Skip to content

Commit 0870c8e

Browse files
authored
Merge pull request #901 from tunjid/bugfix/1.3.5
Bugfix/1.3.5
2 parents e77a3f7 + 60db282 commit 0870c8e

File tree

21 files changed

+196
-187
lines changed

21 files changed

+196
-187
lines changed

composeApp/src/androidMain/kotlin/com/tunjid/heron/Platform.android.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ fun createAppState(context: Context): AppState =
4848
logger = {
4949
AndroidLogger(context)
5050
},
51-
videoPlayerController = { appScope ->
51+
videoPlayerController = { appMainScope ->
5252
ExoplayerController(
5353
context = context,
54-
scope = appScope,
54+
scope = appMainScope,
5555
diffingDispatcher = Dispatchers.Default,
5656
)
5757
},
58-
args = { appScope ->
58+
args = { appMainScope ->
5959
DataBindingArgs(
60-
appScope = appScope,
60+
appMainScope = appMainScope,
6161
connectivity = Connectivity(),
6262
savedStatePath = context.savedStatePath(),
6363
savedStateFileSystem = FileSystem.SYSTEM,

composeApp/src/androidMain/res/animator/splash_heron_body_animation.xml

Lines changed: 0 additions & 25 deletions
This file was deleted.

composeApp/src/androidMain/res/animator/splash_heron_head_animation.xml

Lines changed: 0 additions & 24 deletions
This file was deleted.

composeApp/src/androidMain/res/drawable/ic_splash_icon.xml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,4 @@
33
android:width="288dp"
44
android:height="288dp"
55
android:viewportWidth="35"
6-
android:viewportHeight="48">
7-
<target
8-
android:name="head"
9-
android:animation="@animator/splash_heron_head_animation" />
10-
<target
11-
android:name="beak"
12-
android:animation="@animator/splash_heron_body_animation" />
13-
<target
14-
android:name="torso"
15-
android:animation="@animator/splash_heron_body_animation" />
16-
<target
17-
android:name="feet"
18-
android:animation="@animator/splash_heron_body_animation" />
19-
</animated-vector>
6+
android:viewportHeight="48"/>

composeApp/src/commonMain/kotlin/com/tunjid/heron/Platform.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,14 @@ expect fun getPlatform(): Platform
8181

8282
fun createAppState(
8383
imageLoader: () -> ImageLoader,
84-
notifier: (appScope: CoroutineScope) -> Notifier,
84+
notifier: (appMainScope: CoroutineScope) -> Notifier,
8585
logger: () -> Logger,
86-
videoPlayerController: (appScope: CoroutineScope) -> VideoPlayerController,
87-
args: (appScope: CoroutineScope) -> DataBindingArgs,
86+
videoPlayerController: (appMainScope: CoroutineScope) -> VideoPlayerController,
87+
args: (appMainScope: CoroutineScope) -> DataBindingArgs,
8888
): AppState {
8989
logger().install()
9090

91-
val appScope = CoroutineScope(SupervisorJob() + Dispatchers.Main)
91+
val appMainScope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
9292

9393
val navigationComponent = createGraphFactory<AppNavigationGraph.Factory>().create(
9494
signInNavigationBindings = SignInNavigationBindings,
@@ -114,14 +114,14 @@ fun createAppState(
114114
)
115115

116116
val dataBindings = DataBindings(
117-
args = args(appScope),
117+
args = args(appMainScope),
118118
)
119119

120120
val scaffoldBindings = ScaffoldBindings(
121121
args = ScaffoldBindingArgs(
122122
imageLoader = imageLoader(),
123-
notifier = notifier(appScope),
124-
videoPlayerController = videoPlayerController(appScope),
123+
notifier = notifier(appMainScope),
124+
videoPlayerController = videoPlayerController(appMainScope),
125125
routeMatchers = navigationComponent.allRouteMatchers,
126126
),
127127
dataBindings = dataBindings,

composeApp/src/commonMain/kotlin/com/tunjid/heron/di/AppGraph.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package com.tunjid.heron.di
1818

1919
import com.tunjid.heron.compose.di.ComposeBindings
2020
import com.tunjid.heron.conversation.di.ConversationBindings
21-
import com.tunjid.heron.data.di.AppCoroutineScope
21+
import com.tunjid.heron.data.di.AppMainScope
2222
import com.tunjid.heron.data.di.DataBindings
2323
import com.tunjid.heron.data.repository.AuthRepository
2424
import com.tunjid.heron.data.repository.UserDataRepository
@@ -95,8 +95,8 @@ interface AppGraph {
9595
@SingleIn(AppScope::class)
9696
@Provides
9797
fun appState(
98-
@AppCoroutineScope
99-
appScope: CoroutineScope,
98+
@AppMainScope
99+
appMainScope: CoroutineScope,
100100
authRepository: AuthRepository,
101101
userDataRepository: UserDataRepository,
102102
navigationStateHolder: NavigationStateHolder,

composeApp/src/desktopMain/kotlin/com/tunjid/heron/Platform.jvm.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,14 @@ fun createAppState(): AppState =
4545
logger = {
4646
JvmLogger()
4747
},
48-
videoPlayerController = { appScope ->
48+
videoPlayerController = { appMainScope ->
4949
VlcPlayerController(
50-
scope = appScope,
50+
scope = appMainScope,
5151
)
5252
},
53-
args = { appScope ->
53+
args = { appMainScope ->
5454
DataBindingArgs(
55-
appScope = appScope,
55+
appMainScope = appMainScope,
5656
connectivity = Connectivity(),
5757
savedStatePath = savedStatePath(),
5858
savedStateFileSystem = FileSystem.SYSTEM,

composeApp/src/iosMain/kotlin/com/tunjid/heron/Platform.ios.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ fun createAppState(): AppState =
5353
videoPlayerController = {
5454
StubVideoPlayerController
5555
},
56-
args = { appScope ->
56+
args = { appMainScope ->
5757
DataBindingArgs(
58-
appScope = appScope,
58+
appMainScope = appMainScope,
5959
connectivity = Connectivity(),
6060
savedStatePath = savedStatePath(),
6161
savedStateFileSystem = FileSystem.SYSTEM,

data/core/src/commonMain/kotlin/com/tunjid/heron/data/di/Bindings.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,19 @@ import com.tunjid.heron.data.network.oauth.crypto.platformCryptographyProvider
5050
import com.tunjid.heron.data.repository.AuthRepository
5151
import com.tunjid.heron.data.repository.AuthTokenRepository
5252
import com.tunjid.heron.data.repository.DataStoreSavedStateDataSource
53-
import com.tunjid.heron.data.repository.EmbeddableRecordRepository
5453
import com.tunjid.heron.data.repository.MessageRepository
5554
import com.tunjid.heron.data.repository.NotificationsRepository
56-
import com.tunjid.heron.data.repository.OfflineEmbeddableRecordRepository
5755
import com.tunjid.heron.data.repository.OfflineMessageRepository
5856
import com.tunjid.heron.data.repository.OfflineNotificationsRepository
5957
import com.tunjid.heron.data.repository.OfflinePostRepository
6058
import com.tunjid.heron.data.repository.OfflineProfileRepository
59+
import com.tunjid.heron.data.repository.OfflineRecordRepository
6160
import com.tunjid.heron.data.repository.OfflineSearchRepository
6261
import com.tunjid.heron.data.repository.OfflineTimelineRepository
6362
import com.tunjid.heron.data.repository.OfflineUserDataRepository
6463
import com.tunjid.heron.data.repository.PostRepository
6564
import com.tunjid.heron.data.repository.ProfileRepository
65+
import com.tunjid.heron.data.repository.RecordRepository
6666
import com.tunjid.heron.data.repository.SavedStateDataSource
6767
import com.tunjid.heron.data.repository.SearchRepository
6868
import com.tunjid.heron.data.repository.TimelineRepository
@@ -103,7 +103,7 @@ import okio.Path
103103

104104
@Qualifier
105105
@Retention(AnnotationRetention.RUNTIME)
106-
annotation class AppCoroutineScope
106+
annotation class AppMainScope
107107

108108
@Qualifier
109109
@Retention(AnnotationRetention.RUNTIME)
@@ -114,7 +114,7 @@ internal annotation class IODispatcher
114114
internal annotation class DefaultDispatcher
115115

116116
class DataBindingArgs(
117-
val appScope: CoroutineScope,
117+
val appMainScope: CoroutineScope,
118118
val connectivity: Connectivity,
119119
val savedStatePath: Path,
120120
val savedStateFileSystem: FileSystem,
@@ -126,10 +126,10 @@ class DataBindings(
126126
private val args: DataBindingArgs,
127127
) {
128128

129-
@AppCoroutineScope
129+
@AppMainScope
130130
@SingleIn(AppScope::class)
131131
@Provides
132-
fun provideAppScope(): CoroutineScope = args.appScope
132+
fun provideAppScope(): CoroutineScope = args.appMainScope
133133

134134
@IODispatcher
135135
@SingleIn(AppScope::class)
@@ -394,6 +394,6 @@ class DataBindings(
394394
@SingleIn(AppScope::class)
395395
@Provides
396396
internal fun provideRecordRepository(
397-
offlineRecordRepository: OfflineEmbeddableRecordRepository,
398-
): EmbeddableRecordRepository = offlineRecordRepository
397+
offlineRecordRepository: OfflineRecordRepository,
398+
): RecordRepository = offlineRecordRepository
399399
}

data/core/src/commonMain/kotlin/com/tunjid/heron/data/network/NetworkMonitor.kt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,20 @@
1616

1717
package com.tunjid.heron.data.network
1818

19-
import com.tunjid.heron.data.di.AppCoroutineScope
19+
import com.tunjid.heron.data.di.AppMainScope
20+
import com.tunjid.heron.data.di.IODispatcher
2021
import dev.jordond.connectivity.Connectivity
2122
import dev.zacsweers.metro.Inject
2223
import io.ktor.http.Url
24+
import kotlinx.coroutines.CoroutineDispatcher
2325
import kotlinx.coroutines.CoroutineScope
2426
import kotlinx.coroutines.flow.Flow
2527
import kotlinx.coroutines.flow.SharingStarted
2628
import kotlinx.coroutines.flow.emitAll
2729
import kotlinx.coroutines.flow.flow
2830
import kotlinx.coroutines.flow.map
2931
import kotlinx.coroutines.flow.stateIn
32+
import kotlinx.coroutines.plus
3033

3134
/**
3235
* An interface that reports if there's a network connection
@@ -36,8 +39,10 @@ interface NetworkMonitor {
3639
}
3740

3841
internal class ConnectivityNetworkMonitor @Inject constructor(
39-
@AppCoroutineScope
40-
appScope: CoroutineScope,
42+
@AppMainScope
43+
appMainScope: CoroutineScope,
44+
@IODispatcher
45+
ioDispatcher: CoroutineDispatcher,
4146
private val connectivity: Connectivity,
4247
) : NetworkMonitor {
4348
override val isConnected: Flow<Boolean> = flow {
@@ -53,7 +58,7 @@ internal class ConnectivityNetworkMonitor @Inject constructor(
5358
}
5459
}
5560
.stateIn(
56-
scope = appScope,
61+
scope = appMainScope + ioDispatcher,
5762
initialValue = true,
5863
// TODO: Can this be WhileSubscribed?
5964
// The backing library isn't thread safe for start / stop.

0 commit comments

Comments
 (0)