Add billing module, provide a separate build for Google Play
This commit is contained in:
parent
fe18472d07
commit
582bd92d31
6 changed files with 69 additions and 12 deletions
18
client/android/billing/build.gradle.kts
Normal file
18
client/android/billing/build.gradle.kts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
plugins {
|
||||
id(libs.plugins.android.library.get().pluginId)
|
||||
id(libs.plugins.kotlin.android.get().pluginId)
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain(17)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "org.amnezia.vpn.billing"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(libs.androidx.core)
|
||||
implementation(libs.kotlinx.coroutines)
|
||||
implementation(libs.android.billing)
|
||||
}
|
||||
|
|
@ -42,17 +42,6 @@ android {
|
|||
resourceConfigurations += listOf("en", "ru", "b+zh+Hans")
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
getByName("main") {
|
||||
manifest.srcFile("AndroidManifest.xml")
|
||||
java.setSrcDirs(listOf("src"))
|
||||
res.setSrcDirs(listOf("res"))
|
||||
// androyddeployqt creates the folders below
|
||||
assets.setSrcDirs(listOf("assets"))
|
||||
jniLibs.setSrcDirs(listOf("libs"))
|
||||
}
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
register("release") {
|
||||
storeFile = providers.environmentVariable("ANDROID_KEYSTORE_PATH").orNull?.let { file(it) }
|
||||
|
|
@ -78,6 +67,36 @@ android {
|
|||
}
|
||||
}
|
||||
|
||||
flavorDimensions += "billing"
|
||||
|
||||
productFlavors {
|
||||
create("oss") {
|
||||
dimension = "billing"
|
||||
}
|
||||
create("play") {
|
||||
dimension = "billing"
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
getByName("main") {
|
||||
manifest.srcFile("AndroidManifest.xml")
|
||||
java.setSrcDirs(listOf("src"))
|
||||
res.setSrcDirs(listOf("res"))
|
||||
// androyddeployqt creates the folders below
|
||||
assets.setSrcDirs(listOf("assets"))
|
||||
jniLibs.setSrcDirs(listOf("libs"))
|
||||
}
|
||||
|
||||
getByName("oss") {
|
||||
java.setSrcDirs(listOf("oss"))
|
||||
}
|
||||
|
||||
getByName("play") {
|
||||
java.setSrcDirs(listOf("play"))
|
||||
}
|
||||
}
|
||||
|
||||
splits {
|
||||
abi {
|
||||
isEnable = true
|
||||
|
|
@ -123,5 +142,9 @@ dependencies {
|
|||
implementation(libs.google.mlkit)
|
||||
implementation(libs.androidx.datastore)
|
||||
implementation(libs.androidx.biometric)
|
||||
implementation(libs.android.billing)
|
||||
|
||||
playImplementation(project(":billing"))
|
||||
}
|
||||
|
||||
fun DependencyHandler.playImplementation(dependency: Any): Dependency? =
|
||||
add("playImplementation", dependency)
|
||||
|
|
|
|||
7
client/android/oss/org/amnezia/vpn/BillingProvider.kt
Normal file
7
client/android/oss/org/amnezia/vpn/BillingProvider.kt
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
package org.amnezia.vpn
|
||||
|
||||
class BillingProvider {
|
||||
fun type(): String {
|
||||
return "OSS"
|
||||
}
|
||||
}
|
||||
7
client/android/play/org/amnezia/vpn/BillingProvider.kt
Normal file
7
client/android/play/org/amnezia/vpn/BillingProvider.kt
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
package org.amnezia.vpn
|
||||
|
||||
class BillingProvider {
|
||||
fun type(): String {
|
||||
return "PLAY"
|
||||
}
|
||||
}
|
||||
|
|
@ -31,6 +31,7 @@ rootProject.buildFileName = "build.gradle.kts"
|
|||
|
||||
include(":qt")
|
||||
include(":utils")
|
||||
include(":billing")
|
||||
include(":protocolApi")
|
||||
include(":wireguard")
|
||||
include(":awg")
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ class AmneziaActivity : QtActivity() {
|
|||
* Activity overloaded methods
|
||||
*/
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
Log.d(TAG, "Billing provider: ${BillingProvider().type()}")
|
||||
super.onCreate(savedInstanceState)
|
||||
Log.d(TAG, "Create Amnezia activity: $intent")
|
||||
window.apply {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue