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

Feat/dynamic feature #47

Open
wants to merge 4 commits into
base: baseproject
Choose a base branch
from
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
3 changes: 2 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ plugins {

android {
compileSdk = (AppVersions.COMPILE_SDK)

namespace = "com.mutualmobile.praxis"
defaultConfig {
applicationId = (AppVersions.APPLICATION_ID)
minSdk = (AppVersions.MIN_SDK)
Expand Down Expand Up @@ -100,6 +100,7 @@ android {
kotlinOptions {
jvmTarget = "1.8"
}
dynamicFeatures += setOf(":sample")
}

// Required for annotation processing plugins like Dagger
Expand Down
1 change: 1 addition & 0 deletions app/proguard-common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
-dontwarn android.webkit.WebView
-dontwarn android.net.http.SslError
-dontwarn android.webkit.WebViewClient
-dontwarn org.slf4j.impl.StaticLoggerBinder

#This will print mappings - very useful for troubleshooting.
-dump ./build/class_files.txt
Expand Down
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
#}
9 changes: 1 addition & 8 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.mutualmobile.praxis">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />

Expand All @@ -24,12 +23,6 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity-alias
android:name="leakcanary.internal.activity.LeakLauncherActivity"
android:exported="true"
android:targetActivity="leakcanary.internal.activity.LeakActivity"
tools:node="merge" />
</application>

</manifest>
4 changes: 2 additions & 2 deletions app/src/main/java/com/mutualmobile/praxis/PraxisApp.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.mutualmobile.praxis

import android.app.Application
import com.google.android.play.core.splitcompat.SplitCompatApplication
import dagger.hilt.android.HiltAndroidApp
import timber.log.Timber

@HiltAndroidApp
class PraxisCloneApp : Application() {
class PraxisCloneApp : SplitCompatApplication() {

override fun onCreate() {
super.onCreate()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.mutualmobile.praxis.root

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.google.android.play.core.splitcompat.SplitCompat

abstract class BaseSplitActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
SplitCompat.installActivity(this)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.mutualmobile.praxis.root
import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.compose.runtime.LaunchedEffect
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.WindowCompat
Expand All @@ -24,6 +25,7 @@ class OnboardingActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
WindowCompat.setDecorFitsSystemWindows(window, false)

installSplashScreen()
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
<string name="downloading_glue">Downloading %d bytes</string>
<string name="except_no_network">No network available!</string>
<string name="except_generic">Some error occurred</string>
<string name="title_sample">Sample</string>
</resources>
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
classpath(BuildPlugins.KOTLIN_GRADLE_PLUGIN)
classpath(kotlin("serialization", version = Lib.Kotlin.KOTLIN_VERSION))
classpath(BuildPlugins.KTLINT_GRADLE_PLUGIN)
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
classpath("com.android.tools.build:gradle:8.0.0-alpha08")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/AppVersions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ object AppVersions {
const val versionCode = versionMajor * 10000 + versionMinor * 100 + versionPatch
const val versionName = "$versionMajor.$versionMinor.$versionPatch"

const val COMPILE_SDK = 31
const val MIN_SDK = 21
const val TARGET_SDK = 31
const val COMPILE_SDK = 32
const val MIN_SDK = 24
const val TARGET_SDK = 32
const val APPLICATION_ID = "com.mutualmobile.praxis"
}
11 changes: 6 additions & 5 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
object BuildPlugins {
private const val TOOLS_BUILD = "7.1.1"
private const val KT_LINT = "9.2.1"
private const val SAFE_ARGS = "2.3.5"
private const val SAFE_ARGS = "2.5.0"

const val TOOLS_BUILD_GRADLE = "com.android.tools.build:gradle:${TOOLS_BUILD}"
const val KTLINT_GRADLE_PLUGIN = "org.jlleitschuh.gradle:ktlint-gradle:${KT_LINT}"
Expand All @@ -26,7 +26,7 @@ object Lib {
const val KOTLIN_VERSION = "1.6.0"
private const val KTX_CORE_VERSION = "1.2.0"
const val KT_STD = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${KOTLIN_VERSION}"
private const val KTX_CORE = "androidx.core:core-ktx:${KTX_CORE_VERSION}"
const val KTX_CORE = "androidx.core:core-ktx:${KTX_CORE_VERSION}"
private const val DATE_TIME = "org.jetbrains.kotlinx:kotlinx-datetime:0.3.2"

const val COROUTINES = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${KOTLIN_VERSION}"
Expand All @@ -38,18 +38,19 @@ object Lib {

object Google {
const val MATERIAL_DESIGN = "com.google.android.material:material:1.4.0"

const val PLAY_FEATURE_DELIVERY = "com.google.android.play:feature-delivery-ktx:2.0.1"
val list = listOf(
MATERIAL_DESIGN,
PLAY_FEATURE_DELIVERY
)

}

object Androidx {
// Compose
const val composeVersion = "1.1.0"
const val composeVersion = "1.2.0-rc02"
private const val SPLASH_SCREEN_API = "androidx.core:core-splashscreen:1.0.0-beta01"
private const val APP_COMPAT = "androidx.appcompat:appcompat:1.3.0-beta01"
const val APP_COMPAT = "androidx.appcompat:appcompat:1.4.1"

val list = listOf(
APP_COMPAT,
Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {

android {
compileSdk = AppVersions.COMPILE_SDK

namespace = "com.mutualmobile.praxis.common"
defaultConfig {
minSdk = (AppVersions.MIN_SDK)
targetSdk = (AppVersions.TARGET_SDK)
Expand Down
2 changes: 1 addition & 1 deletion commonui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {

android {
compileSdk = AppVersions.COMPILE_SDK

namespace = "com.mutualmobile.praxis.commonui"
defaultConfig {
minSdk = (AppVersions.MIN_SDK)
targetSdk = (AppVersions.TARGET_SDK)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import androidx.compose.ui.unit.dp
import com.mutualmobile.praxis.commonui.theme.PraxisColorProvider
import com.mutualmobile.praxis.commonui.theme.PraxisTypography

@OptIn(ExperimentalMaterialApi::class)
@Composable
fun PraxisListItem(
icon: ImageVector,
Expand Down
2 changes: 1 addition & 1 deletion data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {

android {
compileSdk = AppVersions.COMPILE_SDK

namespace = "com.mutualmobile.praxis.data"
defaultConfig {
minSdk = (AppVersions.MIN_SDK)
targetSdk = (AppVersions.TARGET_SDK)
Expand Down
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Jan 27 08:55:19 IST 2022
#Thu Nov 24 14:31:41 IST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion navigator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {

android {
compileSdk = AppVersions.COMPILE_SDK

namespace = "com.mutualmobile.praxis.navigator"
defaultConfig {
minSdk = (AppVersions.MIN_SDK)
targetSdk = (AppVersions.TARGET_SDK)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ abstract class ComposeNavigator : Navigator() {
is ComposeNavigationCommand.NavigateUpWithResult<*> -> {
navUpWithResult(navigationCommand)
}
else -> {
throw RuntimeException("can't handle this with ComposeNavigator")
}
}
}

Expand Down
1 change: 1 addition & 0 deletions sample/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
25 changes: 25 additions & 0 deletions sample/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
plugins {
id("com.android.dynamic-feature")
id("org.jetbrains.kotlin.android")
}
android {
namespace = "com.mutualmobile.praxis.sample"
compileSdk = (AppVersions.COMPILE_SDK)

defaultConfig {
minSdk = (AppVersions.MIN_SDK)
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
}

dependencies {
implementation(project(":app"))
implementation(Lib.Kotlin.KTX_CORE)
implementation("com.google.android.material:material:1.4.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.4")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0")
androidTestImplementation("androidx.annotation:annotation:1.5.0")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.mutualmobile.praxis

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.mutualmobile.praxis", appContext.packageName)
}
}
27 changes: 27 additions & 0 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:dist="http://schemas.android.com/apk/distribution">

<dist:module
dist:instant="false"
dist:title="@string/title_sample">
<dist:delivery>
<dist:on-demand />
</dist:delivery>

<dist:fusing dist:include="true" />
</dist:module>

<application
android:hasCode="true"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".SampleActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.mutualmobile.praxis.sample

import android.os.Bundle
import com.mutualmobile.praxis.root.BaseSplitActivity

class SampleActivity : BaseSplitActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_sample)
}
}
9 changes: 9 additions & 0 deletions sample/src/main/res/layout/activity_sample.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".sample.SampleActivity">

</androidx.constraintlayout.widget.ConstraintLayout>
17 changes: 17 additions & 0 deletions sample/src/test/java/com/mutualmobile/praxis/ExampleUnitTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.mutualmobile.praxis

import org.junit.Test

import org.junit.Assert.*

/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ include(":common")
include(":commonui")
include(":navigator")

include(":sample")
4 changes: 1 addition & 3 deletions ui-authentication/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {

android {
compileSdk = AppVersions.COMPILE_SDK

namespace = "com.praxis.feat.authentication"
defaultConfig {
minSdk = (AppVersions.MIN_SDK)
targetSdk = (AppVersions.TARGET_SDK)
Expand Down Expand Up @@ -62,8 +62,6 @@ dependencies {
implementation(project(":navigator"))
implementation(project(":commonui"))



Lib.Androidx.list.forEach(::implementation)
Lib.Androidx.Compose.list.forEach(::implementation)
Lib.ThirdParty.list.forEach(::implementation)
Expand Down
Loading