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 Jan 24, 2022
2 parents 2b1b5fe + 205a318 commit 4c8e67f
Show file tree
Hide file tree
Showing 98 changed files with 2,147 additions and 1,061 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/board.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ jobs:
resource_node_id: ${{ github.event.issue.node_id }}
status_value: "✅ Done"

- name: 'Move PR to "🙇 In Progress"'
- name: 'Move PR to "🚧 In Progress"'
if: github.event_name == 'pull_request' && github.event.action == 'converted_to_draft'
uses: leonsteinhaeuser/[email protected]
with:
gh_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
organization: Oztechan
project_id: 2
resource_node_id: ${{ github.event.pull_request.node_id }}
status_value: "🙇 In Progress"
status_value: "🚧 In Progress"

- name: 'Move PR to "🏗 PR Review"'
if: github.event_name == 'pull_request' && github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'review_requested'
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
- develop
pull_request:

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

env:
ANDROID_RELEASE_ADMOB_APP_ID: ${{ secrets.ANDROID_RELEASE_ADMOB_APP_ID }}
ANDROID_RELEASE_BANNER_AD_UNIT_ID_CALCULATOR: ${{ secrets.ANDROID_RELEASE_BANNER_AD_UNIT_ID_CALCULATOR }}
Expand Down Expand Up @@ -66,13 +70,13 @@ jobs:
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ad/build/reports/kover/report.xml,analytics/build/reports/kover/report.xml,android/build/reports/kover/report.xml,backend/build/reports/kover/report.xml,basemob/basemob/build/reports/kover/report.xml,billing/build/reports/kover/report.xml,client/build/reports/kover/report.xml,common/build/reports/kover/report.xml,logmob/logmob/build/reports/kover/report.xml,parsermob/parsermob/build/reports/kover/report.xml,scopemob/scopemob/build/reports/kover/report.xml
files: ad/build/reports/kover/report.xml,analytics/build/reports/kover/report.xml,config/build/reports/kover/report.xml,android/build/reports/kover/report.xml,backend/build/reports/kover/report.xml,basemob/basemob/build/reports/kover/report.xml,billing/build/reports/kover/report.xml,client/build/reports/kover/report.xml,common/build/reports/kover/report.xml,logmob/logmob/build/reports/kover/report.xml,parsermob/parsermob/build/reports/kover/report.xml,scopemob/scopemob/build/reports/kover/report.xml

- name: Upload to Codacy
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ad/build/reports/kover/report.xml,analytics/build/reports/kover/report.xml,android/build/reports/kover/report.xml,backend/build/reports/kover/report.xml,basemob/basemob/build/reports/kover/report.xml,billing/build/reports/kover/report.xml,client/build/reports/kover/report.xml,common/build/reports/kover/report.xml,logmob/logmob/build/reports/kover/report.xml,parsermob/parsermob/build/reports/kover/report.xml,scopemob/scopemob/build/reports/kover/report.xml
coverage-reports: ad/build/reports/kover/report.xml,analytics/build/reports/kover/report.xml,config/build/reports/kover/report.xml,android/build/reports/kover/report.xml,backend/build/reports/kover/report.xml,basemob/basemob/build/reports/kover/report.xml,billing/build/reports/kover/report.xml,client/build/reports/kover/report.xml,common/build/reports/kover/report.xml,logmob/logmob/build/reports/kover/report.xml,parsermob/parsermob/build/reports/kover/report.xml,scopemob/scopemob/build/reports/kover/report.xml

- name: Set Job Status
id: status
Expand Down
24 changes: 19 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
<h1 align="center">Currency Converter & Calculator</h1>
<p align="center">A currency converter application for most of the currencies used in the world.</p>
<p align="center">You can quickly convert and make mathematical operations between currencies.</p>
<p align="center"><a href="https://play.google.com/store/apps/details?id=mustafaozhan.github.com.mycurrencies"><img src="https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png" width="300px"></a></p>
<p align="center"><a href="https://www.codacy.com/gh/Oztechan/CCC/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=CurrencyConverterCalculator/CCC&amp;utm_campaign=Badge_Grade"><img src="https://app.codacy.com/project/badge/Grade/2196f4447c32431b80d582a21ad749db"/></a> <a href="https://codecov.io/gh/Oztechan/CCC"><img src="https://codecov.io/gh/Oztechan/CCC/branch/develop/graph/badge.svg?token=Lenq2MZgM7"/></a> <img src="https://github.com/CurrencyConverterCalculator/CCC/workflows/CCC%20CI/badge.svg"> <img src="https://img.shields.io/github/last-commit/CurrencyConverterCalculator/CCC.svg"> <img src="https://img.shields.io/github/issues/CurrencyConverterCalculator/CCC.svg"> <img src="https://img.shields.io/github/issues-closed/CurrencyConverterCalculator/CCC.svg">
<p align="center"><a href='https://ko-fi.com/B0B2TZMH' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi1.png?v=2' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a></p>

