Feat(Tis): DeviceInfo and Build applicationId

Send Device name and AndroidId in DeviceInfo,
Handle multiple release version with different version number and application Id for each psp
This commit is contained in:
Amir Mousavi
2026-05-09 20:30:14 +03:30
parent d73df5524e
commit fe17187df2
16 changed files with 110 additions and 73 deletions
+18 -4
View File
@@ -2,10 +2,12 @@ plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.ksp)
alias(libs.plugins.hilt)}
alias(libs.plugins.hilt)
}
android {
namespace = "com.example.stage_app"
compileSdk {
version = release(36) {
minorApiLevel = 1
@@ -16,22 +18,33 @@ android {
applicationId = "com.example.stage_app"
minSdk = 24
targetSdk = 36
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
flavorDimensions.add("module")
productFlavors {
create("p3") {
versionCode = 1
versionName = "1.0"
dimension = "module"
applicationId = "com.example.stage_app_p3"
manifestPlaceholders["appName"] = "TisP3"
}
create("ps4") {
versionCode = 1
versionName = "2.0"
dimension = "module"
applicationId = "com.example.stage_app_p4"
manifestPlaceholders["appName"] = "TisP4"
}
create("standard") {
versionCode = 1
versionName = "1.0"
dimension = "module"
applicationId = "com.example.stage_app"
manifestPlaceholders["appName"] = "Tis"
}
}
@@ -74,6 +87,7 @@ dependencies {
implementation(libs.androidx.compose.ui.tooling.preview)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.retrofit.converter.gson)
implementation("androidx.hilt:hilt-navigation-compose:1.2.0")
testImplementation(libs.junit)
androidTestImplementation(platform(libs.androidx.compose.bom))
+1 -1
View File
@@ -20,7 +20,7 @@
android:name=".PspApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:label="${appName}"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.PSP"
@@ -1,6 +1,5 @@
package com.example.stage_app.screen
import android.provider.Settings
import android.webkit.WebView
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
@@ -13,6 +12,8 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.hilt.navigation.compose.hiltViewModel
import com.example.core.getAndroidId
import com.example.core.getDeviceName
import com.example.design_system.PspWebView
import com.example.stage_app.viewmodel.StageViewModel
@@ -60,13 +61,10 @@ fun StageWebViewScreen(
viewModel.print(printEntities)
},
onUUID = {
val androidId = Settings
.Secure
.getString(context.contentResolver, Settings.Secure.ANDROID_ID)
viewModel.sendAndroidId(
androidId
onDeviceInfo = {
viewModel.deviceInfoJson(
androidId = getAndroidId(context),
getDeviceName()
)
}
)
@@ -3,12 +3,13 @@ package com.example.stage_app.viewmodel
import android.content.Intent
import androidx.activity.result.ActivityResult
import androidx.lifecycle.ViewModel
import com.example.core.domain.AppConfig
import com.example.core.domain.PaymentResult
import com.example.core.domain.Printer
import com.example.core.domain.PspService
import com.example.core.model.DeviceInfo
import com.example.core.model.PaymentResultEntity
import com.example.core.model.PrintEntity
import com.google.gson.Gson
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
@@ -17,7 +18,7 @@ class StageViewModel @Inject constructor(
private val pspService: PspService,
private val paymentResult: PaymentResult,
private val printer: Printer,
private val appConfig: AppConfig
private val gson: Gson
) : ViewModel() {
@@ -66,7 +67,12 @@ class StageViewModel @Inject constructor(
)
}
fun sendAndroidId(id: String) {
appConfig.androidId(id)
fun deviceInfoJson(androidId: String, deviceName: String): String {
return gson.toJson(
DeviceInfo(
androidId = androidId,
deviceName = deviceName
)
)
}
}
@@ -1,8 +1,9 @@
package com.example.tis_sep.di
import com.example.core.PspService
import com.example.ps4.Ps4Service
import com.example.core.domain.Printer
import com.example.core.domain.PspService
import com.example.ps4.P4Printer
import com.example.ps4.Ps4Service
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn