Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ render.experimental.xml
*.keystore

# Google Services (e.g. APIs or Firebase)
google-services.json
app/google-services.json

# Android Profiling
*.hprof
Expand Down
47 changes: 20 additions & 27 deletions app/android.gradle
Original file line number Diff line number Diff line change
@@ -1,48 +1,41 @@
def localProperties = new Properties()
localProperties.load(new FileInputStream(rootProject.file("local.properties")))
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localProperties.load(new FileInputStream(localPropertiesFile))
}

android {
namespace 'com.movableink.app'
compileSdk findProperty("compileSdkVersion") as Integer
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
}
namespace = 'com.movableink.app'
compileSdk = findProperty("compileSdkVersion") as Integer
buildTypes {
release {
minifyEnabled false
minifyEnabled = false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug{
minifyEnabled false
debug {
minifyEnabled = false
}
}
defaultConfig {
applicationId findProperty("applicationId")
minSdkVersion findProperty("minSdkVersion") as Integer
targetSdkVersion findProperty("targetSdkVersion")
versionCode findProperty("versionCode") as Integer
versionName findProperty("versionName")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders ["MOVABLE_INK_SDK_API_KEY"] = localProperties['MOVABLE_INK_SDK_API_KEY']
applicationId = findProperty("applicationId")
minSdk = findProperty("minSdkVersion") as Integer
targetSdk = findProperty("targetSdkVersion") as Integer
versionCode = findProperty("versionCode") as Integer
versionName = findProperty("versionName")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
manifestPlaceholders["MOVABLE_INK_SDK_API_KEY"] = localProperties['MOVABLE_INK_SDK_API_KEY'] ?: ""
vectorDrawables.useSupportLibrary = true




}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
compose = true
}
packagingOptions {
packaging {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}
11 changes: 5 additions & 6 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("com.android.application")
kotlin("android")
kotlin("plugin.compose")
id("com.google.gms.google-services")
}

apply(from = "android.gradle")

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions.jvmTarget = "1.8"
}
@Suppress("DSL_SCOPE_VIOLATION")

