feat: add payment
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user