-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ALTAPPS-590: Fix topic progress doesn't change on home screen without…
… screen refreshing
- Loading branch information
1 parent
27dcaa7
commit 4bbb741
Showing
16 changed files
with
149 additions
and
6 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
17 changes: 17 additions & 0 deletions
17
...ed/src/commonMain/kotlin/org/hyperskill/app/progresses/data/flow/TopicProgressFlowImpl.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 org.hyperskill.app.progresses.data.flow | ||
|
||
import kotlinx.coroutines.flow.MutableSharedFlow | ||
import kotlinx.coroutines.flow.SharedFlow | ||
import org.hyperskill.app.progresses.domain.flow.TopicProgressFlow | ||
import org.hyperskill.app.topics.domain.model.TopicProgress | ||
|
||
class TopicProgressFlowImpl : TopicProgressFlow { | ||
private val topicProgressMutableSharedFlow = MutableSharedFlow<TopicProgress>() | ||
|
||
override fun observe(): SharedFlow<TopicProgress> = | ||
topicProgressMutableSharedFlow | ||
|
||
override suspend fun notifyDataChanged(data: TopicProgress) { | ||
topicProgressMutableSharedFlow.emit(data) | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
shared/src/commonMain/kotlin/org/hyperskill/app/progresses/domain/flow/TopicProgressFlow.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,6 @@ | ||
package org.hyperskill.app.progresses.domain.flow | ||
|
||
import org.hyperskill.app.core.domain.flow.SharedDataFlow | ||
import org.hyperskill.app.topics.domain.model.TopicProgress | ||
|
||
interface TopicProgressFlow : SharedDataFlow<TopicProgress> |
7 changes: 7 additions & 0 deletions
7
.../commonMain/kotlin/org/hyperskill/app/progresses/injection/ProgressesFlowDataComponent.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,7 @@ | ||
package org.hyperskill.app.progresses.injection | ||
|
||
import org.hyperskill.app.progresses.domain.flow.TopicProgressFlow | ||
|
||
interface ProgressesFlowDataComponent { | ||
val topicProgressFlow: TopicProgressFlow | ||
} |
8 changes: 8 additions & 0 deletions
8
...monMain/kotlin/org/hyperskill/app/progresses/injection/ProgressesFlowDataComponentImpl.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,8 @@ | ||
package org.hyperskill.app.progresses.injection | ||
|
||
import org.hyperskill.app.progresses.data.flow.TopicProgressFlowImpl | ||
import org.hyperskill.app.progresses.domain.flow.TopicProgressFlow | ||
|
||
class ProgressesFlowDataComponentImpl : ProgressesFlowDataComponent { | ||
override val topicProgressFlow: TopicProgressFlow = TopicProgressFlowImpl() | ||
} |
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: 57 additions & 0 deletions
57
shared/src/commonTest/kotlin/org/hyperskill/TopicProgressTest.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,57 @@ | ||
package org.hyperskill | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
import org.hyperskill.app.topics.domain.model.TopicProgress | ||
import org.hyperskill.app.topics.domain.model.topicId | ||
|
||
class TopicProgressTest { | ||
@Test | ||
fun testTopicProgressGetTopicId() { | ||
val topicProgress = TopicProgress( | ||
id = "2-123", | ||
vid = "topic-123", | ||
isCompleted = false, | ||
isSkipped = false, | ||
isInCurrentTrack = true | ||
) | ||
assertEquals(123L, topicProgress.topicId) | ||
} | ||
|
||
@Test | ||
fun testTopicProgressGetTopicIdNull() { | ||
val topicProgresses = listOf( | ||
TopicProgress( | ||
id = "2-abc", | ||
vid = "topic-abc", | ||
isCompleted = false, | ||
isSkipped = false, | ||
isInCurrentTrack = true | ||
), | ||
TopicProgress( | ||
id = "2-abc", | ||
vid = "abc-defog", | ||
isCompleted = false, | ||
isSkipped = false, | ||
isInCurrentTrack = true | ||
), | ||
TopicProgress( | ||
id = "1-abc", | ||
vid = "", | ||
isCompleted = false, | ||
isSkipped = false, | ||
isInCurrentTrack = true | ||
), | ||
TopicProgress( | ||
id = "1-abc", | ||
vid = "qwerty", | ||
isCompleted = false, | ||
isSkipped = false, | ||
isInCurrentTrack = true | ||
) | ||
) | ||
topicProgresses.forEach { | ||
assertEquals(null, it.topicId) | ||
} | ||
} | ||
} |
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