diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml
index 1bcace6..c8be39b 100644
--- a/.idea/deploymentTargetSelector.xml
+++ b/.idea/deploymentTargetSelector.xml
@@ -10,6 +10,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 5fde283..eb50daa 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -12,9 +12,10 @@
-
+
-
+
+
diff --git a/.idea/planningMode.xml b/.idea/planningMode.xml
new file mode 100644
index 0000000..17c0abb
--- /dev/null
+++ b/.idea/planningMode.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/core/src/main/java/com/example/core/data/AppConfigImpl.kt b/core/src/main/java/com/example/core/data/AppConfigImpl.kt
new file mode 100644
index 0000000..1e97763
--- /dev/null
+++ b/core/src/main/java/com/example/core/data/AppConfigImpl.kt
@@ -0,0 +1,9 @@
+package com.example.core.data
+
+import com.example.core.domain.AppConfig
+
+class AppConfigImpl : AppConfig{
+ override fun androidId(id: String): String {
+ return "window.WebV.onUUID($id);"
+ }
+}
\ No newline at end of file
diff --git a/core/src/main/java/com/example/core/data/PaymentResultImpl.kt b/core/src/main/java/com/example/core/data/PaymentResultImpl.kt
index 7896e3a..0b7e43b 100644
--- a/core/src/main/java/com/example/core/data/PaymentResultImpl.kt
+++ b/core/src/main/java/com/example/core/data/PaymentResultImpl.kt
@@ -10,7 +10,7 @@ class PaymentResultImpl @Inject constructor(
) : PaymentResult {
override fun post(paymentResultEntity: PaymentResultEntity?): String {
- return "window.onPaymentResult(${gson.toJson(paymentResultEntity)});"
+ return "window.WebV.onPaymentResult(${gson.toJson(paymentResultEntity)});"
}
}
\ No newline at end of file
diff --git a/core/src/main/java/com/example/core/di/CoreModule.kt b/core/src/main/java/com/example/core/di/CoreModule.kt
index b4bd9f3..c7fc873 100644
--- a/core/src/main/java/com/example/core/di/CoreModule.kt
+++ b/core/src/main/java/com/example/core/di/CoreModule.kt
@@ -1,6 +1,8 @@
package com.example.core.di
+import com.example.core.data.AppConfigImpl
import com.example.core.data.PaymentResultImpl
+import com.example.core.domain.AppConfig
import com.example.core.domain.PaymentResult
import com.google.gson.Gson
import dagger.Module
@@ -23,4 +25,9 @@ class CoreModule {
): PaymentResult = PaymentResultImpl(
gson = gson
)
+
+ @Provides
+ fun provideAppConfig(
+ gson: Gson
+ ): AppConfig = AppConfigImpl()
}
\ No newline at end of file
diff --git a/core/src/main/java/com/example/core/domain/AppConfig.kt b/core/src/main/java/com/example/core/domain/AppConfig.kt
new file mode 100644
index 0000000..10df710
--- /dev/null
+++ b/core/src/main/java/com/example/core/domain/AppConfig.kt
@@ -0,0 +1,7 @@
+package com.example.core.domain
+
+import com.example.core.model.PaymentResultEntity
+
+interface AppConfig {
+ fun androidId(id : String) : String
+}
\ No newline at end of file
diff --git a/core/src/main/java/com/example/core/domain/Printer.kt b/core/src/main/java/com/example/core/domain/Printer.kt
new file mode 100644
index 0000000..2eff803
--- /dev/null
+++ b/core/src/main/java/com/example/core/domain/Printer.kt
@@ -0,0 +1,11 @@
+package com.example.core.domain
+
+import androidx.annotation.DrawableRes
+import com.example.core.model.PrintEntity
+
+interface Printer {
+
+ fun print(
+ printEntities: List,
+ @DrawableRes icon :Int)
+}
\ No newline at end of file
diff --git a/core/src/main/java/com/example/core/model/PrintEntity.kt b/core/src/main/java/com/example/core/model/PrintEntity.kt
new file mode 100644
index 0000000..76684f7
--- /dev/null
+++ b/core/src/main/java/com/example/core/model/PrintEntity.kt
@@ -0,0 +1,23 @@
+package com.example.core.model
+
+import androidx.annotation.Keep
+
+@Keep
+data class PrintEntity(
+ val title: String? = null,
+ val items: List? = null,
+ val paragraph: String? = null,
+ val type: Type
+
+) {
+ data class ItemEntity(
+ val label: String,
+ val value: String,
+ )
+
+ enum class Type() {
+ CARD,
+ PARAGRAPH
+ }
+
+}
\ No newline at end of file
diff --git a/core/src/main/res/drawable/divider.xml b/core/src/main/res/drawable/divider.xml
new file mode 100644
index 0000000..43f186a
--- /dev/null
+++ b/core/src/main/res/drawable/divider.xml
@@ -0,0 +1,28 @@
+
+
+
+
diff --git a/core/src/main/res/drawable/horizontal_line_svgrepo_com__1_.xml b/core/src/main/res/drawable/horizontal_line_svgrepo_com__1_.xml
new file mode 100644
index 0000000..a5d541a
--- /dev/null
+++ b/core/src/main/res/drawable/horizontal_line_svgrepo_com__1_.xml
@@ -0,0 +1,26 @@
+
+
+
+
diff --git a/design_system/build.gradle.kts b/design_system/build.gradle.kts
index 4c25938..706a1ba 100644
--- a/design_system/build.gradle.kts
+++ b/design_system/build.gradle.kts
@@ -37,6 +37,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)
testImplementation(libs.junit)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
@@ -44,4 +45,6 @@ dependencies {
androidTestImplementation(libs.androidx.junit)
debugImplementation(libs.androidx.compose.ui.test.manifest)
debugImplementation(libs.androidx.compose.ui.tooling)
+
+ implementation(project(":core"))
}
\ No newline at end of file
diff --git a/design_system/src/main/java/com/example/design_system/WebViewScreen.kt b/design_system/src/main/java/com/example/design_system/WebViewScreen.kt
index 05c536f..51d41c2 100644
--- a/design_system/src/main/java/com/example/design_system/WebViewScreen.kt
+++ b/design_system/src/main/java/com/example/design_system/WebViewScreen.kt
@@ -1,8 +1,10 @@
package com.example.design_system
+import android.annotation.SuppressLint
import android.app.Activity
import android.view.ViewGroup
-import android.webkit.JavascriptInterface
+import android.webkit.WebResourceError
+import android.webkit.WebResourceRequest
import android.webkit.WebSettings
import android.webkit.WebView
import android.webkit.WebViewClient
@@ -15,14 +17,17 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
+import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.viewinterop.AndroidView
+import com.example.core.model.PrintEntity
import com.example.design_system.util.PspJavaScriptInterface
import com.example.design_system.util.snackbar.SnackbarController
import com.example.design_system.util.snackbar.SnackbarEvent
import kotlinx.coroutines.launch
+@SuppressLint("JavascriptInterface")
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun PspWebView(
@@ -31,7 +36,8 @@ fun PspWebView(
modifier: Modifier = Modifier,
onWebView: (WebView) -> Unit,
onPayClick: (amount: Long, id: String?) -> Unit,
- onPrintClick: () -> Unit,
+ onUUID: () -> Unit,
+ onPrintClick: (printEntities: List) -> Unit,
) {
val canGoBack = remember { mutableStateOf(false) }
@@ -40,6 +46,18 @@ fun PspWebView(
var lastBackTime by remember { mutableLongStateOf(0L) }
var isPaymentLaunching by remember { mutableStateOf(false) }
+ // Use rememberUpdatedState to ensure the bridge always calls the latest callbacks
+ val currentOnPayClick by rememberUpdatedState(onPayClick)
+ val currentOnPrintClick by rememberUpdatedState(onPrintClick)
+ val currentOnUUID by rememberUpdatedState(onUUID)
+
+ val bridge = remember {
+ PspJavaScriptInterface(
+ onPayClick = { amount, id -> currentOnPayClick(amount, id) },
+ onPrintClick = { entities -> currentOnPrintClick(entities) },
+ onUUID = { currentOnUUID() }
+ )
+ }
BackHandler {
if (canGoBack.value) {
@@ -61,7 +79,6 @@ fun PspWebView(
}
}
-
AndroidView(
modifier = modifier,
factory = { ctx ->
@@ -89,23 +106,7 @@ fun PspWebView(
"Mozilla/5.0 (Linux; Android 13) AppleWebKit/537.36 Chrome/120.0 Mobile Safari/537.36"
}
- addJavascriptInterface(
-
- object : PspJavaScriptInterface {
-
-
- @JavascriptInterface
- override fun pay(amount: Long, id: String?) {
- onPayClick(amount, id)
- }
-
- @JavascriptInterface
- override fun print(text: String) {
- TODO("Not yet implemented")
- }
-
- }, "AndroidPSP"
- )
+ addJavascriptInterface(bridge, "NativeBridge")
loadUrl(url)
diff --git a/design_system/src/main/java/com/example/design_system/util/PspJavaScriptInterface.kt b/design_system/src/main/java/com/example/design_system/util/PspJavaScriptInterface.kt
index 2296653..00d37a4 100644
--- a/design_system/src/main/java/com/example/design_system/util/PspJavaScriptInterface.kt
+++ b/design_system/src/main/java/com/example/design_system/util/PspJavaScriptInterface.kt
@@ -1,8 +1,51 @@
package com.example.design_system.util
-interface PspJavaScriptInterface {
+import android.util.Log
+import android.webkit.JavascriptInterface
+import androidx.annotation.Keep
+import com.example.core.model.PrintEntity
+import com.google.gson.Gson
+import com.google.gson.reflect.TypeToken
- fun pay(amount: Long,id: String?)
+@Keep
+class PspJavaScriptInterface(
+ private val onPayClick: (Long, String?) -> Unit,
+ private val onPrintClick: (List) -> Unit,
+ private val onUUID: () -> Unit,
+) {
- fun print(text: String)
-}
\ No newline at end of file
+ @JavascriptInterface
+ @Keep
+ fun pay(amount: Double, id: String?) {
+ Log.d("PspBridge", "pay called: amount=$amount, id=$id")
+ try {
+ onPayClick(amount.toLong(), id)
+ } catch (e: Exception) {
+ Log.e("PspBridge", "Error in pay callback", e)
+ }
+ }
+
+ @JavascriptInterface
+ @Keep
+ fun print(printEntitiesJson: String) {
+ Log.d("PspBridge", "print called: $printEntitiesJson")
+ try {
+ val type = object : TypeToken>() {}.type
+ val list: List = Gson().fromJson(printEntitiesJson, type)
+ onPrintClick(list)
+ } catch (e: Exception) {
+ Log.e("PspBridge", "Error parsing print entities", e)
+ }
+ }
+
+ @JavascriptInterface
+ @Keep
+ fun uuid() {
+ Log.d("PspBridge", "uuid called")
+ try {
+ onUUID()
+ } catch (e: Exception) {
+ Log.e("PspBridge", "Error in uuid callback", e)
+ }
+ }
+}
diff --git a/ps3/.gitignore b/p3/.gitignore
similarity index 100%
rename from ps3/.gitignore
rename to p3/.gitignore
diff --git a/ps3/build.gradle.kts b/p3/build.gradle.kts
similarity index 62%
rename from ps3/build.gradle.kts
rename to p3/build.gradle.kts
index 140eb04..fe25898 100644
--- a/ps3/build.gradle.kts
+++ b/p3/build.gradle.kts
@@ -5,24 +5,29 @@ plugins {
}
android {
- namespace = "com.example.ps3"
- compileSdk {
- version = release(36) {
- minorApiLevel = 1
- }
- }
+ namespace = "com.example.p3"
+ compileSdk = 36
defaultConfig {
minSdk = 24
-
+ // targetSdk is often not needed for library modules
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}
+
+ buildTypes {
+ release {
+ isMinifyEnabled = false
+ proguardFiles(
+ getDefaultProguardFile("proguard-android-optimize.txt"),
+ "proguard-rules.pro"
+ )
+ }
+ }
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
-
}
dependencies {
@@ -39,10 +44,7 @@ dependencies {
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(libs.androidx.junit)
-// implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
-
-
- // 2. This specifically includes the platform SDK jar
- compileOnly(files("libs/platform_sdk_v2.3.706.jar"))
-
+ // Using implementation to bundle the JAR and avoid NoClassDefFoundError
+ implementation(files("libs/platform_sdk_v2.3.706.jar"))
+ implementation(files("libs/classes-2.1.17.jar"))
}
diff --git a/ps3/consumer-rules.pro b/p3/consumer-rules.pro
similarity index 100%
rename from ps3/consumer-rules.pro
rename to p3/consumer-rules.pro
diff --git a/p3/libs/classes-2.1.17.jar b/p3/libs/classes-2.1.17.jar
new file mode 100644
index 0000000..352ddc8
Binary files /dev/null and b/p3/libs/classes-2.1.17.jar differ
diff --git a/ps3/libs/platform_sdk_v2.3.706.jar b/p3/libs/platform_sdk_v2.3.706.jar
similarity index 100%
rename from ps3/libs/platform_sdk_v2.3.706.jar
rename to p3/libs/platform_sdk_v2.3.706.jar
diff --git a/ps3/proguard-rules.pro b/p3/proguard-rules.pro
similarity index 100%
rename from ps3/proguard-rules.pro
rename to p3/proguard-rules.pro
diff --git a/ps3/src/androidTest/java/com/example/ps3/ExampleInstrumentedTest.kt b/p3/src/androidTest/java/com/example/p3/ExampleInstrumentedTest.kt
similarity index 96%
rename from ps3/src/androidTest/java/com/example/ps3/ExampleInstrumentedTest.kt
rename to p3/src/androidTest/java/com/example/p3/ExampleInstrumentedTest.kt
index 581abb1..c1f3f6a 100644
--- a/ps3/src/androidTest/java/com/example/ps3/ExampleInstrumentedTest.kt
+++ b/p3/src/androidTest/java/com/example/p3/ExampleInstrumentedTest.kt
@@ -1,4 +1,4 @@
-package com.example.ps3
+package com.example.p3
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
diff --git a/ps3/src/main/AndroidManifest.xml b/p3/src/main/AndroidManifest.xml
similarity index 100%
rename from ps3/src/main/AndroidManifest.xml
rename to p3/src/main/AndroidManifest.xml
diff --git a/ps3/src/main/java/com/example/ps3/IapPosService.kt b/p3/src/main/java/com/example/p3/IapPosService.kt
similarity index 98%
rename from ps3/src/main/java/com/example/ps3/IapPosService.kt
rename to p3/src/main/java/com/example/p3/IapPosService.kt
index 34d4c23..c09bd64 100644
--- a/ps3/src/main/java/com/example/ps3/IapPosService.kt
+++ b/p3/src/main/java/com/example/p3/IapPosService.kt
@@ -1,4 +1,4 @@
-package com.example.ps3
+package com.example.p3
import android.content.Context
import android.content.Intent
@@ -6,7 +6,7 @@ import android.content.pm.PackageManager
import androidx.activity.result.ActivityResult
import com.example.core.model.PaymentResultEntity
import com.example.core.model.PaymentResultStatus
-import com.example.ps3.models.IapAccountSplit
+import com.example.p3.models.IapAccountSplit
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import javax.inject.Inject
diff --git a/p3/src/main/java/com/example/p3/P3Printer.kt b/p3/src/main/java/com/example/p3/P3Printer.kt
new file mode 100644
index 0000000..86fec77
--- /dev/null
+++ b/p3/src/main/java/com/example/p3/P3Printer.kt
@@ -0,0 +1,333 @@
+package com.example.p3
+
+import android.content.Context
+import android.graphics.Bitmap
+import android.graphics.Canvas
+import android.graphics.drawable.BitmapDrawable
+import android.util.Log
+import androidx.annotation.DrawableRes
+import androidx.core.content.ContextCompat
+import androidx.core.graphics.createBitmap
+import com.example.core.domain.Printer
+import com.example.core.model.PrintEntity
+import com.pos.sdk.printer.POIPrinterManager
+import com.pos.sdk.printer.POIPrinterManager.IPrinterListener
+import com.pos.sdk.printer.models.BitmapPrintLine
+import com.pos.sdk.printer.models.PrintLine
+import com.pos.sdk.printer.models.TextPrintLine
+import dagger.hilt.android.qualifiers.ApplicationContext
+import java.io.File
+import javax.inject.Inject
+
+
+class P3Printer @Inject constructor(
+ @param:ApplicationContext private val context: Context,
+) : Printer {
+ companion object {
+ private const val TAG = "Printer"
+
+ // Printer state constants (should ideally come from the SDK if available)
+ private const val PRINTER_STATE_ERROR = 4
+ private const val DEFAULT_PRINT_GRAY = 2000
+ private const val DEFAULT_LINE_SPACE = 5
+ }
+
+ /**
+ * Prints a sample receipt for demonstration.
+ */
+ fun printSampleReceipt(context: Context) {
+ // Use applicationContext to avoid potential memory leaks
+
+ val printerManager = initialP3Printer()
+
+ printerManager?.apply {
+ setPrintGray(DEFAULT_PRINT_GRAY)
+ setLineSpace(DEFAULT_LINE_SPACE)
+
+ // Header
+ addPrintLine(TextPrintLine("This is an example of a receipt", PrintLine.CENTER))
+
+ // Reusable logo bitmap
+ val logoBitmap = drawableToBitmap(context, android.R.drawable.btn_plus)
+ val logoLine = logoBitmap?.let { BitmapPrintLine(it, PrintLine.CENTER) }
+
+ logoLine?.let { addPrintLine(it) }
+
+ // Address
+ val addressFont = getFontPath("font")
+ if (addressFont.isNotEmpty()) {
+ setPrintFont(addressFont)
+ } else {
+ setPrintFont("/system/fonts/ComingSoon.ttf")
+ }
+ addPrintLine(
+ TextPrintLine(
+ "Floor ** , Building **, No.*** LONG DONG Avenue, Pudong New District, Shanghai, China",
+ PrintLine.LEFT,
+ 20
+ )
+ )
+
+ // Transaction Details
+ val detailFont = getFontPath("font")
+ if (detailFont.isNotEmpty()) {
+ setPrintFont(detailFont)
+ } else {
+ setPrintFont("/system/fonts/DroidSansMono.ttf")
+ }
+// addPrintLine(createPrintRow("24 June 2025", " Assistant 6", "815002", size = 18))
+// addPrintLine(createPrintRow("Item", "Quantity", "Price", size = 24, isBold = true))
+// addPrintLine(createPrintRow("Tomato", "1", "$2.08", size = 24))
+// addPrintLine(createPrintRow("Orange", "1", "$1.06", size = 24))
+//
+ // Footer
+ addPrintLine(TextPrintLine("Total $3.14", PrintLine.RIGHT))
+ addPrintLine(TextPrintLine(""))
+ logoLine?.let { addPrintLine(it) }
+ addPrintLine(TextPrintLine(""))
+
+ addPrintLine(
+ TextPrintLine(
+ "Did you know you could have earned Rewards points on this purchase?",
+ PrintLine.CENTER
+ )
+ )
+ addPrintLine(
+ TextPrintLine(
+ "Simply sign up today for a Membership Card!",
+ PrintLine.CENTER
+ )
+ )
+
+ logoLine?.let { addPrintLine(it) }
+ addPrintLine(TextPrintLine(" ", 0, 100))
+
+ val listener = object : IPrinterListener {
+ override fun onStart() {
+ Log.d(TAG, "Print started")
+ }
+
+ override fun onFinish() {
+ Log.d(TAG, "Print finished")
+ close()
+ }
+
+ override fun onError(code: Int, msg: String?) {
+ Log.e(TAG, "Print error - code: $code, message: $msg")
+ close()
+ }
+ }
+
+ beginPrint(listener)
+ }
+ }
+
+ private fun initialP3Printer(): POIPrinterManager? {
+ val printerManager = POIPrinterManager(context.applicationContext)
+ printerManager.open()
+
+ val state = printerManager.printerState
+ Log.d(TAG, "Printer state = $state")
+
+ if (state == PRINTER_STATE_ERROR) {
+ Log.e(TAG, "Printer is in an error state ($state). Aborting print.")
+ printerManager.close()
+ return null
+ }
+
+ return printerManager
+ }
+
+
+ /**
+ * Creates a row with left, center, and right aligned text.
+ */
+ private fun createPrintRow(
+ label: String,
+ value: String,
+ size: Int,
+ isBold: Boolean = false
+ ): List {
+ return if (value.hasPersianLetters()) {
+
+ listOf(
+ TextPrintLine(label, PrintLine.LEFT, size, true),
+ TextPrintLine(value, PrintLine.RIGHT, size, isBold)
+ )
+ } else {
+
+ listOf(
+ TextPrintLine(label, PrintLine.LEFT, size, true),
+ TextPrintLine(value, PrintLine.LEFT, size, isBold)
+ )
+ }
+ }
+
+ private fun getFontPath(resourceName: String): String {
+ return try {
+ // Find resource ID by name (e.g., "font") in the "font" resource folder
+ val resId = context.resources.getIdentifier(resourceName, "font", context.packageName)
+ if (resId == 0) {
+ Log.e(TAG, "Font resource not found: $resourceName")
+ return ""
+ }
+
+ val fileName = "$resourceName.ttf"
+ val fontFile = File(context.filesDir, fileName)
+ if (!fontFile.exists()) {
+ context.resources.openRawResource(resId).use { input ->
+ fontFile.outputStream().use { output ->
+ input.copyTo(output)
+ }
+ }
+ }
+ fontFile.absolutePath
+ } catch (e: Exception) {
+ Log.e(TAG, "Error loading font from resources: $resourceName", e)
+ ""
+ }
+ }
+
+ override fun print(
+ printEntities: List,
+ @DrawableRes icon: Int
+ ) {
+ val printerManager = initialP3Printer()
+
+ printerManager?.apply {
+ setPrintGray(DEFAULT_PRINT_GRAY)
+ setLineSpace(DEFAULT_LINE_SPACE)
+
+ // Reusable logo bitmap
+ val logoBitmap = drawableToBitmap(context, icon, 200)
+ if (logoBitmap != null) {
+ val logoLine = BitmapPrintLine(logoBitmap, PrintLine.CENTER)
+ addPrintLine(logoLine)
+ addPrintLine(TextPrintLine(" ", 0, 10))
+ }
+
+ val customFontPath = getFontPath("font")
+ if (customFontPath.isNotEmpty()) {
+ setPrintFont(customFontPath)
+ } else {
+ setPrintFont("/system/fonts/DroidSansMono.ttf") // Fallback
+ }
+
+ val divider = drawableToBitmap(context, com.example.core.R.drawable.horizontal_line_svgrepo_com__1_)
+
+ printEntities.forEachIndexed { index, printEntity ->
+
+ // Header
+ printEntity.title?.let {title->
+ addPrintLine(
+ TextPrintLine(
+ title,
+ if (title.hasPersianLetters()) PrintLine.LEFT else PrintLine.RIGHT
+ )
+ )
+ }
+
+ printEntity.items?.let {items->
+ items.forEach { itemEntity ->
+ addPrintLine(
+ createPrintRow(
+ label = itemEntity.label,
+ value = itemEntity.value,
+ size = 16,
+ )
+ )
+ }
+ }
+ if (divider != null && printEntities.lastIndex > index) {
+ val dividerLine = BitmapPrintLine(divider, PrintLine.CENTER)
+ addPrintLine(dividerLine)
+
+ }
+ }
+
+
+ addPrintLine(TextPrintLine(" ", 0, 60))
+
+ val listener = object : IPrinterListener {
+ override fun onStart() {
+ Log.d(TAG, "Print started")
+ }
+
+ override fun onFinish() {
+ Log.d(TAG, "Print finished")
+ close()
+ }
+
+ override fun onError(code: Int, msg: String?) {
+ Log.e(TAG, "Print error - code: $code, message: $msg")
+ close()
+ }
+ }
+
+ beginPrint(listener)
+ }
+ }
+
+
+// private fun fixForPrinter(input: String): String {
+// val LRM = '\u200E' // کنترل جهت
+//
+// return input
+// .toPersianDigits() // همونی که قبل دادم
+// .replace(Regex("(\\d+)")) { matchResult ->
+// "$LRM${matchResult.value}$LRM"
+// }
+// }
+
+ private fun String.hasPersianLetters(): Boolean {
+ return Regex("[\\u0621-\\u0628\\u062A-\\u063A\\u0641-\\u0642\\u0644-\\u0648\\u067E\\u0686\\u0698\\u06A9\\u06AF\\u06CC\\u0647]").containsMatchIn(
+ this
+ )
+ }
+
+ private fun drawableToBitmap(context: Context, @DrawableRes drawableId: Int): Bitmap? {
+ val drawable = ContextCompat.getDrawable(context, drawableId) ?: return null
+
+ if (drawable is BitmapDrawable) {
+ return drawable.bitmap
+ }
+
+ val bitmap = createBitmap(
+ drawable.intrinsicWidth.coerceAtLeast(1),
+ drawable.intrinsicHeight.coerceAtLeast(1)
+ )
+ val canvas = Canvas(bitmap)
+ drawable.setBounds(0, 0, canvas.width, canvas.height)
+ drawable.draw(canvas)
+
+ return bitmap
+ }
+
+ private fun drawableToBitmap(
+ context: Context,
+ @DrawableRes drawableId: Int,
+ maxWidth: Int = 300
+ ): Bitmap? {
+ val drawable = ContextCompat.getDrawable(context, drawableId) ?: return null
+
+ val original = if (drawable is BitmapDrawable) {
+ drawable.bitmap
+ } else {
+ val bitmap = createBitmap(
+ drawable.intrinsicWidth.coerceAtLeast(1),
+ drawable.intrinsicHeight.coerceAtLeast(1)
+ )
+ val canvas = Canvas(bitmap)
+ drawable.setBounds(0, 0, canvas.width, canvas.height)
+ drawable.draw(canvas)
+ bitmap
+ }
+
+ // 👇 scale با حفظ نسبت
+ val ratio = maxWidth.toFloat() / original.width
+ val width = maxWidth
+ val height = (original.height * ratio).toInt()
+
+ return Bitmap.createScaledBitmap(original, width, height, true)
+ }
+}
diff --git a/ps3/src/main/java/com/example/ps3/Ps3Service.kt b/p3/src/main/java/com/example/p3/P3Service.kt
similarity index 87%
rename from ps3/src/main/java/com/example/ps3/Ps3Service.kt
rename to p3/src/main/java/com/example/p3/P3Service.kt
index 6ac877f..968fcc5 100644
--- a/ps3/src/main/java/com/example/ps3/Ps3Service.kt
+++ b/p3/src/main/java/com/example/p3/P3Service.kt
@@ -1,4 +1,4 @@
-package com.example.ps3
+package com.example.p3
import android.content.Intent
import androidx.activity.result.ActivityResult
@@ -8,7 +8,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import javax.inject.Inject
-class Ps3Service @Inject constructor(
+class P3Service @Inject constructor(
private val iapPosService: IapPosService,
private val printerHelper: PrinterHelper
) : PspService {
@@ -21,9 +21,8 @@ class Ps3Service @Inject constructor(
}
override fun print(lines: List, onMessage: (String) -> Unit) {
-// printerHelper.printText()
printerHelper.printLines(lines) { status ->
- onMessage("PS3 Printer: $status")
+ onMessage("P3 Printer: $status")
}
}
diff --git a/ps3/src/main/java/com/example/ps3/PrinterHelper.kt b/p3/src/main/java/com/example/p3/PrinterHelper.kt
similarity index 99%
rename from ps3/src/main/java/com/example/ps3/PrinterHelper.kt
rename to p3/src/main/java/com/example/p3/PrinterHelper.kt
index 5aef915..95331ec 100644
--- a/ps3/src/main/java/com/example/ps3/PrinterHelper.kt
+++ b/p3/src/main/java/com/example/p3/PrinterHelper.kt
@@ -1,4 +1,4 @@
-package com.example.ps3
+package com.example.p3
import android.device.PrinterManager
import android.graphics.Bitmap
diff --git a/ps3/src/main/java/com/example/ps3/di/Ps3Module.kt b/p3/src/main/java/com/example/p3/di/P3Module.kt
similarity index 84%
rename from ps3/src/main/java/com/example/ps3/di/Ps3Module.kt
rename to p3/src/main/java/com/example/p3/di/P3Module.kt
index 95f910a..3804667 100644
--- a/ps3/src/main/java/com/example/ps3/di/Ps3Module.kt
+++ b/p3/src/main/java/com/example/p3/di/P3Module.kt
@@ -1,7 +1,7 @@
-package com.example.ps3.di
+package com.example.p3.di
import android.content.Context
-import com.example.ps3.IapPosService
+import com.example.p3.IapPosService
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
@@ -11,7 +11,7 @@ import javax.inject.Singleton
@Module
@InstallIn(SingletonComponent::class)
-object Ps3Module {
+object P3Module {
@Provides
@Singleton
diff --git a/ps3/src/main/java/com/example/ps3/models/IapAccountSplit.kt b/p3/src/main/java/com/example/p3/models/IapAccountSplit.kt
similarity index 69%
rename from ps3/src/main/java/com/example/ps3/models/IapAccountSplit.kt
rename to p3/src/main/java/com/example/p3/models/IapAccountSplit.kt
index e0a42c2..7e35015 100644
--- a/ps3/src/main/java/com/example/ps3/models/IapAccountSplit.kt
+++ b/p3/src/main/java/com/example/p3/models/IapAccountSplit.kt
@@ -1,4 +1,4 @@
-package com.example.ps3.models
+package com.example.p3.models
data class IapAccountSplit(
val index: Int,
diff --git a/p3/src/main/res/font/font.ttf b/p3/src/main/res/font/font.ttf
new file mode 100644
index 0000000..cc9d9b4
Binary files /dev/null and b/p3/src/main/res/font/font.ttf differ
diff --git a/ps3/src/test/java/com/example/ps3/ExampleUnitTest.kt b/p3/src/test/java/com/example/p3/ExampleUnitTest.kt
similarity index 92%
rename from ps3/src/test/java/com/example/ps3/ExampleUnitTest.kt
rename to p3/src/test/java/com/example/p3/ExampleUnitTest.kt
index c349d7a..84c5d00 100644
--- a/ps3/src/test/java/com/example/ps3/ExampleUnitTest.kt
+++ b/p3/src/test/java/com/example/p3/ExampleUnitTest.kt
@@ -1,4 +1,4 @@
-package com.example.ps3
+package com.example.p3
import org.junit.Test
diff --git a/ps4/src/main/java/com/example/ps4/P3Printer.kt b/ps4/src/main/java/com/example/ps4/P3Printer.kt
new file mode 100644
index 0000000..ac5e62c
--- /dev/null
+++ b/ps4/src/main/java/com/example/ps4/P3Printer.kt
@@ -0,0 +1,20 @@
+package com.example.ps4
+
+import android.content.Context
+import androidx.annotation.DrawableRes
+import com.example.core.domain.Printer
+import com.example.core.model.PrintEntity
+import javax.inject.Inject
+
+
+class P4Printer @Inject constructor(
+ private val context: Context,
+) : Printer {
+
+
+ override fun print(
+ printEntities: List,
+ @DrawableRes icon: Int
+ ) {
+ }
+}
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 2377c81..0a83031 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -24,8 +24,9 @@ dependencyResolutionManagement {
rootProject.name = "PSP"
include(":app")
-include(":tis_sep")
-include(":ps3")
+include(":tis_app")
+include(":p3")
include(":ps4")
include(":core")
include(":design_system")
+include(":stage_app")
diff --git a/tis_sep/.gitignore b/stage_app/.gitignore
similarity index 100%
rename from tis_sep/.gitignore
rename to stage_app/.gitignore
diff --git a/stage_app/build.gradle.kts b/stage_app/build.gradle.kts
new file mode 100644
index 0000000..e349cde
--- /dev/null
+++ b/stage_app/build.gradle.kts
@@ -0,0 +1,85 @@
+plugins {
+ alias(libs.plugins.android.application)
+ alias(libs.plugins.kotlin.compose)
+ alias(libs.plugins.ksp)
+ alias(libs.plugins.hilt)}
+
+android {
+ namespace = "com.example.stage_app"
+ compileSdk {
+ version = release(36) {
+ minorApiLevel = 1
+ }
+ }
+
+ defaultConfig {
+ 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") {
+ dimension = "module"
+ }
+ create("ps4") {
+ dimension = "module"
+ }
+ create("standard") {
+ dimension = "module"
+ }
+ }
+
+ buildTypes {
+ release {
+ isMinifyEnabled = false
+ proguardFiles(
+ getDefaultProguardFile("proguard-android-optimize.txt"),
+ "proguard-rules.pro"
+ )
+ }
+ }
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_11
+ targetCompatibility = JavaVersion.VERSION_11
+ }
+
+ buildFeatures {
+ compose = true
+ buildConfig = true
+ }
+
+}
+
+dependencies {
+ implementation(project(":core"))
+ implementation(project(":design_system"))
+ "p3Implementation"(project(":p3"))
+
+ "ps4Implementation"(project(":ps4"))
+
+ implementation(libs.hilt.android)
+ ksp(libs.hilt.compiler)
+
+ implementation(platform(libs.androidx.compose.bom))
+ implementation(libs.androidx.activity.compose)
+ implementation(libs.androidx.compose.material3)
+ implementation(libs.androidx.compose.ui)
+ implementation(libs.androidx.compose.ui.graphics)
+ implementation(libs.androidx.compose.ui.tooling.preview)
+ implementation(libs.androidx.core.ktx)
+ implementation(libs.androidx.lifecycle.runtime.ktx)
+ implementation("androidx.hilt:hilt-navigation-compose:1.2.0")
+ testImplementation(libs.junit)
+ androidTestImplementation(platform(libs.androidx.compose.bom))
+ androidTestImplementation(libs.androidx.compose.ui.test.junit4)
+ androidTestImplementation(libs.androidx.espresso.core)
+ androidTestImplementation(libs.androidx.junit)
+ debugImplementation(libs.androidx.compose.ui.test.manifest)
+ debugImplementation(libs.androidx.compose.ui.tooling)
+}
\ No newline at end of file
diff --git a/tis_sep/proguard-rules.pro b/stage_app/proguard-rules.pro
similarity index 100%
rename from tis_sep/proguard-rules.pro
rename to stage_app/proguard-rules.pro
diff --git a/stage_app/src/androidTest/java/com/example/stage_app/ExampleInstrumentedTest.kt b/stage_app/src/androidTest/java/com/example/stage_app/ExampleInstrumentedTest.kt
new file mode 100644
index 0000000..ad48136
--- /dev/null
+++ b/stage_app/src/androidTest/java/com/example/stage_app/ExampleInstrumentedTest.kt
@@ -0,0 +1,24 @@
+package com.example.stage_app
+
+import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.ext.junit.runners.AndroidJUnit4
+
+import org.junit.Test
+import org.junit.runner.RunWith
+
+import org.junit.Assert.*
+
+/**
+ * Instrumented test, which will execute on an Android device.
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+@RunWith(AndroidJUnit4::class)
+class ExampleInstrumentedTest {
+ @Test
+ fun useAppContext() {
+ // Context of the app under test.
+ val appContext = InstrumentationRegistry.getInstrumentation().targetContext
+ assertEquals("com.example.stage_app", appContext.packageName)
+ }
+}
\ No newline at end of file
diff --git a/stage_app/src/main/AndroidManifest.xml b/stage_app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..3128154
--- /dev/null
+++ b/stage_app/src/main/AndroidManifest.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/stage_app/src/main/java/com/example/stage_app/PspApplication.kt b/stage_app/src/main/java/com/example/stage_app/PspApplication.kt
new file mode 100644
index 0000000..53210e2
--- /dev/null
+++ b/stage_app/src/main/java/com/example/stage_app/PspApplication.kt
@@ -0,0 +1,7 @@
+package com.example.stage_app
+
+import android.app.Application
+import dagger.hilt.android.HiltAndroidApp
+
+@HiltAndroidApp
+class PspApplication : Application()
diff --git a/stage_app/src/main/java/com/example/stage_app/StageMainActivity.kt b/stage_app/src/main/java/com/example/stage_app/StageMainActivity.kt
new file mode 100644
index 0000000..8219082
--- /dev/null
+++ b/stage_app/src/main/java/com/example/stage_app/StageMainActivity.kt
@@ -0,0 +1,69 @@
+package com.example.stage_app
+
+import android.os.Bundle
+import androidx.activity.ComponentActivity
+import androidx.activity.compose.setContent
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material3.Scaffold
+import androidx.compose.material3.SnackbarHost
+import androidx.compose.material3.SnackbarHostState
+import androidx.compose.material3.SnackbarResult
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.rememberCoroutineScope
+import androidx.compose.ui.Modifier
+import com.example.design_system.theme.tis.TisTheme
+import com.example.design_system.util.ObserveAsEvents
+import com.example.design_system.util.snackbar.SnackbarController
+import com.example.stage_app.screen.StageWebViewScreen
+import dagger.hilt.android.AndroidEntryPoint
+import kotlinx.coroutines.launch
+
+@AndroidEntryPoint
+class StageMainActivity : ComponentActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContent {
+ TisTheme {
+
+ val scope = rememberCoroutineScope()
+ val snackbarHostState = remember {
+ SnackbarHostState()
+ }
+ ObserveAsEvents(
+ flow = SnackbarController.events,
+ snackbarHostState
+ ) { event ->
+ scope.launch {
+ snackbarHostState.currentSnackbarData?.dismiss()
+ val result = snackbarHostState.showSnackbar(
+ message = event.message,
+ actionLabel = event.action?.name,
+ duration = event.duration
+ )
+
+ if (result == SnackbarResult.ActionPerformed) {
+ event.action?.action?.invoke()
+ }
+ }
+ }
+
+ Scaffold(
+ snackbarHost = {
+ SnackbarHost(
+ hostState = snackbarHostState
+ )
+ }
+ ) { paddingValues ->
+
+
+ StageWebViewScreen(
+ modifier = Modifier
+ .fillMaxSize()
+ .padding(paddingValues)
+ )
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/stage_app/src/main/java/com/example/stage_app/screen/StageWebViewScreen.kt b/stage_app/src/main/java/com/example/stage_app/screen/StageWebViewScreen.kt
new file mode 100644
index 0000000..cd9602f
--- /dev/null
+++ b/stage_app/src/main/java/com/example/stage_app/screen/StageWebViewScreen.kt
@@ -0,0 +1,73 @@
+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
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.saveable.rememberSaveable
+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.design_system.PspWebView
+import com.example.stage_app.viewmodel.StageViewModel
+
+private const val tisIp = "192.168.128.73:5000"
+
+@Composable
+fun StageWebViewScreen(
+ modifier: Modifier = Modifier,
+ viewModel: StageViewModel = hiltViewModel()
+) {
+
+ val context = LocalContext.current
+ var webView: WebView? by remember { mutableStateOf(null) }
+ var currentPaymentId by rememberSaveable { mutableStateOf(null) }
+
+ // launcher to handle POS app result
+ val posLauncher = rememberLauncherForActivityResult(
+ contract = ActivityResultContracts.StartActivityForResult()
+ ) { result ->
+ val paymentResultEntity = viewModel.paymentResult(
+ id = currentPaymentId,
+ activityResult = result
+
+ )
+ webView?.post {
+ webView?.evaluateJavascript(
+ viewModel.postPaymentResult(paymentResultEntity = paymentResultEntity),
+ null
+ )
+ }
+
+ }
+
+ PspWebView(
+ url = tisIp,
+ webView = webView,
+ modifier = modifier,
+ onWebView = { updatedWebView -> webView = updatedWebView },
+ onPayClick = { amount: Long, id: String? ->
+ currentPaymentId = id
+ viewModel.pay(amount)
+ .also(posLauncher::launch)
+ },
+ onPrintClick = { printEntities ->
+ viewModel.print(printEntities)
+
+ },
+ onUUID = {
+ val androidId = Settings
+ .Secure
+ .getString(context.contentResolver, Settings.Secure.ANDROID_ID)
+
+ viewModel.sendAndroidId(
+ androidId
+ )
+ }
+ )
+}
\ No newline at end of file
diff --git a/stage_app/src/main/java/com/example/stage_app/viewmodel/StageViewModel.kt b/stage_app/src/main/java/com/example/stage_app/viewmodel/StageViewModel.kt
new file mode 100644
index 0000000..45d5a4d
--- /dev/null
+++ b/stage_app/src/main/java/com/example/stage_app/viewmodel/StageViewModel.kt
@@ -0,0 +1,72 @@
+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.PaymentResultEntity
+import com.example.core.model.PrintEntity
+import dagger.hilt.android.lifecycle.HiltViewModel
+import javax.inject.Inject
+
+@HiltViewModel
+class StageViewModel @Inject constructor(
+ private val pspService: PspService,
+ private val paymentResult: PaymentResult,
+ private val printer: Printer,
+ private val appConfig: AppConfig
+) : ViewModel() {
+
+
+ fun postPaymentResult(paymentResultEntity: PaymentResultEntity?): String {
+ return paymentResult.post(paymentResultEntity)
+ }
+
+ fun pay(amount: Long): Intent = pspService.pay(amount)
+
+ fun paymentResult(
+ id: String?,
+ activityResult: ActivityResult
+ ): PaymentResultEntity? {
+ return pspService.decodePosResponse(
+ id = id,
+ activityResult = activityResult
+ )
+ }
+
+ private val mock = listOf(
+
+ PrintEntity(
+ title = "اطلاعات مشتری",
+ items = listOf(
+ PrintEntity.ItemEntity("نام مشتری", "علی رضایی"),
+ PrintEntity.ItemEntity("شماره تماس", "09123456789"),
+ PrintEntity.ItemEntity("آدرس", "تهران، خیابان ولیعصر، پلاک ۱۲۳")
+ ),
+ type = PrintEntity.Type.CARD
+ ),
+ PrintEntity(
+ title = "اطلاعات پرداخت",
+ items = listOf(
+ PrintEntity.ItemEntity("روش پرداخت", "کارت به کارت"),
+ PrintEntity.ItemEntity("شماره پیگیری", "7845129630"),
+ PrintEntity.ItemEntity("تاریخ", "1405/02/14")
+ ),
+ type = PrintEntity.Type.CARD
+ ),
+ )
+
+ fun print(printEntities: List) {
+ printer.print(
+ printEntities = printEntities,
+ icon = android.R.drawable.btn_star
+ )
+ }
+
+ fun sendAndroidId(id: String) {
+ appConfig.androidId(id)
+ }
+}
diff --git a/stage_app/src/main/res/drawable/ic_launcher_background.xml b/stage_app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..07d5da9
--- /dev/null
+++ b/stage_app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/stage_app/src/main/res/drawable/ic_launcher_foreground.xml b/stage_app/src/main/res/drawable/ic_launcher_foreground.xml
new file mode 100644
index 0000000..2b068d1
--- /dev/null
+++ b/stage_app/src/main/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/stage_app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/stage_app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 0000000..6f3b755
--- /dev/null
+++ b/stage_app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/stage_app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/stage_app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
new file mode 100644
index 0000000..6f3b755
--- /dev/null
+++ b/stage_app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/stage_app/src/main/res/mipmap-hdpi/ic_launcher.webp b/stage_app/src/main/res/mipmap-hdpi/ic_launcher.webp
new file mode 100644
index 0000000..c209e78
Binary files /dev/null and b/stage_app/src/main/res/mipmap-hdpi/ic_launcher.webp differ
diff --git a/stage_app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/stage_app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..b2dfe3d
Binary files /dev/null and b/stage_app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ
diff --git a/stage_app/src/main/res/mipmap-mdpi/ic_launcher.webp b/stage_app/src/main/res/mipmap-mdpi/ic_launcher.webp
new file mode 100644
index 0000000..4f0f1d6
Binary files /dev/null and b/stage_app/src/main/res/mipmap-mdpi/ic_launcher.webp differ
diff --git a/stage_app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/stage_app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..62b611d
Binary files /dev/null and b/stage_app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ
diff --git a/stage_app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/stage_app/src/main/res/mipmap-xhdpi/ic_launcher.webp
new file mode 100644
index 0000000..948a307
Binary files /dev/null and b/stage_app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ
diff --git a/stage_app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/stage_app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..1b9a695
Binary files /dev/null and b/stage_app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ
diff --git a/stage_app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/stage_app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
new file mode 100644
index 0000000..28d4b77
Binary files /dev/null and b/stage_app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ
diff --git a/stage_app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/stage_app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..9287f50
Binary files /dev/null and b/stage_app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ
diff --git a/stage_app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/stage_app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
new file mode 100644
index 0000000..aa7d642
Binary files /dev/null and b/stage_app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ
diff --git a/stage_app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/stage_app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..9126ae3
Binary files /dev/null and b/stage_app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ
diff --git a/stage_app/src/main/res/values-night/themes.xml b/stage_app/src/main/res/values-night/themes.xml
new file mode 100644
index 0000000..799e20a
--- /dev/null
+++ b/stage_app/src/main/res/values-night/themes.xml
@@ -0,0 +1,16 @@
+
+
+
+
\ No newline at end of file
diff --git a/tis_sep/src/main/res/values/colors.xml b/stage_app/src/main/res/values/colors.xml
similarity index 100%
rename from tis_sep/src/main/res/values/colors.xml
rename to stage_app/src/main/res/values/colors.xml
diff --git a/stage_app/src/main/res/values/strings.xml b/stage_app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..57b5c0a
--- /dev/null
+++ b/stage_app/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ stage_app
+
\ No newline at end of file
diff --git a/stage_app/src/main/res/values/themes.xml b/stage_app/src/main/res/values/themes.xml
new file mode 100644
index 0000000..fe6d297
--- /dev/null
+++ b/stage_app/src/main/res/values/themes.xml
@@ -0,0 +1,16 @@
+
+
+
+
\ No newline at end of file
diff --git a/stage_app/src/p3/java/com/example/tis_app/di/PspModule.kt b/stage_app/src/p3/java/com/example/tis_app/di/PspModule.kt
new file mode 100644
index 0000000..8d208f7
--- /dev/null
+++ b/stage_app/src/p3/java/com/example/tis_app/di/PspModule.kt
@@ -0,0 +1,20 @@
+package com.example.tis_app.di
+
+import com.example.core.domain.Printer
+import com.example.core.domain.PspService
+import com.example.p3.P3Printer
+import com.example.p3.P3Service
+import dagger.Binds
+import dagger.Module
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+
+@Module
+@InstallIn(SingletonComponent::class)
+abstract class PspModule {
+ @Binds
+ abstract fun bindPspService(impl: P3Service): PspService
+
+ @Binds
+ abstract fun bindPrinter(impl: P3Printer): Printer
+}
diff --git a/tis_sep/src/ps4/java/com/example/tis_sep/di/PspModule.kt b/stage_app/src/ps4/java/com/example/tis_sep/di/PspModule.kt
similarity index 78%
rename from tis_sep/src/ps4/java/com/example/tis_sep/di/PspModule.kt
rename to stage_app/src/ps4/java/com/example/tis_sep/di/PspModule.kt
index 985a412..eece775 100644
--- a/tis_sep/src/ps4/java/com/example/tis_sep/di/PspModule.kt
+++ b/stage_app/src/ps4/java/com/example/tis_sep/di/PspModule.kt
@@ -2,6 +2,7 @@ package com.example.tis_sep.di
import com.example.core.PspService
import com.example.ps4.Ps4Service
+import com.example.ps4.P4Printer
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
@@ -12,4 +13,8 @@ import dagger.hilt.components.SingletonComponent
abstract class PspModule {
@Binds
abstract fun bindPspService(impl: Ps4Service): PspService
+
+ @Binds
+ abstract fun bindPrinter(impl: P4Printer): Printer
+
}
diff --git a/tis_sep/src/standard/java/com/example/tis_sep/di/PspModule.kt b/stage_app/src/standard/java/com/example/tis_sep/di/PspModule.kt
similarity index 100%
rename from tis_sep/src/standard/java/com/example/tis_sep/di/PspModule.kt
rename to stage_app/src/standard/java/com/example/tis_sep/di/PspModule.kt
diff --git a/stage_app/src/test/java/com/example/stage_app/ExampleUnitTest.kt b/stage_app/src/test/java/com/example/stage_app/ExampleUnitTest.kt
new file mode 100644
index 0000000..bb8e00f
--- /dev/null
+++ b/stage_app/src/test/java/com/example/stage_app/ExampleUnitTest.kt
@@ -0,0 +1,17 @@
+package com.example.stage_app
+
+import org.junit.Test
+
+import org.junit.Assert.*
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+class ExampleUnitTest {
+ @Test
+ fun addition_isCorrect() {
+ assertEquals(4, 2 + 2)
+ }
+}
\ No newline at end of file
diff --git a/tis_app/.gitignore b/tis_app/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/tis_app/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/tis_sep/build.gradle.kts b/tis_app/build.gradle.kts
similarity index 85%
rename from tis_sep/build.gradle.kts
rename to tis_app/build.gradle.kts
index 1b7bcd8..03c343a 100644
--- a/tis_sep/build.gradle.kts
+++ b/tis_app/build.gradle.kts
@@ -6,7 +6,7 @@ plugins {
}
android {
- namespace = "com.example.tis_sep"
+ namespace = "com.example.tis_app"
compileSdk {
version = release(36) {
minorApiLevel = 1
@@ -14,7 +14,7 @@ android {
}
defaultConfig {
- applicationId = "com.example.tis_sep"
+ applicationId = "com.example.tis_app"
minSdk = 24
targetSdk = 36
versionCode = 1
@@ -25,7 +25,7 @@ android {
flavorDimensions.add("module")
productFlavors {
- create("ps3") {
+ create("p3") {
dimension = "module"
}
create("ps4") {
@@ -58,11 +58,7 @@ android {
dependencies {
implementation(project(":core"))
implementation(project(":design_system"))
- "ps3Implementation"(project(":ps3"))
- "ps3CompileOnly"(files("../ps3/libs/platform_sdk_v2.3.706.jar"))
-
- // Provide the library for compilation only in the ps3 flavor
-// "ps3CompileOnly"(files("${rootProject.projectDir}/external_sdks/platform_sdk_v2.3.706.jar"))
+ "p3Implementation"(project(":p3"))
"ps4Implementation"(project(":ps4"))
diff --git a/tis_app/proguard-rules.pro b/tis_app/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/tis_app/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/tis_sep/ps3/release/baselineProfiles/0/tis_sep-ps3-release.dm b/tis_app/ps3/release/baselineProfiles/0/tis_sep-ps3-release.dm
similarity index 100%
rename from tis_sep/ps3/release/baselineProfiles/0/tis_sep-ps3-release.dm
rename to tis_app/ps3/release/baselineProfiles/0/tis_sep-ps3-release.dm
diff --git a/tis_sep/ps3/release/baselineProfiles/1/tis_sep-ps3-release.dm b/tis_app/ps3/release/baselineProfiles/1/tis_sep-ps3-release.dm
similarity index 100%
rename from tis_sep/ps3/release/baselineProfiles/1/tis_sep-ps3-release.dm
rename to tis_app/ps3/release/baselineProfiles/1/tis_sep-ps3-release.dm
diff --git a/tis_sep/ps3/release/output-metadata.json b/tis_app/ps3/release/output-metadata.json
similarity index 100%
rename from tis_sep/ps3/release/output-metadata.json
rename to tis_app/ps3/release/output-metadata.json
diff --git a/tis_sep/ps3/release/tis_sep-ps3-release.apk b/tis_app/ps3/release/tis_sep-ps3-release.apk
similarity index 100%
rename from tis_sep/ps3/release/tis_sep-ps3-release.apk
rename to tis_app/ps3/release/tis_sep-ps3-release.apk
diff --git a/tis_sep/ps4/release/baselineProfiles/0/tis_sep-ps4-release.dm b/tis_app/ps4/release/baselineProfiles/0/tis_sep-ps4-release.dm
similarity index 100%
rename from tis_sep/ps4/release/baselineProfiles/0/tis_sep-ps4-release.dm
rename to tis_app/ps4/release/baselineProfiles/0/tis_sep-ps4-release.dm
diff --git a/tis_sep/ps4/release/baselineProfiles/1/tis_sep-ps4-release.dm b/tis_app/ps4/release/baselineProfiles/1/tis_sep-ps4-release.dm
similarity index 100%
rename from tis_sep/ps4/release/baselineProfiles/1/tis_sep-ps4-release.dm
rename to tis_app/ps4/release/baselineProfiles/1/tis_sep-ps4-release.dm
diff --git a/tis_sep/ps4/release/output-metadata.json b/tis_app/ps4/release/output-metadata.json
similarity index 100%
rename from tis_sep/ps4/release/output-metadata.json
rename to tis_app/ps4/release/output-metadata.json
diff --git a/tis_sep/ps4/release/tis_sep-ps4-release.apk b/tis_app/ps4/release/tis_sep-ps4-release.apk
similarity index 100%
rename from tis_sep/ps4/release/tis_sep-ps4-release.apk
rename to tis_app/ps4/release/tis_sep-ps4-release.apk
diff --git a/tis_sep/src/androidTest/java/com/example/tis_sep/ExampleInstrumentedTest.kt b/tis_app/src/androidTest/java/com/example/tis_app/ExampleInstrumentedTest.kt
similarity index 95%
rename from tis_sep/src/androidTest/java/com/example/tis_sep/ExampleInstrumentedTest.kt
rename to tis_app/src/androidTest/java/com/example/tis_app/ExampleInstrumentedTest.kt
index fde7b4a..779146c 100644
--- a/tis_sep/src/androidTest/java/com/example/tis_sep/ExampleInstrumentedTest.kt
+++ b/tis_app/src/androidTest/java/com/example/tis_app/ExampleInstrumentedTest.kt
@@ -1,4 +1,4 @@
-package com.example.tis_sep
+package com.example.tis_app
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
diff --git a/tis_sep/src/main/AndroidManifest.xml b/tis_app/src/main/AndroidManifest.xml
similarity index 100%
rename from tis_sep/src/main/AndroidManifest.xml
rename to tis_app/src/main/AndroidManifest.xml
diff --git a/tis_app/src/main/ic_launcher-playstore.png b/tis_app/src/main/ic_launcher-playstore.png
new file mode 100644
index 0000000..f34430f
Binary files /dev/null and b/tis_app/src/main/ic_launcher-playstore.png differ
diff --git a/tis_sep/src/main/java/com/example/tis_sep/PspApplication.kt b/tis_app/src/main/java/com/example/tis_app/PspApplication.kt
similarity index 82%
rename from tis_sep/src/main/java/com/example/tis_sep/PspApplication.kt
rename to tis_app/src/main/java/com/example/tis_app/PspApplication.kt
index 8c0814b..9a8bcc2 100644
--- a/tis_sep/src/main/java/com/example/tis_sep/PspApplication.kt
+++ b/tis_app/src/main/java/com/example/tis_app/PspApplication.kt
@@ -1,4 +1,4 @@
-package com.example.tis_sep
+package com.example.tis_app
import android.app.Application
import dagger.hilt.android.HiltAndroidApp
diff --git a/tis_sep/src/main/java/com/example/tis_sep/TisMainActivity.kt b/tis_app/src/main/java/com/example/tis_app/TisMainActivity.kt
similarity index 96%
rename from tis_sep/src/main/java/com/example/tis_sep/TisMainActivity.kt
rename to tis_app/src/main/java/com/example/tis_app/TisMainActivity.kt
index 7079d3d..e419cb4 100644
--- a/tis_sep/src/main/java/com/example/tis_sep/TisMainActivity.kt
+++ b/tis_app/src/main/java/com/example/tis_app/TisMainActivity.kt
@@ -1,4 +1,4 @@
-package com.example.tis_sep
+package com.example.tis_app
import android.os.Bundle
import androidx.activity.ComponentActivity
@@ -15,7 +15,7 @@ import androidx.compose.ui.Modifier
import com.example.design_system.theme.tis.TisTheme
import com.example.design_system.util.ObserveAsEvents
import com.example.design_system.util.snackbar.SnackbarController
-import com.example.tis_sep.screen.TisWebViewScreen
+import com.example.tis_app.screen.TisWebViewScreen
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
@@ -55,6 +55,8 @@ class TisMainActivity : ComponentActivity() {
)
}
) { paddingValues ->
+
+
TisWebViewScreen(
modifier = Modifier
.fillMaxSize()
diff --git a/tis_sep/src/main/java/com/example/tis_sep/screen/TisWebViewScreen.kt b/tis_app/src/main/java/com/example/tis_app/screen/TisWebViewScreen.kt
similarity index 73%
rename from tis_sep/src/main/java/com/example/tis_sep/screen/TisWebViewScreen.kt
rename to tis_app/src/main/java/com/example/tis_app/screen/TisWebViewScreen.kt
index d04c21a..f7cff35 100644
--- a/tis_sep/src/main/java/com/example/tis_sep/screen/TisWebViewScreen.kt
+++ b/tis_app/src/main/java/com/example/tis_app/screen/TisWebViewScreen.kt
@@ -1,5 +1,6 @@
-package com.example.tis_sep.screen
+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
@@ -10,16 +11,18 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
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.design_system.PspWebView
-import com.example.tis_sep.viewmodel.WebViewModel
-
+import com.example.tis_app.viewmodel.WebViewModel
+private const val tisIp = "194.59.214.243:8090"
@Composable
fun TisWebViewScreen(
modifier: Modifier = Modifier,
viewModel: WebViewModel = hiltViewModel()
) {
+ val context = LocalContext.current
var webView: WebView? by remember { mutableStateOf(null) }
var currentPaymentId by rememberSaveable { mutableStateOf(null) }
@@ -42,7 +45,7 @@ fun TisWebViewScreen(
}
PspWebView(
- url = "192.168.128.73:5000",
+ url = tisIp,
webView = webView,
modifier = modifier,
onWebView = { updatedWebView -> webView = updatedWebView },
@@ -51,6 +54,18 @@ fun TisWebViewScreen(
viewModel.pay(amount)
.also(posLauncher::launch)
},
- onPrintClick = {},
+ onPrintClick = { printEntities ->
+ viewModel.print(printEntities)
+
+ },
+ onUUID = {
+ val androidId = Settings
+ .Secure
+ .getString(context.contentResolver, Settings.Secure.ANDROID_ID)
+
+ viewModel.sendAndroidId(
+ androidId
+ )
+ }
)
}
\ No newline at end of file
diff --git a/tis_sep/src/main/java/com/example/tis_sep/viewmodel/WebViewModel.kt b/tis_app/src/main/java/com/example/tis_app/viewmodel/WebViewModel.kt
similarity index 61%
rename from tis_sep/src/main/java/com/example/tis_sep/viewmodel/WebViewModel.kt
rename to tis_app/src/main/java/com/example/tis_app/viewmodel/WebViewModel.kt
index 9324f2b..4cb37df 100644
--- a/tis_sep/src/main/java/com/example/tis_sep/viewmodel/WebViewModel.kt
+++ b/tis_app/src/main/java/com/example/tis_app/viewmodel/WebViewModel.kt
@@ -1,18 +1,24 @@
-package com.example.tis_sep.viewmodel
+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.PaymentResultEntity
+import com.example.core.model.PrintEntity
+import com.example.tis_app.R
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
@HiltViewModel
class WebViewModel @Inject constructor(
private val pspService: PspService,
- private val paymentResult: PaymentResult
+ private val paymentResult: PaymentResult,
+ private val printer: Printer,
+ private val appConfig: AppConfig
) : ViewModel() {
@@ -31,4 +37,14 @@ class WebViewModel @Inject constructor(
activityResult = activityResult
)
}
+ fun print(printEntities : List) {
+ printer.print(
+ printEntities = printEntities,
+ icon = R.drawable.tis_icon
+ )
+ }
+
+ fun sendAndroidId(id : String) {
+ appConfig.androidId(id)
+ }
}
diff --git a/tis_app/src/main/res/drawable/ic_android_black_24dp.xml b/tis_app/src/main/res/drawable/ic_android_black_24dp.xml
new file mode 100644
index 0000000..74d650a
--- /dev/null
+++ b/tis_app/src/main/res/drawable/ic_android_black_24dp.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
diff --git a/tis_app/src/main/res/drawable/ic_launcher_background.xml b/tis_app/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..5e1d762
--- /dev/null
+++ b/tis_app/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tis_app/src/main/res/drawable/tis_icon.xml b/tis_app/src/main/res/drawable/tis_icon.xml
new file mode 100644
index 0000000..d6b19e9
--- /dev/null
+++ b/tis_app/src/main/res/drawable/tis_icon.xml
@@ -0,0 +1,144 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tis_app/src/main/res/font/font.ttf b/tis_app/src/main/res/font/font.ttf
new file mode 100644
index 0000000..cc9d9b4
Binary files /dev/null and b/tis_app/src/main/res/font/font.ttf differ
diff --git a/tis_sep/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/tis_app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
similarity index 100%
rename from tis_sep/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
rename to tis_app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
diff --git a/tis_sep/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/tis_app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
similarity index 100%
rename from tis_sep/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
rename to tis_app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
diff --git a/tis_app/src/main/res/mipmap-hdpi/ic_launcher.webp b/tis_app/src/main/res/mipmap-hdpi/ic_launcher.webp
new file mode 100644
index 0000000..801644c
Binary files /dev/null and b/tis_app/src/main/res/mipmap-hdpi/ic_launcher.webp differ
diff --git a/tis_app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp b/tis_app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp
new file mode 100644
index 0000000..0fea5b6
Binary files /dev/null and b/tis_app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp differ
diff --git a/tis_app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/tis_app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..eb2c002
Binary files /dev/null and b/tis_app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ
diff --git a/tis_app/src/main/res/mipmap-mdpi/ic_launcher.webp b/tis_app/src/main/res/mipmap-mdpi/ic_launcher.webp
new file mode 100644
index 0000000..ff6f774
Binary files /dev/null and b/tis_app/src/main/res/mipmap-mdpi/ic_launcher.webp differ
diff --git a/tis_app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp b/tis_app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp
new file mode 100644
index 0000000..1d697e5
Binary files /dev/null and b/tis_app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp differ
diff --git a/tis_app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/tis_app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..32d9015
Binary files /dev/null and b/tis_app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ
diff --git a/tis_app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/tis_app/src/main/res/mipmap-xhdpi/ic_launcher.webp
new file mode 100644
index 0000000..ce0d59e
Binary files /dev/null and b/tis_app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ
diff --git a/tis_app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp b/tis_app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp
new file mode 100644
index 0000000..bf562d8
Binary files /dev/null and b/tis_app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp differ
diff --git a/tis_app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/tis_app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..38ae500
Binary files /dev/null and b/tis_app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ
diff --git a/tis_app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/tis_app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
new file mode 100644
index 0000000..852ab92
Binary files /dev/null and b/tis_app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ
diff --git a/tis_app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp b/tis_app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp
new file mode 100644
index 0000000..c0988ee
Binary files /dev/null and b/tis_app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp differ
diff --git a/tis_app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/tis_app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..f3297d2
Binary files /dev/null and b/tis_app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ
diff --git a/tis_app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/tis_app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
new file mode 100644
index 0000000..deec89f
Binary files /dev/null and b/tis_app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ
diff --git a/tis_app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp b/tis_app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp
new file mode 100644
index 0000000..e6816d1
Binary files /dev/null and b/tis_app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp differ
diff --git a/tis_app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/tis_app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..89b2f4f
Binary files /dev/null and b/tis_app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ
diff --git a/tis_app/src/main/res/values/colors.xml b/tis_app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..f8c6127
--- /dev/null
+++ b/tis_app/src/main/res/values/colors.xml
@@ -0,0 +1,10 @@
+
+
+ #FFBB86FC
+ #FF6200EE
+ #FF3700B3
+ #FF03DAC5
+ #FF018786
+ #FF000000
+ #FFFFFFFF
+
\ No newline at end of file
diff --git a/tis_app/src/main/res/values/ic_launcher_background.xml b/tis_app/src/main/res/values/ic_launcher_background.xml
new file mode 100644
index 0000000..beab31f
--- /dev/null
+++ b/tis_app/src/main/res/values/ic_launcher_background.xml
@@ -0,0 +1,4 @@
+
+
+ #000000
+
\ No newline at end of file
diff --git a/tis_app/src/main/res/values/strings.xml b/tis_app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..01b6d8d
--- /dev/null
+++ b/tis_app/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ تیس
+
\ No newline at end of file
diff --git a/tis_sep/src/main/res/values/themes.xml b/tis_app/src/main/res/values/themes.xml
similarity index 100%
rename from tis_sep/src/main/res/values/themes.xml
rename to tis_app/src/main/res/values/themes.xml
diff --git a/tis_app/src/p3/java/com/example/tis_app/di/PspModule.kt b/tis_app/src/p3/java/com/example/tis_app/di/PspModule.kt
new file mode 100644
index 0000000..8d208f7
--- /dev/null
+++ b/tis_app/src/p3/java/com/example/tis_app/di/PspModule.kt
@@ -0,0 +1,20 @@
+package com.example.tis_app.di
+
+import com.example.core.domain.Printer
+import com.example.core.domain.PspService
+import com.example.p3.P3Printer
+import com.example.p3.P3Service
+import dagger.Binds
+import dagger.Module
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+
+@Module
+@InstallIn(SingletonComponent::class)
+abstract class PspModule {
+ @Binds
+ abstract fun bindPspService(impl: P3Service): PspService
+
+ @Binds
+ abstract fun bindPrinter(impl: P3Printer): Printer
+}
diff --git a/tis_sep/src/ps3/java/com/example/tis_sep/di/PspModule.kt b/tis_app/src/ps4/java/com/example/tis_sep/di/PspModule.kt
similarity index 50%
rename from tis_sep/src/ps3/java/com/example/tis_sep/di/PspModule.kt
rename to tis_app/src/ps4/java/com/example/tis_sep/di/PspModule.kt
index 0e103b1..eece775 100644
--- a/tis_sep/src/ps3/java/com/example/tis_sep/di/PspModule.kt
+++ b/tis_app/src/ps4/java/com/example/tis_sep/di/PspModule.kt
@@ -1,7 +1,8 @@
package com.example.tis_sep.di
-import com.example.core.domain.PspService
-import com.example.ps3.Ps3Service
+import com.example.core.PspService
+import com.example.ps4.Ps4Service
+import com.example.ps4.P4Printer
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
@@ -11,5 +12,9 @@ import dagger.hilt.components.SingletonComponent
@InstallIn(SingletonComponent::class)
abstract class PspModule {
@Binds
- abstract fun bindPspService(impl: Ps3Service): PspService
+ abstract fun bindPspService(impl: Ps4Service): PspService
+
+ @Binds
+ abstract fun bindPrinter(impl: P4Printer): Printer
+
}
diff --git a/tis_app/src/standard/java/com/example/tis_sep/di/PspModule.kt b/tis_app/src/standard/java/com/example/tis_sep/di/PspModule.kt
new file mode 100644
index 0000000..96ef61d
--- /dev/null
+++ b/tis_app/src/standard/java/com/example/tis_sep/di/PspModule.kt
@@ -0,0 +1,24 @@
+package com.example.tis_sep.di
+
+import android.content.Intent
+import com.example.core.PspService
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.InstallIn
+import dagger.hilt.components.SingletonComponent
+
+@Module
+@InstallIn(SingletonComponent::class)
+object PspModule {
+ @Provides
+ fun providePspService(): PspService = object : PspService {
+ override fun pay(amount: Double, onMessage: (String) -> Unit) {
+ onMessage("Standard: Payment not supported")
+ }
+ override fun print(text: String, onMessage: (String) -> Unit) {
+ onMessage("Standard: Printing not supported")
+ }
+ override fun createPurchaseIntent(amount: Long): Intent? = null
+ override fun decodePosResponse(response: String?): Map? = null
+ }
+}
diff --git a/tis_sep/src/test/java/com/example/tis_sep/ExampleUnitTest.kt b/tis_app/src/test/java/com/example/tis_app/ExampleUnitTest.kt
similarity index 91%
rename from tis_sep/src/test/java/com/example/tis_sep/ExampleUnitTest.kt
rename to tis_app/src/test/java/com/example/tis_app/ExampleUnitTest.kt
index 136dffe..1ce2954 100644
--- a/tis_sep/src/test/java/com/example/tis_sep/ExampleUnitTest.kt
+++ b/tis_app/src/test/java/com/example/tis_app/ExampleUnitTest.kt
@@ -1,4 +1,4 @@
-package com.example.tis_sep
+package com.example.tis_app
import org.junit.Test
diff --git a/tis_sep/src/main/ic_launcher-playstore.png b/tis_sep/src/main/ic_launcher-playstore.png
deleted file mode 100644
index 7e5d0c9..0000000
Binary files a/tis_sep/src/main/ic_launcher-playstore.png and /dev/null differ
diff --git a/tis_sep/src/main/res/drawable/ic_launcher_background.xml b/tis_sep/src/main/res/drawable/ic_launcher_background.xml
deleted file mode 100644
index ca3826a..0000000
--- a/tis_sep/src/main/res/drawable/ic_launcher_background.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tis_sep/src/main/res/mipmap-hdpi/ic_launcher.webp b/tis_sep/src/main/res/mipmap-hdpi/ic_launcher.webp
deleted file mode 100644
index 354649a..0000000
Binary files a/tis_sep/src/main/res/mipmap-hdpi/ic_launcher.webp and /dev/null differ
diff --git a/tis_sep/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp b/tis_sep/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp
deleted file mode 100644
index 63e2f0a..0000000
Binary files a/tis_sep/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp and /dev/null differ
diff --git a/tis_sep/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/tis_sep/src/main/res/mipmap-hdpi/ic_launcher_round.webp
deleted file mode 100644
index 4c93d79..0000000
Binary files a/tis_sep/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/tis_sep/src/main/res/mipmap-mdpi/ic_launcher.webp b/tis_sep/src/main/res/mipmap-mdpi/ic_launcher.webp
deleted file mode 100644
index e79b4a1..0000000
Binary files a/tis_sep/src/main/res/mipmap-mdpi/ic_launcher.webp and /dev/null differ
diff --git a/tis_sep/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp b/tis_sep/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp
deleted file mode 100644
index 42ccc19..0000000
Binary files a/tis_sep/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp and /dev/null differ
diff --git a/tis_sep/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/tis_sep/src/main/res/mipmap-mdpi/ic_launcher_round.webp
deleted file mode 100644
index 25cbdba..0000000
Binary files a/tis_sep/src/main/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/tis_sep/src/main/res/mipmap-xhdpi/ic_launcher.webp b/tis_sep/src/main/res/mipmap-xhdpi/ic_launcher.webp
deleted file mode 100644
index 43cfeea..0000000
Binary files a/tis_sep/src/main/res/mipmap-xhdpi/ic_launcher.webp and /dev/null differ
diff --git a/tis_sep/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp b/tis_sep/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp
deleted file mode 100644
index 2d2b3ba..0000000
Binary files a/tis_sep/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp and /dev/null differ
diff --git a/tis_sep/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/tis_sep/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
deleted file mode 100644
index c06f255..0000000
Binary files a/tis_sep/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/tis_sep/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/tis_sep/src/main/res/mipmap-xxhdpi/ic_launcher.webp
deleted file mode 100644
index e974f22..0000000
Binary files a/tis_sep/src/main/res/mipmap-xxhdpi/ic_launcher.webp and /dev/null differ
diff --git a/tis_sep/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp b/tis_sep/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp
deleted file mode 100644
index 77610ec..0000000
Binary files a/tis_sep/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp and /dev/null differ
diff --git a/tis_sep/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/tis_sep/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
deleted file mode 100644
index 68a802f..0000000
Binary files a/tis_sep/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/tis_sep/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/tis_sep/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
deleted file mode 100644
index 93eb1f8..0000000
Binary files a/tis_sep/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and /dev/null differ
diff --git a/tis_sep/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp b/tis_sep/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp
deleted file mode 100644
index 4e89be7..0000000
Binary files a/tis_sep/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp and /dev/null differ
diff --git a/tis_sep/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/tis_sep/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
deleted file mode 100644
index 3784a48..0000000
Binary files a/tis_sep/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/tis_sep/src/main/res/values/strings.xml b/tis_sep/src/main/res/values/strings.xml
deleted file mode 100644
index 2137564..0000000
--- a/tis_sep/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- Tis_Sep
-
\ No newline at end of file