mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-12 21:06:43 +02:00
Dart fix + Flutter upgrade
This commit is contained in:
2
.flutter
2
.flutter
Submodule .flutter updated: b25305a883...6fba2447e9
@ -8,7 +8,7 @@ import 'package:obtainium/providers/source_provider.dart';
|
||||
|
||||
extension Unique<E, Id> on List<E> {
|
||||
List<E> unique([Id Function(E element)? id, bool inplace = true]) {
|
||||
final ids = Set();
|
||||
final ids = <dynamic>{};
|
||||
var list = inplace ? this : List<E>.from(this);
|
||||
list.retainWhere((x) => ids.add(id != null ? id(x) : x as Id));
|
||||
return list;
|
||||
@ -76,7 +76,7 @@ class APKPure extends AppSource {
|
||||
return Uri.parse(standardUrl).pathSegments.last;
|
||||
}
|
||||
|
||||
getDetailsForVersion(
|
||||
Future<APKDetails> getDetailsForVersion(
|
||||
List<Map<String, dynamic>> versionVariants,
|
||||
List<String> supportedArchs,
|
||||
Map<String, dynamic> additionalSettings,
|
||||
|
@ -16,7 +16,7 @@ class DirectAPKLink extends AppSource {
|
||||
.where((element) => element.key == 'requestHeader')
|
||||
.isNotEmpty,
|
||||
)
|
||||
.toList(),
|
||||
,
|
||||
[
|
||||
GeneratedFormDropdown(
|
||||
'defaultPseudoVersioningMethod',
|
||||
|
@ -566,7 +566,7 @@ class GitHub extends AppSource {
|
||||
}
|
||||
}
|
||||
|
||||
getLatestAPKDetailsCommon2(
|
||||
Future<APKDetails> getLatestAPKDetailsCommon2(
|
||||
String standardUrl,
|
||||
Map<String, dynamic> additionalSettings,
|
||||
Future<String> Function(bool) reqUrlGenerator,
|
||||
@ -667,7 +667,7 @@ class GitHub extends AppSource {
|
||||
);
|
||||
}
|
||||
|
||||
rateLimitErrorCheck(Response res) {
|
||||
void rateLimitErrorCheck(Response res) {
|
||||
if (res.headers['x-ratelimit-remaining'] == '0') {
|
||||
throw RateLimitError(
|
||||
(int.parse(res.headers['x-ratelimit-reset'] ?? '1800000000') / 60000000)
|
||||
|
@ -24,10 +24,10 @@ class HuaweiAppGallery extends AppSource {
|
||||
return match.group(0)!;
|
||||
}
|
||||
|
||||
getDlUrl(String standardUrl) =>
|
||||
String getDlUrl(String standardUrl) =>
|
||||
'https://${hosts[0].replaceAll('appgallery.huawei', 'appgallery.cloud.huawei')}/appdl/${standardUrl.split('/').last}';
|
||||
|
||||
requestAppdlRedirect(
|
||||
Future<Response> requestAppdlRedirect(
|
||||
String dlUrl,
|
||||
Map<String, dynamic> additionalSettings,
|
||||
) async {
|
||||
@ -45,7 +45,7 @@ class HuaweiAppGallery extends AppSource {
|
||||
}
|
||||
}
|
||||
|
||||
appIdFromRedirectDlUrl(String redirectDlUrl) {
|
||||
String appIdFromRedirectDlUrl(String redirectDlUrl) {
|
||||
var parts = redirectDlUrl
|
||||
.split('?')[0]
|
||||
.split('/')
|
||||
|
@ -56,7 +56,7 @@ class NeutronCode extends AppSource {
|
||||
}
|
||||
}
|
||||
|
||||
customDateParse(String dateString) {
|
||||
String? customDateParse(String dateString) {
|
||||
List<String> parts = dateString.split(' ');
|
||||
if (parts.length != 3) {
|
||||
return null;
|
||||
|
@ -3,7 +3,7 @@ import 'package:html/parser.dart';
|
||||
import 'package:obtainium/custom_errors.dart';
|
||||
import 'package:obtainium/providers/source_provider.dart';
|
||||
|
||||
parseDateTimeMMMddCommayyyy(String? dateString) {
|
||||
DateTime? parseDateTimeMMMddCommayyyy(String? dateString) {
|
||||
DateTime? releaseDate;
|
||||
try {
|
||||
releaseDate = dateString != null
|
||||
|
@ -293,7 +293,7 @@ class _GeneratedFormState extends State<GeneratedForm> {
|
||||
widget.onValueChanges(returnValues, valid, isBuilding);
|
||||
}
|
||||
|
||||
initForm() {
|
||||
void initForm() {
|
||||
initKey = widget.key.toString();
|
||||
// Initialize form values as all empty
|
||||
values.clear();
|
||||
|
@ -76,7 +76,7 @@ class MultiAppMultiError extends ObtainiumError {
|
||||
|
||||
MultiAppMultiError() : super(tr('placeholder'), unexpected: true);
|
||||
|
||||
add(String appId, dynamic error, {String? appName}) {
|
||||
void add(String appId, dynamic error, {String? appName}) {
|
||||
if (error is SocketException) {
|
||||
error = error.message;
|
||||
}
|
||||
@ -107,7 +107,7 @@ class MultiAppMultiError extends ObtainiumError {
|
||||
.join('\n\n');
|
||||
}
|
||||
|
||||
showMessage(dynamic e, BuildContext context, {bool isError = false}) {
|
||||
void showMessage(dynamic e, BuildContext context, {bool isError = false}) {
|
||||
Provider.of<LogsProvider>(
|
||||
context,
|
||||
listen: false,
|
||||
@ -150,7 +150,7 @@ showMessage(dynamic e, BuildContext context, {bool isError = false}) {
|
||||
}
|
||||
}
|
||||
|
||||
showError(dynamic e, BuildContext context) {
|
||||
void showError(dynamic e, BuildContext context) {
|
||||
showMessage(e, context, isError: true);
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ class AddAppPageState extends State<AddAppPage> {
|
||||
int urlInputKey = 0;
|
||||
SourceProvider sourceProvider = SourceProvider();
|
||||
|
||||
linkFn(String input) {
|
||||
void linkFn(String input) {
|
||||
try {
|
||||
if (input.isEmpty) {
|
||||
throw UnsupportedURLError();
|
||||
@ -51,7 +51,7 @@ class AddAppPageState extends State<AddAppPage> {
|
||||
}
|
||||
}
|
||||
|
||||
changeUserInput(
|
||||
void changeUserInput(
|
||||
String input,
|
||||
bool valid,
|
||||
bool isBuilding, {
|
||||
|
@ -26,7 +26,7 @@ class AppsPage extends StatefulWidget {
|
||||
State<AppsPage> createState() => AppsPageState();
|
||||
}
|
||||
|
||||
showChangeLogDialog(
|
||||
void showChangeLogDialog(
|
||||
BuildContext context,
|
||||
App app,
|
||||
String? changesUrl,
|
||||
@ -100,7 +100,7 @@ showChangeLogDialog(
|
||||
);
|
||||
}
|
||||
|
||||
getChangeLogFn(BuildContext context, App app) {
|
||||
Null Function()? getChangeLogFn(BuildContext context, App app) {
|
||||
AppSource appSource = SourceProvider().getSource(
|
||||
app.url,
|
||||
overrideSource: app.overrideSource,
|
||||
@ -138,7 +138,7 @@ class AppsPageState extends State<AppsPage> {
|
||||
Set<String> selectedAppIds = {};
|
||||
DateTime? refreshingSince;
|
||||
|
||||
clearSelected() {
|
||||
bool clearSelected() {
|
||||
if (selectedAppIds.isNotEmpty) {
|
||||
setState(() {
|
||||
selectedAppIds.clear();
|
||||
@ -148,7 +148,7 @@ class AppsPageState extends State<AppsPage> {
|
||||
return false;
|
||||
}
|
||||
|
||||
selectThese(List<App> apps) {
|
||||
void selectThese(List<App> apps) {
|
||||
if (selectedAppIds.isEmpty) {
|
||||
setState(() {
|
||||
for (var a in apps) {
|
||||
@ -1063,6 +1063,7 @@ class AppsPageState extends State<AppsPage> {
|
||||
globalNavigatorKey.currentContext ?? context,
|
||||
)
|
||||
.catchError(
|
||||
// ignore: invalid_return_type_for_catch_error
|
||||
(e) => showError(
|
||||
e,
|
||||
globalNavigatorKey.currentContext ?? context,
|
||||
@ -1317,7 +1318,7 @@ class AppsFilter {
|
||||
};
|
||||
}
|
||||
|
||||
setFormValuesFromMap(Map<String, dynamic> values) {
|
||||
void setFormValuesFromMap(Map<String, dynamic> values) {
|
||||
nameFilter = values['appName']!;
|
||||
authorFilter = values['author']!;
|
||||
idFilter = values['appId']!;
|
||||
|
@ -229,7 +229,7 @@ class _HomePageState extends State<HomePage> {
|
||||
});
|
||||
}
|
||||
|
||||
setIsReversing(int targetIndex) {
|
||||
void setIsReversing(int targetIndex) {
|
||||
bool reversing =
|
||||
selectedIndexHistory.isNotEmpty &&
|
||||
selectedIndexHistory.last > targetIndex;
|
||||
@ -238,7 +238,7 @@ class _HomePageState extends State<HomePage> {
|
||||
});
|
||||
}
|
||||
|
||||
switchToPage(int index) async {
|
||||
Future<void> switchToPage(int index) async {
|
||||
setIsReversing(index);
|
||||
if (index == 0) {
|
||||
while ((pages[0].widget.key as GlobalKey<AppsPageState>).currentState !=
|
||||
@ -340,8 +340,8 @@ class _HomePageState extends State<HomePage> {
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return !(pages[0].widget.key as GlobalKey<AppsPageState>).currentState
|
||||
?.clearSelected();
|
||||
return !(pages[0].widget.key as GlobalKey<AppsPageState>).currentState!
|
||||
.clearSelected();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
@ -695,7 +695,7 @@ class _SelectionModalState extends State<SelectionModal> {
|
||||
}
|
||||
}
|
||||
|
||||
selectOnlyOne(String url) {
|
||||
void selectOnlyOne(String url) {
|
||||
for (var e in entrySelections.keys) {
|
||||
entrySelections[e] = e.key == url;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ Set<String> findStandardFormatsForVersion(String version, bool strict) {
|
||||
return results;
|
||||
}
|
||||
|
||||
moveStrToEnd(List<String> arr, String str, {String? strB}) {
|
||||
List<String> moveStrToEnd(List<String> arr, String str, {String? strB}) {
|
||||
String? temp;
|
||||
arr.removeWhere((element) {
|
||||
bool res = element == str || element == strB;
|
||||
@ -269,7 +269,7 @@ Future<String?> checkETagHeader(
|
||||
.toString();
|
||||
}
|
||||
|
||||
deleteFile(File file) {
|
||||
void deleteFile(File file) {
|
||||
try {
|
||||
file.deleteSync(recursive: true);
|
||||
} on PathAccessException catch (e) {
|
||||
@ -1826,7 +1826,7 @@ class AppsProvider with ChangeNotifier {
|
||||
await intent.launch();
|
||||
}
|
||||
|
||||
addMissingCategories(SettingsProvider settingsProvider) {
|
||||
void addMissingCategories(SettingsProvider settingsProvider) {
|
||||
var cats = settingsProvider.categories;
|
||||
apps.forEach((key, value) {
|
||||
for (var c in value.app.categories) {
|
||||
|
@ -218,7 +218,7 @@ class NotificationsProvider {
|
||||
false;
|
||||
}
|
||||
|
||||
checkLaunchByNotif() async {
|
||||
Future<void> checkLaunchByNotif() async {
|
||||
final NotificationAppLaunchDetails? launchDetails = await notifications
|
||||
.getNotificationAppLaunchDetails();
|
||||
if (launchDetails?.didNotificationLaunchApp ?? false) {
|
||||
@ -229,7 +229,7 @@ class NotificationsProvider {
|
||||
}
|
||||
}
|
||||
|
||||
_showNotificationPayload(String? payload, {bool doublePop = false}) {
|
||||
void _showNotificationPayload(String? payload, {bool doublePop = false}) {
|
||||
if (payload?.isNotEmpty == true) {
|
||||
var title = (payload ?? '\n\n').split('\n').first;
|
||||
var content = (payload ?? '\n\n').split('\n').sublist(1).join('\n');
|
||||
|
@ -63,15 +63,15 @@ class APKDetails {
|
||||
});
|
||||
}
|
||||
|
||||
stringMapListTo2DList(List<MapEntry<String, String>> mapList) =>
|
||||
List<List<String>> stringMapListTo2DList(List<MapEntry<String, String>> mapList) =>
|
||||
mapList.map((e) => [e.key, e.value]).toList();
|
||||
|
||||
assumed2DlistToStringMapList(List<dynamic> arr) =>
|
||||
List<MapEntry<String, String>> assumed2DlistToStringMapList(List<dynamic> arr) =>
|
||||
arr.map((e) => MapEntry(e[0] as String, e[1] as String)).toList();
|
||||
|
||||
// App JSON schema has changed multiple times over the many versions of Obtainium
|
||||
// This function takes an App JSON and modifies it if needed to conform to the latest (current) version
|
||||
appJSONCompatibilityModifiers(Map<String, dynamic> json) {
|
||||
Map<String, dynamic> appJSONCompatibilityModifiers(Map<String, dynamic> json) {
|
||||
var source = SourceProvider().getSource(
|
||||
json['url'],
|
||||
overrideSource: json['overrideSource'],
|
||||
@ -454,7 +454,7 @@ class App {
|
||||
}
|
||||
|
||||
// Ensure the input is starts with HTTPS and has no WWW
|
||||
preStandardizeUrl(String url) {
|
||||
String preStandardizeUrl(String url) {
|
||||
var firstDotIndex = url.indexOf('.');
|
||||
if (!(firstDotIndex >= 0 && firstDotIndex != url.length - 1)) {
|
||||
throw UnsupportedURLError();
|
||||
@ -529,7 +529,7 @@ Future<List<MapEntry<String, String>>> filterApksByArch(
|
||||
return apkUrls;
|
||||
}
|
||||
|
||||
getSourceRegex(List<String> hosts) {
|
||||
String getSourceRegex(List<String> hosts) {
|
||||
return '(${hosts.join('|').replaceAll('.', '\\.')})';
|
||||
}
|
||||
|
||||
@ -637,7 +637,7 @@ abstract class AppSource {
|
||||
name = runtimeType.toString();
|
||||
}
|
||||
|
||||
overrideAdditionalAppSpecificSourceAgnosticSettingSwitch(
|
||||
void overrideAdditionalAppSpecificSourceAgnosticSettingSwitch(
|
||||
String key, {
|
||||
bool disabled = true,
|
||||
bool defaultValue = true,
|
||||
@ -949,7 +949,7 @@ abstract class MassAppUrlSource {
|
||||
Future<Map<String, List<String>>> getUrlsWithDescriptions(List<String> args);
|
||||
}
|
||||
|
||||
regExValidator(String? value) {
|
||||
String? regExValidator(String? value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return null;
|
||||
}
|
||||
@ -961,7 +961,7 @@ regExValidator(String? value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
intValidator(String? value, {bool positive = false}) {
|
||||
String? intValidator(String? value, {bool positive = false}) {
|
||||
if (value == null) {
|
||||
return tr('invalidInput');
|
||||
}
|
||||
@ -980,7 +980,7 @@ bool isTempId(App app) {
|
||||
return RegExp('^[0-9]+\$').hasMatch(app.id);
|
||||
}
|
||||
|
||||
replaceMatchGroupsInString(RegExpMatch match, String matchGroupString) {
|
||||
String? replaceMatchGroupsInString(RegExpMatch match, String matchGroupString) {
|
||||
if (RegExp('^\\d+\$').hasMatch(matchGroupString)) {
|
||||
matchGroupString = '\$$matchGroupString';
|
||||
}
|
||||
@ -1049,7 +1049,7 @@ List<MapEntry<String, String>> filterApks(
|
||||
return apkUrls;
|
||||
}
|
||||
|
||||
isVersionPseudo(App app) =>
|
||||
bool isVersionPseudo(App app) =>
|
||||
app.additionalSettings['trackOnly'] == true ||
|
||||
(app.installedVersion != null &&
|
||||
app.additionalSettings['versionDetection'] != true);
|
||||
|
18
pubspec.lock
18
pubspec.lock
@ -288,10 +288,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: file_picker
|
||||
sha256: "77f8e81d22d2a07d0dee2c62e1dda71dc1da73bf43bb2d45af09727406167964"
|
||||
sha256: ef9908739bdd9c476353d6adff72e88fd00c625f5b959ae23f7567bd5137db0a
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.1.9"
|
||||
version: "10.2.0"
|
||||
fixnum:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -804,10 +804,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pointer_interceptor_web
|
||||
sha256: "7a7087782110f8c1827170660b09f8aa893e0e9a61431dbbe2ac3fc482e8c044"
|
||||
sha256: "460b600e71de6fcea2b3d5f662c92293c049c4319e27f0829310e5a953b3ee2a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.10.2+1"
|
||||
version: "0.10.3"
|
||||
provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -893,7 +893,7 @@ packages:
|
||||
description:
|
||||
path: "."
|
||||
ref: master
|
||||
resolved-ref: "89cdb5434a7ac7510f6bcdb60e1d51a27ee2f40b"
|
||||
resolved-ref: "012e22791138958e089f6c1a8d6c4c6943a9f253"
|
||||
url: "https://github.com/AlexBacich/shared-storage"
|
||||
source: git
|
||||
version: "0.7.0"
|
||||
@ -1155,10 +1155,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: webview_flutter_platform_interface
|
||||
sha256: "7cb32b21825bd65569665c32bb00a34ded5779786d6201f5350979d2d529940d"
|
||||
sha256: f0dc2dc3a2b1e3a6abdd6801b9355ebfeb3b8f6cde6b9dc7c9235909c4a1f147
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.13.0"
|
||||
version: "2.13.1"
|
||||
webview_flutter_wkwebview:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1171,10 +1171,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: win32
|
||||
sha256: "329edf97fdd893e0f1e3b9e88d6a0e627128cc17cc316a8d67fda8f1451178ba"
|
||||
sha256: "66814138c3562338d05613a6e368ed8cfb237ad6d64a9e9334be3f309acfca03"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.13.0"
|
||||
version: "5.14.0"
|
||||
win32_registry:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -149,4 +149,4 @@ flutter:
|
||||
fonts:
|
||||
- family: Montserrat
|
||||
fonts:
|
||||
- asset: assets/fonts/Montserrat-Regular.ttf
|
||||
- asset: assets/fonts/Montserrat-Regular.ttf
|
||||
|
Reference in New Issue
Block a user