From 008c2d10226c16cc7bf4518aa58063d35844ee75 Mon Sep 17 00:00:00 2001
From: koinupapi <42801572+koinupapi@users.noreply.github.com>
Date: Fri, 27 Nov 2026 15:15:02 -0800
Subject: [PATCH 01/21] Give Atrium Enhanced a separate Android application
identity
---
app/android/app/build.gradle.kts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/android/app/build.gradle.kts b/app/android/app/build.gradle.kts
index 1a71e73d..12c075dd 100644
--- a/app/android/app/build.gradle.kts
+++ b/app/android/app/build.gradle.kts
@@ -48,7 +48,7 @@ android {
}
defaultConfig {
- applicationId = "app.atrium"
+ applicationId = "com.koinupapi.atrium.enhanced"
// local_auth + flutter_secure_storage need API 23+ (BiometricPrompt,
// EncryptedSharedPreferences). Floor at 23 regardless of Flutter's
// default.
@@ -61,7 +61,7 @@ android {
val appNameProp = if (project.hasProperty("appName")) {
project.property("appName") as String
} else {
- "Atrium"
+ "Atrium Enhanced"
}
manifestPlaceholders["appName"] = appNameProp
}
From aeb7536dc78646b32b38701c2c272460342df7ac Mon Sep 17 00:00:00 2001
From: koinupapi <42801572+koinupapi@users.noreply.github.com>
Date: Fri, 27 Nov 2026 15:15:09 -0800
Subject: [PATCH 02/21] Add opt-in signed APK build and release workflow
---
.github/workflows/enhanced-apk.yml | 67 ++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)
create mode 100644 .github/workflows/enhanced-apk.yml
diff --git a/.github/workflows/enhanced-apk.yml b/.github/workflows/enhanced-apk.yml
new file mode 100644
index 00000000..37d3e313
--- /dev/null
+++ b/.github/workflows/enhanced-apk.yml
@@ -0,0 +1,67 @@
+name: Build Atrium Enhanced APK
+on:
+ workflow_dispatch:
+ push:
+ branches:
+ - rmg
+ - 'feature/**'
+ - 'fix/**'
+ - 'refactor/**'
+permissions:
+ contents: write
+jobs:
+ build:
+ if: github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[build apk]')
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-java@v4
+ with:
+ distribution: temurin
+ java-version: '17'
+ - uses: subosito/flutter-action@v2
+ with:
+ flutter-version: '3.41.9'
+ channel: stable
+ cache: true
+ - name: Restore release signing credentials
+ env:
+ KEYSTORE: ${{ secrets.ATRIUM_KEYSTORE_BASE64 }}
+ STORE_PASSWORD: ${{ secrets.ATRIUM_KEYSTORE_PASSWORD }}
+ KEY_ALIAS: ${{ secrets.ATRIUM_KEY_ALIAS }}
+ KEY_PASSWORD: ${{ secrets.ATRIUM_KEY_PASSWORD }}
+ run: |
+ set -eu
+ test -n "$KEYSTORE" && test -n "$STORE_PASSWORD" && test -n "$KEY_ALIAS" && test -n "$KEY_PASSWORD"
+ printf '%s' "$KEYSTORE" | base64 --decode > "$RUNNER_TEMP/atrium-release.jks"
+ chmod 600 "$RUNNER_TEMP/atrium-release.jks"
+ printf 'storeFile=%s\nstorePassword=%s\nkeyAlias=%s\nkeyPassword=%s\n' "$RUNNER_TEMP/atrium-release.jks" "$STORE_PASSWORD" "$KEY_ALIAS" "$KEY_PASSWORD" > app/android/key.properties
+ chmod 600 app/android/key.properties
+ - name: Resolve dependencies
+ working-directory: app
+ run: flutter pub get --enforce-lockfile
+ - name: Generate sources
+ run: dart run tool/build_all.dart
+ - name: Build signed universal APK
+ working-directory: app
+ run: flutter build apk --release --build-number="$GITHUB_RUN_NUMBER"
+ - name: Verify APK signature
+ run: |
+ APKSIGNER="$(find "$ANDROID_HOME/build-tools" -name apksigner -type f | sort -V | tail -n 1)"
+ "$APKSIGNER" verify --print-certs app/build/app/outputs/flutter-apk/app-release.apk
+ - name: Publish release
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ set -eu
+ APK="Atrium-Enhanced-${GITHUB_RUN_NUMBER}.apk"
+ cp app/build/app/outputs/flutter-apk/app-release.apk "$APK"
+ printf 'Branch: %s\nBuild: %s\nCommit: %s\n' "$GITHUB_REF_NAME" "$GITHUB_RUN_NUMBER" "$GITHUB_SHA" > release-notes.txt
+ if [ "$GITHUB_REF_NAME" = rmg ]; then
+ gh release create "enhanced-$GITHUB_RUN_NUMBER" "$APK" --target "$GITHUB_SHA" --title "Atrium Enhanced build $GITHUB_RUN_NUMBER" --notes-file release-notes.txt
+ else
+ gh release create "enhanced-$GITHUB_RUN_NUMBER" "$APK" --target "$GITHUB_SHA" --prerelease --title "Atrium Enhanced test build $GITHUB_RUN_NUMBER" --notes-file release-notes.txt
+ fi
+ - name: Remove signing material
+ if: always()
+ run: rm -f app/android/key.properties "$RUNNER_TEMP/atrium-release.jks"
From 82f65f93a165f4c7ed8dcc98a1ec594bddab0042 Mon Sep 17 00:00:00 2001
From: koinupapi <42801572+koinupapi@users.noreply.github.com>
Date: Fri, 27 Nov 2026 15:27:18 -0800
Subject: [PATCH 03/21] Test signed APK release pipeline [build apk]
---
.github/workflows/enhanced-apk.yml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/enhanced-apk.yml b/.github/workflows/enhanced-apk.yml
index 37d3e313..1ba8468d 100644
--- a/.github/workflows/enhanced-apk.yml
+++ b/.github/workflows/enhanced-apk.yml
@@ -39,7 +39,9 @@ jobs:
chmod 600 app/android/key.properties
- name: Resolve dependencies
working-directory: app
- run: flutter pub get --enforce-lockfile
+ run: |
+ flutter config --no-analytics
+ flutter pub get --enforce-lockfile
- name: Generate sources
run: dart run tool/build_all.dart
- name: Build signed universal APK
From 637a97a9044a5490cdc7d95c06c5ec3e63d7ffe3 Mon Sep 17 00:00:00 2001
From: koinupapi <42801572+koinupapi@users.noreply.github.com>
Date: Fri, 27 Nov 2026 15:54:20 -0800
Subject: [PATCH 04/21] Distinguish Enhanced launcher with Bastion blue
background
---
app/android/app/src/main/res/values/colors.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/android/app/src/main/res/values/colors.xml b/app/android/app/src/main/res/values/colors.xml
index 9b5e432e..0adf1e08 100644
--- a/app/android/app/src/main/res/values/colors.xml
+++ b/app/android/app/src/main/res/values/colors.xml
@@ -1,4 +1,4 @@
- #6750A4
-
\ No newline at end of file
+ #243A67
+
From 555869cd18b97d021d752e998c3b615b21cf2df4 Mon Sep 17 00:00:00 2001
From: koinupapi <42801572+koinupapi@users.noreply.github.com>
Date: Fri, 27 Nov 2026 15:58:18 -0800
Subject: [PATCH 05/21] Modernize build actions and cache Gradle dependencies
---
.github/workflows/enhanced-apk.yml | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/enhanced-apk.yml b/.github/workflows/enhanced-apk.yml
index 1ba8468d..856ba152 100644
--- a/.github/workflows/enhanced-apk.yml
+++ b/.github/workflows/enhanced-apk.yml
@@ -14,16 +14,21 @@ jobs:
if: github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '[build apk]')
runs-on: ubuntu-24.04
steps:
- - uses: actions/checkout@v4
- - uses: actions/setup-java@v4
+ - uses: actions/checkout@v5
+ - uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
+ cache: gradle
+ cache-dependency-path: |
+ app/android/**/*.gradle*
+ app/android/gradle/wrapper/gradle-wrapper.properties
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.41.9'
channel: stable
cache: true
+ pub-cache: true
- name: Restore release signing credentials
env:
KEYSTORE: ${{ secrets.ATRIUM_KEYSTORE_BASE64 }}
From 7952790af228c2c64c298273192f2e10d4282d79 Mon Sep 17 00:00:00 2001
From: koinupapi <42801572+koinupapi@users.noreply.github.com>
Date: Fri, 27 Nov 2026 15:58:20 -0800
Subject: [PATCH 06/21] Preserve Enhanced blue when regenerating launcher icons
---
app/pubspec.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/pubspec.yaml b/app/pubspec.yaml
index 1dbd41b5..96a4edac 100644
--- a/app/pubspec.yaml
+++ b/app/pubspec.yaml
@@ -86,7 +86,7 @@ flutter_launcher_icons:
android: true
ios: false
image_path: "assets/icon/atrium_icon.png"
- adaptive_icon_background: "#6750A4"
+ adaptive_icon_background: "#243A67"
adaptive_icon_foreground: "assets/icon/atrium_foreground.png"
adaptive_icon_monochrome: "assets/icon/atrium_foreground.png"
min_sdk_android: 23
From e8a4f46a213af5bb43fed8658cdfaea941dd6858 Mon Sep 17 00:00:00 2001
From: koinupapi <42801572+koinupapi@users.noreply.github.com>
Date: Fri, 27 Nov 2026 15:58:26 -0800
Subject: [PATCH 07/21] Scope updater file sharing to private update cache
---
app/android/app/src/main/res/xml/enhanced_update_paths.xml | 4 ++++
1 file changed, 4 insertions(+)
create mode 100644 app/android/app/src/main/res/xml/enhanced_update_paths.xml
diff --git a/app/android/app/src/main/res/xml/enhanced_update_paths.xml b/app/android/app/src/main/res/xml/enhanced_update_paths.xml
new file mode 100644
index 00000000..19969447
--- /dev/null
+++ b/app/android/app/src/main/res/xml/enhanced_update_paths.xml
@@ -0,0 +1,4 @@
+
+
+
+
From e1be157f62a6c51dcb52fe35d5f9902f3f604a83 Mon Sep 17 00:00:00 2001
From: koinupapi <42801572+koinupapi@users.noreply.github.com>
Date: Fri, 27 Nov 2026 15:58:28 -0800
Subject: [PATCH 08/21] Declare Android update installer permission and scoped
provider
---
app/android/app/src/main/AndroidManifest.xml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/app/android/app/src/main/AndroidManifest.xml b/app/android/app/src/main/AndroidManifest.xml
index dc919bd0..65e4accf 100644
--- a/app/android/app/src/main/AndroidManifest.xml
+++ b/app/android/app/src/main/AndroidManifest.xml
@@ -6,6 +6,8 @@
+
+
+
+
+
Date: Fri, 27 Nov 2026 15:58:34 -0800
Subject: [PATCH 09/21] Expose installed build and scoped Android installer to
Flutter updater
---
.../main/kotlin/app/atrium/MainActivity.kt | 34 +++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/app/android/app/src/main/kotlin/app/atrium/MainActivity.kt b/app/android/app/src/main/kotlin/app/atrium/MainActivity.kt
index 0ac6907a..0bdc0296 100644
--- a/app/android/app/src/main/kotlin/app/atrium/MainActivity.kt
+++ b/app/android/app/src/main/kotlin/app/atrium/MainActivity.kt
@@ -31,6 +31,40 @@ class MainActivity : FlutterFragmentActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
+ MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "app.atrium/enhanced_updates").setMethodCallHandler { call, result ->
+ try {
+ when (call.method) {
+ "installedBuild" -> {
+ @Suppress("DEPRECATION")
+ val info = packageManager.getPackageInfo(packageName, 0)
+ @Suppress("DEPRECATION")
+ val version = if (Build.VERSION.SDK_INT >= 28) info.longVersionCode else info.versionCode.toLong()
+ result.success(version)
+ }
+ "cacheDirectory" -> result.success(java.io.File(cacheDir, "updates").apply { mkdirs() }.absolutePath)
+ "install" -> {
+ val directory = java.io.File(cacheDir, "updates").canonicalFile
+ val file = java.io.File(requireNotNull(call.argument("path"))).canonicalFile
+ require(file.parentFile == directory && file.extension == "apk" && file.isFile)
+ if (Build.VERSION.SDK_INT >= 26 && !packageManager.canRequestPackageInstalls()) {
+ startActivity(Intent(android.provider.Settings.ACTION_MANAGE_UNKNOWN_APP_SOURCES, Uri.parse("package:$packageName")))
+ result.success(false)
+ } else {
+ val uri = androidx.core.content.FileProvider.getUriForFile(this, "$packageName.updates", file)
+ startActivity(Intent(Intent.ACTION_VIEW).apply {
+ setDataAndType(uri, "application/vnd.android.package-archive")
+ addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
+ })
+ result.success(true)
+ }
+ }
+ else -> result.notImplemented()
+ }
+ } catch (e: Exception) {
+ result.error("UPDATE_ERROR", e.message, null)
+ }
+ }
+
pendingShareIntent = intent
shareChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, SHARE_CHANNEL).apply {
From a93728be680b43dc7bbac09b4711645105a16ae7 Mon Sep 17 00:00:00 2001
From: koinupapi <42801572+koinupapi@users.noreply.github.com>
Date: Fri, 27 Nov 2026 16:07:36 -0800
Subject: [PATCH 10/21] Add branch-aware Enhanced release discovery and
diagnostics
---
.../src/update_check/enhanced_release.dart | 75 +++++++++++++++++++
1 file changed, 75 insertions(+)
create mode 100644 app/lib/src/update_check/enhanced_release.dart
diff --git a/app/lib/src/update_check/enhanced_release.dart b/app/lib/src/update_check/enhanced_release.dart
new file mode 100644
index 00000000..122518d3
--- /dev/null
+++ b/app/lib/src/update_check/enhanced_release.dart
@@ -0,0 +1,75 @@
+import 'package:dio/dio.dart';
+
+class EnhancedRelease {
+ const EnhancedRelease(this.build, this.branch, this.url, this.page,
+ this.digest, this.notes, this.date, this.size);
+ final int build;
+ final String branch, url, page, digest, notes, date;
+ final int size;
+
+ static EnhancedRelease? parse(Map data) {
+ if (data['draft'] == true) return null;
+ final match = RegExp(r'^enhanced-(\d+)$').firstMatch(data['tag_name'] as String? ?? '');
+ if (match == null) return null;
+ final build = int.parse(match.group(1)!);
+ final notes = data['body'] as String? ?? '';
+ final branch = RegExp(r'^Branch: (.+)$', multiLine: true).firstMatch(notes)?.group(1)?.trim();
+ if (branch == null || !allowedBranch(branch)) return null;
+ for (final raw in data['assets'] as List? ?? []) {
+ final asset = Map.from(raw as Map);
+ if (asset['name'] != 'Atrium-Enhanced-$build.apk') continue;
+ final url = asset['browser_download_url'] as String? ?? '';
+ if (url != 'https://github.com/koinupapi/Atrium-Enhanced/releases/download/enhanced-$build/Atrium-Enhanced-$build.apk') continue;
+ return EnhancedRelease(build, branch, url, data['html_url'] as String? ?? '',
+ asset['digest'] as String? ?? '', notes, data['published_at'] as String? ?? '',
+ asset['size'] as int? ?? 0);
+ }
+ return null;
+ }
+
+ static bool allowedBranch(String branch) => branch == 'rmg' ||
+ ['feature/', 'fix/', 'refactor/'].any(branch.startsWith);
+}
+
+class EnhancedReleaseRepository {
+ EnhancedReleaseRepository(this.dio);
+ final Dio dio;
+ static const repo = 'repos/koinupapi/Atrium-Enhanced';
+
+ Future> _pages(String endpoint) async {
+ final items = [];
+ for (var page = 1; ; page++) {
+ final response = await dio.get>('$repo/$endpoint',
+ queryParameters: {'per_page': 100, 'page': page});
+ final batch = response.data ?? [];
+ items.addAll(batch);
+ if (batch.length < 100) return items;
+ }
+ }
+
+ Future> branches() async {
+ final names = (await _pages('branches')).map((e) => e['name'] as String)
+ .where(EnhancedRelease.allowedBranch).toSet()..add('rmg');
+ return names.toList()..sort((a,b) => a == b ? 0 : a == 'rmg' ? -1 : b == 'rmg' ? 1 : a.compareTo(b));
+ }
+
+ Future latest(String branch) async {
+ final releases = (await _pages('releases'))
+ .map((e) => EnhancedRelease.parse(Map.from(e as Map)))
+ .whereType().where((e) => e.branch == branch).toList()
+ ..sort((a,b) => b.build.compareTo(a.build));
+ return releases.isEmpty ? null : releases.first;
+ }
+
+ static String describeError(Object error) {
+ if (error is DioException) {
+ final response = error.response;
+ final reset = int.tryParse(response?.headers.value('x-ratelimit-reset') ?? '');
+ if (response?.headers.value('x-ratelimit-remaining') == '0' && reset != null) {
+ return 'GitHub rate limit reached. Retry after ${DateTime.fromMillisecondsSinceEpoch(reset * 1000).toLocal()}.';
+ }
+ return 'GitHub request failed: ${response?.statusCode ?? error.type.name}';
+ }
+ return error.toString();
+ }
+}
From 546aa7592e83b5b7b947edba55266f33cc46ee28 Mon Sep 17 00:00:00 2001
From: koinupapi <42801572+koinupapi@users.noreply.github.com>
Date: Fri, 27 Nov 2026 16:07:42 -0800
Subject: [PATCH 11/21] Implement cancellable APK download and SHA-256
verification via Android bridge
---
.../src/update_check/enhanced_download.dart | 40 +++++++++++++++++++
1 file changed, 40 insertions(+)
create mode 100644 app/lib/src/update_check/enhanced_download.dart
diff --git a/app/lib/src/update_check/enhanced_download.dart b/app/lib/src/update_check/enhanced_download.dart
new file mode 100644
index 00000000..46e4abb6
--- /dev/null
+++ b/app/lib/src/update_check/enhanced_download.dart
@@ -0,0 +1,40 @@
+import 'dart:io';
+import 'package:dio/dio.dart';
+import 'package:flutter/services.dart';
+import 'enhanced_release.dart';
+
+class EnhancedDownload {
+ static const channel = MethodChannel('app.atrium/enhanced_updates');
+ static Future installedBuild() async =>
+ (await channel.invokeMethod('installedBuild'))!;
+ static Future install(String path) async =>
+ (await channel.invokeMethod('install', {'path': path})) ?? false;
+
+ Future download(EnhancedRelease release, CancelToken token,
+ void Function(int, int) progress) async {
+ final directory = (await channel.invokeMethod('cacheDirectory'))!;
+ final target = File('$directory/Atrium-Enhanced-${release.build}.apk');
+ final part = File('${target.path}.part');
+ final dio = Dio(BaseOptions(connectTimeout: const Duration(seconds: 15),
+ receiveTimeout: const Duration(seconds: 60)));
+ try {
+ await dio.download(release.url, part.path, cancelToken: token,
+ onReceiveProgress: progress);
+ final size = await part.length();
+ if (size == 0 || (release.size > 0 && size != release.size)) {
+ throw StateError('APK size mismatch');
+ }
+ if (release.digest.isNotEmpty) {
+ final actual = await channel.invokeMethod('sha256', {'path': part.path});
+ if ('sha256:$actual' != release.digest.toLowerCase()) {
+ throw StateError('APK checksum mismatch');
+ }
+ }
+ if (token.isCancelled) throw StateError('Download cancelled');
+ return (await part.rename(target.path)).path;
+ } finally {
+ dio.close(force: true);
+ if (await part.exists()) await part.delete();
+ }
+ }
+}
From c19a984864293809449d5368b57c2e36e7bb69b9 Mon Sep 17 00:00:00 2001
From: koinupapi <42801572+koinupapi@users.noreply.github.com>
Date: Fri, 27 Nov 2026 16:07:44 -0800
Subject: [PATCH 12/21] Verify downloaded APK digest off the Android UI thread
---
.../main/kotlin/app/atrium/MainActivity.kt | 22 +++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/app/android/app/src/main/kotlin/app/atrium/MainActivity.kt b/app/android/app/src/main/kotlin/app/atrium/MainActivity.kt
index 0bdc0296..a223f910 100644
--- a/app/android/app/src/main/kotlin/app/atrium/MainActivity.kt
+++ b/app/android/app/src/main/kotlin/app/atrium/MainActivity.kt
@@ -42,6 +42,28 @@ class MainActivity : FlutterFragmentActivity() {
result.success(version)
}
"cacheDirectory" -> result.success(java.io.File(cacheDir, "updates").apply { mkdirs() }.absolutePath)
+ "sha256" -> {
+ val directory = java.io.File(cacheDir, "updates").canonicalFile
+ val file = java.io.File(requireNotNull(call.argument("path"))).canonicalFile
+ require(file.parentFile == directory && file.isFile)
+ Thread {
+ try {
+ val digest = java.security.MessageDigest.getInstance("SHA-256")
+ file.inputStream().use { input ->
+ val buffer = ByteArray(65536)
+ while (true) {
+ val count = input.read(buffer)
+ if (count < 0) break
+ digest.update(buffer, 0, count)
+ }
+ }
+ val hash = digest.digest().joinToString("") { "%02x".format(it) }
+ runOnUiThread { result.success(hash) }
+ } catch (e: Exception) {
+ runOnUiThread { result.error("HASH_ERROR", e.message, null) }
+ }
+ }.start()
+ }
"install" -> {
val directory = java.io.File(cacheDir, "updates").canonicalFile
val file = java.io.File(requireNotNull(call.argument("path"))).canonicalFile
From 8bf3781a845e25c342c6d5563934aa38397c8b93 Mon Sep 17 00:00:00 2001
From: koinupapi <42801572+koinupapi@users.noreply.github.com>
Date: Fri, 27 Nov 2026 16:07:51 -0800
Subject: [PATCH 13/21] Extend existing Riverpod update checker for Enhanced
build channels
---
app/lib/src/update_check/update_checker.dart | 107 ++++++-------------
1 file changed, 30 insertions(+), 77 deletions(-)
diff --git a/app/lib/src/update_check/update_checker.dart b/app/lib/src/update_check/update_checker.dart
index 2f1186c1..bd02d4b3 100644
--- a/app/lib/src/update_check/update_checker.dart
+++ b/app/lib/src/update_check/update_checker.dart
@@ -2,11 +2,10 @@ import 'package:dio/dio.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:hive_ce/hive.dart';
-import '../external_links.dart';
+import 'enhanced_release.dart';
+import 'enhanced_download.dart';
import '../preferences.dart';
-import 'app_version.dart';
import 'update_check_state.dart';
-import 'version_compare.dart';
/// A plain Dio for the GitHub API, no per-instance auth. Overridden in tests.
final Provider githubDioProvider = Provider((Ref ref) {
@@ -50,91 +49,45 @@ String? extractWhatsNew(String body) {
/// Checks GitHub for a newer release, only when [check] is called. Never
/// fetches on construction; [build] only reads the persisted last result.
class UpdateChecker extends Notifier {
- static const String _latestKey = 'update.latestVersion';
- static const String _urlKey = 'update.releaseUrl';
- static const String _checkedAtKey = 'update.checkedAt';
- static const String _notesKey = 'update.latestNotes';
- static const String _dateKey = 'update.latestDate';
-
Box get _box => ref.read(settingsBoxProvider);
+ String get branch => _box.get('enhanced.branch') ?? 'rmg';
+ EnhancedRelease? release;
+ int? installed;
+ String? diagnostic;
+ EnhancedReleaseRepository get repository => EnhancedReleaseRepository(ref.read(githubDioProvider));
@override
- UpdateCheckState build() {
- final String? latest = _box.get(_latestKey);
- final String? url = _box.get(_urlKey);
- final String? checkedAtRaw = _box.get(_checkedAtKey);
- final DateTime? checkedAt =
- checkedAtRaw == null ? null : DateTime.tryParse(checkedAtRaw);
- final String? notes = _box.get(_notesKey);
- final String? date = _box.get(_dateKey);
+ UpdateCheckState build() => const UpdateCheckState();
- final UpdateStatus status;
- if (latest == null) {
- status = UpdateStatus.idle;
- } else if (compareVersions(latest, appVersion) > 0) {
- status = UpdateStatus.updateAvailable;
- } else {
- status = UpdateStatus.upToDate;
- }
- return UpdateCheckState(
- status: status,
- latestVersion: latest,
- releaseUrl: url,
- checkedAt: checkedAt,
- latestNotes: notes,
- latestDate: date,
- );
+ Future> branches() => repository.branches();
+
+ Future selectBranch(String value) async {
+ if (!EnhancedRelease.allowedBranch(value)) return;
+ await _box.put('enhanced.branch', value);
+ await check();
}
- /// Fetches the latest release and updates state. Errors keep the durable
- /// fields so a known "available" banner survives a failed check.
Future check() async {
+ if (state.status == UpdateStatus.checking) return;
state = state.copyWith(status: UpdateStatus.checking);
try {
- final Dio dio = ref.read(githubDioProvider);
- final Response