Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch errors when running JSON compat mods - app breaking bug (#2015, #2019) #2021

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion lib/providers/source_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import 'package:obtainium/app_sources/uptodown.dart';
import 'package:obtainium/components/generated_form.dart';
import 'package:obtainium/custom_errors.dart';
import 'package:obtainium/mass_app_sources/githubstars.dart';
import 'package:obtainium/providers/logs_provider.dart';
import 'package:obtainium/providers/settings_provider.dart';

class AppNames {
Expand Down Expand Up @@ -367,7 +368,14 @@ class App {
otherAssetUrls: otherAssetUrls);

factory App.fromJson(Map<String, dynamic> json) {
json = appJSONCompatibilityModifiers(json);
Map<String, dynamic> originalJSON = new Map.from(json);
try {
json = appJSONCompatibilityModifiers(json);
} catch (e) {
json = originalJSON;
LogsProvider().add(
'Error running JSON compat modifiers: ${e.toString()}: ${originalJSON.toString()}');
}
return App(
json['id'] as String,
json['url'] as String,
Expand Down
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: 1.1.33+2290
version: 1.1.34+2291

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