diff --git a/AGENTS.md b/AGENTS.md index 4577553..06db5c5 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -110,10 +110,10 @@ Apps removed (not on Play Store, APK-only distribution): Honeygain, PacketStream ## APK Installation via adb -- `adb install -r ` installs over existing app **only if signatures match** -- Debug and release APKs have different signing keys — installing debug over release (or vice versa) fails with `INSTALL_FAILED_UPDATE_INCOMPATIBLE` -- To switch signing type: `adb uninstall com.cashpilot.android` first (loses app data) -- CI release APK matches the keystore used for GitHub Releases and F-Droid — always prefer `app-release` artifact +- **ALWAYS install the release-signed APK (`app-release`). NEVER use the debug APK.** Switching signatures requires a full uninstall, which wipes all app data (server URL, API key, permissions). +- Download from CI: `gh run download --name app-release --dir /tmp/cashpilot-apk` +- Install: `adb install -r /tmp/cashpilot-apk/app-release.apk` +- If signature mismatch: `adb uninstall com.cashpilot.android` first, then install (user must re-configure) ## What NOT to Build Yet diff --git a/app/src/main/java/com/cashpilot/android/ui/MainActivity.kt b/app/src/main/java/com/cashpilot/android/ui/MainActivity.kt index 7c47878..3574e63 100644 --- a/app/src/main/java/com/cashpilot/android/ui/MainActivity.kt +++ b/app/src/main/java/com/cashpilot/android/ui/MainActivity.kt @@ -69,12 +69,11 @@ class MainActivity : ComponentActivity() { val settings by viewModel.settings.collectAsState() val hasNotif by viewModel.hasNotificationAccess.collectAsState() val hasUsage by viewModel.hasUsageAccess.collectAsState() - val hasBattery by viewModel.hasBatteryOptOut.collectAsState() var showSettings by rememberSaveable { mutableStateOf(false) } var setupDismissed by rememberSaveable { mutableStateOf(false) } val needsSetup = !setupDismissed && - (settings.serverUrl.isBlank() || settings.apiKey.isBlank() || !hasNotif || !hasUsage || !hasBattery) + (settings.serverUrl.isBlank() || settings.apiKey.isBlank() || !hasNotif || !hasUsage) // Handle system Back from Settings → return to Dashboard BackHandler(enabled = showSettings && !needsSetup) { diff --git a/app/src/main/java/com/cashpilot/android/ui/screen/SetupScreen.kt b/app/src/main/java/com/cashpilot/android/ui/screen/SetupScreen.kt index 5ac0b70..1b18cc3 100644 --- a/app/src/main/java/com/cashpilot/android/ui/screen/SetupScreen.kt +++ b/app/src/main/java/com/cashpilot/android/ui/screen/SetupScreen.kt @@ -192,7 +192,7 @@ fun SetupScreen(viewModel: MainViewModel, onComplete: () -> Unit) { onComplete() }, modifier = Modifier.fillMaxWidth(), - enabled = serverDone && hasNotif && hasUsage && hasBattery, + enabled = serverDone && hasNotif && hasUsage, ) { Text(stringResource(R.string.setup_continue)) } @@ -284,8 +284,19 @@ private fun openUsageAccessSettings(context: Context) { } private fun openBatteryOptimizationSettings(context: Context) { - context.startActivity( - Intent(AndroidSettings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS) - .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK), - ) + try { + // Direct prompt for this app specifically + context.startActivity( + Intent( + AndroidSettings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, + android.net.Uri.parse("package:${context.packageName}"), + ).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK), + ) + } catch (_: Exception) { + // Fallback to global list + context.startActivity( + Intent(AndroidSettings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS) + .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK), + ) + } } diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png index c74f591..aed66bf 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png index d4caa50..24d73db 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png index c74f591..aed66bf 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png index 740ebd6..9829395 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png index dd29f91..add3c8a 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png index 740ebd6..9829395 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 843268f..d04803e 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png index fc7a9b0..d8d8d3b 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png index 843268f..d04803e 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index a912734..20cb082 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png index f934ba8..af9351e 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png index a912734..20cb082 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index 2f13e1a..c3ce99c 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png index fc84343..7993752 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png index 2f13e1a..c3ce99c 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