Skip to content

Commit

Permalink
Merge pull request #685 from ImranR98/dev
Browse files Browse the repository at this point in the history
 Make page transition animation optional (#683), Add reverse transition animation toggle (#683), Fix text alignment + visibility on app page (#680), Attempt at more resilient XAPK installs (#682)
  • Loading branch information
ImranR98 authored Jul 16, 2023
2 parents 785bba1 + 579bc94 commit e093fc2
Show file tree
Hide file tree
Showing 18 changed files with 106 additions and 10 deletions.
2 changes: 2 additions & 0 deletions assets/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@
"removeOnExternalUninstall": "Automatically remove externally uninstalled Apps",
"pickHighestVersionCode": "Auto-select highest version code APK",
"checkUpdateOnDetailPage": "Check for updates on opening an App detail page",
"disablePageTransitions": "Disable page transition animations",
"reversePageTransitions": "Reverse page transition animations",
"removeAppQuestion": {
"one": "App entfernen?",
"other": "Apps entfernen?"
Expand Down
2 changes: 2 additions & 0 deletions assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@
"removeOnExternalUninstall": "Automatically remove externally uninstalled Apps",
"pickHighestVersionCode": "Auto-select highest version code APK",
"checkUpdateOnDetailPage": "Check for updates on opening an App detail page",
"disablePageTransitions": "Disable page transition animations",
"reversePageTransitions": "Reverse page transition animations",
"removeAppQuestion": {
"one": "Remove App?",
"other": "Remove Apps?"
Expand Down
2 changes: 2 additions & 0 deletions assets/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@
"removeOnExternalUninstall": "Automatically remove externally uninstalled Apps",
"pickHighestVersionCode": "Auto-select highest version code APK",
"checkUpdateOnDetailPage": "Check for updates on opening an App detail page",
"disablePageTransitions": "Disable page transition animations",
"reversePageTransitions": "Reverse page transition animations",
"removeAppQuestion": {
"one": "¿Eliminar Aplicación?",
"other": "¿Eliminar Aplicaciones?"
Expand Down
2 changes: 2 additions & 0 deletions assets/translations/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@
"removeOnExternalUninstall": "Automatically remove externally uninstalled Apps",
"pickHighestVersionCode": "Auto-select highest version code APK",
"checkUpdateOnDetailPage": "Check for updates on opening an App detail page",
"disablePageTransitions": "Disable page transition animations",
"reversePageTransitions": "Reverse page transition animations",
"removeAppQuestion": {
"one": "برنامه حذف شود؟",
"other": "برنامه ها حذف شوند؟"
Expand Down
2 changes: 2 additions & 0 deletions assets/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@
"removeOnExternalUninstall": "Automatically remove externally uninstalled Apps",
"pickHighestVersionCode": "Auto-select highest version code APK",
"checkUpdateOnDetailPage": "Check for updates on opening an App detail page",
"disablePageTransitions": "Disable page transition animations",
"reversePageTransitions": "Reverse page transition animations",
"removeAppQuestion": {
"one": "Supprimer l'application ?",
"other": "Supprimer les applications ?"
Expand Down
2 changes: 2 additions & 0 deletions assets/translations/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@
"removeOnExternalUninstall": "A külsőleg eltávolított appok auto. eltávolítása",
"pickHighestVersionCode": "A legmagasabb verziószámú APK auto. kiválasztása",
"checkUpdateOnDetailPage": "Frissítések keresése az app részleteit tartalmazó oldal megnyitásakor",
"disablePageTransitions": "Disable page transition animations",
"reversePageTransitions": "Reverse page transition animations",
"removeAppQuestion": {
"one": "Eltávolítja az alkalmazást?",
"other": "Eltávolítja az alkalmazást?"
Expand Down
2 changes: 2 additions & 0 deletions assets/translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@
"removeOnExternalUninstall": "Automatically remove externally uninstalled Apps",
"pickHighestVersionCode": "Auto-select highest version code APK",
"checkUpdateOnDetailPage": "Check for updates on opening an App detail page",
"disablePageTransitions": "Disable page transition animations",
"reversePageTransitions": "Reverse page transition animations",
"removeAppQuestion": {
"one": "Rimuovere l'app?",
"other": "Rimuovere le app?"
Expand Down
2 changes: 2 additions & 0 deletions assets/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@
"removeOnExternalUninstall": "外部でアンインストールされたアプリを自動的に削除する",
"pickHighestVersionCode": "最も高いバージョンコードのAPKを自動的に選択する",
"checkUpdateOnDetailPage": "アプリの詳細ページを開く際にアップデートを確認する",
"disablePageTransitions": "Disable page transition animations",
"reversePageTransitions": "Reverse page transition animations",
"removeAppQuestion": {
"one": "アプリを削除しますか?",
"other": "アプリを削除しますか?"
Expand Down
2 changes: 2 additions & 0 deletions assets/translations/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@
"removeOnExternalUninstall": "Automatyczne usuń odinstalowane zewnętrznie aplikacje",
"pickHighestVersionCode": "Automatycznie wybierz najwyższy kod wersji APK",
"checkUpdateOnDetailPage": "Sprawdzaj aktualizacje podczas otwierania strony szczegółów aplikacji",
"disablePageTransitions": "Disable page transition animations",
"reversePageTransitions": "Reverse page transition animations",
"removeAppQuestion": {
"one": "Usunąć aplikację?",
"other": "Usunąć aplikacje?"
Expand Down
2 changes: 2 additions & 0 deletions assets/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@
"removeOnExternalUninstall": "Автоматически убирать из списка удаленные извне приложения",
"pickHighestVersionCode": "Автовыбор кода наивысшей версии APK",
"checkUpdateOnDetailPage": "Проверять наличие обновлений при открытии страницы представления приложения",
"disablePageTransitions": "Disable page transition animations",
"reversePageTransitions": "Reverse page transition animations",
"removeAppQuestion": {
"one": "Удалить приложение?",
"other": "Удалить приложения?"
Expand Down
2 changes: 2 additions & 0 deletions assets/translations/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@
"removeOnExternalUninstall": "Automatically remove externally uninstalled Apps",
"pickHighestVersionCode": "Auto-select highest version code APK",
"checkUpdateOnDetailPage": "Check for updates on opening an App detail page",
"disablePageTransitions": "Disable page transition animations",
"reversePageTransitions": "Reverse page transition animations",
"removeAppQuestion": {
"one": "是否删除应用?",
"other": "是否删除应用?"
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import 'package:easy_localization/src/easy_localization_controller.dart';
// ignore: implementation_imports
import 'package:easy_localization/src/localization.dart';

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

Expand Down
16 changes: 11 additions & 5 deletions lib/pages/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ class _AppPageState extends State<AppPage> {
app?.app.additionalSettings['versionDetection'] ==
'standardVersionDetection';

bool installedVersionIsEstimate = trackOnly ||
(app?.app.installedVersion != null &&
app?.app.additionalSettings['versionDetection'] ==
'noVersionDetection');

getInfoColumn() => Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
Expand Down Expand Up @@ -92,9 +97,7 @@ class _AppPageState extends State<AppPage> {
app?.app.latestVersion ?? tr('unknown')
])}\n${tr('installedVersionX', args: [
app?.app.installedVersion ?? tr('none')
])}${trackOnly ? ' ${tr('estimateInBrackets')}\n\n${tr('xIsTrackOnly', args: [
tr('app')
])}' : ''}',
])}${installedVersionIsEstimate ? '\n${tr('estimateInBrackets')}' : ''}',
textAlign: TextAlign.end,
style: Theme.of(context).textTheme.bodyLarge!,
),
Expand All @@ -105,11 +108,14 @@ class _AppPageState extends State<AppPage> {
Column(
children: [
const SizedBox(
height: 4,
height: 16,
),
Text(
tr('noVersionDetection'),
'${trackOnly ? '${tr('xIsTrackOnly', args: [
tr('app')
])}\n' : ''}${tr('noVersionDetection')}',
style: Theme.of(context).textTheme.labelSmall,
textAlign: TextAlign.center,
)
],
),
Expand Down
9 changes: 8 additions & 1 deletion lib/pages/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:obtainium/pages/apps.dart';
import 'package:obtainium/pages/import_export.dart';
import 'package:obtainium/pages/settings.dart';
import 'package:obtainium/providers/apps_provider.dart';
import 'package:obtainium/providers/settings_provider.dart';
import 'package:provider/provider.dart';

class HomePage extends StatefulWidget {
Expand Down Expand Up @@ -42,6 +43,7 @@ class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
AppsProvider appsProvider = context.watch<AppsProvider>();
SettingsProvider settingsProvider = context.watch<SettingsProvider>();

setIsReversing(int targetIndex) {
bool reversing = selectedIndexHistory.isNotEmpty &&
Expand Down Expand Up @@ -89,7 +91,12 @@ class _HomePageState extends State<HomePage> {
child: Scaffold(
backgroundColor: Theme.of(context).colorScheme.surface,
body: PageTransitionSwitcher(
reverse: isReversing,
duration: Duration(
milliseconds:
settingsProvider.disablePageTransitions ? 0 : 300),
reverse: settingsProvider.reversePageTransitions
? !isReversing
: isReversing,
transitionBuilder: (
Widget child,
Animation<double> animation,
Expand Down
30 changes: 30 additions & 0 deletions lib/pages/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,36 @@ class _SettingsPageState extends State<SettingsPage> {
})
],
),
height16,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
child: Text(tr('disablePageTransitions'))),
Switch(
value:
settingsProvider.disablePageTransitions,
onChanged: (value) {
settingsProvider.disablePageTransitions =
value;
})
],
),
height16,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
child: Text(tr('reversePageTransitions'))),
Switch(
value:
settingsProvider.reversePageTransitions,
onChanged: (value) {
settingsProvider.reversePageTransitions =
value;
})
],
),
height32,
Text(
tr('categories'),
Expand Down
17 changes: 15 additions & 2 deletions lib/providers/apps_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -341,20 +341,33 @@ class AppsProvider with ChangeNotifier {

Future<void> installXApkDir(DownloadedXApkDir dir,
{bool silent = false}) async {
// We don't know which APKs in an XAPK are supported by the user's device
// So we try installing all of them and assume success if at least one installed
// If 0 APKs installed, throw the first install error encountered
try {
var somethingInstalled = false;
var firstError = null;
for (var file in dir.extracted
.listSync(recursive: true, followLinks: false)
.whereType<File>()) {
if (file.path.toLowerCase().endsWith('.apk')) {
somethingInstalled = somethingInstalled ||
await installApk(DownloadedApk(dir.appId, file), silent: silent);
try {
somethingInstalled = somethingInstalled ||
await installApk(DownloadedApk(dir.appId, file),
silent: silent);
} catch (e) {
logs.add(
'Could not install APK from XAPK \'${file.path}\': ${e.toString()}');
firstError ??= e;
}
} else if (file.path.toLowerCase().endsWith('.obb')) {
await moveObbFile(file, dir.appId);
}
}
if (somethingInstalled) {
dir.file.delete(recursive: true);
} else if (firstError) {
throw firstError;
}
} finally {
dir.extracted.delete(recursive: true);
Expand Down
18 changes: 18 additions & 0 deletions lib/providers/settings_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,22 @@ class SettingsProvider with ChangeNotifier {
prefs?.setBool('checkUpdateOnDetailPage', show);
notifyListeners();
}

bool get disablePageTransitions {
return prefs?.getBool('disablePageTransitions') ?? false;
}

set disablePageTransitions(bool show) {
prefs?.setBool('disablePageTransitions', show);
notifyListeners();
}

bool get reversePageTransitions {
return prefs?.getBool('reversePageTransitions') ?? false;
}

set reversePageTransitions(bool show) {
prefs?.setBool('reversePageTransitions', show);
notifyListeners();
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 0.13.17+181 # When changing this, update the tag in main() accordingly
version: 0.13.18+182 # When changing this, update the tag in main() accordingly

environment:
sdk: '>=2.18.2 <3.0.0'
Expand Down

0 comments on commit e093fc2

Please sign in to comment.