mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-10-24 03:13:45 +02:00
Release asset download confirmation even for single choice (#1694)
This commit is contained in:
@@ -717,7 +717,8 @@ class AppsProvider with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<MapEntry<String, String>?> confirmAppFileUrl(
|
Future<MapEntry<String, String>?> confirmAppFileUrl(
|
||||||
App app, BuildContext? context, bool pickAnyAsset) async {
|
App app, BuildContext? context, bool pickAnyAsset,
|
||||||
|
{bool evenIfSingleChoice = false}) async {
|
||||||
var urlsToSelectFrom = app.apkUrls;
|
var urlsToSelectFrom = app.apkUrls;
|
||||||
if (pickAnyAsset) {
|
if (pickAnyAsset) {
|
||||||
urlsToSelectFrom = [...urlsToSelectFrom, ...app.otherAssetUrls];
|
urlsToSelectFrom = [...urlsToSelectFrom, ...app.otherAssetUrls];
|
||||||
@@ -728,7 +729,8 @@ class AppsProvider with ChangeNotifier {
|
|||||||
// get device supported architecture
|
// get device supported architecture
|
||||||
List<String> archs = (await DeviceInfoPlugin().androidInfo).supportedAbis;
|
List<String> archs = (await DeviceInfoPlugin().androidInfo).supportedAbis;
|
||||||
|
|
||||||
if (urlsToSelectFrom.length > 1 && context != null) {
|
if ((urlsToSelectFrom.length > 1 || evenIfSingleChoice) &&
|
||||||
|
context != null) {
|
||||||
appFileUrl = await showDialog(
|
appFileUrl = await showDialog(
|
||||||
// ignore: use_build_context_synchronously
|
// ignore: use_build_context_synchronously
|
||||||
context: context,
|
context: context,
|
||||||
@@ -973,7 +975,8 @@ class AppsProvider with ChangeNotifier {
|
|||||||
if (apps[id]!.app.apkUrls.isNotEmpty ||
|
if (apps[id]!.app.apkUrls.isNotEmpty ||
|
||||||
apps[id]!.app.otherAssetUrls.isNotEmpty) {
|
apps[id]!.app.otherAssetUrls.isNotEmpty) {
|
||||||
// ignore: use_build_context_synchronously
|
// ignore: use_build_context_synchronously
|
||||||
fileUrl = await confirmAppFileUrl(apps[id]!.app, context, true);
|
fileUrl = await confirmAppFileUrl(apps[id]!.app, context, true,
|
||||||
|
evenIfSingleChoice: true);
|
||||||
}
|
}
|
||||||
if (fileUrl != null) {
|
if (fileUrl != null) {
|
||||||
filesToDownload.add(MapEntry(fileUrl, apps[id]!.app));
|
filesToDownload.add(MapEntry(fileUrl, apps[id]!.app));
|
||||||
@@ -1650,7 +1653,9 @@ class _AppFilePickerState extends State<AppFilePicker> {
|
|||||||
? tr('selectX', args: [tr('releaseAsset').toLowerCase()])
|
? tr('selectX', args: [tr('releaseAsset').toLowerCase()])
|
||||||
: tr('pickAnAPK')),
|
: tr('pickAnAPK')),
|
||||||
content: Column(children: [
|
content: Column(children: [
|
||||||
Text(tr('appHasMoreThanOnePackage', args: [widget.app.finalName])),
|
urlsToSelectFrom.length > 1
|
||||||
|
? Text(tr('appHasMoreThanOnePackage', args: [widget.app.finalName]))
|
||||||
|
: const SizedBox.shrink(),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
...urlsToSelectFrom.map(
|
...urlsToSelectFrom.map(
|
||||||
(u) => RadioListTile<String>(
|
(u) => RadioListTile<String>(
|
||||||
|
|||||||
Reference in New Issue
Block a user