mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-14 13:46:43 +02:00
Compare commits
1 Commits
v0.2.2-bet
...
v0.2.3-bet
Author | SHA1 | Date | |
---|---|---|---|
3ddf9ea736 |
@ -12,7 +12,7 @@ import 'package:dynamic_color/dynamic_color.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
|
||||
const String currentReleaseTag =
|
||||
'v0.2.2-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
|
||||
'v0.2.3-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
|
||||
|
||||
@pragma('vm:entry-point')
|
||||
void bgTaskCallback() {
|
||||
|
@ -23,7 +23,9 @@ class _AddAppPageState extends State<AddAppPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SourceProvider sourceProvider = SourceProvider();
|
||||
return CustomScrollView(slivers: <Widget>[
|
||||
return Scaffold(
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
body: CustomScrollView(slivers: <Widget>[
|
||||
const CustomAppBar(title: 'Add App'),
|
||||
SliverFillRemaining(
|
||||
hasScrollBody: false,
|
||||
@ -42,7 +44,8 @@ class _AddAppPageState extends State<AddAppPage> {
|
||||
children: [
|
||||
TextFormField(
|
||||
decoration: const InputDecoration(
|
||||
hintText: 'https://github.com/Author/Project',
|
||||
hintText:
|
||||
'https://github.com/Author/Project',
|
||||
helperText: 'Enter the App source URL'),
|
||||
controller: urlInputController,
|
||||
validator: (value) {
|
||||
@ -55,24 +58,26 @@ class _AddAppPageState extends State<AddAppPage> {
|
||||
},
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16.0),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 16.0),
|
||||
child: ElevatedButton(
|
||||
onPressed: gettingAppInfo
|
||||
? null
|
||||
: () {
|
||||
HapticFeedback.selectionClick();
|
||||
if (_formKey.currentState!.validate()) {
|
||||
if (_formKey.currentState!
|
||||
.validate()) {
|
||||
setState(() {
|
||||
gettingAppInfo = true;
|
||||
});
|
||||
sourceProvider
|
||||
.getApp(
|
||||
urlInputController.value.text)
|
||||
.getApp(urlInputController
|
||||
.value.text)
|
||||
.then((app) {
|
||||
var appsProvider =
|
||||
context.read<AppsProvider>();
|
||||
var settingsProvider =
|
||||
context.read<SettingsProvider>();
|
||||
var settingsProvider = context
|
||||
.read<SettingsProvider>();
|
||||
if (appsProvider.apps
|
||||
.containsKey(app.id)) {
|
||||
throw 'App already added';
|
||||
@ -80,21 +85,25 @@ class _AddAppPageState extends State<AddAppPage> {
|
||||
settingsProvider
|
||||
.getInstallPermission()
|
||||
.then((_) {
|
||||
appsProvider.saveApp(app).then((_) {
|
||||
appsProvider
|
||||
.saveApp(app)
|
||||
.then((_) {
|
||||
urlInputController.clear();
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
AppPage(
|
||||
appId: app.id)));
|
||||
appId:
|
||||
app.id)));
|
||||
});
|
||||
});
|
||||
}).catchError((e) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(e.toString())),
|
||||
content:
|
||||
Text(e.toString())),
|
||||
);
|
||||
}).whenComplete(() {
|
||||
setState(() {
|
||||
@ -125,12 +134,14 @@ class _AddAppPageState extends State<AddAppPage> {
|
||||
.map((e) => GestureDetector(
|
||||
onTap: () {
|
||||
launchUrlString('https://$e',
|
||||
mode: LaunchMode.externalApplication);
|
||||
mode:
|
||||
LaunchMode.externalApplication);
|
||||
},
|
||||
child: Text(
|
||||
e,
|
||||
style: const TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
decoration:
|
||||
TextDecoration.underline,
|
||||
fontStyle: FontStyle.italic),
|
||||
)))
|
||||
.toList()
|
||||
@ -142,6 +153,6 @@ class _AddAppPageState extends State<AddAppPage> {
|
||||
],
|
||||
)),
|
||||
))
|
||||
]);
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
@ -54,12 +54,15 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
||||
return errors;
|
||||
}
|
||||
|
||||
return CustomScrollView(slivers: <Widget>[
|
||||
return Scaffold(
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
body: CustomScrollView(slivers: <Widget>[
|
||||
const CustomAppBar(title: 'Import/Export'),
|
||||
SliverFillRemaining(
|
||||
hasScrollBody: false,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
||||
padding:
|
||||
const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
@ -79,8 +82,8 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
SnackBar(
|
||||
content:
|
||||
Text('Exported to $path')),
|
||||
content: Text(
|
||||
'Exported to $path')),
|
||||
);
|
||||
});
|
||||
},
|
||||
@ -102,8 +105,8 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
||||
importInProgress = true;
|
||||
});
|
||||
if (result != null) {
|
||||
String data =
|
||||
File(result.files.single.path!)
|
||||
String data = File(
|
||||
result.files.single.path!)
|
||||
.readAsStringSync();
|
||||
try {
|
||||
jsonDecode(data);
|
||||
@ -126,7 +129,8 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
||||
}).catchError((e) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
SnackBar(content: Text(e.toString())),
|
||||
SnackBar(
|
||||
content: Text(e.toString())),
|
||||
);
|
||||
}).whenComplete(() {
|
||||
setState(() {
|
||||
@ -169,7 +173,8 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
||||
);
|
||||
}).then((values) {
|
||||
if (values != null) {
|
||||
var urls = (values[0] as String).split('\n');
|
||||
var urls =
|
||||
(values[0] as String).split('\n');
|
||||
setState(() {
|
||||
importInProgress = true;
|
||||
});
|
||||
@ -191,7 +196,8 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
||||
});
|
||||
}
|
||||
}).catchError((e) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
SnackBar(content: Text(e.toString())),
|
||||
);
|
||||
}).whenComplete(() {
|
||||
@ -207,7 +213,8 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
||||
)),
|
||||
...sourceProvider.massSources
|
||||
.map((source) => Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
const SizedBox(height: 8),
|
||||
TextButton(
|
||||
@ -216,14 +223,18 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
||||
: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext ctx) {
|
||||
builder:
|
||||
(BuildContext ctx) {
|
||||
return GeneratedFormModal(
|
||||
title:
|
||||
'Import ${source.name}',
|
||||
items: source.requiredArgs
|
||||
items: source
|
||||
.requiredArgs
|
||||
.map((e) =>
|
||||
GeneratedFormItem(
|
||||
e, true, 1))
|
||||
e,
|
||||
true,
|
||||
1))
|
||||
.toList());
|
||||
}).then((values) {
|
||||
if (values != null) {
|
||||
@ -233,7 +244,8 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
||||
setState(() {
|
||||
importInProgress = true;
|
||||
});
|
||||
addApps(urls).then((errors) {
|
||||
addApps(urls)
|
||||
.then((errors) {
|
||||
if (errors.isEmpty) {
|
||||
ScaffoldMessenger.of(
|
||||
context)
|
||||
@ -245,25 +257,29 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
||||
} else {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext
|
||||
builder:
|
||||
(BuildContext
|
||||
ctx) {
|
||||
return ImportErrorDialog(
|
||||
urlsLength:
|
||||
urls.length,
|
||||
errors: errors);
|
||||
urlsLength: urls
|
||||
.length,
|
||||
errors:
|
||||
errors);
|
||||
});
|
||||
}
|
||||
}).whenComplete(() {
|
||||
setState(() {
|
||||
importInProgress = false;
|
||||
importInProgress =
|
||||
false;
|
||||
});
|
||||
});
|
||||
}).catchError((e) {
|
||||
ScaffoldMessenger.of(context)
|
||||
ScaffoldMessenger.of(
|
||||
context)
|
||||
.showSnackBar(
|
||||
SnackBar(
|
||||
content:
|
||||
Text(e.toString())),
|
||||
content: Text(
|
||||
e.toString())),
|
||||
);
|
||||
});
|
||||
}
|
||||
@ -274,7 +290,7 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
||||
.toList()
|
||||
],
|
||||
)))
|
||||
]);
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:obtainium/components/custom_app_bar.dart';
|
||||
import 'package:obtainium/providers/settings_provider.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@ -19,7 +18,9 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
if (settingsProvider.prefs == null) {
|
||||
settingsProvider.initializeSettings();
|
||||
}
|
||||
return CustomScrollView(slivers: <Widget>[
|
||||
return Scaffold(
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
body: CustomScrollView(slivers: <Widget>[
|
||||
const CustomAppBar(title: 'Add App'),
|
||||
SliverFillRemaining(
|
||||
hasScrollBody: true,
|
||||
@ -94,11 +95,13 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
value: settingsProvider.sortColumn,
|
||||
items: const [
|
||||
DropdownMenuItem(
|
||||
value: SortColumnSettings.authorName,
|
||||
value:
|
||||
SortColumnSettings.authorName,
|
||||
child: Text('Author/Name'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: SortColumnSettings.nameAuthor,
|
||||
value:
|
||||
SortColumnSettings.nameAuthor,
|
||||
child: Text('Name/Author'),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
@ -208,8 +211,8 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
TextButton.icon(
|
||||
style: ButtonStyle(
|
||||
foregroundColor:
|
||||
MaterialStateProperty.resolveWith<Color>(
|
||||
(Set<MaterialState> states) {
|
||||
MaterialStateProperty.resolveWith<
|
||||
Color>((Set<MaterialState> states) {
|
||||
return Colors.grey;
|
||||
}),
|
||||
),
|
||||
@ -220,13 +223,14 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
icon: const Icon(Icons.code),
|
||||
label: Text(
|
||||
'Source',
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
style:
|
||||
Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
)))
|
||||
]);
|
||||
]));
|
||||
}
|
||||
}
|
||||
|
@ -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.2.2+13 # When changing this, update the tag in main() accordingly
|
||||
version: 0.2.3+14 # 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