diff --git a/app/main.py b/app/main.py index c1256c8..5951d32 100644 --- a/app/main.py +++ b/app/main.py @@ -115,7 +115,7 @@ def version() -> dict[str, str | None]: # mobile sklei z baseUrl. public_url = os.environ.get("BACKEND_PUBLIC_URL", "").rstrip("/") apk_url = f"{public_url}/static/app-release.apk" if public_url else "/static/app-release.apk" - return {"version": "0.2.0", "apk_url": apk_url} + return {"version": "0.2.1", "apk_url": apk_url} @app.get("/readyz") diff --git a/mobile/android/app/build.gradle b/mobile/android/app/build.gradle index 663cf03..b4a6d13 100644 --- a/mobile/android/app/build.gradle +++ b/mobile/android/app/build.gradle @@ -93,8 +93,8 @@ android { applicationId 'com.goon.mobile' minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 10 - versionName "0.2.0" + versionCode 11 + versionName "0.2.1" } signingConfigs { debug { diff --git a/mobile/android/app/src/main/java/com/goon/mobile/ApkInstallerModule.kt b/mobile/android/app/src/main/java/com/goon/mobile/ApkInstallerModule.kt index 07882eb..b302d33 100644 --- a/mobile/android/app/src/main/java/com/goon/mobile/ApkInstallerModule.kt +++ b/mobile/android/app/src/main/java/com/goon/mobile/ApkInstallerModule.kt @@ -1,7 +1,10 @@ package com.goon.mobile import android.app.PendingIntent +import android.content.BroadcastReceiver +import android.content.Context import android.content.Intent +import android.content.IntentFilter import android.content.pm.PackageInstaller import android.net.Uri import android.os.Build @@ -122,22 +125,53 @@ class ApkInstallerModule(reactContext: ReactApplicationContext) : } } - // PendingIntent musi być MUTABLE bo PackageInstaller dorzuca extras - // (PackageInstaller.EXTRA_STATUS) przed delivery do nas. - val intent = Intent(ctx, MainActivity::class.java).apply { - action = "com.goon.mobile.APK_INSTALL_RESULT" + // BUG-FIX 2026-05-31 ("klikam Install i nic się nie dzieje"): + // commit() NIE pokazuje od razu dialogu. Android najpierw odsyła + // STATUS_PENDING_USER_ACTION + EXTRA_INTENT, który MUSIMY ręcznie + // startActivity() żeby pokazać systemowy dialog "Install update?". + // Poprzednio target był MainActivity bez obsługi tego statusu → + // download się udawał, sesja commitowała, ale dialog nigdy nie + // wyskakiwał. Teraz: getBroadcast → receiver → launch EXTRA_INTENT. + val action = "com.goon.mobile.APK_INSTALL_STATUS" + val receiver = object : BroadcastReceiver() { + override fun onReceive(c: Context, i: Intent) { + val status = i.getIntExtra( + PackageInstaller.EXTRA_STATUS, + PackageInstaller.STATUS_FAILURE, + ) + if (status == PackageInstaller.STATUS_PENDING_USER_ACTION) { + @Suppress("DEPRECATION") + val confirm = i.getParcelableExtra(Intent.EXTRA_INTENT) + confirm?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + if (confirm != null) c.startActivity(confirm) + } else { + // terminal (SUCCESS/FAILURE/ABORTED) — sprzątamy receiver. + try { c.applicationContext.unregisterReceiver(this) } catch (_: Exception) {} + } + } } + val filter = IntentFilter(action) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + ctx.applicationContext.registerReceiver( + receiver, filter, Context.RECEIVER_NOT_EXPORTED, + ) + } else { + @Suppress("UnspecifiedRegisterReceiverFlag") + ctx.applicationContext.registerReceiver(receiver, filter) + } + + val intent = Intent(action).setPackage(ctx.packageName) val flags = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE } else { PendingIntent.FLAG_UPDATE_CURRENT } - val pendingIntent = PendingIntent.getActivity(ctx, sessionId, intent, flags) + val pendingIntent = PendingIntent.getBroadcast(ctx, sessionId, intent, flags) s.commit(pendingIntent.intentSender) } - // commit() jest async — Android pokaże dialog "Install update?" w tej samej - // chwili. Resolwujemy od razu — JS nie czeka na user choice (Android UI). + // commit() async — receiver odpali systemowy dialog gdy Android poprosi + // o user-action. JS nie czeka na wynik (to Android UI). promise.resolve(null) } catch (e: Exception) { promise.reject("ERR_INSTALL", e.message ?: "install fail", e) diff --git a/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp index edfbf22..6492aa0 100644 Binary files a/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp and b/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp b/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp index 23938dd..e29f8aa 100644 Binary files a/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp and b/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp differ diff --git a/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp index 4511f7a..c8a93dc 100644 Binary files a/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp and b/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp index 56c3e00..6c55952 100644 Binary files a/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp and b/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp b/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp index 8d93397..947e0d9 100644 Binary files a/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp and b/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp differ diff --git a/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp index 1fd1d2c..4a37f90 100644 Binary files a/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp and b/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp index d5fb170..40e7c46 100644 Binary files a/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp and b/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp b/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp index 7630c6b..955f625 100644 Binary files a/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp and b/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp differ diff --git a/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp index 0ec84d8..737a53d 100644 Binary files a/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and b/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp index 7d7901a..382774f 100644 Binary files a/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp and b/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp b/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp index 90bbeee..407be98 100644 Binary files a/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp and b/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp differ diff --git a/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp index 94bf6ae..1a78da0 100644 Binary files a/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and b/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp index 8752e23..a499d62 100644 Binary files a/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and b/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp b/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp index 553eb51..7976702 100644 Binary files a/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp and b/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp differ diff --git a/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp index 55f6723..98b304d 100644 Binary files a/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and b/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/mobile/android/app/src/main/res/values/colors.xml b/mobile/android/app/src/main/res/values/colors.xml index 599f126..4691079 100644 --- a/mobile/android/app/src/main/res/values/colors.xml +++ b/mobile/android/app/src/main/res/values/colors.xml @@ -1,6 +1,6 @@ #0E1018 - #0E1018 + #15110D #023c69 #0E1018 \ No newline at end of file diff --git a/mobile/app.json b/mobile/app.json index 0342556..f49b503 100644 --- a/mobile/app.json +++ b/mobile/app.json @@ -2,7 +2,7 @@ "expo": { "name": "goon", "slug": "goon", - "version": "0.2.0", + "version": "0.2.1", "orientation": "portrait", "userInterfaceStyle": "automatic", "newArchEnabled": false,