Skip to content

Commit

Permalink
Merge pull request mutualmobile#35 from mutualmobile/praxis_slack
Browse files Browse the repository at this point in the history
added slack features as sample feature modules and fixed styling and problems with navigation
  • Loading branch information
anmolvermamm committed Feb 3, 2022
2 parents cf174a0 + 8ea325e commit 8c3cd6f
Show file tree
Hide file tree
Showing 194 changed files with 4,802 additions and 2,322 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Minimal Android CI Workflow

on:
push:
branches:
- master

jobs:
test:
name: Run Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Unit tests
run: bash ./gradlew test --stacktrace
build_apk:
name: Generate APK
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup JDK
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build APK
run: bash ./gradlew assembleRelease --stacktrace
- name: Upload APK
uses: actions/upload-artifact@v2
with:
name: build_release_apk
path: app/build/outputs/apk/release/app-release.apk
retention-days: 2
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Praxis
# Praxis
2022 Hit Refresh! Praxis now loves ❤️ Jetpack Compose

<div align="left">
Expand All @@ -12,14 +12,14 @@
This is a sample app written in Kotlin following clean architecture principles which fetches random jokes, trending Github repository and displays it.

The purpose of this app to showcase:
- Implementation of Jetpack Android Architecture components with Dagger Hilt and Data Binding to minimize boilerplate code.
- Implementation of an architecture that will support both XML and the new Compose.
- Implementation of Modular Multi Module Navigation Architecture.
- Performing background task with Kotlin Coroutines
- Implementation of Jetpack Android Architecture components with Dagger Hilt and Data Binding to minimize boilerplate code.
- Implementation of an architecture that will support both XML and the new Compose.
- Implementation of Modular Multi Module Navigation Architecture.
- Performing background task with Kotlin Coroutines

# Requirements
1. Android Studio : Arctic Fox | 2020.3.1 3.1 or higher
2. Android Emulator or Physical android device
2. Android Emulator or Physical android device

# Built With 🏗

Expand Down Expand Up @@ -51,18 +51,18 @@ The purpose of this app to showcase:

**Notes:** Mapping between response models and transformed models will happen via extension functions defined in transformed model file

# Hybrid Architecture ( XML + Compose )
# Hybrid Architecture ( XML + Compose )

Praxis now supports old XML and new Compose as well.
Praxis now supports old XML and new Compose as well.

<img src = "art/hybrid_arch.jpeg" />

### Conventions:
Files are suffixed with be defined Class types.
- ViewModels are suffixed with **VM**. Ex: `LoginVM`
- UseCases are suffixed with **UseCase**. Ex: `LoginUseCase`
- Sources are suffixed with **Source**. Ex: `LoginRemoteSource`, `LoginLocalSource`
- Repositories are suffixed with **Repo**. Ex: `LoginRepo`
- ViewModels are suffixed with **VM**. Ex: `LoginVM`
- UseCases are suffixed with **UseCase**. Ex: `LoginUseCase`
- Sources are suffixed with **Source**. Ex: `LoginRemoteSource`, `LoginLocalSource`
- Repositories are suffixed with **Repo**. Ex: `LoginRepo`

## Conclusion
This project can be used as a template for new apps.
Expand Down
66 changes: 54 additions & 12 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ plugins {
id("org.jlleitschuh.gradle.ktlint")
}

subprojects {
apply {
from("variants.gradle.kts")
}
}

// def preDexEnabled = "true" == System.getProperty("pre-dex", "true")

