Skip to content

An open-source cross-platform alternative to AirDrop

feat: add apk picker

Tien Do Namc8d4a41749d7
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index ea7e6e48..f71b8903 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -11,6 +11,8 @@
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
+ <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
+
<!-- Android TV -->
<uses-feature android:name="android.software.leanback" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
diff --git a/assets/CHANGELOG.md b/assets/CHANGELOG.md
index 8b071a53..58358f56 100644
--- a/assets/CHANGELOG.md
+++ b/assets/CHANGELOG.md
@@ -1,10 +1,11 @@
## 1.8.0 (2023-)
-- feat: Android TV support
+- feat(android): share apk
+- feat(android): Android TV support
- feat: add troubleshoot page
- feat(windows): left click on tray icon opens app
-- fix: missing app icon on Android 7
-- i18n: add ua
+- fix(android): missing app icon on Android 7
+- i18n: add uk
## 1.7.0 (2023-02-11)
diff --git a/assets/i18n/_missing_translations_ar.json b/assets/i18n/_missing_translations_ar.json
index 36fbf783..341c48f8 100644
--- a/assets/i18n/_missing_translations_ar.json
+++ b/assets/i18n/_missing_translations_ar.json
@@ -3,6 +3,11 @@
"Here are translations that exist in <en> but not in <ar>.",
"After editing this file, you can run 'flutter pub run slang apply --locale=ar' to quickly apply the newly added translations."
],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
"settingsTab": {
"network": {
"portWarning": "You might not be detected by other devices because you are using a custom port. (default: {defaultPort})",
@@ -35,6 +40,12 @@
"deleteFromHistory": "Delete from history"
}
},
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ },
"sendPage": {
"busy": "The recipient is busy with another request."
},
diff --git a/assets/i18n/_missing_translations_bn.json b/assets/i18n/_missing_translations_bn.json
index f585bdff..81efc78a 100644
--- a/assets/i18n/_missing_translations_bn.json
+++ b/assets/i18n/_missing_translations_bn.json
@@ -3,6 +3,11 @@
"Here are translations that exist in <en> but not in <bn>.",
"After editing this file, you can run 'flutter pub run slang apply --locale=bn' to quickly apply the newly added translations."
],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
"settingsTab": {
"network": {
"multicastGroup": "Multicast",
@@ -33,6 +38,12 @@
"deleteFromHistory": "Delete from history"
}
},
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ },
"sendPage": {
"busy": "The recipient is busy with another request."
},
diff --git a/assets/i18n/_missing_translations_es_ES.json b/assets/i18n/_missing_translations_es_ES.json
index 4d395e7c..54bd83d0 100644
--- a/assets/i18n/_missing_translations_es_ES.json
+++ b/assets/i18n/_missing_translations_es_ES.json
@@ -3,6 +3,11 @@
"Here are translations that exist in <en> but not in <es-ES>.",
"After editing this file, you can run 'flutter pub run slang apply --locale=es-ES' to quickly apply the newly added translations."
],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
"settingsTab": {
"network": {
"multicastGroup": "Multicast",
@@ -24,6 +29,12 @@
"solution": "The problem exists on both sides? Then you need to make sure that both devices are in the same wifi network and share the same configuration (port, multicast address, encryption). The wifi may not allow communication between participants. In this case, this option must be enabled on the router."
}
},
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ },
"sendPage": {
"busy": "The recipient is busy with another request."
},
diff --git a/assets/i18n/_missing_translations_fr_FR.json b/assets/i18n/_missing_translations_fr_FR.json
index 8a8741f4..03d327e2 100644
--- a/assets/i18n/_missing_translations_fr_FR.json
+++ b/assets/i18n/_missing_translations_fr_FR.json
@@ -1,7 +1,17 @@
{
"@@info": [
"Here are translations that exist in <en> but not in <fr-FR>.",
- "After editing this file, you can run 'flutter pub run slang apply --locale=fr-FR' to quickly apply the newly added translations.",
- "Congratulations! There are no missing translations! :)"
- ]
+ "After editing this file, you can run 'flutter pub run slang apply --locale=fr-FR' to quickly apply the newly added translations."
+ ],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ }
}
diff --git a/assets/i18n/_missing_translations_hu.json b/assets/i18n/_missing_translations_hu.json
index 3c29dccc..75a36c5b 100644
--- a/assets/i18n/_missing_translations_hu.json
+++ b/assets/i18n/_missing_translations_hu.json
@@ -1,7 +1,17 @@
{
"@@info": [
"Here are translations that exist in <en> but not in <hu>.",
- "After editing this file, you can run 'flutter pub run slang apply --locale=hu' to quickly apply the newly added translations.",
- "Congratulations! There are no missing translations! :)"
- ]
+ "After editing this file, you can run 'flutter pub run slang apply --locale=hu' to quickly apply the newly added translations."
+ ],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ }
}
diff --git a/assets/i18n/_missing_translations_in.json b/assets/i18n/_missing_translations_in.json
index 7cc7430f..525076b9 100644
--- a/assets/i18n/_missing_translations_in.json
+++ b/assets/i18n/_missing_translations_in.json
@@ -3,6 +3,11 @@
"Here are translations that exist in <en> but not in <in>.",
"After editing this file, you can run 'flutter pub run slang apply --locale=in' to quickly apply the newly added translations."
],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
"settingsTab": {
"network": {
"multicastGroup": "Multicast",
@@ -33,6 +38,12 @@
"deleteFromHistory": "Delete from history"
}
},
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ },
"sendPage": {
"busy": "The recipient is busy with another request."
},
diff --git a/assets/i18n/_missing_translations_it.json b/assets/i18n/_missing_translations_it.json
index c3d2fe12..84ce8861 100644
--- a/assets/i18n/_missing_translations_it.json
+++ b/assets/i18n/_missing_translations_it.json
@@ -3,6 +3,11 @@
"Here are translations that exist in <en> but not in <it>.",
"After editing this file, you can run 'flutter pub run slang apply --locale=it' to quickly apply the newly added translations."
],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
"settingsTab": {
"network": {
"multicastGroup": "Multicast",
@@ -33,6 +38,12 @@
"deleteFromHistory": "Delete from history"
}
},
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ },
"sendPage": {
"busy": "The recipient is busy with another request."
},
diff --git a/assets/i18n/_missing_translations_iw.json b/assets/i18n/_missing_translations_iw.json
index fd613190..890b9c79 100644
--- a/assets/i18n/_missing_translations_iw.json
+++ b/assets/i18n/_missing_translations_iw.json
@@ -3,6 +3,11 @@
"Here are translations that exist in <en> but not in <iw>.",
"After editing this file, you can run 'flutter pub run slang apply --locale=iw' to quickly apply the newly added translations."
],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
"settingsTab": {
"network": {
"portWarning": "You might not be detected by other devices because you are using a custom port. (default: {defaultPort})",
@@ -35,6 +40,12 @@
"deleteFromHistory": "Delete from history"
}
},
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ },
"sendPage": {
"busy": "The recipient is busy with another request."
},
diff --git a/assets/i18n/_missing_translations_ja.json b/assets/i18n/_missing_translations_ja.json
index 754e70e3..8a63a012 100644
--- a/assets/i18n/_missing_translations_ja.json
+++ b/assets/i18n/_missing_translations_ja.json
@@ -1,7 +1,17 @@
{
"@@info": [
"Here are translations that exist in <en> but not in <ja>.",
- "After editing this file, you can run 'flutter pub run slang apply --locale=ja' to quickly apply the newly added translations.",
- "Congratulations! There are no missing translations! :)"
- ]
+ "After editing this file, you can run 'flutter pub run slang apply --locale=ja' to quickly apply the newly added translations."
+ ],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ }
}
diff --git a/assets/i18n/_missing_translations_ko.json b/assets/i18n/_missing_translations_ko.json
index 1f673ec5..9ddc8853 100644
--- a/assets/i18n/_missing_translations_ko.json
+++ b/assets/i18n/_missing_translations_ko.json
@@ -3,6 +3,11 @@
"Here are translations that exist in <en> but not in <ko>.",
"After editing this file, you can run 'flutter pub run slang apply --locale=ko' to quickly apply the newly added translations."
],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
"settingsTab": {
"network": {
"multicastGroup": "Multicast",
@@ -33,6 +38,12 @@
"deleteFromHistory": "Delete from history"
}
},
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ },
"sendPage": {
"busy": "The recipient is busy with another request."
},
diff --git a/assets/i18n/_missing_translations_ne.json b/assets/i18n/_missing_translations_ne.json
index e7b6bb9d..3f461931 100644
--- a/assets/i18n/_missing_translations_ne.json
+++ b/assets/i18n/_missing_translations_ne.json
@@ -3,6 +3,11 @@
"Here are translations that exist in <en> but not in <ne>.",
"After editing this file, you can run 'flutter pub run slang apply --locale=ne' to quickly apply the newly added translations."
],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
"settingsTab": {
"network": {
"portWarning": "You might not be detected by other devices because you are using a custom port. (default: {defaultPort})",
@@ -35,6 +40,12 @@
"deleteFromHistory": "Delete from history"
}
},
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ },
"sendPage": {
"busy": "The recipient is busy with another request."
},
diff --git a/assets/i18n/_missing_translations_pl.json b/assets/i18n/_missing_translations_pl.json
index 72cb59e4..957211f9 100644
--- a/assets/i18n/_missing_translations_pl.json
+++ b/assets/i18n/_missing_translations_pl.json
@@ -3,6 +3,11 @@
"Here are translations that exist in <en> but not in <pl>.",
"After editing this file, you can run 'flutter pub run slang apply --locale=pl' to quickly apply the newly added translations."
],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
"settingsTab": {
"network": {
"portWarning": "You might not be detected by other devices because you are using a custom port. (default: {defaultPort})",
@@ -35,6 +40,12 @@
"deleteFromHistory": "Delete from history"
}
},
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ },
"sendPage": {
"busy": "The recipient is busy with another request."
},
diff --git a/assets/i18n/_missing_translations_pt_BR.json b/assets/i18n/_missing_translations_pt_BR.json
index 5835f442..f794772c 100644
--- a/assets/i18n/_missing_translations_pt_BR.json
+++ b/assets/i18n/_missing_translations_pt_BR.json
@@ -3,6 +3,11 @@
"Here are translations that exist in <en> but not in <pt-BR>.",
"After editing this file, you can run 'flutter pub run slang apply --locale=pt-BR' to quickly apply the newly added translations."
],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
"settingsTab": {
"network": {
"multicastGroup": "Multicast",
@@ -24,6 +29,12 @@
"solution": "The problem exists on both sides? Then you need to make sure that both devices are in the same wifi network and share the same configuration (port, multicast address, encryption). The wifi may not allow communication between participants. In this case, this option must be enabled on the router."
}
},
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ },
"sendPage": {
"busy": "The recipient is busy with another request."
},
diff --git a/assets/i18n/_missing_translations_ru.json b/assets/i18n/_missing_translations_ru.json
index d7e57750..2376e670 100644
--- a/assets/i18n/_missing_translations_ru.json
+++ b/assets/i18n/_missing_translations_ru.json
@@ -3,6 +3,11 @@
"Here are translations that exist in <en> but not in <ru>.",
"After editing this file, you can run 'flutter pub run slang apply --locale=ru' to quickly apply the newly added translations."
],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
"settingsTab": {
"network": {
"portWarning": "You might not be detected by other devices because you are using a custom port. (default: {defaultPort})",
@@ -35,6 +40,12 @@
"deleteFromHistory": "Delete from history"
}
},
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ },
"sendPage": {
"busy": "The recipient is busy with another request."
},
diff --git a/assets/i18n/_missing_translations_sv.json b/assets/i18n/_missing_translations_sv.json
index 6764a9d9..fe0e8184 100644
--- a/assets/i18n/_missing_translations_sv.json
+++ b/assets/i18n/_missing_translations_sv.json
@@ -3,6 +3,11 @@
"Here are translations that exist in <en> but not in <sv>.",
"After editing this file, you can run 'flutter pub run slang apply --locale=sv' to quickly apply the newly added translations."
],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
"settingsTab": {
"network": {
"portWarning": "You might not be detected by other devices because you are using a custom port. (default: {defaultPort})",
@@ -35,6 +40,12 @@
"deleteFromHistory": "Delete from history"
}
},
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ },
"sendPage": {
"busy": "The recipient is busy with another request."
},
diff --git a/assets/i18n/_missing_translations_tr.json b/assets/i18n/_missing_translations_tr.json
index cee30a4f..234dcfda 100644
--- a/assets/i18n/_missing_translations_tr.json
+++ b/assets/i18n/_missing_translations_tr.json
@@ -3,6 +3,11 @@
"Here are translations that exist in <en> but not in <tr>.",
"After editing this file, you can run 'flutter pub run slang apply --locale=tr' to quickly apply the newly added translations."
],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
"settingsTab": {
"network": {
"multicastGroup": "Multicast",
@@ -23,5 +28,11 @@
"symptom": "Both devices cannot discover each other nor can they share files.",
"solution": "The problem exists on both sides? Then you need to make sure that both devices are in the same wifi network and share the same configuration (port, multicast address, encryption). The wifi may not allow communication between participants. In this case, this option must be enabled on the router."
}
+ },
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
}
}
diff --git a/assets/i18n/_missing_translations_ua.json b/assets/i18n/_missing_translations_uk.json
similarity index 86%
rename from assets/i18n/_missing_translations_ua.json
rename to assets/i18n/_missing_translations_uk.json
index 0da34972..94fadb3f 100644
--- a/assets/i18n/_missing_translations_ua.json
+++ b/assets/i18n/_missing_translations_uk.json
@@ -1,8 +1,13 @@
{
"@@info": [
- "Here are translations that exist in <en> but not in <ua>.",
- "After editing this file, you can run 'flutter pub run slang apply --locale=ua' to quickly apply the newly added translations."
+ "Here are translations that exist in <en> but not in <uk>.",
+ "After editing this file, you can run 'flutter pub run slang apply --locale=uk' to quickly apply the newly added translations."
],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
"settingsTab": {
"network": {
"portWarning": "You might not be detected by other devices because you are using a custom port. (default: {defaultPort})",
@@ -35,6 +40,12 @@
"deleteFromHistory": "Delete from history"
}
},
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ },
"sendPage": {
"busy": "The recipient is busy with another request."
},
diff --git a/assets/i18n/_missing_translations_zh_Hans.json b/assets/i18n/_missing_translations_zh_Hans.json
index e76443c3..199f3c86 100644
--- a/assets/i18n/_missing_translations_zh_Hans.json
+++ b/assets/i18n/_missing_translations_zh_Hans.json
@@ -1,7 +1,17 @@
{
"@@info": [
"Here are translations that exist in <en> but not in <zh-Hans>.",
- "After editing this file, you can run 'flutter pub run slang apply --locale=zh-Hans' to quickly apply the newly added translations.",
- "Congratulations! There are no missing translations! :)"
- ]
+ "After editing this file, you can run 'flutter pub run slang apply --locale=zh-Hans' to quickly apply the newly added translations."
+ ],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ }
}
diff --git a/assets/i18n/_missing_translations_zh_Hant_HK.json b/assets/i18n/_missing_translations_zh_Hant_HK.json
index e514836c..0f72a761 100644
--- a/assets/i18n/_missing_translations_zh_Hant_HK.json
+++ b/assets/i18n/_missing_translations_zh_Hant_HK.json
@@ -3,6 +3,11 @@
"Here are translations that exist in <en> but not in <zh-Hant-HK>.",
"After editing this file, you can run 'flutter pub run slang apply --locale=zh-Hant-HK' to quickly apply the newly added translations."
],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
"settingsTab": {
"network": {
"portWarning": "You might not be detected by other devices because you are using a custom port. (default: {defaultPort})",
@@ -35,6 +40,12 @@
"deleteFromHistory": "Delete from history"
}
},
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ },
"sendPage": {
"busy": "The recipient is busy with another request."
},
diff --git a/assets/i18n/_missing_translations_zh_Hant_TW.json b/assets/i18n/_missing_translations_zh_Hant_TW.json
index ba9ae28a..9f9170d4 100644
--- a/assets/i18n/_missing_translations_zh_Hant_TW.json
+++ b/assets/i18n/_missing_translations_zh_Hant_TW.json
@@ -1,7 +1,17 @@
{
"@@info": [
"Here are translations that exist in <en> but not in <zh-Hant-TW>.",
- "After editing this file, you can run 'flutter pub run slang apply --locale=zh-Hant-TW' to quickly apply the newly added translations.",
- "Congratulations! There are no missing translations! :)"
- ]
+ "After editing this file, you can run 'flutter pub run slang apply --locale=zh-Hant-TW' to quickly apply the newly added translations."
+ ],
+ "sendTab": {
+ "picker": {
+ "app": "App"
+ }
+ },
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ }
}
diff --git a/assets/i18n/_unused_translations.json b/assets/i18n/_unused_translations.json
index d4b8ac6c..24e79c5d 100644
--- a/assets/i18n/_unused_translations.json
+++ b/assets/i18n/_unused_translations.json
@@ -27,7 +27,7 @@
"ru": {},
"sv": {},
"tr": {},
- "ua": {},
+ "uk": {},
"zh-Hans": {},
"zh-Hant-HK": {},
"zh-Hant-TW": {}
diff --git a/assets/i18n/strings.i18n.json b/assets/i18n/strings.i18n.json
index c920e74c..2e623db0 100644
--- a/assets/i18n/strings.i18n.json
+++ b/assets/i18n/strings.i18n.json
@@ -55,7 +55,8 @@
"picker": {
"file": "File",
"media": "Media",
- "text": "Text"
+ "text": "Text",
+ "app": "App"
},
"shareIntentInfo": "You can also use the \"Share\" feature of your mobile device to select files more easily.",
"nearbyDevices": "Nearby devices",
@@ -124,6 +125,12 @@
"deleteFromHistory": "Delete from history"
}
},
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "Exclude system apps",
+ "excludeAppsWithoutLaunchIntent": "Exclude non-launchable apps",
+ "apps": "{n} Apps"
+ },
"selectedFilesPage": {
"deleteAll": "Delete all"
},
diff --git a/assets/i18n/strings_de.i18n.json b/assets/i18n/strings_de.i18n.json
index 3853f3d7..275dc176 100644
--- a/assets/i18n/strings_de.i18n.json
+++ b/assets/i18n/strings_de.i18n.json
@@ -55,7 +55,8 @@
"picker": {
"file": "Datei",
"media": "Medien",
- "text": "Text"
+ "text": "Text",
+ "app": "App"
},
"shareIntentInfo": "Du kannst auch die \"Teilen\"-Funktion deines mobilen Geräts nutzen, um Dateien einfacher auszuwählen.",
"nearbyDevices": "Geräte in der Nähe",
@@ -124,6 +125,12 @@
"deleteFromHistory": "Vom Verlauf entfernen"
}
},
+ "apkPickerPage": {
+ "title": "Apps (APK)",
+ "excludeSystemApps": "System-Apps ausschließen",
+ "excludeAppsWithoutLaunchIntent": "Nicht-startbare Apps ausschließen",
+ "apps": "{n} Apps"
+ },
"selectedFilesPage": {
"deleteAll": "Alle löschen"
},
@@ -168,7 +175,7 @@
"changelogPage": {
"title": "Changelog"
},
- "aliasGenerator": {
+ "aliasGenerator(ignoreMissing)": {
"@info": "Inherits from the English version"
},
"dialogs": {
diff --git a/assets/i18n/strings_it.i18n.json b/assets/i18n/strings_it.i18n.json
index e9fd4eb5..f67e7ee5 100644
--- a/assets/i18n/strings_it.i18n.json
+++ b/assets/i18n/strings_it.i18n.json
@@ -54,7 +54,7 @@
},
"picker": {
"file": "File",
- "media": "Multimedia",
+ "media": "Media",
"text": "Testo"
},
"shareIntentInfo": "Puoi anche usare la funzionalità \"Condividi\" sul tuo dispositivo mobile per selezionare file in modo più semplice.",
diff --git a/assets/i18n/strings_ua.i18n.json b/assets/i18n/strings_uk.i18n.json
similarity index 100%
rename from assets/i18n/strings_ua.i18n.json
rename to assets/i18n/strings_uk.i18n.json
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 168806bd..0f5ab941 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -66,6 +66,7 @@
<string>ru</string>
<string>sv</string>
<string>tr</string>
+ <string>uk</string>
<string>zh-Hans</string>
<string>zh-Hant-HK</string>
<string>zh-Hant-TW</string>
diff --git a/lib/model/cross_file.dart b/lib/model/cross_file.dart
index 414a8b66..543129c6 100644
--- a/lib/model/cross_file.dart
+++ b/lib/model/cross_file.dart
@@ -1,3 +1,5 @@
+import 'dart:typed_data';
+
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:localsend_app/model/file_type.dart';
import 'package:wechat_assets_picker/wechat_assets_picker.dart';
@@ -12,6 +14,7 @@ class CrossFile with _$CrossFile {
required String name,
required FileType fileType,
required int size,
+ required Uint8List? thumbnail,
required AssetEntity? asset, // for thumbnails
required String? path,
required List<int>? bytes, // if type message, then UTF-8 encoded
diff --git a/lib/model/dto/file_dto.dart b/lib/model/dto/file_dto.dart
index 83f1b8be..da8da5da 100644
--- a/lib/model/dto/file_dto.dart
+++ b/lib/model/dto/file_dto.dart
@@ -8,9 +8,15 @@ part 'file_dto.g.dart';
class FileDto with _$FileDto {
const factory FileDto({
required String id, // unique inside send session
+
required String fileName,
+
required int size,
+
+ // ignore: invalid_annotation_target
+ @JsonKey(unknownEnumValue: FileType.other)
required FileType fileType,
+
required String? preview,
}) = _FileDto;
diff --git a/lib/model/dto/info_dto.dart b/lib/model/dto/info_dto.dart
index dab21c8c..4168998e 100644
--- a/lib/model/dto/info_dto.dart
+++ b/lib/model/dto/info_dto.dart
@@ -9,6 +9,9 @@ class InfoDto with _$InfoDto {
const factory InfoDto({
required String alias,
required String? deviceModel,
+
+ // ignore: invalid_annotation_target
+ @JsonKey(unknownEnumValue: DeviceType.desktop)
required DeviceType deviceType,
}) = _InfoDto;
diff --git a/lib/model/file_type.dart b/lib/model/file_type.dart
index 66e3cb4d..be68eb20 100644
--- a/lib/model/file_type.dart
+++ b/lib/model/file_type.dart
@@ -7,6 +7,7 @@ enum FileType {
video(Icons.movie),
pdf(Icons.description),
text(Icons.subject),
+ apk(Icons.android),
other(Icons.file_present_sharp);
const FileType(this.icon);
diff --git a/lib/pages/apk_picker_page.dart b/lib/pages/apk_picker_page.dart
new file mode 100644
index 00000000..bee9b8e6
--- /dev/null
+++ b/lib/pages/apk_picker_page.dart
@@ -0,0 +1,172 @@
+import 'package:device_apps/device_apps.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:localsend_app/gen/strings.g.dart';
+import 'package:localsend_app/model/file_type.dart';
+import 'package:localsend_app/provider/apk_provider.dart';
+import 'package:localsend_app/provider/param/apk_provider_param.dart';
+import 'package:localsend_app/provider/selection/selected_sending_files_provider.dart';
+import 'package:localsend_app/util/file_size_helper.dart';
+import 'package:localsend_app/widget/file_thumbnail.dart';
+import 'package:localsend_app/widget/responsive_list_view.dart';
+import 'package:localsend_app/widget/sliver/sliver_pinned_header.dart';
+import 'package:routerino/routerino.dart';
+
+class ApkPickerPage extends ConsumerStatefulWidget {
+ const ApkPickerPage({Key? key}) : super(key: key);
+
+ @override
+ ConsumerState<ApkPickerPage> createState() => _ApkPickerPageState();
+}
+
+class _ApkPickerPageState extends ConsumerState<ApkPickerPage> {
+ String _query = '';
+ bool _includeSystemApps = false;
+ bool _onlyAppsWithLaunchIntent = true;
+
+ @override
+ Widget build(BuildContext context) {
+ final apkAsync = ref.watch(apkProvider(ApkProviderParam(
+ query: _query,
+ includeSystemApps: _includeSystemApps,
+ onlyAppsWithLaunchIntent: _onlyAppsWithLaunchIntent,
+ )));
+
+ return Scaffold(
+ appBar: AppBar(
+ title: Text(t.apkPickerPage.title),
+ actions: [
+ PopupMenuButton(
+ itemBuilder: (context) {
+ return [
+ CheckedPopupMenuItem<int>(
+ value: 0,
+ checked: !_includeSystemApps,
+ child: Text(t.apkPickerPage.excludeSystemApps),
+ ),
+ CheckedPopupMenuItem<int>(
+ value: 1,
+ checked: _onlyAppsWithLaunchIntent,
+ child: Text(t.apkPickerPage.excludeAppsWithoutLaunchIntent),
+ ),
+ ];
+ }, onSelected: (value) {
+ switch(value) {
+ case 0:
+ setState(() => _includeSystemApps = !_includeSystemApps);
+ break;
+ case 1:
+ setState(() => _onlyAppsWithLaunchIntent = !_onlyAppsWithLaunchIntent);
+ break;
+ }
+ }),
+ ],
+ ),
+ body: ResponsiveListView.single(
+ padding: const EdgeInsets.symmetric(horizontal: 15),
+ child: CustomScrollView(
+ slivers: [
+ const SliverToBoxAdapter(
+ child: SizedBox(height: 10),
+ ),
+ SliverPinnedHeader(
+ height: 80,
+ child: Padding(
+ padding: const EdgeInsets.only(top: 10),
+ child: TextField(
+ autofocus: true,
+ onChanged: (s) {
+ setState(() => _query = s);
+ },
+ decoration: InputDecoration(
+ fillColor: ElevationOverlay.applySurfaceTint(
+ Theme.of(context).inputDecorationTheme.fillColor!,
+ Theme.of(context).colorScheme.surfaceTint,
+ 3,
+ ),
+ suffixIcon: const Icon(Icons.search),
+ ),
+ ),
+ ),
+ ),
+ SliverToBoxAdapter(
+ child: Text(t.apkPickerPage.apps(n: apkAsync.value?.length ?? 0)),
+ ),
+ const SliverToBoxAdapter(
+ child: SizedBox(height: 10),
+ ),
+ apkAsync.when(
+ data: (appList) {
+ return SliverList(
+ delegate: SliverChildBuilderDelegate(
+ (context, index) {
+ final app = appList[index];
+ final thumbnail = (app as ApplicationWithIcon).icon;
+
+ return Padding(
+ padding: const EdgeInsets.only(bottom: 10),
+ child: InkWell(
+ onTap: () {
+ ref.read(selectedSendingFilesProvider.notifier).addFiles(files: [app], converter: CrossFileConverters.convertApplication);
+ context.pop();
+ },
+ customBorder: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(10),
+ ),
+ child: Row(
+ children: [
+ MemoryThumbnail(
+ bytes: thumbnail,
+ fileType: FileType.apk,
+ ),
+ const SizedBox(width: 10),
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ app.appName,
+ maxLines: 1,
+ overflow: TextOverflow.fade,
+ softWrap: false,
+ ),
+ Consumer(
+ builder: (context, ref, _) {
+ print('read: ${app.appName}');
+ final appSize = ref.watch(apkSizeProvider(app.apkFilePath));
+ final appSizeString = appSize.maybeWhen(
+ data: (size) => '${size.asReadableFileSize} - ',
+ orElse: () => '',
+ );
+ return Text('$appSizeString${app.versionName ?? '?'} - ${app.packageName}', style: Theme.of(context).textTheme.caption);
+ },
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ },
+ childCount: appList.length,
+ ),
+ );
+ },
+ error: (e, st) {
+ return SliverToBoxAdapter(child: Text('Error: $e\n$st'));
+ },
+ loading: () {
+ return const SliverToBoxAdapter(
+ child: Center(
+ child: CircularProgressIndicator(),
+ ),
+ );
+ },
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/pages/tabs/send_tab.dart b/lib/pages/tabs/send_tab.dart
index 5b605538..bb804d5f 100644
--- a/lib/pages/tabs/send_tab.dart
+++ b/lib/pages/tabs/send_tab.dart
@@ -24,6 +24,8 @@ import 'package:localsend_app/widget/responsive_list_view.dart';
import 'package:localsend_app/widget/rotating_widget.dart';
import 'package:routerino/routerino.dart';
+const _horizontalPadding = 15.0;
+
class SendTab extends ConsumerStatefulWidget {
const SendTab({Key? key}) : super(key: key);
@@ -55,50 +57,47 @@ class _SendTabState extends ConsumerState<SendTab> {
FilePickerOption.file,
if (checkPlatformWithGallery()) FilePickerOption.media,
FilePickerOption.text,
+ if (checkPlatform([TargetPlatform.android])) FilePickerOption.app,
];
return ResponsiveListView(
- padding: const EdgeInsets.symmetric(horizontal: 15),
+ padding: EdgeInsets.zero,
children: [
const SizedBox(height: 20),
if (selectedFiles.isEmpty) ...[
Padding(
- padding: const EdgeInsets.only(bottom: 10),
+ padding: const EdgeInsets.symmetric(horizontal: _horizontalPadding),
child: Text(
t.sendTab.selection.title,
style: Theme.of(context).textTheme.subtitle1,
),
),
- IntrinsicHeight(
+ SingleChildScrollView(
+ scrollDirection: Axis.horizontal,
child: Row(
- crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
- ...List.generate(3, (index) {
- final option = index < addOptions.length ? addOptions[index] : null;
- return [
- Expanded(
- child: option == null
- ? Container()
- : BigButton(
- icon: option.icon,
- label: option.label,
- filled: false,
- onTap: () => option.select(
- context: context,
- ref: ref,
- ),
- ),
+ const SizedBox(width: 10),
+ ...addOptions.map((option) {
+ return Padding(
+ padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 5),
+ child: BigButton(
+ icon: option.icon,
+ label: option.label,
+ filled: false,
+ onTap: () => option.select(
+ context: context,
+ ref: ref,
+ ),
),
- const SizedBox(width: 15),
- ];
- }).expand((e) => e).toList()
- ..removeLast(),
+ );
+ }),
+ const SizedBox(width: 10),
],
),
),
] else ...[
Card(
- margin: EdgeInsets.zero,
+ margin: const EdgeInsets.only(bottom: 10, left: _horizontalPadding, right: _horizontalPadding),
child: Padding(
padding: const EdgeInsets.all(15),
child: Column(
@@ -165,9 +164,9 @@ class _SendTabState extends ConsumerState<SendTab> {
),
),
],
- const SizedBox(height: 10),
Row(
children: [
+ const SizedBox(width: _horizontalPadding),
Flexible(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
@@ -215,7 +214,7 @@ class _SendTabState extends ConsumerState<SendTab> {
),
if (networkInfo.localIps.length > 1)
Padding(
- padding: const EdgeInsets.only(bottom: 15),
+ padding: const EdgeInsets.only(bottom: 15, left: _horizontalPadding, right: _horizontalPadding),
child: Wrap(
spacing: 15,
runSpacing: 15,
@@ -245,17 +244,20 @@ class _SendTabState extends ConsumerState<SendTab> {
}).toList(),
),
),
- Hero(
- tag: 'this-device',
- child: DeviceListTile(
- device: myDevice,
- thisDevice: true,
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: _horizontalPadding),
+ child: Hero(
+ tag: 'this-device',
+ child: DeviceListTile(
+ device: myDevice,
+ thisDevice: true,
+ ),
),
),
const SizedBox(height: 10),
...nearbyDevicesState.devices.values.map((device) {
return Padding(
- padding: const EdgeInsets.only(bottom: 10),
+ padding: const EdgeInsets.only(bottom: 10, left: _horizontalPadding, right: _horizontalPadding),
child: Hero(
tag: 'device-${device.ip}',
child: DeviceListTile(
@@ -277,13 +279,16 @@ class _SendTabState extends ConsumerState<SendTab> {
);
}),
const SizedBox(height: 20),
- OpacitySlideshow(
- durationMillis: 6000,
- children: [
- Text(t.sendTab.help, style: const TextStyle(color: Colors.grey), textAlign: TextAlign.center),
- if (checkPlatformCanReceiveShareIntent())
- Text(t.sendTab.shareIntentInfo, style: const TextStyle(color: Colors.grey), textAlign: TextAlign.center),
- ],
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: _horizontalPadding),
+ child: OpacitySlideshow(
+ durationMillis: 6000,
+ children: [
+ Text(t.sendTab.help, style: const TextStyle(color: Colors.grey), textAlign: TextAlign.center),
+ if (checkPlatformCanReceiveShareIntent())
+ Text(t.sendTab.shareIntentInfo, style: const TextStyle(color: Colors.grey), textAlign: TextAlign.center),
+ ],
+ ),
),
const SizedBox(height: 50),
],
diff --git a/lib/provider/apk_provider.dart b/lib/provider/apk_provider.dart
new file mode 100644
index 00000000..9c2c89a5
--- /dev/null
+++ b/lib/provider/apk_provider.dart
@@ -0,0 +1,33 @@
+import 'dart:io';
+
+import 'package:device_apps/device_apps.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:localsend_app/provider/param/apk_provider_param.dart';
+import 'package:localsend_app/provider/param/cached_apk_provider_param.dart';
+
+final apkProvider = Provider.family.autoDispose<AsyncValue<List<Application>>, ApkProviderParam>((ref, param) {
+ return ref.watch(_apkProvider(CachedApkProviderParam(
+ includeSystemApps: param.includeSystemApps,
+ onlyAppsWithLaunchIntent: param.onlyAppsWithLaunchIntent,
+ ))).whenData((apps) {
+ final query = param.query.trim().toLowerCase();
+ if (query.isNotEmpty) {
+ apps = apps.where((a) => a.appName.contains(query) || a.packageName.contains(query)).toList();
+ }
+
+ return apps..sort((a, b) => a.appName.compareTo(b.appName));
+ });
+});
+
+final apkSizeProvider = FutureProvider.family<int, String>((_, path) {
+ return File(path).length();
+});
+
+/// Provides a list of APKs which is cached
+final _apkProvider = FutureProvider.family<List<Application>, CachedApkProviderParam>((_, param) {
+ return DeviceApps.getInstalledApplications(
+ includeSystemApps: param.includeSystemApps,
+ onlyAppsWithLaunchIntent: param.onlyAppsWithLaunchIntent,
+ includeAppIcons: true,
+ );
+});
diff --git a/lib/provider/param/apk_provider_param.dart b/lib/provider/param/apk_provider_param.dart
new file mode 100644
index 00000000..857610f3
--- /dev/null
+++ b/lib/provider/param/apk_provider_param.dart
@@ -0,0 +1,12 @@
+import 'package:freezed_annotation/freezed_annotation.dart';
+
+part 'apk_provider_param.freezed.dart';
+
+@freezed
+class ApkProviderParam with _$ApkProviderParam {
+ const factory ApkProviderParam({
+ required String query,
+ required bool includeSystemApps,
+ required bool onlyAppsWithLaunchIntent,
+ }) = _ApkProviderParam;
+}
diff --git a/lib/provider/param/cached_apk_provider_param.dart b/lib/provider/param/cached_apk_provider_param.dart
new file mode 100644
index 00000000..b0e5fe57
--- /dev/null
+++ b/lib/provider/param/cached_apk_provider_param.dart
@@ -0,0 +1,11 @@
+import 'package:freezed_annotation/freezed_annotation.dart';
+
+part 'cached_apk_provider_param.freezed.dart';
+
+@freezed
+class CachedApkProviderParam with _$CachedApkProviderParam {
+ const factory CachedApkProviderParam({
+ required bool includeSystemApps,
+ required bool onlyAppsWithLaunchIntent,
+ }) = _CachedApkProviderParam;
+}
diff --git a/lib/provider/selection/selected_sending_files_provider.dart b/lib/provider/selection/selected_sending_files_provider.dart
index 21c92aa9..d71a1275 100644
--- a/lib/provider/selection/selected_sending_files_provider.dart
+++ b/lib/provider/selection/selected_sending_files_provider.dart
@@ -1,6 +1,7 @@
import 'dart:convert' show utf8;
import 'dart:io';
+import 'package:device_apps/device_apps.dart';
import 'package:file_picker/file_picker.dart' as file_picker;
import 'package:flutter/foundation.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
@@ -33,6 +34,7 @@ class SelectedSendingFilesNotifier extends StateNotifier<List<CrossFile>> {
name: '${_uuid.v4()}.txt',
fileType: FileType.text,
size: bytes.length,
+ thumbnail: null,
asset: null,
path: null,
bytes: bytes,
@@ -69,6 +71,7 @@ class CrossFileConverters {
name: file.name,
fileType: file.name.guessFileType(),
size: file.size,
+ thumbnail: null,
asset: null,
path: kIsWeb ? null : file.path,
bytes: kIsWeb ? file.bytes! : null,
@@ -81,6 +84,7 @@ class CrossFileConverters {
name: await asset.titleAsync,
fileType: asset.type == AssetType.video ? FileType.video : FileType.image,
size: await file.length(),
+ thumbnail: null,
asset: asset,
path: file.path,
bytes: null,
@@ -92,6 +96,7 @@ class CrossFileConverters {
name: file.name,
fileType: file.name.guessFileType(),
size: await file.length(),
+ thumbnail: null,
asset: null,
path: kIsWeb ? null : file.path,
bytes: kIsWeb ? await file.readAsBytes() : null, // we can fetch it now because in Web it is already there
@@ -105,9 +110,23 @@ class CrossFileConverters {
name: fileName,
fileType: fileName.guessFileType(),
size: await file.length(),
+ thumbnail: null,
asset: null,
path: file.path,
bytes: null,
);
}
+
+ static Future<CrossFile> convertApplication(Application app) async {
+ final file = File(app.apkFilePath);
+ return CrossFile(
+ name: '${app.appName}.apk',
+ fileType: FileType.apk,
+ thumbnail: app is ApplicationWithIcon ? app.icon : null,
+ size: await file.length(),
+ asset: null,
+ path: app.apkFilePath,
+ bytes: null,
+ );
+ }
}
diff --git a/lib/util/file_picker.dart b/lib/util/file_picker.dart
index 28472825..f6fce81b 100644
--- a/lib/util/file_picker.dart
+++ b/lib/util/file_picker.dart
@@ -2,14 +2,17 @@ import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:localsend_app/gen/strings.g.dart';
+import 'package:localsend_app/pages/apk_picker_page.dart';
import 'package:localsend_app/provider/selection/selected_sending_files_provider.dart';
import 'package:localsend_app/widget/dialogs/message_input_dialog.dart';
+import 'package:routerino/routerino.dart';
import 'package:wechat_assets_picker/wechat_assets_picker.dart';
enum FilePickerOption {
file(Icons.description),
media(Icons.image),
- text(Icons.subject);
+ text(Icons.subject),
+ app(Icons.apps);
const FilePickerOption(this.icon);
@@ -23,6 +26,8 @@ enum FilePickerOption {
return t.sendTab.picker.media;
case FilePickerOption.text:
return t.sendTab.picker.text;
+ case FilePickerOption.app:
+ return t.sendTab.picker.app;
}
}
@@ -60,6 +65,10 @@ enum FilePickerOption {
ref.read(selectedSendingFilesProvider.notifier).addMessage(result);
}
break;
+ case FilePickerOption.app:
+ // Currently, only Android APK
+ context.push(() => const ApkPickerPage());
+ break;
}
}
}
diff --git a/lib/widget/big_button.dart b/lib/widget/big_button.dart
index 1acbf1ea..9d0d2497 100644
--- a/lib/widget/big_button.dart
+++ b/lib/widget/big_button.dart
@@ -15,26 +15,31 @@ class BigButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return ElevatedButton(
- style: ElevatedButton.styleFrom(
- backgroundColor: filled ? Theme.of(context).colorScheme.primary : null,
- foregroundColor: filled ? Theme.of(context).colorScheme.onPrimary : null,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(10),
- ),
+ return ConstrainedBox(
+ constraints: const BoxConstraints(
+ maxWidth: 90,
+ minWidth: 90,
+ minHeight: 65,
),
- onPressed: onTap,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- Icon(icon),
- const SizedBox(height: 5),
- Expanded(
- child: FittedBox(
+ child: ElevatedButton(
+ style: ElevatedButton.styleFrom(
+ backgroundColor: filled ? Theme.of(context).colorScheme.primary : null,
+ foregroundColor: filled ? Theme.of(context).colorScheme.onPrimary : null,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(10),
+ ),
+ ),
+ onPressed: onTap,
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Icon(icon),
+ const SizedBox(height: 5),
+ FittedBox(
child: Text(label, maxLines: 1),
),
- ),
- ],
+ ],
+ ),
),
);
}
diff --git a/lib/widget/dialogs/add_file_dialog.dart b/lib/widget/dialogs/add_file_dialog.dart
index 5d0e197a..24f4ff76 100644
--- a/lib/widget/dialogs/add_file_dialog.dart
+++ b/lib/widget/dialogs/add_file_dialog.dart
@@ -49,39 +49,24 @@ class AddFileDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return Column(
- mainAxisSize: MainAxisSize.min,
+ return Wrap(
+ spacing: 15,
+ runSpacing: 15,
children: [
- IntrinsicHeight(
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- ...List.generate(3, (index) {
- final option = index < options.length ? options[index] : null;
- return [
- Expanded(
- child: option == null
- ? Container()
- : BigButton(
- icon: option.icon,
- label: option.label,
- filled: true,
- onTap: () {
- context.popUntilRoot();
- option.select(
- context: context,
- ref: parentRef,
- );
- },
- ),
- ),
- const SizedBox(width: 15),
- ];
- }).expand((e) => e).toList()
- ..removeLast(),
- ],
- ),
- ),
+ ...options.map((option) {
+ return BigButton(
+ icon: option.icon,
+ label: option.label,
+ filled: true,
+ onTap: () {
+ context.popUntilRoot();
+ option.select(
+ context: context,
+ ref: parentRef,
+ );
+ },
+ );
+ }),
],
);
}
diff --git a/lib/widget/file_thumbnail.dart b/lib/widget/file_thumbnail.dart
index 9e43563d..66dd379a 100644
--- a/lib/widget/file_thumbnail.dart
+++ b/lib/widget/file_thumbnail.dart
@@ -1,4 +1,5 @@
import 'dart:io';
+import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:localsend_app/model/cross_file.dart';
@@ -12,7 +13,12 @@ class CrossFileThumbnail extends StatelessWidget {
@override
Widget build(BuildContext context) {
- if (file.asset != null) {
+ if (file.thumbnail != null) {
+ return MemoryThumbnail(
+ bytes: file.thumbnail!,
+ fileType: file.fileType,
+ );
+ } else if (file.asset != null) {
return AssetThumbnail(
asset: file.asset!,
fileType: file.fileType,
@@ -37,7 +43,7 @@ class AssetThumbnail extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return _FileThumbnail(
+ return _Thumbnail(
thumbnail: AssetEntityImage(
asset,
isOriginal: false,
@@ -74,18 +80,52 @@ class FilePathThumbnail extends StatelessWidget {
thumbnail = null;
}
- return _FileThumbnail(
+ return _Thumbnail(
+ thumbnail: thumbnail,
+ icon: fileType.icon,
+ );
+ }
+}
+
+class MemoryThumbnail extends StatelessWidget {
+ final Uint8List? bytes;
+ final FileType fileType;
+
+ const MemoryThumbnail({
+ required this.bytes,
+ required this.fileType,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ final Widget? thumbnail;
+ if (bytes != null) {
+ thumbnail = Padding(
+ padding: fileType == FileType.apk ? const EdgeInsets.all(50) : EdgeInsets.zero,
+ child: Image.memory(
+ bytes!,
+ errorBuilder: (_, __, ___) => Padding(
+ padding: const EdgeInsets.all(10),
+ child: Icon(fileType.icon, size: 32),
+ ),
+ ),
+ );
+ } else {
+ thumbnail = null;
+ }
+
+ return _Thumbnail(
thumbnail: thumbnail,
icon: fileType.icon,
);
}
}
-class _FileThumbnail extends StatelessWidget {
+class _Thumbnail extends StatelessWidget {
final Widget? thumbnail;
final IconData? icon;
- const _FileThumbnail({
+ const _Thumbnail({
required this.thumbnail,
required this.icon,
});
diff --git a/lib/widget/responsive_list_view.dart b/lib/widget/responsive_list_view.dart
index 82d76899..6b78bf05 100644
--- a/lib/widget/responsive_list_view.dart
+++ b/lib/widget/responsive_list_view.dart
@@ -8,38 +8,65 @@ class ResponsiveListView extends StatelessWidget {
final ScrollController? controller;
final EdgeInsets padding;
final EdgeInsets desktopPadding;
- final List<Widget> children;
+ final List<Widget>? children;
+ final Widget? child;
+
+ const ResponsiveListView.single({
+ this.maxWidth = defaultMaxWidth,
+ this.controller,
+ required this.padding,
+ EdgeInsets? tabletPadding,
+ required Widget this.child,
+ super.key,
+ }) : desktopPadding = tabletPadding ?? const EdgeInsets.symmetric(horizontal: 10, vertical: 30),
+ children = null;
const ResponsiveListView({
this.maxWidth = defaultMaxWidth,
this.controller,
required this.padding,
EdgeInsets? tabletPadding,
- required this.children,
- Key? key,
+ required List<Widget> this.children,
+ super.key,
}) : desktopPadding = tabletPadding ?? const EdgeInsets.symmetric(horizontal: 10, vertical: 30),
- super(key: key);
+ child = null;
@override
Widget build(BuildContext context) {
- return SingleChildScrollView(
- controller: controller,
- child: Center(
+ if (children != null) {
+ return SingleChildScrollView(
+ controller: controller,
+ child: Center(
+ child: ConstrainedBox(
+ constraints: BoxConstraints(maxWidth: maxWidth),
+ child: ResponsiveBuilder(
+ builder: (sizingInformation) {
+ return Padding(
+ padding: sizingInformation.isDesktop ? desktopPadding : padding,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: children!,
+ ),
+ );
+ },
+ ),
+ ),
+ ),
+ );
+ } else {
+ return Center(
child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: maxWidth),
child: ResponsiveBuilder(
builder: (sizingInformation) {
return Padding(
padding: sizingInformation.isDesktop ? desktopPadding : padding,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: children,
- ),
+ child: child!,
);
},
),
),
- ),
- );
+ );
+ }
}
}
diff --git a/lib/widget/sliver/sliver_pinned_header.dart b/lib/widget/sliver/sliver_pinned_header.dart
new file mode 100644
index 00000000..5c56aafd
--- /dev/null
+++ b/lib/widget/sliver/sliver_pinned_header.dart
@@ -0,0 +1,45 @@
+import 'package:flutter/material.dart';
+
+class SliverPinnedHeader extends StatelessWidget {
+ final double height;
+ final Widget child;
+
+ const SliverPinnedHeader({required this.height, required this.child});
+
+ @override
+ Widget build(BuildContext context) {
+ return SliverPersistentHeader(
+ pinned: true,
+ delegate: _SliverPersistentHeaderDelegate(
+ height: height,
+ child: child,
+ ),
+ );
+ }
+}
+
+class _SliverPersistentHeaderDelegate extends SliverPersistentHeaderDelegate {
+ final double height;
+ final Widget child;
+
+ _SliverPersistentHeaderDelegate({
+ required this.height,
+ required this.child,
+ });
+
+ @override
+ double get minExtent => height;
+
+ @override
+ double get maxExtent => height;
+
+ @override
+ Widget build(BuildContext context, double shrinkOffset, bool overlapsContent) {
+ return SizedBox.expand(child: child);
+ }
+
+ @override
+ bool shouldRebuild(_SliverPersistentHeaderDelegate oldDelegate) {
+ return false;
+ }
+}
diff --git a/macos/Runner/Info.plist b/macos/Runner/Info.plist
index 24ad5c84..f2d16df9 100644
--- a/macos/Runner/Info.plist
+++ b/macos/Runner/Info.plist
@@ -52,6 +52,7 @@
<string>ru</string>
<string>sv</string>
<string>tr</string>
+ <string>uk</string>
<string>zh-Hans</string>
<string>zh-Hant-HK</string>
<string>zh-Hant-TW</string>
diff --git a/pubspec.lock b/pubspec.lock
index 40fa7d09..2f8fec64 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -246,6 +246,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.0"
+ device_apps:
+ dependency: "direct main"
+ description:
+ name: device_apps
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.2.0"
device_info_plus:
dependency: "direct main"
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index 4ee8787b..ec81ca84 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -13,6 +13,7 @@ dependencies:
collection: 1.16.0
connectivity_plus: 3.0.3
desktop_drop: 0.4.0
+ device_apps: 2.2.0
device_info_plus: 8.1.0
dio: 4.0.6
file_picker: 5.2.5
@@ -92,7 +93,7 @@ msix_config:
publisher: CN=0A8E9755-183F-4F0B-823F-1B8C991D7B97
identity_name: 11157TienDoNam.LocalSend
logo_path: assets\img\logo-512.png
- languages: en, ar, de, es-ES, fr-FR, hu, in, it, iw, ja, ko, ne, pl, pt-BR, ru, sv, tr, zh-Hans, zh-Hant-HK, zh-Hant-TW
+ languages: en, ar, de, es-ES, fr-FR, hu, in, it, iw, ja, ko, ne, pl, pt-BR, ru, sv, tr, uk, zh-Hans, zh-Hant-HK, zh-Hant-TW
startup_task:
task_id: localsend
enabled: false
diff --git a/test/unit/model/dto/send_request_dto_test.dart b/test/unit/model/dto/send_request_dto_test.dart
new file mode 100644
index 00000000..c435d1d0
--- /dev/null
+++ b/test/unit/model/dto/send_request_dto_test.dart
@@ -0,0 +1,77 @@
+import 'package:localsend_app/model/device.dart';
+import 'package:localsend_app/model/dto/send_request_dto.dart';
+import 'package:localsend_app/model/file_type.dart';
+import 'package:test/test.dart';
+
+void main() {
+ group('parse SendRequestDto', () {
+ test('should parse valid enums', () {
+ final dto = {
+ 'info': {
+ 'alias': 'Nice Banana',
+ 'deviceModel': 'Samsung',
+ 'deviceType': 'mobile',
+ },
+ 'files': {
+ 'some id': {
+ 'id': 'some id',
+ 'fileName': 'another image.jpg',
+ 'size': 1234,
+ 'fileType': 'image',
+ 'preview': "*preview data*"
+ }
+ }
+ };
+ final parsed = SendRequestDto.fromJson(dto);
+ expect(parsed.info.deviceType, DeviceType.mobile);
+ expect(parsed.files.length, 1);
+ expect(parsed.files.values.first.fileType, FileType.image);
+ });
+
+ test('should fallback deviceType', () {
+ final dto = {
+ 'info': {
+ 'alias': 'Nice Banana',
+ 'deviceModel': 'Samsung',
+ 'deviceType': 'invalidType',
+ },
+ 'files': {
+ 'some id': {
+ 'id': 'some id',
+ 'fileName': 'another image.jpg',
+ 'size': 1234,
+ 'fileType': 'image',
+ 'preview': "*preview data*"
+ }
+ }
+ };
+ final parsed = SendRequestDto.fromJson(dto);
+ expect(parsed.info.deviceType, DeviceType.desktop);
+ expect(parsed.files.length, 1);
+ expect(parsed.files.values.first.fileType, FileType.image);
+ });
+
+ test('should fallback fileType', () {
+ final dto = {
+ 'info': {
+ 'alias': 'Nice Banana',
+ 'deviceModel': 'Samsung',
+ 'deviceType': 'mobile',
+ },
+ 'files': {
+ 'some id': {
+ 'id': 'some id',
+ 'fileName': 'another image.jpg',
+ 'size': 1234,
+ 'fileType': 'superBigImage',
+ 'preview': "*preview data*"
+ }
+ }
+ };
+ final parsed = SendRequestDto.fromJson(dto);
+ expect(parsed.info.deviceType, DeviceType.mobile);
+ expect(parsed.files.length, 1);
+ expect(parsed.files.values.first.fileType, FileType.other);
+ });
+ });
+}