├── .editorconfig
├── .gitignore
├── .lint
└── config.xml
├── CHANGELOG.md
├── LICENSE
├── Makefile
├── README.md
├── androidApp
├── build.gradle.kts
├── fake-google-services.json
├── google-services.json
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── kotlin
│ │ └── tech
│ │ └── alexib
│ │ └── yaba
│ │ └── android
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── ic_launcher-playstore.png
│ ├── kotlin
│ │ └── tech
│ │ │ └── alexib
│ │ │ └── yaba
│ │ │ └── android
│ │ │ ├── MainActivity.kt
│ │ │ ├── MainApp.kt
│ │ │ ├── di
│ │ │ └── viewModelModule.kt
│ │ │ ├── fcm
│ │ │ ├── FCMService.kt
│ │ │ └── PushTokenManagerImpl.kt
│ │ │ ├── navigation
│ │ │ └── AppNavigation.kt
│ │ │ ├── ui
│ │ │ ├── MainAppLayout.kt
│ │ │ ├── YabaBottomAppBar.kt
│ │ │ ├── accounts
│ │ │ │ ├── AccountsScreen.kt
│ │ │ │ ├── AccountsScreenAction.kt
│ │ │ │ ├── AccountsScreenViewModel.kt
│ │ │ │ └── detail
│ │ │ │ │ ├── AccountDetailScreen.kt
│ │ │ │ │ ├── AccountDetailScreenAction.kt
│ │ │ │ │ ├── AccountDetailScreenParams.kt
│ │ │ │ │ └── AccountDetailScreenViewModel.kt
│ │ │ ├── auth
│ │ │ │ ├── biometric
│ │ │ │ │ ├── BiometricSetupScreen.kt
│ │ │ │ │ ├── BiometricSetupScreenAction.kt
│ │ │ │ │ ├── BiometricSetupScreenState.kt
│ │ │ │ │ └── BiometricSetupScreenViewModel.kt
│ │ │ │ ├── components
│ │ │ │ │ ├── Password.kt
│ │ │ │ │ ├── Username.kt
│ │ │ │ │ └── Welcome.kt
│ │ │ │ ├── login
│ │ │ │ │ ├── Login.kt
│ │ │ │ │ └── LoginScreenViewModel.kt
│ │ │ │ ├── register
│ │ │ │ │ ├── Register.kt
│ │ │ │ │ └── RegisterScreenViewModel.kt
│ │ │ │ └── splash
│ │ │ │ │ └── SplashScreenViewModel.kt
│ │ │ ├── components.kt
│ │ │ ├── components
│ │ │ │ ├── BackArrowButton.kt
│ │ │ │ ├── BalanceRow.kt
│ │ │ │ ├── BankLogo.kt
│ │ │ │ ├── ErrorText.kt
│ │ │ │ ├── ExpandableContent.kt
│ │ │ │ ├── GenericDialog.kt
│ │ │ │ ├── LoadingScreen.kt
│ │ │ │ ├── Money.kt
│ │ │ │ ├── NoSpendingInSelectedRange.kt
│ │ │ │ ├── SlideInContent.kt
│ │ │ │ ├── SpendingWidget.kt
│ │ │ │ ├── TotalCashBalanceRow.kt
│ │ │ │ ├── TransactionItem.kt
│ │ │ │ ├── YabaCard.kt
│ │ │ │ ├── YabaLogo.kt
│ │ │ │ └── YabaRow.kt
│ │ │ ├── home
│ │ │ │ ├── Home.kt
│ │ │ │ └── HomeViewModel.kt
│ │ │ ├── plaid
│ │ │ │ ├── PlaidLinkHandler.kt
│ │ │ │ ├── PlaidLinkResultScreen.kt
│ │ │ │ ├── PlaidLinkResultScreenViewModel.kt
│ │ │ │ ├── PlaidLinkScreen.kt
│ │ │ │ └── PlaidLinkViewModel.kt
│ │ │ ├── settings
│ │ │ │ ├── SettingsScreen.kt
│ │ │ │ ├── SettingsScreenAction.kt
│ │ │ │ ├── SettingsScreenViewModel.kt
│ │ │ │ └── plaid_items
│ │ │ │ │ ├── PlaidItemDetailScreen.kt
│ │ │ │ │ ├── PlaidItemDetailScreenViewModel.kt
│ │ │ │ │ ├── PlaidItemsScreen.kt
│ │ │ │ │ ├── PlaidItemsScreenAction.kt
│ │ │ │ │ └── PlaidItemsScreenViewModel.kt
│ │ │ ├── theme
│ │ │ │ ├── Color.kt
│ │ │ │ ├── Margin.kt
│ │ │ │ ├── Shape.kt
│ │ │ │ ├── Theme.kt
│ │ │ │ └── Type.kt
│ │ │ └── transactions
│ │ │ │ ├── TransactionDetailScreen.kt
│ │ │ │ ├── TransactionDetailScreenAction.kt
│ │ │ │ ├── TransactionDetailScreenViewModel.kt
│ │ │ │ ├── TransactionListScreen.kt
│ │ │ │ └── TransactionListScreenViewModel.kt
│ │ │ └── util
│ │ │ ├── BackpressHandler.kt
│ │ │ ├── Flow.kt
│ │ │ ├── bitmap.kt
│ │ │ ├── navigation.kt
│ │ │ ├── notifications.kt
│ │ │ └── stringFormatters.kt
│ └── res
│ │ ├── drawable-mdpi
│ │ └── default_bank.png
│ │ ├── drawable
│ │ ├── ic_launcher_foreground.xml
│ │ ├── yaba_logo_blue.png
│ │ └── yaba_logo_foreground.xml
│ │ ├── font
│ │ ├── karla_bold.ttf
│ │ ├── karla_regular.ttf
│ │ ├── montserrat_light.ttf
│ │ ├── montserrat_medium.ttf
│ │ ├── montserrat_regular.ttf
│ │ └── montserrat_semibold.ttf
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── yaba_logo.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-night
│ │ ├── colors.xml
│ │ ├── flags.xml
│ │ └── themes.xml
│ │ ├── values
│ │ ├── colors.xml
│ │ ├── flags.xml
│ │ ├── ic_launcher_background.xml
│ │ ├── strings.xml
│ │ └── themes.xml
│ │ └── xml
│ │ └── network_security_config.xml
│ ├── sandbox
│ ├── AndroidManifest.xml
│ └── res
│ │ └── values
│ │ └── strings.xml
│ ├── staging
│ └── res
│ │ └── xml
│ │ └── network_security_config.xml
│ └── test
│ ├── kotlin
│ └── tech
│ │ └── alexib
│ │ └── yaba
│ │ └── android
│ │ ├── ExampleUnitTest.kt
│ │ └── FakeKeyStore.kt
│ └── resources
│ └── robolectric.properties
├── assets
├── dark.gif
├── light.gif
├── screens
│ ├── dark001.png
│ ├── dark002.png
│ ├── dark003.png
│ ├── dark004.png
│ ├── dark005.png
│ ├── dark006.png
│ ├── dark007.png
│ ├── dark008.png
│ ├── dark009.png
│ ├── dark010.png
│ ├── dark011.png
│ ├── light001.png
│ ├── light002.png
│ ├── light003.png
│ ├── light004.png
│ ├── light005.png
│ ├── light006.png
│ ├── light007.png
│ ├── light008.png
│ ├── light009.png
│ ├── light010.png
│ ├── light011.png
│ └── play
│ │ ├── dark001.png
│ │ ├── dark003.png
│ │ ├── dark005.png
│ │ ├── dark006.png
│ │ ├── dark007.png
│ │ ├── feature.png
│ │ ├── light001.png
│ │ ├── light003.png
│ │ ├── light005.png
│ │ ├── light006.png
│ │ └── light007.png
└── yaba.png
├── base
├── build.gradle.kts
└── src
│ ├── androidMain
│ ├── AndroidManifest.xml
│ └── kotlin
│ │ └── tech
│ │ └── alexib
│ │ └── yaba
│ │ └── util
│ │ └── androidTestUtil.kt
│ └── commonMain
│ └── kotlin
│ └── tech
│ └── alexib
│ └── yaba
│ ├── AppInfo.kt
│ ├── Interactor.kt
│ ├── di
│ └── koinCore.kt
│ ├── model
│ ├── Account.kt
│ ├── Institution.kt
│ ├── PlaidItem.kt
│ ├── RangeOption.kt
│ ├── Transaction.kt
│ ├── User.kt
│ ├── defaultLogoBase64.kt
│ ├── request
│ │ ├── PlaidItemCreateRequest.kt
│ │ ├── PlaidLinkEventCreateRequest.kt
│ │ ├── UserLoginInput.kt
│ │ └── UserRegisterInput.kt
│ └── response
│ │ ├── AuthResponse.kt
│ │ ├── AuthResult.kt
│ │ ├── CreateLinkTokenResponse.kt
│ │ ├── PlaidItemCreateResponse.kt
│ │ └── PlaidLinkResult.kt
│ ├── stubs
│ ├── AccountStubs.kt
│ ├── TransactionStubs.kt
│ ├── json
│ │ ├── accountsJson.kt
│ │ ├── transactionsChaseJson1.kt
│ │ ├── transactionsChaseJson2.kt
│ │ ├── transactionsChaseJson3.kt
│ │ ├── transactionsWellsJson1.kt
│ │ ├── transactionsWellsJson2.kt
│ │ └── userJson.kt
│ └── plaidItemWithAccountsStub.kt
│ └── util
│ ├── ObservableLoadingCounter.kt
│ ├── flow.kt
│ ├── koin.kt
│ ├── serializer.kt
│ └── testUtil.kt
├── build.gradle.kts
├── buildSrc
├── .gitignore
├── build.gradle.kts
├── buildSrc
│ ├── .gitignore
│ ├── build.gradle.kts
│ └── src
│ │ └── main
│ │ └── kotlin
│ │ ├── Deps.kt
│ │ └── YabaAndroidConfig.kt
└── src
│ └── main
│ └── kotlin
│ ├── android-base-convention.gradle.kts
│ ├── android-lib.gradle.kts
│ ├── base-convention.gradle.kts
│ ├── multiplatform-plugin.gradle.kts
│ ├── static-analysis.gradle.kts
│ └── util
│ └── properties.kt
├── config
└── detekt.yml
├── data
├── .gitignore
├── build.gradle.kts
├── db
│ ├── .gitignore
│ ├── build.gradle.kts
│ └── src
│ │ ├── androidMain
│ │ ├── AndroidManifest.xml
│ │ └── kotlin
│ │ │ └── tech
│ │ │ └── alexib
│ │ │ └── yaba
│ │ │ └── data
│ │ │ └── db
│ │ │ ├── DriverFactory.kt
│ │ │ └── di
│ │ │ └── koinAndroid.kt
│ │ └── commonMain
│ │ ├── kotlin
│ │ └── tech
│ │ │ └── alexib
│ │ │ └── yaba
│ │ │ └── data
│ │ │ └── db
│ │ │ ├── DriverFactory.kt
│ │ │ ├── YabaDatabase.kt
│ │ │ ├── dao
│ │ │ ├── AccountDao.kt
│ │ │ ├── InstitutionDao.kt
│ │ │ ├── ItemDao.kt
│ │ │ ├── TransactionDao.kt
│ │ │ └── UserDao.kt
│ │ │ ├── di
│ │ │ ├── dbModule.kt
│ │ │ └── koin.kt
│ │ │ ├── mapper
│ │ │ ├── AccountEntityMapper.kt
│ │ │ ├── InstitutionEntityMapper.kt
│ │ │ ├── ItemEntityMapper.kt
│ │ │ ├── TransactionEntityMapper.kt
│ │ │ └── UserEntityMapper.kt
│ │ │ └── util
│ │ │ ├── CoroutineExtensions.kt
│ │ │ └── adapters.kt
│ │ └── sqldelight
│ │ ├── databases
│ │ ├── 10.db
│ │ ├── 11.db
│ │ └── 12.db
│ │ ├── migrations
│ │ ├── 10.sqm
│ │ └── 11.sqm
│ │ └── tech
│ │ └── alexib
│ │ └── yaba
│ │ └── data
│ │ └── db
│ │ ├── Account.sq
│ │ ├── InstitutionEntity.sq
│ │ ├── ItemEntity.sq
│ │ ├── Transaction.sq
│ │ └── UserEntity.sq
├── domain
│ ├── .gitignore
│ ├── build.gradle.kts
│ └── src
│ │ ├── androidMain
│ │ └── AndroidManifest.xml
│ │ └── commonMain
│ │ └── kotlin
│ │ └── tech
│ │ └── alexib
│ │ └── yaba
│ │ └── data
│ │ └── domain
│ │ ├── AuthTokenProvider.kt
│ │ ├── DataResult.kt
│ │ └── dto
│ │ ├── AccountDto.kt
│ │ ├── AccountWithTransactionsDto.kt
│ │ ├── InstitutionDto.kt
│ │ ├── ItemDto.kt
│ │ ├── NewItemDto.kt
│ │ ├── TransactionDto.kt
│ │ ├── TransactionsUpdateDto.kt
│ │ └── UserDataDto.kt
├── network
│ ├── .gitignore
│ ├── build.gradle.kts
│ └── src
│ │ ├── androidMain
│ │ └── AndroidManifest.xml
│ │ └── commonMain
│ │ ├── graphql
│ │ └── tech
│ │ │ └── alexib
│ │ │ └── yaba
│ │ │ ├── .graphqlconfig
│ │ │ ├── Account.graphql
│ │ │ ├── AuthMutations.graphql
│ │ │ ├── PlaidItem.graphql
│ │ │ ├── PlaidLinkMutations.graphql
│ │ │ ├── PushToken.graphql
│ │ │ ├── TestSub.graphql
│ │ │ ├── UserData.graphql
│ │ │ ├── UserTransactions.graphql
│ │ │ └── schema.graphqls
│ │ └── kotlin
│ │ └── tech
│ │ └── alexib
│ │ └── yaba
│ │ └── data
│ │ └── network
│ │ ├── api
│ │ ├── AccountApi.kt
│ │ ├── AuthApi.kt
│ │ ├── PlaidItemApi.kt
│ │ ├── PushTokenApi.kt
│ │ └── UserDataApi.kt
│ │ ├── apollo
│ │ ├── YabaApolloClient.kt
│ │ └── scalarTypeAdapters.kt
│ │ ├── di
│ │ └── apiModule.kt
│ │ └── mapper
│ │ ├── AccountDtoMapper.kt
│ │ ├── AuthMapper.kt
│ │ ├── InstitutionMapper.kt
│ │ ├── ItemMapper.kt
│ │ ├── NewItemDataMapper.kt
│ │ ├── PlaidItemCreateResponseMapper.kt
│ │ ├── PlaidItemMutationMapper.kt
│ │ ├── PlaidLinkEventMapper.kt
│ │ ├── TransactionDtoMapper.kt
│ │ ├── TransactionUpdateDtoMapper.kt
│ │ └── UserDataDtoMapper.kt
└── src
│ ├── androidMain
│ ├── AndroidManifest.xml
│ └── kotlin
│ │ └── tech
│ │ └── alexib
│ │ └── yaba
│ │ └── data
│ │ ├── PlatformAndroid.kt
│ │ ├── auth
│ │ └── SessionManager.kt
│ │ ├── biometrics
│ │ ├── BiometricSettings.kt
│ │ ├── BiometricsManager.kt
│ │ ├── CipherWrapper.kt
│ │ └── EncryptionManager.kt
│ │ ├── di
│ │ └── koinAndroid.kt
│ │ └── task
│ │ ├── UpdateTransactionsWorker.kt
│ │ └── UserPushTokenWorker.kt
│ ├── androidTest
│ └── kotlin
│ │ └── tech
│ │ └── alexib
│ │ └── yaba
│ │ └── data
│ │ ├── BaseTest.kt
│ │ ├── CoroutineTestRule.kt
│ │ └── testDeps.kt
│ ├── commonMain
│ └── kotlin
│ │ └── tech
│ │ └── alexib
│ │ └── yaba
│ │ └── data
│ │ ├── Platform.kt
│ │ ├── di
│ │ └── koin.kt
│ │ ├── fcm
│ │ └── PushTokenManager.kt
│ │ ├── interactor
│ │ ├── AddItem.kt
│ │ ├── ClearAppData.kt
│ │ ├── PerformInitialSync.kt
│ │ ├── SetAccountsToHide.kt
│ │ ├── UpdateTransactions.kt
│ │ └── interactorModule.kt
│ │ ├── observer
│ │ ├── ObserveAccount.kt
│ │ ├── ObserveAccountTransactions.kt
│ │ ├── ObserveCurrentCashBalance.kt
│ │ ├── ObserveItem.kt
│ │ ├── ObserveItemsWithAccounts.kt
│ │ ├── ObserveRecentTransactions.kt
│ │ ├── ObserveSpendingCategoriesByDate.kt
│ │ ├── ObserveTransactionDetail.kt
│ │ ├── ObserveTransactions.kt
│ │ ├── ObserveUserItemsCount.kt
│ │ └── observersModule.kt
│ │ ├── provider
│ │ ├── AuthTokenProviderImpl.kt
│ │ └── UserIdProvider.kt
│ │ ├── repository
│ │ ├── AccountRepository.kt
│ │ ├── AuthRepository.kt
│ │ ├── ItemRepository.kt
│ │ ├── PushTokenRepository.kt
│ │ ├── TransactionRepository.kt
│ │ └── UserRepository.kt
│ │ ├── settings
│ │ ├── AppSettings.kt
│ │ └── AuthSettings.kt
│ │ ├── store
│ │ ├── AccountDetailStore.kt
│ │ ├── AccountsStore.kt
│ │ ├── HomeStore.kt
│ │ ├── PlaidItemsStore.kt
│ │ ├── PlaidLinkResultStore.kt
│ │ ├── TransactionDetailStore.kt
│ │ ├── TransactionsStore.kt
│ │ └── storeModule.kt
│ │ └── util
│ │ ├── Similarity.kt
│ │ └── SupervisorScope.kt
│ └── commonTest
│ └── kotlin
│ └── tech
│ └── alexib
│ └── yaba
│ └── data
│ ├── BaseTest.kt
│ ├── StubTests.kt
│ ├── TestDependencies.kt
│ ├── mock
│ └── api
│ │ ├── AccountApiMock.kt
│ │ ├── AuthApiMock.kt
│ │ ├── PlaidItemApiMock.kt
│ │ ├── PushTokenApiMock.kt
│ │ └── UserDataApiMock.kt
│ ├── repository
│ ├── AccountRepositoryTest.kt
│ ├── AuthRepositoryTest.kt
│ ├── BaseRepositoryTest.kt
│ ├── TransactionRepositoryTest.kt
│ ├── UserDataTest.kt
│ ├── UserIdProviderTest.kt
│ └── UserRepositoryTest.kt
│ ├── stubs
│ ├── AccountDtoStubs.kt
│ ├── InstitutionDtoStubs.kt
│ ├── PlaidItemDtoStubs.kt
│ ├── TransactionDtoStubs.kt
│ ├── UserDataDtoStubs.kt
│ └── json
│ │ ├── institutionJson.kt
│ │ └── plaidItemsJson.kt
│ └── testUtil.kt
├── downloadSchemaLocal.sh
├── downloadSchemaRemote.sh
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── iosApp
├── Podfile
├── iosApp.xcodeproj
│ └── project.pbxproj
└── iosApp
│ ├── ContentView.swift
│ ├── Info.plist
│ └── iOSApp.swift
├── lint.xml
├── release
└── debug.jks
├── scripts
├── changelog.sh
└── tags.sh
├── settings.gradle.kts
├── spotless
└── copyright.kt
└── versions.properties
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | insert_final_newline = true
5 |
6 | [*.{yml, json}]
7 | indent_style = space
8 | indent_size = 2
9 |
10 | [*.{kt, kts, java}]
11 | indent_size = 4
12 | max_line_length = 100
13 |
14 | # Starting from ktlint 0.34.2 There is a problem with import "import-ordering" rule - ktlint contradicts
15 | # default AS import arrangement rules, so we have to disable ktlint it.
16 | # See https://github.com/pinterest/ktlint/issues/527
17 | # Since IDE complains about unknown `disabled_rules` key we have to disable it as well:
18 |
19 | # noinspection EditorConfigKeyCorrectness
20 | disabled_rules = import-ordering
21 | # ,no-wildcard-imports
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | .idea
5 | .DS_Store
6 | /build
7 | */build
8 | /captures
9 | .externalNativeBuild
10 | .cxx
11 | local.properties
12 | /keys
13 | /release/yaba-release.jks
14 | sentry.properties
15 |
--------------------------------------------------------------------------------
/.lint/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | SHELL := /bin/bash -o pipefail
2 |
3 | .PHONY: changelog
4 | changelog:
5 | @$(shell pwd)/scripts/changelog.sh
6 |
7 | .PHONY: changelog-release
8 | changelog-release:
9 | @$(shell pwd)/scripts/changelog.sh -r
10 |
--------------------------------------------------------------------------------
/androidApp/fake-google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "9996237098026",
4 | "project_id": "yaba-fake",
5 | "storage_bucket": "yaba-fake.appspot.com"
6 | },
7 | "client": [
8 | {
9 | "client_info": {
10 | "mobilesdk_app_id": "OhSoFake",
11 | "android_client_info": {
12 | "package_name": "tech.alexib.yaba"
13 | }
14 | },
15 | "oauth_client": [
16 | {
17 | "client_id": "OhSoFake",
18 | "client_type": 1,
19 | "android_info": {
20 | "package_name": "tech.alexib.yaba",
21 | "certificate_hash": "OhSoFake"
22 | }
23 | },
24 | {
25 | "client_id": "OhSoFake",
26 | "client_type": 1,
27 | "android_info": {
28 | "package_name": "tech.alexib.yaba",
29 | "certificate_hash": "OhSoFake"
30 | }
31 | },
32 | {
33 | "client_id": "OhSoFake",
34 | "client_type": 1,
35 | "android_info": {
36 | "package_name": "tech.alexib.yaba",
37 | "certificate_hash": "OhSoFake"
38 | }
39 | },
40 | {
41 | "client_id": "OhSoFake",
42 | "client_type": 3
43 | }
44 | ],
45 | "api_key": [
46 | {
47 | "current_key": "OhSoFake"
48 | }
49 | ],
50 | "services": {
51 | "appinvite_service": {
52 | "other_platform_oauth_client": [
53 | {
54 | "client_id": "OhSoFake",
55 | "client_type": 3
56 | }
57 | ]
58 | }
59 | }
60 | }
61 | ],
62 | "configuration_version": "1"
63 | }
64 |
--------------------------------------------------------------------------------
/androidApp/src/androidTest/kotlin/tech/alexib/yaba/android/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android
17 |
18 | import androidx.test.ext.junit.runners.AndroidJUnit4
19 | import androidx.test.platform.app.InstrumentationRegistry
20 | import junit.framework.TestCase.assertEquals
21 | import org.junit.Test
22 | import org.junit.runner.RunWith
23 |
24 | @RunWith(AndroidJUnit4::class)
25 | class ExampleInstrumentedTest {
26 | @Test
27 | fun useAppContext() {
28 | // Context of the app under test.
29 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
30 | assertEquals("tech.alexib.yaba.android", appContext.packageName)
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/androidApp/src/main/ic_launcher-playstore.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/androidApp/src/main/ic_launcher-playstore.png
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/fcm/PushTokenManagerImpl.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.fcm
17 |
18 | import androidx.work.OneTimeWorkRequestBuilder
19 | import androidx.work.WorkManager
20 | import org.koin.core.component.KoinComponent
21 | import org.koin.core.component.inject
22 | import tech.alexib.yaba.data.fcm.PushTokenManager
23 | import tech.alexib.yaba.data.repository.PushTokenRepository
24 | import tech.alexib.yaba.data.task.UserPushTokenWorker
25 |
26 | class PushTokenManagerImpl : PushTokenManager, KoinComponent {
27 | private val workManager: WorkManager by inject()
28 | private val pushTokenRepository: PushTokenRepository by inject()
29 |
30 | override fun saveToken(token: String) {
31 | val work = OneTimeWorkRequestBuilder()
32 | .setInputData(UserPushTokenWorker.addToken(token)).build()
33 | workManager.enqueue(work)
34 | }
35 |
36 | override fun deleteToken(token: String) {
37 | pushTokenRepository.delete(token)
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/accounts/AccountsScreenAction.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.accounts
17 |
18 | import com.benasher44.uuid.Uuid
19 |
20 | sealed class AccountsScreenAction {
21 | data class OnSelected(val accountId: Uuid, val itemId: Uuid) : AccountsScreenAction()
22 | }
23 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/accounts/AccountsScreenViewModel.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.accounts
17 |
18 | import androidx.lifecycle.ViewModel
19 | import androidx.lifecycle.viewModelScope
20 | import kotlinx.coroutines.flow.StateFlow
21 | import org.koin.core.component.KoinComponent
22 | import org.koin.core.component.inject
23 | import org.koin.core.parameter.parametersOf
24 | import tech.alexib.yaba.data.store.AccountsScreenState
25 | import tech.alexib.yaba.data.store.AccountsStore
26 | import tech.alexib.yaba.util.stateInDefault
27 |
28 | class AccountsScreenViewModel : ViewModel(), KoinComponent {
29 |
30 | private val store: AccountsStore by inject { parametersOf(viewModelScope) }
31 |
32 | val state: StateFlow =
33 | store.state.stateInDefault(viewModelScope, AccountsScreenState.Empty)
34 | }
35 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/accounts/detail/AccountDetailScreenAction.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.accounts.detail
17 |
18 | import com.benasher44.uuid.Uuid
19 |
20 | sealed class AccountDetailScreenAction {
21 | object NavigateBack : AccountDetailScreenAction()
22 | data class OnTransactionSelected(val transactionId: Uuid) : AccountDetailScreenAction()
23 | }
24 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/accounts/detail/AccountDetailScreenParams.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.accounts.detail
17 |
18 | import com.benasher44.uuid.Uuid
19 | import kotlinx.serialization.Contextual
20 | import kotlinx.serialization.Serializable
21 |
22 | @Serializable
23 | data class AccountDetailScreenParams(
24 | @Contextual
25 | val accountId: Uuid,
26 | @Contextual
27 | val itemId: Uuid
28 | )
29 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/accounts/detail/AccountDetailScreenViewModel.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.accounts.detail
17 |
18 | import androidx.lifecycle.SavedStateHandle
19 | import androidx.lifecycle.ViewModel
20 | import androidx.lifecycle.viewModelScope
21 | import kotlinx.coroutines.flow.StateFlow
22 | import tech.alexib.yaba.android.navigation.NestedRoute
23 | import tech.alexib.yaba.data.store.AccountDetailScreenState
24 | import tech.alexib.yaba.data.store.AccountDetailStore
25 | import tech.alexib.yaba.util.stateInDefault
26 |
27 | class AccountDetailScreenViewModel(
28 | savedStateHandle: SavedStateHandle,
29 | store: AccountDetailStore
30 | ) : ViewModel() {
31 |
32 | private val params: AccountDetailScreenParams =
33 | NestedRoute.AccountDetail.getArg(savedStateHandle)
34 | val state: StateFlow =
35 | store.state.stateInDefault(viewModelScope, AccountDetailScreenState.Empty)
36 |
37 | init {
38 | store.init(params.accountId, params.itemId)
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/auth/biometric/BiometricSetupScreenAction.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.auth.biometric
17 |
18 | sealed class BiometricSetupScreenAction {
19 | object PromptSetup : BiometricSetupScreenAction()
20 | object Decline : BiometricSetupScreenAction()
21 | object NavigateHome : BiometricSetupScreenAction()
22 | }
23 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/auth/biometric/BiometricSetupScreenState.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.auth.biometric
17 |
18 | import androidx.compose.runtime.Immutable
19 |
20 | @Immutable
21 | data class BiometricSetupScreenState(
22 | val setupSuccessful: Boolean = false,
23 | val errorMessage: String? = null,
24 | val declined: Boolean = false
25 | ) {
26 | companion object {
27 | val Empty = BiometricSetupScreenState()
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/auth/components/Welcome.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.components
17 |
18 | import androidx.compose.material.MaterialTheme
19 | import androidx.compose.material.Text
20 | import androidx.compose.runtime.Composable
21 | import tech.alexib.yaba.android.ui.theme.BlueSlate
22 |
23 | @Composable
24 | fun Welcome() {
25 | Text(
26 | text = "Welcome To",
27 | style = MaterialTheme.typography.h5,
28 | color = BlueSlate
29 | )
30 | YabaLogo()
31 | }
32 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/components.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui
17 |
18 | import androidx.compose.foundation.layout.Spacer
19 | import androidx.compose.foundation.layout.height
20 | import androidx.compose.runtime.Composable
21 | import androidx.compose.ui.Modifier
22 | import androidx.compose.ui.unit.Dp
23 | import androidx.compose.ui.unit.dp
24 |
25 | @Composable
26 | fun AddSpace(spaceHeight: Dp = 16.dp) {
27 | Spacer(modifier = Modifier.height(spaceHeight))
28 | }
29 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/components/BackArrowButton.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.components
17 |
18 | import androidx.compose.material.Icon
19 | import androidx.compose.material.IconButton
20 | import androidx.compose.material.icons.Icons
21 | import androidx.compose.material.icons.filled.ArrowBack
22 | import androidx.compose.runtime.Composable
23 | import androidx.compose.ui.Modifier
24 | import androidx.compose.ui.res.stringResource
25 | import tech.alexib.yaba.android.R
26 |
27 | @Composable
28 | fun BackArrowButton(modifier: Modifier = Modifier, onClick: () -> Unit) {
29 | IconButton(
30 | onClick = {
31 | onClick()
32 | },
33 | modifier = modifier
34 | ) {
35 | Icon(Icons.Filled.ArrowBack, stringResource(R.string.back_arrow))
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/components/ErrorText.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.components
17 |
18 | import androidx.compose.material.MaterialTheme
19 | import androidx.compose.material.Text
20 | import androidx.compose.runtime.Composable
21 | import androidx.compose.ui.text.TextStyle
22 |
23 | @Composable
24 | fun ErrorText(errorMessage: String) {
25 | Text(
26 | text = errorMessage,
27 | style = TextStyle(color = MaterialTheme.colors.error)
28 | )
29 | }
30 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/components/Money.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.components
17 |
18 | import androidx.compose.material.Text
19 | import androidx.compose.runtime.Composable
20 | import androidx.compose.ui.Modifier
21 | import androidx.compose.ui.graphics.Color
22 | import androidx.compose.ui.text.TextStyle
23 | import tech.alexib.yaba.android.ui.theme.MoneyGreen
24 | import tech.alexib.yaba.android.util.moneyFormat
25 |
26 | @Composable
27 | fun Money(amount: Double, modifier: Modifier = Modifier, textStyle: TextStyle = TextStyle.Default) {
28 | val formatted = if (amount == 0.0) "$0.00" else "$${moneyFormat.format(amount)}"
29 | val color = if (amount < 0) Color.Red else MoneyGreen
30 | Text(text = formatted, color = color, modifier = modifier, style = textStyle)
31 | }
32 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/components/TotalCashBalanceRow.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.components
17 |
18 | import androidx.compose.foundation.layout.padding
19 | import androidx.compose.foundation.layout.wrapContentHeight
20 | import androidx.compose.material.Card
21 | import androidx.compose.runtime.Composable
22 | import androidx.compose.ui.Alignment
23 | import androidx.compose.ui.Modifier
24 | import androidx.compose.ui.res.stringResource
25 | import androidx.compose.ui.tooling.preview.Preview
26 | import androidx.compose.ui.unit.dp
27 | import tech.alexib.yaba.android.R
28 |
29 | @Composable
30 | fun TotalCashBalanceRow(
31 | balance: Double?
32 | ) {
33 | Card(
34 | modifier = Modifier
35 | .wrapContentHeight(Alignment.CenterVertically),
36 | elevation = 3.dp
37 | ) {
38 | BalanceRow(
39 | balance = balance ?: 0.0,
40 | description = stringResource(id = R.string.current_cash_balance),
41 | modifier = Modifier.padding(16.dp)
42 | )
43 | }
44 | }
45 |
46 | @Suppress("UnusedPrivateMember")
47 | @Preview
48 | @Composable
49 | private fun TotalCashBalanceRowPreview() {
50 | TotalCashBalanceRow(39000.00)
51 | }
52 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/components/YabaCard.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.components
17 |
18 | import androidx.compose.foundation.layout.fillMaxWidth
19 | import androidx.compose.foundation.layout.padding
20 | import androidx.compose.foundation.layout.wrapContentHeight
21 | import androidx.compose.material.Card
22 | import androidx.compose.material.MaterialTheme
23 | import androidx.compose.runtime.Composable
24 | import androidx.compose.ui.Alignment
25 | import androidx.compose.ui.Modifier
26 | import androidx.compose.ui.graphics.Color
27 | import androidx.compose.ui.unit.dp
28 | import tech.alexib.yaba.android.ui.AddSpace
29 |
30 | @Composable
31 | fun YabaCard(
32 | modifier: Modifier = Modifier,
33 | background: Color? = null,
34 | content: @Composable () -> Unit
35 | ) {
36 | AddSpace()
37 | Card(
38 | modifier = modifier
39 | .fillMaxWidth()
40 | .wrapContentHeight(align = Alignment.CenterVertically)
41 | .padding(4.dp),
42 | elevation = 3.dp,
43 | backgroundColor = background ?: MaterialTheme.colors.surface
44 | ) {
45 | content()
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/components/YabaLogo.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.components
17 |
18 | import androidx.compose.foundation.Image
19 | import androidx.compose.foundation.layout.width
20 | import androidx.compose.runtime.Composable
21 | import androidx.compose.ui.Modifier
22 | import androidx.compose.ui.graphics.ImageBitmap
23 | import androidx.compose.ui.layout.ContentScale
24 | import androidx.compose.ui.res.imageResource
25 | import androidx.compose.ui.unit.dp
26 | import tech.alexib.yaba.android.R
27 |
28 | @Composable
29 | fun YabaLogo(modifier: Modifier = Modifier, size: Int = 500) {
30 | Image(
31 | contentScale = ContentScale.Fit,
32 | contentDescription = "yaba logo",
33 | modifier = modifier.width(size.dp),
34 | bitmap = ImageBitmap.imageResource(id = R.drawable.yaba_logo_blue),
35 | )
36 | }
37 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/plaid/PlaidLinkHandler.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.plaid
17 |
18 | import androidx.activity.compose.rememberLauncherForActivityResult
19 | import androidx.activity.result.ActivityResultLauncher
20 | import androidx.compose.runtime.Composable
21 | import com.plaid.link.OpenPlaidLink
22 | import com.plaid.link.configuration.LinkTokenConfiguration
23 | import com.plaid.link.result.LinkResult
24 |
25 | @Composable
26 | fun PlaidLinkHandler(
27 | onResult: (LinkResult) -> Unit,
28 | content: @Composable (ActivityResultLauncher) -> Unit
29 | ) {
30 | val linkLauncher = rememberLauncherForActivityResult(contract = OpenPlaidLink()) {
31 | onResult(it)
32 | }
33 | content(linkLauncher)
34 | }
35 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/plaid/PlaidLinkResultScreenViewModel.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.plaid
17 |
18 | import androidx.lifecycle.ViewModel
19 | import androidx.lifecycle.viewModelScope
20 | import com.benasher44.uuid.Uuid
21 | import kotlinx.coroutines.Dispatchers
22 | import org.koin.core.component.KoinComponent
23 | import org.koin.core.component.inject
24 | import org.koin.core.parameter.parametersOf
25 | import tech.alexib.yaba.data.store.PlaidLinkResultScreenState
26 | import tech.alexib.yaba.data.store.PlaidLinkResultStore
27 | import tech.alexib.yaba.data.store.PlaidLinkScreenResult
28 | import tech.alexib.yaba.util.stateInDefault
29 |
30 | class PlaidLinkResultScreenViewModel : ViewModel(), KoinComponent {
31 | private val store: PlaidLinkResultStore by inject { parametersOf(Dispatchers.Main) }
32 |
33 | val state = store.state.stateInDefault(viewModelScope, PlaidLinkResultScreenState.Empty)
34 |
35 | fun init(accounts: List, itemId: Uuid) {
36 | store.init(itemId, accounts)
37 | }
38 |
39 | fun submit(action: PlaidLinkResultStore.Action) {
40 | store.submit(action)
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/settings/SettingsScreenAction.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.settings
17 |
18 | import tech.alexib.yaba.data.settings.Theme
19 |
20 | sealed class SettingsScreenAction {
21 | object Logout : SettingsScreenAction()
22 | data class Navigate(val destination: NavDestination) : SettingsScreenAction()
23 | object ClearAppData : SettingsScreenAction()
24 | data class ChangeTheme(val theme: Theme) : SettingsScreenAction()
25 |
26 | sealed class NavDestination {
27 | object Auth : NavDestination()
28 | object LinkedInstitutions : NavDestination()
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/settings/plaid_items/PlaidItemsScreenAction.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.settings.plaid_items
17 |
18 | import tech.alexib.yaba.model.PlaidItemWithAccounts
19 |
20 | sealed class PlaidItemsScreenAction {
21 | data class OnItemSelected(val item: PlaidItemWithAccounts) : PlaidItemsScreenAction()
22 | object NavigateToLinkInstitution : PlaidItemsScreenAction()
23 | }
24 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/settings/plaid_items/PlaidItemsScreenViewModel.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.settings.plaid_items
17 |
18 | import androidx.lifecycle.ViewModel
19 | import androidx.lifecycle.viewModelScope
20 | import org.koin.core.component.KoinComponent
21 | import org.koin.core.component.inject
22 | import tech.alexib.yaba.data.store.PlaidItemsScreenState
23 | import tech.alexib.yaba.data.store.PlaidItemsStore
24 | import tech.alexib.yaba.util.stateInDefault
25 |
26 | class PlaidItemsScreenViewModel : ViewModel(), KoinComponent {
27 |
28 | private val store: PlaidItemsStore by inject()
29 |
30 | val state = store.state.stateInDefault(viewModelScope, PlaidItemsScreenState.Empty)
31 | }
32 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/theme/Margin.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.theme
17 |
18 | import androidx.compose.ui.unit.dp
19 |
20 | object Margin {
21 | val small = 4.dp
22 | val regular = 8.dp
23 | val medium = 16.dp
24 | val large = 24.dp
25 | }
26 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/theme/Shape.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.theme
17 |
18 | import androidx.compose.foundation.shape.RoundedCornerShape
19 | import androidx.compose.material.Shapes
20 | import androidx.compose.ui.unit.dp
21 |
22 | val Shapes = Shapes(
23 | small = RoundedCornerShape(4.dp),
24 | medium = RoundedCornerShape(4.dp),
25 | large = RoundedCornerShape(0.dp)
26 | )
27 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/transactions/TransactionDetailScreenAction.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.transactions
17 |
18 | sealed class TransactionDetailScreenAction {
19 | object NavigateBack : TransactionDetailScreenAction()
20 | }
21 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/transactions/TransactionDetailScreenViewModel.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.transactions
17 |
18 | import androidx.lifecycle.SavedStateHandle
19 | import androidx.lifecycle.ViewModel
20 | import androidx.lifecycle.viewModelScope
21 | import kotlinx.coroutines.flow.StateFlow
22 | import org.koin.core.component.KoinComponent
23 | import org.koin.core.component.inject
24 | import tech.alexib.yaba.android.navigation.NestedRoute
25 | import tech.alexib.yaba.data.store.TransactionDetailScreenState
26 | import tech.alexib.yaba.data.store.TransactionDetailStore
27 | import tech.alexib.yaba.util.stateInDefault
28 |
29 | class TransactionDetailScreenViewModel(handle: SavedStateHandle) :
30 | ViewModel(),
31 | KoinComponent {
32 |
33 | private val id = NestedRoute.TransactionDetail.getArg(handle)
34 | private val store: TransactionDetailStore by inject()
35 |
36 | val state: StateFlow =
37 | store.state.stateInDefault(viewModelScope, TransactionDetailScreenState.Empty)
38 |
39 | init {
40 | store.init(id)
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/ui/transactions/TransactionListScreenViewModel.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.ui.transactions
17 |
18 | import androidx.lifecycle.ViewModel
19 | import androidx.lifecycle.viewModelScope
20 | import kotlinx.coroutines.Dispatchers
21 | import org.koin.core.component.KoinComponent
22 | import org.koin.core.component.inject
23 | import org.koin.core.parameter.parametersOf
24 | import tech.alexib.yaba.data.store.TransactionsStore
25 | import tech.alexib.yaba.util.stateInDefault
26 |
27 | class TransactionListScreenViewModel : ViewModel(), KoinComponent {
28 |
29 | val store: TransactionsStore by inject { parametersOf(Dispatchers.Main) }
30 | val state = store.state.stateInDefault(viewModelScope, TransactionsStore.State.Empty)
31 |
32 | override fun onCleared() {
33 | store.dispose()
34 | super.onCleared()
35 | }
36 |
37 | init {
38 | store.init()
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/util/Flow.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | @file:Suppress("UNCHECKED_CAST", "LongParameterList")
17 |
18 | package tech.alexib.yaba.android.util
19 |
20 | import androidx.compose.runtime.Composable
21 | import androidx.compose.runtime.remember
22 | import androidx.compose.ui.platform.LocalLifecycleOwner
23 | import androidx.lifecycle.Lifecycle
24 | import androidx.lifecycle.flowWithLifecycle
25 | import kotlinx.coroutines.flow.Flow
26 |
27 | // all credit to https://github.com/chrisbanes
28 | @Composable
29 | fun rememberFlowWithLifecycle(
30 | flow: Flow,
31 | lifecycle: Lifecycle = LocalLifecycleOwner.current.lifecycle,
32 | minActiveState: Lifecycle.State = Lifecycle.State.STARTED
33 | ): Flow = remember(flow, lifecycle) {
34 | flow.flowWithLifecycle(
35 | lifecycle = lifecycle,
36 | minActiveState = minActiveState
37 | )
38 | }
39 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/util/bitmap.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.util
17 |
18 | import android.graphics.Bitmap
19 | import android.graphics.BitmapFactory
20 | import android.util.Log
21 | import tech.alexib.yaba.android.ui.components.defaultLogo
22 | import java.util.Base64
23 |
24 | @Suppress("FunctionParameterNaming", "FunctionNaming", "TooGenericExceptionCaught")
25 | fun base64ToBitmap(b64: String): Bitmap {
26 | return try {
27 | val imageAsBytes: ByteArray = Base64.getDecoder().decode(b64.toByteArray())
28 | BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.size)
29 | } catch (e: Throwable) {
30 | Log.e("base64ToBitmap", b64)
31 | defaultLogo
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/util/navigation.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.util
17 |
18 | import android.os.Bundle
19 | import kotlinx.serialization.decodeFromString
20 | import kotlinx.serialization.encodeToString
21 | import tech.alexib.yaba.util.jSerializer
22 |
23 | inline fun Bundle.getSerialized(key: String): T? {
24 | return this.getString(key)?.let {
25 | jSerializer.decodeFromString(it)
26 | }
27 | }
28 |
29 | inline fun Bundle.putSerialized(key: String, value: T) =
30 | this.putString(key, jSerializer.encodeToString(value))
31 |
--------------------------------------------------------------------------------
/androidApp/src/main/kotlin/tech/alexib/yaba/android/util/notifications.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android.util
17 |
18 | import android.app.NotificationManager
19 |
20 | sealed class YabaNotificationChannel {
21 | abstract val name: String
22 | abstract val id: String
23 | }
24 |
25 | object NewTransactionChannel : YabaNotificationChannel() {
26 | override val id: String = "new_transaction"
27 | override val name: String = "New transactions"
28 | }
29 |
30 | fun NotificationManager.isChannelActive(channel: YabaNotificationChannel): Boolean {
31 | val notificationChannel = this.getNotificationChannel(channel.id)
32 | return notificationChannel != null &&
33 | notificationChannel.importance != NotificationManager.IMPORTANCE_NONE
34 | }
35 |
--------------------------------------------------------------------------------
/androidApp/src/main/res/drawable-mdpi/default_bank.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/androidApp/src/main/res/drawable-mdpi/default_bank.png
--------------------------------------------------------------------------------
/androidApp/src/main/res/drawable/yaba_logo_blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/androidApp/src/main/res/drawable/yaba_logo_blue.png
--------------------------------------------------------------------------------
/androidApp/src/main/res/font/karla_bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/androidApp/src/main/res/font/karla_bold.ttf
--------------------------------------------------------------------------------
/androidApp/src/main/res/font/karla_regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/androidApp/src/main/res/font/karla_regular.ttf
--------------------------------------------------------------------------------
/androidApp/src/main/res/font/montserrat_light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/androidApp/src/main/res/font/montserrat_light.ttf
--------------------------------------------------------------------------------
/androidApp/src/main/res/font/montserrat_medium.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/androidApp/src/main/res/font/montserrat_medium.ttf
--------------------------------------------------------------------------------
/androidApp/src/main/res/font/montserrat_regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/androidApp/src/main/res/font/montserrat_regular.ttf
--------------------------------------------------------------------------------
/androidApp/src/main/res/font/montserrat_semibold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/androidApp/src/main/res/font/montserrat_semibold.ttf
--------------------------------------------------------------------------------
/androidApp/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/androidApp/src/main/res/mipmap-anydpi-v26/yaba_logo.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/androidApp/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/androidApp/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/androidApp/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/androidApp/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/androidApp/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/androidApp/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/androidApp/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/androidApp/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/androidApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/androidApp/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/androidApp/src/main/res/values-night/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #0e0e0e
4 | @color/black30
5 | @color/blue_slate
6 |
7 |
--------------------------------------------------------------------------------
/androidApp/src/main/res/values-night/flags.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | false
19 |
--------------------------------------------------------------------------------
/androidApp/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/androidApp/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFBB86FC
4 | #FF6200EE
5 | #FF3700B3
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 | #dd0d3e
11 | #c20029
12 | @color/red900
13 | #FF4f83cc
14 | #FF84b2ff
15 | #4D000000
16 | @color/blue_slate
17 | @color/white
18 |
19 |
--------------------------------------------------------------------------------
/androidApp/src/main/res/values/flags.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 | true
19 |
--------------------------------------------------------------------------------
/androidApp/src/main/res/values/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #4F83CC
4 |
--------------------------------------------------------------------------------
/androidApp/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | yaba
3 | new_transaction
4 | transactions_updated
5 | Hang on while we fetch your data
6 | Link your first institution
7 | Current cash balance
8 | View all transactions
9 | hide password
10 | show password
11 | Back arrow
12 | Transactions
13 | Please do not enter your real credentials as they will not work, use the credentials below instead
14 | If asked to use multi-factor authentication, choose any method and enter 1234 for the code
15 | This is a sandbox version of yaba
16 | There are no transactions available for this account
17 | Current balance
18 | Available balance
19 | Total limit
20 | Institution
21 |
22 |
--------------------------------------------------------------------------------
/androidApp/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
16 |
17 |
22 |
23 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/androidApp/src/main/res/xml/network_security_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/androidApp/src/sandbox/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/androidApp/src/sandbox/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | yaba - sandbox
4 |
5 |
--------------------------------------------------------------------------------
/androidApp/src/staging/res/xml/network_security_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 192.168.86.231
5 |
6 |
7 |
--------------------------------------------------------------------------------
/androidApp/src/test/kotlin/tech/alexib/yaba/android/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.android
17 |
18 | import junit.framework.TestCase.assertEquals
19 | import org.junit.Test
20 |
21 | class ExampleUnitTest {
22 | @Test
23 | fun addition_isCorrect() {
24 | assertEquals(4, 2 + 2)
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/androidApp/src/test/resources/robolectric.properties:
--------------------------------------------------------------------------------
1 | sdk=30
2 |
--------------------------------------------------------------------------------
/assets/dark.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/dark.gif
--------------------------------------------------------------------------------
/assets/light.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/light.gif
--------------------------------------------------------------------------------
/assets/screens/dark001.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/dark001.png
--------------------------------------------------------------------------------
/assets/screens/dark002.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/dark002.png
--------------------------------------------------------------------------------
/assets/screens/dark003.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/dark003.png
--------------------------------------------------------------------------------
/assets/screens/dark004.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/dark004.png
--------------------------------------------------------------------------------
/assets/screens/dark005.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/dark005.png
--------------------------------------------------------------------------------
/assets/screens/dark006.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/dark006.png
--------------------------------------------------------------------------------
/assets/screens/dark007.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/dark007.png
--------------------------------------------------------------------------------
/assets/screens/dark008.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/dark008.png
--------------------------------------------------------------------------------
/assets/screens/dark009.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/dark009.png
--------------------------------------------------------------------------------
/assets/screens/dark010.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/dark010.png
--------------------------------------------------------------------------------
/assets/screens/dark011.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/dark011.png
--------------------------------------------------------------------------------
/assets/screens/light001.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/light001.png
--------------------------------------------------------------------------------
/assets/screens/light002.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/light002.png
--------------------------------------------------------------------------------
/assets/screens/light003.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/light003.png
--------------------------------------------------------------------------------
/assets/screens/light004.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/light004.png
--------------------------------------------------------------------------------
/assets/screens/light005.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/light005.png
--------------------------------------------------------------------------------
/assets/screens/light006.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/light006.png
--------------------------------------------------------------------------------
/assets/screens/light007.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/light007.png
--------------------------------------------------------------------------------
/assets/screens/light008.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/light008.png
--------------------------------------------------------------------------------
/assets/screens/light009.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/light009.png
--------------------------------------------------------------------------------
/assets/screens/light010.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/light010.png
--------------------------------------------------------------------------------
/assets/screens/light011.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/light011.png
--------------------------------------------------------------------------------
/assets/screens/play/dark001.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/play/dark001.png
--------------------------------------------------------------------------------
/assets/screens/play/dark003.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/play/dark003.png
--------------------------------------------------------------------------------
/assets/screens/play/dark005.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/play/dark005.png
--------------------------------------------------------------------------------
/assets/screens/play/dark006.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/play/dark006.png
--------------------------------------------------------------------------------
/assets/screens/play/dark007.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/play/dark007.png
--------------------------------------------------------------------------------
/assets/screens/play/feature.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/play/feature.png
--------------------------------------------------------------------------------
/assets/screens/play/light001.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/play/light001.png
--------------------------------------------------------------------------------
/assets/screens/play/light003.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/play/light003.png
--------------------------------------------------------------------------------
/assets/screens/play/light005.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/play/light005.png
--------------------------------------------------------------------------------
/assets/screens/play/light006.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/play/light006.png
--------------------------------------------------------------------------------
/assets/screens/play/light007.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/screens/play/light007.png
--------------------------------------------------------------------------------
/assets/yaba.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/assets/yaba.png
--------------------------------------------------------------------------------
/base/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("multiplatform-plugin")
3 | kotlin("plugin.serialization")
4 | }
5 |
6 | dependencies {
7 | with(KotlinX) {
8 | commonMainApi(serialization.core)
9 | commonMainApi(serialization.json)
10 | }
11 | }
12 | tasks {
13 | ktlintFormat {
14 | doLast {
15 | delete("src/main")
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/base/src/androidMain/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/base/src/androidMain/kotlin/tech/alexib/yaba/util/androidTestUtil.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.util
17 |
18 | import kotlinx.coroutines.CoroutineScope
19 | import kotlin.coroutines.CoroutineContext
20 |
21 | actual fun runBlockingTest(
22 | context: CoroutineContext,
23 | block: suspend CoroutineScope.() -> T
24 | ): T =
25 | kotlinx.coroutines.runBlocking(context, block)
26 |
--------------------------------------------------------------------------------
/base/src/commonMain/kotlin/tech/alexib/yaba/AppInfo.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba
17 |
18 | interface AppInfo {
19 | val appId: String
20 | }
21 |
--------------------------------------------------------------------------------
/base/src/commonMain/kotlin/tech/alexib/yaba/di/koinCore.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | @file:Suppress("MatchingDeclarationName")
17 | package tech.alexib.yaba.di
18 |
19 | import org.koin.core.qualifier.named
20 |
21 | object CoreDependencies {
22 | val mainDispatcherQualifier = named("MainDispatcher")
23 | val ioDispatcherQualifier = named("IoDispatcher")
24 | val koinUiScopeQualifier = named("uiScope")
25 | }
26 |
--------------------------------------------------------------------------------
/base/src/commonMain/kotlin/tech/alexib/yaba/model/Institution.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.model
17 |
18 | data class Institution(
19 | val institutionId: String,
20 | val logo: String,
21 | val name: String,
22 | val primaryColor: String,
23 | )
24 |
--------------------------------------------------------------------------------
/base/src/commonMain/kotlin/tech/alexib/yaba/model/User.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.model
17 |
18 | import com.benasher44.uuid.Uuid
19 | import kotlinx.serialization.Contextual
20 | import kotlinx.serialization.Serializable
21 |
22 | @Serializable
23 | data class User(
24 | @Contextual
25 | val id: Uuid,
26 | val email: String
27 | )
28 |
--------------------------------------------------------------------------------
/base/src/commonMain/kotlin/tech/alexib/yaba/model/request/PlaidItemCreateRequest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.model.request
17 |
18 | data class PlaidItemCreateRequest(
19 | val institutionId: String,
20 | val publicToken: String
21 | )
22 |
--------------------------------------------------------------------------------
/base/src/commonMain/kotlin/tech/alexib/yaba/model/request/PlaidLinkEventCreateRequest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.model.request
17 |
18 | sealed class PlaidLinkEventCreateRequest {
19 | data class Exit(
20 | val requestId: String? = null,
21 | val errorCode: String? = null,
22 | val errorType: String? = null,
23 | val linkSessionId: String = "",
24 | ) : PlaidLinkEventCreateRequest()
25 |
26 | data class Success(
27 | val linkSessionId: String,
28 | val type: String = "LinkSuccess"
29 | ) : PlaidLinkEventCreateRequest()
30 | }
31 |
--------------------------------------------------------------------------------
/base/src/commonMain/kotlin/tech/alexib/yaba/model/request/UserLoginInput.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.model.request
17 |
18 | data class UserLoginInput(
19 | val email: String,
20 | val password: String
21 | )
22 |
--------------------------------------------------------------------------------
/base/src/commonMain/kotlin/tech/alexib/yaba/model/request/UserRegisterInput.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.model.request
17 |
18 | data class UserRegisterInput(
19 | val email: String,
20 | val password: String,
21 | )
22 |
--------------------------------------------------------------------------------
/base/src/commonMain/kotlin/tech/alexib/yaba/model/response/AuthResponse.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.model.response
17 |
18 | import com.benasher44.uuid.Uuid
19 |
20 | data class AuthResponse(
21 | val id: Uuid,
22 | val email: String,
23 | val token: String
24 | )
25 |
--------------------------------------------------------------------------------
/base/src/commonMain/kotlin/tech/alexib/yaba/model/response/AuthResult.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.model.response
17 |
18 | sealed class AuthResult {
19 | object Success : AuthResult()
20 | data class Error(val message: String) : AuthResult()
21 | }
22 |
--------------------------------------------------------------------------------
/base/src/commonMain/kotlin/tech/alexib/yaba/model/response/CreateLinkTokenResponse.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.model.response
17 |
18 | data class CreateLinkTokenResponse(
19 | val linkToken: String
20 | )
21 |
--------------------------------------------------------------------------------
/base/src/commonMain/kotlin/tech/alexib/yaba/model/response/PlaidItemCreateResponse.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.model.response
17 |
18 | import com.benasher44.uuid.Uuid
19 |
20 | data class PlaidItemCreateResponse(
21 | val id: Uuid,
22 | val name: String,
23 | val logo: String,
24 | val accounts: List
25 | ) {
26 | data class Account(
27 | val mask: String,
28 | val name: String,
29 | val plaidAccountId: String
30 | )
31 | }
32 |
--------------------------------------------------------------------------------
/base/src/commonMain/kotlin/tech/alexib/yaba/stubs/AccountStubs.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.stubs
17 |
18 | import kotlinx.serialization.decodeFromString
19 | import tech.alexib.yaba.model.Account
20 | import tech.alexib.yaba.stubs.json.accountsChaseJson
21 | import tech.alexib.yaba.stubs.json.accountsWellsJson
22 | import tech.alexib.yaba.util.jSerializer
23 |
24 | object AccountStubs {
25 |
26 | val chaseAccounts: List by lazy {
27 | jSerializer.decodeFromString(accountsChaseJson)
28 | }
29 |
30 | val wellsFargoAccounts: List by lazy {
31 | jSerializer.decodeFromString(accountsWellsJson)
32 | }
33 |
34 | val allAccounts: List by lazy {
35 | chaseAccounts + wellsFargoAccounts
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/base/src/commonMain/kotlin/tech/alexib/yaba/stubs/json/userJson.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | @file:Suppress("TopLevelPropertyNaming")
17 | package tech.alexib.yaba.stubs.json
18 |
19 | const val userJson = """
20 | {
21 | "id": "eb15d547-a558-4c2f-9337-1155253cd2db",
22 | "email": "alexi3@test.com"
23 | }
24 | """
25 |
--------------------------------------------------------------------------------
/base/src/commonMain/kotlin/tech/alexib/yaba/util/koin.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.util
17 |
18 | import org.koin.core.parameter.parametersOf
19 | import org.koin.core.scope.Scope
20 |
21 | inline fun Scope.getWith(vararg params: Any?): T {
22 | return get(parameters = { parametersOf(*params) })
23 | }
24 |
--------------------------------------------------------------------------------
/buildSrc/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | .gradle
--------------------------------------------------------------------------------
/buildSrc/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | `kotlin-dsl`
3 | }
4 |
5 | repositories {
6 | mavenCentral()
7 | google()
8 | gradlePluginPortal()
9 | }
10 |
11 | kotlin {
12 | sourceSets.getByName("main").kotlin.srcDir("buildSrc/src/main/kotlin")
13 | }
14 |
15 | dependencies {
16 | api(Lib.Moko.mobileMultiplatform)
17 | api(GradlePlugins.kotlin)
18 | api(GradlePlugins.android)
19 | api("com.android.tools.build:builder:${GradleVersions.androidTools}")
20 | api("com.android.tools.build:builder-model:${GradleVersions.androidTools}")
21 | api(GradlePlugins.detekt)
22 | api(GradlePlugins.spotless)
23 | api(GradlePlugins.ktLint)
24 | }
25 |
--------------------------------------------------------------------------------
/buildSrc/buildSrc/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | .gradle
--------------------------------------------------------------------------------
/buildSrc/buildSrc/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | `kotlin-dsl`
3 | }
4 |
5 | repositories {
6 | mavenCentral()
7 | }
--------------------------------------------------------------------------------
/buildSrc/buildSrc/src/main/kotlin/YabaAndroidConfig.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | @file:SuppressWarnings()
17 |
18 | object YabaAndroidConfig {
19 | private const val versionMajor = 1
20 | private const val versionMinor = 1
21 | private const val versionPatch = 1
22 | const val minSdk = 29
23 | const val targetSdk = 31
24 | val versionCode = generateVersionCode()
25 | const val versionName = "$versionMajor.$versionMinor.$versionPatch"
26 | const val compileSdk = 31
27 | const val buildToolsVersion = "31.0.0"
28 |
29 | private fun generateVersionCode(): Int {
30 | return minSdk * 10000000 + versionMajor * 10000 + versionMinor * 100 + versionPatch
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/buildSrc/src/main/kotlin/android-base-convention.gradle.kts:
--------------------------------------------------------------------------------
1 | import com.android.build.gradle.BaseExtension
2 |
3 | configure {
4 | compileSdkVersion(YabaAndroidConfig.compileSdk)
5 |
6 | defaultConfig {
7 | minSdk = YabaAndroidConfig.minSdk
8 | targetSdk = YabaAndroidConfig.targetSdk
9 | }
10 | compileOptions {
11 | sourceCompatibility = JavaVersion.VERSION_11
12 | targetCompatibility = JavaVersion.VERSION_11
13 | }
14 |
15 | packagingOptions {
16 | resources {
17 | excludes.add("META-INF/*")
18 | excludes.add("META-INF/*.kotlin_module")
19 | excludes.add("META-INF/LGPL2.1")
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/buildSrc/src/main/kotlin/android-lib.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("base-convention")
3 | id("com.android.library")
4 | id("android-base-convention")
5 | }
6 |
7 | android {
8 | sourceSets.all { java.srcDir("src/$name/kotlin") }
9 |
10 | lint {
11 | lintConfig = rootProject.file(".lint/config.xml")
12 | checkAllWarnings = true
13 | warningsAsErrors = true
14 | abortOnError = false
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/buildSrc/src/main/kotlin/base-convention.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins{
2 | id("static-analysis")
3 | }
4 |
--------------------------------------------------------------------------------
/buildSrc/src/main/kotlin/static-analysis.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("org.jlleitschuh.gradle.ktlint")
3 | id("org.jlleitschuh.gradle.ktlint-idea")
4 | id("com.diffplug.spotless")
5 | id("io.gitlab.arturbosch.detekt")
6 | }
7 |
8 | ktlint {
9 | // debug.set(true)
10 | // verbose.set(true)
11 | version.set(Version.ktLint)
12 | android.set(true)
13 | outputToConsole.set(true)
14 | outputColorName.set("BLUE")
15 | ignoreFailures.set(true)
16 | // enableExperimentalRules.set(true)
17 | reporters {
18 | reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.PLAIN)
19 | reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.CHECKSTYLE)
20 | }
21 | filter {
22 | exclude { projectDir.toURI().relativize(it.file.toURI()).path.contains("/generated/") }
23 |
24 | }
25 | additionalEditorconfigFile.set(file("${rootProject.rootDir}/.editorConfig"))
26 | }
27 |
28 | spotless {
29 | kotlin {
30 | target("**/src/**/*.kt")
31 | licenseHeaderFile(rootProject.file("spotless/copyright.kt"))
32 | targetExclude("$buildDir/**/*.kt")
33 | targetExclude("**/generated/**")
34 | targetExclude("spotless/copyright.kt")
35 | ktlint(Version.ktLint)
36 | trimTrailingWhitespace()
37 | endWithNewline()
38 | }
39 | kotlinGradle {
40 | target("*.gradle.kts")
41 | ktlint(Version.ktLint)
42 | }
43 | }
44 |
45 | detekt {
46 | source.setFrom(
47 | "src/commonMain/kotlin",
48 | "src/androidMain/kotlin",
49 | "src/iosMain/kotlin",
50 | "src/main/kotlin",
51 | "src/main/java"
52 | )
53 | config = files(rootProject.file("config/detekt.yml"))
54 |
55 | parallel = true
56 | }
57 |
--------------------------------------------------------------------------------
/data/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | .gradle
3 |
--------------------------------------------------------------------------------
/data/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("multiplatform-plugin")
3 | kotlin("plugin.serialization")
4 | id("kotlin-parcelize")
5 | }
6 |
7 | kotlin {
8 | sourceSets {
9 | all {
10 | languageSettings.apply {
11 | optIn("com.russhwolf.settings.ExperimentalSettingsApi")
12 | optIn(
13 | "com.russhwolf.settings.ExperimentalSettingsImplementation"
14 | )
15 | }
16 | }
17 | }
18 | }
19 | dependencies {
20 | commonMainApi(projects.base)
21 | commonMainImplementation(projects.data.domain)
22 | commonMainImplementation(projects.data.network)
23 | commonMainImplementation(projects.data.db)
24 | commonTestImplementation(Lib.turbine)
25 | commonMainImplementation(Koin.workManager)
26 |
27 | with(RussHWolf) {
28 | commonMainImplementation(multiplatformSettings.settings)
29 | commonMainImplementation(multiplatformSettings.coroutines)
30 | commonTestImplementation(multiplatformSettings.test)
31 | androidMainImplementation(multiplatformSettings.dataStore)
32 | }
33 | with(AndroidX) {
34 | androidMainImplementation(dataStore.preferences)
35 | androidMainImplementation(security.cryptoKtx)
36 | androidMainImplementation(biometricKtx)
37 | androidMainImplementation(work.runtimeKtx)
38 | androidMainImplementation(work.multiprocess)
39 | androidMainApi(compose.runtime)
40 | }
41 | }
42 |
43 | tasks {
44 | ktlintFormat {
45 | doLast {
46 | delete("src/main")
47 | delete("src/test")
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/data/db/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | .gradle
3 |
--------------------------------------------------------------------------------
/data/db/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("multiplatform-plugin")
3 | kotlin("plugin.serialization")
4 | id("dev.icerock.mobile.multiplatform.android-manifest")
5 | id("com.squareup.sqldelight")
6 | }
7 |
8 | dependencies {
9 | with(Lib.SqlDelight) {
10 | commonMainApi(runtime)
11 | commonMainApi(coroutineExtensions)
12 | androidMainApi(androidDriver)
13 | androidMainApi(jvm)
14 | androidTestImplementation(jvm)
15 | }
16 | commonMainImplementation(projects.base)
17 | commonMainImplementation(projects.data.domain)
18 | }
19 |
20 | sqldelight {
21 | database("YabaDb") {
22 | packageName = "tech.alexib.yaba.data.db"
23 | schemaOutputDirectory = file("src/commonMain/sqldelight/databases")
24 | dialect = "sqlite:3.25"
25 | linkSqlite = true
26 | }
27 | }
28 | tasks {
29 | ktlintFormat {
30 | doLast {
31 | delete("src/main")
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/data/db/src/androidMain/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/data/db/src/androidMain/kotlin/tech/alexib/yaba/data/db/DriverFactory.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.db
17 |
18 | import android.content.Context
19 | import androidx.sqlite.db.SupportSQLiteDatabase
20 | import co.touchlab.kermit.Kermit
21 | import com.squareup.sqldelight.android.AndroidSqliteDriver
22 | import com.squareup.sqldelight.db.SqlDriver
23 | import com.squareup.sqldelight.logs.LogSqliteDriver
24 | import tech.alexib.yaba.base.BuildConfig
25 |
26 | actual class DriverFactory(private val context: Context, private val log: Kermit) {
27 | actual fun createDriver(): SqlDriver {
28 | val driver = AndroidSqliteDriver(
29 | YabaDb.Schema,
30 | context,
31 | "yaba.db",
32 | callback = object : AndroidSqliteDriver.Callback(YabaDb.Schema) {
33 | override fun onConfigure(db: SupportSQLiteDatabase) {
34 | super.onConfigure(db)
35 | db.execSQL("PRAGMA foreign_keys=ON;")
36 | }
37 | }
38 | )
39 | return if (BuildConfig.DEBUG) {
40 | LogSqliteDriver(driver) { log.d { it } }
41 | } else driver
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/data/db/src/androidMain/kotlin/tech/alexib/yaba/data/db/di/koinAndroid.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.db.di
17 |
18 | import com.squareup.sqldelight.db.SqlDriver
19 | import com.squareup.sqldelight.sqlite.driver.JdbcSqliteDriver
20 | import org.koin.core.module.Module
21 | import org.koin.dsl.module
22 | import tech.alexib.yaba.data.db.DriverFactory
23 | import tech.alexib.yaba.data.db.YabaDb
24 | import tech.alexib.yaba.util.getWith
25 |
26 | actual val dbPlatformModule: Module = module {
27 | single { DriverFactory(get(), getWith("SqlDelight")).createDriver() }
28 | }
29 |
30 | actual val dbPlatformTestModule: Module = module {
31 | single {
32 | JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY).apply {
33 | YabaDb.Schema.create(this)
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/data/db/src/commonMain/kotlin/tech/alexib/yaba/data/db/DriverFactory.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.db
17 |
18 | import com.squareup.sqldelight.db.SqlDriver
19 |
20 | expect class DriverFactory {
21 | fun createDriver(): SqlDriver
22 | }
23 |
--------------------------------------------------------------------------------
/data/db/src/commonMain/kotlin/tech/alexib/yaba/data/db/di/dbModule.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.db.di
17 |
18 | import org.koin.dsl.module
19 | import tech.alexib.yaba.data.db.YabaDatabase
20 | import tech.alexib.yaba.data.db.YabaDb
21 | import tech.alexib.yaba.data.db.dao.AccountDao
22 | import tech.alexib.yaba.data.db.dao.InstitutionDao
23 | import tech.alexib.yaba.data.db.dao.ItemDao
24 | import tech.alexib.yaba.data.db.dao.TransactionDao
25 | import tech.alexib.yaba.data.db.dao.UserDao
26 | import tech.alexib.yaba.di.CoreDependencies.ioDispatcherQualifier
27 | import tech.alexib.yaba.util.getWith
28 |
29 | val dbModule = module {
30 | single { YabaDatabase(get(), getWith("YabaDb")).getInstance() }
31 | single { AccountDao.Impl(get(), get(ioDispatcherQualifier)) }
32 | single { InstitutionDao.Impl(get(), get(ioDispatcherQualifier)) }
33 | single { ItemDao.Impl(get(), get(ioDispatcherQualifier)) }
34 | single { TransactionDao.Impl(get(), get(ioDispatcherQualifier)) }
35 | single { UserDao.Impl(get(), get(ioDispatcherQualifier)) }
36 | }
37 |
--------------------------------------------------------------------------------
/data/db/src/commonMain/kotlin/tech/alexib/yaba/data/db/di/koin.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.db.di
17 |
18 | import org.koin.core.module.Module
19 |
20 | expect val dbPlatformModule: Module
21 |
22 | expect val dbPlatformTestModule: Module
23 |
--------------------------------------------------------------------------------
/data/db/src/commonMain/kotlin/tech/alexib/yaba/data/db/mapper/AccountEntityMapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.db.mapper
17 |
18 | import tech.alexib.yaba.data.db.AccountEntity
19 | import tech.alexib.yaba.data.domain.dto.AccountDto
20 |
21 | internal fun AccountDto.toEntity(): AccountEntity = AccountEntity(
22 | id = id,
23 | name = name,
24 | current_balance = currentBalance,
25 | available_balance = availableBalance,
26 | credit_limit = creditLimit,
27 | mask = mask,
28 | item_id = itemId,
29 | type = type,
30 | subtype = subtype,
31 | hidden = hidden
32 | )
33 |
34 | internal fun List.toEntities(): List = this.map { it.toEntity() }
35 |
--------------------------------------------------------------------------------
/data/db/src/commonMain/kotlin/tech/alexib/yaba/data/db/mapper/InstitutionEntityMapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.db.mapper
17 |
18 | import tech.alexib.yaba.data.db.InstitutionEntity
19 | import tech.alexib.yaba.data.domain.dto.InstitutionDto
20 |
21 | fun InstitutionDto.toEntity(): InstitutionEntity = this.run {
22 | InstitutionEntity(id = institutionId, logo = logo, name = name, primary_color = primaryColor)
23 | }
24 |
--------------------------------------------------------------------------------
/data/db/src/commonMain/kotlin/tech/alexib/yaba/data/db/mapper/ItemEntityMapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.db.mapper
17 |
18 | import tech.alexib.yaba.data.db.ItemEntity
19 | import tech.alexib.yaba.data.domain.dto.ItemDto
20 |
21 | internal fun ItemDto.toEntity(): ItemEntity = ItemEntity(
22 | id = id,
23 | plaid_institution_id = plaidInstitutionId,
24 | user_id = userId
25 | )
26 |
27 | internal fun List.toEntities(): List = this.map { it.toEntity() }
28 |
--------------------------------------------------------------------------------
/data/db/src/commonMain/kotlin/tech/alexib/yaba/data/db/mapper/TransactionEntityMapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.db.mapper
17 |
18 | import tech.alexib.yaba.data.db.TransactionEntity
19 | import tech.alexib.yaba.data.domain.dto.TransactionDto
20 |
21 | internal fun TransactionDto.toEntity() = TransactionEntity(
22 | name = name,
23 | id = id,
24 | type = type,
25 | amount = amount,
26 | date = date,
27 | account_id = accountId,
28 | item_id = itemId,
29 | category = category,
30 | pending = pending,
31 | subcategory = subcategory,
32 | iso_currency_code = isoCurrencyCode,
33 | merchant_name = merchantName
34 | )
35 |
36 | internal fun List.toEntities(): List = this.map { it.toEntity() }
37 |
--------------------------------------------------------------------------------
/data/db/src/commonMain/kotlin/tech/alexib/yaba/data/db/mapper/UserEntityMapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.db.mapper
17 |
18 | import tech.alexib.yaba.data.db.UserEntity
19 | import tech.alexib.yaba.model.User
20 |
21 | fun User.toEntity(): UserEntity = UserEntity(this.id, this.email)
22 |
--------------------------------------------------------------------------------
/data/db/src/commonMain/kotlin/tech/alexib/yaba/data/db/util/CoroutineExtensions.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.db.util
17 |
18 | import com.squareup.sqldelight.Transacter
19 | import com.squareup.sqldelight.TransactionWithoutReturn
20 | import kotlinx.coroutines.withContext
21 | import kotlin.coroutines.CoroutineContext
22 |
23 | // all credit to https://github.com/touchlab/KaMPKit
24 |
25 | suspend fun Transacter.transactionWithContext(
26 | coroutineContext: CoroutineContext,
27 | noEnclosing: Boolean = false,
28 | body: TransactionWithoutReturn.() -> Unit
29 | ) {
30 | withContext(coroutineContext) {
31 | this@transactionWithContext.transaction(noEnclosing) {
32 | body()
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/data/db/src/commonMain/kotlin/tech/alexib/yaba/data/db/util/adapters.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.db.util
17 |
18 | import com.benasher44.uuid.Uuid
19 | import com.benasher44.uuid.uuidFrom
20 | import com.squareup.sqldelight.ColumnAdapter
21 | import kotlinx.datetime.Instant
22 | import kotlinx.datetime.LocalDate
23 | import kotlinx.datetime.TimeZone
24 | import kotlinx.datetime.atStartOfDayIn
25 | import kotlinx.datetime.toLocalDateTime
26 |
27 | class DateAdapter : ColumnAdapter {
28 | override fun decode(databaseValue: Long): LocalDate =
29 | Instant.fromEpochSeconds(databaseValue)
30 | .toLocalDateTime(TimeZone.currentSystemDefault()).date
31 |
32 | override fun encode(value: LocalDate): Long =
33 | value.atStartOfDayIn(TimeZone.currentSystemDefault()).epochSeconds
34 | }
35 |
36 | class UuidAdapter : ColumnAdapter {
37 | override fun decode(databaseValue: String): Uuid =
38 | uuidFrom(databaseValue)
39 |
40 | override fun encode(value: Uuid): String =
41 | value.toString()
42 | }
43 |
--------------------------------------------------------------------------------
/data/db/src/commonMain/sqldelight/databases/10.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/data/db/src/commonMain/sqldelight/databases/10.db
--------------------------------------------------------------------------------
/data/db/src/commonMain/sqldelight/databases/11.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/data/db/src/commonMain/sqldelight/databases/11.db
--------------------------------------------------------------------------------
/data/db/src/commonMain/sqldelight/databases/12.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/data/db/src/commonMain/sqldelight/databases/12.db
--------------------------------------------------------------------------------
/data/db/src/commonMain/sqldelight/migrations/11.sqm:
--------------------------------------------------------------------------------
1 | DROP VIEW IF EXISTS UserTransasctionDetail;
2 |
3 | CREATE VIEW UserTransactionDetail
4 | AS
5 | SELECT
6 | t.id,
7 | t.account_id,
8 | t.item_id,
9 | a.user_id,
10 | t.category,
11 | t.subcategory,
12 | t.type,
13 | t.name,
14 | t.iso_currency_code,
15 | t.date,
16 | t.amount,
17 | t.pending,
18 | t.merchant_name,
19 | a.name AS accountName,
20 | a.mask,
21 | a.institutionName
22 | FROM
23 | TransactionEntity t
24 | LEFT JOIN UserAccount a ON t.account_id = a.id;
25 |
--------------------------------------------------------------------------------
/data/db/src/commonMain/sqldelight/tech/alexib/yaba/data/db/InstitutionEntity.sq:
--------------------------------------------------------------------------------
1 | CREATE TABLE InstitutionEntity (
2 | id TEXT PRIMARY KEY NOT NULL,
3 | logo TEXT NOT NULL,
4 | name TEXT NOT NULL,
5 | primary_color TEXT NOT NULL
6 | );
7 |
8 | insertInstitution:
9 | INSERT OR REPLACE INTO InstitutionEntity
10 | VALUES ?;
11 |
12 |
13 | selectAll:
14 | SELECT * FROM InstitutionEntity;
15 |
16 |
--------------------------------------------------------------------------------
/data/db/src/commonMain/sqldelight/tech/alexib/yaba/data/db/ItemEntity.sq:
--------------------------------------------------------------------------------
1 | import com.benasher44.uuid.Uuid;
2 |
3 | CREATE TABLE ItemEntity (
4 | id TEXT AS Uuid PRIMARY KEY NOT NULL ON CONFLICT REPLACE,
5 | plaid_institution_id TEXT NOT NULL,
6 | user_id TEXT AS Uuid NOT NULL,
7 | FOREIGN KEY (plaid_institution_id) REFERENCES InstitutionEntity(id),
8 | FOREIGN KEY(user_id) REFERENCES UserEntity(id)
9 | ON DELETE CASCADE
10 | ON UPDATE CASCADE
11 | );
12 |
13 | CREATE VIEW itemWithLogo AS
14 | SELECT
15 | i.id,
16 | i.plaid_institution_id,
17 | i.user_id,
18 | inst.name,
19 | inst.logo
20 | FROM ItemEntity i
21 | JOIN InstitutionEntity inst ON i.plaid_institution_id = inst.id;
22 |
23 | insert:
24 | INSERT OR IGNORE INTO ItemEntity
25 | VALUES ?;
26 |
27 | count:
28 | SELECT COUNT(*)
29 | FROM itemWithLogo
30 | WHERE user_id = ?;
31 |
32 | selectAll:
33 | SELECT *
34 | FROM itemWithLogo
35 | WHERE itemWithLogo.user_id = ?;
36 |
37 | selectById:
38 | SELECT *
39 | FROM itemWithLogo
40 | WHERE itemWithLogo.id = ?;
41 |
42 | deleteById:
43 | DELETE FROM ItemEntity
44 | WHERE id = ?;
45 |
--------------------------------------------------------------------------------
/data/db/src/commonMain/sqldelight/tech/alexib/yaba/data/db/UserEntity.sq:
--------------------------------------------------------------------------------
1 | import com.benasher44.uuid.Uuid;
2 | CREATE TABLE UserEntity (
3 | id TEXT AS Uuid PRIMARY KEY NOT NULL,
4 | email TEXT NOT NULL
5 | );
6 |
7 | insert:
8 | INSERT INTO UserEntity
9 | VALUES ?
10 | ON CONFLICT(id)
11 | DO UPDATE
12 | SET email = excluded.email;
13 |
14 | selectById:
15 | SELECT * FROM UserEntity
16 | WHERE id = ?;
17 |
18 | deleteById:
19 | DELETE FROM UserEntity
20 | WHERE id = ?;
21 |
--------------------------------------------------------------------------------
/data/domain/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | .gradle
3 |
--------------------------------------------------------------------------------
/data/domain/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("multiplatform-plugin")
3 | kotlin("plugin.serialization")
4 | }
5 |
6 | dependencies {
7 | commonMainApi(projects.base)
8 | }
9 |
--------------------------------------------------------------------------------
/data/domain/src/androidMain/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/data/domain/src/commonMain/kotlin/tech/alexib/yaba/data/domain/AuthTokenProvider.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.domain
17 |
18 | import kotlinx.coroutines.flow.Flow
19 |
20 | interface AuthTokenProvider {
21 | fun token(): Flow
22 | }
23 |
--------------------------------------------------------------------------------
/data/domain/src/commonMain/kotlin/tech/alexib/yaba/data/domain/DataResult.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.domain
17 |
18 | sealed class DataResult {
19 | open fun get(): T? = null
20 |
21 | fun getOrThrow(): T = when (this) {
22 | is Success -> get()
23 | is ErrorResult -> throw RuntimeException(this.error)
24 | }
25 | }
26 |
27 | data class Success(val data: T) : DataResult() {
28 | override fun get(): T = data
29 | }
30 |
31 | data class ErrorResult(val error: String) : DataResult()
32 |
--------------------------------------------------------------------------------
/data/domain/src/commonMain/kotlin/tech/alexib/yaba/data/domain/dto/AccountDto.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.domain.dto
17 |
18 | import com.benasher44.uuid.Uuid
19 | import kotlinx.serialization.Contextual
20 | import kotlinx.serialization.Serializable
21 | import tech.alexib.yaba.model.AccountSubtype
22 | import tech.alexib.yaba.model.AccountType
23 |
24 | @Serializable
25 | data class AccountDto(
26 | @Contextual
27 | val id: Uuid,
28 | val name: String,
29 | val currentBalance: Double,
30 | val availableBalance: Double? = null,
31 | val creditLimit: Double? = null,
32 | val mask: String,
33 | @Contextual
34 | val itemId: Uuid,
35 | val type: AccountType,
36 | val subtype: AccountSubtype,
37 | val hidden: Boolean = false,
38 | )
39 |
--------------------------------------------------------------------------------
/data/domain/src/commonMain/kotlin/tech/alexib/yaba/data/domain/dto/AccountWithTransactionsDto.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.domain.dto
17 |
18 | import kotlinx.serialization.Serializable
19 |
20 | @Serializable
21 | data class AccountWithTransactionsDto(
22 | val account: AccountDto,
23 | val transactions: List,
24 | )
25 |
--------------------------------------------------------------------------------
/data/domain/src/commonMain/kotlin/tech/alexib/yaba/data/domain/dto/InstitutionDto.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.domain.dto
17 |
18 | import kotlinx.serialization.Serializable
19 |
20 | @Serializable
21 | data class InstitutionDto(
22 | val institutionId: String,
23 | val logo: String,
24 | val name: String,
25 | val primaryColor: String,
26 | )
27 |
--------------------------------------------------------------------------------
/data/domain/src/commonMain/kotlin/tech/alexib/yaba/data/domain/dto/ItemDto.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.domain.dto
17 |
18 | import com.benasher44.uuid.Uuid
19 | import kotlinx.serialization.Contextual
20 | import kotlinx.serialization.Serializable
21 |
22 | @Serializable
23 | data class ItemDto(
24 | @Contextual
25 | val id: Uuid,
26 | val plaidInstitutionId: String,
27 | @Contextual
28 | val userId: Uuid
29 | )
30 |
--------------------------------------------------------------------------------
/data/domain/src/commonMain/kotlin/tech/alexib/yaba/data/domain/dto/NewItemDto.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.domain.dto
17 |
18 | import kotlinx.serialization.Serializable
19 | import tech.alexib.yaba.model.User
20 |
21 | @Serializable
22 | data class NewItemDto(
23 | val user: User,
24 | val institutionDto: InstitutionDto,
25 | val item: ItemDto,
26 | val accounts: List,
27 | val transactions: List
28 | )
29 |
--------------------------------------------------------------------------------
/data/domain/src/commonMain/kotlin/tech/alexib/yaba/data/domain/dto/TransactionDto.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | @file:UseSerializers(UuidSerializer::class)
17 |
18 | package tech.alexib.yaba.data.domain.dto
19 |
20 | import com.benasher44.uuid.Uuid
21 | import kotlinx.datetime.LocalDate
22 | import kotlinx.serialization.Serializable
23 | import kotlinx.serialization.UseSerializers
24 | import tech.alexib.yaba.model.TransactionType
25 | import tech.alexib.yaba.util.UuidSerializer
26 |
27 | @Serializable
28 | data class TransactionDto(
29 | val id: Uuid,
30 | val name: String,
31 | val type: TransactionType,
32 | val amount: Double,
33 | val date: LocalDate,
34 | val accountId: Uuid,
35 | val itemId: Uuid,
36 | val category: String?,
37 | val subcategory: String?,
38 | val isoCurrencyCode: String?,
39 | val pending: Boolean?,
40 | val merchantName: String? = null
41 | )
42 |
--------------------------------------------------------------------------------
/data/domain/src/commonMain/kotlin/tech/alexib/yaba/data/domain/dto/TransactionsUpdateDto.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.domain.dto
17 |
18 | import com.benasher44.uuid.Uuid
19 |
20 | data class TransactionsUpdateDto(
21 | val added: List? = null,
22 | val removed: List? = null
23 | )
24 |
--------------------------------------------------------------------------------
/data/domain/src/commonMain/kotlin/tech/alexib/yaba/data/domain/dto/UserDataDto.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.domain.dto
17 |
18 | import kotlinx.serialization.Serializable
19 | import tech.alexib.yaba.model.User
20 |
21 | @Serializable
22 | data class UserDataDto(
23 | val user: User,
24 | val transactions: List,
25 | val items: List,
26 | val accounts: List,
27 | val institutions: List
28 | )
29 |
--------------------------------------------------------------------------------
/data/network/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | .gradle
3 |
--------------------------------------------------------------------------------
/data/network/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("multiplatform-plugin")
3 | kotlin("plugin.serialization")
4 | id("com.apollographql.apollo3")
5 | }
6 |
7 | dependencies {
8 | with(Lib.Apollo) {
9 | commonMainImplementation(runtime)
10 | commonMainImplementation(adapters)
11 | }
12 | commonMainImplementation(projects.data.domain)
13 | }
14 |
15 | configure {
16 | customScalarsMapping.set(
17 | mapOf(
18 | "UUID" to "com.benasher44.uuid.Uuid",
19 | "LocalDate" to "kotlinx.datetime.LocalDate"
20 | )
21 | )
22 | packageName.set("yaba.schema")
23 | generateSchema.set(true)
24 | }
25 |
--------------------------------------------------------------------------------
/data/network/src/androidMain/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/data/network/src/commonMain/graphql/tech/alexib/yaba/.graphqlconfig:
--------------------------------------------------------------------------------
1 | {
2 | "name": "yaba GraphQL Schema",
3 | "schemaPath": "schema.json",
4 | "extensions": {
5 | "endpoints": {
6 | "Default GraphQL Endpoint": {
7 | "url": "http://192.168.86.231:9050/graphql",
8 |
9 | "introspect": true
10 | }
11 | }
12 | }
13 | }
--------------------------------------------------------------------------------
/data/network/src/commonMain/graphql/tech/alexib/yaba/Account.graphql:
--------------------------------------------------------------------------------
1 | query AccountById($id:UUID!){
2 | accountById(id: $id){
3 | ...Account
4 | }
5 | }
6 | query AccountByIdWithTransaction($id:UUID!){
7 | accountById(id: $id){
8 | ...AccountWithTransactions
9 | }
10 | }
11 |
12 | fragment Account on Account{
13 | id
14 | name
15 | currentBalance
16 | availableBalance
17 | creditLimit
18 | mask
19 | itemId
20 | type
21 | subtype
22 | hidden
23 |
24 | }
25 |
26 | fragment AccountWithTransactions on Account{
27 | ...Account
28 | transactions{
29 | ...Transaction
30 | }
31 |
32 | }
33 |
34 | mutation AccountSetHidden($id:UUID!,$hidden:Boolean!){
35 | setAccountHidden(input: {accountId: $id,hide: $hidden})
36 | }
37 |
38 | fragment Transaction on Transaction{
39 | name
40 | id
41 | type
42 | amount
43 | date
44 | accountId
45 | itemId
46 | category
47 | pending
48 | subcategory
49 | isoCurrencyCode
50 | merchantName
51 | }
52 |
53 | query AccountsByItemId($itemId:UUID!){
54 | accountsByItemId(itemId: $itemId){
55 | ...Account
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/data/network/src/commonMain/graphql/tech/alexib/yaba/AuthMutations.graphql:
--------------------------------------------------------------------------------
1 | mutation Login($email:String!,$password:String!){
2 | login(input:{email:$email,password:$password}){
3 | id
4 | email
5 | token
6 | }
7 | }
8 |
9 | mutation Register($email:String!,$password:String!){
10 | register(input:{email:$email,password:$password}){
11 | id
12 | email
13 | token
14 | }
15 | }
16 |
17 | query VerifyToken{
18 | me{
19 | id
20 | email
21 | }
22 | }
--------------------------------------------------------------------------------
/data/network/src/commonMain/graphql/tech/alexib/yaba/PlaidItem.graphql:
--------------------------------------------------------------------------------
1 | mutation CreateItem($institutionId:String!,$publicToken:String!){
2 | itemCreate(input:{
3 | publicToken:$publicToken,
4 | institutionId:$institutionId
5 | }){
6 | name
7 | logo
8 | itemId
9 | accounts{
10 | mask
11 | name
12 | plaidAccountId
13 | }
14 | }
15 | }
16 |
17 |
18 | mutation SetAccountsToHide($itemId:UUID!,$plaidAccountIds:[String!]!){
19 | setAccountsToHide(itemId:$itemId,plaidAccountIds: $plaidAccountIds)
20 | }
21 |
22 | mutation UnlinkItem($itemId:UUID!){
23 | itemUnlink(itemId: $itemId)
24 | }
--------------------------------------------------------------------------------
/data/network/src/commonMain/graphql/tech/alexib/yaba/PlaidLinkMutations.graphql:
--------------------------------------------------------------------------------
1 | mutation CreateLinkToken{
2 | createLinkToken{
3 | linkToken
4 | }
5 | }
6 |
7 |
8 | mutation CreateLinkEvent($requestId:String @optional,$type:String!,$linkSessionId:String!
9 | $errorCode:String @optional,$errorType:String @optional){
10 | createLinkEvent(input:{
11 | requestId: $requestId,
12 | type:$type,
13 | linkSessionId: $linkSessionId,
14 | errorCode: $errorCode,
15 | errorType: $errorType
16 | })
17 | }
18 |
--------------------------------------------------------------------------------
/data/network/src/commonMain/graphql/tech/alexib/yaba/PushToken.graphql:
--------------------------------------------------------------------------------
1 | mutation PushTokenInsert($token:String!){
2 | pushTokenInsert(token:$token)
3 | }
4 |
5 | mutation PushTokenDelete($token:String!){
6 | pushTokenDelete(token: $token)
7 | }
8 |
--------------------------------------------------------------------------------
/data/network/src/commonMain/graphql/tech/alexib/yaba/TestSub.graphql:
--------------------------------------------------------------------------------
1 | subscription TestSub($user:String!){
2 | testSub(user: $user)
3 | }
4 |
--------------------------------------------------------------------------------
/data/network/src/commonMain/graphql/tech/alexib/yaba/UserData.graphql:
--------------------------------------------------------------------------------
1 | fragment Institution on Institution{
2 | institutionId
3 | name
4 | logo
5 | primaryColor
6 | }
7 |
8 | query UserTransactions{
9 | transactionsByUser{
10 | ...Transaction
11 | }
12 | }
13 |
14 | query UserAccounts{
15 | accountsByUser{
16 | ...Account
17 | }
18 | }
19 |
20 | fragment ItemWithInstitution on Item{
21 | id
22 | plaidInstitutionId
23 | institution{
24 | ...Institution
25 | }
26 | }
27 |
28 | query NewItemData($id:UUID!){
29 | me{
30 | id
31 | email
32 | }
33 | itemById(itemId: $id){
34 | ...ItemWithInstitution
35 | accounts{
36 | ...AccountWithTransactions
37 | }
38 | }
39 | }
40 |
41 |
42 |
43 | query AllUserData{
44 | me{
45 | id
46 | email
47 | accounts{
48 | ...Account
49 | }
50 | items{
51 | ...ItemWithInstitution
52 | }
53 | transactions{
54 | ...Transaction
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/data/network/src/commonMain/graphql/tech/alexib/yaba/UserTransactions.graphql:
--------------------------------------------------------------------------------
1 | query TransactionsById($ids:[UUID!]!){
2 | transactionsByIds(ids:$ids){
3 | ...Transaction
4 | }
5 | }
6 |
7 | query TransactionsUpdate($id:UUID!){
8 | transactionsUpdated(updateId: $id){
9 | added {
10 | ...Transaction
11 | }
12 | removed
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/data/network/src/commonMain/kotlin/tech/alexib/yaba/data/network/api/PushTokenApi.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.network.api
17 |
18 | import kotlinx.coroutines.flow.firstOrNull
19 | import tech.alexib.yaba.data.network.apollo.YabaApolloClient
20 | import yaba.schema.PushTokenDeleteMutation
21 | import yaba.schema.PushTokenInsertMutation
22 |
23 | interface PushTokenApi {
24 | suspend fun save(token: String)
25 | suspend fun delete(token: String)
26 |
27 | class Impl(
28 | private val client: YabaApolloClient
29 | ) : PushTokenApi {
30 | override suspend fun save(token: String) {
31 | val mutation = PushTokenInsertMutation(token)
32 | client.mutate(mutation).firstOrNull()
33 | }
34 |
35 | override suspend fun delete(token: String) {
36 | val mutation = PushTokenDeleteMutation(token)
37 | client.mutate(mutation).firstOrNull()
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/data/network/src/commonMain/kotlin/tech/alexib/yaba/data/network/apollo/scalarTypeAdapters.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.network.apollo
17 |
18 | import com.apollographql.apollo3.api.Adapter
19 | import com.apollographql.apollo3.api.CustomScalarAdapters
20 | import com.apollographql.apollo3.api.json.JsonReader
21 | import com.apollographql.apollo3.api.json.JsonWriter
22 | import com.benasher44.uuid.Uuid
23 | import com.benasher44.uuid.uuidFrom
24 |
25 | internal val uuidAdapter = object : Adapter {
26 |
27 | override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): Uuid {
28 | return uuidFrom(reader.nextString()!!)
29 | }
30 |
31 | override fun toJson(
32 | writer: JsonWriter,
33 | customScalarAdapters: CustomScalarAdapters,
34 | value: Uuid
35 | ) {
36 | writer.value(value.toString())
37 | }
38 | }
39 |
40 | internal val customScalarTypeAdapters = CustomScalarAdapters(
41 | mapOf(
42 | "UUID" to uuidAdapter,
43 | "id" to uuidAdapter,
44 | )
45 | )
46 |
--------------------------------------------------------------------------------
/data/network/src/commonMain/kotlin/tech/alexib/yaba/data/network/mapper/AccountDtoMapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.network.mapper
17 |
18 | import tech.alexib.yaba.data.domain.dto.AccountDto
19 | import tech.alexib.yaba.data.domain.dto.AccountWithTransactionsDto
20 | import tech.alexib.yaba.model.AccountSubtype
21 | import tech.alexib.yaba.model.AccountType
22 |
23 | internal fun yaba.schema.fragment.Account.toDto(): AccountDto = AccountDto(
24 | id = id,
25 | name = name,
26 | mask = mask,
27 | availableBalance = availableBalance,
28 | currentBalance = currentBalance,
29 | creditLimit = creditLimit,
30 | itemId = itemId,
31 | type = AccountType.valueOf(type.rawValue),
32 | subtype = AccountSubtype.valueOf(subtype.rawValue),
33 | hidden = hidden
34 | )
35 |
36 | internal fun yaba.schema.fragment.AccountWithTransactions.toAccountWithTransactions() =
37 | AccountWithTransactionsDto(
38 | account = this.fragments.account.toDto(),
39 | transactions = transactions.map { it.fragments.transaction.toDto() }
40 | )
41 |
--------------------------------------------------------------------------------
/data/network/src/commonMain/kotlin/tech/alexib/yaba/data/network/mapper/AuthMapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.network.mapper
17 |
18 | import tech.alexib.yaba.model.response.AuthResponse
19 |
20 | internal fun yaba.schema.LoginMutation.Login.toAuthResponse() = AuthResponse(
21 | id = id,
22 | email = email,
23 | token = token
24 | )
25 |
26 | internal fun yaba.schema.RegisterMutation.Register.toAuthResponse() = AuthResponse(
27 | id = id,
28 | email = email,
29 | token = token
30 | )
31 |
--------------------------------------------------------------------------------
/data/network/src/commonMain/kotlin/tech/alexib/yaba/data/network/mapper/InstitutionMapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.network.mapper
17 |
18 | import tech.alexib.yaba.data.domain.dto.InstitutionDto
19 |
20 | internal fun yaba.schema.fragment.Institution.toDto(): InstitutionDto = this.run {
21 | InstitutionDto(
22 | institutionId = institutionId,
23 | name = name,
24 | logo = logo,
25 | primaryColor = primaryColor ?: "#095aa6"
26 | )
27 | }
28 |
29 | internal fun yaba.schema.fragment.ItemWithInstitution.Institution.toDto(): InstitutionDto =
30 | this.run {
31 | val institution = fragments.institution
32 | institution.toDto()
33 | }
34 |
--------------------------------------------------------------------------------
/data/network/src/commonMain/kotlin/tech/alexib/yaba/data/network/mapper/ItemMapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.network.mapper
17 |
18 | import com.benasher44.uuid.Uuid
19 | import tech.alexib.yaba.data.domain.dto.ItemDto
20 | import tech.alexib.yaba.model.PlaidItem
21 |
22 | internal fun yaba.schema.fragment.ItemWithInstitution.toDto(userId: Uuid) = this.run {
23 | ItemDto(
24 | id = id,
25 | plaidInstitutionId = plaidInstitutionId,
26 | userId
27 | )
28 | }
29 |
30 | internal fun yaba.schema.fragment.ItemWithInstitution.toPlaidItem() = this.run {
31 | val institution = institution.fragments.institution
32 | PlaidItem(
33 | id = id,
34 | plaidInstitutionId = plaidInstitutionId,
35 | name = institution.name,
36 | base64Logo = institution.logo
37 | )
38 | }
39 |
--------------------------------------------------------------------------------
/data/network/src/commonMain/kotlin/tech/alexib/yaba/data/network/mapper/PlaidItemCreateResponseMapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.network.mapper
17 |
18 | import tech.alexib.yaba.model.response.PlaidItemCreateResponse
19 |
20 | internal fun yaba.schema.CreateItemMutation.ItemCreate.toResponse() = PlaidItemCreateResponse(
21 | id = itemId,
22 | name = name,
23 | logo = logo,
24 | accounts = accounts.map { account ->
25 | PlaidItemCreateResponse.Account(
26 | mask = account.mask,
27 | plaidAccountId = account.plaidAccountId,
28 | name = account.name
29 | )
30 | }
31 | )
32 |
--------------------------------------------------------------------------------
/data/network/src/commonMain/kotlin/tech/alexib/yaba/data/network/mapper/PlaidItemMutationMapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.network.mapper
17 |
18 | import tech.alexib.yaba.model.response.PlaidItemCreateResponse
19 |
20 | internal fun yaba.schema.CreateItemMutation.Data.toResponse(): PlaidItemCreateResponse =
21 | this.itemCreate.run {
22 | PlaidItemCreateResponse(
23 | id = itemId,
24 | name = name,
25 | logo = logo,
26 | accounts = accounts.map { account ->
27 | PlaidItemCreateResponse.Account(
28 | mask = account.mask,
29 | plaidAccountId = account.plaidAccountId,
30 | name = account.name
31 | )
32 | }
33 | )
34 | }
35 |
--------------------------------------------------------------------------------
/data/network/src/commonMain/kotlin/tech/alexib/yaba/data/network/mapper/PlaidLinkEventMapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.network.mapper
17 |
18 | import com.apollographql.apollo3.api.Optional.Companion.presentIfNotNull
19 | import tech.alexib.yaba.model.request.PlaidLinkEventCreateRequest
20 | import yaba.schema.CreateLinkEventMutation
21 |
22 | internal fun PlaidLinkEventCreateRequest.toMutation(): CreateLinkEventMutation {
23 | return when (this) {
24 | is PlaidLinkEventCreateRequest.Exit -> CreateLinkEventMutation(
25 | type = "LinkExit",
26 | requestId = presentIfNotNull(requestId),
27 | errorCode = presentIfNotNull(errorCode),
28 | errorType = presentIfNotNull(errorType),
29 | linkSessionId = linkSessionId
30 | )
31 | is PlaidLinkEventCreateRequest.Success -> CreateLinkEventMutation(
32 | type = "LinkSuccess",
33 | linkSessionId = linkSessionId,
34 | )
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/data/network/src/commonMain/kotlin/tech/alexib/yaba/data/network/mapper/TransactionDtoMapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.network.mapper
17 |
18 | import tech.alexib.yaba.data.domain.dto.TransactionDto
19 | import tech.alexib.yaba.model.TransactionType
20 |
21 | internal fun yaba.schema.fragment.Transaction.toDto() = TransactionDto(
22 | name = name,
23 | id = id,
24 | type = TransactionType.valueOf(type.uppercase()),
25 | amount = amount,
26 | date = date,
27 | accountId = accountId,
28 | itemId = itemId,
29 | category = category,
30 | pending = pending,
31 | subcategory = subcategory,
32 | isoCurrencyCode = isoCurrencyCode,
33 | merchantName = merchantName
34 | )
35 |
--------------------------------------------------------------------------------
/data/network/src/commonMain/kotlin/tech/alexib/yaba/data/network/mapper/TransactionUpdateDtoMapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.network.mapper
17 |
18 | import tech.alexib.yaba.data.domain.dto.TransactionsUpdateDto
19 |
20 | internal fun yaba.schema.TransactionsUpdateQuery.Data.toDto(): TransactionsUpdateDto? = this.run {
21 | transactionsUpdated?.let { data ->
22 | val added =
23 | data.added?.map { it.fragments.transaction.toDto() }
24 | val removed = data.removed
25 | TransactionsUpdateDto(added, removed)
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/data/network/src/commonMain/kotlin/tech/alexib/yaba/data/network/mapper/UserDataDtoMapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.network.mapper
17 |
18 | import tech.alexib.yaba.data.domain.dto.UserDataDto
19 | import tech.alexib.yaba.model.User
20 |
21 | internal fun yaba.schema.AllUserDataQuery.Data.toDto(): UserDataDto {
22 | val data = this.me
23 | val userId = data.id
24 |
25 | return UserDataDto(
26 | user = User(userId, data.email),
27 | institutions = data.items.map {
28 | it.fragments.itemWithInstitution.institution.toDto()
29 | },
30 | items = data.items.map {
31 | it.fragments.itemWithInstitution.toDto(userId)
32 | },
33 | accounts = data.accounts.map { account ->
34 | account.fragments.account.toDto()
35 | },
36 | transactions = data.transactions.map { transaction ->
37 | transaction.fragments.transaction.toDto()
38 | }
39 | )
40 | }
41 |
--------------------------------------------------------------------------------
/data/src/androidMain/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/data/src/androidMain/kotlin/tech/alexib/yaba/data/PlatformAndroid.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data
17 |
18 | actual typealias Immutable = androidx.compose.runtime.Immutable
19 |
20 | actual typealias Parcelize = kotlinx.parcelize.Parcelize
21 |
22 | actual typealias Parcelable = android.os.Parcelable
23 |
--------------------------------------------------------------------------------
/data/src/androidMain/kotlin/tech/alexib/yaba/data/auth/SessionManager.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.auth
17 |
18 | import tech.alexib.yaba.data.repository.AuthRepository
19 |
20 | class SessionManager(
21 | authRepository: AuthRepository
22 | ) : AuthRepository by authRepository
23 |
--------------------------------------------------------------------------------
/data/src/androidMain/kotlin/tech/alexib/yaba/data/task/UserPushTokenWorker.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.task
17 |
18 | import android.content.Context
19 | import androidx.work.CoroutineWorker
20 | import androidx.work.Data
21 | import androidx.work.WorkerParameters
22 | import tech.alexib.yaba.data.repository.PushTokenRepository
23 |
24 | class UserPushTokenWorker(
25 | private val pushTokenRepository: PushTokenRepository,
26 | context: Context,
27 | params: WorkerParameters
28 | ) : CoroutineWorker(context, params) {
29 |
30 | companion object {
31 | const val key = "token"
32 | fun addToken(token: String) = Data.Builder().putString(key, token).build()
33 | }
34 |
35 | override suspend fun doWork(): Result {
36 | val token = inputData.getString(key)
37 | token?.let {
38 | pushTokenRepository.save(it)
39 | }
40 | return Result.success()
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/data/src/androidTest/kotlin/tech/alexib/yaba/data/BaseTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data
17 |
18 | import androidx.test.ext.junit.runners.AndroidJUnit4
19 | import kotlinx.coroutines.CoroutineScope
20 | import kotlinx.coroutines.runBlocking
21 | import org.junit.Rule
22 | import org.junit.runner.RunWith
23 | @Suppress("UnnecessaryAbstractClass")
24 | @RunWith(AndroidJUnit4::class)
25 | actual abstract class BaseTest {
26 | @get:Rule
27 | var coroutineTestRule = CoroutineTestRule()
28 |
29 | actual fun runTest(block: suspend CoroutineScope.() -> T) {
30 | runBlocking { block() }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/data/src/androidTest/kotlin/tech/alexib/yaba/data/CoroutineTestRule.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data
17 |
18 | import kotlinx.coroutines.Dispatchers
19 | import kotlinx.coroutines.ExecutorCoroutineDispatcher
20 | import kotlinx.coroutines.asCoroutineDispatcher
21 | import kotlinx.coroutines.test.resetMain
22 | import kotlinx.coroutines.test.setMain
23 | import org.junit.rules.TestWatcher
24 | import org.junit.runner.Description
25 | import java.util.concurrent.Executors
26 |
27 | /**
28 | * Use this rule to update the Main dispatcher ahead of tests. By delegating the main dispatcher to a new thread.
29 | * we can block the current thread and still dispatch main coroutines
30 | */
31 | class CoroutineTestRule(
32 | private val testDispatcher: ExecutorCoroutineDispatcher = Executors.newSingleThreadExecutor()
33 | .asCoroutineDispatcher()
34 | ) : TestWatcher() {
35 | override fun starting(description: Description?) {
36 | super.starting(description)
37 | Dispatchers.setMain(testDispatcher)
38 | }
39 |
40 | override fun finished(description: Description?) {
41 | super.finished(description)
42 | Dispatchers.resetMain()
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/data/src/androidTest/kotlin/tech/alexib/yaba/data/testDeps.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data
17 |
18 | import co.touchlab.kermit.CommonLogger
19 | import co.touchlab.kermit.Kermit
20 | import com.squareup.sqldelight.db.SqlDriver
21 | import com.squareup.sqldelight.logs.LogSqliteDriver
22 | import com.squareup.sqldelight.sqlite.driver.JdbcSqliteDriver
23 | import tech.alexib.yaba.data.db.YabaDb
24 |
25 | actual fun createInMemorySqlDriver(): SqlDriver {
26 | val log = Kermit(CommonLogger())
27 | val driver = JdbcSqliteDriver(JdbcSqliteDriver.IN_MEMORY).apply {
28 | YabaDb.Schema.create(this)
29 | }
30 | driver.execute(null, "PRAGMA foreign_keys = 1", 0, null)
31 | return LogSqliteDriver(driver) { log.d { it } }
32 | }
33 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/Platform.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data
17 |
18 | @OptIn(ExperimentalMultiplatform::class)
19 | @MustBeDocumented
20 | @Target(AnnotationTarget.CLASS)
21 | @Retention(AnnotationRetention.BINARY)
22 | @OptionalExpectation
23 | expect annotation class Immutable()
24 |
25 | @OptIn(ExperimentalMultiplatform::class)
26 | @MustBeDocumented
27 | @Target(AnnotationTarget.CLASS)
28 | @Retention(AnnotationRetention.BINARY)
29 | @OptionalExpectation
30 | expect annotation class Parcelize()
31 |
32 | expect interface Parcelable
33 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/fcm/PushTokenManager.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.fcm
17 |
18 | interface PushTokenManager {
19 | fun saveToken(token: String)
20 | fun deleteToken(token: String)
21 | }
22 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/interactor/ClearAppData.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.interactor
17 |
18 | import tech.alexib.yaba.Interactor
19 | import tech.alexib.yaba.data.repository.UserRepository
20 | import tech.alexib.yaba.data.settings.AuthSettings
21 |
22 | class ClearAppData(
23 | private val authSettings: AuthSettings,
24 | private val userRepository: UserRepository
25 | ) : Interactor() {
26 | override suspend fun doWork(params: Unit) {
27 | authSettings.clearAppSettings()
28 | userRepository.deleteCurrentUser()
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/interactor/SetAccountsToHide.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.interactor
17 |
18 | import com.benasher44.uuid.Uuid
19 | import kotlinx.coroutines.CoroutineDispatcher
20 | import kotlinx.coroutines.withContext
21 | import tech.alexib.yaba.Interactor
22 | import tech.alexib.yaba.data.repository.ItemRepository
23 |
24 | class SetAccountsToHide(
25 | private val itemRepository: ItemRepository,
26 | private val backgroundDispatcher: CoroutineDispatcher
27 | ) : Interactor() {
28 |
29 | override suspend fun doWork(params: Params) {
30 | withContext(backgroundDispatcher) {
31 | itemRepository.setAccountsToHideSync(params.itemId, params.plaidAccountIds)
32 | }
33 | }
34 |
35 | data class Params(val itemId: Uuid, val plaidAccountIds: List)
36 | }
37 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/interactor/interactorModule.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.interactor
17 |
18 | import org.koin.dsl.module
19 | import tech.alexib.yaba.di.CoreDependencies.ioDispatcherQualifier
20 | import tech.alexib.yaba.util.getWith
21 |
22 | internal val interactorModule = module {
23 | single {
24 | AddItem(
25 | getWith("AddItemInteractor"),
26 | get(ioDispatcherQualifier),
27 | get(),
28 | get()
29 | )
30 | }
31 | single { ClearAppData(get(), get()) }
32 | single {
33 | PerformInitialSync(
34 | get(), get(), getWith("PerformInitialSyncInteractor"), get(),
35 | get(
36 | ioDispatcherQualifier
37 | )
38 | )
39 | }
40 | single {
41 | UpdateTransactions(
42 | getWith("UpdateTransactionsInteractor"),
43 | get(ioDispatcherQualifier),
44 | get(),
45 | get(),
46 | get()
47 | )
48 | }
49 | single { SetAccountsToHide(get(), get(ioDispatcherQualifier)) }
50 | }
51 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/observer/ObserveAccount.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.observer
17 |
18 | import com.benasher44.uuid.Uuid
19 | import kotlinx.coroutines.flow.Flow
20 | import tech.alexib.yaba.SubjectInteractor
21 | import tech.alexib.yaba.data.repository.AccountRepository
22 | import tech.alexib.yaba.model.Account
23 |
24 | class ObserveAccount(
25 | private val accountRepository: AccountRepository
26 | ) : SubjectInteractor() {
27 |
28 | override fun createObservable(params: Params): Flow {
29 | return accountRepository.getById(params.accountId)
30 | }
31 |
32 | data class Params(val accountId: Uuid)
33 | }
34 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/observer/ObserveAccountTransactions.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.observer
17 |
18 | import com.benasher44.uuid.Uuid
19 | import kotlinx.coroutines.flow.Flow
20 | import tech.alexib.yaba.SubjectInteractor
21 | import tech.alexib.yaba.data.repository.TransactionRepository
22 | import tech.alexib.yaba.model.Transaction
23 |
24 | class ObserveAccountTransactions(
25 | private val transactionRepository: TransactionRepository
26 | ) : SubjectInteractor>() {
27 |
28 | override fun createObservable(params: Params): Flow> {
29 | return transactionRepository.getAllByAccountId(params.accountId)
30 | }
31 |
32 | data class Params(val accountId: Uuid)
33 | }
34 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/observer/ObserveCurrentCashBalance.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.observer
17 |
18 | import kotlinx.coroutines.flow.Flow
19 | import tech.alexib.yaba.SubjectInteractor
20 | import tech.alexib.yaba.data.repository.AccountRepository
21 |
22 | class ObserveCurrentCashBalance(
23 | private val accountRepository: AccountRepository
24 | ) : SubjectInteractor() {
25 | override fun createObservable(params: Unit): Flow {
26 | return accountRepository.currentCashBalance()
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/observer/ObserveItem.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.observer
17 |
18 | import com.benasher44.uuid.Uuid
19 | import kotlinx.coroutines.flow.Flow
20 | import tech.alexib.yaba.SubjectInteractor
21 | import tech.alexib.yaba.data.repository.ItemRepository
22 | import tech.alexib.yaba.model.PlaidItem
23 |
24 | class ObserveItem(
25 | private val itemRepository: ItemRepository
26 | ) : SubjectInteractor() {
27 |
28 | override fun createObservable(params: Params): Flow {
29 | return itemRepository.getById(params.itemId)
30 | }
31 |
32 | data class Params(val itemId: Uuid)
33 | }
34 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/observer/ObserveItemsWithAccounts.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.observer
17 |
18 | import kotlinx.coroutines.flow.Flow
19 | import org.koin.core.component.KoinComponent
20 | import tech.alexib.yaba.SubjectInteractor
21 | import tech.alexib.yaba.data.repository.ItemRepository
22 | import tech.alexib.yaba.model.PlaidItemWithAccounts
23 |
24 | class ObserveItemsWithAccounts(
25 | private val itemRepository: ItemRepository
26 | ) : SubjectInteractor>(),
27 | KoinComponent {
28 |
29 | override fun createObservable(params: Params): Flow> {
30 | return itemRepository.getAllWithAccounts(params.includeHidden)
31 | }
32 |
33 | data class Params(val includeHidden: Boolean = false)
34 | }
35 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/observer/ObserveRecentTransactions.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.observer
17 |
18 | import kotlinx.coroutines.flow.Flow
19 | import tech.alexib.yaba.SubjectInteractor
20 | import tech.alexib.yaba.data.repository.TransactionRepository
21 | import tech.alexib.yaba.model.Transaction
22 |
23 | class ObserveRecentTransactions(
24 | private val transactionRepository: TransactionRepository
25 | ) : SubjectInteractor>() {
26 | override fun createObservable(params: Unit): Flow> {
27 | return transactionRepository.recentTransactions()
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/observer/ObserveTransactionDetail.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.observer
17 |
18 | import com.benasher44.uuid.Uuid
19 | import kotlinx.coroutines.flow.Flow
20 | import tech.alexib.yaba.SubjectInteractor
21 | import tech.alexib.yaba.data.repository.TransactionRepository
22 | import tech.alexib.yaba.model.TransactionDetail
23 |
24 | class ObserveTransactionDetail(
25 | private val transactionRepository: TransactionRepository
26 | ) : SubjectInteractor() {
27 | override fun createObservable(params: Uuid): Flow {
28 | return transactionRepository.getById(params)
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/observer/ObserveTransactions.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.observer
17 |
18 | import kotlinx.coroutines.flow.Flow
19 | import tech.alexib.yaba.SubjectInteractor
20 | import tech.alexib.yaba.data.repository.TransactionRepository
21 | import tech.alexib.yaba.model.Transaction
22 |
23 | class ObserveTransactions(
24 | private val transactionsRepository: TransactionRepository
25 | ) : SubjectInteractor>() {
26 |
27 | override fun createObservable(params: Params): Flow> {
28 | return transactionsRepository.getAll()
29 | }
30 |
31 | data class Params(val query: String?)
32 | }
33 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/observer/ObserveUserItemsCount.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.observer
17 |
18 | import kotlinx.coroutines.flow.Flow
19 | import tech.alexib.yaba.SubjectInteractor
20 | import tech.alexib.yaba.data.repository.ItemRepository
21 |
22 | class ObserveUserItemsCount(
23 | private val itemRepository: ItemRepository
24 | ) : SubjectInteractor() {
25 | override fun createObservable(params: Unit): Flow {
26 | return itemRepository.userItemsCount()
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/observer/observersModule.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.observer
17 |
18 | import org.koin.dsl.module
19 |
20 | internal val observersModule = module {
21 | single { ObserveCurrentCashBalance(get()) }
22 | single { ObserveRecentTransactions(get()) }
23 | single { ObserveUserItemsCount(get()) }
24 | single { ObserveItem(get()) }
25 | single { ObserveAccountTransactions(get()) }
26 | single { ObserveAccount(get()) }
27 | single { ObserveItemsWithAccounts(get()) }
28 | single { ObserveTransactionDetail(get()) }
29 | single { ObserveTransactions(get()) }
30 | single { ObserveSpendingCategoriesByDate(get()) }
31 | }
32 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/provider/AuthTokenProviderImpl.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.provider
17 |
18 | import kotlinx.coroutines.flow.Flow
19 | import tech.alexib.yaba.data.domain.AuthTokenProvider
20 | import tech.alexib.yaba.data.settings.AuthSettings
21 |
22 | class AuthTokenProviderImpl(
23 | private val authSettings: AuthSettings
24 | ) : AuthTokenProvider {
25 | override fun token(): Flow = authSettings.token()
26 | }
27 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/repository/PushTokenRepository.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.repository
17 |
18 | import kotlinx.coroutines.CoroutineDispatcher
19 | import kotlinx.coroutines.CoroutineScope
20 | import kotlinx.coroutines.launch
21 | import tech.alexib.yaba.data.network.api.PushTokenApi
22 |
23 | interface PushTokenRepository {
24 | suspend fun save(token: String)
25 | fun delete(token: String)
26 |
27 | class Impl(
28 | private val pushTokenApi: PushTokenApi,
29 | private val backgroundDispatcher: CoroutineDispatcher
30 | ) : PushTokenRepository {
31 |
32 | override suspend fun save(token: String) {
33 | pushTokenApi.save(token)
34 | }
35 |
36 | override fun delete(token: String) {
37 | CoroutineScope(backgroundDispatcher).launch {
38 | pushTokenApi.delete(token)
39 | }
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/store/AccountsStore.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.store
17 |
18 | import kotlinx.coroutines.flow.Flow
19 | import kotlinx.coroutines.flow.mapLatest
20 | import tech.alexib.yaba.data.Immutable
21 | import tech.alexib.yaba.data.observer.ObserveItemsWithAccounts
22 | import tech.alexib.yaba.model.PlaidItemWithAccounts
23 |
24 | class AccountsStore(
25 | observeItemsWithAccounts: ObserveItemsWithAccounts,
26 |
27 | ) {
28 |
29 | val state: Flow =
30 | observeItemsWithAccounts.flow.mapLatest {
31 | AccountsScreenState(it, false)
32 | }
33 |
34 | init {
35 | observeItemsWithAccounts(ObserveItemsWithAccounts.Params(false))
36 | }
37 | }
38 |
39 | @Immutable
40 | data class AccountsScreenState(
41 | val items: List = emptyList(),
42 | val loading: Boolean = false
43 | ) {
44 | companion object {
45 | val Empty = AccountsScreenState()
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/store/PlaidItemsStore.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.store
17 |
18 | import kotlinx.coroutines.flow.mapLatest
19 | import tech.alexib.yaba.data.Immutable
20 | import tech.alexib.yaba.data.observer.ObserveItemsWithAccounts
21 | import tech.alexib.yaba.model.PlaidItemWithAccounts
22 |
23 | class PlaidItemsStore(
24 | observeItemsWithAccounts: ObserveItemsWithAccounts
25 | ) {
26 |
27 | val state = observeItemsWithAccounts.flow.mapLatest {
28 | PlaidItemsScreenState(it, false)
29 | }
30 |
31 | init {
32 | observeItemsWithAccounts(ObserveItemsWithAccounts.Params(true))
33 | }
34 | }
35 |
36 | @Immutable
37 | data class PlaidItemsScreenState(
38 | val items: List = emptyList(),
39 | val loading: Boolean = true
40 | ) {
41 | companion object {
42 | val Empty = PlaidItemsScreenState()
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/store/TransactionDetailStore.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.store
17 |
18 | import com.benasher44.uuid.Uuid
19 | import kotlinx.coroutines.flow.Flow
20 | import kotlinx.coroutines.flow.mapLatest
21 | import tech.alexib.yaba.data.Immutable
22 | import tech.alexib.yaba.data.observer.ObserveTransactionDetail
23 | import tech.alexib.yaba.model.TransactionDetail
24 |
25 | class TransactionDetailStore(
26 | private val observeTransactionDetail: ObserveTransactionDetail,
27 | ) {
28 |
29 | val state: Flow = observeTransactionDetail
30 | .flow
31 | .mapLatest { TransactionDetailScreenState(false, it) }
32 |
33 | fun init(transactionId: Uuid) {
34 | observeTransactionDetail(transactionId)
35 | }
36 | }
37 |
38 | @Immutable
39 | data class TransactionDetailScreenState(
40 | val loading: Boolean = false,
41 | val transaction: TransactionDetail? = null
42 | ) {
43 | companion object {
44 | val Empty = TransactionDetailScreenState()
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/store/storeModule.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.store
17 |
18 | import org.koin.core.module.Module
19 | import org.koin.dsl.module
20 | import tech.alexib.yaba.util.getWith
21 |
22 | val storeModule: Module = module {
23 | single { parameters -> HomeStore(get(), get(), get(), get(), get(), parameters.get()) }
24 | single { AccountDetailStore(get(), get(), get()) }
25 | single { AccountsStore(get()) }
26 | single { TransactionDetailStore(get()) }
27 | single { params -> TransactionsStore(get(), params.get()) }
28 | single { params ->
29 | PlaidLinkResultStore(
30 | get(),
31 | get(),
32 | getWith("PlaidLinkResultStore"),
33 | params.get(),
34 | )
35 | }
36 | single { PlaidItemsStore(get()) }
37 | }
38 |
--------------------------------------------------------------------------------
/data/src/commonMain/kotlin/tech/alexib/yaba/data/util/SupervisorScope.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.util
17 |
18 | import kotlinx.coroutines.CoroutineDispatcher
19 | import kotlinx.coroutines.CoroutineScope
20 | import kotlinx.coroutines.SupervisorJob
21 | import kotlinx.coroutines.cancelChildren
22 | import kotlin.coroutines.CoroutineContext
23 |
24 | class SupervisorScope(dispatcher: CoroutineDispatcher) : CoroutineScope {
25 | private val job = SupervisorJob()
26 | override val coroutineContext: CoroutineContext = job + dispatcher
27 |
28 | fun clear() {
29 | job.cancelChildren()
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/data/src/commonTest/kotlin/tech/alexib/yaba/data/BaseTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data
17 |
18 | import kotlinx.coroutines.CoroutineScope
19 | @Suppress("UnnecessaryAbstractClass")
20 | expect abstract class BaseTest {
21 | fun runTest(block: suspend CoroutineScope.() -> T)
22 | }
23 |
--------------------------------------------------------------------------------
/data/src/commonTest/kotlin/tech/alexib/yaba/data/StubTests.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data
17 |
18 | import tech.alexib.yaba.data.stubs.AccountDtoStubs
19 | import tech.alexib.yaba.data.stubs.InstitutionDtoStubs
20 | import tech.alexib.yaba.data.stubs.PlaidItemDtoStubs
21 | import tech.alexib.yaba.data.stubs.TransactionDtoStubs
22 | import tech.alexib.yaba.data.stubs.UserDataDtoStubs
23 | import kotlin.test.Test
24 | import kotlin.test.assertEquals
25 | import kotlin.test.assertTrue
26 |
27 | class StubTests {
28 |
29 | @Test
30 | fun parsesJson() {
31 | runCatching {
32 |
33 | val user = UserDataDtoStubs.user
34 | assertEquals("alexi3@test.com", user.email)
35 |
36 | val userData = UserDataDtoStubs.userData
37 | assertTrue(userData.transactions.isNotEmpty())
38 |
39 | assertEquals(382, TransactionDtoStubs.allTransactions.size)
40 |
41 | assertEquals(8, AccountDtoStubs.allAccounts.size)
42 |
43 | assertEquals("Wells Fargo", InstitutionDtoStubs.wellsFargo.name)
44 | assertEquals("ins_4", PlaidItemDtoStubs.wellsFargo.plaidInstitutionId)
45 | }.getOrThrow()
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/data/src/commonTest/kotlin/tech/alexib/yaba/data/mock/api/PushTokenApiMock.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.mock.api
17 |
18 | import tech.alexib.yaba.data.network.api.PushTokenApi
19 |
20 | internal class PushTokenApiMock : PushTokenApi {
21 | @Suppress("EmptyFunctionBlock")
22 | override suspend fun save(token: String) {
23 | }
24 | @Suppress("EmptyFunctionBlock")
25 | override suspend fun delete(token: String) {
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/data/src/commonTest/kotlin/tech/alexib/yaba/data/mock/api/UserDataApiMock.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.mock.api
17 |
18 | import com.benasher44.uuid.Uuid
19 | import kotlinx.coroutines.delay
20 | import kotlinx.coroutines.flow.Flow
21 | import kotlinx.coroutines.flow.flow
22 | import tech.alexib.yaba.data.domain.DataResult
23 | import tech.alexib.yaba.data.domain.Success
24 | import tech.alexib.yaba.data.domain.dto.TransactionsUpdateDto
25 | import tech.alexib.yaba.data.domain.dto.UserDataDto
26 | import tech.alexib.yaba.data.network.api.UserDataApi
27 | import tech.alexib.yaba.data.stubs.UserDataDtoStubs
28 |
29 | internal class UserDataApiMock : UserDataApi {
30 | override fun getTransactionsUpdate(updateId: Uuid): Flow> =
31 | flow> {
32 | emit(Success(TransactionsUpdateDto()))
33 | }
34 |
35 | override fun getAllUserData(): Flow> = flow {
36 | emit(Success(UserDataDtoStubs.userData))
37 | }
38 |
39 | override fun testSub(): Flow = flow {
40 | (0..500).forEach {
41 | emit(it)
42 | delay(1000)
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/data/src/commonTest/kotlin/tech/alexib/yaba/data/repository/UserIdProviderTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.repository
17 |
18 | import app.cash.turbine.test
19 | import com.benasher44.uuid.uuidFrom
20 | import tech.alexib.yaba.util.suspendTest
21 | import kotlin.test.AfterTest
22 | import kotlin.test.BeforeTest
23 | import kotlin.test.Test
24 | import kotlin.test.assertEquals
25 |
26 | internal class UserIdProviderTest : BaseRepositoryTest() {
27 |
28 | private val userIdProvider = deps.userIdProvider
29 | private val authSettings = deps.authSettings
30 |
31 | @BeforeTest
32 | fun setup() = suspendTest {
33 | authSettings.setUserId(uuidFrom("aa1e60bd-0a48-4e8d-800e-237f42d4a793"))
34 | }
35 |
36 | @Test
37 | fun providesUserId() = suspendTest {
38 | userIdProvider.userId.test {
39 | assertEquals(uuidFrom("aa1e60bd-0a48-4e8d-800e-237f42d4a793"), awaitItem())
40 | authSettings.setUserId(userId)
41 | assertEquals(userId, awaitItem())
42 | cancelAndConsumeRemainingEvents()
43 | }
44 | }
45 |
46 | @AfterTest
47 | fun breakdown() = suspendTest {
48 | cleanup()
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/data/src/commonTest/kotlin/tech/alexib/yaba/data/stubs/AccountDtoStubs.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.stubs
17 |
18 | import kotlinx.serialization.decodeFromString
19 | import tech.alexib.yaba.data.domain.dto.AccountDto
20 | import tech.alexib.yaba.stubs.json.accountsChaseJson
21 | import tech.alexib.yaba.stubs.json.accountsWellsJson
22 | import tech.alexib.yaba.util.jSerializer
23 |
24 | object AccountDtoStubs {
25 |
26 | val chaseAccounts: List by lazy {
27 | jSerializer.decodeFromString(accountsChaseJson)
28 | }
29 |
30 | // ** 4 of 9 hidden
31 | val wellsFargoAccounts: List by lazy {
32 | jSerializer.decodeFromString(accountsWellsJson)
33 | }
34 |
35 | // 18
36 | val allAccounts: List by lazy {
37 | chaseAccounts + wellsFargoAccounts
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/data/src/commonTest/kotlin/tech/alexib/yaba/data/stubs/InstitutionDtoStubs.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.stubs
17 |
18 | import kotlinx.serialization.decodeFromString
19 | import tech.alexib.yaba.data.domain.dto.InstitutionDto
20 | import tech.alexib.yaba.data.stubs.json.institutionChaseJson
21 | import tech.alexib.yaba.data.stubs.json.institutionWellsFargoJson
22 | import tech.alexib.yaba.util.jSerializer
23 |
24 | object InstitutionDtoStubs {
25 |
26 | val wellsFargo: InstitutionDto by lazy {
27 | jSerializer.decodeFromString(institutionWellsFargoJson)
28 | }
29 | val chase: InstitutionDto by lazy {
30 | jSerializer.decodeFromString(institutionChaseJson)
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/data/src/commonTest/kotlin/tech/alexib/yaba/data/stubs/PlaidItemDtoStubs.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data.stubs
17 |
18 | import kotlinx.serialization.decodeFromString
19 | import tech.alexib.yaba.data.domain.dto.ItemDto
20 | import tech.alexib.yaba.data.stubs.json.plaidItemChaseJson
21 | import tech.alexib.yaba.data.stubs.json.plaidItemWellsFargoJson
22 | import tech.alexib.yaba.util.jSerializer
23 |
24 | object PlaidItemDtoStubs {
25 | val chase: ItemDto by lazy { jSerializer.decodeFromString(plaidItemChaseJson) }
26 | val wellsFargo: ItemDto by lazy { jSerializer.decodeFromString(plaidItemWellsFargoJson) }
27 | }
28 |
--------------------------------------------------------------------------------
/data/src/commonTest/kotlin/tech/alexib/yaba/data/testUtil.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package tech.alexib.yaba.data
17 |
18 | import com.squareup.sqldelight.db.SqlDriver
19 |
20 | expect fun createInMemorySqlDriver(): SqlDriver
21 |
--------------------------------------------------------------------------------
/downloadSchemaLocal.sh:
--------------------------------------------------------------------------------
1 | ./gradlew downloadApolloSchema \
2 | --endpoint=http://192.168.86.231:9050/graphql \
3 | --schema="data/network/src/commonMain/graphql/tech/alexib/yaba/schema.graphqls"
4 |
--------------------------------------------------------------------------------
/downloadSchemaRemote.sh:
--------------------------------------------------------------------------------
1 | ./gradlew downloadApolloSchema \
2 | --endpoint=https://yabasandbox.alexib.dev/graphql \
3 | --schema="data/network/src/commonMain/graphql/tech/alexib/yaba/schema.graphqls"
4 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | #Gradle
2 | org.gradle.jvmargs=-Xmx4096m -Dkotlin.daemon.jvm.options\="-Xmx4096m"
3 |
4 | #Kotlin
5 | kotlin.code.style=official
6 |
7 | #Android
8 | android.useAndroidX=true
9 | #breaks PlaidLink
10 | #android.enableR8.fullMode=true
11 | android.enableResourceOptimizations=true
12 |
13 | org.gradle.parallel=true
14 | org.gradle.caching=true
15 | org.gradle.configureondemand=false
16 |
17 | kotlin.native.disableCompilerDaemon=true
18 | kotlin.native.ignoreDisabledTargets=true
19 | mobile.multiplatform.iosTargetWarning=false
20 | kotlin.mpp.stability.nowarn=true
21 | kotlin.mpp.enableGranularSourceSetsMetadata=true
22 | kotlin.native.enableDependencyPropagation=false
23 | #localServerUrl=https://
24 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Jun 17 20:41:37 EDT 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/iosApp/Podfile:
--------------------------------------------------------------------------------
1 | target 'iosApp' do
2 | use_frameworks!
3 | platform :ios, '14.1'
4 | pod 'shared', :path => '../shared'
5 | end
--------------------------------------------------------------------------------
/iosApp/iosApp/ContentView.swift:
--------------------------------------------------------------------------------
1 | import SwiftUI
2 | import shared
3 |
4 | struct ContentView: View {
5 | let greet = Greeting().greeting()
6 |
7 | var body: some View {
8 | Text(greet)
9 | }
10 | }
11 |
12 | struct ContentView_Previews: PreviewProvider {
13 | static var previews: some View {
14 | ContentView()
15 | }
16 | }
--------------------------------------------------------------------------------
/iosApp/iosApp/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UIApplicationSceneManifest
24 |
25 | UIApplicationSupportsMultipleScenes
26 |
27 |
28 | UIRequiredDeviceCapabilities
29 |
30 | armv7
31 |
32 | UISupportedInterfaceOrientations
33 |
34 | UIInterfaceOrientationPortrait
35 | UIInterfaceOrientationLandscapeLeft
36 | UIInterfaceOrientationLandscapeRight
37 |
38 | UISupportedInterfaceOrientations~ipad
39 |
40 | UIInterfaceOrientationPortrait
41 | UIInterfaceOrientationPortraitUpsideDown
42 | UIInterfaceOrientationLandscapeLeft
43 | UIInterfaceOrientationLandscapeRight
44 |
45 | UILaunchScreen
46 |
47 |
48 |
--------------------------------------------------------------------------------
/iosApp/iosApp/iOSApp.swift:
--------------------------------------------------------------------------------
1 | import SwiftUI
2 |
3 | @main
4 | struct iOSApp: App {
5 | var body: some Scene {
6 | WindowGroup {
7 | ContentView()
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/lint.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/release/debug.jks:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ruffCode/yaba-kmm/c5a7f5f81c6eb11bb44b6a556795147c160028c5/release/debug.jks
--------------------------------------------------------------------------------
/scripts/changelog.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 | #V_PROP="../version.properties"
4 | #CURRENT_VERSION=$(grep -w version $V_PROP | cut -d '=' -f 2 | tr -d '\n')
5 | RELEASE_URL="https://github.com/ruffCode/yaba-kmm/releases/tag/%s"
6 | since=$(source scripts/tags.sh; previous_tag)
7 | prev=$(git describe --tags 2>/dev/null || git rev-parse --short HEAD)
8 | function release() {
9 | github_changelog_generator -u ruffcode -p yaba-kmm -t "$GITHUB_CHANGELOG_API_KEY" \
10 | --no-pr-wo-labels \
11 | --no-author \
12 | --no-issues \
13 | --enhancement-label "**Enhancements:**" \
14 | --bugs-label "**Bug fixes:**" \
15 | --release-url $RELEASE_URL \
16 | --exclude-labels documentation \
17 | --o RELEASE_CHANGELOG.md \
18 | --since-tag "$since"
19 | }
20 |
21 |
22 | function changelog() {
23 | github_changelog_generator -u ruffcode -p yaba-kmm -t "$GITHUB_CHANGELOG_API_KEY" \
24 | --no-pr-wo-labels \
25 | --no-author \
26 | --enhancement-label "**Enhancements:**" \
27 | --bugs-label "**Bug fixes:**" \
28 | --release-url $RELEASE_URL \
29 | -o CHANGELOG.md
30 | }
31 |
32 |
33 | case $1 in
34 | "-r")
35 | release
36 | ;;
37 | *)
38 | changelog
39 | ;;
40 | esac
41 |
42 |
--------------------------------------------------------------------------------
/scripts/tags.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | function previous_tag() {
5 | current_tag="$(git describe --tags 'HEAD^' --abbrev=0)"
6 | start_ref="HEAD"
7 |
8 | # Find the previous release on the same branch, skipping prereleases if the
9 | # current tag is a full release
10 | previous_tag=""
11 | while [[ -z $previous_tag || ( $previous_tag == *-* && $current_tag != *-* ) ]]; do
12 | previous_tag="$(git describe --tags "$start_ref^" --abbrev=0)"
13 | start_ref="$previous_tag"
14 | done
15 | echo "$previous_tag"
16 | }
17 |
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 |
2 | pluginManagement {
3 | repositories {
4 | gradlePluginPortal()
5 | google()
6 | mavenCentral()
7 | maven("https://s01.oss.sonatype.org/content/repositories/snapshots")
8 | }
9 | plugins {
10 | id("de.fayard.refreshVersions").version("0.22.0-SNAPSHOT")
11 | }
12 | }
13 | dependencyResolutionManagement {
14 | // repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
15 | @Suppress("UnstableApiUsage")
16 | repositories {
17 | mavenCentral()
18 | google()
19 | }
20 | }
21 | plugins {
22 | id("com.gradle.enterprise") version "3.7"
23 | id("de.fayard.refreshVersions")
24 | }
25 | enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
26 |
27 | refreshVersions {
28 | }
29 | gradleEnterprise {
30 | buildScan {
31 | termsOfServiceUrl = "https://gradle.com/terms-of-service'"
32 | termsOfServiceAgree = "yes"
33 | }
34 | }
35 |
36 | rootProject.name = "Yaba_KMM"
37 | include(":androidApp")
38 | include(":base")
39 | include(":data")
40 | include(":data:domain")
41 | include(":data:network")
42 | include(":data:db")
43 |
--------------------------------------------------------------------------------
/spotless/copyright.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2021 Alexi Bre
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
--------------------------------------------------------------------------------