android {
Expand All @@ -30,6 +24,45 @@ android {
vectorDrawables.useSupportLibrary = true
}

signingConfigs {

getByName("debug") {
keyAlias = "praxis-debug"
keyPassword = "utherNiC"
storeFile = file("keystore/praxis-debug.jks")
storePassword = "uRgeSCIt"
}

create("release") {
keyAlias = "praxis-release"
keyPassword = "ITHOmptI"
storeFile = file("keystore/praxis-release.jks")
storePassword = "PoTHatHR"
}

}
buildTypes {
getByName("release") {
isDebuggable = false
versionNameSuffix = "-release"

isMinifyEnabled = true
isShrinkResources = true

proguardFiles(
getDefaultProguardFile("proguard-android.txt"), "proguard-common.txt",
"proguard-specific.txt"
)
signingConfig = signingConfigs.getByName("release")
}
getByName("debug") {
isDebuggable = true
versionNameSuffix = "-debug"
applicationIdSuffix = ".debug"
signingConfig = signingConfigs.getByName("debug")
}
}

buildFeatures {
dataBinding = true
}
Expand Down Expand Up @@ -65,8 +98,12 @@ kapt {
}

dependencies {
implementation(project(":ui-jokes"))
implementation(project(":ui-githubrepos"))
api(project(":ui-onboarding"))
api(project(":ui-dashboard"))
api(project(":ui-chat"))
api(project(":ui-jokes"))
api(project(":ui-authentication"))


implementation(project(":navigator"))
implementation(project(":data"))
Expand All @@ -81,13 +118,11 @@ dependencies {
implementation(Lib.Android.MATERIAL_DESIGN)
implementation(Lib.Android.CONSTRAINT_LAYOUT_COMPOSE)
implementation(Lib.Android.ACCOMPANIST_INSETS)
implementation(Lib.Android.SPLASH_SCREEN_API)

implementation(Lib.Android.APP_COMPAT)
implementation(Lib.Android.NAVIGATION_FRAGMENT)
implementation(Lib.Kotlin.KTX_CORE)

/* SplashScreen */
implementation(Lib.Android.SPLASH_SCREEN_API)
implementation(Lib.Kotlin.KTX_CORE)

/*DI*/
implementation(Lib.Di.hilt)
Expand All @@ -103,6 +138,13 @@ dependencies {
implementation(Lib.Async.COROUTINES)
implementation(Lib.Async.COROUTINES_ANDROID)

/* Room */
implementation(Lib.Room.roomRuntime)
kapt(Lib.Room.roomCompiler)
implementation(Lib.Room.roomKtx)
implementation(Lib.Room.roomPaging)


/*Testing*/
testImplementation(TestLib.JUNIT)
testImplementation(TestLib.CORE_TEST)
Expand Down
4 changes: 2 additions & 2 deletions app/proguard-common.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#MM Proguard Settings for Praxis
#MM Proguard Settings for PraxisClone
# this is an extension to the recommended settings for android
# provided in the default android proguard configuration
#
# This file should only be edited if Praxis requires base configuration changes
# This file should only be edited if PraxisClone requires base configuration changes
# please put project specific directives in proguard-specific.txt

# If your project uses WebView with JS, uncomment the following
Expand Down
2 changes: 1 addition & 1 deletion app/proguard-specific.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this is an extension to the recommended settings for android
# provide in proguard-android.pro
#
# It is also an extention to the proguard configuration of Praxis
# It is also an extention to the proguard configuration of PraxisClone
#
# Add proguard directives to this file if this project requires additional
# configuration
Expand Down
22 changes: 0 additions & 22 deletions app/signing.gradle.kts

This file was deleted.

11 changes: 6 additions & 5 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@
<uses-permission android:name="android.permission.INTERNET" />

<application
android:name=".PraxisApp"
android:usesCleartextTraffic="true"
android:name=".PraxisCloneApp"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Theme.App.SplashScreeTheme"
android:theme="@style/Theme.App.SplashScreenTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".root.MainActivity"
android:exported="true"
android:theme="@style/Theme.App.SplashScreeTheme" >
android:theme="@style/Theme.App.SplashScreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/mutualmobile/praxis/PraxisApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import dagger.hilt.android.HiltAndroidApp
import timber.log.Timber

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

override fun onCreate() {
super.onCreate()
Expand Down
11 changes: 2 additions & 9 deletions app/src/main/java/com/mutualmobile/praxis/di/NavigationModule.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.mutualmobile.praxis.di

import com.mutualmobile.praxis.navigator.ComposeNavigator
import com.mutualmobile.praxis.navigator.FragmentNavGraphNavigator
import com.mutualmobile.praxis.navigator.composenavigator.PraxisComposeNavigator
import com.mutualmobile.praxis.navigator.fragmentnavigator.PraxisFragmentNavGraphNavigator
import com.mutualmobile.praxis.navigator.composenavigator.PraxisCloneComposeNavigator
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
Expand All @@ -16,10 +14,5 @@ abstract class NavigationModule {

@Binds
@Singleton
abstract fun provideComposeNavigator(praxisComposeNavigator: PraxisComposeNavigator): ComposeNavigator


@Binds
@Singleton
abstract fun provideFragmentNavGraphNavigator(praxisFragmentNavGraphNavigator: PraxisFragmentNavGraphNavigator): FragmentNavGraphNavigator
abstract fun provideComposeNavigator(praxisComposeNavigator: PraxisCloneComposeNavigator): ComposeNavigator
}
48 changes: 38 additions & 10 deletions app/src/main/java/com/mutualmobile/praxis/root/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,30 +1,58 @@
package com.mutualmobile.praxis.root

import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.runtime.LaunchedEffect
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.WindowCompat
import androidx.databinding.DataBindingUtil
import com.mutualmobile.praxis.R
import com.mutualmobile.praxis.databinding.ActivityMainBinding
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.rememberNavController
import com.google.accompanist.insets.ProvideWindowInsets
import com.mutualmobile.feat.jokes.nav.jokesNavGraph
import dagger.hilt.android.AndroidEntryPoint
import com.mutualmobile.praxis.navigator.ComposeNavigator
import com.mutualmobile.praxis.navigator.PraxisRoute
import com.mutualmobile.praxis.uidashboard.nav.dashboardNavigation
import com.mutualmobile.praxis.uionboarding.nav.onboardingNavigation
import com.praxis.feat.authentication.nav.authNavGraph
import javax.inject.Inject

@AndroidEntryPoint
class MainActivity : AppCompatActivity() {

private lateinit var binding: ActivityMainBinding
@Inject
lateinit var composeNavigator: ComposeNavigator

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

// Installing the Splash Screen here
installSplashScreen()
setContent {
val navController = rememberNavController()

LaunchedEffect(Unit) {
composeNavigator.handleNavigationCommands(navController)
}

ProvideWindowInsets(windowInsetsAnimationsEnabled = true) {
NavHost(
navController = navController,
startDestination = PraxisRoute.OnBoarding.name,
) {
onboardingNavigation(
composeNavigator = composeNavigator,
)
dashboardNavigation(
composeNavigator = composeNavigator
)
authNavGraph()
jokesNavGraph()
}
}

// Displaying edge-to-edge
// Turn off the decor fitting system windows, which allows us to handle insets, including IME animations
// This app draws behind the system bars, so we want to handle fitting system windows
WindowCompat.setDecorFitsSystemWindows(window, false)
binding = DataBindingUtil.setContentView(this, R.layout.activity_main)

}
}
}
Loading

0 comments on commit 8c3cd6f

Please sign in to comment.