mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-16 14:46:44 +02:00
bugs
This commit is contained in:
@ -8,7 +8,7 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:launchMode="singleInstance"
|
android:launchMode="singleTop"
|
||||||
android:theme="@style/LaunchTheme"
|
android:theme="@style/LaunchTheme"
|
||||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||||
android:hardwareAccelerated="true"
|
android:hardwareAccelerated="true"
|
||||||
|
@ -77,11 +77,9 @@ class _HomePageState extends State<HomePage> {
|
|||||||
} else if (action == 'app') {
|
} else if (action == 'app') {
|
||||||
await context
|
await context
|
||||||
.read<AppsProvider>()
|
.read<AppsProvider>()
|
||||||
.importApps('[${Uri.decodeComponent(data)}]');
|
.import('[${Uri.decodeComponent(data)}]');
|
||||||
} else if (action == 'apps') {
|
} else if (action == 'apps') {
|
||||||
await context
|
await context.read<AppsProvider>().import(Uri.decodeComponent(data));
|
||||||
.read<AppsProvider>()
|
|
||||||
.importApps(Uri.decodeComponent(data));
|
|
||||||
} else {
|
} else {
|
||||||
throw ObtainiumError(tr('unknown'));
|
throw ObtainiumError(tr('unknown'));
|
||||||
}
|
}
|
||||||
@ -145,13 +143,13 @@ class _HomePageState extends State<HomePage> {
|
|||||||
AppsProvider appsProvider = context.watch<AppsProvider>();
|
AppsProvider appsProvider = context.watch<AppsProvider>();
|
||||||
SettingsProvider settingsProvider = context.watch<SettingsProvider>();
|
SettingsProvider settingsProvider = context.watch<SettingsProvider>();
|
||||||
|
|
||||||
if (!prevIsLoading &&
|
// if (!prevIsLoading &&
|
||||||
prevAppCount >= 0 &&
|
// prevAppCount >= 0 &&
|
||||||
appsProvider.apps.length > prevAppCount &&
|
// appsProvider.apps.length > prevAppCount &&
|
||||||
selectedIndexHistory.isNotEmpty &&
|
// selectedIndexHistory.isNotEmpty &&
|
||||||
selectedIndexHistory.last == 1) {
|
// selectedIndexHistory.last == 1) {
|
||||||
switchToPage(0);
|
// switchToPage(0);
|
||||||
}
|
// }
|
||||||
prevAppCount = appsProvider.apps.length;
|
prevAppCount = appsProvider.apps.length;
|
||||||
prevIsLoading = appsProvider.loadingApps;
|
prevIsLoading = appsProvider.loadingApps;
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
|||||||
runObtainiumExport({bool pickOnly = false}) async {
|
runObtainiumExport({bool pickOnly = false}) async {
|
||||||
HapticFeedback.selectionClick();
|
HapticFeedback.selectionClick();
|
||||||
appsProvider
|
appsProvider
|
||||||
.exportApps(
|
.export(
|
||||||
pickOnly:
|
pickOnly:
|
||||||
pickOnly || (await settingsProvider.getExportDir()) == null,
|
pickOnly || (await settingsProvider.getExportDir()) == null,
|
||||||
sp: settingsProvider)
|
sp: settingsProvider)
|
||||||
@ -132,7 +132,7 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw ObtainiumError(tr('invalidInput'));
|
throw ObtainiumError(tr('invalidInput'));
|
||||||
}
|
}
|
||||||
appsProvider.importApps(data).then((value) {
|
appsProvider.import(data).then((value) {
|
||||||
var cats = settingsProvider.categories;
|
var cats = settingsProvider.categories;
|
||||||
appsProvider.apps.forEach((key, value) {
|
appsProvider.apps.forEach((key, value) {
|
||||||
for (var c in value.app.categories) {
|
for (var c in value.app.categories) {
|
||||||
@ -143,7 +143,10 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
|||||||
});
|
});
|
||||||
appsProvider.addMissingCategories(settingsProvider);
|
appsProvider.addMissingCategories(settingsProvider);
|
||||||
showMessage(
|
showMessage(
|
||||||
tr('importedX', args: [plural('apps', value)]), context);
|
'${tr('importedX', args: [
|
||||||
|
plural('apps', value.key)
|
||||||
|
])}${value.value ? ' + ${tr('settings')}' : ''}',
|
||||||
|
context);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// User canceled the picker
|
// User canceled the picker
|
||||||
|
@ -974,7 +974,7 @@ class AppsProvider with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
exportApps(isAuto: true);
|
export(isAuto: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> removeApps(List<String> appIds) async {
|
Future<void> removeApps(List<String> appIds) async {
|
||||||
@ -996,7 +996,7 @@ class AppsProvider with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
if (appIds.isNotEmpty) {
|
if (appIds.isNotEmpty) {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
exportApps(isAuto: true);
|
export(isAuto: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1173,11 +1173,8 @@ class AppsProvider with ChangeNotifier {
|
|||||||
return updateAppIds;
|
return updateAppIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String?> exportApps(
|
Future<String?> export(
|
||||||
{bool pickOnly = false,
|
{bool pickOnly = false, isAuto = false, SettingsProvider? sp}) async {
|
||||||
isAuto = false,
|
|
||||||
SettingsProvider? sp,
|
|
||||||
bool includeSettings = false}) async {
|
|
||||||
SettingsProvider settingsProvider = sp ?? this.settingsProvider;
|
SettingsProvider settingsProvider = sp ?? this.settingsProvider;
|
||||||
var exportDir = await settingsProvider.getExportDir();
|
var exportDir = await settingsProvider.getExportDir();
|
||||||
if (isAuto) {
|
if (isAuto) {
|
||||||
@ -1231,10 +1228,11 @@ class AppsProvider with ChangeNotifier {
|
|||||||
return returnPath;
|
return returnPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> importApps(String appsJSON) async {
|
Future<MapEntry<int, bool>> import(String appsJSON) async {
|
||||||
var decodedJSON = jsonDecode(appsJSON);
|
var decodedJSON = jsonDecode(appsJSON);
|
||||||
|
var newFormat = !(decodedJSON is List);
|
||||||
List<App> importedApps =
|
List<App> importedApps =
|
||||||
((decodedJSON['apps'] ?? decodedJSON) as List<dynamic>)
|
((newFormat ? decodedJSON['apps'] : decodedJSON) as List<dynamic>)
|
||||||
.map((e) => App.fromJson(e))
|
.map((e) => App.fromJson(e))
|
||||||
.toList();
|
.toList();
|
||||||
while (loadingApps) {
|
while (loadingApps) {
|
||||||
@ -1247,7 +1245,7 @@ class AppsProvider with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
await saveApps(importedApps, onlyIfExists: false);
|
await saveApps(importedApps, onlyIfExists: false);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
if (decodedJSON['settings'] != null) {
|
if (newFormat && decodedJSON['settings'] != null) {
|
||||||
var settingsMap = decodedJSON['settings'] as Map<String, Object?>;
|
var settingsMap = decodedJSON['settings'] as Map<String, Object?>;
|
||||||
settingsMap.forEach((key, value) {
|
settingsMap.forEach((key, value) {
|
||||||
if (value is int) {
|
if (value is int) {
|
||||||
@ -1259,7 +1257,8 @@ class AppsProvider with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return importedApps.length;
|
return MapEntry<int, bool>(
|
||||||
|
importedApps.length, newFormat && decodedJSON['settings'] != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
Reference in New Issue
Block a user