Skip to content

Commit

Permalink
Merge pull request #136 from michaelbel/develop
Browse files Browse the repository at this point in the history
1.4.7
  • Loading branch information
michaelbel authored May 21, 2023
2 parents cd52d67 + 493dee7 commit d089eca
Show file tree
Hide file tree
Showing 43 changed files with 282 additions and 425 deletions.
13 changes: 1 addition & 12 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
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 {
Expand All @@ -28,14 +27,6 @@ val currentTime: Long by lazy {
System.currentTimeMillis()
}

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

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

val gitVersion: groovy.lang.Closure<String> by extra
val versionDetails: groovy.lang.Closure<com.palantir.gradle.gitversion.VersionDetails> by extra
val versionLastTag: String = versionDetails().lastTag
Expand Down Expand Up @@ -69,8 +60,6 @@ android {
resourceConfigurations.addAll(listOf("en", "ru"))

buildConfigField("String", "VERSION_DATE", "\"$currentTime\"")
buildConfigField("String", "ADMOB_APP_ID", "\"$admobAppId\"")
buildConfigField("String", "ADMOB_BANNER_ID", "\"$admobBannerId\"")

setProperty("archivesBaseName", "Movies-v$versionName($versionCode)")
}
Expand Down
15 changes: 5 additions & 10 deletions app/src/main/kotlin/org/michaelbel/movies/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
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
Expand All @@ -15,6 +13,7 @@ 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

Expand All @@ -40,20 +39,16 @@ internal class MainActivity: AppCompatActivity() {
val layoutDirection: LayoutDirection by viewModel.layoutDirection.collectAsStateWithLifecycle()

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

MoviesTheme(
theme = currentTheme,
dynamicColors = dynamicColors
) {
CompositionLocalProvider(LocalLayoutDirection provides layoutDirection) {
MainActivityContent(
navHostController = navHostController
)
}
MainActivityContent(
navHostController = navHostController
)
}
}
}
Expand Down
32 changes: 12 additions & 20 deletions app/src/main/kotlin/org/michaelbel/movies/MainActivityContent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import androidx.compose.runtime.Composable
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.rememberNavController
import org.michaelbel.movies.auth.AccountDestination
import org.michaelbel.movies.auth.AuthDestination
import org.michaelbel.movies.auth.accountGraph
import org.michaelbel.movies.auth.authGraph
import org.michaelbel.movies.details.DetailsDestination
import org.michaelbel.movies.auth.navigateToAccount
import org.michaelbel.movies.auth.navigateToAuth
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.settings.SettingsDestination
import org.michaelbel.movies.settings.navigateToSettings
import org.michaelbel.movies.settings.settingsGraph

@Composable
Expand All @@ -25,30 +25,22 @@ internal fun MainActivityContent(
startDestination = startDestination
) {
authGraph(
onBackClick = navHostController::popBackStack
navigateBack = navHostController::popBackStack
)
accountGraph(
onBackClick = navHostController::popBackStack
navigateBack = navHostController::popBackStack
)
feedGraph(
navigateToAuth = {
navHostController.navigate(AuthDestination.route)
},
navigateToAccount = {
navHostController.navigate(AccountDestination.route)
},
navigateToSettings = {
navHostController.navigate(SettingsDestination.route)
},
navigateToDetails = { movieId ->
navHostController.navigate(DetailsDestination.createNavigationRoute(movieId))
}
navigateToAuth = navHostController::navigateToAuth,
navigateToAccount = navHostController::navigateToAccount,
navigateToSettings = navHostController::navigateToSettings,
navigateToDetails = navHostController::navigateToDetails
)
detailsGraph(
onBackClick = navHostController::popBackStack
navigateBack = navHostController::popBackStack
)
settingsGraph(
onBackClick = navHostController::popBackStack
navigateBack = navHostController::popBackStack
)
}
}
5 changes: 5 additions & 0 deletions benchmark/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ android {
}
}

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

