feat: Add screen orientation setting and improve padding for navigation bars in ChatsList and Onboarding screens
This commit is contained in:
@@ -23,7 +23,8 @@
|
|||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/Theme.RosettaAndroid"
|
android:theme="@style/Theme.RosettaAndroid"
|
||||||
android:windowSoftInputMode="adjustResize">
|
android:windowSoftInputMode="adjustResize"
|
||||||
|
android:screenOrientation="portrait">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,10 @@ class MainActivity : ComponentActivity() {
|
|||||||
// 🔔 Инициализируем Firebase для push-уведомлений
|
// 🔔 Инициализируем Firebase для push-уведомлений
|
||||||
initializeFirebase()
|
initializeFirebase()
|
||||||
|
|
||||||
// <EFBFBD> Предзагружаем эмодзи в фоне для мгновенного открытия пикера
|
// 🔥 Помечаем что приложение в foreground
|
||||||
|
com.rosetta.messenger.push.RosettaFirebaseMessagingService.isAppInForeground = true
|
||||||
|
|
||||||
|
// 📱 Предзагружаем эмодзи в фоне для мгновенного открытия пикера
|
||||||
// Используем новый оптимизированный кэш
|
// Используем новый оптимизированный кэш
|
||||||
OptimizedEmojiCache.preload(this)
|
OptimizedEmojiCache.preload(this)
|
||||||
|
|
||||||
@@ -275,6 +278,18 @@ class MainActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
// 🔥 Приложение стало видимым - отключаем уведомления
|
||||||
|
com.rosetta.messenger.push.RosettaFirebaseMessagingService.isAppInForeground = true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPause() {
|
||||||
|
super.onPause()
|
||||||
|
// 🔥 Приложение ушло в background - включаем уведомления
|
||||||
|
com.rosetta.messenger.push.RosettaFirebaseMessagingService.isAppInForeground = false
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 🔔 Инициализация Firebase Cloud Messaging
|
* 🔔 Инициализация Firebase Cloud Messaging
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ class RosettaFirebaseMessagingService : FirebaseMessagingService() {
|
|||||||
private const val CHANNEL_ID = "rosetta_messages"
|
private const val CHANNEL_ID = "rosetta_messages"
|
||||||
private const val CHANNEL_NAME = "Messages"
|
private const val CHANNEL_NAME = "Messages"
|
||||||
private const val NOTIFICATION_ID = 1
|
private const val NOTIFICATION_ID = 1
|
||||||
|
|
||||||
|
// 🔥 Флаг - приложение в foreground (видимо пользователю)
|
||||||
|
@Volatile
|
||||||
|
var isAppInForeground = false
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,6 +93,11 @@ class RosettaFirebaseMessagingService : FirebaseMessagingService() {
|
|||||||
* Показать уведомление о новом сообщении
|
* Показать уведомление о новом сообщении
|
||||||
*/
|
*/
|
||||||
private fun showMessageNotification(senderPublicKey: String?, senderName: String, messagePreview: String) {
|
private fun showMessageNotification(senderPublicKey: String?, senderName: String, messagePreview: String) {
|
||||||
|
// 🔥 Не показываем уведомление если приложение открыто
|
||||||
|
if (isAppInForeground) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
createNotificationChannel()
|
createNotificationChannel()
|
||||||
|
|
||||||
// Intent для открытия чата
|
// Intent для открытия чата
|
||||||
@@ -122,6 +131,11 @@ class RosettaFirebaseMessagingService : FirebaseMessagingService() {
|
|||||||
* Показать простое уведомление
|
* Показать простое уведомление
|
||||||
*/
|
*/
|
||||||
private fun showSimpleNotification(title: String, body: String) {
|
private fun showSimpleNotification(title: String, body: String) {
|
||||||
|
// 🔥 Не показываем уведомление если приложение открыто
|
||||||
|
if (isAppInForeground) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
createNotificationChannel()
|
createNotificationChannel()
|
||||||
|
|
||||||
val intent = Intent(this, MainActivity::class.java).apply {
|
val intent = Intent(this, MainActivity::class.java).apply {
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ fun ConfirmSeedPhraseScreen(
|
|||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.background(backgroundColor)
|
.background(backgroundColor)
|
||||||
.statusBarsPadding()
|
.statusBarsPadding()
|
||||||
|
.navigationBarsPadding()
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.fillMaxSize()) {
|
Column(modifier = Modifier.fillMaxSize()) {
|
||||||
// Top bar
|
// Top bar
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ fun ImportSeedPhraseScreen(
|
|||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.background(backgroundColor)
|
.background(backgroundColor)
|
||||||
.statusBarsPadding()
|
.statusBarsPadding()
|
||||||
|
.navigationBarsPadding()
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.fillMaxSize()) {
|
Column(modifier = Modifier.fillMaxSize()) {
|
||||||
// Top bar
|
// Top bar
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ fun SeedPhraseScreen(
|
|||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.background(backgroundColor)
|
.background(backgroundColor)
|
||||||
.statusBarsPadding()
|
.statusBarsPadding()
|
||||||
|
.navigationBarsPadding()
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.fillMaxSize()) {
|
Column(modifier = Modifier.fillMaxSize()) {
|
||||||
// Simple top bar
|
// Simple top bar
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ fun SetPasswordScreen(
|
|||||||
val isPasswordWeak = password.isNotEmpty() && password.length < 6
|
val isPasswordWeak = password.isNotEmpty() && password.length < 6
|
||||||
val canContinue = passwordsMatch && !isCreating
|
val canContinue = passwordsMatch && !isCreating
|
||||||
|
|
||||||
Box(modifier = Modifier.fillMaxSize().background(backgroundColor)) {
|
Box(modifier = Modifier.fillMaxSize().background(backgroundColor).navigationBarsPadding()) {
|
||||||
Column(modifier = Modifier.fillMaxSize().statusBarsPadding()) {
|
Column(modifier = Modifier.fillMaxSize().statusBarsPadding()) {
|
||||||
// Top Bar
|
// Top Bar
|
||||||
Row(
|
Row(
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ fun UnlockScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Box(modifier = Modifier.fillMaxSize().background(backgroundColor)) {
|
Box(modifier = Modifier.fillMaxSize().background(backgroundColor).navigationBarsPadding()) {
|
||||||
Column(
|
Column(
|
||||||
modifier =
|
modifier =
|
||||||
Modifier.fillMaxSize()
|
Modifier.fillMaxSize()
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ fun WelcomeScreen(
|
|||||||
var visible by remember { mutableStateOf(false) }
|
var visible by remember { mutableStateOf(false) }
|
||||||
LaunchedEffect(Unit) { visible = true }
|
LaunchedEffect(Unit) { visible = true }
|
||||||
|
|
||||||
Box(modifier = Modifier.fillMaxSize().background(backgroundColor)) {
|
Box(modifier = Modifier.fillMaxSize().background(backgroundColor).navigationBarsPadding()) {
|
||||||
// Back button when coming from UnlockScreen
|
// Back button when coming from UnlockScreen
|
||||||
if (hasExistingAccount) {
|
if (hasExistingAccount) {
|
||||||
IconButton(onClick = onBack, modifier = Modifier.statusBarsPadding().padding(4.dp)) {
|
IconButton(onClick = onBack, modifier = Modifier.statusBarsPadding().padding(4.dp)) {
|
||||||
|
|||||||
@@ -151,8 +151,15 @@ fun ChatsListScreen(
|
|||||||
LaunchedEffect(Unit) { hasInitialized = true }
|
LaunchedEffect(Unit) { hasInitialized = true }
|
||||||
|
|
||||||
val view = androidx.compose.ui.platform.LocalView.current
|
val view = androidx.compose.ui.platform.LocalView.current
|
||||||
|
val context = androidx.compose.ui.platform.LocalContext.current
|
||||||
val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
|
val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
|
|
||||||
|
// 🔥 ВСЕГДА закрываем клавиатуру при появлении ChatsListScreen
|
||||||
|
LaunchedEffect(Unit) {
|
||||||
|
val imm = context.getSystemService(android.content.Context.INPUT_METHOD_SERVICE) as android.view.inputmethod.InputMethodManager
|
||||||
|
imm.hideSoftInputFromWindow(view.windowToken, 0)
|
||||||
|
}
|
||||||
|
|
||||||
// Update status bar and completely hide navigation bar
|
// Update status bar and completely hide navigation bar
|
||||||
LaunchedEffect(isDarkTheme) {
|
LaunchedEffect(isDarkTheme) {
|
||||||
@@ -199,11 +206,10 @@ fun ChatsListScreen(
|
|||||||
var showStatusDialog by remember { mutableStateOf(false) }
|
var showStatusDialog by remember { mutableStateOf(false) }
|
||||||
val debugLogs by ProtocolManager.debugLogs.collectAsState()
|
val debugLogs by ProtocolManager.debugLogs.collectAsState()
|
||||||
|
|
||||||
// <EFBFBD> FCM токен диалог
|
// 📱 FCM токен диалог
|
||||||
var showFcmDialog by remember { mutableStateOf(false) }
|
var showFcmDialog by remember { mutableStateOf(false) }
|
||||||
val context = LocalContext.current
|
|
||||||
|
|
||||||
// <EFBFBD>📬 Requests screen state
|
// 📬 Requests screen state
|
||||||
var showRequestsScreen by remember { mutableStateOf(false) }
|
var showRequestsScreen by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
// 🔥 Используем rememberSaveable чтобы сохранить состояние при навигации
|
// 🔥 Используем rememberSaveable чтобы сохранить состояние при навигации
|
||||||
@@ -410,7 +416,7 @@ fun ChatsListScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Simple background
|
// Simple background
|
||||||
Box(modifier = Modifier.fillMaxSize().background(backgroundColor)) {
|
Box(modifier = Modifier.fillMaxSize().background(backgroundColor).navigationBarsPadding()) {
|
||||||
ModalNavigationDrawer(
|
ModalNavigationDrawer(
|
||||||
drawerState = drawerState,
|
drawerState = drawerState,
|
||||||
drawerContent = {
|
drawerContent = {
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ fun OnboardingScreen(
|
|||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
|
.navigationBarsPadding()
|
||||||
) {
|
) {
|
||||||
// Base background - shows the OLD theme color during transition
|
// Base background - shows the OLD theme color during transition
|
||||||
Box(
|
Box(
|
||||||
|
|||||||
Reference in New Issue
Block a user