Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.5.2 #187

Merged
merged 40 commits into from
Nov 21, 2023
Merged

1.5.2 #187

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
959d755
Update project
michaelbel Nov 5, 2023
06ffc79
Update project
michaelbel Nov 5, 2023
ae8ca7b
Update project
michaelbel Nov 5, 2023
5ba6430
Bump kotlin from 1.9.10 to 1.9.20 (#169)
dependabot[bot] Nov 8, 2023
5d241a6
Bump com.google.devtools.ksp from 1.9.10-1.0.13 to 1.9.20-1.0.14 (#174)
dependabot[bot] Nov 8, 2023
5495353
Update project
michaelbel Nov 8, 2023
7e39550
Update project
michaelbel Nov 8, 2023
65af27a
Update project
michaelbel Nov 8, 2023
9ad4142
Update gradle plugin to 8.1.3
michaelbel Nov 9, 2023
364d1dd
Add LocalRippleTheme composition provider
michaelbel Nov 10, 2023
45eb8dc
Add API key interceptor
michaelbel Nov 11, 2023
6f66234
Update project
michaelbel Nov 11, 2023
7221bb8
Update project
michaelbel Nov 11, 2023
9812f26
Update project
michaelbel Nov 11, 2023
a5cb497
Update project
michaelbel Nov 11, 2023
d2b1569
Update project
michaelbel Nov 11, 2023
f83f66d
Update project
michaelbel Nov 11, 2023
4c36956
Update project
michaelbel Nov 11, 2023
eb36fed
Download image (#177)
michaelbel Nov 12, 2023
f2cbe8f
Update project
michaelbel Nov 12, 2023
cdcccd8
Update project
michaelbel Nov 13, 2023
ee98676
Update kotlinx serialization to 1.6.1
michaelbel Nov 15, 2023
deae540
Update project
michaelbel Nov 15, 2023
85b9eb6
Update project
michaelbel Nov 15, 2023
bb5e055
Change launcher app icon (#178)
michaelbel Nov 16, 2023
24e9e72
Update project
michaelbel Nov 16, 2023
89a49c7
Update project
michaelbel Nov 17, 2023
9cff94d
Update project
michaelbel Nov 17, 2023
d381e33
Update project
michaelbel Nov 17, 2023
02a1c9f
Update project
michaelbel Nov 17, 2023
01944db
Predictive back gesture (#179)
michaelbel Nov 19, 2023
d41463f
Update project
michaelbel Nov 19, 2023
6e39dd0
Update project
michaelbel Nov 19, 2023
dd8e83b
Update project
michaelbel Nov 19, 2023
05d5db4
Support landscape orientation (#181)
michaelbel Nov 19, 2023
bd68da6
Display content edge-to-edge (#182)
michaelbel Nov 19, 2023
3feb3ce
Update project
michaelbel Nov 19, 2023
9fb208c
Support display cutouts (#183)
michaelbel Nov 19, 2023
2cc1e7c
Update gradle plugin to 8.1.4
michaelbel Nov 19, 2023
756b070
Update project
michaelbel Nov 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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 {
Expand All @@ -11,7 +11,6 @@ plugins {
alias(libs.plugins.firebase.appdistribution)
alias(libs.plugins.firebase.crashlytics)
alias(libs.plugins.palantir.git)
alias(libs.plugins.detekt)
id("movies-android-hilt")
}

Expand Down Expand Up @@ -91,14 +90,14 @@ android {
isShrinkResources = true
signingConfig = signingConfigs.getByName("release")
applicationIdSuffix = MoviesBuildType.RELEASE.applicationIdSuffix
manifestPlaceholders += mapOf("appName" to "@string/app_name")
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
"retrofit2.pro",
"okhttp3.pro",
"coroutines.pro"
)

firebaseAppDistribution {
appId = "1:770317857182:android:876190afbc53df31"
artifactType = "APK"
Expand All @@ -113,6 +112,7 @@ android {
isMinifyEnabled = false
isShrinkResources = false
applicationIdSuffix = MoviesBuildType.DEBUG.applicationIdSuffix
manifestPlaceholders += mapOf("appName" to "@string/app_name_dev")
}
create("benchmark") {
initWith(getByName("release"))
Expand Down Expand Up @@ -153,11 +153,11 @@ android {
dependencies {
implementation(project(":core:analytics"))
implementation(project(":core:common"))
implementation(project(":core:domain"))
implementation(project(":core:interactor"))
implementation(project(":core:navigation"))
implementation(project(":core:notifications"))
implementation(project(":core:ui"))

implementation(project(":core:work"))
implementation(project(":feature:auth"))
implementation(project(":feature:account"))
implementation(project(":feature:details"))
Expand Down
3 changes: 0 additions & 3 deletions app/src/debug/res/values/strings.xml

This file was deleted.

50 changes: 41 additions & 9 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dist="http://schemas.android.com/apk/distribution"
xmlns:tools="http://schemas.android.com/tools">
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="auto">

<dist:module dist:instant="true" />

Expand All @@ -23,12 +24,13 @@
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="true"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:label="${appName}"
android:localeConfig="@xml/locale_config"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/Theme.Movies.Starting">
android:theme="@style/Theme.Movies.Starting"
android:icon="@mipmap/ic_launcher_red"
android:roundIcon="@mipmap/ic_launcher_red"
android:enableOnBackInvokedCallback="true">

<profileable
android:shell="true"
Expand All @@ -37,7 +39,7 @@
<activity
android:name="org.michaelbel.movies.MainActivity"
android:exported="true"
android:screenOrientation="portrait">
android:screenOrientation="fullUser">

<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
Expand Down Expand Up @@ -89,11 +91,41 @@
</activity>

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

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

</activity-alias>

<activity-alias
android:name="org.michaelbel.movies.PurpleIcon"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_purple"
android:roundIcon="@mipmap/ic_launcher_purple"
android:targetActivity="org.michaelbel.movies.MainActivity">

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

</activity-alias>

<activity-alias
android:name="org.michaelbel.movies.BrownIcon"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_brown"
android:roundIcon="@mipmap/ic_launcher_brown"
android:targetActivity="org.michaelbel.movies.MainActivity">

<intent-filter>
Expand Down
12 changes: 4 additions & 8 deletions app/src/main/kotlin/org/michaelbel/movies/App.kt
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
package org.michaelbel.movies

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 org.michaelbel.moviemade.BuildConfig
import javax.inject.Inject
import org.michaelbel.movies.ui.appicon.installLauncherIcon

@HiltAndroidApp
internal class App: Application(), Configuration.Provider {

@Inject lateinit var workerFactory: HiltWorkerFactory

override fun getWorkManagerConfiguration(): Configuration {
return Configuration.Builder()
.setWorkerFactory(workerFactory)
.setMinimumLoggingLevel(if (BuildConfig.DEBUG) Log.DEBUG else Log.ERROR)
.build()
}
override val workManagerConfiguration: Configuration
get() = Configuration.Builder().setWorkerFactory(workerFactory).build()

override fun onCreate() {
super.onCreate()
installLauncherIcon()
FirebaseApp.initializeApp(this)
}
}
33 changes: 5 additions & 28 deletions app/src/main/kotlin/org/michaelbel/movies/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,12 @@ package org.michaelbel.movies

import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.runtime.getValue
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.theme.AppTheme
import org.michaelbel.movies.navigation.ktx.addOnDestinationChangedListener
import org.michaelbel.movies.ui.shortcuts.installShortcuts
import org.michaelbel.movies.ui.theme.MoviesTheme

/**
* Per-App Language depends on AppCompatActivity (not ComponentActivity).
Expand All @@ -26,29 +19,13 @@ internal class MainActivity: AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
enableEdgeToEdge()
super.onCreate(savedInstanceState)

/** Configure edge-to-edge display. */
WindowCompat.setDecorFitsSystemWindows(window, false)

installShortcuts()
setContent {
val currentTheme: AppTheme by viewModel.currentTheme.collectAsStateWithLifecycle()
val dynamicColors: Boolean by viewModel.dynamicColors.collectAsStateWithLifecycle()

val navHostController: NavHostController = rememberNavController().apply {
addOnDestinationChangedListener(viewModel::analyticsTrackDestination)
}

MoviesTheme(
theme = currentTheme,
dynamicColors = dynamicColors
) {
MainActivityContent(
navHostController = navHostController,
onStartUpdateFlow = { viewModel.startUpdateFlow(this) }
)
}
MainActivityContent(
onStartUpdateFlow = { viewModel.startUpdateFlow(this) }
)
}
}
}
74 changes: 45 additions & 29 deletions app/src/main/kotlin/org/michaelbel/movies/MainActivityContent.kt
Original file line number Diff line number Diff line change
@@ -1,54 +1,70 @@
package org.michaelbel.movies

import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.rememberNavController
import org.michaelbel.movies.auth.accountGraph
import org.michaelbel.movies.auth.authGraph
import org.michaelbel.movies.auth.navigateToAccount
import org.michaelbel.movies.auth.navigateToAuth
import org.michaelbel.movies.common.theme.AppTheme
import org.michaelbel.movies.details.detailsGraph
import org.michaelbel.movies.details.navigateToDetails
import org.michaelbel.movies.feed.FeedDestination
import org.michaelbel.movies.feed.feedGraph
import org.michaelbel.movies.gallery.galleryGraph
import org.michaelbel.movies.gallery.navigateToGallery
import org.michaelbel.movies.navigation.ktx.addOnDestinationChangedListener
import org.michaelbel.movies.settings.navigateToSettings
import org.michaelbel.movies.settings.settingsGraph
import org.michaelbel.movies.ui.theme.MoviesTheme

@Composable
internal fun MainActivityContent(
navHostController: NavHostController = rememberNavController(),
startDestination: String = FeedDestination.route,
onStartUpdateFlow: () -> Unit
onStartUpdateFlow: () -> Unit,
viewModel: MainViewModel = hiltViewModel()
) {
NavHost(
navController = navHostController,
startDestination = startDestination
val currentTheme: AppTheme by viewModel.currentTheme.collectAsStateWithLifecycle()
val dynamicColors: Boolean by viewModel.dynamicColors.collectAsStateWithLifecycle()
val navHostController: NavHostController = rememberNavController().apply {
addOnDestinationChangedListener(viewModel::analyticsTrackDestination)
}

MoviesTheme(
theme = currentTheme,
dynamicColors = dynamicColors
) {
authGraph(
navigateBack = navHostController::popBackStack
)
accountGraph(
navigateBack = navHostController::popBackStack
)
feedGraph(
navigateToAuth = navHostController::navigateToAuth,
navigateToAccount = navHostController::navigateToAccount,
navigateToSettings = navHostController::navigateToSettings,
navigateToDetails = navHostController::navigateToDetails,
onStartUpdateFlow = onStartUpdateFlow
)
detailsGraph(
navigateBack = navHostController::popBackStack,
navigateToGallery = navHostController::navigateToGallery
)
galleryGraph(
navigateBack = navHostController::popBackStack
)
settingsGraph(
navigateBack = navHostController::popBackStack
)
NavHost(
navController = navHostController,
startDestination = FeedDestination.route
) {
authGraph(
navigateBack = navHostController::popBackStack
)
accountGraph(
navigateBack = navHostController::popBackStack
)
feedGraph(
navigateToAuth = navHostController::navigateToAuth,
navigateToAccount = navHostController::navigateToAccount,
navigateToSettings = navHostController::navigateToSettings,
navigateToDetails = navHostController::navigateToDetails,
onStartUpdateFlow = onStartUpdateFlow
)
detailsGraph(
navigateBack = navHostController::popBackStack,
navigateToGallery = navHostController::navigateToGallery
)
galleryGraph(
navigateBack = navHostController::popBackStack
)
settingsGraph(
navigateBack = navHostController::popBackStack
)
}
}
}
14 changes: 7 additions & 7 deletions app/src/main/kotlin/org/michaelbel/movies/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.work.WorkManager
import androidx.work.workDataOf
import com.google.firebase.messaging.FirebaseMessaging
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 @@ -17,18 +18,17 @@ import org.michaelbel.movies.common.inappupdate.di.InAppUpdate
import org.michaelbel.movies.common.ktx.printlnDebug
import org.michaelbel.movies.common.theme.AppTheme
import org.michaelbel.movies.common.viewmodel.BaseViewModel
import org.michaelbel.movies.domain.workers.AccountUpdateWorker
import org.michaelbel.movies.domain.workers.MoviesDatabaseWorker
import org.michaelbel.movies.interactor.Interactor
import javax.inject.Inject
import org.michaelbel.movies.work.AccountUpdateWorker
import org.michaelbel.movies.work.MoviesDatabaseWorker

@HiltViewModel
internal class MainViewModel @Inject constructor(
private val interactor: Interactor,
private val inAppUpdate: InAppUpdate,
private val workManager: WorkManager,
private val analytics: MoviesAnalytics,
private val firebaseMessaging: FirebaseMessaging
private val firebaseMessaging: FirebaseMessaging,
private val workManager: WorkManager
): BaseViewModel() {

val currentTheme: StateFlow<AppTheme> = interactor.currentTheme
Expand Down Expand Up @@ -84,7 +84,7 @@ internal class MainViewModel @Inject constructor(
workManager.enqueue(request)
}

private companion object {
private const val MOVIES_DATA_FILENAME = "movies.json"
companion object {
const val MOVIES_DATA_FILENAME = "movies.json"
}
}
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<resources>
<string name="app_name" translatable="false">Movies</string>
<string name="app_name_dev" translatable="false">Movies Dev</string>
</resources>
Loading