targetProjectPath = ":app"
experimentalProperties["android.experimental.self-instrumenting"] = true
}
Expand Down
16 changes: 0 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@Suppress("dsl_scope_violation")
plugins {
alias(libs.plugins.application) apply false
alias(libs.plugins.library) apply false
Expand All @@ -14,19 +13,4 @@ plugins {
alias(libs.plugins.spotless)
alias(libs.plugins.detekt)
alias(libs.plugins.palantir.git)
alias(libs.plugins.ben.manes.versions)
alias(libs.plugins.littlerobots.version.catalog.update)
}

/**
* https://github.com/littlerobots/version-catalog-update-plugin
* ./gradlew versionCatalogUpdate
*/
versionCatalogUpdate {
sortByKey.set(false)
keep {
keepUnusedVersions.set(true)
keepUnusedLibraries.set(true)
keepUnusedPlugins.set(true)
}
}
1 change: 0 additions & 1 deletion core/ads/.gitignore

This file was deleted.

39 changes: 0 additions & 39 deletions core/ads/build.gradle.kts

This file was deleted.

2 changes: 0 additions & 2 deletions core/ads/src/main/AndroidManifest.xml

This file was deleted.

6 changes: 0 additions & 6 deletions core/ads/src/main/res/values/admob_config.xml

This file was deleted.

1 change: 1 addition & 0 deletions core/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ dependencies {
api(libs.timber)
implementation(libs.bundles.appcompat)
implementation(libs.firebase.crashlytics)
implementation(libs.firebase.messaging)
implementation(libs.androidx.startup.runtime)
implementation(libs.androidx.browser)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package org.michaelbel.movies.entities

const val TMDB_URL = "https://themoviedb.org"
const val TMDB_TERMS_OF_USE = "https://themoviedb.org/documentation/website/terms-of-use"
const val TMDB_PRIVACY_POLICY = "https://themoviedb.org/privacy-policy"
const val TMDB_REGISTER = "https://themoviedb.org/signup"
const val TMDB_RESET_PASSWORD = "https://themoviedb.org/reset-password"
const val TMDB_MOVIE_URL = "https://themoviedb.org/movie/%d"

val tmdbApiKey: String
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.michaelbel.movies.navigation.ktx

import android.os.Bundle
import androidx.navigation.NavDestination
import androidx.navigation.NavHostController

fun NavHostController.addOnDestinationChangedListener(
listener: (destination: NavDestination, arguments: Bundle?) -> Unit
) {
addOnDestinationChangedListener { _, destination, arguments ->
listener(destination, arguments)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import androidx.compose.material.icons.filled.MovieFilter
import androidx.compose.material.icons.outlined.AccountCircle
import androidx.compose.material.icons.outlined.ArrowBack
import androidx.compose.material.icons.outlined.Close
import androidx.compose.material.icons.outlined.ErrorOutline
import androidx.compose.material.icons.outlined.Info
import androidx.compose.material.icons.outlined.Language
import androidx.compose.material.icons.outlined.LocationOn
Expand All @@ -28,7 +27,6 @@ object MoviesIcons {
val ArrowBack = Icons.Outlined.ArrowBack
val Close = Icons.Outlined.Close
val Info = Icons.Outlined.Info
val Error = Icons.Outlined.ErrorOutline
val Language = Icons.Outlined.Language
val LocationOn = Icons.Outlined.LocationOn
val MovieFilter = Icons.Filled.MovieFilter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ fun AccountRoute(
loading = viewModel.loading,
onBackClick = onBackClick,
onLogoutClick = {
viewModel.onLogoutClick {
onBackClick()
}
viewModel.onLogoutClick(onBackClick)
},
modifier = modifier
)
Expand Down Expand Up @@ -177,7 +175,7 @@ internal fun AccountScreenContent(
)
} else {
Text(
text = stringResource(R.string.account_logout).uppercase(),
text = stringResource(R.string.account_logout),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.michaelbel.movies.auth

import org.michaelbel.movies.navigation.MoviesNavigationDestination

internal object AccountDestination: MoviesNavigationDestination {

override val route: String = "account"

override val destination: String = "account"
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
package org.michaelbel.movies.auth

import androidx.compose.ui.window.DialogProperties
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.dialog
import org.michaelbel.movies.account.ui.AccountRoute
import org.michaelbel.movies.navigation.MoviesNavigationDestination

object AccountDestination: MoviesNavigationDestination {

override val route: String = "account"

override val destination: String = "account"
fun NavController.navigateToAccount() {
navigate(AccountDestination.route)
}

fun NavGraphBuilder.accountGraph(
onBackClick: () -> Unit
navigateBack: () -> Unit
) {
dialog(
route = AccountDestination.route,
Expand All @@ -23,7 +20,7 @@ fun NavGraphBuilder.accountGraph(
)
) {
AccountRoute(
onBackClick = onBackClick
onBackClick = navigateBack
)
}
}
Loading

0 comments on commit d089eca

Please sign in to comment.