A cheap attempt at a native Bluesky client for Android
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

TimelineView: basic video/image distinction

geesawra e7dc4c63 8f275441

+12 -2
+11 -2
app/src/main/java/industries/geesawra/jerryno/TimelineView.kt
··· 117 117 val keyboardController = LocalSoftwareKeyboardController.current 118 118 val context = LocalContext.current 119 119 val mediaSelected = remember { mutableStateOf(mapOf<Uri, String?>()) } 120 + val mediaSelectedIsVideo = remember { mutableStateOf(false) } 120 121 121 122 LaunchedEffect(scaffoldState.bottomSheetState.isVisible) { 122 123 if (scaffoldState.bottomSheetState.isVisible) { ··· 162 163 ).show() 163 164 164 165 return@rememberLauncherForActivityResult 166 + } 167 + 168 + if (urisMap.size == 1 && urisMap.values.first() == "video") { 169 + mediaSelectedIsVideo.value = true 165 170 } 166 171 167 172 mediaSelected.value = urisMap ··· 281 286 uploadingPost.value = true 282 287 timelineViewModel.post( 283 288 postText, 284 - mediaSelected.value.keys.toList().ifEmpty { null } 289 + if (!mediaSelectedIsVideo.value) mediaSelected.value.keys.toList() 290 + .ifEmpty { null } else null, 291 + if (mediaSelectedIsVideo.value) mediaSelected.value.keys.toList() 292 + .firstOrNull() 293 + else null, 285 294 ).onSuccess { 286 295 scaffoldState.bottomSheetState.hide() 287 296 postText = "" ··· 293 302 Toast.makeText( 294 303 context, 295 304 "Could not post: ${it.message}", 296 - Toast.LENGTH_SHORT 305 + Toast.LENGTH_LONG 297 306 ).show() 298 307 uploadingPost.value = false 299 308 postButtonEnabled.value = true
+1
app/src/main/java/industries/geesawra/jerryno/datalayer/Bluesky.kt
··· 411 411 } 412 412 413 413 suspend fun post(content: String, images: List<Uri>? = null, video: Uri? = null): Result<Unit> { 414 + // TODO: videos need to be uploaded through a different API. 414 415 return runCatching { 415 416 create().onFailure { 416 417 return Result.failure(LoginException(it.message))