dependencies {
// Compose BOM
implementation(platform(libs.compose.bom))

implementation(platform(libs.firebase.bom))
implementation(libs.firebase.auth)
implementation(libs.firebase.analytics)
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission
android:name="android.permission.POST_NOTIFICATIONS"
tools:node="remove" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<application
android:name=".App"
Expand Down Expand Up @@ -96,6 +94,7 @@

<data
android:scheme="miapp"
android:host="app"
android:pathPrefix="/product" />
</intent-filter>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/movableink/app/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class App : Application() {
super.onCreate()
MIClient.start()
MIClient.registerDeeplinkDomains(
listOf("afra.io"),
listOf("afra.io")
)
MIClient.appInstallEventEnabled(true)
FirebaseApp.initializeApp(this)
Expand Down
21 changes: 8 additions & 13 deletions app/src/main/java/com/movableink/app/AppState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,18 @@ fun rememberAppState(
navController: NavHostController = rememberNavController(),
snackBarManager: SnackbarManager = SnackbarManager,
resources: Resources = resources(),
coroutineScope: CoroutineScope = rememberCoroutineScope(),
) =
remember(scaffoldState, navController, snackBarManager, resources, coroutineScope) {
AppState(scaffoldState, navController, snackBarManager, resources, coroutineScope)
}
coroutineScope: CoroutineScope = rememberCoroutineScope()
) = remember(scaffoldState, navController, snackBarManager, resources, coroutineScope) {
AppState(scaffoldState, navController, snackBarManager, resources, coroutineScope)
}

@Stable
class AppState(
val scaffoldState: ScaffoldState,
val navController: NavHostController,
private val snackbarManager: SnackbarManager,
private val resources: Resources,
coroutineScope: CoroutineScope,
coroutineScope: CoroutineScope
) {
init {
coroutineScope.launch {
Expand Down Expand Up @@ -94,10 +93,7 @@ class AppState(
}
}

fun navigateToCategories(
gender: String,
from: NavBackStackEntry,
) {
fun navigateToCategories(gender: String, from: NavBackStackEntry) {
if (from.lifecycleIsResumed()) {
navController.navigate("${MainDestinations.CATEGORIES_ROUTE}/$gender")
}
Expand Down Expand Up @@ -127,9 +123,8 @@ private fun NavBackStackEntry.lifecycleIsResumed() = this.lifecycle.currentState
private val NavGraph.startDestination: NavDestination?
get() = findNode(startDestinationId)

private tailrec fun findStartDestination(graph: NavDestination): NavDestination {
return if (graph is NavGraph) findStartDestination(graph.startDestination!!) else graph
}
private tailrec fun findStartDestination(graph: NavDestination): NavDestination =
if (graph is NavGraph) findStartDestination(graph.startDestination!!) else graph

@Composable
@ReadOnlyComposable
Expand Down
38 changes: 0 additions & 38 deletions app/src/main/java/com/movableink/app/BrazeListener.kt

This file was deleted.

4 changes: 2 additions & 2 deletions app/src/main/java/com/movableink/app/DeeplinkMapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fun deepLinkToProductPage(url: String, context: Context, scheme: Scheme = Scheme
Intent.ACTION_VIEW,
"${DeepLinkPattern.baseDestination}/$productId".toUri(),
context,
MainActivity::class.java,
MainActivity::class.java
).apply {
flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP
}
Expand Down Expand Up @@ -65,5 +65,5 @@ fun urlScheme(urlString: String): Scheme {
enum class Scheme {
INTERNAL,
GLOBAL,
OTHER,
OTHER
}
3 changes: 1 addition & 2 deletions app/src/main/java/com/movableink/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ private const val TAG = "MainActivity "
class MainActivity : ComponentActivity() {
private val requestPermissionLauncher =
registerForActivityResult(
ActivityResultContracts.RequestPermission(),
ActivityResultContracts.RequestPermission()
) { isGranted: Boolean ->
if (isGranted) {
// FCM SDK (and your app) can post notifications.
Expand Down Expand Up @@ -53,7 +53,6 @@ class MainActivity : ComponentActivity() {
super.onWindowFocusChanged(hasFocus)
}


private fun fetchClickableLink() {
MIClient.checkPasteboardOnInstall { resolvedLink ->
try {
Expand Down
40 changes: 20 additions & 20 deletions app/src/main/java/com/movableink/app/ShoppingCartApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,23 @@ fun ShoppingCartApp() {
MovableBottomBar(
tabs = appState.bottomBarTabs,
currentRoute = appState.currentRoute!!,
navigateToRoute = appState::navigateToBottomBarRoute,
navigateToRoute = appState::navigateToBottomBarRoute
)
}
},
snackbarHost = {
SnackbarHost(
hostState = it,
modifier = Modifier.systemBarsPadding(),
snackbar = { snackbarData -> MovableSnackSnackBar(snackbarData) },
snackbar = { snackbarData -> MovableSnackSnackBar(snackbarData) }
)
},
scaffoldState = appState.scaffoldState,
scaffoldState = appState.scaffoldState
) { innerPaddingModifier ->
NavHost(
navController = appState.navController,
startDestination = MainDestinations.HOME_ROUTE,
modifier = Modifier.padding(innerPaddingModifier),
modifier = Modifier.padding(innerPaddingModifier)

) {
appNavGraph(
Expand All @@ -70,7 +70,7 @@ fun ShoppingCartApp() {
cartViewModel = cartViewModel,
navigateToCart = appState::navigateToCart,
homeViewModel = homeViewModel,
searchViewModel = searchViewModel,
searchViewModel = searchViewModel
)
}
}
Expand All @@ -85,37 +85,37 @@ private fun NavGraphBuilder.appNavGraph(
cartViewModel: CartViewModel,
navigateToCart: () -> Unit,
homeViewModel: HomeViewModel,
searchViewModel: SearchViewModel,
searchViewModel: SearchViewModel
) {
navigation(
route = MainDestinations.HOME_ROUTE,
startDestination = HomeSections.HOME.route,
startDestination = HomeSections.HOME.route
) {
addHomeGraph(
onGenderSelected,
onSearchBarClick,
cartViewModel = cartViewModel,
homeViewModel = homeViewModel,
searchViewModel = searchViewModel,
navigateToProductDetail = navigateToProductDetail,
navigateToProductDetail = navigateToProductDetail
)
}
composable(
route = "${MainDestinations.CATEGORIES_ROUTE}/{${MainDestinations.SELECTED_GENDER}}",
arguments = listOf(navArgument(MainDestinations.SELECTED_GENDER) { type = NavType.StringType }),
arguments = listOf(navArgument(MainDestinations.SELECTED_GENDER) { type = NavType.StringType })
) {
CategoryScreen(
onCategoryClick = onCategoryClick,
upPress,
homeViewModel,
homeViewModel
)
}
composable(
route = "${MainDestinations.CATALOG_ROUTE}/{${MainDestinations.SELECTED_CATEGORY}}/{${MainDestinations.SELECTED_GENDER}}",
arguments = listOf(
navArgument(MainDestinations.SELECTED_GENDER) { type = NavType.StringType },
navArgument(MainDestinations.SELECTED_CATEGORY) { type = NavType.StringType },
),
navArgument(MainDestinations.SELECTED_CATEGORY) { type = NavType.StringType }
)
) { backStackEntry ->
val arguments = requireNotNull(backStackEntry.arguments)
val selectedCategory = arguments.getString(MainDestinations.SELECTED_CATEGORY)
Expand All @@ -125,25 +125,25 @@ private fun NavGraphBuilder.appNavGraph(
upPress,
cartViewModel,
onViewCart = navigateToCart,
homeViewModel,
homeViewModel
)
}

composable(
route = "${MainDestinations.PRODUCT_DETAIL_ROUTE}/{${MainDestinations.PRODUCT_ID}}",
arguments = listOf(
navArgument(MainDestinations.PRODUCT_ID) { type = NavType.StringType },
),
navArgument(MainDestinations.PRODUCT_ID) { type = NavType.StringType }
)
) {
ProductDetailScreen(
popBackStack = upPress,
cartViewModel,
homeViewModel,
homeViewModel
)
}
composable(
route = MainDestinations.PRODUCT_DETAIL_ROUTE,
deepLinks = listOf(navDeepLink { uriPattern = "$baseDestination/{productId}" }),
deepLinks = listOf(navDeepLink { uriPattern = "$baseDestination/{productId}" })
) { backStackEntry ->
val arguments = requireNotNull(backStackEntry.arguments)
val selectedCategory = arguments.getString(MainDestinations.SELECTED_CATEGORY)
Expand All @@ -152,17 +152,17 @@ private fun NavGraphBuilder.appNavGraph(
ProductDetailScreen(
popBackStack = upPress,
cartViewModel,
homeViewModel,
homeViewModel
)
}
composable(
route = MainDestinations.SEARCH_UI_ROUTE,
route = MainDestinations.SEARCH_UI_ROUTE
) {
SearchView(
onBackClicked = upPress,
searchViewModel,
navigateToProductDetail,
homeViewModel,
homeViewModel
)
}
}
Loading