<div align="center">

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://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png" width="250px"></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>
<a href="https://www.codacy.com/gh/Oztechan/CCC/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=CurrencyConverterCalculator/CCC&amp;utm_campaign=Badge_Grade"><img src="https://app.codacy.com/project/badge/Grade/2196f4447c32431b80d582a21ad749db"/></a>
<a href="https://codecov.io/gh/Oztechan/CCC"><img src="https://codecov.io/gh/Oztechan/CCC/branch/develop/graph/badge.svg?token=Lenq2MZgM7"/></a>
<a href="https://www.codacy.com/gh/Oztechan/CCC/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=CurrencyConverterCalculator/CCC&amp;utm_campaign=Badge_Coverage"><img src="https://app.codacy.com/project/badge/Coverage/2196f4447c32431b80d582a21ad749db"/></a>

<a href="https://github.com/Oztechan/CCC/commits/develop"><img src="https://img.shields.io/github/last-commit/Oztechan/CCC?label=Last%20commit&color=blue"></a>
<a href="https://github.com/Oztechan/CCC/pulls?q=is%3Apr+is%3Aopen"><img src="https://img.shields.io/github/issues-pr-raw/Oztechan/CCC?label=Open%20PR&color=green0light"></a>
<a href="https://github.com/Oztechan/CCC/pulls?q=is%3Apr+is%3Aclosed"><img src="https://img.shields.io/github/issues-pr-closed-raw/Oztechan/CCC?label=Closed%20PR&color=white"></a>
<a href="https://github.com/Oztechan/CCC/issues?q=is%3Aopen"><img src="https://img.shields.io/github/issues-raw/Oztechan/CCC?label=Open%20Issue&color=green-light"></a>
<a href="https://github.com/Oztechan/CCC/issues?q=is%3Aclosed"><img src="https://img.shields.io/github/issues-closed-raw/Oztechan/CCC?label=Closed%20Issue&color=white"></a>

