feat: add payment

This commit is contained in:
2026-07-05 16:03:15 +03:30
parent c2356b3242
commit 5017e9a613
30 changed files with 470 additions and 65 deletions
+77 -1
View File
@@ -1,3 +1,6 @@
import java.io.FileInputStream
import java.util.Properties
plugins {
id("com.android.application")
id("kotlin-android")
@@ -23,7 +26,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "ir.hakemsho.hakemsho"
applicationId = "com.approagency.hakemirani"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
// flutter_secure_storage حداقل SDK 23 را لازم دارد.
@@ -31,14 +34,87 @@ android {
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
// مقادیرِ پیش‌فرض تا buildِ بدونِ flavor (مثلِ `flutter run`) هم merge شود؛
// flavorها این‌ها را override می‌کنند.
manifestPlaceholders += mapOf(
"marketApplicationId" to "com.farsitel.bazaar",
"marketBindAddress" to "com.farsitel.bazaar.InAppBillingService.BIND",
"marketPermission" to "com.farsitel.bazaar.permission.PAY_THROUGH_BAZAAR"
)
}
// یک flavor برای هر فروشگاه؛ هر کدام placeholderهای manifestِ افزونه‌ی
// پرداخت (myket_iap / flutter_poolakey) را پر می‌کند. STORE به‌صورتِ
// BuildConfig هم تزریق می‌شود تا سمتِ Dart بدونِ dart-define بداند کدام
// درگاه فعال است.
flavorDimensions += "store"
productFlavors {
create("myket") {
dimension = "store"
manifestPlaceholders += mapOf(
"marketApplicationId" to "ir.mservices.market",
"marketBindAddress" to "ir.mservices.market.InAppBillingService.BIND",
"marketPermission" to "ir.mservices.market.BILLING"
)
resValue("string", "iap_store", "myket")
}
create("bazaar") {
dimension = "store"
manifestPlaceholders += mapOf(
"marketApplicationId" to "com.farsitel.bazaar",
"marketBindAddress" to "com.farsitel.bazaar.InAppBillingService.BIND",
"marketPermission" to "com.farsitel.bazaar.permission.PAY_THROUGH_BAZAAR"
)
resValue("string", "iap_store", "bazaar")
}
}
val keystoreProperties = Properties()
val keystorePropertiesFile = rootProject.file("key.properties")
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
}
signingConfigs {
create("release") {
keyAlias = keystoreProperties["keyAlias"] as String?
keyPassword = keystoreProperties["keyPassword"] as String?
storeFile = keystoreProperties["storeFile"]?.let {
file(it)
}
storePassword = keystoreProperties["storePassword"] as String?
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.getByName("debug")
getByName("release") {
signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
}
}
// هر دو افزونه‌ی پرداخت کلاسِ AIDLِ یکسانِ
// `com.android.vending.billing.IInAppBillingService` را در AARِ خود دارند؛ چون
// هر دو پکیجِ Dart همیشه در classpath هستند، هر flavor هر دو AAR را می‌کشد و
// «Duplicate class» می‌دهد. راه‌حل: از هر flavor فقط کتابخانه‌ی فروشگاهِ خودش را
// نگه می‌داریم و کتابخانه‌ی فروشگاهِ دیگر را حذف می‌کنیم (در آن flavor صدا زده
// نمی‌شود).
configurations.configureEach {
if (name.startsWith("myket")) {
exclude(group = "com.github.cafebazaar.Poolakey")
}
if (name.startsWith("bazaar")) {
exclude(group = "com.github.myketstore")
}
}
+13
View File
@@ -0,0 +1,13 @@
# هر flavor فقط کتابخانه‌ی پرداختِ فروشگاهِ خودش را دارد (کتابخانه‌ی فروشگاهِ
# دیگر در build.gradle.kts حذف شده تا «Duplicate class» رخ ندهد). در نتیجه،
# کلاسِ افزونه‌ی فروشگاهِ غایب به کلاس‌هایی ارجاع می‌دهد که در آن flavor نیستند؛
# چون در آن flavor صدا زده نمی‌شوند، به R8 می‌گوییم درباره‌شان هشدار ندهد.
-dontwarn ir.cafebazaar.poolakey.**
-dontwarn ir.myket.billingclient.**
# افزونه‌های پرداخت و کلاس‌های billing را دست‌نخورده نگه دار.
-keep class ir.cafebazaar.flutter_poolakey.** { *; }
-keep class ir.mservices.myketiap.** { *; }
-keep class ir.cafebazaar.poolakey.** { *; }
-keep class ir.myket.billingclient.** { *; }
-keep class com.android.vending.billing.** { *; }
+1 -1
View File
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:label="hakemsho"
android:label="حاکم ایرانی"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true">
Binary file not shown.

Before

Width:  |  Height:  |  Size: 544 B

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 721 B

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 87 KiB