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 0000000..fae2ec8 Binary files /dev/null and b/key differ diff --git a/paylibs/src/main/java/com/utsmyanmar/paylibs/utils/core_utils/SystemParamsSettings.java b/paylibs/src/main/java/com/utsmyanmar/paylibs/utils/core_utils/SystemParamsSettings.java index 63b5f00..aac1055 100644 --- a/paylibs/src/main/java/com/utsmyanmar/paylibs/utils/core_utils/SystemParamsSettings.java +++ b/paylibs/src/main/java/com/utsmyanmar/paylibs/utils/core_utils/SystemParamsSettings.java @@ -38,6 +38,7 @@ public class SystemParamsSettings implements Serializable { private boolean checkExpSwitch = false; +// private String tmsAddress = "http://posuat.myanmarorientalbank.com:5033"; private String tmsAddress = "https://sirius-nest.utsmyanmar.com/api/v1"; // private String tmsAddress = "http://128.199.170.203"; diff --git a/xpay/build.gradle.kts b/xpay/build.gradle.kts index 220d72c..70b4320 100644 --- a/xpay/build.gradle.kts +++ b/xpay/build.gradle.kts @@ -7,7 +7,7 @@ android { compileSdk = 34 defaultConfig { - minSdk = 24 + minSdk = 23 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles("consumer-rules.pro")