mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-22 09:09:41 +02:00
Updated version, standardized quotes, deleted test_page
This commit is contained in:
@@ -21,9 +21,9 @@ class GitHub implements AppSource {
|
||||
Future<APKDetails> getLatestAPKDetails(
|
||||
String standardUrl, List<String> additionalData) async {
|
||||
var includePrereleases =
|
||||
additionalData.isNotEmpty && additionalData[0] == "true";
|
||||
additionalData.isNotEmpty && additionalData[0] == 'true';
|
||||
var fallbackToOlderReleases =
|
||||
additionalData.length >= 2 && additionalData[1] == "true";
|
||||
additionalData.length >= 2 && additionalData[1] == 'true';
|
||||
var regexFilter = additionalData.length >= 3 && additionalData[2].isNotEmpty
|
||||
? additionalData[2]
|
||||
: null;
|
||||
@@ -92,14 +92,14 @@ class GitHub implements AppSource {
|
||||
|
||||
@override
|
||||
List<List<GeneratedFormItem>> additionalDataFormItems = [
|
||||
[GeneratedFormItem(label: "Include prereleases", type: FormItemType.bool)],
|
||||
[GeneratedFormItem(label: 'Include prereleases', type: FormItemType.bool)],
|
||||
[
|
||||
GeneratedFormItem(
|
||||
label: "Fallback to older releases", type: FormItemType.bool)
|
||||
label: 'Fallback to older releases', type: FormItemType.bool)
|
||||
],
|
||||
[
|
||||
GeneratedFormItem(
|
||||
label: "Filter Release Titles by Regular Expression",
|
||||
label: 'Filter Release Titles by Regular Expression',
|
||||
type: FormItemType.string,
|
||||
required: false,
|
||||
additionalValidators: [
|
||||
@@ -110,7 +110,7 @@ class GitHub implements AppSource {
|
||||
try {
|
||||
RegExp(value);
|
||||
} catch (e) {
|
||||
return "Invalid regular expression";
|
||||
return 'Invalid regular expression';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -119,5 +119,5 @@ class GitHub implements AppSource {
|
||||
];
|
||||
|
||||
@override
|
||||
List<String> additionalDataDefaults = ["true", "true", ""];
|
||||
List<String> additionalDataDefaults = ['true', 'true', ''];
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ class GeneratedFormItem {
|
||||
late List<String? Function(String? value)> additionalValidators;
|
||||
|
||||
GeneratedFormItem(
|
||||
{this.label = "Input",
|
||||
{this.label = 'Input',
|
||||
this.type = FormItemType.string,
|
||||
this.required = true,
|
||||
this.max = 1,
|
||||
@@ -69,7 +69,7 @@ class _GeneratedFormState extends State<GeneratedForm> {
|
||||
.map((row) => row.map((e) {
|
||||
return j < widget.defaultValues.length
|
||||
? widget.defaultValues[j++]
|
||||
: "";
|
||||
: '';
|
||||
}).toList())
|
||||
.toList();
|
||||
|
||||
@@ -89,7 +89,7 @@ class _GeneratedFormState extends State<GeneratedForm> {
|
||||
});
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
helperText: e.value.label + (e.value.required ? " *" : "")),
|
||||
helperText: e.value.label + (e.value.required ? ' *' : '')),
|
||||
minLines: e.value.max <= 1 ? null : e.value.max,
|
||||
maxLines: e.value.max <= 1 ? 1 : e.value.max,
|
||||
validator: (value) {
|
||||
@@ -122,10 +122,10 @@ class _GeneratedFormState extends State<GeneratedForm> {
|
||||
children: [
|
||||
Text(widget.items[r][e].label),
|
||||
Switch(
|
||||
value: values[r][e] == "true",
|
||||
value: values[r][e] == 'true',
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
values[r][e] = value ? "true" : "";
|
||||
values[r][e] = value ? 'true' : '';
|
||||
someValueChanged();
|
||||
});
|
||||
})
|
||||
|
@@ -9,7 +9,7 @@ class GeneratedFormModal extends StatefulWidget {
|
||||
required this.items,
|
||||
required this.defaultValues,
|
||||
this.initValid = false,
|
||||
this.message = ""});
|
||||
this.message = ''});
|
||||
|
||||
final String title;
|
||||
final String message;
|
||||
@@ -40,7 +40,7 @@ class _GeneratedFormModalState extends State<GeneratedFormModal> {
|
||||
Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [
|
||||
if (widget.message.isNotEmpty) Text(widget.message),
|
||||
if (widget.message.isNotEmpty)
|
||||
SizedBox(
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
GeneratedForm(
|
||||
|
@@ -13,7 +13,7 @@ import 'package:dynamic_color/dynamic_color.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
|
||||
const String currentReleaseTag =
|
||||
'v0.3.2-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
|
||||
'v0.4.0-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
void bgTaskCallback() {
|
||||
@@ -118,7 +118,7 @@ class MyApp extends StatelessWidget {
|
||||
currentReleaseTag,
|
||||
[],
|
||||
0,
|
||||
["true"]));
|
||||
['true']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@ class AddAppPage extends StatefulWidget {
|
||||
class _AddAppPageState extends State<AddAppPage> {
|
||||
bool gettingAppInfo = false;
|
||||
|
||||
String userInput = "";
|
||||
String userInput = '';
|
||||
AppSource? pickedSource;
|
||||
List<String> additionalData = [];
|
||||
bool validAdditionalData = true;
|
||||
@@ -44,19 +44,19 @@ class _AddAppPageState extends State<AddAppPage> {
|
||||
items: [
|
||||
[
|
||||
GeneratedFormItem(
|
||||
label: "App Source Url",
|
||||
label: 'App Source Url',
|
||||
additionalValidators: [
|
||||
(value) {
|
||||
try {
|
||||
sourceProvider
|
||||
.getSource(value ?? "")
|
||||
.getSource(value ?? '')
|
||||
.standardizeURL(
|
||||
makeUrlHttps(
|
||||
value ?? ""));
|
||||
value ?? ''));
|
||||
} catch (e) {
|
||||
return e is String
|
||||
? e
|
||||
: "Error";
|
||||
: 'Error';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@@ -247,13 +247,13 @@ class AppsPageState extends State<AppsPage> {
|
||||
formInputs.add([
|
||||
GeneratedFormItem(
|
||||
label:
|
||||
"Update ${existingUpdateIdsSelected.length} Apps?",
|
||||
'Update ${existingUpdateIdsSelected.length} Apps?',
|
||||
type: FormItemType.bool)
|
||||
]);
|
||||
formInputs.add([
|
||||
GeneratedFormItem(
|
||||
label:
|
||||
"Install ${newInstallIdsSelected.length} new Apps?",
|
||||
'Install ${newInstallIdsSelected.length} new Apps?',
|
||||
type: FormItemType.bool)
|
||||
]);
|
||||
}
|
||||
@@ -261,13 +261,13 @@ class AppsPageState extends State<AppsPage> {
|
||||
context: context,
|
||||
builder: (BuildContext ctx) {
|
||||
return GeneratedFormModal(
|
||||
title: "Install Selected Apps?",
|
||||
title: 'Install Selected Apps?',
|
||||
message:
|
||||
"${existingUpdateIdsSelected.length} update${existingUpdateIdsSelected.length == 1 ? '' : 's'} and ${newInstallIdsSelected.length} new install${newInstallIdsSelected.length == 1 ? '' : 's'}.",
|
||||
'${existingUpdateIdsSelected.length} update${existingUpdateIdsSelected.length == 1 ? '' : 's'} and ${newInstallIdsSelected.length} new install${newInstallIdsSelected.length == 1 ? '' : 's'}.',
|
||||
items: formInputs,
|
||||
defaultValues: const [
|
||||
"true",
|
||||
"true"
|
||||
'true',
|
||||
'true'
|
||||
],
|
||||
initValid: true,
|
||||
);
|
||||
@@ -275,10 +275,10 @@ class AppsPageState extends State<AppsPage> {
|
||||
if (values != null) {
|
||||
bool shouldInstallUpdates =
|
||||
values.length < 2 ||
|
||||
values[0] == "true";
|
||||
values[0] == 'true';
|
||||
bool shouldInstallNew =
|
||||
values.length < 2 ||
|
||||
values[1] == "true";
|
||||
values[1] == 'true';
|
||||
settingsProvider
|
||||
.getInstallPermission()
|
||||
.then((_) {
|
||||
@@ -323,18 +323,18 @@ class AppsPageState extends State<AppsPage> {
|
||||
items: [
|
||||
[
|
||||
GeneratedFormItem(
|
||||
label: "App Name", required: false),
|
||||
label: 'App Name', required: false),
|
||||
GeneratedFormItem(
|
||||
label: "Author", required: false)
|
||||
label: 'Author', required: false)
|
||||
],
|
||||
[
|
||||
GeneratedFormItem(
|
||||
label: "Up to Date Apps",
|
||||
label: 'Up to Date Apps',
|
||||
type: FormItemType.bool)
|
||||
],
|
||||
[
|
||||
GeneratedFormItem(
|
||||
label: "Non-Installed Apps",
|
||||
label: 'Non-Installed Apps',
|
||||
type: FormItemType.bool)
|
||||
]
|
||||
],
|
||||
@@ -371,8 +371,8 @@ class AppsFilter {
|
||||
late bool includeNonInstalled;
|
||||
|
||||
AppsFilter(
|
||||
{this.nameFilter = "",
|
||||
this.authorFilter = "",
|
||||
{this.nameFilter = '',
|
||||
this.authorFilter = '',
|
||||
this.includeUptodate = true,
|
||||
this.includeNonInstalled = true});
|
||||
|
||||
@@ -380,16 +380,16 @@ class AppsFilter {
|
||||
return [
|
||||
nameFilter,
|
||||
authorFilter,
|
||||
includeUptodate ? "true" : "",
|
||||
includeNonInstalled ? "true" : ""
|
||||
includeUptodate ? 'true' : '',
|
||||
includeNonInstalled ? 'true' : ''
|
||||
];
|
||||
}
|
||||
|
||||
AppsFilter.fromValuesArray(List<String> values) {
|
||||
nameFilter = values[0];
|
||||
authorFilter = values[1];
|
||||
includeUptodate = values[2] == "true";
|
||||
includeNonInstalled = values[3] == "true";
|
||||
includeUptodate = values[2] == 'true';
|
||||
includeNonInstalled = values[3] == 'true';
|
||||
}
|
||||
|
||||
bool isIdenticalTo(AppsFilter other) =>
|
||||
|
@@ -1,53 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:obtainium/components/generated_form.dart';
|
||||
|
||||
class TestPage extends StatefulWidget {
|
||||
const TestPage({super.key});
|
||||
|
||||
@override
|
||||
State<TestPage> createState() => _TestPageState();
|
||||
}
|
||||
|
||||
class _TestPageState extends State<TestPage> {
|
||||
List<String?>? sourceSpecificData;
|
||||
bool valid = false;
|
||||
|
||||
List<List<GeneratedFormItem>> sourceSpecificInputs = [
|
||||
[GeneratedFormItem(label: 'Test Item 1')],
|
||||
[
|
||||
GeneratedFormItem(label: 'Test Item 2', required: false),
|
||||
GeneratedFormItem(label: 'Test Item 3')
|
||||
],
|
||||
[GeneratedFormItem(label: 'Test Item 4', type: FormItemType.bool)]
|
||||
];
|
||||
|
||||
List<String> defaultInputValues = ["ABC"];
|
||||
|
||||
void onSourceSpecificDataChanges(
|
||||
List<String?> valuesFromForm, bool formValid) {
|
||||
setState(() {
|
||||
sourceSpecificData = valuesFromForm;
|
||||
valid = formValid;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Test Page')),
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(children: [
|
||||
GeneratedForm(
|
||||
items: sourceSpecificInputs,
|
||||
onValueChanges: onSourceSpecificDataChanges,
|
||||
defaultValues: defaultInputValues,
|
||||
),
|
||||
...(sourceSpecificData != null
|
||||
? (sourceSpecificData as List<String?>)
|
||||
.map((e) => Text(e ?? ""))
|
||||
: [Container()])
|
||||
])));
|
||||
}
|
||||
}
|
@@ -113,9 +113,6 @@ class AppsProvider with ChangeNotifier {
|
||||
cancelExisting: true);
|
||||
await FGBGEvents.stream.first == FGBGType.foreground;
|
||||
await notificationsProvider.cancel(completeInstallationNotification.id);
|
||||
// We need to wait for the App to come to the foreground to install it
|
||||
// Can't try to call install plugin in a background isolate (may not have worked anyways) because of:
|
||||
// https://github.com/flutter/flutter/issues/13937
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -85,7 +85,7 @@ class App {
|
||||
|
||||
escapeRegEx(String s) {
|
||||
return s.replaceAllMapped(RegExp(r'[.*+?^${}()|[\]\\]'), (x) {
|
||||
return "\\${x[0]}";
|
||||
return '\\${x[0]}';
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -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.3.2+18 # When changing this, update the tag in main() accordingly
|
||||
version: 0.4.0+19 # When changing this, update the tag in main() accordingly
|
||||
|
||||
environment:
|
||||
sdk: '>=2.19.0-79.0.dev <3.0.0'
|
||||
|
Reference in New Issue
Block a user