tangled
alpha
login
or
join now
geesawra.industries
/
jerry-no
8
fork
atom
A cheap attempt at a native Bluesky client for Android
8
fork
atom
overview
issues
pulls
pipelines
MainView: tie isRefreshing to isScrollingEnabled
geesawra.industries
5 months ago
c834efb6
9eb04892
+6
-29
2 changed files
expand all
collapse all
unified
split
app
src
main
java
industries
geesawra
monarch
MainView.kt
datalayer
TimelineViewModel.kt
+4
-10
app/src/main/java/industries/geesawra/monarch/MainView.kt
···
164
164
val drawerState = rememberDrawerState(
165
165
initialValue = DrawerValue.Closed
166
166
)
167
167
-
val isScrollEnabled = remember { mutableStateOf(true) }
167
167
+
val isRefreshing = remember { mutableStateOf(true) }
168
168
+
val isScrollEnabled = !isRefreshing.value
168
169
val ctx = LocalContext.current
169
170
170
171
LaunchedEffect(Unit) {
···
186
187
.show()
187
188
}
188
189
}
189
189
-
val isRefreshing = remember { mutableStateOf(true) }
190
190
191
191
PullToRefreshBox(
192
192
isRefreshing = isRefreshing.value,
···
194
194
isRefreshing.value = true
195
195
when (currentDestination) {
196
196
TabBarDestinations.TIMELINE -> {
197
197
-
isScrollEnabled.value = false
198
197
timelineViewModel.fetchTimeline {
199
198
isRefreshing.value = false
200
200
-
isScrollEnabled.value = true
201
199
}
202
200
}
203
201
204
202
TabBarDestinations.NOTIFICATIONS -> {
205
205
-
isScrollEnabled.value = false
206
203
timelineViewModel.fetchNotifications {
207
204
isRefreshing.value = false
208
208
-
isScrollEnabled.value = true
209
205
}
210
206
}
211
207
}
···
359
355
}
360
356
) { values ->
361
357
LaunchedEffect(Unit) {
362
362
-
isScrollEnabled.value = false
363
358
timelineViewModel.fetchNewData {
364
359
isRefreshing.value = false
365
365
-
isScrollEnabled.value = true
366
360
}
367
361
}
368
362
···
372
366
state = timelineState,
373
367
modifier = Modifier.padding(values),
374
368
onReplyTap = onReplyTap,
375
375
-
isScrollEnabled = isScrollEnabled
369
369
+
isScrollEnabled = remember { mutableStateOf(isScrollEnabled) }
376
370
)
377
371
378
372
TabBarDestinations.NOTIFICATIONS -> NotificationsView(
379
373
viewModel = timelineViewModel,
380
374
state = notificationsState,
381
375
modifier = Modifier.padding(values),
382
382
-
isScrollEnabled = isScrollEnabled,
376
376
+
isScrollEnabled = remember { mutableStateOf(isScrollEnabled) },
383
377
onReplyTap = onReplyTap
384
378
)
385
379
}
+2
-19
app/src/main/java/industries/geesawra/monarch/datalayer/TimelineViewModel.kt
···
235
235
}
236
236
}
237
237
238
238
-
fun resetTimeline() {
239
239
-
uiState = uiState.copy(
240
240
-
skeets = listOf(),
241
241
-
isFetchingMoreTimeline = false,
242
242
-
timelineCursor = null,
243
243
-
)
244
244
-
}
245
245
-
246
246
-
fun resetNotifications() {
247
247
-
uiState = uiState.copy(
248
248
-
notifications = listOf(),
249
249
-
isFetchingMoreNotifications = false,
250
250
-
notificationsCursor = null,
251
251
-
)
252
252
-
}
253
253
-
254
254
-
255
238
suspend fun post(
256
239
content: String,
257
240
images: List<Uri>? = null,
···
287
270
feedName = displayName,
288
271
feedAvatar = avatar,
289
272
)
290
290
-
resetTimeline()
291
291
-
fetchTimeline { then() }
273
273
+
274
274
+
fetchTimeline(fresh = true) { then() }
292
275
}
293
276
294
277
fun like(uri: AtUri, cid: Cid, then: () -> Unit) {