forked from melod1n/fast-messenger
ability to use more animations (experimental);
fix online friends loading; conversation avatar in messages history screen; test second tap on conversations item in bottom bar to scroll to top; etc
This commit is contained in:
@@ -84,6 +84,7 @@ class MainActivity : AppCompatActivity() {
|
||||
)
|
||||
|
||||
createNotificationChannels()
|
||||
requestNotificationPermissions()
|
||||
|
||||
setContent {
|
||||
KoinContext {
|
||||
@@ -282,6 +283,15 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun requestNotificationPermissions() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
requestPermissions(
|
||||
arrayOf(Manifest.permission.POST_NOTIFICATIONS),
|
||||
REQUEST_NOTIFICATION_PERMISSION_CODE
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun toggleLongPollService(
|
||||
enable: Boolean,
|
||||
inBackground: Boolean = AppSettings.Experimental.longPollInBackground
|
||||
@@ -321,4 +331,8 @@ class MainActivity : AppCompatActivity() {
|
||||
super.onDestroy()
|
||||
stopServices()
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val REQUEST_NOTIFICATION_PERMISSION_CODE = 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ import dev.meloda.fast.ui.theme.LocalBottomPadding
|
||||
import dev.meloda.fast.ui.theme.LocalHazeState
|
||||
import dev.meloda.fast.ui.theme.LocalThemeConfig
|
||||
import dev.meloda.fast.ui.util.ImmutableList
|
||||
import kotlinx.coroutines.channels.BufferOverflow
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
|
||||
@OptIn(ExperimentalHazeMaterialsApi::class)
|
||||
@Composable
|
||||
@@ -68,6 +70,14 @@ fun MainScreen(
|
||||
mutableIntStateOf(1)
|
||||
}
|
||||
|
||||
val sharedFlow = remember {
|
||||
MutableSharedFlow<Int>(
|
||||
replay = 0,
|
||||
extraBufferCapacity = 1,
|
||||
onBufferOverflow = BufferOverflow.DROP_OLDEST
|
||||
)
|
||||
}
|
||||
|
||||
Scaffold(
|
||||
bottomBar = {
|
||||
NavigationBar(
|
||||
@@ -98,6 +108,8 @@ fun MainScreen(
|
||||
inclusive = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sharedFlow.tryEmit(index)
|
||||
}
|
||||
},
|
||||
icon = {
|
||||
@@ -156,7 +168,11 @@ fun MainScreen(
|
||||
enterTransition = { fadeIn(animationSpec = tween(200)) },
|
||||
exitTransition = { fadeOut(animationSpec = tween(200)) }
|
||||
) {
|
||||
navigation<MainGraph>(startDestination = navigationItems[selectedItemIndex].route) {
|
||||
navigation<MainGraph>(
|
||||
startDestination = navigationItems[selectedItemIndex].route,
|
||||
enterTransition = { fadeIn(animationSpec = tween(200)) },
|
||||
exitTransition = { fadeOut(animationSpec = tween(200)) }
|
||||
) {
|
||||
friendsScreen(
|
||||
onError = onError,
|
||||
navController = navController,
|
||||
@@ -165,8 +181,9 @@ fun MainScreen(
|
||||
conversationsScreen(
|
||||
onError = onError,
|
||||
onConversationItemClicked = onConversationItemClicked,
|
||||
onPhotoClicked = onPhotoClicked,
|
||||
scrollToTopFlow = sharedFlow,
|
||||
navController = navController,
|
||||
onPhotoClicked = onPhotoClicked
|
||||
)
|
||||
profileScreen(
|
||||
onError = onError,
|
||||
|
||||
Reference in New Issue
Block a user