Merge branch 'master' into angerman/both-compilers
This commit is contained in:
commit
ba954e4faa
@ -234,6 +234,8 @@ You can use SimpleX with your own servers and still communicate with people usin
|
||||
|
||||
Recent and important updates:
|
||||
|
||||
[Jan 24, 2024. SimpleX Chat: free infrastructure from Linode, v5.5 released with private notes, group history and a simpler UX to connect.](./blog/20240124-simplex-chat-infrastructure-costs-v5-5-simplex-ux-private-notes-group-history.md)
|
||||
|
||||
[Nov 25, 2023. SimpleX Chat v5.4 released: link mobile and desktop apps via quantum resistant protocol, and much better groups](./blog/20231125-simplex-chat-v5-4-link-mobile-desktop-quantum-resistant-better-groups.md).
|
||||
|
||||
[Sep 25, 2023. SimpleX Chat v5.3 released: desktop app, local file encryption, improved groups and directory service](./blog/20230925-simplex-chat-v5-3-desktop-app-local-file-encryption-directory-service.md).
|
||||
@ -299,7 +301,7 @@ What is already implemented:
|
||||
11. Transport isolation - different TCP connections and Tor circuits are used for traffic of different user profiles, optionally - for different contacts and group member connections.
|
||||
12. Manual messaging queue rotations to move conversation to another SMP relay.
|
||||
13. Sending end-to-end encrypted files using [XFTP protocol](https://simplex.chat/blog/20230301-simplex-file-transfer-protocol.html).
|
||||
14. Local files encryption, except videos (to be added later).
|
||||
14. Local files encryption.
|
||||
|
||||
We plan to add:
|
||||
|
||||
@ -371,12 +373,13 @@ Please also join [#simplex-devs](https://simplex.chat/contact#/?v=1-2&smp=smp%3A
|
||||
- ✅ Desktop client.
|
||||
- ✅ Encryption of local files stored in the app.
|
||||
- ✅ Using mobile profiles from the desktop app.
|
||||
- ✅ Private notes.
|
||||
- ✅ Improve sending videos (including encryption of locally stored videos).
|
||||
- 🏗 Improve experience for the new users.
|
||||
- 🏗 Post-quantum resistant key exchange in double ratchet protocol.
|
||||
- 🏗 Large groups, communities and public channels.
|
||||
- Message delivery relay for senders (to conceal IP address from the recipients' servers and to reduce the traffic).
|
||||
- 🏗 Message delivery relay for senders (to conceal IP address from the recipients' servers and to reduce the traffic).
|
||||
- Privacy & security slider - a simple way to set all settings at once.
|
||||
- Improve sending videos (including encryption of locally stored videos).
|
||||
- SMP queue redundancy and rotation (manual is supported).
|
||||
- Include optional message into connection request sent via contact address.
|
||||
- Improved navigation and search in the conversation (expand and scroll to quoted message, scroll to search results, etc.).
|
||||
|
@ -1172,7 +1172,7 @@ func filterMembersToAdd(_ ms: [GMember]) -> [Contact] {
|
||||
let memberContactIds = ms.compactMap{ m in m.wrapped.memberCurrent ? m.wrapped.memberContactId : nil }
|
||||
return ChatModel.shared.chats
|
||||
.compactMap{ $0.chatInfo.contact }
|
||||
.filter{ !memberContactIds.contains($0.apiId) }
|
||||
.filter{ c in c.ready && c.active && !memberContactIds.contains(c.apiId) }
|
||||
.sorted{ $0.displayName.lowercased() < $1.displayName.lowercased() }
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,8 @@ struct MarkedDeletedItemView: View {
|
||||
}
|
||||
}
|
||||
|
||||
// same texts are in markedDeletedText in ChatPreviewView, but it returns String;
|
||||
// can be refactored into a single function if functions calling these are changed to return same type
|
||||
var markedDeletedText: LocalizedStringKey {
|
||||
switch chatItem.meta.itemDeleted {
|
||||
case let .moderated(_, byGroupMember): "moderated by \(byGroupMember.displayName)"
|
||||
|
@ -159,12 +159,13 @@ struct ChatView: View {
|
||||
switch cInfo {
|
||||
case let .direct(contact):
|
||||
HStack {
|
||||
if contact.allowsFeature(.calls) {
|
||||
let callsPrefEnabled = contact.mergedPreferences.calls.enabled.forUser
|
||||
if callsPrefEnabled {
|
||||
callButton(contact, .audio, imageName: "phone")
|
||||
.disabled(!contact.ready || !contact.active)
|
||||
}
|
||||
Menu {
|
||||
if contact.allowsFeature(.calls) {
|
||||
if callsPrefEnabled {
|
||||
Button {
|
||||
CallController.shared.startCall(contact, .video)
|
||||
} label: {
|
||||
|
@ -34,7 +34,7 @@ struct ChatPreviewView: View {
|
||||
HStack(alignment: .top) {
|
||||
chatPreviewTitle()
|
||||
Spacer()
|
||||
(cItem?.timestampText ?? formatTimestampText(chat.chatInfo.updatedAt))
|
||||
(cItem?.timestampText ?? formatTimestampText(chat.chatInfo.chatTs))
|
||||
.font(.subheadline)
|
||||
.frame(minWidth: 60, alignment: .trailing)
|
||||
.foregroundColor(.secondary)
|
||||
@ -171,10 +171,21 @@ struct ChatPreviewView: View {
|
||||
}
|
||||
|
||||
func chatItemPreview(_ cItem: ChatItem) -> Text {
|
||||
let itemText = cItem.meta.itemDeleted == nil ? cItem.text : NSLocalizedString("marked deleted", comment: "marked deleted chat item preview text")
|
||||
let itemText = cItem.meta.itemDeleted == nil ? cItem.text : markedDeletedText()
|
||||
let itemFormattedText = cItem.meta.itemDeleted == nil ? cItem.formattedText : nil
|
||||
return messageText(itemText, itemFormattedText, cItem.memberDisplayName, icon: attachment(), preview: true, showSecrets: false)
|
||||
|
||||
// same texts are in markedDeletedText in MarkedDeletedItemView, but it returns LocalizedStringKey;
|
||||
// can be refactored into a single function if functions calling these are changed to return same type
|
||||
func markedDeletedText() -> String {
|
||||
switch cItem.meta.itemDeleted {
|
||||
case let .moderated(_, byGroupMember): String.localizedStringWithFormat(NSLocalizedString("moderated by %@", comment: "marked deleted chat item preview text"), byGroupMember.displayName)
|
||||
case .blocked: NSLocalizedString("blocked", comment: "marked deleted chat item preview text")
|
||||
case .blockedByAdmin: NSLocalizedString("blocked by admin", comment: "marked deleted chat item preview text")
|
||||
case .deleted, nil: NSLocalizedString("marked deleted", comment: "marked deleted chat item preview text")
|
||||
}
|
||||
}
|
||||
|
||||
func attachment() -> String? {
|
||||
switch cItem.content.msgContent {
|
||||
case .file: return "doc.fill"
|
||||
|
@ -1509,7 +1509,7 @@
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = "SimpleX (iOS).entitlements";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 191;
|
||||
CURRENT_PROJECT_VERSION = 194;
|
||||
DEVELOPMENT_TEAM = 5NN7GUYB6T;
|
||||
ENABLE_BITCODE = NO;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
@ -1552,7 +1552,7 @@
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = "SimpleX (iOS).entitlements";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 191;
|
||||
CURRENT_PROJECT_VERSION = 194;
|
||||
DEVELOPMENT_TEAM = 5NN7GUYB6T;
|
||||
ENABLE_BITCODE = NO;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
@ -1633,7 +1633,7 @@
|
||||
CODE_SIGN_ENTITLEMENTS = "SimpleX NSE/SimpleX NSE.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 191;
|
||||
CURRENT_PROJECT_VERSION = 194;
|
||||
DEVELOPMENT_TEAM = 5NN7GUYB6T;
|
||||
ENABLE_BITCODE = NO;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
@ -1665,7 +1665,7 @@
|
||||
CODE_SIGN_ENTITLEMENTS = "SimpleX NSE/SimpleX NSE.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 191;
|
||||
CURRENT_PROJECT_VERSION = 194;
|
||||
DEVELOPMENT_TEAM = 5NN7GUYB6T;
|
||||
ENABLE_BITCODE = NO;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
@ -1697,7 +1697,7 @@
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 191;
|
||||
CURRENT_PROJECT_VERSION = 194;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = 5NN7GUYB6T;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
@ -1743,7 +1743,7 @@
|
||||
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 191;
|
||||
CURRENT_PROJECT_VERSION = 194;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = 5NN7GUYB6T;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
|
@ -1367,6 +1367,17 @@ public enum ChatInfo: Identifiable, Decodable, NamedChat {
|
||||
}
|
||||
}
|
||||
|
||||
public var chatTs: Date {
|
||||
switch self {
|
||||
case let .direct(contact): return contact.chatTs ?? contact.updatedAt
|
||||
case let .group(groupInfo): return groupInfo.chatTs ?? groupInfo.updatedAt
|
||||
case let .local(noteFolder): return noteFolder.chatTs
|
||||
case let .contactRequest(contactRequest): return contactRequest.updatedAt
|
||||
case let .contactConnection(contactConnection): return contactConnection.updatedAt
|
||||
case .invalidJSON: return .now
|
||||
}
|
||||
}
|
||||
|
||||
public struct SampleData {
|
||||
public var direct: ChatInfo
|
||||
public var group: ChatInfo
|
||||
@ -1425,6 +1436,7 @@ public struct Contact: Identifiable, Decodable, NamedChat {
|
||||
public var mergedPreferences: ContactUserPreferences
|
||||
var createdAt: Date
|
||||
var updatedAt: Date
|
||||
var chatTs: Date?
|
||||
var contactGroupMemberId: Int64?
|
||||
var contactGrpInvSent: Bool
|
||||
|
||||
@ -1744,6 +1756,7 @@ public struct GroupInfo: Identifiable, Decodable, NamedChat {
|
||||
public var chatSettings: ChatSettings
|
||||
var createdAt: Date
|
||||
var updatedAt: Date
|
||||
var chatTs: Date?
|
||||
|
||||
public var id: ChatId { get { "#\(groupId)" } }
|
||||
public var apiId: Int64 { get { groupId } }
|
||||
@ -2049,6 +2062,7 @@ public struct NoteFolder: Identifiable, Decodable, NamedChat {
|
||||
public var unread: Bool
|
||||
var createdAt: Date
|
||||
public var updatedAt: Date
|
||||
var chatTs: Date
|
||||
|
||||
public var id: ChatId { get { "*\(noteFolderId)" } }
|
||||
public var apiId: Int64 { get { noteFolderId } }
|
||||
@ -2070,7 +2084,8 @@ public struct NoteFolder: Identifiable, Decodable, NamedChat {
|
||||
favorite: false,
|
||||
unread: false,
|
||||
createdAt: .now,
|
||||
updatedAt: .now
|
||||
updatedAt: .now,
|
||||
chatTs: .now
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -197,10 +197,18 @@ class SimplexApp: Application(), LifecycleEventObserver {
|
||||
}
|
||||
SimplexService.StartReceiver.toggleReceiver(mode == NotificationsMode.SERVICE)
|
||||
CoroutineScope(Dispatchers.Default).launch {
|
||||
if (mode == NotificationsMode.SERVICE)
|
||||
if (mode == NotificationsMode.SERVICE) {
|
||||
SimplexService.start()
|
||||
else
|
||||
// Sometimes, when we change modes fast from one to another, system destroys the service after start.
|
||||
// We can wait a little and restart the service, and it will work in 100% of cases
|
||||
delay(2000)
|
||||
if (!SimplexService.isServiceStarted && appPrefs.notificationsMode.get() == NotificationsMode.SERVICE) {
|
||||
Log.i(TAG, "Service tried to start but destroyed by system, repeating once more")
|
||||
SimplexService.start()
|
||||
}
|
||||
} else {
|
||||
SimplexService.safeStopService()
|
||||
}
|
||||
}
|
||||
|
||||
if (mode != NotificationsMode.PERIODIC) {
|
||||
|
@ -262,7 +262,7 @@ class SimplexService: Service() {
|
||||
private const val SHARED_PREFS_SERVICE_STATE = "SIMPLEX_SERVICE_STATE"
|
||||
private const val WORK_NAME_ONCE = "ServiceStartWorkerOnce"
|
||||
|
||||
private var isServiceStarted = false
|
||||
var isServiceStarted = false
|
||||
private var stopAfterStart = false
|
||||
|
||||
fun scheduleStart(context: Context) {
|
||||
|
@ -0,0 +1,106 @@
|
||||
package chat.simplex.common.views.helpers
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import chat.simplex.common.model.CustomTimeUnit
|
||||
import chat.simplex.common.ui.theme.DEFAULT_PADDING
|
||||
import com.sd.lib.compose.wheel_picker.*
|
||||
|
||||
@Composable
|
||||
actual fun CustomTimePicker(
|
||||
selection: MutableState<Int>,
|
||||
timeUnitsLimits: List<TimeUnitLimits>
|
||||
) {
|
||||
fun getUnitValues(unit: CustomTimeUnit, selectedValue: Int): List<Int> {
|
||||
val unitLimits = timeUnitsLimits.firstOrNull { it.timeUnit == unit } ?: TimeUnitLimits.defaultUnitLimits(unit)
|
||||
val regularUnitValues = (unitLimits.minValue..unitLimits.maxValue).toList()
|
||||
return regularUnitValues + if (regularUnitValues.contains(selectedValue)) emptyList() else listOf(selectedValue)
|
||||
}
|
||||
|
||||
val (unit, duration) = CustomTimeUnit.toTimeUnit(selection.value)
|
||||
val selectedUnit: MutableState<CustomTimeUnit> = remember { mutableStateOf(unit) }
|
||||
val selectedDuration = remember { mutableStateOf(duration) }
|
||||
val selectedUnitValues = remember { mutableStateOf(getUnitValues(selectedUnit.value, selectedDuration.value)) }
|
||||
val isTriggered = remember { mutableStateOf(false) }
|
||||
|
||||
LaunchedEffect(selectedUnit.value) {
|
||||
// on initial composition, if passed selection doesn't fit into picker bounds, so that selectedDuration is bigger than selectedUnit maxValue
|
||||
// (e.g., for selection = 121 seconds: selectedUnit would be Second, selectedDuration would be 121 > selectedUnit maxValue of 120),
|
||||
// selectedDuration would've been replaced by maxValue - isTriggered check prevents this by skipping LaunchedEffect on initial composition
|
||||
if (isTriggered.value) {
|
||||
val maxValue = timeUnitsLimits.firstOrNull { it.timeUnit == selectedUnit.value }?.maxValue
|
||||
if (maxValue != null && selectedDuration.value > maxValue) {
|
||||
selectedDuration.value = maxValue
|
||||
selectedUnitValues.value = getUnitValues(selectedUnit.value, selectedDuration.value)
|
||||
} else {
|
||||
selectedUnitValues.value = getUnitValues(selectedUnit.value, selectedDuration.value)
|
||||
selection.value = selectedUnit.value.toSeconds * selectedDuration.value
|
||||
}
|
||||
} else {
|
||||
isTriggered.value = true
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(selectedDuration.value) {
|
||||
selection.value = selectedUnit.value.toSeconds * selectedDuration.value
|
||||
}
|
||||
|
||||
Row(
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = DEFAULT_PADDING),
|
||||
horizontalArrangement = Arrangement.spacedBy(0.dp)
|
||||
) {
|
||||
Column(Modifier.weight(1f)) {
|
||||
val durationPickerState = rememberFWheelPickerState(selectedUnitValues.value.indexOf(selectedDuration.value))
|
||||
FVerticalWheelPicker(
|
||||
count = selectedUnitValues.value.count(),
|
||||
state = durationPickerState,
|
||||
unfocusedCount = 2,
|
||||
focus = {
|
||||
FWheelPickerFocusVertical(dividerColor = MaterialTheme.colors.primary)
|
||||
}
|
||||
) { index ->
|
||||
Text(
|
||||
selectedUnitValues.value[index].toString(),
|
||||
fontSize = 18.sp,
|
||||
color = MaterialTheme.colors.primary
|
||||
)
|
||||
}
|
||||
LaunchedEffect(durationPickerState) {
|
||||
snapshotFlow { durationPickerState.currentIndex }
|
||||
.collect {
|
||||
selectedDuration.value = selectedUnitValues.value[it]
|
||||
}
|
||||
}
|
||||
}
|
||||
Column(Modifier.weight(1f)) {
|
||||
val unitPickerState = rememberFWheelPickerState(timeUnitsLimits.indexOfFirst { it.timeUnit == selectedUnit.value })
|
||||
FVerticalWheelPicker(
|
||||
count = timeUnitsLimits.count(),
|
||||
state = unitPickerState,
|
||||
unfocusedCount = 2,
|
||||
focus = {
|
||||
FWheelPickerFocusVertical(dividerColor = MaterialTheme.colors.primary)
|
||||
}
|
||||
) { index ->
|
||||
Text(
|
||||
timeUnitsLimits[index].timeUnit.text,
|
||||
fontSize = 18.sp,
|
||||
color = MaterialTheme.colors.primary
|
||||
)
|
||||
}
|
||||
LaunchedEffect(unitPickerState) {
|
||||
snapshotFlow { unitPickerState.currentIndex }
|
||||
.collect {
|
||||
selectedUnit.value = timeUnitsLimits[it].timeUnit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -969,6 +969,16 @@ sealed class ChatInfo: SomeChat, NamedChat {
|
||||
is Group -> groupInfo.chatSettings
|
||||
else -> null
|
||||
}
|
||||
|
||||
val chatTs: Instant
|
||||
get() = when(this) {
|
||||
is Direct -> contact.chatTs ?: contact.updatedAt
|
||||
is Group -> groupInfo.chatTs ?: groupInfo.updatedAt
|
||||
is Local -> noteFolder.chatTs
|
||||
is ContactRequest -> contactRequest.updatedAt
|
||||
is ContactConnection -> contactConnection.updatedAt
|
||||
is InvalidJSON -> updatedAt
|
||||
}
|
||||
}
|
||||
|
||||
@Serializable
|
||||
@ -1009,6 +1019,7 @@ data class Contact(
|
||||
val mergedPreferences: ContactUserPreferences,
|
||||
override val createdAt: Instant,
|
||||
override val updatedAt: Instant,
|
||||
val chatTs: Instant?,
|
||||
val contactGroupMemberId: Long? = null,
|
||||
val contactGrpInvSent: Boolean
|
||||
): SomeChat, NamedChat {
|
||||
@ -1077,6 +1088,7 @@ data class Contact(
|
||||
mergedPreferences = ContactUserPreferences.sampleData,
|
||||
createdAt = Clock.System.now(),
|
||||
updatedAt = Clock.System.now(),
|
||||
chatTs = Clock.System.now(),
|
||||
contactGrpInvSent = false
|
||||
)
|
||||
}
|
||||
@ -1204,7 +1216,8 @@ data class GroupInfo (
|
||||
val hostConnCustomUserProfileId: Long? = null,
|
||||
val chatSettings: ChatSettings,
|
||||
override val createdAt: Instant,
|
||||
override val updatedAt: Instant
|
||||
override val updatedAt: Instant,
|
||||
val chatTs: Instant?
|
||||
): SomeChat, NamedChat {
|
||||
override val chatType get() = ChatType.Group
|
||||
override val id get() = "#$groupId"
|
||||
@ -1245,7 +1258,8 @@ data class GroupInfo (
|
||||
hostConnCustomUserProfileId = null,
|
||||
chatSettings = ChatSettings(enableNtfs = MsgFilter.All, sendRcpts = null, favorite = false),
|
||||
createdAt = Clock.System.now(),
|
||||
updatedAt = Clock.System.now()
|
||||
updatedAt = Clock.System.now(),
|
||||
chatTs = Clock.System.now()
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -1507,7 +1521,8 @@ class NoteFolder(
|
||||
val favorite: Boolean,
|
||||
val unread: Boolean,
|
||||
override val createdAt: Instant,
|
||||
override val updatedAt: Instant
|
||||
override val updatedAt: Instant,
|
||||
val chatTs: Instant
|
||||
): SomeChat, NamedChat {
|
||||
override val chatType get() = ChatType.Local
|
||||
override val id get() = "*$noteFolderId"
|
||||
@ -1530,7 +1545,8 @@ class NoteFolder(
|
||||
favorite = false,
|
||||
unread = false,
|
||||
createdAt = Clock.System.now(),
|
||||
updatedAt = Clock.System.now()
|
||||
updatedAt = Clock.System.now(),
|
||||
chatTs = Clock.System.now()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -68,12 +68,14 @@ fun ChatView(chatId: String, chatModel: ChatModel, onComposed: suspend (chatId:
|
||||
snapshotFlow { chatModel.chatId.value }
|
||||
.distinctUntilChanged()
|
||||
.onEach { Log.d(TAG, "TODOCHAT: chatId: activeChatId ${activeChat.value?.id} == new chatId $it ${activeChat.value?.id == it} ") }
|
||||
.filter { it != null && activeChat.value?.id != it }
|
||||
.filterNotNull()
|
||||
.collect { chatId ->
|
||||
// Redisplay the whole hierarchy if the chat is different to make going from groups to direct chat working correctly
|
||||
// Also for situation when chatId changes after clicking in notification, etc
|
||||
activeChat.value = chatModel.getChat(chatId!!)
|
||||
Log.d(TAG, "TODOCHAT: chatId: activeChatId became ${activeChat.value?.id}")
|
||||
if (activeChat.value?.id != chatId) {
|
||||
// Redisplay the whole hierarchy if the chat is different to make going from groups to direct chat working correctly
|
||||
// Also for situation when chatId changes after clicking in notification, etc
|
||||
activeChat.value = chatModel.getChat(chatId)
|
||||
Log.d(TAG, "TODOCHAT: chatId: activeChatId became ${activeChat.value?.id}")
|
||||
}
|
||||
markUnreadChatAsRead(activeChat, chatModel)
|
||||
}
|
||||
}
|
||||
@ -647,7 +649,7 @@ fun ChatInfoToolbar(
|
||||
}
|
||||
}
|
||||
|
||||
if (chat.chatInfo is ChatInfo.Direct && chat.chatInfo.contact.allowsFeature(ChatFeature.Calls)) {
|
||||
if (chat.chatInfo is ChatInfo.Direct && chat.chatInfo.contact.mergedPreferences.calls.enabled.forUser) {
|
||||
if (activeCall == null) {
|
||||
barButtons.add {
|
||||
if (appPlatform.isAndroid) {
|
||||
|
@ -59,14 +59,6 @@ fun SendMsgView(
|
||||
) {
|
||||
val showCustomDisappearingMessageDialog = remember { mutableStateOf(false) }
|
||||
|
||||
if (showCustomDisappearingMessageDialog.value) {
|
||||
CustomDisappearingMessageDialog(
|
||||
sendMessage = sendMessage,
|
||||
setShowDialog = { showCustomDisappearingMessageDialog.value = it },
|
||||
customDisappearingMessageTimePref = customDisappearingMessageTimePref
|
||||
)
|
||||
}
|
||||
|
||||
Box(Modifier.padding(vertical = 8.dp)) {
|
||||
val cs = composeState.value
|
||||
var progressByTimeout by rememberSaveable { mutableStateOf(false) }
|
||||
@ -203,6 +195,11 @@ fun SendMsgView(
|
||||
DefaultDropdownMenu(showDropdown) {
|
||||
menuItems.forEach { composable -> composable() }
|
||||
}
|
||||
CustomDisappearingMessageDialog(
|
||||
showCustomDisappearingMessageDialog,
|
||||
sendMessage = sendMessage,
|
||||
customDisappearingMessageTimePref = customDisappearingMessageTimePref
|
||||
)
|
||||
} else {
|
||||
SendMsgButton(icon, sendButtonSize, sendButtonAlpha, sendButtonColor, !sendMsgButtonDisabled, sendMessage)
|
||||
}
|
||||
@ -220,93 +217,43 @@ expect fun VoiceButtonWithoutPermissionByPlatform()
|
||||
|
||||
@Composable
|
||||
private fun CustomDisappearingMessageDialog(
|
||||
showMenu: MutableState<Boolean>,
|
||||
sendMessage: (Int?) -> Unit,
|
||||
setShowDialog: (Boolean) -> Unit,
|
||||
customDisappearingMessageTimePref: SharedPreference<Int>?
|
||||
) {
|
||||
val showCustomTimePicker = remember { mutableStateOf(false) }
|
||||
|
||||
if (showCustomTimePicker.value) {
|
||||
val selectedDisappearingMessageTime = remember {
|
||||
mutableStateOf(customDisappearingMessageTimePref?.get?.invoke() ?: 300)
|
||||
}
|
||||
CustomTimePickerDialog(
|
||||
selectedDisappearingMessageTime,
|
||||
title = generalGetString(MR.strings.delete_after),
|
||||
confirmButtonText = generalGetString(MR.strings.send_disappearing_message_send),
|
||||
confirmButtonAction = { ttl ->
|
||||
sendMessage(ttl)
|
||||
customDisappearingMessageTimePref?.set?.invoke(ttl)
|
||||
setShowDialog(false)
|
||||
},
|
||||
cancel = { setShowDialog(false) }
|
||||
DefaultDropdownMenu(showMenu) {
|
||||
Text(
|
||||
generalGetString(MR.strings.send_disappearing_message),
|
||||
Modifier.padding(vertical = DEFAULT_PADDING_HALF, horizontal = DEFAULT_PADDING * 1.5f),
|
||||
fontSize = 16.sp,
|
||||
color = MaterialTheme.colors.secondary
|
||||
)
|
||||
} else {
|
||||
@Composable
|
||||
fun ChoiceButton(
|
||||
text: String,
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
TextButton(onClick) {
|
||||
Text(
|
||||
text,
|
||||
fontSize = 18.sp,
|
||||
color = MaterialTheme.colors.primary
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
DefaultDialog(onDismissRequest = { setShowDialog(false) }) {
|
||||
Surface(
|
||||
shape = RoundedCornerShape(corner = CornerSize(25.dp)),
|
||||
contentColor = LocalContentColor.current
|
||||
) {
|
||||
Box(
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.padding(DEFAULT_PADDING),
|
||||
verticalArrangement = Arrangement.spacedBy(6.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Text(" ") // centers title
|
||||
Text(
|
||||
generalGetString(MR.strings.send_disappearing_message),
|
||||
fontSize = 16.sp,
|
||||
color = MaterialTheme.colors.secondary
|
||||
)
|
||||
Icon(
|
||||
painterResource(MR.images.ic_close),
|
||||
generalGetString(MR.strings.icon_descr_close_button),
|
||||
tint = MaterialTheme.colors.secondary,
|
||||
modifier = Modifier
|
||||
.size(25.dp)
|
||||
.clickable { setShowDialog(false) }
|
||||
)
|
||||
}
|
||||
ChoiceButton(generalGetString(MR.strings.send_disappearing_message_30_seconds)) {
|
||||
sendMessage(30)
|
||||
setShowDialog(false)
|
||||
}
|
||||
ChoiceButton(generalGetString(MR.strings.send_disappearing_message_1_minute)) {
|
||||
sendMessage(60)
|
||||
setShowDialog(false)
|
||||
}
|
||||
ChoiceButton(generalGetString(MR.strings.send_disappearing_message_5_minutes)) {
|
||||
sendMessage(300)
|
||||
setShowDialog(false)
|
||||
}
|
||||
ChoiceButton(generalGetString(MR.strings.send_disappearing_message_custom_time)) {
|
||||
showCustomTimePicker.value = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ItemAction(generalGetString(MR.strings.send_disappearing_message_30_seconds)) {
|
||||
sendMessage(30)
|
||||
showMenu.value = false
|
||||
}
|
||||
ItemAction(generalGetString(MR.strings.send_disappearing_message_1_minute)) {
|
||||
sendMessage(60)
|
||||
showMenu.value = false
|
||||
}
|
||||
ItemAction(generalGetString(MR.strings.send_disappearing_message_5_minutes)) {
|
||||
sendMessage(300)
|
||||
showMenu.value = false
|
||||
}
|
||||
ItemAction(generalGetString(MR.strings.send_disappearing_message_custom_time)) {
|
||||
showMenu.value = false
|
||||
val selectedDisappearingMessageTime = mutableStateOf(customDisappearingMessageTimePref?.get?.invoke() ?: 300)
|
||||
showCustomTimePickerDialog(
|
||||
selectedDisappearingMessageTime,
|
||||
title = generalGetString(MR.strings.delete_after),
|
||||
confirmButtonText = generalGetString(MR.strings.send_disappearing_message_send),
|
||||
confirmButtonAction = { ttl ->
|
||||
sendMessage(ttl)
|
||||
customDisappearingMessageTimePref?.set?.invoke(ttl)
|
||||
},
|
||||
cancel = { showMenu.value = false }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ fun getContactsToAdd(chatModel: ChatModel, search: String): List<Contact> {
|
||||
.map { it.chatInfo }
|
||||
.filterIsInstance<ChatInfo.Direct>()
|
||||
.map { it.contact }
|
||||
.filter { it.contactId !in memberContactIds && it.chatViewName.lowercase().contains(s) }
|
||||
.filter { c -> c.ready && c.active && c.contactId !in memberContactIds && c.chatViewName.lowercase().contains(s) }
|
||||
.sortedBy { it.displayName.lowercase() }
|
||||
.toList()
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ fun ChatItemView(
|
||||
setReaction(cInfo, cItem, !r.userReacted, r.reaction)
|
||||
}
|
||||
}
|
||||
Row(modifier.padding(2.dp)) {
|
||||
Row(modifier.padding(2.dp), verticalAlignment = Alignment.CenterVertically) {
|
||||
ReactionIcon(r.reaction.text, fontSize = 12.sp)
|
||||
if (r.totalReacted > 1) {
|
||||
Spacer(Modifier.width(4.dp))
|
||||
@ -112,7 +112,6 @@ fun ChatItemView(
|
||||
fontSize = 11.5.sp,
|
||||
fontWeight = if (r.userReacted) FontWeight.Bold else FontWeight.Normal,
|
||||
color = if (r.userReacted) MaterialTheme.colors.primary else MaterialTheme.colors.secondary,
|
||||
modifier = if (appPlatform.isAndroid) Modifier else Modifier.padding(top = 4.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -651,6 +650,23 @@ fun ItemAction(text: String, icon: ImageVector, onClick: () -> Unit, color: Colo
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ItemAction(text: String, color: Color = Color.Unspecified, onClick: () -> Unit) {
|
||||
val finalColor = if (color == Color.Unspecified) {
|
||||
MenuTextColor
|
||||
} else color
|
||||
DropdownMenuItem(onClick, contentPadding = PaddingValues(horizontal = DEFAULT_PADDING * 1.5f)) {
|
||||
Text(
|
||||
text,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.weight(1F)
|
||||
.padding(end = 15.dp),
|
||||
color = finalColor
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun cancelFileAlertDialog(fileId: Long, cancelFile: (Long) -> Unit, cancelAction: CancelAction) {
|
||||
AlertManager.shared.showAlertDialog(
|
||||
title = generalGetString(cancelAction.alert.titleId),
|
||||
|
@ -91,7 +91,7 @@ private fun MergedMarkedDeletedText(chatItem: ChatItem, revealed: MutableState<B
|
||||
)
|
||||
}
|
||||
|
||||
private fun markedDeletedText(meta: CIMeta): String =
|
||||
fun markedDeletedText(meta: CIMeta): String =
|
||||
when (meta.itemDeleted) {
|
||||
is CIDeleted.Moderated ->
|
||||
String.format(generalGetString(MR.strings.moderated_item_description), meta.itemDeleted.byGroupMember.displayName)
|
||||
|
@ -26,6 +26,7 @@ import chat.simplex.common.views.helpers.*
|
||||
import chat.simplex.common.model.*
|
||||
import chat.simplex.common.model.GroupInfo
|
||||
import chat.simplex.common.platform.chatModel
|
||||
import chat.simplex.common.views.chat.item.markedDeletedText
|
||||
import chat.simplex.res.MR
|
||||
import dev.icerock.moko.resources.ImageResource
|
||||
|
||||
@ -170,7 +171,7 @@ fun ChatPreviewView(
|
||||
val (text: CharSequence, inlineTextContent) = when {
|
||||
chatModelDraftChatId == chat.id && chatModelDraft != null -> remember(chatModelDraft) { messageDraft(chatModelDraft) }
|
||||
ci.meta.itemDeleted == null -> ci.text to null
|
||||
else -> generalGetString(MR.strings.marked_deleted_description) to null
|
||||
else -> markedDeletedText(ci.meta) to null
|
||||
}
|
||||
val formattedText = when {
|
||||
chatModelDraftChatId == chat.id && chatModelDraft != null -> null
|
||||
@ -286,7 +287,7 @@ fun ChatPreviewView(
|
||||
Box(
|
||||
contentAlignment = Alignment.TopEnd
|
||||
) {
|
||||
val ts = chat.chatItems.lastOrNull()?.timestampText ?: getTimestampText(chat.chatInfo.updatedAt)
|
||||
val ts = chat.chatItems.lastOrNull()?.timestampText ?: getTimestampText(chat.chatInfo.chatTs)
|
||||
Text(
|
||||
ts,
|
||||
color = MaterialTheme.colors.secondary,
|
||||
|
@ -1,116 +1,21 @@
|
||||
package chat.simplex.common.views.helpers
|
||||
|
||||
import androidx.compose.foundation.clickable
|
||||
import SectionItemView
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.CornerSize
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import dev.icerock.moko.resources.compose.painterResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.window.Dialog
|
||||
import chat.simplex.common.ui.theme.DEFAULT_PADDING
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import chat.simplex.common.model.CustomTimeUnit
|
||||
import chat.simplex.common.model.timeText
|
||||
import chat.simplex.res.MR
|
||||
import com.sd.lib.compose.wheel_picker.*
|
||||
|
||||
@Composable
|
||||
fun CustomTimePicker(
|
||||
expect fun CustomTimePicker(
|
||||
selection: MutableState<Int>,
|
||||
timeUnitsLimits: List<TimeUnitLimits> = TimeUnitLimits.defaultUnitsLimits
|
||||
) {
|
||||
fun getUnitValues(unit: CustomTimeUnit, selectedValue: Int): List<Int> {
|
||||
val unitLimits = timeUnitsLimits.firstOrNull { it.timeUnit == unit } ?: TimeUnitLimits.defaultUnitLimits(unit)
|
||||
val regularUnitValues = (unitLimits.minValue..unitLimits.maxValue).toList()
|
||||
return regularUnitValues + if (regularUnitValues.contains(selectedValue)) emptyList() else listOf(selectedValue)
|
||||
}
|
||||
|
||||
val (unit, duration) = CustomTimeUnit.toTimeUnit(selection.value)
|
||||
val selectedUnit: MutableState<CustomTimeUnit> = remember { mutableStateOf(unit) }
|
||||
val selectedDuration = remember { mutableStateOf(duration) }
|
||||
val selectedUnitValues = remember { mutableStateOf(getUnitValues(selectedUnit.value, selectedDuration.value)) }
|
||||
val isTriggered = remember { mutableStateOf(false) }
|
||||
|
||||
LaunchedEffect(selectedUnit.value) {
|
||||
// on initial composition, if passed selection doesn't fit into picker bounds, so that selectedDuration is bigger than selectedUnit maxValue
|
||||
// (e.g., for selection = 121 seconds: selectedUnit would be Second, selectedDuration would be 121 > selectedUnit maxValue of 120),
|
||||
// selectedDuration would've been replaced by maxValue - isTriggered check prevents this by skipping LaunchedEffect on initial composition
|
||||
if (isTriggered.value) {
|
||||
val maxValue = timeUnitsLimits.firstOrNull { it.timeUnit == selectedUnit.value }?.maxValue
|
||||
if (maxValue != null && selectedDuration.value > maxValue) {
|
||||
selectedDuration.value = maxValue
|
||||
selectedUnitValues.value = getUnitValues(selectedUnit.value, selectedDuration.value)
|
||||
} else {
|
||||
selectedUnitValues.value = getUnitValues(selectedUnit.value, selectedDuration.value)
|
||||
selection.value = selectedUnit.value.toSeconds * selectedDuration.value
|
||||
}
|
||||
} else {
|
||||
isTriggered.value = true
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(selectedDuration.value) {
|
||||
selection.value = selectedUnit.value.toSeconds * selectedDuration.value
|
||||
}
|
||||
|
||||
Row(
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = DEFAULT_PADDING),
|
||||
horizontalArrangement = Arrangement.spacedBy(0.dp)
|
||||
) {
|
||||
Column(Modifier.weight(1f)) {
|
||||
val durationPickerState = rememberFWheelPickerState(selectedUnitValues.value.indexOf(selectedDuration.value))
|
||||
FVerticalWheelPicker(
|
||||
count = selectedUnitValues.value.count(),
|
||||
state = durationPickerState,
|
||||
unfocusedCount = 2,
|
||||
focus = {
|
||||
FWheelPickerFocusVertical(dividerColor = MaterialTheme.colors.primary)
|
||||
}
|
||||
) { index ->
|
||||
Text(
|
||||
selectedUnitValues.value[index].toString(),
|
||||
fontSize = 18.sp,
|
||||
color = MaterialTheme.colors.primary
|
||||
)
|
||||
}
|
||||
LaunchedEffect(durationPickerState) {
|
||||
snapshotFlow { durationPickerState.currentIndex }
|
||||
.collect {
|
||||
selectedDuration.value = selectedUnitValues.value[it]
|
||||
}
|
||||
}
|
||||
}
|
||||
Column(Modifier.weight(1f)) {
|
||||
val unitPickerState = rememberFWheelPickerState(timeUnitsLimits.indexOfFirst { it.timeUnit == selectedUnit.value })
|
||||
FVerticalWheelPicker(
|
||||
count = timeUnitsLimits.count(),
|
||||
state = unitPickerState,
|
||||
unfocusedCount = 2,
|
||||
focus = {
|
||||
FWheelPickerFocusVertical(dividerColor = MaterialTheme.colors.primary)
|
||||
}
|
||||
) { index ->
|
||||
Text(
|
||||
timeUnitsLimits[index].timeUnit.text,
|
||||
fontSize = 18.sp,
|
||||
color = MaterialTheme.colors.primary
|
||||
)
|
||||
}
|
||||
LaunchedEffect(unitPickerState) {
|
||||
snapshotFlow { unitPickerState.currentIndex }
|
||||
.collect {
|
||||
selectedUnit.value = timeUnitsLimits[it].timeUnit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
data class TimeUnitLimits(
|
||||
val timeUnit: CustomTimeUnit,
|
||||
@ -141,8 +46,7 @@ data class TimeUnitLimits(
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun CustomTimePickerDialog(
|
||||
fun showCustomTimePickerDialog(
|
||||
selection: MutableState<Int>,
|
||||
timeUnitsLimits: List<TimeUnitLimits> = TimeUnitLimits.defaultUnitsLimits,
|
||||
title: String,
|
||||
@ -150,53 +54,26 @@ fun CustomTimePickerDialog(
|
||||
confirmButtonAction: (Int) -> Unit,
|
||||
cancel: () -> Unit
|
||||
) {
|
||||
DefaultDialog(onDismissRequest = cancel) {
|
||||
Surface(
|
||||
shape = RoundedCornerShape(corner = CornerSize(25.dp)),
|
||||
contentColor = LocalContentColor.current
|
||||
) {
|
||||
Box(
|
||||
contentAlignment = Alignment.Center
|
||||
AlertManager.shared.showAlertDialogButtonsColumn(
|
||||
title = title,
|
||||
onDismissRequest = cancel
|
||||
) {
|
||||
Column(horizontalAlignment = Alignment.CenterHorizontally) {
|
||||
CustomTimePicker(
|
||||
selection,
|
||||
timeUnitsLimits
|
||||
)
|
||||
SectionItemView({
|
||||
AlertManager.shared.hideAlert()
|
||||
confirmButtonAction(selection.value)
|
||||
}
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.padding(DEFAULT_PADDING),
|
||||
verticalArrangement = Arrangement.spacedBy(6.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Text(" ") // centers title
|
||||
Text(
|
||||
title,
|
||||
fontSize = 16.sp,
|
||||
color = MaterialTheme.colors.secondary
|
||||
)
|
||||
Icon(
|
||||
painterResource(MR.images.ic_close),
|
||||
generalGetString(MR.strings.icon_descr_close_button),
|
||||
tint = MaterialTheme.colors.secondary,
|
||||
modifier = Modifier
|
||||
.size(25.dp)
|
||||
.clickable { cancel() }
|
||||
)
|
||||
}
|
||||
|
||||
CustomTimePicker(
|
||||
selection,
|
||||
timeUnitsLimits
|
||||
)
|
||||
|
||||
TextButton(onClick = { confirmButtonAction(selection.value) }) {
|
||||
Text(
|
||||
confirmButtonText,
|
||||
fontSize = 18.sp,
|
||||
color = MaterialTheme.colors.primary
|
||||
)
|
||||
}
|
||||
}
|
||||
Text(
|
||||
confirmButtonText,
|
||||
Modifier.fillMaxWidth(),
|
||||
textAlign = TextAlign.Center,
|
||||
color = MaterialTheme.colors.primary
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -220,7 +97,6 @@ fun DropdownCustomTimePickerSettingRow(
|
||||
|
||||
val dropdownSelection: MutableState<DropdownSelection> = remember { mutableStateOf(DropdownSelection.DropdownValue(selection.value)) }
|
||||
val values: MutableState<List<DropdownSelection>> = remember { mutableStateOf(getValues(selection.value)) }
|
||||
val showCustomTimePicker = remember { mutableStateOf(false) }
|
||||
|
||||
fun updateValue(selectedValue: Int?) {
|
||||
values.value = getValues(selectedValue)
|
||||
@ -247,28 +123,22 @@ fun DropdownCustomTimePickerSettingRow(
|
||||
onSelected = { sel: DropdownSelection ->
|
||||
when (sel) {
|
||||
is DropdownSelection.DropdownValue -> updateValue(sel.value)
|
||||
DropdownSelection.Custom -> showCustomTimePicker.value = true
|
||||
DropdownSelection.Custom -> {
|
||||
val selectedCustomTime = mutableStateOf(selection.value ?: 86400)
|
||||
showCustomTimePickerDialog(
|
||||
selectedCustomTime,
|
||||
timeUnitsLimits = customPickerTimeUnitsLimits,
|
||||
title = customPickerTitle,
|
||||
confirmButtonText = customPickerConfirmButtonText,
|
||||
confirmButtonAction = ::updateValue,
|
||||
cancel = {
|
||||
dropdownSelection.value = DropdownSelection.DropdownValue(selection.value)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
if (showCustomTimePicker.value) {
|
||||
val selectedCustomTime = remember { mutableStateOf(selection.value ?: 86400) }
|
||||
CustomTimePickerDialog(
|
||||
selectedCustomTime,
|
||||
timeUnitsLimits = customPickerTimeUnitsLimits,
|
||||
title = customPickerTitle,
|
||||
confirmButtonText = customPickerConfirmButtonText,
|
||||
confirmButtonAction = { time ->
|
||||
updateValue(time)
|
||||
showCustomTimePicker.value = false
|
||||
},
|
||||
cancel = {
|
||||
dropdownSelection.value = DropdownSelection.DropdownValue(selection.value)
|
||||
showCustomTimePicker.value = false
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class DropdownSelection {
|
||||
|
@ -36,7 +36,7 @@ fun WhatsNewView(viaSettings: Boolean = false, close: () -> Unit) {
|
||||
Icon(
|
||||
painterResource(MR.images.ic_open_in_new), stringResource(titleId), tint = MaterialTheme.colors.primary,
|
||||
modifier = Modifier
|
||||
.clickable { uriHandler.openUriCatching(link) }
|
||||
.clickable { if (link.startsWith("simplex:")) uriHandler.openVerifiedSimplexUri(link) else uriHandler.openUriCatching(link) }
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,80 @@
|
||||
package chat.simplex.common.views.helpers
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import chat.simplex.common.model.CustomTimeUnit
|
||||
import chat.simplex.common.ui.theme.DEFAULT_PADDING
|
||||
|
||||
@Composable
|
||||
actual fun CustomTimePicker(
|
||||
selection: MutableState<Int>,
|
||||
timeUnitsLimits: List<TimeUnitLimits>
|
||||
) {
|
||||
val unit = remember {
|
||||
var res: CustomTimeUnit = CustomTimeUnit.Second
|
||||
val found = timeUnitsLimits.asReversed().any {
|
||||
if (selection.value >= it.minValue * it.timeUnit.toSeconds && selection.value <= it.maxValue * it.timeUnit.toSeconds) {
|
||||
res = it.timeUnit
|
||||
selection.value = (selection.value / it.timeUnit.toSeconds).coerceIn(it.minValue, it.maxValue) * it.timeUnit.toSeconds
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
// If custom interval doesn't fit in any category, set it to 1 second interval
|
||||
selection.value = 1
|
||||
}
|
||||
mutableStateOf(res)
|
||||
}
|
||||
val values = remember(unit.value) {
|
||||
val limit = timeUnitsLimits.first { it.timeUnit == unit.value }
|
||||
val res = ArrayList<Pair<Int, String>>()
|
||||
for (i in limit.minValue..limit.maxValue) {
|
||||
val seconds = i * limit.timeUnit.toSeconds
|
||||
val desc = i.toString()
|
||||
res.add(seconds to desc)
|
||||
}
|
||||
if (res.none { it.first == selection.value }) {
|
||||
// Doesn't fit into min..max, put it equal to the closest value
|
||||
selection.value = selection.value.coerceIn(res.first().first, res.last().first)
|
||||
//selection.value = res.last { it.first <= selection.value }.first
|
||||
}
|
||||
res
|
||||
}
|
||||
val units = remember {
|
||||
val res = ArrayList<Pair<CustomTimeUnit, String>>()
|
||||
for (unit in timeUnitsLimits) {
|
||||
res.add(unit.timeUnit to unit.timeUnit.text)
|
||||
}
|
||||
res
|
||||
}
|
||||
|
||||
Row(
|
||||
Modifier.padding(bottom = DEFAULT_PADDING),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceEvenly
|
||||
) {
|
||||
ExposedDropDownSetting(
|
||||
values,
|
||||
selection,
|
||||
textColor = MaterialTheme.colors.onBackground,
|
||||
enabled = remember { mutableStateOf(true) },
|
||||
onSelected = { selection.value = it }
|
||||
)
|
||||
Spacer(Modifier.width(DEFAULT_PADDING))
|
||||
ExposedDropDownSetting(
|
||||
units,
|
||||
unit,
|
||||
textColor = MaterialTheme.colors.onBackground,
|
||||
enabled = remember { mutableStateOf(true) },
|
||||
onSelected = {
|
||||
selection.value = selection.value / unit.value.toSeconds * it.toSeconds
|
||||
unit.value = it
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
@ -25,11 +25,11 @@ android.nonTransitiveRClass=true
|
||||
android.enableJetifier=true
|
||||
kotlin.mpp.androidSourceSetLayoutVersion=2
|
||||
|
||||
android.version_name=5.5-beta.2
|
||||
android.version_code=174
|
||||
android.version_name=5.5
|
||||
android.version_code=175
|
||||
|
||||
desktop.version_name=5.5-beta.2
|
||||
desktop.version_code=25
|
||||
desktop.version_name=5.5
|
||||
desktop.version_code=26
|
||||
|
||||
kotlin.version=1.8.20
|
||||
gradle.plugin.version=7.4.2
|
||||
|
@ -0,0 +1,119 @@
|
||||
---
|
||||
layout: layouts/article.html
|
||||
title: "SimpleX Chat: free infrastructure from Linode, v5.5 released with private notes, group history and a simpler UX to connect."
|
||||
date: 2024-01-24
|
||||
previewBody: blog_previews/20240124.html
|
||||
image: images/20240124-connect1.png
|
||||
permalink: "/blog/20240124-simplex-chat-infrastructure-costs-v5-5-simplex-ux-private-notes-group-history.html"
|
||||
---
|
||||
|
||||
# SimpleX Chat: free infrastructure from Linode, v5.5 released with private notes, group history and a simpler UX to connect.
|
||||
|
||||
**Published:** Jan 24, 2024
|
||||
|
||||
[SimpleX Chat infrastructure on Linode](#simplex-chat-infrastructure-on-linode):
|
||||
- Free infrastructure.
|
||||
- SimpleX servers in Linode Marketplace.
|
||||
- High capacity messaging servers.
|
||||
|
||||
What's new in v5.5:
|
||||
- [private notes](#private-notes)
|
||||
- [group history](#group-history)
|
||||
- [simpler UX to connect to other users](#simpler-ux-to-connect-to-other-users)
|
||||
- [message delivery stability and other improvements](#message-delivery-stability-and-other-improvements)
|
||||
|
||||
Also, we added Hungarian (only Android) and Turkish interface languages, thanks to [our users and Weblate](https://github.com/simplex-chat/simplex-chat#help-translating-simplex-chat).
|
||||
|
||||
SimpleX Chat Android app is now available in 20 languages!
|
||||
|
||||
## SimpleX Chat infrastructure on Linode
|
||||
|
||||
We chose Linode as our hosting provider as and they have been consistently reliable, cheaper than alternatives, with excellent support and great documentation.
|
||||
|
||||
When Linode was acquired by Akamai, we were a bit nervous about how it may affect service quality. So far it's been working out quite well.
|
||||
|
||||
As the usage of SimpleX network was growing, so did our hosting costs, and from being really small they started to become significant, particularly as we didn't yet manage to optimize the servers last year.
|
||||
|
||||
Linode helped - we're really excited to announce that Akamai decided to support SimpleX Chat growth by accepting it into their [Linode Rise startup program](https://www.linode.com/linode-for-startups/).
|
||||
|
||||
Thanks to this program:
|
||||
|
||||
- we received free infrastructure for the first year up to $10,000 per month, no strings attached. It already saved us some money, and gave us enough time to optimize the servers - the latest version of the servers are much less costly to operate with the current traffic, and can support a much larger traffic within this limit. In the year 2 of the program we will receive 50% discount with unlimited traffic, and in year 3 - 25% discount.
|
||||
|
||||
- Linode Marketplace now includes [SimpleX Chat messages and file servers](https://www.linode.com/marketplace/apps/simplex-chat/simplex-chat/) - you can get free $100 credits for the first 2 months and run your own servers in just a few clicks, and use them in SimpleX Chat apps. Anybody can submit their application to Linode marketplace, but dedicated support we have from Linode team via this program made it simpler.
|
||||
|
||||
- Akamai solution engineers are helping us to design high capacity server solution, free of charge, so that a single host can provide horizontally scalable capacity for messaging, allowing for a much larger number of concurrent users on a single server address. Initially we considered using HAProxy, and the latest proof of concept uses OpenResty - a fork of Nginx with Lua script engine - to route requests from a single host to multiple SMP relays, reducing an overhead for the clients that would be configured with a smaller number of higher capacity servers. This project is still in progress, there will be more details as we roll it out.
|
||||
|
||||
## What's new in v5.5
|
||||
|
||||
### Private notes
|
||||
|
||||
<img src="./images/20240124-notes1.png" width="220" class="float-to-left"> <img src="./images/20240124-notes2.png" width="220" class="float-to-left">
|
||||
|
||||
*"Where do I put notes for myself?"* was a very common support question. There was a workaround - you could create an empty group, just with yourself, and use it to save notes, but it was not very convenient, and you could accidentally add members there.
|
||||
|
||||
This version has a more convenient and private alternative - the Private notes. It looks like an ordinary conversation where you can put text messages, links with previews, and any media and files, but they are not sent anywhere - they are stored locally, only on your device, with encrypted files.
|
||||
|
||||
You can access the Private notes created in mobile app from desktop app too, by linking a mobile and desktop apps - the feature [added in the previous version](./20231125-simplex-chat-v5-4-link-mobile-desktop-quantum-resistant-better-groups.md). It allows to conveniently share files between the devices without sending them over the Internet.
|
||||
|
||||
### Group history
|
||||
|
||||
<img src="./images/20240124-history1.png" width="220" class="float-to-left"> <img src="./images/20240124-history2.png" width="220" class="float-to-left">
|
||||
|
||||
In the previous version, when users joined groups, they only saw an empty conversation, and the notifications of being connected to other members. This version allows group admins sending recent group history to the new members - this option is enabled by default for new groups, and can be enabled for the existing groups in the preferences. So now new members can join the conversation as soon as they join.
|
||||
|
||||
This does not mean that these messages are stored on any servers - the admin member that adds a new member to the group sends these messages directly when a new member joins. Groups are still fully decentralized, do not have any identity on the network, and fully private - only their members know they exist.
|
||||
|
||||
That is, unless a group owner decides to make it public. Groups can be registered in [SimpleX groups directory](https://simplex.chat/contact#/?v=1-4&smp=smp%3A%2F%2Fu2dS9sG8nMNURyZwqASV4yROM28Er0luVTx5X1CsMrU%3D%40smp4.simplex.im%2FeXSPwqTkKyDO3px4fLf1wx3MvPdjdLW3%23%2F%3Fv%3D1-2%26dh%3DMCowBQYDK2VuAyEAaiv6MkMH44L2TcYrt_CsX3ZvM11WgbMEUn0hkIKTOho%253D%26srv%3Do5vmywmrnaxalvz6wi3zicyftgio6psuvyniis6gco6bp6ekl4cqj4id.onion) to be discovered by the new members - group directory is also improved.
|
||||
|
||||
### Simpler UX to connect to other users
|
||||
|
||||
<img src="./images/20240124-connect1.png" width="220" class="float-to-left"> <img src="./images/20240124-connect2.png" width="220" class="float-to-left">
|
||||
|
||||
SimpleX platform has no user accounts or identities, and while it improves metadata privacy, it also makes it harder to understand how to connect to other people, particularly for the new users who are not invited by the existing users.
|
||||
|
||||
This version simplifies this interface by allowing to connect via the received link just by pasting the address into the search bar, as is common in many wallet apps and some other decentralized messengers. We also improved the interface of creating invitation links.
|
||||
|
||||
We will continue working on improving and simplifying user interface throughout the year. Please send us any feedback and suggestions to the team's address available in the app.
|
||||
|
||||
### Message delivery stability and other improvements
|
||||
|
||||
One of the long standing issues was that message reception could get stuck in some rare occasions, and only get resumed once the app is fully restarted. As Android app includes an always-on notification service that runs in background, full restart should be done via the app settings.
|
||||
|
||||
This version fixed many issues with message delivery stability and also added some diagnostics to identify any other cases when message delivery may stop. These fixes should also reduce battery usage, particularly on slow internet connections.
|
||||
|
||||
Other improvements in this version:
|
||||
- you can now reveal secret messages by tapping. To send a secret message wrap in "#" characters, e.g. "\#password\#".
|
||||
- you can delete the last user profile, simplifying account deletion. If you have [hidden user profiles](./20230328-simplex-chat-v4-6-hidden-profiles.md), they won't be deleted in this case, and will be accessible again once you create a new profile.
|
||||
|
||||
## SimpleX platform
|
||||
|
||||
Some links to answer the most common questions:
|
||||
|
||||
[How can SimpleX deliver messages without user identifiers](./20220511-simplex-chat-v2-images-files.md#the-first-messaging-platform-without-user-identifiers).
|
||||
|
||||
[What are the risks to have identifiers assigned to the users](./20220711-simplex-chat-v3-released-ios-notifications-audio-video-calls-database-export-import-protocol-improvements.md#why-having-users-identifiers-is-bad-for-the-users).
|
||||
|
||||
[Technical details and limitations](https://github.com/simplex-chat/simplex-chat#privacy-technical-details-and-limitations).
|
||||
|
||||
[How SimpleX is different from Session, Matrix, Signal, etc.](https://github.com/simplex-chat/simplex-chat/blob/stable/README.md#frequently-asked-questions).
|
||||
|
||||
Please also see our [website](https://simplex.chat).
|
||||
|
||||
## Help us with donations
|
||||
|
||||
Huge thank you to everybody who donated to SimpleX Chat!
|
||||
|
||||
We are prioritizing users privacy and security - it would be impossible without your support.
|
||||
|
||||
Our pledge to our users is that SimpleX protocols are and will remain open, and in public domain, - so anybody can build the future implementations of the clients and the servers. We are building SimpleX platform based on the same principles as email and web, but much more private and secure.
|
||||
|
||||
Your donations help us raise more funds – any amount, even the price of the cup of coffee, makes a big difference for us.
|
||||
|
||||
See [this section](https://github.com/simplex-chat/simplex-chat/tree/master#help-us-with-donations) for the ways to donate.
|
||||
|
||||
Thank you,
|
||||
|
||||
Evgeny
|
||||
|
||||
SimpleX Chat founder
|
@ -1,5 +1,20 @@
|
||||
# Blog
|
||||
|
||||
Jan 24, 2024 [SimpleX Chat: free infrastructure from Linode, v5.5 released](./20240124-simplex-chat-infrastructure-costs-v5-5-simplex-ux-private-notes-group-history.md)
|
||||
|
||||
SimpleX Chat infrastructure on Linode:
|
||||
- Free infrastructure.
|
||||
- SimpleX servers in Linode Marketplace.
|
||||
- High capacity messaging servers.
|
||||
|
||||
What's new in v5.5:
|
||||
- private notes.
|
||||
- group history.
|
||||
- simpler UX to connect to other users.
|
||||
- message delivery stability and other improvements.
|
||||
|
||||
---
|
||||
|
||||
Nov 25, 2023 [SimpleX Chat v5.4 released](./20231125-simplex-chat-v5-4-link-mobile-desktop-quantum-resistant-better-groups.md)
|
||||
|
||||
- Link mobile and desktop apps via secure quantum-resistant protocol. 🔗
|
||||
|
BIN
blog/images/20240124-connect1.png
Normal file
BIN
blog/images/20240124-connect1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 358 KiB |
BIN
blog/images/20240124-connect2.png
Normal file
BIN
blog/images/20240124-connect2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 323 KiB |
BIN
blog/images/20240124-history1.png
Normal file
BIN
blog/images/20240124-history1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 303 KiB |
BIN
blog/images/20240124-history2.png
Normal file
BIN
blog/images/20240124-history2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 363 KiB |
BIN
blog/images/20240124-notes1.png
Normal file
BIN
blog/images/20240124-notes1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 259 KiB |
BIN
blog/images/20240124-notes2.png
Normal file
BIN
blog/images/20240124-notes2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 256 KiB |
@ -7,7 +7,7 @@ revision: 25.11.2023
|
||||
| Updated 25.11.2023 | Languages: EN |
|
||||
# Download SimpleX apps
|
||||
|
||||
The latest stable version is v5.4.3.
|
||||
The latest stable version is v5.5.
|
||||
|
||||
You can get the latest beta releases from [GitHub](https://github.com/simplex-chat/simplex-chat/releases).
|
||||
|
||||
@ -21,24 +21,24 @@ You can get the latest beta releases from [GitHub](https://github.com/simplex-ch
|
||||
|
||||
Using the same profile as on mobile device is not yet supported – you need to create a separate profile to use desktop apps.
|
||||
|
||||
**Linux**: [AppImage](https://github.com/simplex-chat/simplex-chat/releases/download/v5.4.3/simplex-desktop-x86_64.AppImage) (most Linux distros), [Ubuntu 20.04](https://github.com/simplex-chat/simplex-chat/releases/download/v5.4.3/simplex-desktop-ubuntu-20_04-x86_64.deb) (and Debian-based distros), [Ubuntu 22.04](https://github.com/simplex-chat/simplex-chat/releases/download/v5.4.3/simplex-desktop-ubuntu-22_04-x86_64.deb).
|
||||
**Linux**: [AppImage](https://github.com/simplex-chat/simplex-chat/releases/download/v5.5.0/simplex-desktop-x86_64.AppImage) (most Linux distros), [Ubuntu 20.04](https://github.com/simplex-chat/simplex-chat/releases/download/v5.5.0/simplex-desktop-ubuntu-20_04-x86_64.deb) (and Debian-based distros), [Ubuntu 22.04](https://github.com/simplex-chat/simplex-chat/releases/download/v5.5.0/simplex-desktop-ubuntu-22_04-x86_64.deb).
|
||||
|
||||
**Mac**: [x86_64](https://github.com/simplex-chat/simplex-chat/releases/download/v5.4.3/simplex-desktop-macos-x86_64.dmg) (Intel), [aarch64](https://github.com/simplex-chat/simplex-chat/releases/download/v5.4.3/simplex-desktop-macos-aarch64.dmg) (Apple Silicon).
|
||||
**Mac**: [x86_64](https://github.com/simplex-chat/simplex-chat/releases/download/v5.5.0/simplex-desktop-macos-x86_64.dmg) (Intel), [aarch64](https://github.com/simplex-chat/simplex-chat/releases/download/v5.5.0/simplex-desktop-macos-aarch64.dmg) (Apple Silicon).
|
||||
|
||||
**Windows**: [x86_64](https://github.com/simplex-chat/simplex-chat/releases/download/v5.4.3/simplex-desktop-windows-x86_64.msi).
|
||||
**Windows**: [x86_64](https://github.com/simplex-chat/simplex-chat/releases/download/v5.5.0/simplex-desktop-windows-x86_64.msi).
|
||||
|
||||
## Mobile apps
|
||||
|
||||
**iOS**: [App store](https://apps.apple.com/us/app/simplex-chat/id1605771084), [TestFlight](https://testflight.apple.com/join/DWuT2LQu).
|
||||
|
||||
**Android**: [Play store](https://play.google.com/store/apps/details?id=chat.simplex.app), [F-Droid](https://simplex.chat/fdroid/), [APK aarch64](https://github.com/simplex-chat/simplex-chat/releases/download/v5.4.3/simplex.apk), [APK armv7](https://github.com/simplex-chat/simplex-chat/releases/download/v5.4.3/simplex-armv7a.apk).
|
||||
**Android**: [Play store](https://play.google.com/store/apps/details?id=chat.simplex.app), [F-Droid](https://simplex.chat/fdroid/), [APK aarch64](https://github.com/simplex-chat/simplex-chat/releases/download/v5.5.0/simplex.apk), [APK armv7](https://github.com/simplex-chat/simplex-chat/releases/download/v5.5.0/simplex-armv7a.apk).
|
||||
|
||||
## Terminal (console) app
|
||||
|
||||
See [Using terminal app](/docs/CLI.md).
|
||||
|
||||
**Linux**: [Ubuntu 20.04](https://github.com/simplex-chat/simplex-chat/releases/download/v5.4.3/simplex-chat-ubuntu-20_04-x86-64), [Ubuntu 22.04](https://github.com/simplex-chat/simplex-chat/releases/download/v5.4.3/simplex-chat-ubuntu-22_04-x86-64).
|
||||
**Linux**: [Ubuntu 20.04](https://github.com/simplex-chat/simplex-chat/releases/download/v5.5.0/simplex-chat-ubuntu-20_04-x86-64), [Ubuntu 22.04](https://github.com/simplex-chat/simplex-chat/releases/download/v5.5.0/simplex-chat-ubuntu-22_04-x86-64).
|
||||
|
||||
**Mac** [x86_64](https://github.com/simplex-chat/simplex-chat/releases/download/v5.4.3/simplex-chat-macos-x86-64), aarch64 - [compile from source](./CLI.md#).
|
||||
**Mac** [x86_64](https://github.com/simplex-chat/simplex-chat/releases/download/v5.5.0/simplex-chat-macos-x86-64), aarch64 - [compile from source](/docs/CLI.md#).
|
||||
|
||||
**Windows**: [x86_64](https://github.com/simplex-chat/simplex-chat/releases/download/v5.4.3/simplex-chat-windows-x86-64).
|
||||
**Windows**: [x86_64](https://github.com/simplex-chat/simplex-chat/releases/download/v5.5.0/simplex-chat-windows-x86-64).
|
||||
|
20
website/src/_includes/blog_previews/20240124.html
Normal file
20
website/src/_includes/blog_previews/20240124.html
Normal file
@ -0,0 +1,20 @@
|
||||
<p><strong>SimpleX Chat infrastructure on Linode:</strong></p>
|
||||
|
||||
<ul class="mb-[12px]">
|
||||
<li>free infrastructure.</li>
|
||||
<li>SimpleX servers in Linode Marketplace.</li>
|
||||
<li>high capacity messaging servers.</li>
|
||||
</ul>
|
||||
|
||||
<p><strong>v5.5 is released:</strong></p>
|
||||
|
||||
<ul class="mb-[12px]">
|
||||
<li>private notes.</li>
|
||||
<li>group history</li>
|
||||
<li>simpler UX to connect to other people</li>
|
||||
<li>message delivery, battery usage and other improvements</li>
|
||||
</ul>
|
||||
|
||||
<p>Also, the app interface is now available in Hungarian and Turkish - thanks to our users.</p>
|
||||
|
||||
<p>SimpleX Chat Android and desktop apps are now available in 20 languages!</p>
|
Loading…
Reference in New Issue
Block a user