From ded84bfa8ec51aa955a1b97132bd5e34ca18a8b3 Mon Sep 17 00:00:00 2001 From: moon <56061215+MgKyawLay@users.noreply.github.com> Date: Tue, 23 Jun 2026 14:13:32 +0630 Subject: [PATCH] http response fix --- .gitignore | 1 + app/build.gradle.kts | 14 +++++--- .../main/java/com/mob/utsmyanmar/AGENTS.md | 33 +++++++++++++++++- .../ui/dashboard/DashboardScreen.kt | 4 +-- .../ui/tms_setup/TmsSetupViewModel.kt | 18 +++++++--- baselib/build.gradle | 2 +- .../utsmyanmar/baselib/di/NetworkModule.java | 2 +- cmhl/build.gradle | 2 +- ecr/build.gradle | 2 +- gradle.properties | 2 +- key | Bin 0 -> 2660 bytes .../core_utils/SystemParamsSettings.java | 1 + xpay/build.gradle.kts | 2 +- 13 files changed, 65 insertions(+), 18 deletions(-) create mode 100644 key diff --git a/.gitignore b/.gitignore index 681a57c..e417e80 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ local.properties /.idea /sunmiui-lib /paysdk-lib +/app/uat diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 55dd540..5b6c0eb 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -5,6 +5,9 @@ plugins { id("com.google.dagger.hilt.android") } +// Set default build variant +project.ext.set("android.defaultPublishConfig", "uatDebug") + android { namespace = "com.mob.utsmyanmar" compileSdk { @@ -15,7 +18,7 @@ android { defaultConfig { applicationId = "com.mob.utsmyanmar" - minSdk = 24 + minSdk = 23 //noinspection OldTargetApi targetSdk = 36 versionCode = 1 @@ -34,14 +37,16 @@ android { versionCode = 1 versionName = "1.0" buildConfigField("String", "ENV", "\"SIT\"") + resValue("string", "app_name", "MOB-SIT") } create("uat"){ dimension = "env" applicationIdSuffix = ".uat" - versionNameSuffix = "-SIT" - versionCode = 1 - versionName = "1.0" + versionNameSuffix = "-UAT" + versionCode = 2 + versionName = "2.0" buildConfigField("String", "ENV", "\"UAT\"") + resValue("string", "app_name", "MOB-UAT") } create("production"){ dimension = "env" @@ -65,6 +70,7 @@ android { buildFeatures { compose = true buildConfig = true + resValues = true } } diff --git a/app/src/main/java/com/mob/utsmyanmar/AGENTS.md b/app/src/main/java/com/mob/utsmyanmar/AGENTS.md index 537e01e..16439bf 100644 --- a/app/src/main/java/com/mob/utsmyanmar/AGENTS.md +++ b/app/src/main/java/com/mob/utsmyanmar/AGENTS.md @@ -6,4 +6,35 @@ ### Re-usable Screens - PasswordInput.kt -- InputAmountScreen.kt \ No newline at end of file +- InputAmountScreen.kt +- + +### Ponytail, lazy senior dev mode + You are a lazy senior developer. Lazy means efficient, not careless. The best code is the code never written. + +Before writing any code, stop at the first rung that holds: + +Does this need to be built at all? (YAGNI) +Does it already exist in this codebase? Reuse the helper, util, or pattern that's already here, don't re-write it. +Does the standard library already do this? Use it. +Does a native platform feature cover it? Use it. +Does an already-installed dependency solve it? Use it. +Can this be one line? Make it one line. +Only then: write the minimum code that works. +The ladder runs after you understand the problem, not instead of it: read the task and the code it touches, trace the real flow end to end, then climb. + +Bug fix = root cause, not symptom: a report names a symptom. Grep every caller of the function you touch and fix the shared function once — one guard there is a smaller diff than one per caller, and patching only the path the ticket names leaves a sibling caller still broken. + +Rules: + +No abstractions that weren't explicitly requested. +No new dependency if it can be avoided. +No boilerplate nobody asked for. +Deletion over addition. Boring over clever. Fewest files possible. +Shortest working diff wins, but only once you understand the problem. The smallest change in the wrong place isn't lazy, it's a second bug. +Question complex requests: "Do you actually need X, or does Y cover it?" +Pick the edge-case-correct option when two stdlib approaches are the same size, lazy means less code, not the flimsier algorithm. +Mark intentional simplifications with a ponytail: comment. If the shortcut has a known ceiling (global lock, O(n²) scan, naive heuristic), the comment names the ceiling and the upgrade path. +Not lazy about: understanding the problem (read it fully and trace the real flow before picking a rung, a small diff you don't understand is just laziness dressed up as efficiency), input validation at trust boundaries, error handling that prevents data loss, security, accessibility, the calibration real hardware needs (the platform is never the spec ideal, a clock drifts, a sensor reads off), anything explicitly requested. Lazy code without its check is unfinished: non-trivial logic leaves ONE runnable check behind, the smallest thing that fails if the logic breaks (an assert-based demo/self-check or one small test file; no frameworks, no fixtures). Trivial one-liners need no test. + +(Yes, this file also applies to agents working on the ponytail repo itself. Especially to them.) \ No newline at end of file diff --git a/app/src/main/java/com/mob/utsmyanmar/ui/dashboard/DashboardScreen.kt b/app/src/main/java/com/mob/utsmyanmar/ui/dashboard/DashboardScreen.kt index e6be3ae..8d07841 100644 --- a/app/src/main/java/com/mob/utsmyanmar/ui/dashboard/DashboardScreen.kt +++ b/app/src/main/java/com/mob/utsmyanmar/ui/dashboard/DashboardScreen.kt @@ -72,13 +72,13 @@ import androidx.compose.runtime.produceState import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue -import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.rotate import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign @@ -494,7 +494,7 @@ private fun AdvertisingArea( modifier = modifier, shape = RoundedCornerShape(0.dp), colors = CardDefaults.cardColors(containerColor = Color.White), - ) { +) { HorizontalPager( state = pageState, modifier = Modifier.fillMaxSize() ) { page -> diff --git a/app/src/main/java/com/mob/utsmyanmar/ui/tms_setup/TmsSetupViewModel.kt b/app/src/main/java/com/mob/utsmyanmar/ui/tms_setup/TmsSetupViewModel.kt index ebdd9f9..fdcb4d4 100644 --- a/app/src/main/java/com/mob/utsmyanmar/ui/tms_setup/TmsSetupViewModel.kt +++ b/app/src/main/java/com/mob/utsmyanmar/ui/tms_setup/TmsSetupViewModel.kt @@ -95,11 +95,19 @@ class TmsSetupViewModel @Inject constructor( onConfigApplied() }, { error -> - val errorMessage = if(error is retrofit2.HttpException){ -// error.response()?.errorBody()?.toString() ?: error.message.toString() - val body = error.response()?.errorBody()?.toString() - JSONObject(body ?: "").getString("message") - }else{ + val errorMessage = if (error is retrofit2.HttpException) { + try { + val body = error.response()?.errorBody()?.string() + if (!body.isNullOrBlank()) { + JSONObject(body).optString("message", "Unknown server error") + } else { + "Empty error response (${error.code()})" + } + } catch (e: Exception) { + // Server returned non-JSON (HTML 404 page, plain text, etc.) + "Server error: ${error.code()}" + } + } else { error.message.toString() } _uiState.update { diff --git a/baselib/build.gradle b/baselib/build.gradle index 3c9059a..8bea50d 100644 --- a/baselib/build.gradle +++ b/baselib/build.gradle @@ -12,7 +12,7 @@ android { } defaultConfig { - minSdk = 24 + minSdk = 23 //noinspection ExpiredTargetSdkVersion targetSdk = 30 diff --git a/baselib/src/main/java/com/utsmyanmar/baselib/di/NetworkModule.java b/baselib/src/main/java/com/utsmyanmar/baselib/di/NetworkModule.java index 4ab07d5..cea6e18 100644 --- a/baselib/src/main/java/com/utsmyanmar/baselib/di/NetworkModule.java +++ b/baselib/src/main/java/com/utsmyanmar/baselib/di/NetworkModule.java @@ -346,7 +346,7 @@ public class NetworkModule { String tmsAddress = SystemParamsOperation.getInstance().getTmsAddress(); - if(tmsAddress == null || tmsAddress.equals("")) { + if(tmsAddress == null || tmsAddress.isEmpty()) { tmsAddress = getTMSUrlFromNative(); } diff --git a/cmhl/build.gradle b/cmhl/build.gradle index 89f4562..1debdd6 100644 --- a/cmhl/build.gradle +++ b/cmhl/build.gradle @@ -7,7 +7,7 @@ android { compileSdk = 34 defaultConfig { - minSdk 24 + minSdk 23 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" diff --git a/ecr/build.gradle b/ecr/build.gradle index e346349..3c399d2 100644 --- a/ecr/build.gradle +++ b/ecr/build.gradle @@ -6,7 +6,7 @@ android { compileSdk = 34 defaultConfig { - minSdk = 24 + minSdk = 23 //noinspection ExpiredTargetSdkVersion targetSdk = 30 diff --git a/gradle.properties b/gradle.properties index 34c5e9e..2d6942d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,4 +12,4 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 # https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects # org.gradle.parallel=true # Kotlin code style for this project: "official" or "obsolete": -kotlin.code.style=official \ No newline at end of file +kotlin.code.style=official diff --git a/key b/key new file mode 100644 index 0000000000000000000000000000000000000000..fae2ec8c93c2c72a9ead0e3499293e95b32be4b9 GIT binary patch literal 2660 zcma);c{tRI8pmfC`&c78lZmm89}U7xkt|uWG@a^H7{gd5j9rM4xn&zQcCr+*FHJ(o zoH!#Vl&wjrL_^jPW7q9I_dcEH{&nvk@AE$I_xpa|KR?e4kOkejz}x^?P>@$ZlVU^J z6bAEwOUMGd5VF7~KoA%i<}3ka==`%Cw(F=ip)N%($g`2I1%uw+{Zwn`%@6kwHTnI5PFbsh5^8foHmjDk4P~;VG zr`Uk;+z_xPL@Y2&YD1xI&6Mar4ROHPyFkd0*VqnjsI%&TYa1wxM`Y^ex6??4xOkMt9#UQG=JVt%ju%M#9cPo(oRaDOt8M zP-V_t{R6@7>2)!8f`t>Fk{U3DmuS7MpW5zeVs4uv7Ox(K0Fwmi3i)w^ZSSRl@h;IC zgoNeyR7hp&j8N3FY(Tc~ADUfu`?XrEk^3-g|GUnQMP~)T6U58(SR( zbK9NJDaKIr&>E*jNg78J9%i$H;J2^>{DW1mvL8$0nvVDFO&(QxARqP!{8KP$%uO?v!Ibr%&{n z0=r0iRUlP*+302X@J5nAWsHaa=l%=Txqms!UC$WmzR2{STv^~8Sj{|@E%4MGs8e;A z6+l?Zr^f7O83cIn-p^;4zY7WVm~le|RJ=a?eZqM*F-GC#3PwWeSk%i)$`?3k$e1`= zs7Ed{xn)hiHw^TA^f+M1`;O{tqZ z*N5Ady7Ts#(S2atP}5#OyceOMsAgO<({1S9l+2MW^z=nIpez8T+KA~yDVl8|g?;J6 zyMEG4*=CD|0J355=`^NFqGA44xiyZiVi?VF10EgohL4*#4#l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