Skip to content

Commit

Permalink
Merge pull request #94 from michaelbel/develop
Browse files Browse the repository at this point in the history
1.4.0
  • Loading branch information
michaelbel authored Oct 29, 2022
2 parents 14c00eb + ecc606c commit b89337e
Show file tree
Hide file tree
Showing 190 changed files with 1,372 additions and 2,203 deletions.
28 changes: 22 additions & 6 deletions .github/workflows/check_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,20 @@ jobs:
timeout-minutes: 60

steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

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

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Decode Keystore File
id: decode_keystore_file
Expand All @@ -43,6 +50,15 @@ jobs:

- name: Make Gradlew Executable
run: chmod +x ./gradlew


- name: Lint
run: ./gradlew lint

- name: Detekt
run: ./gradlew detekt

- name: Spotless
run: ./gradlew spotlessCheck

- name: Build
run: ./gradlew compileDebugKotlin
11 changes: 6 additions & 5 deletions .github/workflows/distribution_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

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

- name: Make Gradlew Executable
run: chmod +x ./gradlew
Expand Down
21 changes: 7 additions & 14 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("UnstableApiUsage")

import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
import java.io.FileInputStream
import org.apache.commons.io.output.ByteArrayOutputStream
Expand All @@ -8,17 +6,15 @@ import org.michaelbel.moviemade.App
import org.michaelbel.moviemade.App.ApplicationId
import org.michaelbel.moviemade.App.BuildTools
import org.michaelbel.moviemade.App.VersionName
import org.michaelbel.moviemade.dependencies.OptExperimentalLifecycleComposeApi
import org.michaelbel.moviemade.dependencies.OptExperimentalMaterial3Api

plugins {
id("movies-android-application")
id("movies-android-application-compose")
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("movies-android-hilt")
}

val gitVersion: Int by lazy {
Expand Down Expand Up @@ -46,7 +42,7 @@ tasks.register("prepareReleaseNotes") {
doLast {
exec {
workingDir(rootDir)
executable("./scripts/gitlog.sh")
executable("./config/scripts/gitlog.sh")
}
}
}
Expand Down Expand Up @@ -125,19 +121,16 @@ android {
viewBinding = true
}

/*lint {
lintConfig = file("lint.xml")
isCheckReleaseBuilds = false
isAbortOnError = false
}*/

kotlinOptions {
freeCompilerArgs = freeCompilerArgs + OptExperimentalMaterial3Api
freeCompilerArgs = freeCompilerArgs + OptExperimentalLifecycleComposeApi
freeCompilerArgs = freeCompilerArgs + listOf(
"-Xopt-in=androidx.compose.material3.ExperimentalMaterial3Api",
"-Xopt-in=androidx.lifecycle.compose.ExperimentalLifecycleComposeApi"
)
}
}

dependencies {
implementation(project(":core:analytics"))
implementation(project(":core:common"))
implementation(project(":core:domain"))
implementation(project(":core:navigation"))
Expand Down
21 changes: 19 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
Expand All @@ -19,14 +20,15 @@
android:hardwareAccelerated="true"
android:theme="@style/Theme.Movies.Starting"
android:dataExtractionRules="@xml/data_extraction_rules"
android:supportsRtl="true"
tools:ignore="UnusedAttribute">

<activity
android:name="org.michaelbel.movies.MainActivity"
android:exported="true">
android:exported="true"
android:screenOrientation="portrait">

<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
Expand All @@ -46,6 +48,21 @@
</intent-filter>

</activity>

<activity-alias
android:name=".DEFAULT"
android:targetActivity="org.michaelbel.movies.MainActivity"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:enabled="true"
android:exported="true">

<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>

</activity-alias>

<!--AdMob-->
<meta-data
Expand Down
20 changes: 18 additions & 2 deletions app/src/main/kotlin/org/michaelbel/movies/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.viewModels
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.unit.LayoutDirection
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.WindowCompat
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.navigation.NavHostController
import androidx.navigation.compose.rememberNavController
import dagger.hilt.android.AndroidEntryPoint
import org.michaelbel.movies.common.shortcuts.installShortcuts
import org.michaelbel.movies.ui.theme.SystemTheme
import org.michaelbel.movies.ui.theme.MoviesTheme
import org.michaelbel.movies.ui.theme.model.SystemTheme

@AndroidEntryPoint
class MainActivity: ComponentActivity() {
Expand All @@ -26,12 +31,23 @@ class MainActivity: ComponentActivity() {
setContent {
val currentTheme: SystemTheme by viewModel.currentTheme.collectAsStateWithLifecycle()
val dynamicColors: Boolean by viewModel.dynamicColors.collectAsStateWithLifecycle()
val layoutDirection: LayoutDirection by viewModel.layoutDirection.collectAsStateWithLifecycle()

val navHostController: NavHostController = rememberNavController().apply {
addOnDestinationChangedListener { _, destination, arguments ->
viewModel.analyticsTrackDestination(destination, arguments)
}
}

MoviesTheme(
theme = currentTheme,
dynamicColors = dynamicColors
) {
MainActivityContent()
CompositionLocalProvider(LocalLayoutDirection provides layoutDirection) {
MainActivityContent(
navHostController = navHostController
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ fun MainActivityContent(
NavHost(
navController = navHostController,
startDestination = startDestination,
modifier = modifier.padding(paddingValues)
modifier = modifier
.padding(paddingValues)
) {
feedGraph(
navigateToSettings = {
Expand Down
32 changes: 22 additions & 10 deletions app/src/main/kotlin/org/michaelbel/movies/MainViewModel.kt
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
package org.michaelbel.movies

import android.os.Bundle
import androidx.compose.ui.unit.LayoutDirection
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.google.firebase.remoteconfig.FirebaseRemoteConfig
import androidx.navigation.NavDestination
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch
import org.michaelbel.movies.analytics.MoviesAnalytics
import org.michaelbel.movies.domain.interactor.SettingsInteractor
import org.michaelbel.movies.ui.theme.SystemTheme
import timber.log.Timber
import org.michaelbel.movies.ui.theme.model.SystemTheme

@HiltViewModel
class MainViewModel @Inject constructor(
settingsInteractor: SettingsInteractor,
private val firebaseRemoteConfig: FirebaseRemoteConfig
private val settingsInteractor: SettingsInteractor,
private val analytics: MoviesAnalytics
): ViewModel() {

val currentTheme: StateFlow<SystemTheme> = settingsInteractor.currentTheme
Expand All @@ -32,13 +36,21 @@ class MainViewModel @Inject constructor(
initialValue = false
)

val layoutDirection: StateFlow<LayoutDirection> = settingsInteractor.rtlEnabled
.map { enabled -> if (enabled) LayoutDirection.Rtl else LayoutDirection.Ltr }
.stateIn(
scope = viewModelScope,
started = SharingStarted.Lazily,
initialValue = LayoutDirection.Ltr
)

init {
fetchRemoteConfig()
viewModelScope.launch {
settingsInteractor.fetchRemoteConfig()
}
}

private fun fetchRemoteConfig() {
firebaseRemoteConfig
.fetchAndActivate()
.addOnFailureListener(Timber::e)
fun analyticsTrackDestination(destination: NavDestination, arguments: Bundle?) {
analytics.trackDestination(destination.route, arguments)
}
}
5 changes: 0 additions & 5 deletions app/src/main/res/values-land/dimens.xml

This file was deleted.

16 changes: 0 additions & 16 deletions app/src/main/res/values-sw720dp/dimens.xml

This file was deleted.

Loading

0 comments on commit b89337e

Please sign in to comment.