Skip to content

Commit

Permalink
Merge pull request #122 from michaelbel/develop
Browse files Browse the repository at this point in the history
1.4.6
  • Loading branch information
michaelbel authored Apr 28, 2023
2 parents 157683e + e5bf258 commit cd52d67
Show file tree
Hide file tree
Showing 111 changed files with 1,279 additions and 766 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ jobs:
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
java-version: 17

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -708,3 +708,7 @@
/.gradle/7.6/checksums/sha1-checksums.bin
/buildSrc/.gradle/7.6/checksums/sha1-checksums.bin
/config/movies.jks
/.gradle/
/.idea/
/buildSrc/build/classes/kotlin/main/ktx/
/buildSrc/.gradle/
29 changes: 19 additions & 10 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
import java.io.FileInputStream
import org.apache.commons.io.output.ByteArrayOutputStream
import org.jetbrains.kotlin.konan.properties.Properties
import java.io.FileInputStream

@Suppress("dsl_scope_violation")
plugins {
id("movies-android-application")
id("movies-android-application-compose")
alias(libs.plugins.application)
alias(libs.plugins.kotlin)
alias(libs.plugins.androidx.navigation.safeargs)
alias(libs.plugins.google.services)
alias(libs.plugins.firebase.appdistribution)
alias(libs.plugins.firebase.crashlytics)
alias(libs.plugins.palantir.git)
id("movies-android-hilt")
id("androidx.navigation.safeargs")
id("com.google.gms.google-services")
id("com.google.firebase.appdistribution")
id("com.google.firebase.crashlytics")
id("com.palantir.git-version")
}

