Skip to content

Commit

Permalink
Merge pull request #8153 from wmontwe/add-billing-module-for-tb-daily
Browse files Browse the repository at this point in the history
Add basic feature setup for funding and Google Play billing support
  • Loading branch information
wmontwe authored Sep 20, 2024
2 parents a5d7ee8 + e7e7520 commit 8798df3
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 0 deletions.
1 change: 1 addition & 0 deletions app-k9mail/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies {
implementation(projects.feature.widget.shortcut)
implementation(projects.feature.widget.unread)
implementation(projects.feature.telemetry.noop)
implementation(projects.feature.funding.noop)

implementation(libs.androidx.work.runtime)

Expand Down
2 changes: 2 additions & 0 deletions app-k9mail/src/main/kotlin/app/k9mail/K9KoinModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import app.k9mail.core.featureflag.FeatureFlagFactory
import app.k9mail.core.ui.theme.api.FeatureThemeProvider
import app.k9mail.core.ui.theme.api.ThemeProvider
import app.k9mail.dev.developmentModuleAdditions
import app.k9mail.feature.funding.featureFundingModule
import app.k9mail.feature.telemetry.telemetryModule
import app.k9mail.feature.widget.shortcut.LauncherShortcutActivity
import app.k9mail.featureflag.K9FeatureFlagFactory
Expand All @@ -26,6 +27,7 @@ import org.koin.dsl.module
val appModule = module {
includes(appWidgetModule)
includes(telemetryModule)
includes(featureFundingModule)

single(named("ClientInfoAppName")) { BuildConfig.CLIENT_INFO_APP_NAME }
single(named("ClientInfoAppVersion")) { BuildConfig.VERSION_NAME }
Expand Down
5 changes: 5 additions & 0 deletions app-thunderbird/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ dependencies {
debugImplementation(projects.backend.demo)
debugImplementation(projects.feature.autodiscovery.demo)

debugImplementation(projects.feature.funding.noop)
add("dailyImplementation", projects.feature.funding.googleplay)
add("betaImplementation", projects.feature.funding.noop)
releaseImplementation(projects.feature.funding.noop)

testImplementation(libs.robolectric)

// Required for DependencyInjectionTest to be able to resolve OpenPgpApiManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import app.k9mail.core.common.provider.AppNameProvider
import app.k9mail.core.featureflag.FeatureFlagFactory
import app.k9mail.core.ui.theme.api.FeatureThemeProvider
import app.k9mail.core.ui.theme.api.ThemeProvider
import app.k9mail.feature.funding.featureFundingModule
import app.k9mail.feature.telemetry.telemetryModule
import app.k9mail.feature.widget.shortcut.LauncherShortcutActivity
import com.fsck.k9.AppConfig
Expand All @@ -25,6 +26,7 @@ import org.koin.dsl.module
val appModule = module {
includes(appWidgetModule)
includes(telemetryModule)
includes(featureFundingModule)

single(named("ClientInfoAppName")) { BuildConfig.CLIENT_INFO_APP_NAME }
single(named("ClientInfoAppVersion")) { BuildConfig.VERSION_NAME }
Expand Down
4 changes: 4 additions & 0 deletions feature/funding/api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
plugins {
id(ThunderbirdPlugins.Library.jvm)
alias(libs.plugins.android.lint)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package app.k9mail.feature.funding.api

interface FundingManager {

/**
* Returns `true` if the app has a funding feature included.
*/
fun isFundingFeatureIncluded(): Boolean
}
14 changes: 14 additions & 0 deletions feature/funding/googleplay/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
plugins {
id(ThunderbirdPlugins.Library.androidCompose)
}

android {
namespace = "app.k9mail.feature.funding.googleplay"
resourcePrefix = "funding_googleplay_"
}

dependencies {
api(projects.feature.funding.api)

implementation(libs.android.billing)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package app.k9mail.feature.funding

import app.k9mail.feature.funding.api.FundingManager
import app.k9mail.feature.funding.googleplay.GooglePlayFundingManager
import org.koin.dsl.module

val featureFundingModule = module {
single<FundingManager> { GooglePlayFundingManager() }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package app.k9mail.feature.funding.googleplay

import app.k9mail.feature.funding.api.FundingManager

class GooglePlayFundingManager : FundingManager {
override fun isFundingFeatureIncluded(): Boolean {
return true
}
}
8 changes: 8 additions & 0 deletions feature/funding/noop/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
plugins {
id(ThunderbirdPlugins.Library.jvm)
alias(libs.plugins.android.lint)
}

dependencies {
api(projects.feature.funding.api)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package app.k9mail.feature.funding

import app.k9mail.feature.funding.api.FundingManager
import app.k9mail.feature.funding.noop.NoOpFundingManager
import org.koin.dsl.module

val featureFundingModule = module {
single<FundingManager> { NoOpFundingManager() }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package app.k9mail.feature.funding.noop

import app.k9mail.feature.funding.api.FundingManager

class NoOpFundingManager : FundingManager {
override fun isFundingFeatureIncluded(): Boolean {
return false
}
}
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# 4. Run the app and check for any issues.

[versions]
androidBilling = "7.0.0"
androidDesugar = "2.1.2"
androidMaterial = "1.12.0"
# AGP and tools should be updated together
Expand Down Expand Up @@ -112,6 +113,7 @@ ksp = { id = "com.google.devtools.ksp", version.ref = "kotlinKsp" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotlessPlugin" }

[libraries]
android-billing = { module = "com.android.billingclient:billing", version.ref = "androidBilling" }
android-desugar = { module = "com.android.tools:desugar_jdk_libs", version.ref = "androidDesugar" }
android-material = { module = "com.google.android.material:material", version.ref = "androidMaterial" }
android-tools-common = { module = "com.android.tools:common", version.ref = "androidTools" }
Expand Down
6 changes: 6 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ include(
":feature:telemetry:glean",
)

include(
":feature:funding:api",
":feature:funding:googleplay",
":feature:funding:noop",
)

include(
":core:common",
":core:featureflags",
Expand Down

0 comments on commit 8798df3

Please sign in to comment.