Skip to content

Commit a035ae2

Browse files
committed
migrate to navigation-animation, update deps closes #48 closes #53
* Update sandbox instructions * Update kotlin to 1.5.30 * Update compose to 1.1.0-alpha04 * Update lifecycle to 2.4.0-beta01 * Update activity to 1.3.1 * Replace "use experimental" with "opt in" per depreciation * Update Turbine to 0.6.1 * Add LeakCanary * Update accompanist-insets to 0.18.0 * Update coroutines to 1.5.2 * Update AGP to 7.1.0-alpha12
1 parent 6397c6f commit a035ae2

32 files changed

Lines changed: 789 additions & 442 deletions

README.md

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
![yaba logo](./assets/yaba.png)
2+
[![yaba](https://img.shields.io/badge/MAD-Score-green)](https://madscorecard.withgoogle.com/scorecards/117769992/)
23

34
# yaba (yet another budgeting app)
5+
46
![yaba logo](./assets/dark.gif) ![yaba logo](./assets/light.gif)
57

68
## Kotlin Multiplatform Mobile
@@ -9,10 +11,11 @@
911

1012
#### An app which uses Plaid's APIs and allows users to track the balances and transactions for any financial institution they choose to link.
1113

12-
#### *This is a work in progress and for now, only the Android app is being developed as I am just starting to learn Swift.*
14+
#### *This is a work in progress and for now, only the Android app is being developed as I am just
15+
starting to learn Swift.*
1316

14-
The [backend](https://github.com/ruffCode/yaba-server) is using Plaid's sandbox API, so you can
15-
only get fake data.
17+
The [backend](https://github.com/ruffCode/yaba-server) is using Plaid's sandbox API, so you can only
18+
get fake data.
1619

1720
## Usage
1821

@@ -21,15 +24,17 @@ only get fake data.
2124
````shell script
2225
./gradlew installSandboxDebug
2326
````
27+
2428
Register with any email address you'd like, the format needs to be valid but nothing will be emailed
2529
to you.
2630

27-
####*You can also grab the latest signed APK from the releases tab.*####
31+
#### *You can also grab the latest signed APK from the releases tab.*####
2832

2933
### Linking financial institutions
3034

31-
When linking a financial institution use the sandbox credentials below. If prompted for an MFA method,
32-
choose any of them and enter 1234 for the code. Bank of America does prompt for MFA so take note when linking.
35+
When linking a financial institution use the sandbox credentials below. If prompted for an MFA
36+
method, choose any of them and enter 1234 for the code. Bank of America does prompt for MFA so take
37+
note when linking.
3338

3439
```
3540
username: custom_user1 or custom_user2
@@ -38,25 +43,33 @@ pin: credential_good (when required)
3843
MFA code: 1234 (when required)
3944
```
4045

46+
*With some institutions, Chase being one, the above credentials will not work, use the following:*
47+
48+
```
49+
username: user_good
50+
password: pass_good
51+
```
52+
4153
Please see [Plaid sandbox test credentials](https://plaid.com/docs/sandbox/test-credentials/) for
4254
MFA credentials if the institution you are attempting to link requires them.
4355

4456
### Using a local server
4557

46-
* Clone or fork the backend from [https://github.com/ruffCode/yaba-server](https://github.com/ruffCode/yaba-server)
47-
* Enable staging build type by uncommenting "localServerUrl" in `gradle.properties` and insert the url of your local
48-
instance
49-
* If using an insecure host, change the domain value in `staging/res/xms/network-security-config.xml`
58+
* Clone or fork the backend
59+
from [https://github.com/ruffCode/yaba-server](https://github.com/ruffCode/yaba-server)
60+
* Enable staging build type by uncommenting "localServerUrl" in `gradle.properties` and insert the
61+
url of your local instance
62+
* If using an insecure host, change the domain value
63+
in `staging/res/xms/network-security-config.xml`
5064
* Install ```./gradlew installSandboxStaging ```
5165

52-
5366
## Prior Art
5467

5568
### [tivi by Chris Banes](https://github.com/chisbanes/tivi)
5669

5770
This project is a great example of how to build a large and stable project. I was greatly inspired
58-
by Chris' state management technique and do use some of his code, including Flow extensions, observers
59-
and interactors. Credit is given where used.
71+
by Chris' state management technique and do use some of his code, including Flow extensions,
72+
observers and interactors. Credit is given where used.
6073

6174
### [KaMPKit by Touchlab](https://github.com/touchlab/KaMPKit)
6275

androidApp/build.gradle.kts

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ plugins {
1010
id("io.sentry.android.gradle") version "2.1.4"
1111
}
1212

13+
1314
val hasReleaseKey: Boolean = project.rootProject.file("release/yaba-release.jks").exists()
1415

1516
dependencies {
1617

1718
implementation(projects.data)
18-
implementation("androidx.core:core-ktx:1.7.0-alpha02")
19+
// implementation("androidx.core:core-ktx:1.7.0-beta01")
1920
implementation("com.google.android.material:material:1.4.0")
2021
implementation(Lib.Compose.animation)
2122
implementation(Lib.Compose.foundation)
@@ -30,17 +31,20 @@ dependencies {
3031
implementation(platform(Lib.KotlinX.Coroutines.bom))
3132
implementation(Lib.KotlinX.Coroutines.core)
3233
implementation(Lib.KotlinX.Coroutines.android)
33-
implementation(Lib.Koin.core)
34+
3435
implementation(Lib.Koin.android)
3536
implementation(Lib.Koin.compose)
3637
implementation(Lib.kermit)
3738
implementation(Lib.KotlinX.dateTime)
3839
implementation(Lib.KotlinX.Serialization.json)
39-
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.0-alpha03")
40+
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.0-beta01")
41+
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0-beta01")
42+
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.4.0-beta01")
4043
implementation("androidx.activity:activity-compose:1.3.1")
41-
//2.4.0-alpha05 uses crossfade by default and breaks the app
42-
implementation("androidx.navigation:navigation-compose:2.4.0-alpha04")
43-
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07")
44+
45+
implementation(Lib.Accompanist.navigationAnimation)
46+
47+
implementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:2.4.0-beta01")
4448
implementation("androidx.constraintlayout:constraintlayout-compose:1.0.0-beta02")
4549
implementation("androidx.core:core-splashscreen:1.0.0-alpha01")
4650
implementation("com.plaid.link:sdk-core:3.5.1")
@@ -72,6 +76,8 @@ dependencies {
7276
testImplementation(Lib.AndroidXTest.robolectric)
7377
testImplementation(Lib.AndroidXTest.mockito)
7478
testImplementation(Lib.KotlinX.Coroutines.test)
79+
debugImplementation(Lib.leakCanary)
80+
implementation(Lib.logCat)
7581
}
7682

7783
android {
@@ -165,17 +171,18 @@ android {
165171
freeCompilerArgs = freeCompilerArgs + listOf(
166172
"-Xopt-in=kotlin.RequiresOptIn",
167173
"-Xskip-prerelease-check",
168-
"-Xuse-experimental=kotlin.Experimental",
169-
"-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi",
170-
"-Xuse-experimental=kotlinx.coroutines.FlowPreview",
171-
"-Xuse-experimental=kotlin.ExperimentalStdlibApi",
172-
"-Xuse-experimental=androidx.compose.foundation.ExperimentalFoundationApi",
173-
"-Xuse-experimental=androidx.compose.material.ExperimentalMaterialApi",
174-
"-Xuse-experimental=androidx.compose.animation.ExperimentalAnimationApi",
175-
"-Xuse-experimental=kotlin.time.ExperimentalTime",
176-
"-Xuse-experimental=androidx.compose.ui.ExperimentalComposeUiApi",
177-
"-Xuse-experimental=org.koin.core.KoinExperimentalAPI",
178-
"-Xuse-experimental=coil.annotation.ExperimentalCoilApi"
174+
"-Xopt-in=kotlin.Experimental",
175+
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
176+
"-Xopt-in=kotlinx.coroutines.FlowPreview",
177+
"-Xopt-in=kotlin.ExperimentalStdlibApi",
178+
"-Xopt-in=androidx.compose.foundation.ExperimentalFoundationApi",
179+
"-Xopt-in=androidx.compose.material.ExperimentalMaterialApi",
180+
"-Xopt-in=androidx.compose.animation.ExperimentalAnimationApi",
181+
"-Xopt-in=kotlin.time.ExperimentalTime",
182+
"-Xopt-in=androidx.compose.ui.ExperimentalComposeUiApi",
183+
"-Xopt-in=org.koin.core.KoinExperimentalAPI",
184+
"-Xopt-in=coil.annotation.ExperimentalCoilApi",
185+
"-Xopt-in=kotlinx.serialization.ExperimentalSerializationApi"
179186
)
180187
}
181188
packagingOptions {

androidApp/src/main/kotlin/tech/alexib/yaba/android/MainActivity.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@ import androidx.compose.runtime.staticCompositionLocalOf
2929
import androidx.compose.ui.graphics.Color
3030
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
3131
import androidx.core.view.WindowCompat
32-
import co.touchlab.kermit.Kermit
3332
import com.google.accompanist.insets.ProvideWindowInsets
3433
import com.google.accompanist.systemuicontroller.rememberSystemUiController
3534
import org.koin.core.component.KoinComponent
3635
import org.koin.core.component.inject
37-
import org.koin.core.parameter.parametersOf
3836
import org.koin.core.qualifier.named
3937
import tech.alexib.yaba.android.ui.MainAppLayout
4038
import tech.alexib.yaba.android.ui.theme.YabaTheme
@@ -52,7 +50,6 @@ val LocalIsSandBoxProvider = staticCompositionLocalOf<IsSandbox>() {
5250
class MainActivity : AppCompatActivity(), KoinComponent {
5351

5452
private val appSettings: AppSettings by inject()
55-
private val log: Kermit by inject { parametersOf("MainActivity") }
5653
private val isSandBox: Boolean by inject(named("isSandbox"))
5754

5855
@SuppressLint("SourceLockedOrientationActivity")

androidApp/src/main/kotlin/tech/alexib/yaba/android/MainApp.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import androidx.work.await
2323
import io.sentry.SentryLevel
2424
import io.sentry.android.core.SentryAndroid
2525
import kotlinx.coroutines.runBlocking
26+
import logcat.AndroidLogcatLogger
27+
import logcat.LogPriority
2628
import org.koin.android.ext.koin.androidContext
2729
import org.koin.androidx.workmanager.koin.workManagerFactory
2830
import org.koin.core.qualifier.named
@@ -57,7 +59,7 @@ class MainApp : Application() {
5759
workManagerFactory()
5860
modules(createAppModule(serverUrl, isSandbox), viewModelModule)
5961
}
60-
62+
AndroidLogcatLogger.installOnDebuggableApp(this, minPriority = LogPriority.VERBOSE)
6163
SentryAndroid.init(this) { options ->
6264
options.setBeforeSend { event, _ ->
6365
if (SentryLevel.DEBUG == event.level) {

androidApp/src/main/kotlin/tech/alexib/yaba/android/di/viewModelModule.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package tech.alexib.yaba.android.di
22

3+
import kotlinx.coroutines.Dispatchers
34
import org.koin.androidx.viewmodel.dsl.viewModel
5+
import org.koin.core.parameter.parametersOf
46
import org.koin.dsl.module
57
import tech.alexib.yaba.android.fcm.PushTokenManagerImpl
68
import tech.alexib.yaba.android.ui.accounts.AccountsScreenViewModel
@@ -24,15 +26,17 @@ val viewModelModule = module {
2426
viewModel { LoginScreenViewModel(get(), get()) }
2527
viewModel { RegisterScreenViewModel() }
2628
viewModel { SettingsScreenViewModel() }
27-
viewModel { PlaidLinkViewModel(get()) }
28-
viewModel { PlaidLinkResultScreenViewModel() }
29+
single { PlaidLinkViewModel(get()) }
30+
single {
31+
PlaidLinkResultScreenViewModel()
32+
}
2933
viewModel { BiometricSetupScreenViewModel() }
3034
viewModel { HomeViewModel() }
3135
viewModel { PlaidItemsScreenViewModel() }
32-
viewModel { PlaidItemDetailScreenViewModel() }
36+
viewModel { PlaidItemDetailScreenViewModel(get()) }
3337
viewModel { TransactionListScreenViewModel() }
34-
viewModel { TransactionDetailScreenViewModel() }
38+
viewModel { TransactionDetailScreenViewModel(get()) }
3539
single<PushTokenManager> { PushTokenManagerImpl() }
3640
viewModel { AccountsScreenViewModel() }
37-
viewModel { AccountDetailScreenViewModel() }
41+
viewModel { AccountDetailScreenViewModel(get(), get()) }
3842
}

0 commit comments

Comments
 (0)