mirror of
https://github.com/zapstore/zapstore.git
synced 2026-10-05 20:48:24 +00:00
Messaging fixes
This commit is contained in:
+3
-3
@@ -156,7 +156,7 @@ extension AppX on App {
|
||||
|
||||
AppInstallStatus get status {
|
||||
if (latestMetadata == null) {
|
||||
return AppInstallStatus.notInstallable;
|
||||
return AppInstallStatus.noArch;
|
||||
}
|
||||
if (installedVersion == null) {
|
||||
return AppInstallStatus.installable;
|
||||
@@ -165,7 +165,7 @@ extension AppX on App {
|
||||
if (comp == 1) return AppInstallStatus.updatable;
|
||||
if (comp == 0) return AppInstallStatus.updated;
|
||||
// else it's a downgrade, which is not installable
|
||||
return AppInstallStatus.notInstallable;
|
||||
return AppInstallStatus.downgrade;
|
||||
}
|
||||
|
||||
Future<void> install() async {
|
||||
@@ -260,7 +260,7 @@ Future<bool> _isHashMismatch(String path, String hash) async {
|
||||
|
||||
// install support
|
||||
|
||||
enum AppInstallStatus { updated, updatable, installable, notInstallable }
|
||||
enum AppInstallStatus { updated, updatable, installable, downgrade, noArch }
|
||||
|
||||
// class
|
||||
|
||||
|
||||
@@ -386,7 +386,8 @@ class InstallButton extends ConsumerWidget {
|
||||
width: double.infinity,
|
||||
child: ElevatedButton(
|
||||
onPressed: switch (app.status) {
|
||||
AppInstallStatus.notInstallable => null,
|
||||
AppInstallStatus.noArch => null,
|
||||
AppInstallStatus.downgrade => null,
|
||||
AppInstallStatus.updated => () {
|
||||
LaunchApp.openApp(androidPackageName: app.id!.toString());
|
||||
},
|
||||
@@ -424,7 +425,10 @@ class InstallButton extends ConsumerWidget {
|
||||
_ => Colors.blue[700],
|
||||
}),
|
||||
child: switch (app.status) {
|
||||
AppInstallStatus.notInstallable => Text('Sorry, can\'t install'),
|
||||
AppInstallStatus.noArch =>
|
||||
Text('Sorry, release does not support your device'),
|
||||
AppInstallStatus.downgrade =>
|
||||
Text('Installed version is higher, can\'t downgrade'),
|
||||
AppInstallStatus.updated => Text('Open'),
|
||||
_ => switch (progress) {
|
||||
IdleInstallProgress() => app.canUpdate
|
||||
@@ -491,23 +495,25 @@ class InstallAlertDialog extends ConsumerWidget {
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
if (user != null)
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
app.install();
|
||||
// NOTE: can't use context.pop()
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text('Install'),
|
||||
),
|
||||
if (user == null)
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
scaffoldKey.currentState!.openDrawer();
|
||||
},
|
||||
child: Text('Log in to view web of trust'),
|
||||
child: Text('Log in to view web of trust',
|
||||
style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
app.install();
|
||||
// NOTE: can't use context.pop()
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: user != null
|
||||
? Text('Install', style: TextStyle(fontWeight: FontWeight.bold))
|
||||
: Text('I trust the signer, install anyway'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
// NOTE: can't use context.pop()
|
||||
|
||||
Reference in New Issue
Block a user