From 869ebd90df0ec54f530ad9951da78982a99880b8 Mon Sep 17 00:00:00 2001 From: sim Date: Tue, 24 Jan 2023 19:37:16 +0100 Subject: [PATCH] Add fdroid flavor --- android/app/build.gradle | 12 ++++++++++++ lib/main.dart | 31 +++++++++++++++++-------------- lib/main_fdroid.dart | 6 ++++++ 3 files changed, 35 insertions(+), 14 deletions(-) create mode 100644 lib/main_fdroid.dart diff --git a/android/app/build.gradle b/android/app/build.gradle index 09eb008..1149a83 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -59,6 +59,18 @@ android { versionName flutterVersionName } + flavorDimensions "flavor" + + productFlavors { + no { + dimension "flavor" + applicationIdSuffix "" + } + fdroid { + dimension "flavor" + applicationIdSuffix ".fdroid" + } + } signingConfigs { release { keyAlias keystoreProperties['keyAlias'] diff --git a/lib/main.dart b/lib/main.dart index 939c938..c041806 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -37,6 +37,7 @@ const supportedLocales = [ ]; const fallbackLocale = Locale('en'); const localeDir = 'assets/translations'; +var fdroid = false; final globalNavigatorKey = GlobalKey(); @@ -195,20 +196,22 @@ class _ObtainiumState extends State { logs.add(tr('firstRun')); // If this is the first run, ask for notification permissions and add Obtainium to the Apps list Permission.notification.request(); - appsProvider.saveApps([ - App( - obtainiumId, - 'https://github.com/ImranR98/Obtainium', - 'ImranR98', - 'Obtainium', - currentReleaseTag, - currentReleaseTag, - [], - 0, - {'includePrereleases': true}, - null, - false) - ]); + if (!fdroid) { + appsProvider.saveApps([ + App( + obtainiumId, + 'https://github.com/ImranR98/Obtainium', + 'ImranR98', + 'Obtainium', + currentReleaseTag, + currentReleaseTag, + [], + 0, + {'includePrereleases': true}, + null, + false) + ]); + } } // Register the background update task according to the user's setting if (existingUpdateInterval != settingsProvider.updateInterval) { diff --git a/lib/main_fdroid.dart b/lib/main_fdroid.dart new file mode 100644 index 0000000..7fb8a28 --- /dev/null +++ b/lib/main_fdroid.dart @@ -0,0 +1,6 @@ +import 'main.dart' as m; + +void main() async { + m.fdroid = true; + m.main(); +} \ No newline at end of file