Skip to content

Commit

Permalink
Merge pull request #1180 from ImranR98/dev
Browse files Browse the repository at this point in the history
- Fix installed version bug when importing apps (#1179)
- Share button now shares Obtainium "protocol" links
  • Loading branch information
ImranR98 authored Dec 23, 2023
2 parents cdccf58 + eacf377 commit b63a798
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 27 deletions.
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import 'package:easy_localization/src/easy_localization_controller.dart';
// ignore: implementation_imports
import 'package:easy_localization/src/localization.dart';

const String currentVersion = '0.14.39';
const String currentVersion = '0.14.40';
const String currentReleaseTag =
'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES

Expand Down
28 changes: 8 additions & 20 deletions lib/pages/apps.dart
Original file line number Diff line number Diff line change
Expand Up @@ -496,14 +496,8 @@ class AppsPageState extends State<AppsPage> {
var transparent =
Theme.of(context).colorScheme.background.withAlpha(0).value;
List<double> stops = [
...listedApps[index]
.app
.categories
.asMap()
.entries
.map((e) =>
((e.key / (listedApps[index].app.categories.length - 1))))
,
...listedApps[index].app.categories.asMap().entries.map(
(e) => ((e.key / (listedApps[index].app.categories.length - 1)))),
1
];
if (stops.length == 2) {
Expand All @@ -516,13 +510,9 @@ class AppsPageState extends State<AppsPage> {
begin: const Alignment(-1, 0),
end: const Alignment(-0.97, 0),
colors: [
...listedApps[index]
.app
.categories
.map((e) =>
Color(settingsProvider.categories[e] ?? transparent)
.withAlpha(255))
,
...listedApps[index].app.categories.map((e) =>
Color(settingsProvider.categories[e] ?? transparent)
.withAlpha(255)),
Color(transparent)
])),
child: ListTile(
Expand Down Expand Up @@ -881,7 +871,7 @@ class AppsPageState extends State<AppsPage> {
onPressed: () {
String urls = '';
for (var a in selectedApps) {
urls += '${a.url}\n';
urls += 'obtainium://add/${a.url}\n';
}
urls = urls.substring(0, urls.length - 1);
Share.share(urls,
Expand Down Expand Up @@ -981,10 +971,8 @@ class AppsPageState extends State<AppsPage> {
defaultValue: filter.sourceFilter,
[
MapEntry('', tr('none')),
...sourceProvider.sources
.map((e) =>
MapEntry(e.runtimeType.toString(), e.name))

...sourceProvider.sources.map(
(e) => MapEntry(e.runtimeType.toString(), e.name))
])
]
],
Expand Down
12 changes: 7 additions & 5 deletions lib/providers/apps_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -740,12 +740,15 @@ class AppsProvider with ChangeNotifier {
return appsDir;
}

Future<PackageInfo?> getInstalledInfo(String? packageName) async {
Future<PackageInfo?> getInstalledInfo(String? packageName,
{bool printErr = true}) async {
if (packageName != null) {
try {
return await pm.getPackageInfo(packageName: packageName);
} catch (e) {
print(e); // OK
if (printErr) {
print(e); // OK
}
}
}
return null;
Expand Down Expand Up @@ -1253,9 +1256,8 @@ class AppsProvider with ChangeNotifier {
await Future.delayed(const Duration(microseconds: 1));
}
for (App a in importedApps) {
if (apps[a.id]?.app.installedVersion != null) {
a.installedVersion = apps[a.id]?.app.installedVersion;
}
a.installedVersion =
(await getInstalledInfo(a.id, printErr: false))?.versionName;
}
await saveApps(importedApps, onlyIfExists: false);
notifyListeners();
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.14.39+233 # When changing this, update the tag in main() accordingly
version: 0.14.40+234 # When changing this, update the tag in main() accordingly

environment:
sdk: '>=3.0.0 <4.0.0'
Expand Down

0 comments on commit b63a798

Please sign in to comment.