Skip to content

Commit

Permalink
Publishing to F-Droid (#180)
Browse files Browse the repository at this point in the history
* Publishing to F-Droid

* Publishing to F-Droid
  • Loading branch information
michaelbel authored Dec 13, 2023
1 parent dccf932 commit 138ebb6
Show file tree
Hide file tree
Showing 20 changed files with 222 additions and 4 deletions.
8 changes: 8 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ android {
isShrinkResources = false
applicationIdSuffix = MoviesBuildType.DEBUG.applicationIdSuffix
manifestPlaceholders += mapOf("appName" to "@string/app_name_dev")
isDefault = true
}
create("benchmark") {
initWith(getByName("release"))
Expand All @@ -133,11 +134,16 @@ android {
create("gms") {
dimension = "version"
applicationId = "org.michaelbel.moviemade"
isDefault = true
}
create("hms") {
dimension = "version"
applicationId = "org.michaelbel.movies"
}
create("foss") {
dimension = "version"
applicationId = "org.michaelbel.movies"
}
}

dynamicFeatures += setOf(":instant")
Expand All @@ -162,9 +168,11 @@ android {

val gmsImplementation: Configuration by configurations
val hmsImplementation: Configuration by configurations
val fossImplementation: Configuration by configurations
dependencies {
gmsImplementation(project(":core:platform-services:gms"))
hmsImplementation(project(":core:platform-services:hms"))
fossImplementation(project(":core:platform-services:foss"))

implementation(project(":core:analytics"))
implementation(project(":core:common"))
Expand Down
1 change: 1 addition & 0 deletions core/platform-services/foss/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
40 changes: 40 additions & 0 deletions core/platform-services/foss/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@Suppress("dsl_scope_violation")
plugins {
alias(libs.plugins.library)
alias(libs.plugins.kotlin)
id("movies-android-hilt")
}

android {
namespace = "org.michaelbel.movies.platform.foss"

defaultConfig {
minSdk = libs.versions.min.sdk.get().toInt()
compileSdk = libs.versions.compile.sdk.get().toInt()
}

/*buildTypes {
create("benchmark") {
signingConfig = signingConfigs.getByName("debug")
matchingFallbacks += listOf("release")
initWith(getByName("release"))
}
}*/

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

lint {
quiet = true
abortOnError = false
ignoreWarnings = true
checkDependencies = true
lintConfig = file("${project.rootDir}/config/codestyle/lint.xml")
}
}

dependencies {
implementation(project(":core:platform-services:interactor"))
}
2 changes: 2 additions & 0 deletions core/platform-services/foss/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package org.michaelbel.movies.hms

import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
import org.michaelbel.movies.hms.analytics.AnalyticsServiceImpl
import org.michaelbel.movies.hms.app.AppServiceImpl
import org.michaelbel.movies.hms.config.ConfigServiceImpl
import org.michaelbel.movies.hms.crashlytics.CrashlyticsServiceImpl
import org.michaelbel.movies.hms.messaging.MessagingServiceImpl
import org.michaelbel.movies.hms.review.ReviewServiceImpl
import org.michaelbel.movies.hms.update.UpdateServiceImpl
import org.michaelbel.movies.platform.main.analytics.AnalyticsService
import org.michaelbel.movies.platform.main.app.AppService
import org.michaelbel.movies.platform.main.config.ConfigService
import org.michaelbel.movies.platform.main.crashlytics.CrashlyticsService
import org.michaelbel.movies.platform.main.messaging.MessagingService
import org.michaelbel.movies.platform.main.review.ReviewService
import org.michaelbel.movies.platform.main.update.UpdateService

@Module
@InstallIn(SingletonComponent::class)
internal interface FossServiceModule {

@Binds
@Singleton
fun provideAnalyticsService(service: AnalyticsServiceImpl): AnalyticsService

@Binds
@Singleton
fun provideAppService(service: AppServiceImpl): AppService

@Binds
@Singleton
fun provideConfigService(service: ConfigServiceImpl): ConfigService

@Binds
@Singleton
fun provideCrashlyticsService(service: CrashlyticsServiceImpl): CrashlyticsService

@Binds
@Singleton
fun provideMessagingService(service: MessagingServiceImpl): MessagingService

@Binds
@Singleton
fun provideReviewService(service: ReviewServiceImpl): ReviewService

@Binds
@Singleton
fun provideUpdateService(service: UpdateServiceImpl): UpdateService
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.michaelbel.movies.hms.analytics

import android.os.Bundle
import javax.inject.Inject
import org.michaelbel.movies.platform.main.analytics.AnalyticsService

internal class AnalyticsServiceImpl @Inject constructor(): AnalyticsService {

override val screenView: String = ""

override val screenName: String = ""

override fun logEvent(name: String, params: Bundle) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.michaelbel.movies.hms.app

import javax.inject.Inject
import org.michaelbel.movies.platform.main.Flavor
import org.michaelbel.movies.platform.main.app.AppService

internal class AppServiceImpl @Inject constructor(): AppService {

override val flavor: Flavor = Flavor.Foss

override val isPlayServicesAvailable: Boolean
get() = false

override fun installApp() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.michaelbel.movies.hms.config

import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
import org.michaelbel.movies.platform.main.config.ConfigService

internal class ConfigServiceImpl @Inject constructor(): ConfigService {

override fun fetchAndActivate() {}

override fun getBooleanFlow(name: String): Flow<Boolean> {
return flowOf(false)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.michaelbel.movies.hms.crashlytics

import javax.inject.Inject
import org.michaelbel.movies.platform.main.crashlytics.CrashlyticsService

internal class CrashlyticsServiceImpl @Inject constructor(): CrashlyticsService {

override fun recordException(priority: Int, tag: String, message: String, exception: Throwable) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.michaelbel.movies.hms.messaging

import javax.inject.Inject
import org.michaelbel.movies.platform.main.messaging.MessagingService
import org.michaelbel.movies.platform.main.messaging.TokenListener

internal class MessagingServiceImpl @Inject constructor(): MessagingService {

override fun setTokenListener(listener: TokenListener) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.michaelbel.movies.hms.review

import android.app.Activity
import javax.inject.Inject
import org.michaelbel.movies.platform.main.review.ReviewService

internal class ReviewServiceImpl @Inject constructor(): ReviewService {

override fun requestReview(activity: Activity) {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.michaelbel.movies.hms.update

import android.app.Activity
import javax.inject.Inject
import org.michaelbel.movies.platform.main.update.UpdateListener
import org.michaelbel.movies.platform.main.update.UpdateService

internal class UpdateServiceImpl @Inject constructor(): UpdateService {

override fun setUpdateAvailableListener(listener: UpdateListener) {}

override fun startUpdate(activity: Activity) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ import com.google.android.gms.common.GoogleApiAvailability
import com.google.firebase.FirebaseApp
import dagger.hilt.android.qualifiers.ApplicationContext
import javax.inject.Inject
import org.michaelbel.movies.platform.main.Flavor
import org.michaelbel.movies.platform.main.app.AppService

internal class AppServiceImpl @Inject constructor(
@ApplicationContext private val context: Context,
private val googleApiAvailability: GoogleApiAvailability
): AppService {

override val flavor: Flavor = Flavor.Gms

override val isPlayServicesAvailable: Boolean
get() {
val status: Int = googleApiAvailability.isGooglePlayServicesAvailable(context)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.michaelbel.movies.platform.main.update.UpdateService

@Module
@InstallIn(SingletonComponent::class)
internal interface GmsServiceModule {
internal interface HmsServiceModule {

@Binds
@Singleton
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package org.michaelbel.movies.hms.app

import javax.inject.Inject
import org.michaelbel.movies.platform.main.Flavor
import org.michaelbel.movies.platform.main.app.AppService

internal class AppServiceImpl @Inject constructor(): AppService {

override val flavor: Flavor = Flavor.Hms

override val isPlayServicesAvailable: Boolean
get() = false

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.michaelbel.movies.platform.main

sealed class Flavor(
val name: String
) {
data object Gms: Flavor("GMS")

data object Hms: Flavor("HMS")

data object Foss: Flavor("FOSS")
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
package org.michaelbel.movies.platform.main.app

import org.michaelbel.movies.platform.main.Flavor

interface AppService {

val flavor: Flavor

val isPlayServicesAvailable: Boolean

fun installApp()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ import org.michaelbel.movies.common.list.MovieList
import org.michaelbel.movies.common.theme.AppTheme
import org.michaelbel.movies.common.version.AppVersionData
import org.michaelbel.movies.persistence.datastore.MoviesPreferences
import org.michaelbel.movies.platform.main.app.AppService
import org.michaelbel.movies.repository.SettingsRepository
import org.michaelbel.movies.repository.ktx.code
import org.michaelbel.movies.repository.ktx.packageInfo

@Singleton
internal class SettingsRepositoryImpl @Inject constructor(
@ApplicationContext private val context: Context,
private val preferences: MoviesPreferences
private val preferences: MoviesPreferences,
appService: AppService
): SettingsRepository {

override val currentTheme: Flow<AppTheme> = preferences.themeFlow.map { name ->
Expand All @@ -49,7 +51,7 @@ internal class SettingsRepositoryImpl @Inject constructor(
AppVersionData(
version = context.packageInfo.versionName,
code = context.packageInfo.code,
flavor = "GMS",
flavor = appService.flavor.name,
isDebug = BuildConfig.DEBUG
)
)
Expand Down
5 changes: 4 additions & 1 deletion instant/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
android {
namespace = "org.michaelbel.movies.instant"
compileSdk = libs.versions.compile.sdk.get().toInt()
flavorDimensions += "version"

defaultConfig {
minSdk = libs.versions.min.sdk.get().toInt()
Expand All @@ -15,14 +16,16 @@ android {
compose = true
}

flavorDimensions += "version"
productFlavors {
create("gms") {
dimension = "version"
}
create("hms") {
dimension = "version"
}
create("foss") {
dimension = "version"
}
}

composeOptions {
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ include(
":core:persistence",
":core:platform-services:gms",
":core:platform-services:hms",
":core:platform-services:foss",
":core:platform-services:interactor",
":core:repository",
":core:ui",
Expand Down

0 comments on commit 138ebb6

Please sign in to comment.