diff --git a/apps/android/app/build.gradle b/apps/android/app/build.gradle index 1b81bf7d5..aca945b71 100644 --- a/apps/android/app/build.gradle +++ b/apps/android/app/build.gradle @@ -5,14 +5,14 @@ plugins { } android { - compileSdk 33 + compileSdk 32 defaultConfig { applicationId "chat.simplex.app" minSdk 29 - targetSdk 33 - versionCode 104 - versionName "4.6-beta.0" + targetSdk 32 + versionCode 105 + versionName "4.6-beta.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" ndk { diff --git a/apps/android/app/src/main/AndroidManifest.xml b/apps/android/app/src/main/AndroidManifest.xml index 3476fe605..6d090e381 100644 --- a/apps/android/app/src/main/AndroidManifest.xml +++ b/apps/android/app/src/main/AndroidManifest.xml @@ -30,8 +30,8 @@ android:label="${app_name}" android:extractNativeLibs="${extract_native_libs}" android:supportsRtl="true" - android:localeConfig="@xml/locales_config" android:theme="@style/Theme.SimpleX"> + = 30_000) { runAuthenticate() @@ -160,25 +159,31 @@ class MainActivity: FragmentActivity() { } else { userAuthorized.value = false ModalManager.shared.closeModals() - authenticate( - generalGetString(R.string.auth_unlock), - generalGetString(R.string.auth_log_in_using_credential), - this@MainActivity, - completed = { laResult -> - when (laResult) { - LAResult.Success -> - userAuthorized.value = true - is LAResult.Error, LAResult.Failed -> - laFailed.value = true - LAResult.Unavailable -> { - userAuthorized.value = true - m.performLA.value = false - m.controller.appPrefs.performLA.set(false) - laUnavailableTurningOffAlert() + // To make Main thread free in order to allow to Compose to show blank view that hiding content underneath of it faster on slow devices + CoroutineScope(Dispatchers.Default).launch { + delay(50) + withContext(Dispatchers.Main) { + authenticate( + generalGetString(R.string.auth_unlock), + generalGetString(R.string.auth_log_in_using_credential), + this@MainActivity, + completed = { laResult -> + when (laResult) { + LAResult.Success -> + userAuthorized.value = true + is LAResult.Error, LAResult.Failed -> + laFailed.value = true + LAResult.Unavailable -> { + userAuthorized.value = true + m.performLA.value = false + m.controller.appPrefs.performLA.set(false) + laUnavailableTurningOffAlert() + } + } } - } + ) } - ) + } } } @@ -261,14 +266,6 @@ fun MainPage( setPerformLA: (Boolean) -> Unit, showLANotice: () -> Unit ) { - // this with LaunchedEffect(userAuthorized.value) fixes bottom sheet visibly collapsing after authentication - var chatsAccessAuthorized by rememberSaveable { mutableStateOf(false) } - LaunchedEffect(userAuthorized.value) { - if (chatModel.controller.appPrefs.performLA.get()) { - delay(500L) - } - chatsAccessAuthorized = userAuthorized.value == true - } var showChatDatabaseError by rememberSaveable { mutableStateOf(chatModel.chatDbStatus.value != DBMigrationResult.OK && chatModel.chatDbStatus.value != null) } @@ -327,7 +324,7 @@ fun MainPage( } } onboarding == null || userCreated == null -> SplashView() - !chatsAccessAuthorized -> { + userAuthorized.value != true -> { if (chatModel.controller.appPrefs.performLA.get() && laFailed.value) { authView() } else { diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/chat/ChatView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/chat/ChatView.kt index f875f31ae..9558f6254 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/chat/ChatView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/chat/ChatView.kt @@ -204,7 +204,7 @@ fun ChatView(chatId: String, chatModel: ChatModel, onComposed: () -> Unit) { val groupMember = toModerate?.second val deletedChatItem: ChatItem? val toChatItem: ChatItem? - if (groupInfo != null && groupMember != null) { + if (mode == CIDeleteMode.cidmBroadcast && groupInfo != null && groupMember != null) { val r = chatModel.controller.apiDeleteMemberChatItem( groupId = groupInfo.groupId, groupMemberId = groupMember.groupMemberId, diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/helpers/Util.kt b/apps/android/app/src/main/java/chat/simplex/app/views/helpers/Util.kt index 74eae06e0..17a462f58 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/helpers/Util.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/helpers/Util.kt @@ -2,7 +2,7 @@ package chat.simplex.app.views.helpers import android.app.Activity import android.app.Application -import android.app.LocaleManager +//import android.app.LocaleManager import android.content.ActivityNotFoundException import android.content.Context import android.content.res.Configuration @@ -506,24 +506,24 @@ inline fun serializableSaver(): Saver = Saver( ) fun saveAppLocale(pref: SharedPreference, activity: Activity, languageCode: String? = null) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - val localeManager = SimplexApp.context.getSystemService(LocaleManager::class.java) - localeManager.applicationLocales = LocaleList(Locale.forLanguageTag(languageCode ?: return)) - } else { +// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { +// val localeManager = SimplexApp.context.getSystemService(LocaleManager::class.java) +// localeManager.applicationLocales = LocaleList(Locale.forLanguageTag(languageCode ?: return)) +// } else { pref.set(languageCode) if (languageCode == null) { activity.applyLocale(SimplexApp.context.defaultLocale) } activity.recreate() - } +// } } fun Activity.applyAppLocale(pref: SharedPreference) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) { +// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) { val lang = pref.get() if (lang == null || lang == Locale.getDefault().language) return applyLocale(Locale.forLanguageTag(lang)) - } +// } } private fun Activity.applyLocale(locale: Locale) { diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/Appearance.kt b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/Appearance.kt index 2ff6c498b..827d5e883 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/Appearance.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/Appearance.kt @@ -97,14 +97,14 @@ fun AppearanceView(m: ChatModel) { AppBarTitle(stringResource(R.string.appearance_settings)) SectionView(stringResource(R.string.settings_section_title_language), padding = PaddingValues()) { val context = LocalContext.current - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - SectionItemWithValue( - generalGetString(R.string.settings_section_title_language).lowercase().replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.US) else it.toString() }, - remember { mutableStateOf("system") }, - listOf(ValueTitleDesc("system", generalGetString(R.string.change_verb), "")), - onSelected = { openSystemLangPicker(context as? Activity ?: return@SectionItemWithValue) } - ) - } else { +// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { +// SectionItemWithValue( +// generalGetString(R.string.settings_section_title_language).lowercase().replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.US) else it.toString() }, +// remember { mutableStateOf("system") }, +// listOf(ValueTitleDesc("system", generalGetString(R.string.change_verb), "")), +// onSelected = { openSystemLangPicker(context as? Activity ?: return@SectionItemWithValue) } +// ) +// } else { val state = rememberSaveable { mutableStateOf(languagePref.get() ?: "system") } SectionItemView { LangSelector(state) { @@ -122,7 +122,7 @@ fun AppearanceView(m: ChatModel) { } } } - } +// } } SectionSpacer() @@ -264,9 +264,9 @@ private fun ThemeSelector(state: State, onSelected: (DefaultTheme) ) } -private fun openSystemLangPicker(activity: Activity) { - activity.startActivity(Intent(Settings.ACTION_APP_LOCALE_SETTINGS, Uri.parse("package:" + SimplexApp.context.packageName))) -} +//private fun openSystemLangPicker(activity: Activity) { +// activity.startActivity(Intent(Settings.ACTION_APP_LOCALE_SETTINGS, Uri.parse("package:" + SimplexApp.context.packageName))) +//} private fun findEnabledIcon(): AppIcon = AppIcon.values().first { icon -> SimplexApp.context.packageManager.getComponentEnabledSetting( diff --git a/apps/ios/Shared/Views/Chat/ChatView.swift b/apps/ios/Shared/Views/Chat/ChatView.swift index 21fcb66dd..8d189bd4d 100644 --- a/apps/ios/Shared/Views/Chat/ChatView.swift +++ b/apps/ios/Shared/Views/Chat/ChatView.swift @@ -667,7 +667,8 @@ struct ChatView: View { if let di = deletingItem { var deletedItem: ChatItem var toItem: ChatItem? - if let (groupInfo, groupMember) = di.memberToModerate(chat.chatInfo) { + if case .cidmBroadcast = mode, + let (groupInfo, groupMember) = di.memberToModerate(chat.chatInfo) { (deletedItem, toItem) = try await apiDeleteMemberChatItem( groupId: groupInfo.apiId, groupMemberId: groupMember.groupMemberId, diff --git a/apps/ios/Shared/Views/ChatList/ChatListView.swift b/apps/ios/Shared/Views/ChatList/ChatListView.swift index d23418101..0b2a3f1a9 100644 --- a/apps/ios/Shared/Views/ChatList/ChatListView.swift +++ b/apps/ios/Shared/Views/ChatList/ChatListView.swift @@ -85,7 +85,7 @@ struct ChatListView: View { .frame(width: 32, height: 32) .padding(.trailing, 4) let allRead = chatModel.users - .filter { !$0.user.activeUser } + .filter { u in !u.user.activeUser && !u.user.hidden } .allSatisfy { u in u.unreadCount == 0 } if !allRead { unreadBadge(size: 12) diff --git a/apps/ios/Shared/Views/ChatList/UserPicker.swift b/apps/ios/Shared/Views/ChatList/UserPicker.swift index 76bac7a28..bb88f5c38 100644 --- a/apps/ios/Shared/Views/ChatList/UserPicker.swift +++ b/apps/ios/Shared/Views/ChatList/UserPicker.swift @@ -126,7 +126,9 @@ struct UserPicker: View { if user.activeUser { Image(systemName: "checkmark") } else if u.unreadCount > 0 { - unreadCounter(u.unreadCount) + unreadCounter(u.unreadCount, color: user.showNtfs ? .accentColor : .secondary) + } else if !user.showNtfs { + Image(systemName: "speaker.slash") } } .padding(.trailing) @@ -152,13 +154,13 @@ struct UserPicker: View { } } -func unreadCounter(_ unread: Int) -> some View { +private func unreadCounter(_ unread: Int, color: Color) -> some View { unreadCountText(unread) .font(.caption) .foregroundColor(.white) .padding(.horizontal, 4) .frame(minWidth: 18, minHeight: 18) - .background(Color.accentColor) + .background(color) .cornerRadius(10) } diff --git a/apps/ios/SimpleX.xcodeproj/project.pbxproj b/apps/ios/SimpleX.xcodeproj/project.pbxproj index b37d37ab8..1ff2641c2 100644 --- a/apps/ios/SimpleX.xcodeproj/project.pbxproj +++ b/apps/ios/SimpleX.xcodeproj/project.pbxproj @@ -1396,7 +1396,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = "SimpleX (iOS).entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 131; + CURRENT_PROJECT_VERSION = 132; DEVELOPMENT_TEAM = 5NN7GUYB6T; ENABLE_BITCODE = NO; ENABLE_PREVIEWS = YES; @@ -1438,7 +1438,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = "SimpleX (iOS).entitlements"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 131; + CURRENT_PROJECT_VERSION = 132; DEVELOPMENT_TEAM = 5NN7GUYB6T; ENABLE_BITCODE = NO; ENABLE_PREVIEWS = YES; @@ -1518,7 +1518,7 @@ CODE_SIGN_ENTITLEMENTS = "SimpleX NSE/SimpleX NSE.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 131; + CURRENT_PROJECT_VERSION = 132; DEVELOPMENT_TEAM = 5NN7GUYB6T; ENABLE_BITCODE = NO; GENERATE_INFOPLIST_FILE = YES; @@ -1550,7 +1550,7 @@ CODE_SIGN_ENTITLEMENTS = "SimpleX NSE/SimpleX NSE.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 131; + CURRENT_PROJECT_VERSION = 132; DEVELOPMENT_TEAM = 5NN7GUYB6T; ENABLE_BITCODE = NO; GENERATE_INFOPLIST_FILE = YES; diff --git a/scripts/ios/prepare.sh b/scripts/ios/prepare.sh index 3e4157b4c..1043af4bd 100755 --- a/scripts/ios/prepare.sh +++ b/scripts/ios/prepare.sh @@ -3,7 +3,7 @@ # the binaries folder should be in ~/Downloads folder rm -rf ./apps/ios/Libraries/mac ./apps/ios/Libraries/ios ./apps/ios/Libraries/sim mkdir -p ./apps/ios/Libraries/mac ./apps/ios/Libraries/ios ./apps/ios/Libraries/sim -cp ~/Downloads/pkg-ios-aarch64-swift-json/* ./apps/ios/Libraries/mac +unzip -o ~/Downloads/pkg-ios-aarch64-swift-json.zip -d ./apps/ios/Libraries/mac chmod +w ./apps/ios/Libraries/mac/* cp ./apps/ios/Libraries/mac/* ./apps/ios/Libraries/ios cp ./apps/ios/Libraries/mac/* ./apps/ios/Libraries/sim