diff --git a/lib/info.dart b/lib/info.dart index 609a88c..48a0bac 100644 --- a/lib/info.dart +++ b/lib/info.dart @@ -3,4 +3,5 @@ class INFO { static const String author = '22'; static const String authorUrl = 'https://github.com/nini22P'; static const String githubUrl = 'https://github.com/nini22P/iris'; + static const String msStoreId = '9NML7WNHNRTJ'; } diff --git a/lib/widgets/dialogs/show_release_dialog.dart b/lib/widgets/dialogs/show_release_dialog.dart index c8f5712..86188d6 100644 --- a/lib/widgets/dialogs/show_release_dialog.dart +++ b/lib/widgets/dialogs/show_release_dialog.dart @@ -10,6 +10,13 @@ import 'package:iris/utils/get_latest_release.dart'; import 'package:iris/utils/get_localizations.dart'; import 'package:iris/utils/url.dart'; +bool isPortable() { + String resolvedExecutablePath = Platform.resolvedExecutable; + String path = p.dirname(resolvedExecutablePath); + String batFilePath = p.join(path, 'iris-updater.bat'); + return File(batFilePath).existsSync(); +} + Future showReleaseDialog(BuildContext context, {required Release release}) async => await showDialog( @@ -32,10 +39,7 @@ class ReleaseDialog extends HookWidget { useEffect(() { if (isWindows) { - String resolvedExecutablePath = Platform.resolvedExecutable; - String path = p.dirname(resolvedExecutablePath); - String batFilePath = p.join(path, 'iris-updater.bat'); - updateScriptIsExists.value = File(batFilePath).existsSync(); + updateScriptIsExists.value = isPortable(); } return null; }, []); diff --git a/lib/widgets/popups/settings/about.dart b/lib/widgets/popups/settings/about.dart index 93cf20f..82a86ea 100644 --- a/lib/widgets/popups/settings/about.dart +++ b/lib/widgets/popups/settings/about.dart @@ -1,3 +1,6 @@ +import 'dart:io'; +import 'package:iris/utils/platform.dart'; +import 'package:path/path.dart' as p; import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:iris/info.dart'; @@ -7,6 +10,16 @@ import 'package:iris/utils/get_localizations.dart'; import 'package:iris/utils/url.dart'; import 'package:package_info_plus/package_info_plus.dart'; +bool isMsix() { + if (!isWindows) { + return false; + } + String resolvedExecutablePath = Platform.resolvedExecutable; + String path = p.dirname(resolvedExecutablePath); + String batFilePath = p.join(path, 'AppxManifest.xml'); + return File(batFilePath).existsSync(); +} + class About extends HookWidget { const About({super.key}); @@ -48,6 +61,11 @@ class About extends HookWidget { title: Text(t.check_update), subtitle: noNewVersion.value ? Text(t.no_new_version) : null, onTap: () async { + if (isMsix()) { + launchURL( + 'ms-windows-store://pdp/?ProductId=${INFO.msStoreId}'); + return; + } noNewVersion.value = false; final release = await getLatestRelease(); if (release != null && context.mounted) {