import 'package:deskup/deskup.dart'; import 'package:flutter/services.dart'; // Values are compiled from Dart defines; process environment does not redirect production. MacOSUpdateConfiguration macosUpdateConfiguration() => const MacOSUpdateConfiguration( allowLocalHttp: appFlavor == 'development' && bool.fromEnvironment('CUTDEX_UPDATE_TEST_HTTP'), ); WindowsUpdateConfiguration? windowsUpdateConfiguration({ String? flavor, String developmentUrl = const String.fromEnvironment( 'CUTDEX_WINDOWS_UPDATE_URL', ), String developmentSource = const String.fromEnvironment( 'CUTDEX_WINDOWS_UPDATE_SOURCE', defaultValue: 'gitea', ), bool allowLocalHttp = const bool.fromEnvironment('CUTDEX_UPDATE_TEST_HTTP'), }) { final development = (flavor ?? appFlavor) == 'development'; if (development && developmentUrl.isEmpty) return null; final WindowsUpdateSource source; if (!development) { source = GiteaUpdateSource( repositoryUrl: Uri.parse('https://git.orangraph.com/lingjhf/cutdex'), ); } else if (developmentSource == 'gitea') { source = GiteaUpdateSource( repositoryUrl: Uri.parse(developmentUrl), allowLocalHttp: allowLocalHttp, ); } else if (developmentSource == 'web') { source = WebUpdateSource( url: Uri.parse(developmentUrl), allowLocalHttp: allowLocalHttp, ); } else { throw ArgumentError.value(developmentSource, 'developmentSource'); } return WindowsUpdateConfiguration( source: source, expectedPackageId: development ? 'Cutdex.Dev' : 'Cutdex', preferenceNamespace: 'Cutdex', ); }