Compare commits

..
4 Commits
Author SHA1 Message Date
brontomark c8fdd29cf4 v
Build and Release FLUX (Multi-Platform) / build-web (push) Successful in 1m55s
Build and Release FLUX (Multi-Platform) / build-linux (push) Successful in 1m26s
Build and Release FLUX (Multi-Platform) / build-windows (push) Failing after 9m48s
Build and Release FLUX (Multi-Platform) / build-macos (push) Failing after 11m3s
2026-09-21 09:30:44 +02:00
brontomark 00615b92a0 fix(windows): use {autopf} with PrivilegesRequired=lowest and bump to v2.0.9
Build and Release FLUX (Multi-Platform) / build-web (push) Successful in 1m50s
Build and Release FLUX (Multi-Platform) / build-linux (push) Successful in 1m21s
Build and Release FLUX (Multi-Platform) / build-windows (push) Failing after 12m2s
Build and Release FLUX (Multi-Platform) / build-macos (push) Successful in 2m59s
2026-09-19 19:24:11 +02:00
brontomark 832be3d797 feat: supporto latest_version, riga AppImage e gestione aggiornamento facoltativo/obbligatorio
Build and Release FLUX (Multi-Platform) / build-web (push) Successful in 1m53s
Build and Release FLUX (Multi-Platform) / build-linux (push) Successful in 1m20s
Build and Release FLUX (Multi-Platform) / build-windows (push) Failing after 6m18s
Build and Release FLUX (Multi-Platform) / build-macos (push) Failing after 14m10s
2026-09-19 18:42:34 +02:00
brontomark 72f9d88f96 auto update
Build and Release FLUX (Multi-Platform) / build-web (push) Successful in 1m58s
Build and Release FLUX (Multi-Platform) / build-linux (push) Successful in 1m22s
Build and Release FLUX (Multi-Platform) / build-windows (push) Failing after 7m41s
Build and Release FLUX (Multi-Platform) / build-macos (push) Has been cancelled
2026-09-19 18:25:30 +02:00
6 changed files with 523 additions and 127 deletions

No files matched your search

