Merge pull request #236 from p1gp1g/flavors

Add fdroid flavor
This commit is contained in:
Imran Remtulla
2023-11-18 15:01:37 -05:00
committed by GitHub
3 changed files with 36 additions and 14 deletions

View File

@@ -58,6 +58,19 @@ android {
versionName flutterVersionName
}
flavorDimensions "flavor"
productFlavors {
github {
dimension "flavor"
applicationIdSuffix ""
}
fdroid {
dimension "flavor"
applicationIdSuffix ".fdroid"
}
}
buildTypes {
release {

View File

@@ -45,6 +45,7 @@ List<MapEntry<Locale, String>> supportedLocales = const [
];
const fallbackLocale = Locale('en');
const localeDir = 'assets/translations';
var fdroid = false;
final globalNavigatorKey = GlobalKey<NavigatorState>();
@@ -133,6 +134,7 @@ class _ObtainiumState extends State<Obtainium> {
logs.add('This is the first ever run of Obtainium.');
// If this is the first run, ask for notification permissions and add Obtainium to the Apps list
Permission.notification.request();
if (!fdroid) {
appsProvider.saveApps([
App(
obtainiumId,
@@ -148,6 +150,7 @@ class _ObtainiumState extends State<Obtainium> {
false)
], onlyIfExists: false);
}
}
if (!supportedLocales
.map((e) => e.key.languageCode)
.contains(context.locale.languageCode) ||

6
lib/main_fdroid.dart Normal file
View File

@@ -0,0 +1,6 @@
import 'main.dart' as m;
void main() async {
m.fdroid = true;
m.main();
}