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