diff --git a/.github/stale.yml b/.github/stale.yml
deleted file mode 100644
index 45fac5581b..0000000000
--- a/.github/stale.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-# Number of days of inactivity before an issue becomes stale
-daysUntilStale: 30
-# Number of days of inactivity before a stale issue is closed
-daysUntilClose: 3
-# Issues with these labels will never be considered stale
-exemptLabels:
- - pinned
- - security
-# Label to use when marking an issue as stale
-staleLabel: wontfix
-# Comment to post when marking an issue as stale. Set to `false` to disable
-markComment: >
- This issue has been automatically marked as stale because it has not had
- recent activity. It will be closed if no further activity occurs. Thank you
- for your contributions.
-# Comment to post when closing a stale issue. Set to `false` to disable
-closeComment: false
diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependency.yml
similarity index 68%
rename from .github/workflows/dependencies.yml
rename to .github/workflows/dependency.yml
index ff3e8b01fc..b628cbc9b7 100644
--- a/.github/workflows/dependencies.yml
+++ b/.github/workflows/dependency.yml
@@ -1,4 +1,4 @@
-name: Dependency Check
+name: Dependency
on:
schedule:
@@ -22,20 +22,8 @@ jobs:
with:
java-version: 11
- - name: Run dependency updates task
- run: ./gradlew dependencyUpdates -DoutputFormatter=plain
-
- - name: Extract dependencies from report file
- id: deps
- run: |
- export DEPENDENCIES="$(sed -n '/.*milestone versions:/,/^$/p' build/dependencyUpdates/report.txt)"
- DEPENDENCIES="${DEPENDENCIES//$'\n'/'%0A'}"
- DEPENDENCIES="${DEPENDENCIES//$'\r'/'%0D'}"
- echo "OUTPUT:"
- echo $DEPENDENCIES
- echo "depss=$DEPENDENCIES" >> $GITHUB_ENV
- echo "::set-output name=dependencies::$(echo "$DEPENDENCIES")"
- shell: bash
+ - name: Run dependencyUpdates Task
+ run: ./gradlew dependencyUpdates --parallel
- name: Upload dependencies report
uses: actions/upload-artifact@v2
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 4042cc7e5c..f596800173 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -49,8 +49,11 @@ jobs:
echo "${{ secrets.ANDROID_GPG_RELEASE_KEYSTORE }}" > release.keystore.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch release.keystore.asc > android/release.keystore
mkdir android/src/release
- echo "${{ secrets.GOOGLE_SERVICES_JSON_ASC }}" > google-services.json.asc
+ echo "${{ secrets.RELEASE_GOOGLE_SERVICES_JSON_ASC }}" > google-services.json.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch google-services.json.asc > android/src/release/google-services.json
+ mkdir android/src/debug
+ echo "${{ secrets.DEBUG_GOOGLE_SERVICES_JSON_ASC }}" > google-services.json.asc
+ gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch google-services.json.asc > android/src/debug/google-services.json
echo "${{ secrets.AG_CONNECT_SERVICES_JSON_ASC }}" > agconnect-services.json.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch agconnect-services.json.asc > android/src/release/agconnect-services.json
echo "${{ secrets.IOS_GPG_FIREBASE_CONFIG }}" > GoogleService-Info.plist.asc
@@ -96,8 +99,11 @@ jobs:
echo "${{ secrets.ANDROID_GPG_RELEASE_KEYSTORE }}" > release.keystore.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch release.keystore.asc > android/release.keystore
mkdir android/src/release
- echo "${{ secrets.GOOGLE_SERVICES_JSON_ASC }}" > google-services.json.asc
+ echo "${{ secrets.RELEASE_GOOGLE_SERVICES_JSON_ASC }}" > google-services.json.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch google-services.json.asc > android/src/release/google-services.json
+ mkdir android/src/debug
+ echo "${{ secrets.DEBUG_GOOGLE_SERVICES_JSON_ASC }}" > google-services.json.asc
+ gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch google-services.json.asc > android/src/debug/google-services.json
echo "${{ secrets.AG_CONNECT_SERVICES_JSON_ASC }}" > agconnect-services.json.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch agconnect-services.json.asc > android/src/release/agconnect-services.json
echo "${{ secrets.IOS_GPG_FIREBASE_CONFIG }}" > GoogleService-Info.plist.asc
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 62c9fba475..225164f1ce 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -46,8 +46,11 @@ jobs:
echo "${{ secrets.ANDROID_GPG_RELEASE_KEYSTORE }}" > release.keystore.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch release.keystore.asc > android/release.keystore
mkdir android/src/release
- echo "${{ secrets.GOOGLE_SERVICES_JSON_ASC }}" > google-services.json.asc
+ echo "${{ secrets.RELEASE_GOOGLE_SERVICES_JSON_ASC }}" > google-services.json.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch google-services.json.asc > android/src/release/google-services.json
+ mkdir android/src/debug
+ echo "${{ secrets.DEBUG_GOOGLE_SERVICES_JSON_ASC }}" > google-services.json.asc
+ gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch google-services.json.asc > android/src/debug/google-services.json
echo "${{ secrets.AG_CONNECT_SERVICES_JSON_ASC }}" > agconnect-services.json.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch agconnect-services.json.asc > android/src/release/agconnect-services.json
echo "${{ secrets.IOS_GPG_FIREBASE_CONFIG }}" > GoogleService-Info.plist.asc
diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml
index 2cd551fac3..bd6a3613f7 100644
--- a/.github/workflows/testing.yml
+++ b/.github/workflows/testing.yml
@@ -50,8 +50,11 @@ jobs:
echo "${{ secrets.ANDROID_GPG_RELEASE_KEYSTORE }}" > release.keystore.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch release.keystore.asc > android/release.keystore
mkdir android/src/release
- echo "${{ secrets.GOOGLE_SERVICES_JSON_ASC }}" > google-services.json.asc
+ echo "${{ secrets.RELEASE_GOOGLE_SERVICES_JSON_ASC }}" > google-services.json.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch google-services.json.asc > android/src/release/google-services.json
+ mkdir android/src/debug
+ echo "${{ secrets.DEBUG_GOOGLE_SERVICES_JSON_ASC }}" > google-services.json.asc
+ gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch google-services.json.asc > android/src/debug/google-services.json
echo "${{ secrets.AG_CONNECT_SERVICES_JSON_ASC }}" > agconnect-services.json.asc
gpg -d --passphrase "${{ secrets.SECRET_PASSWORD }}" --batch agconnect-services.json.asc > android/src/release/agconnect-services.json
diff --git a/README.md b/README.md
index 17059efaf1..57edd4a97b 100755
--- a/README.md
+++ b/README.md
@@ -6,7 +6,8 @@ A currency converter application for most of the currencies used in the world.
You can quickly convert and make mathematical operations between currencies.
-
+
+
@@ -21,15 +22,39 @@ You can quickly convert and make mathematical operations between currencies.
-Main Modules | Completed | State | Tech |
-:------------ | :-------------| :-------------| :-------------|
-![badge-android](https://img.shields.io/badge/app-android-green) | :white_check_mark:| in production :muscle: | ViewBinding (State/Shared)Flow
-![badge-backend](https://img.shields.io/badge/app-backend-blue) | :white_check_mark: | in production :muscle: | Ktor (server/client) Sqldelight
-![badge-ios](https://img.shields.io/badge/app-ios-orange) || in progress :bow: | SwiftUI Combine
-![badge-web](https://img.shields.io/badge/app-web-yellow) || coming soon :eyes: | :grey_question:
-![badge-desktop](https://img.shields.io/badge/app-desktop-red) || coming soon :eyes: | :grey_question:
-![badge-client](https://img.shields.io/badge/shared-client-white) | :white_check_mark: | used in FE targets :recycle: | KMP (android/ios)
-![badge-common](https://img.shields.io/badge/shared-common-darkgrey) | :white_check_mark: | used in all targets :recycle: | KMP (android/ios/jvm)
+## Module Graph
+
+```mermaid
+graph TD;
+
+billing-->android
+
+ad-->android
+
+analytics-->android
+
+resources{resources}-->android
+resources-->ios
+
+client{client}-->android
+client-->ios
+
+config{config}-->client
+
+common{common}-->client
+common-->backend
+
+android(android)
+ios(ios)
+backend(backend)
+```
+
+```mermaid
+graph TD;
+KMP_Library{KMP_Library}
+Target(Target)
+Library
+```
@@ -70,53 +95,19 @@ override suspend fun methodXYZ(base: String) = client.getandroid
-
-ad-->android
-
-analytics-->android
-
-resources{resources}-->android
-resources-->ios
-
-client{client}-->android
-client-->ios
-
-config{config}-->client
-
-common{common}-->client
-common-->backend
-
-android(android)
-ios(ios)
-backend(backend)
-```
-
-```mermaid
-graph TD;
-KMP_Library{KMP_Library}
-Target(Target)
-Library
-```
-
## Android Preview
-
+
-
+
## iOS Preview
-
+
## Included Currencies
-[![currencies.png](https://github.com/CurrencyConverterCalculator/CCC/raw/master/art/currencies.png)](https://github.com/CurrencyConverterCalculator/CCC/raw/master/art/currencies.png)
+[![currencies.png](https://github.com/CurrencyConverterCalculator/CCC/raw/develop/art/currencies.png)](https://github.com/CurrencyConverterCalculator/CCC/raw/develop/art/currencies.png)
## License
diff --git a/analytics/src/main/kotlin/com/oztechan/ccc/analytics/model/UserProperty.kt b/analytics/src/main/kotlin/com/oztechan/ccc/analytics/model/UserProperty.kt
index 12c07f67d8..1f7d2e76b2 100644
--- a/analytics/src/main/kotlin/com/oztechan/ccc/analytics/model/UserProperty.kt
+++ b/analytics/src/main/kotlin/com/oztechan/ccc/analytics/model/UserProperty.kt
@@ -7,5 +7,6 @@ enum class UserProperty(val key: String) {
IS_ROOTED("is_rooted"),
APP_THEME("app_theme"),
IS_AD_FREE("is_ad_free"),
- SESSION_COUNT("session_count")
+ SESSION_COUNT("session_count"),
+ DEVICE_PLATFORM("device_platform")
}
diff --git a/android/build.gradle.kts b/android/build.gradle.kts
index 32d996b3c0..b13fe96f65 100644
--- a/android/build.gradle.kts
+++ b/android/build.gradle.kts
@@ -86,6 +86,8 @@ android {
}
getByName(BuildType.debug) {
+ applicationIdSuffix = ".debug"
+ versionNameSuffix = "-debug"
with(Keys(project, BuildType.DEBUG)) {
resValue(typeString, admobAppId.resourceKey, admobAppId.value)
resValue(typeString, bannerAdIdCalculator.resourceKey, bannerAdIdCalculator.value)
diff --git a/android/src/main/kotlin/com/oztechan/ccc/android/ui/calculator/CalculatorAdapter.kt b/android/src/main/kotlin/com/oztechan/ccc/android/ui/calculator/CalculatorAdapter.kt
index a88ca49646..2a23b4a3fd 100644
--- a/android/src/main/kotlin/com/oztechan/ccc/android/ui/calculator/CalculatorAdapter.kt
+++ b/android/src/main/kotlin/com/oztechan/ccc/android/ui/calculator/CalculatorAdapter.kt
@@ -7,11 +7,11 @@ import com.github.submob.basemob.adapter.BaseVBRecyclerViewAdapter
import com.oztechan.ccc.analytics.AnalyticsManager
import com.oztechan.ccc.analytics.model.EventParam
import com.oztechan.ccc.analytics.model.FirebaseEvent
-import com.oztechan.ccc.android.util.setBackgroundByName
import com.oztechan.ccc.client.model.Currency
import com.oztechan.ccc.client.util.getFormatted
import com.oztechan.ccc.client.util.toStandardDigits
import com.oztechan.ccc.client.viewmodel.calculator.CalculatorEvent
+import com.oztechan.ccc.resources.setBackgroundByName
import mustafaozhan.github.com.mycurrencies.databinding.ItemCalculatorBinding
class CalculatorAdapter(
diff --git a/android/src/main/kotlin/com/oztechan/ccc/android/ui/calculator/CalculatorFragment.kt b/android/src/main/kotlin/com/oztechan/ccc/android/ui/calculator/CalculatorFragment.kt
index 8e539f125f..973a84372b 100755
--- a/android/src/main/kotlin/com/oztechan/ccc/android/ui/calculator/CalculatorFragment.kt
+++ b/android/src/main/kotlin/com/oztechan/ccc/android/ui/calculator/CalculatorFragment.kt
@@ -16,15 +16,15 @@ import com.oztechan.ccc.analytics.AnalyticsManager
import com.oztechan.ccc.analytics.model.UserProperty
import com.oztechan.ccc.android.util.copyToClipBoard
import com.oztechan.ccc.android.util.dataState
-import com.oztechan.ccc.android.util.getImageResourceByName
import com.oztechan.ccc.android.util.getNavigationResult
-import com.oztechan.ccc.android.util.setBackgroundByName
import com.oztechan.ccc.android.util.setBannerAd
import com.oztechan.ccc.android.util.showLoading
import com.oztechan.ccc.android.util.showSnack
import com.oztechan.ccc.client.util.toValidList
import com.oztechan.ccc.client.viewmodel.calculator.CalculatorEffect
import com.oztechan.ccc.client.viewmodel.calculator.CalculatorViewModel
+import com.oztechan.ccc.resources.getDrawableIdByFileName
+import com.oztechan.ccc.resources.setBackgroundByName
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import mustafaozhan.github.com.mycurrencies.R
@@ -152,7 +152,7 @@ class CalculatorFragment : BaseVBFragment() {
)
CalculatorEffect.OpenBar -> navigate(
R.id.calculatorFragment,
- CalculatorFragmentDirections.actionCalculatorFragmentToChangeBaseBottomSheet()
+ CalculatorFragmentDirections.actionCalculatorFragmentToSelectCurrencyBottomSheet()
)
CalculatorEffect.OpenSettings -> navigate(
R.id.calculatorFragment,
@@ -162,7 +162,7 @@ class CalculatorFragment : BaseVBFragment() {
is CalculatorEffect.ShowRate -> showSnack(
requireView(),
viewEffect.text,
- icon = requireContext().getImageResourceByName(viewEffect.name)
+ icon = getDrawableIdByFileName(viewEffect.name)
)
}
}.launchIn(viewLifecycleOwner.lifecycleScope)
diff --git a/android/src/main/kotlin/com/oztechan/ccc/android/ui/currencies/CurrenciesAdapter.kt b/android/src/main/kotlin/com/oztechan/ccc/android/ui/currencies/CurrenciesAdapter.kt
index a1dc7b9d73..57689652c2 100644
--- a/android/src/main/kotlin/com/oztechan/ccc/android/ui/currencies/CurrenciesAdapter.kt
+++ b/android/src/main/kotlin/com/oztechan/ccc/android/ui/currencies/CurrenciesAdapter.kt
@@ -5,9 +5,9 @@ import android.view.ViewGroup
import android.view.animation.AnimationUtils
import androidx.recyclerview.widget.DiffUtil
import com.github.submob.basemob.adapter.BaseVBRecyclerViewAdapter
-import com.oztechan.ccc.android.util.setBackgroundByName
import com.oztechan.ccc.client.model.Currency
import com.oztechan.ccc.client.viewmodel.currencies.CurrenciesEvent
+import com.oztechan.ccc.resources.setBackgroundByName
import mustafaozhan.github.com.mycurrencies.R
import mustafaozhan.github.com.mycurrencies.databinding.ItemCurrenciesBinding
diff --git a/android/src/main/kotlin/com/oztechan/ccc/android/ui/main/MainActivity.kt b/android/src/main/kotlin/com/oztechan/ccc/android/ui/main/MainActivity.kt
index 1001867c80..22db800b96 100755
--- a/android/src/main/kotlin/com/oztechan/ccc/android/ui/main/MainActivity.kt
+++ b/android/src/main/kotlin/com/oztechan/ccc/android/ui/main/MainActivity.kt
@@ -16,10 +16,12 @@ import com.github.submob.basemob.activity.BaseActivity
import com.oztechan.ccc.ad.AdManager
import com.oztechan.ccc.analytics.AnalyticsManager
import com.oztechan.ccc.analytics.model.UserProperty
+import com.oztechan.ccc.android.util.getMarketLink
import com.oztechan.ccc.android.util.requestAppReview
import com.oztechan.ccc.android.util.showDialog
import com.oztechan.ccc.android.util.updateAppTheme
import com.oztechan.ccc.android.util.updateBaseContextLocale
+import com.oztechan.ccc.client.device
import com.oztechan.ccc.client.model.AppTheme
import com.oztechan.ccc.client.viewmodel.main.MainEffect
import com.oztechan.ccc.client.viewmodel.main.MainViewModel
@@ -66,7 +68,7 @@ class MainActivity : BaseActivity() {
positiveButton = R.string.update,
cancelable = isCancelable
) {
- startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.app_market_link))))
+ startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(getMarketLink())))
}
private fun checkDestination() = with(getNavigationController()) {
@@ -97,6 +99,7 @@ class MainActivity : BaseActivity() {
UserProperty.SESSION_COUNT,
mainViewModel.getSessionCount().toString()
)
+ analyticsManager.setUserProperty(UserProperty.DEVICE_PLATFORM, device.name)
}
override fun onResume() {
diff --git a/android/src/main/kotlin/com/oztechan/ccc/android/ui/changebase/ChangeBaseAdapter.kt b/android/src/main/kotlin/com/oztechan/ccc/android/ui/selectcurrency/SelectCurrencyAdapter.kt
similarity index 68%
rename from android/src/main/kotlin/com/oztechan/ccc/android/ui/changebase/ChangeBaseAdapter.kt
rename to android/src/main/kotlin/com/oztechan/ccc/android/ui/selectcurrency/SelectCurrencyAdapter.kt
index 3b4e891a9e..f9ce9ce1a6 100644
--- a/android/src/main/kotlin/com/oztechan/ccc/android/ui/changebase/ChangeBaseAdapter.kt
+++ b/android/src/main/kotlin/com/oztechan/ccc/android/ui/selectcurrency/SelectCurrencyAdapter.kt
@@ -1,36 +1,36 @@
-package com.oztechan.ccc.android.ui.changebase
+package com.oztechan.ccc.android.ui.selectcurrency
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
import com.github.submob.basemob.adapter.BaseVBRecyclerViewAdapter
-import com.oztechan.ccc.android.util.setBackgroundByName
import com.oztechan.ccc.client.model.Currency
-import com.oztechan.ccc.client.viewmodel.changebase.ChangeBaseEvent
-import mustafaozhan.github.com.mycurrencies.databinding.ItemChangeBaseBinding
+import com.oztechan.ccc.client.viewmodel.selectcurrency.SelectCurrencyEvent
+import com.oztechan.ccc.resources.setBackgroundByName
+import mustafaozhan.github.com.mycurrencies.databinding.ItemSelectCurrencyBinding
-class ChangeBaseAdapter(
- private val changeBaseEvent: ChangeBaseEvent
+class SelectCurrencyAdapter(
+ private val selectCurrencyEvent: SelectCurrencyEvent
) : BaseVBRecyclerViewAdapter(CalculatorDiffer()) {
override fun onCreateViewHolder(
parent: ViewGroup,
viewType: Int
) = CalculatorVBViewHolder(
- ItemChangeBaseBinding.inflate(
+ ItemSelectCurrencyBinding.inflate(
LayoutInflater.from(parent.context),
parent,
false
)
)
- inner class CalculatorVBViewHolder(private val itemBinding: ItemChangeBaseBinding) :
+ inner class CalculatorVBViewHolder(private val itemBinding: ItemSelectCurrencyBinding) :
BaseVBViewHolder(itemBinding) {
override fun onItemBind(item: Currency) = with(itemBinding) {
imgIcon.setBackgroundByName(item.name)
txtSettingItem.text = item.getVariablesOneLine()
- root.setOnClickListener { changeBaseEvent.onItemClick(item) }
+ root.setOnClickListener { selectCurrencyEvent.onItemClick(item) }
}
}
diff --git a/android/src/main/kotlin/com/oztechan/ccc/android/ui/changebase/ChangeBaseBottomSheet.kt b/android/src/main/kotlin/com/oztechan/ccc/android/ui/selectcurrency/SelectCurrencyBottomSheet.kt
similarity index 62%
rename from android/src/main/kotlin/com/oztechan/ccc/android/ui/changebase/ChangeBaseBottomSheet.kt
rename to android/src/main/kotlin/com/oztechan/ccc/android/ui/selectcurrency/SelectCurrencyBottomSheet.kt
index afe666a80d..0b0c20064e 100644
--- a/android/src/main/kotlin/com/oztechan/ccc/android/ui/changebase/ChangeBaseBottomSheet.kt
+++ b/android/src/main/kotlin/com/oztechan/ccc/android/ui/selectcurrency/SelectCurrencyBottomSheet.kt
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2021 Mustafa Ozhan. All rights reserved.
*/
-package com.oztechan.ccc.android.ui.changebase
+package com.oztechan.ccc.android.ui.selectcurrency
import android.os.Bundle
import android.view.View
@@ -16,29 +16,30 @@ import com.oztechan.ccc.android.ui.calculator.CalculatorFragment.Companion.CHANG
import com.oztechan.ccc.android.util.setNavigationResult
import com.oztechan.ccc.android.util.showLoading
import com.oztechan.ccc.android.util.visibleIf
-import com.oztechan.ccc.client.viewmodel.changebase.ChangeBaseEffect
-import com.oztechan.ccc.client.viewmodel.changebase.ChangeBaseViewModel
+import com.oztechan.ccc.client.viewmodel.selectcurrency.SelectCurrencyEffect
+import com.oztechan.ccc.client.viewmodel.selectcurrency.SelectCurrencyViewModel
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import mustafaozhan.github.com.mycurrencies.R
-import mustafaozhan.github.com.mycurrencies.databinding.BottomSheetChangeBaseBinding
+import mustafaozhan.github.com.mycurrencies.databinding.BottomSheetSelectCurrencyBinding
import org.koin.android.ext.android.inject
import org.koin.androidx.viewmodel.ext.android.viewModel
-class ChangeBaseBottomSheet : BaseVBBottomSheetDialogFragment() {
+class SelectCurrencyBottomSheet :
+ BaseVBBottomSheetDialogFragment() {
private val analyticsManager: AnalyticsManager by inject()
- private val changeBaseViewModel: ChangeBaseViewModel by viewModel()
+ private val selectCurrencyViewModel: SelectCurrencyViewModel by viewModel()
- private val changeBaseAdapter: ChangeBaseAdapter by lazy {
- ChangeBaseAdapter(changeBaseViewModel.event)
+ private val selectCurrencyAdapter: SelectCurrencyAdapter by lazy {
+ SelectCurrencyAdapter(selectCurrencyViewModel.event)
}
- override fun getViewBinding() = BottomSheetChangeBaseBinding.inflate(layoutInflater)
+ override fun getViewBinding() = BottomSheetSelectCurrencyBinding.inflate(layoutInflater)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- Logger.i { "ChangeBaserBottomSheet onViewCreated" }
+ Logger.i { "SelectCurrencyBottomSheet onViewCreated" }
initViews()
observeStates()
observeEffects()
@@ -46,8 +47,8 @@ class ChangeBaseBottomSheet : BaseVBBottomSheetDialogFragment
- Logger.i { "ChangeBaseBottomSheet observeEffects ${viewEffect::class.simpleName}" }
+ Logger.i { "SelectCurrencyBottomSheet observeEffects ${viewEffect::class.simpleName}" }
when (viewEffect) {
- is ChangeBaseEffect.BaseChange -> {
+ is SelectCurrencyEffect.CurrencyChange -> {
analyticsManager.trackEvent(
FirebaseEvent.BASE_CHANGE,
mapOf(EventParam.BASE to viewEffect.newBase)
@@ -93,14 +94,14 @@ class ChangeBaseBottomSheet : BaseVBBottomSheetDialogFragment navigate(
- R.id.changeBaseBottomSheet,
- ChangeBaseBottomSheetDirections.actionChangeBaseBottomSheetToCurrenciesFragment()
+ SelectCurrencyEffect.OpenCurrencies -> navigate(
+ R.id.selectCurrencyBottomSheet,
+ SelectCurrencyBottomSheetDirections.actionSelectCurrencyBottomSheetToCurrenciesFragment()
)
}
}.launchIn(viewLifecycleOwner.lifecycleScope)
private fun setListeners() = binding.btnSelect.setOnClickListener {
- changeBaseViewModel.event.onSelectClick()
+ selectCurrencyViewModel.event.onSelectClick()
}
}
diff --git a/android/src/main/kotlin/com/oztechan/ccc/android/ui/settings/SettingsFragment.kt b/android/src/main/kotlin/com/oztechan/ccc/android/ui/settings/SettingsFragment.kt
index 7f5367ca91..4ebacd9b06 100644
--- a/android/src/main/kotlin/com/oztechan/ccc/android/ui/settings/SettingsFragment.kt
+++ b/android/src/main/kotlin/com/oztechan/ccc/android/ui/settings/SettingsFragment.kt
@@ -15,6 +15,7 @@ import com.github.submob.basemob.fragment.BaseVBFragment
import com.oztechan.ccc.ad.AdManager
import com.oztechan.ccc.analytics.AnalyticsManager
import com.oztechan.ccc.analytics.model.FirebaseEvent
+import com.oztechan.ccc.android.util.getMarketLink
import com.oztechan.ccc.android.util.setBannerAd
import com.oztechan.ccc.android.util.showDialog
import com.oztechan.ccc.android.util.showSingleChoiceDialog
@@ -151,7 +152,7 @@ class SettingsFragment : BaseVBFragment() {
startIntent(
Intent(
Intent.ACTION_VIEW,
- Uri.parse(getString(R.string.app_market_link))
+ Uri.parse(requireContext().getMarketLink())
)
)
}
@@ -228,7 +229,7 @@ class SettingsFragment : BaseVBFragment() {
private fun share() = Intent(Intent.ACTION_SEND).apply {
type = TEXT_TYPE
- putExtra(Intent.EXTRA_TEXT, getString(R.string.app_market_link))
+ putExtra(Intent.EXTRA_TEXT, requireContext().getMarketLink())
startActivity(Intent.createChooser(this, getString(R.string.settings_item_share_title)))
}
diff --git a/android/src/main/kotlin/com/oztechan/ccc/android/util/DeviceUtil.kt b/android/src/main/kotlin/com/oztechan/ccc/android/util/DeviceUtil.kt
index cebcb08749..17850d0115 100644
--- a/android/src/main/kotlin/com/oztechan/ccc/android/util/DeviceUtil.kt
+++ b/android/src/main/kotlin/com/oztechan/ccc/android/util/DeviceUtil.kt
@@ -9,7 +9,10 @@ import android.content.res.Configuration
import android.content.res.Resources
import android.os.Build
import androidx.appcompat.app.AppCompatDelegate
+import com.oztechan.ccc.client.device
import com.oztechan.ccc.client.model.AppTheme
+import com.oztechan.ccc.client.model.Device
+import mustafaozhan.github.com.mycurrencies.R
import java.util.Locale
fun updateBaseContextLocale(context: Context): Context? {
@@ -45,3 +48,10 @@ private fun updateResourcesLocaleLegacy(context: Context, locale: Locale): Conte
resources.updateConfiguration(configuration, resources.displayMetrics)
return context
}
+
+fun Context.getMarketLink() = getString(
+ when (device as Device.ANDROID) {
+ Device.ANDROID.GOOGLE -> R.string.app_market_link_google
+ Device.ANDROID.HUAWEI -> R.string.app_market_link_huawei
+ }
+)
diff --git a/android/src/main/kotlin/com/oztechan/ccc/android/util/ViewExtensions.kt b/android/src/main/kotlin/com/oztechan/ccc/android/util/ViewExtensions.kt
index ecc9ba24fe..6dcc1641f7 100644
--- a/android/src/main/kotlin/com/oztechan/ccc/android/util/ViewExtensions.kt
+++ b/android/src/main/kotlin/com/oztechan/ccc/android/util/ViewExtensions.kt
@@ -14,36 +14,17 @@ import android.view.animation.Animation
import android.view.animation.Transformation
import android.view.inputmethod.InputMethodManager
import android.widget.FrameLayout
-import android.widget.ImageView
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
-import co.touchlab.kermit.Logger
-import com.github.submob.logmob.e
import com.github.submob.scopemob.castTo
import com.oztechan.ccc.ad.AdManager
import com.oztechan.ccc.client.model.RateState
import mustafaozhan.github.com.mycurrencies.R
-import java.io.FileNotFoundException
private const val ANIMATION_DURATION = 500L
-fun ImageView.setBackgroundByName(
- name: String
-) = setImageResource(context.getImageResourceByName(name))
-
-fun Context.getImageResourceByName(name: String): Int = try {
- resources.getIdentifier(
- name.lowercase().replace("try", "tryy"),
- "drawable",
- packageName
- )
-} catch (e: FileNotFoundException) {
- Logger.e(e)
- R.drawable.transparent
-}
-
fun View.hideKeyboard() = context?.getSystemService(Context.INPUT_METHOD_SERVICE)
?.castTo()
?.hideSoftInputFromWindow(windowToken, 0)
diff --git a/android/src/main/res/layout/bottom_sheet_change_base.xml b/android/src/main/res/layout/bottom_sheet_select_currency.xml
similarity index 96%
rename from android/src/main/res/layout/bottom_sheet_change_base.xml
rename to android/src/main/res/layout/bottom_sheet_select_currency.xml
index 70c97e8ef4..0c0add0ede 100644
--- a/android/src/main/res/layout/bottom_sheet_change_base.xml
+++ b/android/src/main/res/layout/bottom_sheet_select_currency.xml
@@ -21,7 +21,7 @@
app:layout_constraintTop_toBottomOf="@+id/txt_current_base" />
+ app:layout_constraintTop_toBottomOf="@+id/recycler_view_select_currency" />
\ No newline at end of file
diff --git a/android/src/main/res/layout/item_change_base.xml b/android/src/main/res/layout/item_select_currency.xml
similarity index 86%
rename from android/src/main/res/layout/item_change_base.xml
rename to android/src/main/res/layout/item_select_currency.xml
index a6ca0f9c2c..64bc63235a 100755
--- a/android/src/main/res/layout/item_change_base.xml
+++ b/android/src/main/res/layout/item_select_currency.xml
@@ -4,11 +4,11 @@
+ style="@style/SelectCurrencyItemLayout">
+ android:id="@+id/action_calculatorFragment_to_selectCurrencyBottomSheet"
+ app:destination="@id/selectCurrencyBottomSheet" />
diff --git a/android/src/main/res/values/styles.xml b/android/src/main/res/values/styles.xml
index 16aed207cd..45286785e6 100755
--- a/android/src/main/res/values/styles.xml
+++ b/android/src/main/res/values/styles.xml
@@ -290,7 +290,6 @@
- @dimen/margin_eight
-
-
@@ -505,13 +504,13 @@
-
-
diff --git a/art/appgallery.png b/art/appgallery.png
new file mode 100644
index 0000000000..d66acd98cf
Binary files /dev/null and b/art/appgallery.png differ
diff --git a/art/play_store.png b/art/play_store.png
new file mode 100644
index 0000000000..7edd6087a8
Binary files /dev/null and b/art/play_store.png differ
diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt
index 31d6e9e097..450bb6d43f 100644
--- a/buildSrc/src/main/kotlin/Dependencies.kt
+++ b/buildSrc/src/main/kotlin/Dependencies.kt
@@ -8,17 +8,13 @@ object Dependencies {
const val TEST = "test"
const val TEST_ANNOTATIONS = "test-annotations-common"
const val KOIN_CORE = "io.insert-koin:koin-core:${Versions.KOIN}"
- const val MULTIPLATFORM_SETTINGS =
- "com.russhwolf:multiplatform-settings:${Versions.MULTIPLATFORM_SETTINGS}"
- const val KOTLIN_X_DATE_TIME =
- "org.jetbrains.kotlinx:kotlinx-datetime:${Versions.KOTLIN_X_DATE_TIME}"
+ const val MULTIPLATFORM_SETTINGS = "com.russhwolf:multiplatform-settings:${Versions.MULTIPLATFORM_SETTINGS}"
+ const val KOTLIN_X_DATE_TIME = "org.jetbrains.kotlinx:kotlinx-datetime:${Versions.KOTLIN_X_DATE_TIME}"
const val KTOR_LOGGING = "io.ktor:ktor-client-logging:${Versions.KTOR}"
const val KTOR_SETIALIZATION = "io.ktor:ktor-client-serialization:${Versions.KTOR}"
- const val COROUTINES =
- "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.COROUTINES}"
+ const val COROUTINES = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.COROUTINES}"
const val SQL_DELIGHT_RUNTIME = "com.squareup.sqldelight:runtime:${Versions.SQL_DELIGHT}"
- const val SQL_DELIGHT_COROUTINES_EXT =
- "com.squareup.sqldelight:coroutines-extensions:${Versions.SQL_DELIGHT}"
+ const val SQL_DELIGHT_COROUTINES_EXT = "com.squareup.sqldelight:coroutines-extensions:${Versions.SQL_DELIGHT}"
const val MOKO_RESOURCES = "dev.icerock.moko:resources:${Versions.MOKO_RESOURCES}"
const val MOCKATIVE = "io.mockative:mockative:${Versions.MOCKATIVE}"
const val SCOPE_MOB = "com.github.submob:scopemob:${Versions.SCOPE_MOB}"
@@ -27,20 +23,14 @@ object Dependencies {
}
object Android {
- const val ANDROID_MATERIAL =
- "com.google.android.material:material:${Versions.ANDROID_MATERIAL}"
- const val CONSTRAINT_LAYOUT =
- "androidx.constraintlayout:constraintlayout:${Versions.CONSTRAINT_LAYOUT}"
+ const val ANDROID_MATERIAL = "com.google.android.material:material:${Versions.ANDROID_MATERIAL}"
+ const val CONSTRAINT_LAYOUT = "androidx.constraintlayout:constraintlayout:${Versions.CONSTRAINT_LAYOUT}"
const val KOIN_ANDROID = "io.insert-koin:koin-android:${Versions.KOIN}"
- const val FIREBASE_ANALYTICS =
- "com.google.firebase:firebase-analytics-ktx:${Versions.FIREBASE_ANALYTICS}"
- const val FIREBASE_REMOTE_CONFIG =
- "com.google.firebase:firebase-config-ktx:${Versions.FIREBASE_REMOTE_CONFIG}"
+ const val FIREBASE_ANALYTICS = "com.google.firebase:firebase-analytics-ktx:${Versions.FIREBASE_ANALYTICS}"
+ const val FIREBASE_REMOTE_CONFIG = "com.google.firebase:firebase-config-ktx:${Versions.FIREBASE_REMOTE_CONFIG}"
const val DESUGARING = "com.android.tools:desugar_jdk_libs:${Versions.DESUGARING}"
- const val LIFECYCLE_VIEWMODEL =
- "androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.LIFECYCLE}"
- const val LIFECYCLE_RUNTIME =
- "androidx.lifecycle:lifecycle-runtime-ktx:${Versions.LIFECYCLE}"
+ const val LIFECYCLE_VIEWMODEL = "androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.LIFECYCLE}"
+ const val LIFECYCLE_RUNTIME = "androidx.lifecycle:lifecycle-runtime-ktx:${Versions.LIFECYCLE}"
const val NAVIGATION = "androidx.navigation:navigation-fragment-ktx:${Versions.NAVIGATION}"
const val KTOR = "io.ktor:ktor-client-android:${Versions.KTOR}"
const val SQL_DELIGHT = "com.squareup.sqldelight:android-driver:${Versions.SQL_DELIGHT}"
@@ -75,21 +65,15 @@ object Dependencies {
}
object ClassPaths {
- const val ANDROID_GRADLE_PLUGIN =
- "com.android.tools.build:gradle:${Versions.ANDROID_GRADLE_PLUGIN}"
- const val KOTLIN_GRADLE_PLUGIN =
- "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.KOTLIN}"
- const val KOTLIN_SERIALIZATION =
- "org.jetbrains.kotlin:kotlin-serialization:${Versions.KOTLIN}"
+ const val ANDROID_GRADLE_PLUGIN = "com.android.tools.build:gradle:${Versions.ANDROID_GRADLE_PLUGIN}"
+ const val KOTLIN_GRADLE_PLUGIN = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.KOTLIN}"
+ const val KOTLIN_SERIALIZATION = "org.jetbrains.kotlin:kotlin-serialization:${Versions.KOTLIN}"
const val SQL_DELIGHT = "com.squareup.sqldelight:gradle-plugin:${Versions.SQL_DELIGHT}"
const val GSM = "com.google.gms:google-services:${Versions.GSM}"
- const val CRASHLYTICS =
- "com.google.firebase:firebase-crashlytics-gradle:${Versions.CRASHLYTICS}"
- const val NAVIGATION =
- "androidx.navigation:navigation-safe-args-gradle-plugin:${Versions.NAVIGATION}"
+ const val CRASHLYTICS = "com.google.firebase:firebase-crashlytics-gradle:${Versions.CRASHLYTICS}"
+ const val NAVIGATION = "androidx.navigation:navigation-safe-args-gradle-plugin:${Versions.NAVIGATION}"
const val MOKO_RESOURCES = "dev.icerock.moko:resources-generator:${Versions.MOKO_RESOURCES}"
- const val BUILD_KONFIG =
- "com.codingfeline.buildkonfig:buildkonfig-gradle-plugin:${Versions.BUILD_KONFIG}"
+ const val BUILD_KONFIG = "com.codingfeline.buildkonfig:buildkonfig-gradle-plugin:${Versions.BUILD_KONFIG}"
const val KOVER = "org.jetbrains.kotlinx:kover:${Versions.KOVER}"
}
diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt
index ee34595e65..9f87404771 100644
--- a/buildSrc/src/main/kotlin/Versions.kt
+++ b/buildSrc/src/main/kotlin/Versions.kt
@@ -4,16 +4,17 @@
@Suppress("SpellCheckingInspection")
object Versions {
- const val KOTLIN = "1.6.10"
- const val ANDROID_GRADLE_PLUGIN = "7.1.2"
- const val ANDROID_MATERIAL = "1.4.0"
+ const val KOTLIN = "1.6.21"
+ const val KSP = "$KOTLIN-1.0.5"
+ const val ANDROID_GRADLE_PLUGIN = "7.1.3"
+ const val ANDROID_MATERIAL = "1.6.0"
const val CONSTRAINT_LAYOUT = "2.1.3"
const val KTOR = "1.6.8"
const val LOG_BACK = "1.2.11"
- const val KOIN = "3.1.5"
- const val MULTIPLATFORM_SETTINGS = "0.8.1"
- const val FIREBASE_ANALYTICS = "20.1.2"
- const val FIREBASE_REMOTE_CONFIG = "21.0.2"
+ const val KOIN = "3.1.6"
+ const val MULTIPLATFORM_SETTINGS = "0.9"
+ const val FIREBASE_ANALYTICS = "21.0.0"
+ const val FIREBASE_REMOTE_CONFIG = "21.1.0"
const val DESUGARING = "1.1.5"
const val GSM = "4.3.10"
const val CRASHLYTICS = "2.8.1"
@@ -23,21 +24,20 @@ object Versions {
const val KOTLIN_X_DATE_TIME = "0.3.2"
const val COROUTINES = "1.5.2-native-mt"
const val BILLING = "4.1.0"
- const val LEAK_CANARY = "2.8.1"
+ const val LEAK_CANARY = "2.9.1"
const val SQL_DELIGHT = "1.5.3"
const val LIFECYCLE = "2.4.1"
- const val MOKO_RESOURCES = "0.19.0"
+ const val MOKO_RESOURCES = "0.19.1"
const val DEPENDENCY_UPDATES = "0.42.0"
- const val BUILD_HEALTH = "0.80.0"
+ const val BUILD_HEALTH = "1.1.0"
const val BUILD_KONFIG = "0.11.0"
const val WORK_RUNTIME = "2.7.1"
const val SPLASH_SCREEN = "1.0.0-alpha02"
const val KOVER = "0.5.0"
const val ROOT_BEER = "0.1.0"
const val MOCKATIVE = "1.1.4"
- const val KSP = "1.6.10-1.0.4"
- const val SCOPE_MOB = "2.1.4"
- const val PARSER_MOB = "1.1.5"
- const val BASE_MOB = "2.1.3"
- const val LOG_MOB = "2.2.0"
+ const val SCOPE_MOB = "2.1.5"
+ const val PARSER_MOB = "1.1.6"
+ const val BASE_MOB = "2.1.4"
+ const val LOG_MOB = "2.2.1"
}
diff --git a/client/src/commonMain/kotlin/com/oztechan/ccc/client/di/module/ClientModule.kt b/client/src/commonMain/kotlin/com/oztechan/ccc/client/di/module/ClientModule.kt
index a80f2e80c6..12fd97a1eb 100644
--- a/client/src/commonMain/kotlin/com/oztechan/ccc/client/di/module/ClientModule.kt
+++ b/client/src/commonMain/kotlin/com/oztechan/ccc/client/di/module/ClientModule.kt
@@ -5,9 +5,9 @@ import com.oztechan.ccc.client.helper.SessionManager
import com.oztechan.ccc.client.helper.SessionManagerImpl
import com.oztechan.ccc.client.viewmodel.adremove.AdRemoveViewModel
import com.oztechan.ccc.client.viewmodel.calculator.CalculatorViewModel
-import com.oztechan.ccc.client.viewmodel.changebase.ChangeBaseViewModel
import com.oztechan.ccc.client.viewmodel.currencies.CurrenciesViewModel
import com.oztechan.ccc.client.viewmodel.main.MainViewModel
+import com.oztechan.ccc.client.viewmodel.selectcurrency.SelectCurrencyViewModel
import com.oztechan.ccc.client.viewmodel.settings.SettingsViewModel
import com.oztechan.ccc.config.ConfigManager
import com.oztechan.ccc.config.ConfigManagerImpl
@@ -18,7 +18,7 @@ var clientModule = module {
viewModelDefinition { MainViewModel(get(), get(), get()) }
viewModelDefinition { CurrenciesViewModel(get(), get(), get()) }
viewModelDefinition { CalculatorViewModel(get(), get(), get(), get(), get()) }
- viewModelDefinition { ChangeBaseViewModel(get()) }
+ viewModelDefinition { SelectCurrencyViewModel(get()) }
viewModelDefinition { AdRemoveViewModel(get()) }
single { ConfigManagerImpl() }
diff --git a/client/src/commonMain/kotlin/com/oztechan/ccc/client/viewmodel/changebase/BarSEED.kt b/client/src/commonMain/kotlin/com/oztechan/ccc/client/viewmodel/selectcurrency/SelectCurrencySEED.kt
similarity index 68%
rename from client/src/commonMain/kotlin/com/oztechan/ccc/client/viewmodel/changebase/BarSEED.kt
rename to client/src/commonMain/kotlin/com/oztechan/ccc/client/viewmodel/selectcurrency/SelectCurrencySEED.kt
index 659eabd3c8..d03a3af21c 100644
--- a/client/src/commonMain/kotlin/com/oztechan/ccc/client/viewmodel/changebase/BarSEED.kt
+++ b/client/src/commonMain/kotlin/com/oztechan/ccc/client/viewmodel/selectcurrency/SelectCurrencySEED.kt
@@ -1,4 +1,4 @@
-package com.oztechan.ccc.client.viewmodel.changebase
+package com.oztechan.ccc.client.viewmodel.selectcurrency
import com.oztechan.ccc.client.base.BaseEffect
import com.oztechan.ccc.client.base.BaseEvent
@@ -7,26 +7,26 @@ import com.oztechan.ccc.client.model.Currency
import kotlinx.coroutines.flow.MutableStateFlow
// State
-data class ChangeBaseState(
+data class SelectCurrencyState(
val loading: Boolean = true,
val enoughCurrency: Boolean = false,
val currencyList: List = listOf(),
) : BaseState()
// Event
-interface ChangeBaseEvent : BaseEvent {
+interface SelectCurrencyEvent : BaseEvent {
fun onItemClick(currency: Currency)
fun onSelectClick()
}
// Effect
-sealed class ChangeBaseEffect : BaseEffect() {
- data class BaseChange(val newBase: String) : ChangeBaseEffect()
- object OpenCurrencies : ChangeBaseEffect()
+sealed class SelectCurrencyEffect : BaseEffect() {
+ data class CurrencyChange(val newBase: String) : SelectCurrencyEffect()
+ object OpenCurrencies : SelectCurrencyEffect()
}
// Extension
-fun MutableStateFlow.update(
+fun MutableStateFlow.update(
loading: Boolean = value.loading,
enoughCurrency: Boolean = value.enoughCurrency,
currencyList: List = value.currencyList
diff --git a/client/src/commonMain/kotlin/com/oztechan/ccc/client/viewmodel/changebase/ChangeBaseViewModel.kt b/client/src/commonMain/kotlin/com/oztechan/ccc/client/viewmodel/selectcurrency/SelectCurrencyViewModel.kt
similarity index 72%
rename from client/src/commonMain/kotlin/com/oztechan/ccc/client/viewmodel/changebase/ChangeBaseViewModel.kt
rename to client/src/commonMain/kotlin/com/oztechan/ccc/client/viewmodel/selectcurrency/SelectCurrencyViewModel.kt
index 6b68cfbf53..f6cb1cf293 100644
--- a/client/src/commonMain/kotlin/com/oztechan/ccc/client/viewmodel/changebase/ChangeBaseViewModel.kt
+++ b/client/src/commonMain/kotlin/com/oztechan/ccc/client/viewmodel/selectcurrency/SelectCurrencyViewModel.kt
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2021 Mustafa Ozhan. All rights reserved.
*/
-package com.oztechan.ccc.client.viewmodel.changebase
+package com.oztechan.ccc.client.viewmodel.selectcurrency
import co.touchlab.kermit.Logger
import com.oztechan.ccc.client.base.BaseData
@@ -18,17 +18,17 @@ import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
-class ChangeBaseViewModel(
+class SelectCurrencyViewModel(
currencyRepository: CurrencyRepository
-) : BaseSEEDViewModel(), ChangeBaseEvent {
+) : BaseSEEDViewModel(), SelectCurrencyEvent {
// region SEED
- private val _state = MutableStateFlow(ChangeBaseState())
+ private val _state = MutableStateFlow(SelectCurrencyState())
override val state = _state.asStateFlow()
- private val _effect = MutableSharedFlow()
+ private val _effect = MutableSharedFlow()
override val effect = _effect.asSharedFlow()
- override val event = this as ChangeBaseEvent
+ override val event = this as SelectCurrencyEvent
override val data: BaseData? = null
// endregion
@@ -46,13 +46,13 @@ class ChangeBaseViewModel(
// region Event
override fun onItemClick(currency: Currency) = clientScope.launchIgnored {
- Logger.d { "ChangeBaseViewModel onItemClick ${currency.name}" }
- _effect.emit(ChangeBaseEffect.BaseChange(currency.name))
+ Logger.d { "SelectCurrencyViewModel onItemClick ${currency.name}" }
+ _effect.emit(SelectCurrencyEffect.CurrencyChange(currency.name))
}
override fun onSelectClick() = clientScope.launchIgnored {
- Logger.d { "ChangeBaseViewModel onSelectClick" }
- _effect.emit(ChangeBaseEffect.OpenCurrencies)
+ Logger.d { "SelectCurrencyViewModel onSelectClick" }
+ _effect.emit(SelectCurrencyEffect.OpenCurrencies)
}
// endregion
}
diff --git a/client/src/commonTest/kotlin/com/oztechan/ccc/client/viewmodel/ChangeBaseViewModelTest.kt b/client/src/commonTest/kotlin/com/oztechan/ccc/client/viewmodel/SelectCurrencyViewModelTest.kt
similarity index 84%
rename from client/src/commonTest/kotlin/com/oztechan/ccc/client/viewmodel/ChangeBaseViewModelTest.kt
rename to client/src/commonTest/kotlin/com/oztechan/ccc/client/viewmodel/SelectCurrencyViewModelTest.kt
index 34949c977c..770f478532 100644
--- a/client/src/commonTest/kotlin/com/oztechan/ccc/client/viewmodel/ChangeBaseViewModelTest.kt
+++ b/client/src/commonTest/kotlin/com/oztechan/ccc/client/viewmodel/SelectCurrencyViewModelTest.kt
@@ -8,10 +8,10 @@ import com.oztechan.ccc.client.mapper.toUIModel
import com.oztechan.ccc.client.mapper.toUIModelList
import com.oztechan.ccc.client.util.after
import com.oztechan.ccc.client.util.before
-import com.oztechan.ccc.client.viewmodel.changebase.ChangeBaseEffect
-import com.oztechan.ccc.client.viewmodel.changebase.ChangeBaseState
-import com.oztechan.ccc.client.viewmodel.changebase.ChangeBaseViewModel
-import com.oztechan.ccc.client.viewmodel.changebase.update
+import com.oztechan.ccc.client.viewmodel.selectcurrency.SelectCurrencyEffect
+import com.oztechan.ccc.client.viewmodel.selectcurrency.SelectCurrencyState
+import com.oztechan.ccc.client.viewmodel.selectcurrency.SelectCurrencyViewModel
+import com.oztechan.ccc.client.viewmodel.selectcurrency.update
import com.oztechan.ccc.common.db.currency.CurrencyRepository
import com.oztechan.ccc.common.runTest
import io.mockative.Mock
@@ -28,13 +28,13 @@ import kotlin.test.assertEquals
import kotlin.test.assertNull
import com.oztechan.ccc.common.model.Currency as CurrencyCommon
-class ChangeBaseViewModelTest {
+class SelectCurrencyViewModelTest {
@Mock
private val currencyRepository = mock(classOf())
- private val viewModel: ChangeBaseViewModel by lazy {
- ChangeBaseViewModel(currencyRepository)
+ private val viewModel: SelectCurrencyViewModel by lazy {
+ SelectCurrencyViewModel(currencyRepository)
}
private val currencyDollar = CurrencyCommon("USD", "Dollar", "$", 0.0, true)
private val currencyEuro = CurrencyCommon("Eur", "Euro", "", 0.0, true)
@@ -62,7 +62,7 @@ class ChangeBaseViewModelTest {
@Test
fun states_updates_correctly() {
val currencyList = listOf(currencyUIModel)
- val state = MutableStateFlow(ChangeBaseState())
+ val state = MutableStateFlow(SelectCurrencyState())
state.before {
state.update(
@@ -115,7 +115,7 @@ class ChangeBaseViewModelTest {
viewModel.effect.before {
viewModel.event.onItemClick(currencyUIModel)
}.after {
- assertEquals(ChangeBaseEffect.BaseChange(currencyUIModel.name), it)
+ assertEquals(SelectCurrencyEffect.CurrencyChange(currencyUIModel.name), it)
}
}
@@ -124,7 +124,7 @@ class ChangeBaseViewModelTest {
viewModel.effect.before {
viewModel.event.onSelectClick()
}.after {
- assertEquals(ChangeBaseEffect.OpenCurrencies, it)
+ assertEquals(SelectCurrencyEffect.OpenCurrencies, it)
}
}
}
diff --git a/common/src/commonMain/kotlin/com/oztechan/ccc/common/entity/CurrencyResponseEntity.kt b/common/src/commonMain/kotlin/com/oztechan/ccc/common/entity/CurrencyResponseEntity.kt
index b28d52fae8..064dab17d3 100755
--- a/common/src/commonMain/kotlin/com/oztechan/ccc/common/entity/CurrencyResponseEntity.kt
+++ b/common/src/commonMain/kotlin/com/oztechan/ccc/common/entity/CurrencyResponseEntity.kt
@@ -7,7 +7,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonNames
-@Suppress("EXPERIMENTAL_API_USAGE")
+@Suppress("OPT_IN_USAGE")
@Serializable
internal data class CurrencyResponseEntity(
@JsonNames("base", "base_code") var base: String,
diff --git a/common/src/commonMain/kotlin/com/oztechan/ccc/common/entity/RatesEntity.kt b/common/src/commonMain/kotlin/com/oztechan/ccc/common/entity/RatesEntity.kt
index ebdbde9670..20926967ad 100755
--- a/common/src/commonMain/kotlin/com/oztechan/ccc/common/entity/RatesEntity.kt
+++ b/common/src/commonMain/kotlin/com/oztechan/ccc/common/entity/RatesEntity.kt
@@ -7,7 +7,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.JsonNames
-@Suppress("ConstructorParameterNaming", "EXPERIMENTAL_API_USAGE")
+@Suppress("ConstructorParameterNaming", "OPT_IN_USAGE")
@Serializable
internal data class RatesEntity(
@SerialName("base") var base: String = "",
diff --git a/common/src/jvmMain/kotlin/com/oztechan/ccc/common/di/modules/JVMSettingsModule.kt b/common/src/jvmMain/kotlin/com/oztechan/ccc/common/di/modules/JVMSettingsModule.kt
index 8874e0914b..805d6e6211 100644
--- a/common/src/jvmMain/kotlin/com/oztechan/ccc/common/di/modules/JVMSettingsModule.kt
+++ b/common/src/jvmMain/kotlin/com/oztechan/ccc/common/di/modules/JVMSettingsModule.kt
@@ -4,5 +4,5 @@ import com.russhwolf.settings.JvmPreferencesSettings
import com.russhwolf.settings.Settings
import org.koin.core.scope.Scope
-@Suppress("EXPERIMENTAL_API_USAGE")
+@Suppress("OPT_IN_USAGE")
actual fun Scope.provideSettings(): Settings = JvmPreferencesSettings(get())
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 96eb38f12c..e09bbcb5a5 100755
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -5,4 +5,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
diff --git a/ios/CCC.xcodeproj/project.pbxproj b/ios/CCC.xcodeproj/project.pbxproj
index b9e5f68443..018399a9df 100644
--- a/ios/CCC.xcodeproj/project.pbxproj
+++ b/ios/CCC.xcodeproj/project.pbxproj
@@ -22,13 +22,13 @@
5C31E43128142110008C42B9 /* CurrenciesItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C31E43028142110008C42B9 /* CurrenciesItemView.swift */; };
5C31E4342814306D008C42B9 /* SettingsToolbarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C31E4332814306D008C42B9 /* SettingsToolbarView.swift */; };
5C31E4362814308B008C42B9 /* SettingsItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C31E4352814308B008C42B9 /* SettingsItemView.swift */; };
- 5C31E439281431A3008C42B9 /* ChangeBaseItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C31E438281431A3008C42B9 /* ChangeBaseItemView.swift */; };
+ 5C31E439281431A3008C42B9 /* SelectCurrencyItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C31E438281431A3008C42B9 /* SelectCurrencyItemView.swift */; };
5C31E43F28145D32008C42B9 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5C31E43E28145D32008C42B9 /* Launch Screen.storyboard */; };
5C5D09332562EB9E00DA9C4A /* Application.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C5D09322562EB9E00DA9C4A /* Application.swift */; };
5C5D09362562EBDE00DA9C4A /* Koin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C5D09352562EBDE00DA9C4A /* Koin.swift */; };
5C5D09392562EC0100DA9C4A /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C5D09382562EC0100DA9C4A /* Extensions.swift */; };
5C5D093C2562EC2D00DA9C4A /* CalculatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C5D093B2562EC2D00DA9C4A /* CalculatorView.swift */; };
- 5C693EBA25C4AFF800C9373E /* SelectCurrencyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C693EB925C4AFF800C9373E /* SelectCurrencyView.swift */; };
+ 5C693EBA25C4AFF800C9373E /* SelectCurrenciesBottomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C693EB925C4AFF800C9373E /* SelectCurrenciesBottomView.swift */; };
5C6E674025C5A711001CC0D6 /* SliderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C6E673F25C5A711001CC0D6 /* SliderView.swift */; };
5C6E674D25C602BE001CC0D6 /* SnackBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C6E674C25C602BE001CC0D6 /* SnackBar.swift */; };
5C8EB4A9260CB5E200DC4A90 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 5C8EB4A8260CB5E200DC4A90 /* GoogleService-Info.plist */; };
@@ -36,7 +36,7 @@
5C9A59BB25C350DE006745B0 /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C9A59BA25C350DE006745B0 /* MainView.swift */; };
5C9C75C82603A36A00D66FDD /* ToolbarButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C9C75C72603A36A00D66FDD /* ToolbarButton.swift */; };
5CB954BF26932408007632DC /* BannerAdView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CB954BE26932408007632DC /* BannerAdView.swift */; };
- 5CDE468425BC3B2000CA0FB1 /* ChangeBaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CDE468325BC3B2000CA0FB1 /* ChangeBaseView.swift */; };
+ 5CDE468425BC3B2000CA0FB1 /* SelectCurrencyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CDE468325BC3B2000CA0FB1 /* SelectCurrencyView.swift */; };
5CF57E3A269588060081E4BB /* RewardedAd.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CF57E39269588060081E4BB /* RewardedAd.swift */; };
5CF57E3C2695A3B20081E4BB /* InterstitialAd.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CF57E3B2695A3B20081E4BB /* InterstitialAd.swift */; };
5CF8BE4227DE205B00E441F5 /* MailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CF8BE4127DE205B00E441F5 /* MailView.swift */; };
@@ -74,13 +74,13 @@
5C31E43028142110008C42B9 /* CurrenciesItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrenciesItemView.swift; sourceTree = ""; };
5C31E4332814306D008C42B9 /* SettingsToolbarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsToolbarView.swift; sourceTree = ""; };
5C31E4352814308B008C42B9 /* SettingsItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsItemView.swift; sourceTree = ""; };
- 5C31E438281431A3008C42B9 /* ChangeBaseItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangeBaseItemView.swift; sourceTree = ""; };
+ 5C31E438281431A3008C42B9 /* SelectCurrencyItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectCurrencyItemView.swift; sourceTree = ""; };
5C31E43E28145D32008C42B9 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = ""; };
5C5D09322562EB9E00DA9C4A /* Application.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Application.swift; sourceTree = ""; };
5C5D09352562EBDE00DA9C4A /* Koin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Koin.swift; sourceTree = ""; };
5C5D09382562EC0100DA9C4A /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = ""; };
5C5D093B2562EC2D00DA9C4A /* CalculatorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CalculatorView.swift; sourceTree = ""; };
- 5C693EB925C4AFF800C9373E /* SelectCurrencyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectCurrencyView.swift; sourceTree = ""; };
+ 5C693EB925C4AFF800C9373E /* SelectCurrenciesBottomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectCurrenciesBottomView.swift; sourceTree = ""; };
5C6E673F25C5A711001CC0D6 /* SliderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SliderView.swift; sourceTree = ""; };
5C6E674C25C602BE001CC0D6 /* SnackBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SnackBar.swift; sourceTree = ""; };
5C8EB4A8260CB5E200DC4A90 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; };
@@ -90,7 +90,7 @@
5CB954BE26932408007632DC /* BannerAdView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BannerAdView.swift; sourceTree = ""; };
5CB954C526934EFC007632DC /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; };
5CB954CD269362E2007632DC /* Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; };
- 5CDE468325BC3B2000CA0FB1 /* ChangeBaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChangeBaseView.swift; sourceTree = ""; };
+ 5CDE468325BC3B2000CA0FB1 /* SelectCurrencyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectCurrencyView.swift; sourceTree = ""; };
5CF57E39269588060081E4BB /* RewardedAd.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RewardedAd.swift; sourceTree = ""; };
5CF57E3B2695A3B20081E4BB /* InterstitialAd.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterstitialAd.swift; sourceTree = ""; };
5CF8BE4127DE205B00E441F5 /* MailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MailView.swift; sourceTree = ""; };
@@ -120,7 +120,7 @@
children = (
5CB954BE26932408007632DC /* BannerAdView.swift */,
5C039FD525C1B705008350A3 /* FormProgressView.swift */,
- 5C693EB925C4AFF800C9373E /* SelectCurrencyView.swift */,
+ 5C693EB925C4AFF800C9373E /* SelectCurrenciesBottomView.swift */,
5C9C75C72603A36A00D66FDD /* ToolbarButton.swift */,
5CF8BE4127DE205B00E441F5 /* MailView.swift */,
5CF8BE4527DE334100E441F5 /* WebView.swift */,
@@ -179,13 +179,13 @@
path = Settings;
sourceTree = "";
};
- 5C31E4372814315D008C42B9 /* ChangeBase */ = {
+ 5C4B536E28184AEA00D10185 /* SelectCurrency */ = {
isa = PBXGroup;
children = (
- 5CDE468325BC3B2000CA0FB1 /* ChangeBaseView.swift */,
- 5C31E438281431A3008C42B9 /* ChangeBaseItemView.swift */,
+ 5CDE468325BC3B2000CA0FB1 /* SelectCurrencyView.swift */,
+ 5C31E438281431A3008C42B9 /* SelectCurrencyItemView.swift */,
);
- path = ChangeBase;
+ path = SelectCurrency;
sourceTree = "";
};
5C5D09342562EBCA00DA9C4A /* DI */ = {
@@ -204,7 +204,7 @@
5C31E41C28141C61008C42B9 /* Calculator */,
5C31E42B28142033008C42B9 /* Currencies */,
5C31E4322814304F008C42B9 /* Settings */,
- 5C31E4372814315D008C42B9 /* ChangeBase */,
+ 5C4B536E28184AEA00D10185 /* SelectCurrency */,
5C039FD425C1B6A2008350A3 /* SubView */,
);
path = UI;
@@ -459,7 +459,7 @@
5C039FD625C1B705008350A3 /* FormProgressView.swift in Sources */,
5C8FDBDD25BF3FBE00F280FF /* ObservableSEED.swift in Sources */,
5C6E674D25C602BE001CC0D6 /* SnackBar.swift in Sources */,
- 5CDE468425BC3B2000CA0FB1 /* ChangeBaseView.swift in Sources */,
+ 5CDE468425BC3B2000CA0FB1 /* SelectCurrencyView.swift in Sources */,
5C31E43128142110008C42B9 /* CurrenciesItemView.swift in Sources */,
5C31E42028141CA4008C42B9 /* OutputView.swift in Sources */,
5C9A59BB25C350DE006745B0 /* MainView.swift in Sources */,
@@ -473,10 +473,10 @@
5C5D09392562EC0100DA9C4A /* Extensions.swift in Sources */,
5C17581A25BC74BD00D16BD9 /* SettingsView.swift in Sources */,
5C5D09332562EB9E00DA9C4A /* Application.swift in Sources */,
- 5C693EBA25C4AFF800C9373E /* SelectCurrencyView.swift in Sources */,
+ 5C693EBA25C4AFF800C9373E /* SelectCurrenciesBottomView.swift in Sources */,
5C31E41E28141C7B008C42B9 /* InputView.swift in Sources */,
5C31E42A28141F1B008C42B9 /* SlideView.swift in Sources */,
- 5C31E439281431A3008C42B9 /* ChangeBaseItemView.swift in Sources */,
+ 5C31E439281431A3008C42B9 /* SelectCurrencyItemView.swift in Sources */,
5C31E42F281420BC008C42B9 /* CurrenciesToolbarView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
diff --git a/ios/CCC/DI/Koin.swift b/ios/CCC/DI/Koin.swift
index 1d0de29fce..9f60fc32a9 100644
--- a/ios/CCC/DI/Koin.swift
+++ b/ios/CCC/DI/Koin.swift
@@ -39,8 +39,8 @@ extension Koin_coreKoin {
return koin.getDependency(objCClass: CurrenciesViewModel.self) as! CurrenciesViewModel
}
- func get() -> ChangeBaseViewModel {
- return koin.getDependency(objCClass: ChangeBaseViewModel.self) as! ChangeBaseViewModel
+ func get() -> SelectCurrencyViewModel {
+ return koin.getDependency(objCClass: SelectCurrencyViewModel.self) as! SelectCurrencyViewModel
}
func get() -> SettingsViewModel {
@@ -56,8 +56,8 @@ extension Koin_coreKoin {
return CalculatorObservable(viewModel: get())
}
- func get() -> ChangeBaseObservable {
- return ChangeBaseObservable(viewModel: get())
+ func get() -> SelectCurrencyObservable {
+ return SelectCurrencyObservable(viewModel: get())
}
func get() -> SettingsObservable {
diff --git a/ios/CCC/UI/Calculator/CalculatorView.swift b/ios/CCC/UI/Calculator/CalculatorView.swift
index 2ee3420a01..554d4b8b41 100644
--- a/ios/CCC/UI/Calculator/CalculatorView.swift
+++ b/ios/CCC/UI/Calculator/CalculatorView.swift
@@ -88,9 +88,9 @@ struct CalculatorView: View {
.sheet(
isPresented: $isBarShown,
content: {
- ChangeBaseView(
+ SelectCurrencyView(
isBarShown: $isBarShown,
- onBaseChange: { observable.event.onBaseChange(base: $0)}
+ onSelectCurrency: { observable.event.onBaseChange(base: $0)}
).environmentObject(navigationStack)
}
)
diff --git a/ios/CCC/UI/Calculator/OutputView.swift b/ios/CCC/UI/Calculator/OutputView.swift
index b1b408bb37..9a3cb2717f 100644
--- a/ios/CCC/UI/Calculator/OutputView.swift
+++ b/ios/CCC/UI/Calculator/OutputView.swift
@@ -20,12 +20,10 @@ struct OutputView: View {
VStack(alignment: .leading) {
HStack {
- if baseCurrency != "" {
- Image(uiImage: baseCurrency.getImage())
- .resizable()
- .frame(width: 36, height: 36, alignment: .center)
- .shadow(radius: 3)
- }
+ Image(uiImage: baseCurrency.getImage())
+ .resizable()
+ .frame(width: 36, height: 36, alignment: .center)
+ .shadow(radius: 3)
Text(baseCurrency).foregroundColor(MR.colors().text.get())
@@ -36,7 +34,7 @@ struct OutputView: View {
Text(symbol).foregroundColor(MR.colors().text.get())
}
.frame(minWidth: 0, maxWidth: .infinity, alignment: .bottomLeading)
- .padding(EdgeInsets(top: 0, leading: 20, bottom: 0, trailing: 20))
+ .padding(EdgeInsets(top: 2, leading: 20, bottom: 2, trailing: 20))
.animation(.default)
}
diff --git a/ios/CCC/UI/Currencies/CurrenciesView.swift b/ios/CCC/UI/Currencies/CurrenciesView.swift
index 6684e78990..2afb866b68 100644
--- a/ios/CCC/UI/Currencies/CurrenciesView.swift
+++ b/ios/CCC/UI/Currencies/CurrenciesView.swift
@@ -60,7 +60,7 @@ struct CurrenciesView: View {
.background(MR.colors().background.get())
if observable.viewModel.isFirstRun() {
- SelectCurrencyView(
+ SelectCurrenciesBottomView(
text: MR.strings().txt_select_currencies.get(),
buttonText: MR.strings().btn_done.get(),
onButtonClick: observable.event.onDoneClick
diff --git a/ios/CCC/UI/ChangeBase/ChangeBaseItemView.swift b/ios/CCC/UI/SelectCurrency/SelectCurrencyItemView.swift
similarity index 92%
rename from ios/CCC/UI/ChangeBase/ChangeBaseItemView.swift
rename to ios/CCC/UI/SelectCurrency/SelectCurrencyItemView.swift
index 678069c916..94a7432654 100644
--- a/ios/CCC/UI/ChangeBase/ChangeBaseItemView.swift
+++ b/ios/CCC/UI/SelectCurrency/SelectCurrencyItemView.swift
@@ -1,5 +1,5 @@
//
-// ChangeBaseItemView.swift
+// SelectCurrencyItemView.swift
// CCC
//
// Created by Mustafa Ozhan on 23.04.22.
@@ -10,7 +10,7 @@ import SwiftUI
import Resources
import Client
-struct ChangeBaseItemView: View {
+struct SelectCurrencyItemView: View {
@Environment(\.colorScheme) var colorScheme
var item: Currency
diff --git a/ios/CCC/UI/ChangeBase/ChangeBaseView.swift b/ios/CCC/UI/SelectCurrency/SelectCurrencyView.swift
similarity index 72%
rename from ios/CCC/UI/ChangeBase/ChangeBaseView.swift
rename to ios/CCC/UI/SelectCurrency/SelectCurrencyView.swift
index e4b2bbda28..114474bb48 100644
--- a/ios/CCC/UI/ChangeBase/ChangeBaseView.swift
+++ b/ios/CCC/UI/SelectCurrency/SelectCurrencyView.swift
@@ -1,5 +1,5 @@
//
-// BarView.swift
+// SelectCurrencyObservable.swift
// CCC
//
// Created by Mustafa Ozhan on 23/01/2021.
@@ -11,17 +11,17 @@ import Resources
import Client
import NavigationStack
-typealias ChangeBaseObservable = ObservableSEED
-
+typealias SelectCurrencyObservable = ObservableSEED
+
-struct ChangeBaseView: View {
+struct SelectCurrencyView: View {
@Environment(\.colorScheme) var colorScheme
@EnvironmentObject private var navigationStack: NavigationStack
- @StateObject var observable: ChangeBaseObservable = koin.get()
+ @StateObject var observable: SelectCurrencyObservable = koin.get()
@Binding var isBarShown: Bool
- var onBaseChange: (String) -> Void
+ var onSelectCurrency: (String) -> Void
var body: some View {
@@ -33,7 +33,7 @@ struct ChangeBaseView: View {
if observable.state.currencyList.count < 2 {
- SelectCurrencyView(
+ SelectCurrenciesBottomView(
text: MR.strings().choose_at_least_two_currency.get(),
buttonText: MR.strings().select.get(),
onButtonClick: observable.event.onSelectClick
@@ -48,7 +48,7 @@ struct ChangeBaseView: View {
List(observable.state.currencyList, id: \.name) { currency in
- ChangeBaseItemView(item: currency)
+ SelectCurrencyItemView(item: currency)
.onTapGesture { observable.event.onItemClick(currency: currency) }
.frame(minWidth: 0, maxWidth: .infinity, alignment: .center)
@@ -66,15 +66,15 @@ struct ChangeBaseView: View {
.onReceive(observable.effect) { onEffect(effect: $0) }
}
- private func onEffect(effect: ChangeBaseEffect) {
- logger.i(message: {"ChangeBaseView onEffect \(effect.description)"})
+ private func onEffect(effect: SelectCurrencyEffect) {
+ logger.i(message: {"SelectCurrencyView onEffect \(effect.description)"})
switch effect {
// swiftlint:disable force_cast
- case is ChangeBaseEffect.BaseChange:
- onBaseChange((effect as! ChangeBaseEffect.BaseChange).newBase)
+ case is SelectCurrencyEffect.CurrencyChange:
+ onSelectCurrency((effect as! SelectCurrencyEffect.CurrencyChange).newBase)
isBarShown = false
- case is ChangeBaseEffect.OpenCurrencies:
- navigationStack.push(CurrenciesView(onBaseChange: onBaseChange))
+ case is SelectCurrencyEffect.OpenCurrencies:
+ navigationStack.push(CurrenciesView(onBaseChange: onSelectCurrency))
default:
logger.i(message: {"BarView unknown effect"})
}
diff --git a/ios/CCC/UI/SubView/SelectCurrencyView.swift b/ios/CCC/UI/SubView/SelectCurrenciesBottomView.swift
similarity index 91%
rename from ios/CCC/UI/SubView/SelectCurrencyView.swift
rename to ios/CCC/UI/SubView/SelectCurrenciesBottomView.swift
index d972e49240..b779c630b3 100644
--- a/ios/CCC/UI/SubView/SelectCurrencyView.swift
+++ b/ios/CCC/UI/SubView/SelectCurrenciesBottomView.swift
@@ -1,5 +1,5 @@
//
-// CurrencySelectionView.swift
+// SelectCurrenciesBottomView.swift
// CCC
//
// Created by Mustafa Ozhan on 29/01/2021.
@@ -9,7 +9,7 @@
import SwiftUI
import Resources
-struct SelectCurrencyView: View {
+struct SelectCurrenciesBottomView: View {
@Environment(\.colorScheme) var colorScheme
var text: String
diff --git a/ios/CCC/Util/Extensions.swift b/ios/CCC/Util/Extensions.swift
index e7e57589e3..04d41a1392 100644
--- a/ios/CCC/Util/Extensions.swift
+++ b/ios/CCC/Util/Extensions.swift
@@ -12,10 +12,10 @@ import SwiftUI
extension ResourcesStringResource {
func get() -> String {
- return ResourcesKt.getString(stringResource: self).localized()
+ return IOSResourcesKt.getString(stringResource: self).localized()
}
func get(parameter: Any) -> String {
- return ResourcesKt.getString(stringResource: self, parameter: parameter).localized()
+ return IOSResourcesKt.getString(stringResource: self, parameter: parameter).localized()
}
}
@@ -24,7 +24,7 @@ extension ResourcesColorResource {
return Color(get())
}
func get() -> UIColor {
- return ResourcesKt.getColor(colorResource: self)
+ return IOSResourcesKt.getColor(colorResource: self)
}
}
@@ -36,7 +36,7 @@ extension ResourcesImageResource {
extension String {
func getImage() -> UIImage {
- return ResourcesKt.getDrawableByFileName(name: self).toUIImage()!
+ return ResourcesKt.getImageByFileName(name: self).toUIImage()!
}
}
diff --git a/resources/src/androidMain/kotlin/com/oztechan/ccc/resources/AndroidResources.kt b/resources/src/androidMain/kotlin/com/oztechan/ccc/resources/AndroidResources.kt
new file mode 100644
index 0000000000..88ec0c1b99
--- /dev/null
+++ b/resources/src/androidMain/kotlin/com/oztechan/ccc/resources/AndroidResources.kt
@@ -0,0 +1,12 @@
+package com.oztechan.ccc.resources
+
+import android.widget.ImageView
+
+fun getDrawableIdByFileName(
+ name: String
+): Int = getImageByFileName(name.toImageFileName()).drawableResId
+
+fun ImageView.setBackgroundByName(
+ name: String
+) = setImageResource(getDrawableIdByFileName(name))
+
diff --git a/resources/src/commonMain/kotlin/com/oztechan/ccc/resources/Resources.kt b/resources/src/commonMain/kotlin/com/oztechan/ccc/resources/Resources.kt
new file mode 100644
index 0000000000..370e24f5e5
--- /dev/null
+++ b/resources/src/commonMain/kotlin/com/oztechan/ccc/resources/Resources.kt
@@ -0,0 +1,12 @@
+package com.oztechan.ccc.resources
+
+import dev.icerock.moko.resources.ImageResource
+import dev.icerock.moko.resources.getImageByFileName
+
+fun getImageByFileName(
+ name: String
+): ImageResource = MR.images.getImageByFileName(name.toImageFileName()) ?: MR.images.unknown
+
+fun String.toImageFileName() = lowercase()
+ .replace("try", "tryy")
+ .ifEmpty { "unknown" }
diff --git a/resources/src/commonMain/resources/MR/base/strings.xml b/resources/src/commonMain/resources/MR/base/strings.xml
index 83c4aa95bf..fc3eab78ff 100644
--- a/resources/src/commonMain/resources/MR/base/strings.xml
+++ b/resources/src/commonMain/resources/MR/base/strings.xml
@@ -52,7 +52,9 @@
Copied to clipboard!
- Please rate us and review the app on Google Play Store :)
+ You can rate us and review our app in the market :)
+ https://play.google.com/store/apps/details?id=mustafaozhan.github.com.mycurrencies
+ https://appgallery.huawei.com/app/C104920917
RATE
Update
https://github.com/CurrencyConverterCalculator/CCC
@@ -63,7 +65,6 @@
Feedback for CCC
Dear Developer,
Send Feedback:
- https://play.google.com/store/apps/details?id=mustafaozhan.github.com.mycurrencies
NEXT
@@ -80,8 +81,8 @@
If you want to change the app theme
Click on settings icon > Theme\nThen chose your theme!
-
- Select base currency
+
+ Select currency
Settings
diff --git a/resources/src/commonMain/resources/MR/images/transparent@2x.png b/resources/src/commonMain/resources/MR/images/transparent@2x.png
deleted file mode 100755
index bb99aad04b..0000000000
Binary files a/resources/src/commonMain/resources/MR/images/transparent@2x.png and /dev/null differ
diff --git a/resources/src/commonMain/resources/MR/images/unknown@2x.png b/resources/src/commonMain/resources/MR/images/unknown@2x.png
new file mode 100644
index 0000000000..227f959042
Binary files /dev/null and b/resources/src/commonMain/resources/MR/images/unknown@2x.png differ
diff --git a/resources/src/iosMain/kotlin/com/oztechan/ccc/resources/Resources.kt b/resources/src/iosMain/kotlin/com/oztechan/ccc/resources/IOSResources.kt
similarity index 77%
rename from resources/src/iosMain/kotlin/com/oztechan/ccc/resources/Resources.kt
rename to resources/src/iosMain/kotlin/com/oztechan/ccc/resources/IOSResources.kt
index 427fda853f..3343cbca9c 100644
--- a/resources/src/iosMain/kotlin/com/oztechan/ccc/resources/Resources.kt
+++ b/resources/src/iosMain/kotlin/com/oztechan/ccc/resources/IOSResources.kt
@@ -7,22 +7,14 @@ package com.oztechan.ccc.resources
import dev.icerock.moko.graphics.toUIColor
import dev.icerock.moko.resources.ColorResource
-import dev.icerock.moko.resources.ImageResource
import dev.icerock.moko.resources.StringResource
import dev.icerock.moko.resources.desc.Resource
import dev.icerock.moko.resources.desc.ResourceFormatted
import dev.icerock.moko.resources.desc.StringDesc
import dev.icerock.moko.resources.getColor
-import dev.icerock.moko.resources.getImageByFileName
import platform.UIKit.UIColor
import platform.UIKit.UIScreen
-fun getDrawableByFileName(name: String): ImageResource {
- return MR.images.getImageByFileName(
- name.lowercase().replace("try", "tryy")
- ) ?: MR.images.transparent
-}
-
fun getString(stringResource: StringResource): StringDesc {
return StringDesc.Resource(stringResource)
}