Disable cache
All checks were successful
Flutter Release / get-version (push) Successful in 10s
Flutter Release / build-windows (push) Successful in 1m58s
Flutter Release / build-android (push) Successful in 11m36s
Flutter Release / create-release (push) Successful in 30s

This commit is contained in:
2025-12-15 13:21:50 -05:00
parent dae47fdeb9
commit e82255d8a1
6 changed files with 193 additions and 27 deletions

View File

@@ -1,4 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Internet permissions (required for API/WebSocket) -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- Notification permissions -->
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.VIBRATE" />

81
flutter_app/build_sfx.ps1 Normal file
View File

@@ -0,0 +1,81 @@
# rmtPocketWatcher Self-Extracting Executable Builder
# Creates a single .exe that extracts and runs the app
$ErrorActionPreference = "Stop"
$7zPath = "${env:ProgramFiles}\7-Zip\7z.exe"
if (-not (Test-Path $7zPath)) {
$7zPath = "${env:ProgramFiles(x86)}\7-Zip\7z.exe"
}
if (-not (Test-Path $7zPath)) {
Write-Error "7-Zip not found. Please install 7-Zip from https://7-zip.org"
exit 1
}
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$StandaloneDir = Join-Path $ScriptDir "build\windows\standalone"
$OutputDir = Join-Path $ScriptDir "build\windows\sfx"
$SfxModule = "${env:ProgramFiles}\7-Zip\7z.sfx"
$PubspecPath = Join-Path $ScriptDir "pubspec.yaml"
if (-not (Test-Path $StandaloneDir)) {
Write-Error "Standalone build not found. Run build_windows.ps1 first."
exit 1
}
Write-Host "Creating self-extracting executable..." -ForegroundColor Green
# Create output directory
if (Test-Path $OutputDir) { Remove-Item -Recurse -Force $OutputDir }
New-Item -ItemType Directory -Path $OutputDir -Force | Out-Null
# Create SFX config file - silent extract to AppData and run
$SfxConfig = @"
;!@Install@!UTF-8!
Title="rmtPocketWatcher"
InstallPath="%LOCALAPPDATA%\\rmtPocketWatcher"
RunProgram="rmtpocketwatcher.exe"
GUIMode="2"
OverwriteMode="2"
;!@InstallEnd@!
"@
$SfxConfigPath = "$OutputDir\sfx_config.txt"
$SfxConfig | Out-File -FilePath $SfxConfigPath -Encoding UTF8
# Create 7z archive of standalone folder
$ArchivePath = "$OutputDir\app.7z"
Write-Host "Compressing application..." -ForegroundColor Yellow
& $7zPath a -t7z -mx=9 -mf=BCJ2 -r $ArchivePath "$StandaloneDir\*" | Out-Null
if (-not (Test-Path $ArchivePath)) {
Write-Error "Failed to create archive"
exit 1
}
# Combine SFX module + config + archive
$Version = (Select-String -Path $PubspecPath -Pattern "^version: (.+)$").Matches[0].Groups[1].Value -replace '\+.*', ''
$SfxExePath = "$OutputDir\rmtPocketWatcher-v$Version-Portable.exe"
Write-Host "Building self-extracting executable..." -ForegroundColor Yellow
# Read binary files and concatenate
$sfxBytes = [System.IO.File]::ReadAllBytes($SfxModule)
$configBytes = [System.IO.File]::ReadAllBytes($SfxConfigPath)
$archiveBytes = [System.IO.File]::ReadAllBytes($ArchivePath)
$outputStream = [System.IO.File]::Create($SfxExePath)
$outputStream.Write($sfxBytes, 0, $sfxBytes.Length)
$outputStream.Write($configBytes, 0, $configBytes.Length)
$outputStream.Write($archiveBytes, 0, $archiveBytes.Length)
$outputStream.Close()
# Cleanup temp files
Remove-Item $SfxConfigPath -Force
Remove-Item $ArchivePath -Force
$FileSize = [math]::Round((Get-Item $SfxExePath).Length / 1MB, 2)
Write-Host "`n✅ Self-extracting executable created!" -ForegroundColor Green
Write-Host " File: $SfxExePath" -ForegroundColor Cyan
Write-Host " Size: $FileSize MB" -ForegroundColor Cyan
Write-Host "`nThis single .exe can be distributed and run on any Windows PC." -ForegroundColor Yellow

View File

@@ -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;

View File

@@ -16,7 +16,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: 1.0.0
version: 1.0.1
environment:
sdk: '>=3.5.0 <4.0.0'

View File

@@ -43,6 +43,10 @@ function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_options(${TARGET} PRIVATE /EHsc)
target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
target_compile_definitions(${TARGET} PRIVATE "$<$<CONFIG:Debug>:_DEBUG>")
# Use static runtime for truly portable builds (no VC++ Redistributable required)
set_property(TARGET ${TARGET} PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endfunction()
# Flutter library and tool build rules.