-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop'
- Loading branch information
Showing
58 changed files
with
168 additions
and
437 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,7 +163,7 @@ jobs: | |
with: | ||
client-id: ${{secrets.HUAWEI_CLIENT_ID}} | ||
client-key: ${{secrets.HUAWEI_CLIENT_KEY}} | ||
app-id: "104920917" | ||
app-id: ${{secrets.HUAWEI_APP_ID}} | ||
file-extension: "aab" | ||
file-path: "app-huawei-release.aab" | ||
file-name: "app-huawei-release" | ||
|
@@ -191,7 +191,7 @@ jobs: | |
path: artifact | ||
|
||
- name: Deploy to Server | ||
uses: easingthemes/[email protected].9 | ||
uses: easingthemes/[email protected].10 | ||
env: | ||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | ||
REMOTE_HOST: ${{ secrets.REMOTE_HOST }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 10 additions & 47 deletions
57
...oller/sync/src/main/kotlin/com/oztechan/ccc/backend/controller/sync/SyncControllerImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,43 @@ | ||
package com.oztechan.ccc.backend.controller.sync | ||
|
||
import co.touchlab.kermit.Logger | ||
import com.oztechan.ccc.backend.service.free.FreeApiService | ||
import com.oztechan.ccc.backend.service.premium.PremiumApiService | ||
import com.oztechan.ccc.common.core.model.Conversion | ||
import com.oztechan.ccc.common.core.model.CurrencyType | ||
import com.oztechan.ccc.common.datasource.conversion.ConversionDataSource | ||
import kotlinx.coroutines.delay | ||
import kotlin.time.Duration.Companion.seconds | ||
|
||
internal class SyncControllerImpl( | ||
private val premiumApiService: PremiumApiService, | ||
private val freeApiService: FreeApiService, | ||
private val conversionDataSource: ConversionDataSource | ||
) : SyncController { | ||
|
||
override suspend fun syncPrimaryCurrencies() { | ||
Logger.v { "SyncControllerImpl syncPrimaryCurrencies" } | ||
CurrencyType.getPrimaryCurrencies().syncCrossAPI() | ||
CurrencyType.getPrimaryCurrencies().syncCurrencies() | ||
} | ||
|
||
override suspend fun syncSecondaryCurrencies() { | ||
Logger.v { "SyncControllerImpl syncSecondaryCurrencies" } | ||
CurrencyType.getSecondaryCurrencies().syncCrossAPI() | ||
CurrencyType.getSecondaryCurrencies().syncCurrencies() | ||
} | ||
|
||
override suspend fun syncTertiaryCurrencies() { | ||
Logger.v { "SyncControllerImpl syncTertiaryCurrencies" } | ||
CurrencyType.getTertiaryCurrencies().syncCrossAPI() | ||
} | ||
|
||
private suspend fun List<CurrencyType>.syncCrossAPI() = forEach { currencyType -> | ||
|
||
delay(1.seconds.inWholeMilliseconds) | ||
|
||
// non premium call for filling null values | ||
runCatching { freeApiService.getConversion(currencyType.name) } | ||
.onFailure { Logger.w(it) { it.message.toString() } } | ||
.onSuccess { freeConversion -> | ||
|
||
// premium api call | ||
runCatching { premiumApiService.getConversion(currencyType.name) } | ||
.onFailure { Logger.w(it) { it.message.toString() } } | ||
.onSuccess { premiumConversion -> | ||
conversionDataSource.insertConversion( | ||
premiumConversion.fillMissingRatesWith(freeConversion) | ||
) | ||
} | ||
} | ||
CurrencyType.getTertiaryCurrencies().syncCurrencies() | ||
} | ||
|
||
override suspend fun syncUnPopularCurrencies() { | ||
Logger.v { "SyncControllerImpl syncUnPopularCurrencies" } | ||
CurrencyType.getNonPopularCurrencies().syncCurrencies() | ||
} | ||
|
||
CurrencyType.getNonPopularCurrencies().forEach { currencyType -> | ||
|
||
delay(1.seconds.inWholeMilliseconds) | ||
private suspend fun List<CurrencyType>.syncCurrencies() = forEach { currencyType -> | ||
|
||
runCatching { freeApiService.getConversion(currencyType.name) } | ||
.onFailure { Logger.w(it) { it.message.toString() } } | ||
.onSuccess { conversionDataSource.insertConversion(it) } | ||
} | ||
} | ||
delay(1.seconds.inWholeMilliseconds) | ||
|
||
// unsupported currencies by premium API | ||
private fun Conversion.fillMissingRatesWith(freeConversion: Conversion) = apply { | ||
btc = freeConversion.btc | ||
clf = freeConversion.clf | ||
cnh = freeConversion.cnh | ||
kpw = freeConversion.kpw | ||
mro = freeConversion.mro | ||
std = freeConversion.std | ||
svc = freeConversion.svc | ||
xag = freeConversion.xag | ||
xau = freeConversion.xau | ||
xpd = freeConversion.xpd | ||
xpt = freeConversion.xpt | ||
runCatching { premiumApiService.getConversion(currencyType.name) } | ||
.onFailure { Logger.w(it) { it.message.toString() } } | ||
.onSuccess { conversionDataSource.insertConversion(it) } | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
backend/service/free/src/main/kotlin/com/oztechan/ccc/backend/service/free/FreeApiService.kt
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
.../service/free/src/main/kotlin/com/oztechan/ccc/backend/service/free/FreeApiServiceImpl.kt
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
...free/src/main/kotlin/com/oztechan/ccc/backend/service/free/di/BackendServiceFreeModule.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.