Skip to content

An open-source cross-platform alternative to AirDrop

feat: enable starting text share via command line (#2661)

Guilherme Nandi Tiscoski574a54acdb63
diff --git a/app/lib/provider/selection/selected_sending_files_provider.dart b/app/lib/provider/selection/selected_sending_files_provider.dart
index 27d75a50..0212814e 100644
--- a/app/lib/provider/selection/selected_sending_files_provider.dart
+++ b/app/lib/provider/selection/selected_sending_files_provider.dart
@@ -291,11 +291,16 @@ class LoadSelectionFromArgsAction extends AsyncReduxActionWithResult<SelectedSen
Future<(List<CrossFile>, bool)> reduce() async {
bool filesAdded = false;
bool nextShare = false;
+ bool nextText = false;
for (final arg in args) {
if (arg == '--share') {
nextShare = true;
continue;
}
+ if (arg == '--text' || arg == '-t') {
+ nextText = true;
+ continue;
+ }
if (nextShare) {
nextShare = false;
final json = jsonDecode(arg);
@@ -313,6 +318,14 @@ class LoadSelectionFromArgsAction extends AsyncReduxActionWithResult<SelectedSen
filesAdded = true;
continue;
}
+ if (nextText) {
+ nextText = false;
+ if (arg.trim().isNotEmpty) {
+ dispatch(AddMessageAction(message: arg.trim()));
+ filesAdded = true;
+ }
+ continue;
+ }
if (arg.startsWith('-')) {
continue;
}