-
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
76 changed files
with
1,287 additions
and
168 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
addAssignees: author |
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 |
---|---|---|
|
@@ -48,17 +48,7 @@ jobs: | |
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') | ||
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: "🏗 PR Review" | ||
|
||
- name: 'Move PR to "🏗 PR Review"' | ||
if: github.event_name == 'pull_request' && github.event.action == 'ready_for_review' | ||
if: github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'ready_for_review') | ||
uses: leonsteinhaeuser/[email protected] | ||
with: | ||
gh_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | ||
|
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
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
11 changes: 8 additions & 3 deletions
11
client/src/commonMain/kotlin/com/oztechan/ccc/client/di/module/ClientModule.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,26 +1,31 @@ | ||
package com.oztechan.ccc.client.di.module | ||
|
||
import com.oztechan.ccc.client.di.viewModelDefinition | ||
import com.oztechan.ccc.client.helper.SessionManager | ||
import com.oztechan.ccc.client.helper.SessionManagerImpl | ||
import com.oztechan.ccc.client.manager.background.BackgroundManager | ||
import com.oztechan.ccc.client.manager.background.BackgroundManagerImpl | ||
import com.oztechan.ccc.client.manager.session.SessionManager | ||
import com.oztechan.ccc.client.manager.session.SessionManagerImpl | ||
import com.oztechan.ccc.client.viewmodel.adremove.AdRemoveViewModel | ||
import com.oztechan.ccc.client.viewmodel.calculator.CalculatorViewModel | ||
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.client.viewmodel.watchers.WatchersViewModel | ||
import com.oztechan.ccc.config.ConfigManager | ||
import com.oztechan.ccc.config.ConfigManagerImpl | ||
import org.koin.dsl.module | ||
|
||
var clientModule = module { | ||
viewModelDefinition { SettingsViewModel(get(), get(), get(), get(), get()) } | ||
viewModelDefinition { SettingsViewModel(get(), get(), get(), get(), get(), get()) } | ||
viewModelDefinition { MainViewModel(get(), get(), get()) } | ||
viewModelDefinition { CurrenciesViewModel(get(), get(), get()) } | ||
viewModelDefinition { CalculatorViewModel(get(), get(), get(), get(), get()) } | ||
viewModelDefinition { SelectCurrencyViewModel(get()) } | ||
viewModelDefinition { AdRemoveViewModel(get()) } | ||
viewModelDefinition { WatchersViewModel(get(), get()) } | ||
|
||
single<ConfigManager> { ConfigManagerImpl() } | ||
single<SessionManager> { SessionManagerImpl(get(), get()) } | ||
single<BackgroundManager> { BackgroundManagerImpl(get(), get()) } | ||
} |
5 changes: 5 additions & 0 deletions
5
client/src/commonMain/kotlin/com/oztechan/ccc/client/manager/background/BackgroundManager.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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.oztechan.ccc.client.manager.background | ||
|
||
interface BackgroundManager { | ||
fun shouldSendNotification(): Boolean | ||
} |
41 changes: 41 additions & 0 deletions
41
...src/commonMain/kotlin/com/oztechan/ccc/client/manager/background/BackgroundManagerImpl.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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.oztechan.ccc.client.manager.background | ||
|
||
import co.touchlab.kermit.Logger | ||
import com.oztechan.ccc.client.util.getConversionByName | ||
import com.oztechan.ccc.common.api.repo.ApiRepository | ||
import com.oztechan.ccc.common.db.watcher.WatcherRepository | ||
import kotlinx.coroutines.runBlocking | ||
|
||
class BackgroundManagerImpl( | ||
private val watchersRepository: WatcherRepository, | ||
private val apiRepository: ApiRepository | ||
) : BackgroundManager { | ||
|
||
init { | ||
Logger.d { "BackgroundManagerImpl init" } | ||
} | ||
|
||
@Suppress("LabeledExpression", "TooGenericExceptionCaught") | ||
override fun shouldSendNotification() = try { | ||
Logger.d { "BackgroundManagerImpl shouldSendNotification" } | ||
|
||
runBlocking { | ||
watchersRepository.getWatchers().forEach { watcher -> | ||
apiRepository | ||
.getRatesByBackend(watcher.base) | ||
.rates | ||
.getConversionByName(watcher.target) | ||
?.let { conversionRate -> | ||
when { | ||
watcher.isGreater && conversionRate > watcher.rate -> return@runBlocking true | ||
!watcher.isGreater && conversionRate < watcher.rate -> return@runBlocking true | ||
} | ||
} | ||
} | ||
return@runBlocking false | ||
} | ||
} catch (e: Exception) { | ||
Logger.w { "BackgroundManagerImpl shouldSendNotification error: $e" } | ||
false | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...echan/ccc/client/helper/SessionManager.kt → .../client/manager/session/SessionManager.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
2 changes: 1 addition & 1 deletion
2
...n/ccc/client/helper/SessionManagerImpl.kt → ...ent/manager/session/SessionManagerImpl.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
17 changes: 17 additions & 0 deletions
17
client/src/commonMain/kotlin/com/oztechan/ccc/client/mapper/Notification.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.oztechan.ccc.client.mapper | ||
|
||
import com.oztechan.ccc.client.util.removeScientificNotation | ||
import com.oztechan.ccc.common.model.Watcher | ||
import com.oztechan.ccc.client.model.Watcher as WatcherUIModel | ||
|
||
fun Watcher.toUIModel() = WatcherUIModel( | ||
id = id, | ||
base = base, | ||
target = target, | ||
isGreater = isGreater, | ||
rate = rate.removeScientificNotation() | ||
) | ||
|
||
fun List<Watcher>.toUIModelList() = map { | ||
it.toUIModel() | ||
} |
9 changes: 9 additions & 0 deletions
9
client/src/commonMain/kotlin/com/oztechan/ccc/client/model/Watcher.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.oztechan.ccc.client.model | ||
|
||
data class Watcher( | ||
val id: Long, | ||
val base: String, | ||
val target: String, | ||
val isGreater: Boolean, | ||
val rate: String | ||
) |
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
Oops, something went wrong.