val gitCommitsCount: Int by lazy {
Expand All @@ -27,11 +28,11 @@ val currentTime: Long by lazy {
System.currentTimeMillis()
}

val admobAppId: String by lazy {
val admobAppId: String? by lazy {
gradleLocalProperties(rootDir).getProperty("ADMOB_APP_ID")
}

val admobBannerId: String by lazy {
val admobBannerId: String? by lazy {
gradleLocalProperties(rootDir).getProperty("ADMOB_BANNER_ID")
}

Expand Down Expand Up @@ -129,13 +130,19 @@ android {
}

buildFeatures {
buildConfig = true
compose = true
}

composeOptions {
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
}

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

lint {
quiet = true
abortOnError = false
Expand Down Expand Up @@ -165,4 +172,6 @@ dependencies {
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(libs.androidx.compose.ui.test.junit4)
androidTestImplementation(libs.androidx.benchmark.junit)

lintChecks(libs.lint.checks)
}
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@
</service>

<!-- AdMob -->
<meta-data
<!--<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="@string/admobAppId" />
android:value="@string/admobAppId" />-->

<!-- Downloadable Fonts (https://d.android.com/guide/topics/ui/look-and-feel/downloadable-fonts) -->
<meta-data
Expand Down
8 changes: 7 additions & 1 deletion app/src/main/kotlin/org/michaelbel/movies/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import android.app.Application
import android.util.Log
import androidx.hilt.work.HiltWorkerFactory
import androidx.work.Configuration
import com.google.firebase.FirebaseApp
import dagger.hilt.android.HiltAndroidApp
import javax.inject.Inject
import org.michaelbel.moviemade.BuildConfig
import javax.inject.Inject

@HiltAndroidApp
internal class App: Application(), Configuration.Provider {
Expand All @@ -19,4 +20,9 @@ internal class App: Application(), Configuration.Provider {
.setMinimumLoggingLevel(if (BuildConfig.DEBUG) Log.DEBUG else Log.ERROR)
.build()
}

override fun onCreate() {
super.onCreate()
FirebaseApp.initializeApp(this)
}
}
17 changes: 0 additions & 17 deletions app/src/main/kotlin/org/michaelbel/movies/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ import androidx.core.view.WindowCompat
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.navigation.NavHostController
import androidx.navigation.compose.rememberNavController
import androidx.work.OneTimeWorkRequestBuilder
import androidx.work.WorkManager
import androidx.work.workDataOf
import dagger.hilt.android.AndroidEntryPoint
import org.michaelbel.movies.common.theme.AppTheme
import org.michaelbel.movies.domain.workers.MoviesDatabaseWorker
import org.michaelbel.movies.ui.shortcuts.installShortcuts
import org.michaelbel.movies.ui.theme.MoviesTheme

Expand Down Expand Up @@ -60,18 +56,5 @@ internal class MainActivity: AppCompatActivity() {
}
}
}

prepopulateDatabase()
}

private fun prepopulateDatabase() {
val request = OneTimeWorkRequestBuilder<MoviesDatabaseWorker>()
.setInputData(workDataOf(MoviesDatabaseWorker.KEY_FILENAME to MOVIES_DATA_FILENAME))
.build()
WorkManager.getInstance(this).enqueue(request)
}

private companion object {
private const val MOVIES_DATA_FILENAME = "movies.json"
}
}
27 changes: 26 additions & 1 deletion app/src/main/kotlin/org/michaelbel/movies/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ package org.michaelbel.movies
import android.os.Bundle
import androidx.compose.ui.unit.LayoutDirection
import androidx.navigation.NavDestination
import androidx.work.OneTimeWorkRequestBuilder
import androidx.work.WorkManager
import androidx.work.workDataOf
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.stateIn
Expand All @@ -12,11 +16,13 @@ import org.michaelbel.movies.analytics.MoviesAnalytics
import org.michaelbel.movies.common.theme.AppTheme
import org.michaelbel.movies.common.viewmodel.BaseViewModel
import org.michaelbel.movies.domain.interactor.settings.SettingsInteractor
import javax.inject.Inject
import org.michaelbel.movies.domain.workers.AccountUpdateWorker
import org.michaelbel.movies.domain.workers.MoviesDatabaseWorker

@HiltViewModel
internal class MainViewModel @Inject constructor(
private val settingsInteractor: SettingsInteractor,
private val workManager: WorkManager,
private val analytics: MoviesAnalytics
): BaseViewModel() {

Expand All @@ -43,6 +49,8 @@ internal class MainViewModel @Inject constructor(

init {
fetchRemoteConfig()
prepopulateDatabase()
updateAccountDetails()
}

fun analyticsTrackDestination(destination: NavDestination, arguments: Bundle?) {
Expand All @@ -52,4 +60,21 @@ internal class MainViewModel @Inject constructor(
private fun fetchRemoteConfig() = launch {
settingsInteractor.fetchRemoteConfig()
}

private fun prepopulateDatabase() {
val request = OneTimeWorkRequestBuilder<MoviesDatabaseWorker>()
.setInputData(workDataOf(MoviesDatabaseWorker.KEY_FILENAME to MOVIES_DATA_FILENAME))
.build()
workManager.enqueue(request)
}

private fun updateAccountDetails() {
val request = OneTimeWorkRequestBuilder<AccountUpdateWorker>()
.build()
workManager.enqueue(request)
}

private companion object {
private const val MOVIES_DATA_FILENAME = "movies.json"
}
}
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@Suppress("dsl_scope_violation")
plugins {
alias(libs.plugins.application) apply false
alias(libs.plugins.library) apply false
Expand All @@ -12,10 +13,9 @@ plugins {
alias(libs.plugins.hilt) apply false
alias(libs.plugins.spotless)
alias(libs.plugins.detekt)

id("com.github.ben-manes.versions") version "0.46.0"
id("nl.littlerobots.version-catalog-update") version "0.8.0"
id("com.palantir.git-version") version "2.0.0"
alias(libs.plugins.palantir.git)
alias(libs.plugins.ben.manes.versions)
alias(libs.plugins.littlerobots.version.catalog.update)
}

/**
Expand Down
16 changes: 0 additions & 16 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,6 @@ dependencies {

gradlePlugin {
plugins {
register("androidApplication") {
id = "movies-android-application"
implementationClass = "plugins.AndroidApplicationConventionPlugin"
}
register("androidLibrary") {
id = "movies-android-library"
implementationClass = "plugins.AndroidLibraryConventionPlugin"
}
register("androidComposeApplication") {
id = "movies-android-application-compose"
implementationClass = "plugins.AndroidComposeApplicationConventionPlugin"
}
register("androidComposeLibrary") {
id = "movies-android-library-compose"
implementationClass = "plugins.AndroidComposeLibraryConventionPlugin"
}
register("androidHilt") {
id = "movies-android-hilt"
implementationClass = "plugins.AndroidHiltConventionPlugin"
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

23 changes: 0 additions & 23 deletions buildSrc/src/main/kotlin/plugins/AndroidLibraryConventionPlugin.kt

This file was deleted.

11 changes: 9 additions & 2 deletions core/ads/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@Suppress("dsl_scope_violation")
plugins {
id("movies-android-library")
alias(libs.plugins.library)
alias(libs.plugins.kotlin)
}

android {
Expand All @@ -18,6 +20,11 @@ android {
}
}

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

lint {
quiet = true
abortOnError = false
Expand All @@ -28,5 +35,5 @@ android {
}

dependencies {
api(libs.play.services.ads)
/*api(libs.play.services.ads)*/
}
9 changes: 8 additions & 1 deletion core/analytics/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@Suppress("dsl_scope_violation")
plugins {
id("movies-android-library")
alias(libs.plugins.library)
alias(libs.plugins.kotlin)
id("movies-android-hilt")
}

Expand All @@ -19,6 +21,11 @@ android {
}
}

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

lint {
quiet = true
abortOnError = false
Expand Down
Loading

0 comments on commit cd52d67

Please sign in to comment.