Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafaozhan committed Aug 2, 2022
2 parents 04f8ada + ad4ae58 commit 0c741c7
Show file tree
Hide file tree
Showing 378 changed files with 2,032 additions and 1,843 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ jobs:

- name: Install Cocoapods
run: |
./gradlew client:podGenIOS resources:podGenIOS --parallel
./gradlew client:podGenIOS res:podGenIOS --parallel
cd ios/CCC
pod install
pod install --repo-update
- name: Build
uses: maierj/[email protected]
Expand All @@ -136,6 +136,8 @@ jobs:
GIT_AUTHORIZATION: ${{ secrets.GIT_AUTHORIZATION }}
SECRET_PASSWORD: ${{ secrets.SECRET_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.SECRET_PASSWORD }}
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 5
FASTLANE_XCODEBUILD_SETTINGS_RETRIES: 5

- name: Set Job Status
id: status
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ jobs:
- name: Install Cocoapods
run: |
./gradlew client:podGenIOS resources:podGenIOS --parallel
./gradlew client:podGenIOS res:podGenIOS --parallel
cd ios/CCC
pod install
pod install --repo-update
- name: Publish
uses: maierj/[email protected]
Expand All @@ -226,6 +226,8 @@ jobs:
GIT_AUTHORIZATION: ${{ secrets.GIT_AUTHORIZATION }}
SECRET_PASSWORD: ${{ secrets.SECRET_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.SECRET_PASSWORD }}
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 5
FASTLANE_XCODEBUILD_SETTINGS_RETRIES: 5

- name: Set Job Status
id: status
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ jobs:
- name: Install Cocoapods
run: |
./gradlew client:podGenIOS resources:podGenIOS --parallel
./gradlew client:podGenIOS res:podGenIOS --parallel
cd ios/CCC
pod install
pod install --repo-update
- name: Distrubute
uses: maierj/[email protected]
Expand All @@ -124,6 +124,8 @@ jobs:
GIT_AUTHORIZATION: ${{ secrets.GIT_AUTHORIZATION }}
SECRET_PASSWORD: ${{ secrets.SECRET_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.SECRET_PASSWORD }}
FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT: 5
FASTLANE_XCODEBUILD_SETTINGS_RETRIES: 5

- name: Set Job Status
id: status
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ A currency converter application for most of the currencies used in the world.
You can quickly convert and make mathematical operations between currencies.

<a href="https://play.google.com/store/apps/details?id=mustafaozhan.github.com.mycurrencies"><img src="https://raw.githubusercontent.com/CurrencyConverterCalculator/CCC/develop/art/play_store.png?raw=true" width="175px"></a>
<a href="https://apps.apple.com/us/app/currency-converter-calculator/id1617484510"><img src="https://raw.githubusercontent.com/CurrencyConverterCalculator/CCC/develop/art/app_store.png?raw=true" width="175px"></a>
<a href="https://appgallery.huawei.com/app/C104920917"><img src="https://raw.githubusercontent.com/CurrencyConverterCalculator/CCC/develop/art/appgallery.png?raw=true" width="175px"></a>

<a href="https://github.com/Oztechan/CCC/actions/workflows/main.yml"><img src="https://github.com/CurrencyConverterCalculator/CCC/workflows/CCC%20CI/badge.svg"></a>
Expand All @@ -33,8 +34,8 @@ ad-->android
analytics-->android
resources{resources}-->android
resources-->ios
res{res}-->android
res-->ios
client{client}-->android
client-->ios
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ dependencies {

with(Dependencies.Modules) {
implementation(project(CLIENT))
implementation(project(RESOURCES))
implementation(project(RES))
implementation(project(BILLING))
implementation(project(AD))
implementation(project(ANALYTICS))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import com.github.submob.logmob.initCrashlytics
import com.github.submob.logmob.initLogger
import com.oztechan.ccc.ad.initAds
import com.oztechan.ccc.analytics.initAnalytics
import com.oztechan.ccc.android.di.platformModule
import com.oztechan.ccc.android.di.module.appModule
import com.oztechan.ccc.client.di.initAndroid
import mustafaozhan.github.com.mycurrencies.BuildConfig

Expand All @@ -40,7 +40,7 @@ class Application : Application() {

initAndroid(
context = this,
platformModule = platformModule
appModule = appModule
)

Thread.setDefaultUncaughtExceptionHandler(ANRWatchDogHandler())
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.oztechan.ccc.android.di.module

import com.oztechan.ccc.ad.AdManager
import com.oztechan.ccc.ad.AdManagerImpl
import com.oztechan.ccc.analytics.AnalyticsManager
import com.oztechan.ccc.analytics.AnalyticsManagerImpl
import com.oztechan.ccc.billing.BillingManager
import com.oztechan.ccc.billing.BillingManagerImpl
import org.koin.core.module.dsl.bind
import org.koin.core.module.dsl.singleOf
import org.koin.dsl.module

internal var appModule = module {
singleOf(::BillingManagerImpl) { bind<BillingManager>() }
singleOf(::AdManagerImpl) { bind<AdManager>() }
singleOf(::AnalyticsManagerImpl) { bind<AnalyticsManager>() }
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ class AdRemoveBottomSheet : BaseVBBottomSheetDialogFragment<BottomSheetAdRemoveB
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
Logger.i { "AdRemoveBottomSheet onViewCreated" }
billingManager.startConnection(
viewLifecycleOwner.lifecycleScope,
RemoveAdType.getPurchaseIds()
)
billingManager.startConnection(viewLifecycleOwner.lifecycleScope, RemoveAdType.getPurchaseIds())
initViews()
observeStates()
observeEffects()
Expand Down Expand Up @@ -98,16 +95,11 @@ class AdRemoveBottomSheet : BaseVBBottomSheetDialogFragment<BottomSheetAdRemoveB
showRewardedAd()
}
} else {
billingManager.launchBillingFlow(
requireActivity(),
viewEffect.removeAdType.data.id
)
billingManager.launchBillingFlow(requireActivity(), viewEffect.removeAdType.data.id)
}
}
is AdRemoveEffect.AdsRemoved -> {
if (viewEffect.removeAdType == RemoveAdType.VIDEO ||
viewEffect.isRestorePurchase
) {
if (viewEffect.removeAdType == RemoveAdType.VIDEO || viewEffect.isRestorePurchase) {
restartActivity()
} else {
billingManager.acknowledgePurchase()
Expand Down Expand Up @@ -140,7 +132,7 @@ class AdRemoveBottomSheet : BaseVBBottomSheetDialogFragment<BottomSheetAdRemoveB
adId = getString(R.string.android_rewarded_ad_unit_id),
onAdFailedToLoad = {
adRemoveViewModel.showLoadingView(false)
view?.let { showSnack(it, R.string.error_text_unknown) }
view?.showSnack(R.string.error_text_unknown)
},
onAdLoaded = {
adRemoveViewModel.showLoadingView(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,8 @@ class CalculatorFragment : BaseVBFragment<FragmentCalculatorBinding>() {
.onEach { viewEffect ->
Logger.i { "CalculatorFragment observeEffects ${viewEffect::class.simpleName}" }
when (viewEffect) {
CalculatorEffect.Error -> showSnack(
requireView(),
R.string.error_text_unknown
)
CalculatorEffect.FewCurrency -> showSnack(
requireView(),
CalculatorEffect.Error -> view?.showSnack(R.string.error_text_unknown)
CalculatorEffect.FewCurrency -> view?.showSnack(
R.string.choose_at_least_two_currency,
R.string.select
) {
Expand All @@ -146,10 +142,7 @@ class CalculatorFragment : BaseVBFragment<FragmentCalculatorBinding>() {
CalculatorFragmentDirections.actionCalculatorFragmentToCurrenciesFragment()
)
}
CalculatorEffect.MaximumInput -> showSnack(
requireView(),
R.string.text_max_input
)
CalculatorEffect.MaximumInput -> view?.showSnack(R.string.text_max_input)
CalculatorEffect.OpenBar -> navigate(
R.id.calculatorFragment,
CalculatorFragmentDirections.actionCalculatorFragmentToSelectCurrencyBottomSheet()
Expand All @@ -158,9 +151,8 @@ class CalculatorFragment : BaseVBFragment<FragmentCalculatorBinding>() {
R.id.calculatorFragment,
CalculatorFragmentDirections.actionCalculatorFragmentToSettingsFragment()
)
is CalculatorEffect.CopyToClipboard -> requireView().copyToClipBoard(viewEffect.amount)
is CalculatorEffect.ShowRate -> showSnack(
requireView(),
is CalculatorEffect.CopyToClipboard -> view?.copyToClipBoard(viewEffect.amount)
is CalculatorEffect.ShowRate -> view?.showSnack(
viewEffect.text,
icon = requireContext().getImageResourceByName(viewEffect.name)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,7 @@ class CurrenciesFragment : BaseVBFragment<FragmentCurrenciesBinding>() {
.onEach { viewEffect ->
Logger.i { "CurrenciesFragment observeEffects ${viewEffect::class.simpleName}" }
when (viewEffect) {
CurrenciesEffect.FewCurrency -> showSnack(
requireView(),
R.string.choose_at_least_two_currency
)
CurrenciesEffect.FewCurrency -> view?.showSnack(R.string.choose_at_least_two_currency)
CurrenciesEffect.OpenCalculator -> {
navigate(
R.id.currenciesFragment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class MainActivity : BaseActivity() {
private val mainViewModel: MainViewModel by viewModel()

override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)
Logger.i { "MainActivity onCreate" }
installSplashScreen()
updateAppTheme(mainViewModel.getAppTheme())
setContentView(R.layout.activity_main)
checkDestination()
Expand Down Expand Up @@ -73,11 +73,13 @@ class MainActivity : BaseActivity() {

private fun checkDestination() = with(getNavigationController()) {
graph = navInflater.inflate(R.navigation.main_graph).apply {
startDestination = if (mainViewModel.isFistRun()) {
R.id.sliderFragment
} else {
R.id.calculatorFragment
}
setStartDestination(
if (mainViewModel.isFistRun()) {
R.id.sliderFragment
} else {
R.id.calculatorFragment
}
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class SettingsFragment : BaseVBFragment<FragmentSettingsBinding>() {
}
}.launchIn(viewLifecycleOwner.lifecycleScope)

@Suppress("ComplexMethod")
private fun observeEffects() = settingsViewModel.effect
.flowWithLifecycle(lifecycle)
.onEach { viewEffect ->
Expand Down Expand Up @@ -168,22 +169,10 @@ class SettingsFragment : BaseVBFragment<FragmentSettingsBinding>() {
)
SettingsEffect.ThemeDialog -> changeTheme()
is SettingsEffect.ChangeTheme -> updateAppTheme(viewEffect.themeValue)
SettingsEffect.Synchronising -> showSnack(
requireView(),
R.string.txt_synchronising
)
SettingsEffect.Synchronised -> showSnack(
requireView(),
R.string.txt_synced
)
SettingsEffect.OnlyOneTimeSync -> showSnack(
requireView(),
R.string.txt_already_synced
)
SettingsEffect.AlreadyAdFree -> showSnack(
requireView(),
R.string.txt_ads_already_disabled
)
SettingsEffect.Synchronising -> view?.showSnack(R.string.txt_synchronising)
SettingsEffect.Synchronised -> view?.showSnack(R.string.txt_synced)
SettingsEffect.OnlyOneTimeSync -> view?.showSnack(R.string.txt_already_synced)
SettingsEffect.AlreadyAdFree -> view?.showSnack(R.string.txt_ads_already_disabled)
SettingsEffect.OpenWatchers -> TODO("No Android implementation yet")
}
}.launchIn(viewLifecycleOwner.lifecycleScope)
Expand Down
56 changes: 24 additions & 32 deletions android/src/main/kotlin/com/oztechan/ccc/android/util/SnackBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,61 +13,53 @@ import com.google.android.material.snackbar.Snackbar
import mustafaozhan.github.com.mycurrencies.R

@Suppress("LongParameterList", "NestedBlockDepth")
fun showSnack(
view: View,
fun View?.showSnack(
text: String = "",
actionText: String = "",
icon: Int? = null,
isIndefinite: Boolean = false,
action: (() -> Unit)? = null
) = Snackbar.make(
view,
text,
if (isIndefinite) Snackbar.LENGTH_INDEFINITE else Snackbar.LENGTH_LONG
).apply {
setAction(actionText) {
Logger.i { "Snackbar action click" }
action?.invoke()
}
this.view.apply {
) = this?.let {
Snackbar.make(it, text, if (isIndefinite) Snackbar.LENGTH_INDEFINITE else Snackbar.LENGTH_LONG).apply {
setAction(actionText) {
Logger.i { "Snackbar action click" }
action?.invoke()
}
setBackgroundColor(ContextCompat.getColor(context, R.color.color_background_snack_bar))

findViewById<TextView>(R.id.snackbar_text)?.apply {
gravity = Gravity.CENTER

ContextCompat.getDrawable(context, icon ?: R.drawable.ic_dialog_and_snackbar)
?.apply {
setBounds(
0,
0,
resources.getDimensionPixelSize(R.dimen.snack_icon_size),
resources.getDimensionPixelSize(R.dimen.snack_icon_size)
)
}?.let {
setCompoundDrawables(it, null, null, null)
compoundDrawablePadding = resources.getDimensionPixelSize(R.dimen.margin_eight)
}
ContextCompat.getDrawable(context, icon ?: R.drawable.ic_dialog_and_snackbar)?.apply {
setBounds(
0,
0,
resources.getDimensionPixelSize(R.dimen.snack_icon_size),
resources.getDimensionPixelSize(R.dimen.snack_icon_size)
)
}?.let { drawable ->
setCompoundDrawables(drawable, null, null, null)
compoundDrawablePadding = resources.getDimensionPixelSize(R.dimen.margin_eight)
}
}

findViewById<TextView>(R.id.snackbar_action)?.apply {
setTypeface(null, Typeface.BOLD)
setTextColor(ContextCompat.getColor(context, R.color.color_text_action_snack_bar))
}
}
}.show()
}.show()
}

@Suppress("LongParameterList")
fun showSnack(
view: View,
fun View?.showSnack(
text: Int? = null,
actionText: Int? = null,
icon: Int? = null,
isIndefinite: Boolean = false,
action: (() -> Unit)? = null
) = showSnack(
view,
if (text == null) "" else view.context.getString(text),
if (actionText == null) "" else view.context.getString(actionText),
) = this?.showSnack(
if (text == null) "" else context.getString(text),
if (actionText == null) "" else context.getString(actionText),
icon,
isIndefinite,
action
Expand Down
Loading

0 comments on commit 0c741c7

Please sign in to comment.