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:
@@ -17,23 +17,30 @@ android {
|
||||
applicationId = "com.example.tis_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.tis_app_p3"
|
||||
manifestPlaceholders["appName"] = "تیس"
|
||||
}
|
||||
create("ps4") {
|
||||
versionCode = 1
|
||||
versionName = "1.0"
|
||||
dimension = "module"
|
||||
}
|
||||
applicationId = "com.example.tis_app_p4"
|
||||
manifestPlaceholders["appName"] = "تیس" }
|
||||
create("standard") {
|
||||
versionCode = 1
|
||||
versionName = "1.0"
|
||||
dimension = "module"
|
||||
}
|
||||
applicationId = "com.example.tis_app"
|
||||
manifestPlaceholders["appName"] = "تیس" }
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
@@ -72,6 +79,7 @@ dependencies {
|
||||
implementation(libs.androidx.compose.ui.graphics)
|
||||
implementation(libs.androidx.compose.ui.tooling.preview)
|
||||
implementation(libs.androidx.core.ktx)
|
||||
implementation(libs.retrofit.converter.gson)
|
||||
implementation(libs.androidx.lifecycle.runtime.ktx)
|
||||
implementation("androidx.hilt:hilt-navigation-compose:1.2.0")
|
||||
testImplementation(libs.junit)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.example.tis_app.screen
|
||||
|
||||
import android.provider.Settings
|
||||
import android.webkit.WebView
|
||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
@@ -13,9 +12,13 @@ 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.tis_app.viewmodel.WebViewModel
|
||||
|
||||
private const val tisIp = "194.59.214.243:8090"
|
||||
|
||||
@Composable
|
||||
fun TisWebViewScreen(
|
||||
modifier: Modifier = Modifier,
|
||||
@@ -58,13 +61,10 @@ fun TisWebViewScreen(
|
||||
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,13 +3,14 @@ package com.example.tis_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.example.tis_app.R
|
||||
import com.google.gson.Gson
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import javax.inject.Inject
|
||||
|
||||
@@ -18,7 +19,7 @@ class WebViewModel @Inject constructor(
|
||||
private val pspService: PspService,
|
||||
private val paymentResult: PaymentResult,
|
||||
private val printer: Printer,
|
||||
private val appConfig: AppConfig
|
||||
private val gson: Gson
|
||||
) : ViewModel() {
|
||||
|
||||
|
||||
@@ -37,14 +38,20 @@ class WebViewModel @Inject constructor(
|
||||
activityResult = activityResult
|
||||
)
|
||||
}
|
||||
fun print(printEntities : List<PrintEntity>) {
|
||||
|
||||
fun print(printEntities: List<PrintEntity>) {
|
||||
printer.print(
|
||||
printEntities = printEntities,
|
||||
icon = R.drawable.tis_icon
|
||||
)
|
||||
}
|
||||
|
||||
fun sendAndroidId(id : String) {
|
||||
appConfig.androidId(id)
|
||||
fun deviceInfoJson(androidId: String, deviceName: String): String {
|
||||
return gson.toJson(
|
||||
DeviceInfo(
|
||||
androidId = androidId,
|
||||
deviceName = deviceName
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user