Skip to content

Commit

Permalink
Phone & Google SignIn (#1)
Browse files Browse the repository at this point in the history
* Ui for signIn screen

* Ui for phone login screen

* Setup navigation

* git ignore

* Minor improvements

* Complete phone login hookup

* Complete google signIn hookup

* Minor refactoring

* Firestore hookup for auth

* Fix navigation

* Cleanup

* Intro screen color fixes

* Minor fixes

* Minor fixes

* Add Error banner

* Refactor auth viewmodel and add unit test

* Setup CI for test and lint check (#2)

* Add GitHub actions
  • Loading branch information
cp-radhika-s authored Jan 11, 2024
1 parent 17c3ff1 commit 5ae4916
Show file tree
Hide file tree
Showing 56 changed files with 2,992 additions and 288 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Android Build

on: [ push ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up JDK 17
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 17

- name: Retrieve the secret and decode it to a file
env:
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
DEBUG_KEYSTORE_BASE64: ${{ secrets.DEBUG_KEYSTORE_BASE64 }}

run: |
echo $GOOGLE_SERVICES_JSON_BASE64 | base64 -di > app/google-services.json
echo $DEBUG_KEYSTORE_BASE64 | base64 -di > app/debug.keystore
- name: Build with Gradle
run: ./gradlew build

- name: Run Tests with Gradle
run: ./gradlew test

- name: Run Lint check
run: ./gradlew ktlintCheck
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
*.iml
.gradle
.idea
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
Expand Down
16 changes: 0 additions & 16 deletions .idea/deploymentTargetDropDown.xml

This file was deleted.

19 changes: 0 additions & 19 deletions .idea/gradle.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/kotlinc.xml

This file was deleted.

4 changes: 3 additions & 1 deletion app/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/build
/build
debug.keystore
google-services.json
47 changes: 43 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ plugins {
id("org.jetbrains.kotlin.android")
id("com.google.dagger.hilt.android")
id("kotlin-kapt")
id("com.google.gms.google-services")
id("org.jlleitschuh.gradle.ktlint")
}

android {
Expand All @@ -22,15 +24,32 @@ android {
}
}

signingConfigs {
getByName("debug") {
keyAlias = "catchme"
keyPassword = "catchme"
storeFile = file("debug.keystore")
storePassword = "catchme"
}
}

buildTypes {
release {
isMinifyEnabled = false
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("debug")
}
debug {
isMinifyEnabled = false
isDebuggable = true
signingConfig = signingConfigs.getByName("debug")
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand All @@ -40,6 +59,7 @@ android {
}
buildFeatures {
compose = true
buildConfig = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.1"
Expand All @@ -49,36 +69,55 @@ android {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
ktlint {
debug = true
}
}

dependencies {

implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2")
implementation("androidx.activity:activity-compose:1.8.2")
implementation(platform("androidx.compose:compose-bom:2023.08.00"))
implementation(platform("androidx.compose:compose-bom:2023.10.01"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3")
implementation("androidx.navigation:navigation-compose:2.7.6")
implementation("androidx.hilt:hilt-navigation-compose:1.1.0")

// Test
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation(platform("androidx.compose:compose-bom:2023.08.00"))
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.1")
testImplementation("org.mockito.kotlin:mockito-kotlin:4.0.0")
testImplementation("org.mockito:mockito-inline:4.5.1")
testImplementation("org.mockito:mockito-core:5.7.0")

// Hilt
val hilt = "2.50"
implementation("com.google.dagger:hilt-android:$hilt")
kapt("com.google.dagger:hilt-compiler:$hilt")

//DataStore
// DataStore
implementation("androidx.datastore:datastore-preferences:1.0.0")

// Firebase
implementation(platform("com.google.firebase:firebase-bom:32.7.0"))
implementation("com.google.firebase:firebase-auth")
implementation("com.google.android.gms:play-services-auth:20.7.0")

// Timber
implementation("com.jakewharton.timber:timber:5.0.1")

// country-picker
implementation("com.canopas.jetcountrypicker:jetcountrypicker:1.0.9")

implementation(project(":data"))
}
}

This file was deleted.

1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<application
android:allowBackup="true"
android:name=".CatchMeApplication"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
Expand Down
14 changes: 14 additions & 0 deletions app/src/main/java/com/canopas/catchme/CatchMeApplication.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.canopas.catchme

import android.app.Application
import dagger.hilt.android.HiltAndroidApp
import timber.log.Timber

@HiltAndroidApp
class CatchMeApplication : Application() {

override fun onCreate() {
super.onCreate()
Timber.plant(Timber.DebugTree())
}
}
26 changes: 26 additions & 0 deletions app/src/main/java/com/canopas/catchme/di/AppDataProvider.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.canopas.catchme.di

import com.canopas.catchme.BuildConfig
import com.canopas.catchme.data.utils.AppDispatcher
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Named
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
class AppDataProvider {

@Provides
@Singleton
@Named("app_version_code")
fun provideAppVersionCode(): Long {
return BuildConfig.VERSION_CODE.toLong()
}

@Provides
@Singleton
fun provideAppDispatcher() = AppDispatcher()
}
26 changes: 4 additions & 22 deletions app/src/main/java/com/canopas/catchme/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,24 @@ import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.canopas.catchme.ui.flow.intro.IntroView
import com.canopas.catchme.ui.theme.CatchMeTheme
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
CatchMeTheme() {
CatchMeTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
IntroView()
MainApp()
}
}
}
}
}

@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
Text(
text = "Hello $name!",
modifier = modifier
)
}

@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
CatchMeTheme {
Greeting("Android")
}
}
Loading

0 comments on commit 5ae4916

Please sign in to comment.