http response fix

This commit is contained in:
moon 2026-06-23 14:13:32 +06:30
parent d67e27593b
commit ded84bfa8e
13 changed files with 65 additions and 18 deletions

1
.gitignore vendored
View File

@ -17,3 +17,4 @@ local.properties
/.idea /.idea
/sunmiui-lib /sunmiui-lib
/paysdk-lib /paysdk-lib
/app/uat

View File

@ -5,6 +5,9 @@ plugins {
id("com.google.dagger.hilt.android") id("com.google.dagger.hilt.android")
} }
// Set default build variant
project.ext.set("android.defaultPublishConfig", "uatDebug")
android { android {
namespace = "com.mob.utsmyanmar" namespace = "com.mob.utsmyanmar"
compileSdk { compileSdk {
@ -15,7 +18,7 @@ android {
defaultConfig { defaultConfig {
applicationId = "com.mob.utsmyanmar" applicationId = "com.mob.utsmyanmar"
minSdk = 24 minSdk = 23
//noinspection OldTargetApi //noinspection OldTargetApi
targetSdk = 36 targetSdk = 36
versionCode = 1 versionCode = 1
@ -34,14 +37,16 @@ android {
versionCode = 1 versionCode = 1
versionName = "1.0" versionName = "1.0"
buildConfigField("String", "ENV", "\"SIT\"") buildConfigField("String", "ENV", "\"SIT\"")
resValue("string", "app_name", "MOB-SIT")
} }
create("uat"){ create("uat"){
dimension = "env" dimension = "env"
applicationIdSuffix = ".uat" applicationIdSuffix = ".uat"
versionNameSuffix = "-SIT" versionNameSuffix = "-UAT"
versionCode = 1 versionCode = 2
versionName = "1.0" versionName = "2.0"
buildConfigField("String", "ENV", "\"UAT\"") buildConfigField("String", "ENV", "\"UAT\"")
resValue("string", "app_name", "MOB-UAT")
} }
create("production"){ create("production"){
dimension = "env" dimension = "env"
@ -65,6 +70,7 @@ android {
buildFeatures { buildFeatures {
compose = true compose = true
buildConfig = true buildConfig = true
resValues = true
} }
} }

View File

@ -7,3 +7,34 @@
### Re-usable Screens ### Re-usable Screens
- PasswordInput.kt - PasswordInput.kt
- InputAmountScreen.kt - 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.)

View File

@ -72,13 +72,13 @@ import androidx.compose.runtime.produceState
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.rotate import androidx.compose.ui.draw.rotate
import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextAlign

View File

@ -96,9 +96,17 @@ class TmsSetupViewModel @Inject constructor(
}, },
{ error -> { error ->
val errorMessage = if (error is retrofit2.HttpException) { val errorMessage = if (error is retrofit2.HttpException) {
// error.response()?.errorBody()?.toString() ?: error.message.toString() try {
val body = error.response()?.errorBody()?.toString() val body = error.response()?.errorBody()?.string()
JSONObject(body ?: "").getString("message") 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 { } else {
error.message.toString() error.message.toString()
} }

View File

@ -12,7 +12,7 @@ android {
} }
defaultConfig { defaultConfig {
minSdk = 24 minSdk = 23
//noinspection ExpiredTargetSdkVersion //noinspection ExpiredTargetSdkVersion
targetSdk = 30 targetSdk = 30

View File

@ -346,7 +346,7 @@ public class NetworkModule {
String tmsAddress = SystemParamsOperation.getInstance().getTmsAddress(); String tmsAddress = SystemParamsOperation.getInstance().getTmsAddress();
if(tmsAddress == null || tmsAddress.equals("")) { if(tmsAddress == null || tmsAddress.isEmpty()) {
tmsAddress = getTMSUrlFromNative(); tmsAddress = getTMSUrlFromNative();
} }

View File

@ -7,7 +7,7 @@ android {
compileSdk = 34 compileSdk = 34
defaultConfig { defaultConfig {
minSdk 24 minSdk 23
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro" consumerProguardFiles "consumer-rules.pro"

View File

@ -6,7 +6,7 @@ android {
compileSdk = 34 compileSdk = 34
defaultConfig { defaultConfig {
minSdk = 24 minSdk = 23
//noinspection ExpiredTargetSdkVersion //noinspection ExpiredTargetSdkVersion
targetSdk = 30 targetSdk = 30

BIN
key Normal file

Binary file not shown.

View File

@ -38,6 +38,7 @@ public class SystemParamsSettings implements Serializable {
private boolean checkExpSwitch = false; 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 = "https://sirius-nest.utsmyanmar.com/api/v1";
// private String tmsAddress = "http://128.199.170.203"; // private String tmsAddress = "http://128.199.170.203";

View File

@ -7,7 +7,7 @@ android {
compileSdk = 34 compileSdk = 34
defaultConfig { defaultConfig {
minSdk = 24 minSdk = 23
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro") consumerProguardFiles("consumer-rules.pro")