release 0.1.5 (#98)

* settings reorganization;
implement long press on emoji button for fast text;
some deprecations fixed;
some typos fixed;
etc

* 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

* version up
This commit is contained in:
2024-12-17 21:07:22 +03:00
committed by GitHub
parent 82695ccf6f
commit 7c14df1824
43 changed files with 563 additions and 273 deletions
@@ -209,7 +209,7 @@ class MainViewModelImpl(
}
longPollController.setStateToApply(
if (AppSettings.Debug.longPollInBackground) {
if (AppSettings.Experimental.longPollInBackground) {
LongPollState.Background
} else {
LongPollState.InApp
@@ -233,7 +233,7 @@ class MainViewModelImpl(
}
private fun disableBackgroundLongPoll() {
AppSettings.Debug.longPollInBackground = false
AppSettings.Experimental.longPollInBackground = false
longPollController.setStateToApply(LongPollState.InApp)
}
}
@@ -24,7 +24,6 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
import androidx.core.app.NotificationManagerCompat
import androidx.core.content.ContextCompat
import androidx.lifecycle.compose.LifecycleResumeEffect
import androidx.lifecycle.compose.collectAsStateWithLifecycle
@@ -85,6 +84,7 @@ class MainActivity : AppCompatActivity() {
)
createNotificationChannels()
requestNotificationPermissions()
setContent {
KoinContext {
@@ -250,12 +250,11 @@ class MainActivity : AppCompatActivity() {
val noCategoryName = getString(UiR.string.notification_channel_no_category_name)
val noCategoryDescriptionText =
getString(UiR.string.notification_channel_no_category_description)
val noCategoryImportance = NotificationManagerCompat.IMPORTANCE_HIGH
val noCategoryChannel =
NotificationChannel(
AppConstants.NOTIFICATION_CHANNEL_UNCATEGORIZED,
noCategoryName,
noCategoryImportance
NotificationManager.IMPORTANCE_HIGH
).apply {
description = noCategoryDescriptionText
}
@@ -263,12 +262,11 @@ class MainActivity : AppCompatActivity() {
val longPollName = getString(UiR.string.notification_channel_long_polling_service_name)
val longPollDescriptionText =
getString(UiR.string.notification_channel_long_polling_service_description)
val longPollImportance = NotificationManagerCompat.IMPORTANCE_NONE
val longPollChannel =
NotificationChannel(
AppConstants.NOTIFICATION_CHANNEL_LONG_POLLING,
longPollName,
longPollImportance
NotificationManager.IMPORTANCE_NONE
).apply {
description = longPollDescriptionText
}
@@ -285,9 +283,18 @@ 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.Debug.longPollInBackground
inBackground: Boolean = AppSettings.Experimental.longPollInBackground
) {
if (enable) {
val longPollIntent = Intent(this, LongPollingService::class.java)
@@ -313,7 +320,7 @@ class MainActivity : AppCompatActivity() {
private fun stopServices() {
toggleOnlineService(enable = false)
val asForeground = AppSettings.Debug.longPollInBackground
val asForeground = AppSettings.Experimental.longPollInBackground
if (!asForeground) {
toggleLongPollService(enable = false)
@@ -324,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,
@@ -76,7 +76,7 @@ class LongPollingService : Service() {
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
if (startId > 1) return START_STICKY
val inBackground = AppSettings.Debug.longPollInBackground
val inBackground = AppSettings.Experimental.longPollInBackground
Log.d(
STATE_TAG,
@@ -258,10 +258,10 @@ class LongPollingService : Service() {
super.onDestroy()
}
override fun onLowMemory() {
Log.d(STATE_TAG, "onLowMemory")
override fun onTrimMemory(level: Int) {
Log.d(STATE_TAG, "onTrimMemory")
longPollController.updateCurrentState(LongPollState.Stopped)
super.onLowMemory()
super.onTrimMemory(level)
}
companion object {