mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-15 06:06:44 +02:00
Compare commits
2 Commits
v0.2.0-bet
...
v0.2.1-bet
Author | SHA1 | Date | |
---|---|---|---|
9e21f2d6e6 | |||
6f11f850e0 |
@ -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.0-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
|
'v0.2.1-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES
|
||||||
|
|
||||||
@pragma('vm:entry-point')
|
@pragma('vm:entry-point')
|
||||||
void bgTaskCallback() {
|
void bgTaskCallback() {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
@ -7,6 +8,7 @@ import 'package:obtainium/providers/apps_provider.dart';
|
|||||||
import 'package:obtainium/providers/settings_provider.dart';
|
import 'package:obtainium/providers/settings_provider.dart';
|
||||||
import 'package:obtainium/providers/source_provider.dart';
|
import 'package:obtainium/providers/source_provider.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:file_picker/file_picker.dart';
|
||||||
|
|
||||||
class ImportExportPage extends StatefulWidget {
|
class ImportExportPage extends StatefulWidget {
|
||||||
const ImportExportPage({super.key});
|
const ImportExportPage({super.key});
|
||||||
@ -16,7 +18,7 @@ class ImportExportPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ImportExportPageState extends State<ImportExportPage> {
|
class _ImportExportPageState extends State<ImportExportPage> {
|
||||||
bool gettingAppInfo = false;
|
bool importInProgress = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -47,7 +49,7 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: appsProvider.apps.isEmpty || gettingAppInfo
|
onPressed: appsProvider.apps.isEmpty || importInProgress
|
||||||
? null
|
? null
|
||||||
: () {
|
: () {
|
||||||
HapticFeedback.lightImpact();
|
HapticFeedback.lightImpact();
|
||||||
@ -62,42 +64,44 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
|||||||
height: 8,
|
height: 8,
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: gettingAppInfo
|
onPressed: importInProgress
|
||||||
? null
|
? null
|
||||||
: () {
|
: () {
|
||||||
HapticFeedback.lightImpact();
|
HapticFeedback.lightImpact();
|
||||||
showDialog(
|
FilePicker.platform.pickFiles().then((result) {
|
||||||
context: context,
|
setState(() {
|
||||||
builder: (BuildContext ctx) {
|
importInProgress = true;
|
||||||
return GeneratedFormModal(
|
});
|
||||||
title: 'Obtainium Import',
|
if (result != null) {
|
||||||
items: [
|
String data = File(result.files.single.path!)
|
||||||
GeneratedFormItem(
|
.readAsStringSync();
|
||||||
'Obtainium Export JSON Data', true, 7)
|
|
||||||
]);
|
|
||||||
}).then((values) {
|
|
||||||
if (values != null) {
|
|
||||||
try {
|
try {
|
||||||
jsonDecode(values[0]);
|
jsonDecode(data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw 'Invalid input';
|
throw 'Invalid input';
|
||||||
}
|
}
|
||||||
appsProvider.importApps(values[0]).then((value) {
|
appsProvider.importApps(data).then((value) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text(
|
content: Text(
|
||||||
'$value App${value == 1 ? '' : 's'} Imported')),
|
'$value App${value == 1 ? '' : 's'} Imported')),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// User canceled the picker
|
||||||
}
|
}
|
||||||
}).catchError((e) {
|
}).catchError((e) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(content: Text(e.toString())),
|
SnackBar(content: Text(e.toString())),
|
||||||
);
|
);
|
||||||
|
}).whenComplete(() {
|
||||||
|
setState(() {
|
||||||
|
importInProgress = false;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: const Text('Obtainium Import')),
|
child: const Text('Obtainium Import')),
|
||||||
if (gettingAppInfo)
|
if (importInProgress)
|
||||||
Column(
|
Column(
|
||||||
children: const [
|
children: const [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -114,7 +118,7 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
|||||||
height: 32,
|
height: 32,
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: gettingAppInfo
|
onPressed: importInProgress
|
||||||
? null
|
? null
|
||||||
: () {
|
: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
@ -130,7 +134,7 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
|||||||
if (values != null) {
|
if (values != null) {
|
||||||
var urls = (values[0] as String).split('\n');
|
var urls = (values[0] as String).split('\n');
|
||||||
setState(() {
|
setState(() {
|
||||||
gettingAppInfo = true;
|
importInProgress = true;
|
||||||
});
|
});
|
||||||
addApps(urls).then((errors) {
|
addApps(urls).then((errors) {
|
||||||
if (errors.isEmpty) {
|
if (errors.isEmpty) {
|
||||||
@ -154,7 +158,7 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
|||||||
);
|
);
|
||||||
}).whenComplete(() {
|
}).whenComplete(() {
|
||||||
setState(() {
|
setState(() {
|
||||||
gettingAppInfo = false;
|
importInProgress = false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -167,7 +171,7 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
|||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: gettingAppInfo
|
onPressed: importInProgress
|
||||||
? null
|
? null
|
||||||
: () {
|
: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
@ -184,7 +188,7 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
|||||||
if (values != null) {
|
if (values != null) {
|
||||||
source.getUrls(values).then((urls) {
|
source.getUrls(values).then((urls) {
|
||||||
setState(() {
|
setState(() {
|
||||||
gettingAppInfo = true;
|
importInProgress = true;
|
||||||
});
|
});
|
||||||
addApps(urls).then((errors) {
|
addApps(urls).then((errors) {
|
||||||
if (errors.isEmpty) {
|
if (errors.isEmpty) {
|
||||||
@ -207,7 +211,7 @@ class _ImportExportPageState extends State<ImportExportPage> {
|
|||||||
}
|
}
|
||||||
}).whenComplete(() {
|
}).whenComplete(() {
|
||||||
setState(() {
|
setState(() {
|
||||||
gettingAppInfo = false;
|
importInProgress = false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}).catchError((e) {
|
}).catchError((e) {
|
||||||
|
14
pubspec.lock
14
pubspec.lock
@ -162,6 +162,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.1.4"
|
version: "6.1.4"
|
||||||
|
file_picker:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: file_picker
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "5.1.0"
|
||||||
flutter:
|
flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
@ -209,6 +216,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.0.0"
|
version: "5.0.0"
|
||||||
|
flutter_plugin_android_lifecycle:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_plugin_android_lifecycle
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.7"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
|
@ -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.0+11 # When changing this, update the tag in main() accordingly
|
version: 0.2.1+12 # 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'
|
||||||
@ -51,6 +51,7 @@ dependencies:
|
|||||||
permission_handler: ^10.0.0
|
permission_handler: ^10.0.0
|
||||||
fluttertoast: ^8.0.9
|
fluttertoast: ^8.0.9
|
||||||
device_info_plus: ^4.1.2
|
device_info_plus: ^4.1.2
|
||||||
|
file_picker: ^5.1.0
|
||||||
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
Reference in New Issue
Block a user