-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/gradle/org.jetbrains.kotlinx-kotl…
…inx-serialization-json-1.6.0
- Loading branch information
Showing
23 changed files
with
308 additions
and
97 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<vector android:height="24dp" android:tint="#000000" | ||
android:viewportHeight="24" android:viewportWidth="24" | ||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillColor="@android:color/white" android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"/> | ||
</vector> |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
plugins { | ||
kotlin("multiplatform") | ||
} | ||
|
||
configureJvmTargets() | ||
|
||
kotlin { | ||
sourceSets { | ||
val commonMain by getting { | ||
dependencies { | ||
implementation(libs.koin.core) | ||
implementation(libs.kotlin.coroutines.core) | ||
} | ||
} | ||
if (isMac()) { | ||
val iosMain by getting | ||
} | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
core/event/src/commonMain/kotlin/br/alexandregpereira/hunter/event/Event.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,30 @@ | ||
package br.alexandregpereira.hunter.event | ||
|
||
import kotlinx.coroutines.channels.BufferOverflow | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.MutableSharedFlow | ||
|
||
interface EventDispatcher<Event> { | ||
|
||
fun dispatchEvent(event: Event) | ||
} | ||
|
||
interface EventListener<Event> { | ||
|
||
val events: Flow<Event> | ||
} | ||
|
||
interface EventManager<Event> : EventDispatcher<Event>, EventListener<Event> | ||
|
||
internal class DefaultEventManager<Event> : EventManager<Event> { | ||
|
||
private val _events: MutableSharedFlow<Event> = MutableSharedFlow( | ||
extraBufferCapacity = 1, | ||
onBufferOverflow = BufferOverflow.DROP_OLDEST | ||
) | ||
override val events: Flow<Event> = _events | ||
|
||
override fun dispatchEvent(event: Event) { | ||
_events.tryEmit(event) | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...event/src/commonMain/kotlin/br/alexandregpereira/hunter/event/systembar/BottomBarEvent.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,22 @@ | ||
package br.alexandregpereira.hunter.event.systembar | ||
|
||
import br.alexandregpereira.hunter.event.DefaultEventManager | ||
import br.alexandregpereira.hunter.event.EventDispatcher | ||
import br.alexandregpereira.hunter.event.EventManager | ||
|
||
class BottomBarEventManager : EventManager<BottomBarEvent> by DefaultEventManager() | ||
|
||
sealed class BottomBarEvent { | ||
|
||
data class AddTopContent(val topContentId: String) : BottomBarEvent() | ||
|
||
data class RemoveTopContent(val topContentId: String) : BottomBarEvent() | ||
} | ||
|
||
fun EventDispatcher<BottomBarEvent>.dispatchAddTopContentEvent(topContentId: String) { | ||
dispatchEvent(BottomBarEvent.AddTopContent(topContentId)) | ||
} | ||
|
||
fun EventDispatcher<BottomBarEvent>.dispatchRemoveTopContentEvent(topContentId: String) { | ||
dispatchEvent(BottomBarEvent.RemoveTopContent(topContentId)) | ||
} |
15 changes: 15 additions & 0 deletions
15
...src/commonMain/kotlin/br/alexandregpereira/hunter/event/systembar/BottomBarEventModule.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,15 @@ | ||
package br.alexandregpereira.hunter.event.systembar | ||
|
||
import br.alexandregpereira.hunter.event.EventDispatcher | ||
import br.alexandregpereira.hunter.event.EventListener | ||
import org.koin.dsl.module | ||
|
||
val bottomBarEventModule = module { | ||
single { BottomBarEventManager() } | ||
factory<EventDispatcher<BottomBarEvent>> { | ||
get<BottomBarEventManager>() | ||
} | ||
factory<EventListener<BottomBarEvent>> { | ||
get<BottomBarEventManager>() | ||
} | ||
} |
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.