<a href='https://ko-fi.com/B0B2TZMH' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi1.png?v=2' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>

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
Expand Down
11 changes: 9 additions & 2 deletions ad/src/google/java/com/github/mustafaozhan/ad/AdManagerImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.github.mustafaozhan.ad
import android.app.Activity
import android.content.Context
import co.touchlab.kermit.Logger
import com.google.android.gms.ads.AdListener
import com.google.android.gms.ads.AdRequest
import com.google.android.gms.ads.AdSize
import com.google.android.gms.ads.AdView
Expand All @@ -24,9 +25,9 @@ class AdManagerImpl : AdManager {
override fun getBannerAd(
context: Context,
width: Int,
adId: String
adId: String,
onAdLoaded: (Int?) -> Unit
) = AdView(context).apply {
MobileAds.initialize(context)
Logger.i { "AdManagerImpl getBannerAd" }

val adWidthPixels = if (width == 0) {
Expand All @@ -40,6 +41,12 @@ class AdManagerImpl : AdManager {
(adWidthPixels / resources.displayMetrics.density).toInt()
)
adUnitId = adId
adListener = object : AdListener() {
override fun onAdLoaded() {
super.onAdLoaded()
onAdLoaded(adSize?.height?.times(resources.displayMetrics.density)?.toInt())
}
}
loadAd(getAdRequest())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class AdManagerImpl : AdManager {
override fun getBannerAd(
context: Context,
width: Int,
adId: String
adId: String,
onAdLoaded: (Int?) -> Unit
): ViewGroup {
Logger.i { "AdManagerImpl getBannerAd" }
return FrameLayout(context)
Expand Down
3 changes: 2 additions & 1 deletion ad/src/main/java/com/github/mustafaozhan/ad/AdManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ interface AdManager {
fun getBannerAd(
context: Context,
width: Int,
adId: String
adId: String,
onAdLoaded: (Int?) -> Unit
): ViewGroup

fun showInterstitialAd(
Expand Down
1 change: 1 addition & 0 deletions android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ dependencies {

with(Dependencies.Modules) {
implementation(project(CLIENT))
implementation(project(CONFIG))

implementation(project(BASE_MOB))
implementation(project(SCOPE_MOB))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,53 @@
package com.github.mustafaozhan.ccc.android.app

import android.app.Application
import android.os.Build
import android.os.StrictMode
import android.os.StrictMode.ThreadPolicy
import android.os.StrictMode.VmPolicy
import co.touchlab.kermit.Logger
import com.github.mustafaozhan.ad.initAds
import com.github.mustafaozhan.ccc.android.di.platformModule
import com.github.mustafaozhan.ccc.client.di.initAndroid
import com.github.mustafaozhan.config.RemoteConfig
import com.github.mustafaozhan.logmob.ANRWatchDogHandler
import com.github.mustafaozhan.logmob.initCrashlytics
import com.github.mustafaozhan.logmob.initLogger
import com.mustafaozhan.github.analytics.initAnalytics
import mustafaozhan.github.com.mycurrencies.BuildConfig
import org.koin.android.ext.android.inject

@Suppress("unused")
class CCCApplication : Application() {

private val remoteConfig: RemoteConfig by inject()

override fun onCreate() {
super.onCreate()

if (BuildConfig.DEBUG) {
enableStrictMode()
}

initLogger().let {
it.i { "Logger initialized" }
}
initLogger()

Logger.i { "CCCApplication onCreate" }

if (!BuildConfig.DEBUG) {
initAnalytics(this)
}

initCrashlytics(
enableAnrWatchDog = Build.VERSION.SDK_INT < Build.VERSION_CODES.R
)
initCrashlytics()

initAds(this)

initAndroid(
context = this,
platformModule = platformModule
)

Thread.setDefaultUncaughtExceptionHandler(
ANRWatchDogHandler(remoteConfig.appConfig.timeOutANRWatchDog)
)
}

private fun enableStrictMode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ class AdRemoveBottomSheet : BaseVBBottomSheetDialogFragment<BottomSheetAdRemoveB
private val billingManager: BillingManager by inject()
private val adRemoveViewModel: AdRemoveViewModel by viewModel()

private lateinit var removeAdsAdapter: RemoveAdsAdapter
private val removeAdsAdapter: RemoveAdsAdapter by lazy {
RemoveAdsAdapter(adRemoveViewModel.event)
}

override fun getViewBinding() = BottomSheetAdRemoveBinding.inflate(layoutInflater)

Expand Down Expand Up @@ -67,7 +69,6 @@ class AdRemoveBottomSheet : BaseVBBottomSheetDialogFragment<BottomSheetAdRemoveB
}

private fun initViews() {
removeAdsAdapter = RemoveAdsAdapter(adRemoveViewModel.event)
binding.recyclerViewRemoveAds.adapter = removeAdsAdapter
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ class CalculatorFragment : BaseVBFragment<FragmentCalculatorBinding>() {
private val adManager: AdManager by inject()
private val calculatorViewModel: CalculatorViewModel by viewModel()

private lateinit var calculatorAdapter: CalculatorAdapter
private val calculatorAdapter: CalculatorAdapter by lazy {
CalculatorAdapter(calculatorViewModel.event, analyticsManager)
}

override fun getViewBinding() = FragmentCalculatorBinding.inflate(layoutInflater)

Expand Down Expand Up @@ -70,11 +72,23 @@ class CalculatorFragment : BaseVBFragment<FragmentCalculatorBinding>() {
super.onPause()
}

private fun trackUserProperties() {
private fun trackUserProperties() = with(calculatorViewModel.state.value) {
analyticsManager.setUserProperty(
UserProperty.BASE_CURRENCY,
calculatorViewModel.state.value.base
base
)

currencyList.filter { it.isActive }
.run {
analyticsManager.setUserProperty(
UserProperty.CURRENCY_COUNT,
this.count().toString()
)
analyticsManager.setUserProperty(
UserProperty.ACTIVE_CURRENCIES,
this.joinToString(",") { currency -> currency.name }
)
}
}

private fun observeNavigationResults() = getNavigationResult<String>(CHANGE_BASE_EVENT)
Expand All @@ -87,9 +101,8 @@ class CalculatorFragment : BaseVBFragment<FragmentCalculatorBinding>() {
adViewContainer.setBannerAd(
adManager = adManager,
adId = getString(R.string.android_banner_ad_unit_id_calculator),
isExpired = calculatorViewModel.isRewardExpired()
shouldShowAd = calculatorViewModel.shouldShowBannerAd()
)
calculatorAdapter = CalculatorAdapter(calculatorViewModel.event, analyticsManager)
recyclerViewMain.adapter = calculatorAdapter
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ class ChangeBaseBottomSheet : BaseVBBottomSheetDialogFragment<BottomSheetChangeB
private val analyticsManager: AnalyticsManager by inject()
private val changeBaseViewModel: ChangeBaseViewModel by viewModel()

private lateinit var changeBaseAdapter: ChangeBaseAdapter
private val changeBaseAdapter: ChangeBaseAdapter by lazy {
ChangeBaseAdapter(changeBaseViewModel.event)
}

override fun getViewBinding() = BottomSheetChangeBaseBinding.inflate(layoutInflater)

Expand All @@ -55,7 +57,6 @@ class ChangeBaseBottomSheet : BaseVBBottomSheetDialogFragment<BottomSheetChangeB
}

private fun initViews() {
changeBaseAdapter = ChangeBaseAdapter(changeBaseViewModel.event)
binding.recyclerViewChangeBase.adapter = changeBaseAdapter
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ class CurrenciesFragment : BaseVBFragment<FragmentCurrenciesBinding>() {
private val adManager: AdManager by inject()
private val currenciesViewModel: CurrenciesViewModel by viewModel()

private lateinit var currenciesAdapter: CurrenciesAdapter
private val currenciesAdapter: CurrenciesAdapter by lazy {
CurrenciesAdapter(currenciesViewModel.event)
}

override fun getViewBinding() = FragmentCurrenciesBinding.inflate(layoutInflater)

Expand Down Expand Up @@ -86,9 +88,9 @@ class CurrenciesFragment : BaseVBFragment<FragmentCurrenciesBinding>() {
adViewContainer.setBannerAd(
adManager = adManager,
adId = getString(R.string.android_banner_ad_unit_id_currencies),
isExpired = currenciesViewModel.isRewardExpired()
shouldShowAd = currenciesViewModel.shouldShowBannerAd()
)
currenciesAdapter = CurrenciesAdapter(currenciesViewModel.event)

setSpanByOrientation(resources.configuration.orientation)

with(recyclerViewCurrencies) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package com.github.mustafaozhan.ccc.android.ui.main

import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.Build
import android.os.Bundle
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
Expand All @@ -12,6 +14,7 @@ import androidx.lifecycle.lifecycleScope
import co.touchlab.kermit.Logger
import com.github.mustafaozhan.ad.AdManager
import com.github.mustafaozhan.basemob.activity.BaseActivity
import com.github.mustafaozhan.ccc.android.util.showDialog
import com.github.mustafaozhan.ccc.android.util.updateAppTheme
import com.github.mustafaozhan.ccc.android.util.updateBaseContextLocale
import com.github.mustafaozhan.ccc.client.model.AppTheme
Expand Down Expand Up @@ -48,14 +51,25 @@ class MainActivity : BaseActivity() {
.onEach { viewEffect ->
Logger.i { "MainActivity observeEffects ${viewEffect::class.simpleName}" }
when (viewEffect) {
is MainEffect.ShowInterstitialAd -> adManager.showInterstitialAd(
MainEffect.ShowInterstitialAd -> adManager.showInterstitialAd(
this@MainActivity,
getString(R.string.android_interstitial_ad_id)
)
is MainEffect.RequestReview -> requestReview()
MainEffect.RequestReview -> requestReview()
is MainEffect.AppUpdateEffect -> showAppUpdateDialog(viewEffect.isCancelable)
}
}.launchIn(lifecycleScope)

private fun showAppUpdateDialog(isCancelable: Boolean) = showDialog(
activity = this,
title = R.string.txt_update_dialog_title,
message = R.string.txt_update_dialog_description,
positiveButton = R.string.update,
cancelable = isCancelable
) {
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.app_market_link))))
}

private fun requestReview() = ReviewManagerFactory.create(this@MainActivity)
.apply {
requestReviewFlow().addOnCompleteListener { request ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class SettingsFragment : BaseVBFragment<FragmentSettingsBinding>() {
adViewContainer.setBannerAd(
adManager = adManager,
adId = getString(R.string.android_banner_ad_unit_id_settings),
isExpired = settingsViewModel.isRewardExpired()
shouldShowAd = settingsViewModel.shouldShowBannerAd()
)
with(itemCurrencies) {
imgSettingsItem.setBackgroundResource(R.drawable.ic_currency)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ fun showDialog(
function?.invoke()
dialog.dismiss()
}
?.setCancelable(cancelable)
?.inCase(cancelable) {
setCancelable(cancelable)
setNegativeButton(activity.getString(android.R.string.cancel), null)
}?.show()

Expand Down
Loading

0 comments on commit 4c8e67f

Please sign in to comment.