Skip to content

Commit

Permalink
Merge pull request #1096 from ImranR98/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ImranR98 authored Nov 18, 2023
2 parents 77bd16c + cd2857c commit 03106f3
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 79 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ jobs:

- name: Build APKs
run: |
flutter build apk && flutter build apk --split-per-abi
flutter build apk --flavor normal && flutter build apk --split-per-abi --flavor normal
for file in app-*normal*.apk*; do mv "$file" "${file//-normal/}"; done
rm ./build/app/outputs/flutter-apk/*.sha1
ls -l ./build/app/outputs/flutter-apk/
Expand Down
13 changes: 13 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@ android {
versionName flutterVersionName
}

flavorDimensions "flavor"

productFlavors {
normal {
dimension "flavor"
applicationIdSuffix ""
}
fdroid {
dimension "flavor"
applicationIdSuffix ".fdroid"
}
}

buildTypes {
release {

Expand Down
20 changes: 10 additions & 10 deletions assets/translations/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"addApp": "Uygulama Ekle",
"appSourceURL": "Uygulama Kaynak URL'si",
"error": "Hata",
"add": "Ekle"
"add": "Ekle",
"searchSomeSourcesLabel": "Ara (Bazı Kaynaklar Yalnızca)",
"search": "Ara",
"additionalOptsFor": "{} İçin Ek Seçenekler",
Expand Down Expand Up @@ -226,7 +226,7 @@
"requiresCredentialsInSettings": "Bu, ek kimlik bilgilerine ihtiyaç duyar (Ayarlar'da)",
"checkOnStart": "Başlangıçta güncellemeleri kontrol et",
"tryInferAppIdFromCode": "Uygulama kimliğini kaynak kodundan çıkarma girişimi",
"removeOnExternalUninstall": "Harici kaldırmada otomatik olarak kaldırılan uygulamalar"
"removeOnExternalUninstall": "Harici kaldırmada otomatik olarak kaldırılan uygulamalar",
"pickHighestVersionCode": "Otomatik olarak en yüksek sürüm kodlu APK'yi seç",
"checkUpdateOnDetailPage": "Uygulama detay sayfasını açarken güncellemeleri kontrol et",
"disablePageTransitions": "Sayfa geçiş animasyonlarını devre dışı bırak",
Expand All @@ -241,7 +241,7 @@
"customLinkFilterRegex": "Özel APK Bağlantı Filtresi Düzenli İfade ile (Varsayılan '.apk$')",
"appsPossiblyUpdated": "Uygulama Güncellemeleri Denendi",
"appsPossiblyUpdatedNotifDescription": "Kullanıcıya bir veya daha fazla uygulamanın arka planda potansiyel olarak güncellendiğini bildiren bildirim",
"xWasPossiblyUpdatedToY": "{} muhtemelen {} sürümüne güncellendi."
"xWasPossiblyUpdatedToY": "{} muhtemelen {} sürümüne güncellendi.",
"enableBackgroundUpdates": "Arka plan güncellemelerini etkinleştir",
"backgroundUpdateReqsExplanation": "Arka plan güncellemeleri tüm uygulamalar için mümkün olmayabilir.",
"backgroundUpdateLimitsExplanation": "Arka plan kurulumunun başarısı, Obtainium'un açıldığında ancak belirlenebilir.",
Expand All @@ -258,7 +258,7 @@
"autoExportOnChanges": "Değişikliklerde otomatik olarak dışa aktar",
"filterVersionsByRegEx": "Sürümleri Düzenli İfade ile Filtrele",
"trySelectingSuggestedVersionCode": "Önerilen sürüm kodunu seçmeyi dene",
"dontSortReleasesList": "API'den sıralama düzenini koru"
"dontSortReleasesList": "API'den sıralama düzenini koru",
"reverseSort": "Ters sıralama",
"debugMenu": "Hata Ayıklama Menüsü",
"bgTaskStarted": "Arka plan görevi başladı - günlükleri kontrol et.",
Expand All @@ -274,10 +274,10 @@
"downloadingXNotifChannel": "{} İndiriliyor",
"completeAppInstallationNotifChannel": "Uygulama Kurulumu Tamamlandı",
"checkingForUpdatesNotifChannel": "Güncellemeler Kontrol Ediliyor",
"onlyCheckInstalledOrTrackOnlyApps": "Yalnızca yüklü ve Yalnızca İzleme Uygulamalarını güncelleme"
"removeAppQuestion": {
"one": "Uygulamayı Kaldır?",
"other": "Uygulamaları Kaldır?"
"onlyCheckInstalledOrTrackOnlyApps": "Yalnızca yüklü ve Yalnızca İzleme Uygulamalarını güncelleme",
"removeAppQuestion": {
"one": "Uygulamayı Kaldır?",
"other": "Uygulamaları Kaldır?"
},
"tooManyRequestsTryAgainInMinutes": {
"one": "Çok fazla istek (hız sınırlı) - {} dakika sonra tekrar deneyin",
Expand All @@ -290,7 +290,7 @@
"bgCheckFoundUpdatesWillNotifyIfNeeded": {
"one": "Arka plan güncelleme kontrolü {} güncelleme buldu - gerektiğinde kullanıcıyı bilgilendirecek",
"other": "Arka plan güncelleme kontrolü {} güncelleme buldu - gerektiğinde kullanıcıyı bilgilendirecek"
}
},
"apps": {
"one": "{} Uygulama",
"other": "{} Uygulamalar"
Expand Down Expand Up @@ -327,4 +327,4 @@
"one": "{} ve 1 diğer uygulama muhtemelen güncellendi.",
"other": "{} ve {} daha fazla uygulama muhtemelen güncellendi."
}
}
}
7 changes: 5 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ trap "cd "$CURR_DIR"" EXIT
if [ -z "$1" ]; then
git fetch && git merge origin/main && git push # Typically run after a PR to main, so bring dev up to date
fi
rm ./build/app/outputs/flutter-apk/* 2>/dev/null # Get rid of older builds if any
flutter build apk && flutter build apk --split-per-abi # Build (both split and combined APKs)
rm ./build/app/outputs/flutter-apk/* 2>/dev/null # Get rid of older builds if any
flutter build apk --flavor normal && flutter build apk --split-per-abi --flavor normal # Build (both split and combined APKs)
for file in ./build/app/outputs/flutter-apk/app-*normal*.apk*; do mv "$file" "${file//-normal/}"; done
flutter build apk --flavor fdroid -t lib/main_fdroid.dart && # Do the same for the F-Droid flavour
flutter build apk --split-per-abi --flavor fdroid -t lib/main_fdroid.dart
for file in ./build/app/outputs/flutter-apk/*.sha1; do gpg --sign --detach-sig "$file"; done # Generate PGP signatures
rsync -r ./build/app/outputs/flutter-apk/ ~/Downloads/Obtainium-build/ # Dropoff in Downloads to allow for drag-drop into Flatpak Firefox
cd ~/Downloads/Obtainium-build/ # Make zips just in case (for in-comment uploads)
Expand Down
2 changes: 1 addition & 1 deletion lib/app_sources/html.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class HTML extends AppSource {
]
];
overrideVersionDetectionFormDefault('noVersionDetection',
disableStandard: true, disableRelDate: true);
disableStandard: false, disableRelDate: true);
}

@override
Expand Down
35 changes: 20 additions & 15 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import 'package:easy_localization/src/easy_localization_controller.dart';
// ignore: implementation_imports
import 'package:easy_localization/src/localization.dart';

const String currentVersion = '0.14.32';
const String currentVersion = '0.14.33';
const String currentReleaseTag =
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES

Expand All @@ -42,9 +42,12 @@ List<MapEntry<Locale, String>> supportedLocales = const [
MapEntry(Locale('cs'), 'Česky'),
MapEntry(Locale('sv'), 'Svenska'),
MapEntry(Locale('nl'), 'Nederlands'),
MapEntry(Locale('vi'), 'Tiếng Việt'),
MapEntry(Locale('tr'), 'Türkçe'),
];
const fallbackLocale = Locale('en');
const localeDir = 'assets/translations';
var fdroid = false;

final globalNavigatorKey = GlobalKey<NavigatorState>();

Expand Down Expand Up @@ -133,20 +136,22 @@ 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();
appsProvider.saveApps([
App(
obtainiumId,
'https://github.com/ImranR98/Obtainium',
'ImranR98',
'Obtainium',
currentReleaseTag,
currentReleaseTag,
[],
0,
{'includePrereleases': true},
null,
false)
], onlyIfExists: false);
if (!fdroid) {
appsProvider.saveApps([
App(
obtainiumId,
'https://github.com/ImranR98/Obtainium',
'ImranR98',
'Obtainium',
currentReleaseTag,
currentReleaseTag,
[],
0,
{'includePrereleases': true},
null,
false)
], onlyIfExists: false);
}
}
if (!supportedLocales
.map((e) => e.key.languageCode)
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();
}
3 changes: 2 additions & 1 deletion lib/pages/import_export.dart
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ class _ImportExportPageState extends State<ImportExportPage> {
);
});
if (selectedUrls != null && selectedUrls.isNotEmpty) {
var errors = await appsProvider.addAppsByURL(selectedUrls);
var errors = await appsProvider.addAppsByURL(selectedUrls,
sourceOverride: source);
if (errors.isEmpty) {
// ignore: use_build_context_synchronously
showMessage(
Expand Down
6 changes: 4 additions & 2 deletions lib/providers/apps_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1217,9 +1217,11 @@ class AppsProvider with ChangeNotifier {
super.dispose();
}

Future<List<List<String>>> addAppsByURL(List<String> urls) async {
Future<List<List<String>>> addAppsByURL(List<String> urls,
{AppSource? sourceOverride}) async {
List<dynamic> results = await SourceProvider().getAppsByURLNaive(urls,
alreadyAddedUrls: apps.values.map((e) => e.app.url).toList());
alreadyAddedUrls: apps.values.map((e) => e.app.url).toList(),
sourceOverride: sourceOverride);
List<App> pps = results[0];
Map<String, dynamic> errorsMap = results[1];
for (var app in pps) {
Expand Down
5 changes: 3 additions & 2 deletions lib/providers/source_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -706,15 +706,16 @@ class SourceProvider {

// Returns errors in [results, errors] instead of throwing them
Future<List<dynamic>> getAppsByURLNaive(List<String> urls,
{List<String> alreadyAddedUrls = const []}) async {
{List<String> alreadyAddedUrls = const [],
AppSource? sourceOverride}) async {
List<App> apps = [];
Map<String, dynamic> errors = {};
for (var url in urls) {
try {
if (alreadyAddedUrls.contains(url)) {
throw ObtainiumError(tr('appAlreadyAdded'));
}
var source = getSource(url);
var source = sourceOverride ?? getSource(url);
apps.add(await getApp(
source,
url,
Expand Down
Loading

0 comments on commit 03106f3

Please sign in to comment.