+35 -36
View File
@@ -49,44 +49,24 @@ jobs:
files: "build/windows/installer/FluxInstaller.exe"
api_key: ${{ secrets.MYRELEASE_TOKEN }}
- name: Aggiorna Link Windows su Supabase
run: |
$TagVersion = "${{ github.ref_name }}".TrimStart('v')
$headers = @{
"apikey" = "${{ secrets.SUPABASE_SERVICE_KEY }}"
"Authorization" = "Bearer ${{ secrets.SUPABASE_SERVICE_KEY }}"
"Content-Type" = "application/json"
}
$body = (@{
download_url = "https://gitea.catelli.it/brontomark/flux/releases/download/${{ github.ref_name }}/FluxInstaller.exe"
latest_version = $TagVersion
} | ConvertTo-Json)
Invoke-RestMethod -Uri "https://pvqpjloswwvtfoxbkfbh.supabase.co/rest/v1/app_config?platform=eq.windows" -Method Patch -Headers $headers -Body $body
- name: Pulisci Workspace Windows
if: always()
run: Remove-Item -Recurse -Force ./*
# -----------------------------------------------------------------
# JOB 2: ANDROID APPBUNDLE (Gira sul runner Fedora o Mac)
# -----------------------------------------------------------------
build-android:
runs-on: cross-runner
steps:
- name: Checkout del codice
uses: actions/checkout@v3
# Logica Bash per Mac/Linux: usiamo le virgolette singole forti per evitare escape strani
- name: Crea file .env
run: |
cat << 'EOF' > .env
${{ secrets.ENV_FILE_CONTENT }}
EOF
- name: Build Flutter AppBundle
run: flutter build appbundle --release
# Carichiamo l'AAB nelle release di Gitea per poi caricarlo su Google Play Console
- name: Upload Android Asset
uses: https://gitea.com/actions/release-action@main
with:
files: "build/app/outputs/bundle/release/app-release.aab"
api_key: ${{ secrets.MYRELEASE_TOKEN }}
- name: Aggiorna Link Android su Supabase
run: |
curl -X PATCH "https://pvqpjloswwvtfoxbkfbh.supabase.co/rest/v1/app_config?id=eq.49f18b19-2129-46c0-b690-a97db725b5a8" -H "apikey: ${{ secrets.SUPABASE_SERVICE_KEY }}" -H "Authorization: Bearer ${{ secrets.SUPABASE_SERVICE_KEY }}" -H "Content-Type: application/json" -d "{\"download_url\": \"https://gitea.catelli.it/brontomark/flux/releases/download/${{ github.ref_name }}/app-release.aab\"}"
- name: Aggiorna Link Windows su Supabase
run: |
curl -X PATCH "https://pvqpjloswwvtfoxbkfbh.supabase.co/rest/v1/app_config?id=eq.1f888b30-5cbf-4a16-820c-5036a3af0cf8" -H "apikey: ${{ secrets.SUPABASE_SERVICE_KEY }}" -H "Authorization: Bearer ${{ secrets.SUPABASE_SERVICE_KEY }}" -H "Content-Type: application/json" -d "{\"download_url\": \"https://gitea.catelli.it/brontomark/flux/releases/download/${{ github.ref_name }}/FluxInstaller.exe\"}"
# -----------------------------------------------------------------
# JOB 3: WEB & CLOUDFLARE DEPLOY (Gira sul runner Fedora o Mac)
@@ -114,6 +94,15 @@ jobs:
run: |
npx wrangler pages deploy build/web --project-name="flux" --branch="main"
- name: Aggiorna Versione Web su Supabase
run: |
TagVersion="${GITHUB_REF_NAME#v}"
curl -X PATCH "https://pvqpjloswwvtfoxbkfbh.supabase.co/rest/v1/app_config?platform=eq.web" \
-H "apikey: ${{ secrets.SUPABASE_SERVICE_KEY }}" \
-H "Authorization: Bearer ${{ secrets.SUPABASE_SERVICE_KEY }}" \
-H "Content-Type: application/json" \
-d "{\"latest_version\": \"$TagVersion\"}"
# -----------------------------------------------------------------
# JOB 4: LINUX APPIMAGE (Gira sul tuo PC Fedora / Linux Runner)
# -----------------------------------------------------------------
@@ -175,7 +164,12 @@ jobs:
- name: Aggiorna Link Linux su Supabase
run: |
curl -X PATCH "https://pvqpjloswwvtfoxbkfbh.supabase.co/rest/v1/app_config?platform=eq.linux" -H "apikey: ${{ secrets.SUPABASE_SERVICE_KEY }}" -H "Authorization: Bearer ${{ secrets.SUPABASE_SERVICE_KEY }}" -H "Content-Type: application/json" -d "{\"download_url\": \"https://gitea.catelli.it/brontomark/flux/releases/download/${{ github.ref_name }}/Flux-x86_64.AppImage\"}"
TagVersion="${GITHUB_REF_NAME#v}"
curl -X PATCH "https://pvqpjloswwvtfoxbkfbh.supabase.co/rest/v1/app_config?platform=eq.AppImage" \
-H "apikey: ${{ secrets.SUPABASE_SERVICE_KEY }}" \
-H "Authorization: Bearer ${{ secrets.SUPABASE_SERVICE_KEY }}" \
-H "Content-Type: application/json" \
-d "{\"download_url\": \"https://gitea.catelli.it/brontomark/flux/releases/download/${{ github.ref_name }}/Flux-x86_64.AppImage\", \"latest_version\": \"$TagVersion\"}"
# -----------------------------------------------------------------
# JOB 5: MACOS (Gira sul tuo Mac / macos-runner)
@@ -215,4 +209,9 @@ jobs:
- name: Aggiorna Link macOS su Supabase
run: |
curl -X PATCH "https://pvqpjloswwvtfoxbkfbh.supabase.co/rest/v1/app_config?platform=eq.macos" -H "apikey: ${{ secrets.SUPABASE_SERVICE_KEY }}" -H "Authorization: Bearer ${{ secrets.SUPABASE_SERVICE_KEY }}" -H "Content-Type: application/json" -d "{\"download_url\": \"https://gitea.catelli.it/brontomark/flux/releases/download/${{ github.ref_name }}/Flux-macOS.dmg\"}"
TagVersion="${GITHUB_REF_NAME#v}"
curl -X PATCH "https://pvqpjloswwvtfoxbkfbh.supabase.co/rest/v1/app_config?platform=eq.macos" \
-H "apikey: ${{ secrets.SUPABASE_SERVICE_KEY }}" \
-H "Authorization: Bearer ${{ secrets.SUPABASE_SERVICE_KEY }}" \
-H "Content-Type: application/json" \
-d "{\"download_url\": \"https://gitea.catelli.it/brontomark/flux/releases/download/${{ github.ref_name }}/Flux-macOS.dmg\", \"latest_version\": \"$TagVersion\"}"
+164
View File
@@ -0,0 +1,164 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter/foundation.dart';
class AutoUpdateService {
/// Verifica se la piattaforma corrente supporta l'aggiornamento automatico trasparente
static bool get isAutoUpdateSupported {
if (kIsWeb) return false;
if (Platform.isWindows) return true;
if (Platform.isLinux && Platform.environment['APPIMAGE'] != null) {
return true;
}
return false;
}
/// Scarica l'aggiornamento e lo applica in modo silenzioso
static Future<void> downloadAndApplyUpdate({
required String downloadUrl,
required void Function(double progress, String status) onProgress,
}) async {
if (kIsWeb) {
throw UnsupportedError("L'auto-update non è supportato su Web.");
}
if (Platform.isWindows) {
await _updateWindows(downloadUrl, onProgress);
} else if (Platform.isLinux) {
await _updateLinux(downloadUrl, onProgress);
} else {
throw UnsupportedError("Piattaforma non supportata per l'auto-update.");
}
}
/// Gestione aggiornamento Windows
static Future<void> _updateWindows(
String downloadUrl,
void Function(double progress, String status) onProgress,
) async {
final tempDir = Directory.systemTemp;
final installerFile = File('${tempDir.path}\\FluxInstaller_Update.exe');
if (installerFile.existsSync()) {
try {
installerFile.deleteSync();
} catch (_) {}
}
onProgress(0.0, "Download aggiornamento in corso...");
await _downloadFile(downloadUrl, installerFile, onProgress);
onProgress(1.0, "Installazione e riavvio in corso...");
await Future.delayed(const Duration(milliseconds: 500));
// Lancia l'installer in modalità silenziosa per utente singolo
// /VERYSILENT: nessuna interfaccia
// /SUPPRESSMSGBOXES: nessun popup
// /NORESTART: non riavvia il PC
await Process.start(
installerFile.path,
['/VERYSILENT', '/SUPPRESSMSGBOXES', '/NORESTART'],
mode: ProcessStartMode.detached,
);
// Chiude l'applicazione per consentire la sostituzione dei file
exit(0);
}
/// Gestione aggiornamento Linux (AppImage in-place)
static Future<void> _updateLinux(
String downloadUrl,
void Function(double progress, String status) onProgress,
) async {
final currentAppImagePath = Platform.environment['APPIMAGE'];
if (currentAppImagePath == null) {
throw StateError(
"L'applicazione non è in esecuzione come AppImage.",
);
}
final newAppImageFile = File('$currentAppImagePath.new');
if (newAppImageFile.existsSync()) {
try {
newAppImageFile.deleteSync();
} catch (_) {}
}
onProgress(0.0, "Download nuova versione in corso...");
await _downloadFile(downloadUrl, newAppImageFile, onProgress);
onProgress(1.0, "Finalizzazione e riavvio...");
await Future.delayed(const Duration(milliseconds: 300));
// Assegna il permesso di esecuzione
await Process.run('chmod', ['+x', newAppImageFile.path]);
// Sostituzione atomica del vecchio file AppImage con il nuovo
newAppImageFile.renameSync(currentAppImagePath);
// Rilancia la nuova versione
await Process.start(
currentAppImagePath,
[],
mode: ProcessStartMode.detached,
);
// Termina il processo attuale
exit(0);
}
/// Download in streaming con tracciamento del progresso
static Future<void> _downloadFile(
String url,
File destinationFile,
void Function(double progress, String status) onProgress,
) async {
final client = HttpClient();
client.autoUncompress = true;
try {
final uri = Uri.parse(url);
final request = await client.getUrl(uri);
final response = await request.close();
if (response.statusCode < 200 || response.statusCode >= 300) {
throw HttpException(
'Download fallito con codice di stato ${response.statusCode}',
uri: uri,
);
}
final contentLength = response.contentLength;
int downloadedBytes = 0;
final sink = destinationFile.openWrite();
await for (final chunk in response) {
sink.add(chunk);
downloadedBytes += chunk.length;
if (contentLength > 0) {
final progress = (downloadedBytes / contentLength).clamp(0.0, 1.0);
final percent = (progress * 100).toStringAsFixed(0);
final downloadedMb =
(downloadedBytes / (1024 * 1024)).toStringAsFixed(1);
final totalMb = (contentLength / (1024 * 1024)).toStringAsFixed(1);
onProgress(
progress,
'Scaricamento: $percent% ($downloadedMb MB di $totalMb MB)',
);
} else {
final downloadedMb =
(downloadedBytes / (1024 * 1024)).toStringAsFixed(1);
onProgress(0.5, 'Scaricamento in corso ($downloadedMb MB)...');
}
}
await sink.flush();
await sink.close();
} finally {
client.close();
}
}
}
+100 -55
View File
@@ -3,46 +3,86 @@ import 'package:flutter/foundation.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
enum UpdateType {
none,
optional,
mandatory,
}
class UpdateInfo {
final UpdateType type;
final String latestVersion;
final String minVersion;
final String downloadUrl;
const UpdateInfo({
required this.type,
required this.latestVersion,
required this.minVersion,
required this.downloadUrl,
});
bool get isMandatory => type == UpdateType.mandatory;
bool get isOptional => type == UpdateType.optional;
bool get hasUpdate => type != UpdateType.none;
}
class VersionCheckService {
Future<String?> checkForceUpdate() async {
Future<UpdateInfo?> checkUpdate() async {
try {
// 1. Capiamo su che piattaforma sta girando l'app in questo istante
String currentPlatform = _getCurrentPlatform();
final platformAliases = _getPlatformAliases();
// 2. Recuperiamo SOLO la riga corrispondente alla nostra piattaforma
final dbResponse = await Supabase.instance.client
.from('app_config')
.select('min_version, download_url')
.eq('platform', currentPlatform)
.maybeSingle(); // Usiamo maybeSingle così se non c'è la riga non crasha
.select('platform, min_version, latest_version, download_url');
if (dbResponse == null) {
return null; // Nessuna regola per questa piattaforma
if (dbResponse.isEmpty) {
return null;
}
String minVersionFromDb = dbResponse['min_version'] as String;
String downloadUrl = dbResponse['download_url'] as String;
final rows = List<Map<String, dynamic>>.from(dbResponse);
final config = rows.firstWhere(
(r) {
final p = (r['platform'] as String?)?.toLowerCase().trim() ?? '';
return platformAliases.any((alias) => alias.toLowerCase() == p);
},
orElse: () => {},
);
// 3. Recuperiamo la versione locale di Flutter
PackageInfo packageInfo = await PackageInfo.fromPlatform();
String localVersionRaw = packageInfo.version;
if (config.isEmpty) {
return null;
}
// 🥷 TRUCCO 1: Pulizia totale dai build number (+37) o tag "v"
String cleanLocal = localVersionRaw
.split('+')
.first
.replaceAll('v', '')
.trim();
String cleanDb = minVersionFromDb
.split('+')
.first
.replaceAll('v', '')
.trim();
final minVersionRaw = (config['min_version'] as String?) ?? '0.0.0';
final latestVersionRaw =
(config['latest_version'] as String?) ?? minVersionRaw;
final downloadUrl = (config['download_url'] as String?) ?? '';
// 🥷 TRUCCO 2: Confronto Semantico Reale
if (_isVersionLower(current: cleanLocal, minimum: cleanDb)) {
// Ritorna il link VERO per questa specifica piattaforma preso dal CSV!
return downloadUrl;
final packageInfo = await PackageInfo.fromPlatform();
final localVersionRaw = packageInfo.version;
final cleanLocal = _cleanVersion(localVersionRaw);
final cleanMin = _cleanVersion(minVersionRaw);
final cleanLatest = _cleanVersion(latestVersionRaw);
// Se la versione locale è inferiore alla minima ammessa -> obbligatorio
if (_isVersionLower(current: cleanLocal, target: cleanMin)) {
return UpdateInfo(
type: UpdateType.mandatory,
latestVersion: latestVersionRaw,
minVersion: minVersionRaw,
downloadUrl: downloadUrl,
);
}
// Se è >= della minima ma inferiore all'ultima disponibile -> facoltativo
if (_isVersionLower(current: cleanLocal, target: cleanLatest)) {
return UpdateInfo(
type: UpdateType.optional,
latestVersion: latestVersionRaw,
minVersion: minVersionRaw,
downloadUrl: downloadUrl,
);
}
return null;
@@ -52,43 +92,48 @@ class VersionCheckService {
}
}
// Helper ninja per mappare le piattaforme in base alle stringhe del tuo DB
String _getCurrentPlatform() {
if (kIsWeb) return 'web';
if (Platform.isAndroid) return 'android';
if (Platform.isIOS) return 'ios';
if (Platform.isWindows) return 'windows';
if (Platform.isMacOS) return 'macos';
if (Platform.isLinux) return 'linux';
return 'unknown';
Future<String?> checkForceUpdate() async {
final info = await checkUpdate();
return info?.isMandatory == true ? info?.downloadUrl : null;
}
// Il motore matematico (resta invariato)
bool _isVersionLower({required String current, required String minimum}) {
if (current == minimum) return false;
String _cleanVersion(String raw) {
return raw.split('+').first.replaceAll('v', '').trim();
}
List<int> currentParts = current
List<String> _getPlatformAliases() {
if (kIsWeb) return const ['web'];
if (Platform.isAndroid) return const ['android'];
if (Platform.isIOS) return const ['ios'];
if (Platform.isWindows) return const ['windows'];
if (Platform.isMacOS) return const ['macos'];
if (Platform.isLinux) return const ['AppImage', 'linux'];
return const ['unknown'];
}
bool _isVersionLower({required String current, required String target}) {
if (current == target) return false;
final currentParts = current
.split('.')
.map((e) => int.tryParse(e) ?? 0)
.toList();
List<int> minParts = minimum
final targetParts = target
.split('.')
.map((e) => int.tryParse(e) ?? 0)
.toList();
while (currentParts.length < 3) {
currentParts.add(0);
}
while (minParts.length < 3) {
minParts.add(0);
}
final maxLength = currentParts.length > targetParts.length
? currentParts.length
: targetParts.length;
if (currentParts[0] != minParts[0]) {
return currentParts[0] < minParts[0];
for (int i = 0; i < maxLength; i++) {
final c = i < currentParts.length ? currentParts[i] : 0;
final t = i < targetParts.length ? targetParts[i] : 0;
if (c != t) {
return c < t;
}
}
if (currentParts[1] != minParts[1]) {
return currentParts[1] < minParts[1];
}
return currentParts[2] < minParts[2];
return false;
}
}
+216 -29
View File
@@ -32,6 +32,7 @@ import 'package:flux/features/master_data/store/bloc/store_cubit.dart';
import 'package:flutter_web_plugins/url_strategy.dart';
import 'package:universal_html/html.dart' as html;
import 'package:url_launcher/url_launcher.dart';
import 'package:flux/core/utils/auto_update_service.dart';
String? initialRecoveryFragment;
void main() async {
@@ -236,9 +237,14 @@ class GlobalUpdateChecker extends StatefulWidget {
class _GlobalUpdateCheckerState extends State<GlobalUpdateChecker>
with WidgetsBindingObserver {
bool _mustUpdate = false;
String? _updateUrl;
UpdateInfo? _updateInfo;
bool _isDismissed = false;
String? _dismissedVersion;
StreamSubscription? _versionSubscription;
bool _isUpdating = false;
double _downloadProgress = 0.0;
String _statusMessage = "";
String? _errorMessage;
@override
void initState() {
@@ -280,7 +286,7 @@ class _GlobalUpdateCheckerState extends State<GlobalUpdateChecker>
// Riapriamo il rubinetto di Supabase
_versionSubscription = GetIt.I<SupabaseClient>()
.from('app_config') // <-- Sostituisci col nome reale della tua tabella
.from('app_config')
.stream(primaryKey: ['id'])
.listen((_) {
_checkVersion();
@@ -294,19 +300,63 @@ class _GlobalUpdateCheckerState extends State<GlobalUpdateChecker>
}
Future<void> _checkVersion() async {
final updateUrl = await VersionCheckService().checkForceUpdate();
final updateInfo = await VersionCheckService().checkUpdate();
if (updateUrl != null && mounted) {
if (mounted) {
setState(() {
_mustUpdate = true;
_updateUrl = updateUrl;
_updateInfo = updateInfo;
// Se arriva una versione diversa da quella già rimandata, azzeriamo il dismiss
if (updateInfo != null &&
updateInfo.latestVersion != _dismissedVersion) {
_isDismissed = false;
}
});
}
}
Future<void> _startAutoUpdate() async {
final updateUrl = _updateInfo?.downloadUrl;
if (updateUrl == null || updateUrl.isEmpty) return;
setState(() {
_isUpdating = true;
_errorMessage = null;
_downloadProgress = 0.0;
_statusMessage = "Avvio aggiornamento in corso...";
});
try {
await AutoUpdateService.downloadAndApplyUpdate(
downloadUrl: updateUrl,
onProgress: (progress, status) {
if (mounted) {
setState(() {
_downloadProgress = progress;
_statusMessage = status;
});
}
},
);
} catch (e) {
if (mounted) {
setState(() {
_isUpdating = false;
_errorMessage = "Errore durante l'aggiornamento automatico: $e";
});
}
}
}
@override
Widget build(BuildContext context) {
if (!_mustUpdate) return widget.child;
final updateInfo = _updateInfo;
final showOverlay = updateInfo != null &&
updateInfo.hasUpdate &&
(updateInfo.isMandatory || !_isDismissed);
if (!showOverlay) return widget.child;
final isMandatory = updateInfo.isMandatory;
return Stack(
children: [
@@ -320,7 +370,7 @@ class _GlobalUpdateCheckerState extends State<GlobalUpdateChecker>
child: Container(
margin: const EdgeInsets.all(24),
padding: const EdgeInsets.all(24),
constraints: const BoxConstraints(maxWidth: 400),
constraints: const BoxConstraints(maxWidth: 440),
decoration: BoxDecoration(
color: Theme.of(context).scaffoldBackgroundColor,
borderRadius: BorderRadius.circular(16),
@@ -339,32 +389,96 @@ class _GlobalUpdateCheckerState extends State<GlobalUpdateChecker>
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
kIsWeb ? Icons.cached : Icons.system_update,
color: Colors.orange,
isMandatory
? Icons.warning_amber_rounded
: (kIsWeb ? Icons.cached : Icons.system_update),
color:
isMandatory ? Colors.amber[700] : Colors.blue,
size: 32,
),
const SizedBox(width: 12),
Flexible(
Expanded(
child: Text(
kIsWeb
? "Aggiornamento"
: "Aggiornamento Obbligatorio",
style: Theme.of(context).textTheme.titleLarge
isMandatory
? "Aggiornamento Obbligatorio"
: (kIsWeb
? "Aggiornamento Disponibile"
: "Nuova Versione Disponibile"),
style: Theme.of(context)
.textTheme
.titleLarge
?.copyWith(fontWeight: FontWeight.bold),
),
),
if (!isMandatory && !_isUpdating)
IconButton(
icon: const Icon(Icons.close),
tooltip: "Chiudi e rimanda",
onPressed: () {
setState(() {
_isDismissed = true;
_dismissedVersion =
updateInfo.latestVersion;
});
},
),
],
),
const SizedBox(height: 16),
Text(
kIsWeb
? "È stata rilasciata una nuova versione dell'applicazione. Ricarica la pagina per scaricare il nuovo codice."
: "Per continuare ad utilizzare l'applicazione è necessario scaricare e installare l'ultimo aggiornamento.",
? "È stata rilasciata una nuova versione dell'applicazione (${updateInfo.latestVersion}). Ricarica la pagina per scaricare il nuovo codice."
: (isMandatory
? "La versione attuale non è più supportata (minima richiesta: ${updateInfo.minVersion}). È necessario aggiornare all'ultima versione (${updateInfo.latestVersion}) per continuare a lavorare."
: "È disponibile la nuova versione ${updateInfo.latestVersion}. Puoi aggiornare subito oppure rimandare."),
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 16),
style: const TextStyle(fontSize: 15),
),
const SizedBox(height: 24),
if (kIsWeb)
if (_errorMessage != null) ...[
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: Colors.red.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(8),
border: Border.all(
color: Colors.red.withValues(alpha: 0.3),
),
),
child: Text(
_errorMessage!,
style: const TextStyle(
color: Colors.red,
fontSize: 13,
),
textAlign: TextAlign.center,
),
),
const SizedBox(height: 16),
],
if (_isUpdating) ...[
ClipRRect(
borderRadius: BorderRadius.circular(8),
child: LinearProgressIndicator(
value: _downloadProgress > 0
? _downloadProgress
: null,
minHeight: 10,
),
),
const SizedBox(height: 12),
Text(
_statusMessage,
style: TextStyle(
fontSize: 13,
color: Theme.of(context)
.colorScheme
.onSurface
.withValues(alpha: 0.7),
),
textAlign: TextAlign.center,
),
] else if (kIsWeb) ...[
FilledButton.icon(
icon: const Icon(Icons.refresh),
label: const Text("RICARICA ORA"),
@@ -375,8 +489,50 @@ class _GlobalUpdateCheckerState extends State<GlobalUpdateChecker>
// Hard reload aggirando la cache!
html.window.location.reload();
},
)
else
),
if (!isMandatory) ...[
const SizedBox(height: 10),
OutlinedButton(
style: OutlinedButton.styleFrom(
minimumSize: const Size(double.infinity, 44),
),
onPressed: () {
setState(() {
_isDismissed = true;
_dismissedVersion =
updateInfo.latestVersion;
});
},
child: const Text("PIÙ TARDI"),
),
],
] else if (AutoUpdateService.isAutoUpdateSupported) ...[
FilledButton.icon(
icon: const Icon(Icons.system_update_alt),
label: const Text("AGGIORNA ORA"),
style: FilledButton.styleFrom(
minimumSize: const Size(double.infinity, 50),
backgroundColor: Colors.blue,
),
onPressed: _startAutoUpdate,
),
if (!isMandatory) ...[
const SizedBox(height: 10),
OutlinedButton(
style: OutlinedButton.styleFrom(
minimumSize: const Size(double.infinity, 44),
),
onPressed: () {
setState(() {
_isDismissed = true;
_dismissedVersion =
updateInfo.latestVersion;
});
},
child: const Text("PIÙ TARDI"),
),
],
] else ...[
FilledButton.icon(
icon: const Icon(Icons.download),
label: const Text("SCARICA AGGIORNAMENTO"),
@@ -385,15 +541,46 @@ class _GlobalUpdateCheckerState extends State<GlobalUpdateChecker>
backgroundColor: Colors.blue,
),
onPressed: () async {
if (_updateUrl != null) {
final url = Uri.parse(_updateUrl!);
await launchUrl(
url,
mode: LaunchMode.externalApplication,
);
}
final url = Uri.parse(updateInfo.downloadUrl);
await launchUrl(
url,
mode: LaunchMode.externalApplication,
);
},
),
if (!isMandatory) ...[
const SizedBox(height: 10),
OutlinedButton(
style: OutlinedButton.styleFrom(
minimumSize: const Size(double.infinity, 44),
),
onPressed: () {
setState(() {
_isDismissed = true;
_dismissedVersion =
updateInfo.latestVersion;
});
},
child: const Text("PIÙ TARDI"),
),
],
],
if (!_isUpdating &&
AutoUpdateService.isAutoUpdateSupported &&
_errorMessage != null) ...[
const SizedBox(height: 10),
TextButton.icon(
icon: const Icon(Icons.open_in_browser, size: 16),
label: const Text("Scarica manualmente dal browser"),
onPressed: () async {
final url = Uri.parse(updateInfo.downloadUrl);
await launchUrl(
url,
mode: LaunchMode.externalApplication,
);
},
),
],
],
),
),
+1 -1
View File
@@ -1,7 +1,7 @@
name: flux
description: "Gestione attività negozio di telefonia"
publish_to: 'none'
version: 2.0.6+62
version: 2.0.10+66
environment:
sdk: ^3.11.3
+7 -6
View File
@@ -16,11 +16,12 @@ Compression=lzma2/max
SolidCompression=yes
WizardStyle=modern
; Icona dell'installer (opzionale, decommenta se hai il file .ico)
; Icona dell'installer
SetupIconFile=windows\runner\resources\app_icon.ico
; Richiede privilegi di amministratore per installare nella cartella Programmi
PrivilegesRequired=admin
; Installazione utente (senza richiesta di privilegi amministratore UAC)
PrivilegesRequired=lowest
CloseApplications=force
[Files]
; 1. L'eseguibile principale di Flutter
@@ -31,12 +32,12 @@ Source: "build\windows\x64\runner\Release\*"; DestDir: "{app}"; Flags: ignorever
[Icons]
; Scorciatoie nel menu Start e sul Desktop
Name: "{autoprograms}\LaMiaApp"; Filename: "{app}\Flux.exe"
Name: "{autodesktop}\LaMiaApp"; Filename: "{app}\Flux.exe"; Tasks: desktopicon
Name: "{autoprograms}\Flux"; Filename: "{app}\Flux.exe"
Name: "{autodesktop}\Flux"; Filename: "{app}\Flux.exe"; Tasks: desktopicon
[Tasks]
Name: "desktopicon"; Description: "Crea un'icona sul &Desktop"; GroupDescription: "Icone aggiuntive:"; Flags: unchecked
[Run]
; Opzione per avviare l'app subito dopo la fine dell'installazione
Filename: "{app}\Flux.exe"; Description: "Avvia LaMiaApp"; Flags: nowait postinstall skipifsilent
Filename: "{app}\Flux.exe"; Description: "Avvia Flux"; Flags: nowait postinstall