Disable cache
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import 'dart:io';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
@@ -6,6 +7,20 @@ import 'package:xml/xml.dart';
|
||||
class UpdateService {
|
||||
static const String _releasesRssUrl = 'https://git.hudsonriggs.systems/LambdaBankingConglomerate/rmtPocketWatcher/releases.rss';
|
||||
|
||||
/// Check if the app was installed via MSIX (Windows Store-style installation)
|
||||
static bool isInstalledViaMsix() {
|
||||
if (!Platform.isWindows) return false;
|
||||
|
||||
try {
|
||||
// MSIX apps are installed in WindowsApps folder
|
||||
final exePath = Platform.resolvedExecutable;
|
||||
return exePath.contains('WindowsApps') ||
|
||||
exePath.contains('Program Files\\WindowsApps');
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if an update is available by comparing current version with latest release
|
||||
Future<UpdateInfo?> checkForUpdates() async {
|
||||
try {
|
||||
@@ -143,27 +158,34 @@ class UpdateService {
|
||||
final baseUrl = 'https://git.hudsonriggs.systems/LambdaBankingConglomerate/rmtPocketWatcher/releases/download/v$version';
|
||||
|
||||
return [
|
||||
// Windows Full Package
|
||||
// Windows Full Package (ZIP with all DLLs)
|
||||
ReleaseAsset(
|
||||
name: 'rmtPocketWatcher-Windows-v$version.zip',
|
||||
downloadUrl: '$baseUrl/rmtPocketWatcher-Windows-v$version.zip',
|
||||
size: 0, // Unknown size from RSS
|
||||
contentType: 'application/zip',
|
||||
),
|
||||
// Windows Portable (single exe)
|
||||
ReleaseAsset(
|
||||
name: 'rmtPocketWatcher-Windows-Portable-v$version.zip',
|
||||
downloadUrl: '$baseUrl/rmtPocketWatcher-Windows-Portable-v$version.zip',
|
||||
size: 0,
|
||||
contentType: 'application/zip',
|
||||
),
|
||||
// Windows Portable (self-extracting EXE)
|
||||
ReleaseAsset(
|
||||
name: 'rmtPocketWatcher-Windows-Portable-v$version.exe',
|
||||
downloadUrl: '$baseUrl/rmtPocketWatcher-Windows-Portable-v$version.exe',
|
||||
size: 0,
|
||||
contentType: 'application/octet-stream',
|
||||
),
|
||||
// Windows MSIX Installer
|
||||
ReleaseAsset(
|
||||
name: 'rmtPocketWatcher-v$version.msix',
|
||||
downloadUrl: '$baseUrl/rmtPocketWatcher-v$version.msix',
|
||||
name: 'rmtPocketWatcher-Windows-v$version.msix',
|
||||
downloadUrl: '$baseUrl/rmtPocketWatcher-Windows-v$version.msix',
|
||||
size: 0,
|
||||
contentType: 'application/msix',
|
||||
),
|
||||
// Certificate for code signing verification
|
||||
ReleaseAsset(
|
||||
name: 'rmtPocketWatcher-Certificate.cer',
|
||||
downloadUrl: '$baseUrl/rmtPocketWatcher-Certificate.cer',
|
||||
size: 0,
|
||||
contentType: 'application/x-x509-ca-cert',
|
||||
),
|
||||
// Android APK
|
||||
ReleaseAsset(
|
||||
name: 'rmtPocketWatcher-Android-v$version.apk',
|
||||
@@ -200,11 +222,17 @@ class UpdateInfo {
|
||||
|
||||
switch (defaultTargetPlatform) {
|
||||
case TargetPlatform.windows:
|
||||
// Prefer portable version for Windows
|
||||
var portable = assets.where((asset) => asset.name.contains('Portable')).firstOrNull;
|
||||
// If installed via MSIX, prefer MSIX for updates
|
||||
if (UpdateService.isInstalledViaMsix()) {
|
||||
var msix = assets.where((asset) => asset.name.endsWith('.msix')).firstOrNull;
|
||||
if (msix != null) return msix;
|
||||
}
|
||||
|
||||
// Prefer portable self-extracting exe for non-MSIX installs
|
||||
var portable = assets.where((asset) => asset.name.contains('Portable') && asset.name.endsWith('.exe')).firstOrNull;
|
||||
if (portable != null) return portable;
|
||||
|
||||
// Fall back to full Windows package
|
||||
// Fall back to full Windows package (ZIP)
|
||||
var windows = assets.where((asset) => asset.name.contains('Windows') && asset.name.endsWith('.zip')).firstOrNull;
|
||||
if (windows != null) return windows;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user