Skip to content

Commit

Permalink
Add fdroid flavor
Browse files Browse the repository at this point in the history
  • Loading branch information
p1gp1g committed Jan 24, 2023
1 parent f43e5a2 commit 869ebd9
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
12 changes: 12 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ android {
versionName flutterVersionName
}

flavorDimensions "flavor"

productFlavors {
no {
dimension "flavor"
applicationIdSuffix ""
}
fdroid {
dimension "flavor"
applicationIdSuffix ".fdroid"
}
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
Expand Down
31 changes: 17 additions & 14 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const supportedLocales = [
];
const fallbackLocale = Locale('en');
const localeDir = 'assets/translations';
var fdroid = false;

final globalNavigatorKey = GlobalKey<NavigatorState>();

Expand Down Expand Up @@ -195,20 +196,22 @@ class _ObtainiumState extends State<Obtainium> {
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) {
Expand Down
6 changes: 6 additions & 0 deletions lib/main_fdroid.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import 'main.dart' as m;

void main() async {
m.fdroid = true;
m.main();
}

0 comments on commit 869ebd9

Please sign in to comment.