Merge branch 'master' into names

This commit is contained in:
Evgeny Poberezkin committed 2026-11-14 13:36:20 +00:00
commit e4fdc6603c
301 files changed
+29412 -2523

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
{
"name": "simplex-chat",
"description": "The SimpleX Chat plugin for Claude Code.",
"owner": {"name": "SimpleX Chat", "url": "https://simplex.chat"},
"plugins": [
{
"name": "simplex",
"description": "Each Claude Code session gets its own SimpleX group. There you prompt the session, approve its actions and tool use, and read its answers.",
"source": {"source": "npm", "package": "@simplex-chat/mcp"}
}
]
}
+33 -4
View File
@@ -38,6 +38,12 @@ on:
- "apps/simplex-store-service/web/**"
- "scripts/ci/packages_release.py"
- "scripts/ci/test_packages_release.py"
- "website/src/js/simplex-lib.jsc"
- "website/test/**"
- "website/package.json"
- "packages/simplex-chat-mcp/**"
- "apps/simplex-support-bot/**"
- "apps/simplex-support-bot-light/**"
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
inputs:
@@ -123,6 +129,7 @@ jobs:
publish_types: ${{ steps.libs.outputs.tag && steps.publish.outputs.types_version || '' }}
publish_nodejs: ${{ steps.publish.outputs.nodejs_version }}
publish_python: ${{ steps.publish.outputs.python_version }}
publish_mcp: ${{ steps.publish.outputs.mcp_version }}
publish: ${{ steps.publish.outputs.nodejs_version || steps.publish.outputs.python_version }}
packages: ${{ steps.changes.outputs.packages }}
scopes: ${{ steps.changes.outputs.scopes }}
@@ -1928,7 +1935,7 @@ jobs:
publish:
needs: [maybe-release, build-linux, build-linux-full, build-linux-push, build-macos, build-ios, build-windows, releases]
if: ${{ !cancelled() && (needs.maybe-release.outputs.publish || needs.maybe-release.outputs.publish_types) }}
if: ${{ !cancelled() && (needs.maybe-release.outputs.publish || needs.maybe-release.outputs.publish_types || needs.maybe-release.outputs.publish_mcp) }}
runs-on: ubuntu-latest
permissions:
contents: read
@@ -1937,6 +1944,7 @@ jobs:
outputs:
types: ${{ steps.types.outputs.version }}
nodejs: ${{ steps.nodejs.outputs.version }}
mcp: ${{ steps.mcp.outputs.version }}
python: ${{ steps.python.outputs.version }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1975,7 +1983,7 @@ jobs:
run: python3 scripts/ci/packages_release.py publish-plan >> "$GITHUB_OUTPUT"
- name: Setup Node.js
if: steps.plan.outputs.types_version || steps.plan.outputs.nodejs_version
if: steps.plan.outputs.types_version || steps.plan.outputs.nodejs_version || steps.plan.outputs.mcp_version
uses: actions/setup-node@v7
with:
node-version: 24
@@ -2047,9 +2055,29 @@ jobs:
VERSION: ${{ steps.plan.outputs.python_version }}
run: echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Build and test @simplex-chat/mcp
if: steps.plan.outputs.mcp_version
working-directory: packages/simplex-chat-mcp
run: |
npm ci --no-audit --no-fund
npx tsc
npx tsc -p test/tsconfig.json --noEmit
npm test
- name: Publish @simplex-chat/mcp
id: mcp
if: steps.plan.outputs.mcp_version
working-directory: packages/simplex-chat-mcp
env:
VERSION: ${{ steps.plan.outputs.mcp_version }}
DIST_TAG: ${{ steps.plan.outputs.mcp_dist_tag }}
run: |
npm publish --provenance --access public --tag "$DIST_TAG"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
record:
needs: publish
if: ${{ !cancelled() && (needs.publish.outputs.types || needs.publish.outputs.nodejs || needs.publish.outputs.python) }}
if: ${{ !cancelled() && (needs.publish.outputs.types || needs.publish.outputs.nodejs || needs.publish.outputs.mcp || needs.publish.outputs.python) }}
runs-on: ubuntu-latest
steps:
- name: Checkout Code
@@ -2061,7 +2089,8 @@ jobs:
LIBS_REPOSITORY: ${{ github.repository }}-libs
TYPES: ${{ needs.publish.outputs.types }}
NODEJS: ${{ needs.publish.outputs.nodejs }}
MCP: ${{ needs.publish.outputs.mcp }}
PYTHON: ${{ needs.publish.outputs.python }}
run: |
python3 scripts/ci/packages_release.py record --commit "$GITHUB_SHA" \
--types "$TYPES" --nodejs "$NODEJS" --python "$PYTHON"
--types "$TYPES" --nodejs "$NODEJS" --mcp "$MCP" --python "$PYTHON"
+4 -4
View File
@@ -776,7 +776,7 @@ struct OpenStorePurchase: Decodable {
// ChatResponse is split to three enums to reduce stack size used when parsing it, parsing large enums is very inefficient.
// Spec: spec/api.md#ChatResponse0
enum ChatResponse0: Decodable, ChatAPIResult {
indirect enum ChatResponse0: Decodable, ChatAPIResult {
case activeUser(user: User)
case usersList(users: [UserInfo])
case chatStarted
@@ -904,7 +904,7 @@ enum ChatResponse0: Decodable, ChatAPIResult {
}
// Spec: spec/api.md#ChatResponse1
enum ChatResponse1: Decodable, ChatAPIResult {
indirect enum ChatResponse1: Decodable, ChatAPIResult {
case invitation(user: UserRef, connLinkInvitation: CreatedConnLink, connection: PendingContactConnection)
case connectionIncognitoUpdated(user: UserRef, toConnection: PendingContactConnection)
case connectionUserChanged(user: UserRef, fromConnection: PendingContactConnection, toConnection: PendingContactConnection, newUser: UserRef)
@@ -1047,7 +1047,7 @@ enum ChatResponse1: Decodable, ChatAPIResult {
}
// Spec: spec/api.md#ChatResponse2
enum ChatResponse2: Decodable, ChatAPIResult {
indirect enum ChatResponse2: Decodable, ChatAPIResult {
// group responses
case groupCreated(user: UserRef, groupInfo: GroupInfo)
case publicGroupCreated(user: UserRef, groupInfo: GroupInfo, groupLink: GroupLink, groupRelays: [GroupRelay])
@@ -1229,7 +1229,7 @@ enum ChatResponse2: Decodable, ChatAPIResult {
}
// Spec: spec/api.md#ChatEvent
enum ChatEvent: Decodable, ChatAPIResult {
indirect enum ChatEvent: Decodable, ChatAPIResult {
case chatSuspended
case contactSwitch(user: UserRef, contact: Contact, switchProgress: SwitchProgress)
case groupMemberSwitch(user: UserRef, groupInfo: GroupInfo, member: GroupMember, switchProgress: SwitchProgress)
+1 -1
View File
@@ -612,6 +612,7 @@ final class ChatModel: ObservableObject {
} else {
addChat_(chat, at: 0)
}
ChatTagsModel.shared.addPresetChatTags(chat.chatInfo, chat.chatStats)
popChatCollector.throttlePopChat(chat.chatInfo.id, currentPosition: 0)
}
@@ -656,7 +657,6 @@ final class ChatModel: ObservableObject {
updateChatInfo(cInfo)
} else if addMissing {
addChat(Chat(chatInfo: cInfo, chatItems: []))
ChatTagsModel.shared.addPresetChatTags(cInfo, ChatStats())
}
}
+5
View File
@@ -1118,6 +1118,11 @@ private func apiConnectResponseAlert<R>(_ r: APIResult<R>) async {
NSLocalizedString("Connection link removed", comment: ""),
message: NSLocalizedString("Your contact removed this link, or it was a one-time link that was already used.\nTo connect, ask your contact to create a new link.", comment: "")
)
case .errorAgent(.CONN(.DUPLICATE, _)):
showAlert(
NSLocalizedString("Already connected?", comment: ""),
message: String.localizedStringWithFormat(NSLocalizedString("It seems like you are already connected via this link. If it is not the case, there was an error (%@).", comment: ""), "CONN DUPLICATE")
)
case let .errorAgent(.SMP(_, .BLOCKED(info))):
showAlert(
NSLocalizedString("Connection blocked", comment: ""),
@@ -40,6 +40,11 @@ var badgeBrowserAllowed: Bool {
SKPaymentQueue.default().storefront?.countryCode == "USA"
}
// Checks that build is from App Store, supported in iOS 15
private var appStoreReceiptIsProduction: Bool {
Bundle.main.appStoreReceiptURL?.lastPathComponent == "receipt"
}
enum BadgePrice {
case loading
case price(String)
@@ -139,6 +144,8 @@ final class BadgeStore: ObservableObject {
// the original ids of the Apple ID's subscriptions; nil until load() has read them. Apple folds a new subscription
// of an Apple ID that subscribed before into the earlier one, which core resumes only for the profile it retired
@Published private(set) var priorSubscriptions: Set<String>? = nil
// right from the first frame, and confirmed by readEnvironment on iOS 16
@Published private(set) var servedByAppStore = appStoreReceiptIsProduction
// the sweep has no buyer waiting and runs at four triggers, so a failure that cannot clear is told once a run
private var sweepFailureShown = false
private var transactionUpdates: Task<Void, Never>? = nil
@@ -213,6 +220,17 @@ final class BadgeStore: ObservableObject {
)
}
// iOS 16 includes the environment in the app transaction
func readEnvironment() async {
if #available(iOS 16.0, *) {
if let verification = try? await AppTransaction.shared,
case .verified(let appTransaction) = verification {
let served = appTransaction.environment == .production
await MainActor.run { servedByAppStore = served }
}
}
}
func load() async {
guard await startLoading() else { return }
do {
@@ -16,6 +16,7 @@ struct BadgesSupportSimplexView: View {
// set true when presented as a sheet root (from the chat-list banner) — that path doesn't
// reserve nav-bar space like a NavigationLink push does, so the title lands too close to the top
var showsAsSheet: Bool = false
var servedByAppStore: Bool? = nil
@State private var whyBuiltActive = false
@State private var howItWorksActive = false
@State private var chooseLevelActive = false
@@ -45,37 +46,35 @@ struct BadgesSupportSimplexView: View {
Spacer(minLength: 0)
// Store purchases are not released on iOS: TestFlight buys in the sandbox, which the
// service refuses for good. The badge is chosen on the site, and the code redeemed here.
// Revert this commit to restore the block below.
// VStack(spacing: 10) {
// chooseLevelButton()
// .padding(.vertical, 10)
// Group {
// if badgeBrowserAllowed {
// buyInBrowserButton()
// } else {
// RedeemCodeButton()
// }
// }
// .frame(height: 22)
// RestorePurchasesButton()
// .frame(height: 22)
// .padding(.top, 10)
// Text("If you were charged but have no badge, this adds it. A subscription bought with this App Store account moves to this profile, and the device or profile that had it loses its badge at its next renewal.")
// .font(.footnote)
// .foregroundColor(theme.colors.secondary)
// .multilineTextAlignment(.center)
// .fixedSize(horizontal: false, vertical: true)
// }
VStack(spacing: 10) {
chooseBadgeOnSiteButton()
.padding(.vertical, 10)
Group {
RedeemCodeButton()
if servedByAppStore ?? store.servedByAppStore {
chooseLevelButton()
.padding(.vertical, 10)
Group {
if badgeBrowserAllowed {
buyInBrowserButton()
} else {
RedeemCodeButton()
}
}
.frame(height: 22)
RestorePurchasesButton()
.frame(height: 22)
.padding(.top, 10)
Text("If you were charged but have no badge, this adds it. A subscription bought with this App Store account moves to this profile, and the device or profile that had it loses its badge at its next renewal.")
.font(.footnote)
.foregroundColor(theme.colors.secondary)
.multilineTextAlignment(.center)
.fixedSize(horizontal: false, vertical: true)
} else {
chooseBadgeOnSiteButton()
.padding(.vertical, 10)
Group {
RedeemCodeButton()
}
.frame(height: 22)
BadgeInvestorOffer(level: .supporter).hidden()
}
.frame(height: 22)
BadgeInvestorOffer(level: .supporter).hidden()
}
.padding(.bottom, g.safeAreaInsets.bottom == 0 ? 20 : 0)
}
@@ -88,6 +87,7 @@ struct BadgesSupportSimplexView: View {
}
.frame(maxHeight: .infinity)
.navigationBarTitleDisplayMode(.inline)
.task { await store.readEnvironment() }
}
private func chooseLevelButton() -> some View {
@@ -151,7 +151,6 @@ struct BadgesSupportSimplexView: View {
}
}
// delete with the commented block above to restore store purchases
private func chooseBadgeOnSiteButton() -> some View {
Button {
UIApplication.shared.open(URL(string: badgePageUrl)!)
@@ -233,7 +232,7 @@ struct PhoneSupporterHero: View {
struct BadgesSupportSimplexView_Previews: PreviewProvider {
static var previews: some View {
NavigationView {
BadgesSupportSimplexView()
BadgesSupportSimplexView(servedByAppStore: true)
}
}
}
@@ -326,7 +326,7 @@ struct ActiveCallOverlay: View {
.foregroundColor(.white.opacity(0.8))
}
VStack {
ProfileImage(imageStr: call.contact.profile.image, size: 192)
ProfileImage(imageStr: call.contact.profile.image, icon: call.contact.chatIcon, size: 192)
audioCallInfoView(call)
}
.foregroundColor(.white)
@@ -222,7 +222,7 @@ struct CallViewLocal: UIViewRepresentable {
func makeUIView(context: Context) -> UIView {
let view = UIView()
let localRenderer = RTCEAGLVideoView(frame: .zero)
let localRenderer = RTCMTLVideoView(frame: .zero)
context.coordinator.renderer = localRenderer
client.addLocalRenderer(localRenderer)
addSubviewAndResize(localRenderer, nil, into: view)
@@ -245,7 +245,7 @@ struct CallViewLocal: UIViewRepresentable {
// MARK: - Coordinator
class Coordinator: NSObject, AVPictureInPictureControllerDelegate {
var renderer: RTCEAGLVideoView?
var renderer: RTCMTLVideoView?
var client: WebRTCClient
required init(_ client: WebRTCClient) {
+67 -27
View File
@@ -13,10 +13,7 @@ import SimpleXChat
final class WebRTCClient: NSObject, RTCVideoViewDelegate, RTCFrameEncryptorDelegate, RTCFrameDecryptorDelegate {
private static let factory: RTCPeerConnectionFactory = {
RTCInitializeSSL()
let videoEncoderFactory = RTCDefaultVideoEncoderFactory()
let videoDecoderFactory = RTCDefaultVideoDecoderFactory()
videoEncoderFactory.preferredCodec = RTCVideoCodecInfo(name: kRTCVp8CodecName)
return RTCPeerConnectionFactory(encoderFactory: videoEncoderFactory, decoderFactory: videoDecoderFactory)
return RTCPeerConnectionFactory(encoderFactory: VP8EncoderFactory(), decoderFactory: VP8DecoderFactory())
}()
private static let ivTagBytes: Int = 28
private static let enableEncryption: Bool = true
@@ -66,6 +63,7 @@ final class WebRTCClient: NSObject, RTCVideoViewDelegate, RTCFrameEncryptorDeleg
private let rtcAudioSession = RTCAudioSession.sharedInstance()
private let audioQueue = DispatchQueue(label: "chat.simplex.app.audio")
private let endCallLock = NSLock()
private var sendCallResponse: (WVAPIMessage) async -> Void
var activeCall: Call?
var notConnectedCall: NotConnectedCall?
@@ -491,7 +489,7 @@ final class WebRTCClient: NSObject, RTCVideoViewDelegate, RTCFrameEncryptorDeleg
}
}
func addLocalRenderer(_ renderer: RTCEAGLVideoView) {
func addLocalRenderer(_ renderer: RTCMTLVideoView) {
if let activeCall {
if let track = activeCall.localVideoTrack {
track.add(renderer)
@@ -505,7 +503,7 @@ final class WebRTCClient: NSObject, RTCVideoViewDelegate, RTCFrameEncryptorDeleg
renderer.delegate = self
}
func removeLocalRenderer(_ renderer: RTCEAGLVideoView) {
func removeLocalRenderer(_ renderer: RTCMTLVideoView) {
if let activeCall {
if let track = activeCall.localVideoTrack {
track.remove(renderer)
@@ -585,6 +583,21 @@ final class WebRTCClient: NSObject, RTCVideoViewDelegate, RTCFrameEncryptorDeleg
}
}
}
setAudioSendersActive(pc)
}
// WebRTC starts an audio sender's stream without a track too, and sends the microphone on it unmuted (M156): the screen
// audio sender, which has no track, sent the microphone, also when it was muted. So only senders with a track are active.
func setAudioSendersActive(_ connection: RTCPeerConnection) {
for transceiver in connection.transceivers where transceiver.mediaType == .audio {
let sender = transceiver.sender
let active = sender.track != nil
let parameters = sender.parameters
if parameters.encodings.contains(where: { $0.isActive != active }) {
parameters.encodings.forEach { $0.isActive = active }
sender.parameters = parameters
}
}
}
func mediaSourceFromTransceiverMid(_ mid: String?) -> CallMediaSource {
@@ -618,8 +631,11 @@ final class WebRTCClient: NSObject, RTCVideoViewDelegate, RTCFrameEncryptorDeleg
if var key: [CChar] = activeCall?.aesKey?.cString(using: .utf8),
let pointer: UnsafeMutableRawPointer = malloc(encrypted.count) {
memcpy(pointer, (encrypted as NSData).bytes, encrypted.count)
logCrypto("decrypt", chat_decrypt_media(&key, pointer.advanced(by: clearTextBytesSize), Int32(encrypted.count - clearTextBytesSize)))
return Data(bytes: pointer, count: encrypted.count - WebRTCClient.ivTagBytes)
guard checkCrypto("decrypt", chat_decrypt_media(&key, pointer.advanced(by: clearTextBytesSize), Int32(encrypted.count - clearTextBytesSize))) else {
free(pointer)
return nil
}
return Data(bytesNoCopy: pointer, count: encrypted.count - WebRTCClient.ivTagBytes, deallocator: .free)
} else {
return nil
}
@@ -633,22 +649,24 @@ final class WebRTCClient: NSObject, RTCVideoViewDelegate, RTCFrameEncryptorDeleg
if var key: [CChar] = activeCall?.aesKey?.cString(using: .utf8),
let pointer: UnsafeMutableRawPointer = malloc(unencrypted.count + WebRTCClient.ivTagBytes) {
memcpy(pointer, (unencrypted as NSData).bytes, unencrypted.count)
logCrypto("encrypt", chat_encrypt_media(chat_ctrl, &key, pointer.advanced(by: clearTextBytesSize), Int32(unencrypted.count + WebRTCClient.ivTagBytes - clearTextBytesSize)))
return Data(bytes: pointer, count: unencrypted.count + WebRTCClient.ivTagBytes)
guard checkCrypto("encrypt", chat_encrypt_media(chat_ctrl, &key, pointer.advanced(by: clearTextBytesSize), Int32(unencrypted.count + WebRTCClient.ivTagBytes - clearTextBytesSize))) else {
free(pointer)
return nil
}
return Data(bytesNoCopy: pointer, count: unencrypted.count + WebRTCClient.ivTagBytes, deallocator: .free)
} else {
return nil
}
}
private func logCrypto(_ op: String, _ r: UnsafeMutablePointer<CChar>?) {
if let r = r {
let err = fromCString(r)
if err != "" {
logger.error("\(op) error: \(err)")
// } else {
// logger.debug("\(op) ok")
}
private func checkCrypto(_ op: String, _ r: UnsafeMutablePointer<CChar>?) -> Bool {
guard let r = r else { return true }
let err = fromCString(r)
if err != "" {
logger.error("\(op) error: \(err)")
return false
}
return true
}
func addRemoteCameraRenderer(_ renderer: RTCVideoRenderer) {
@@ -687,7 +705,7 @@ final class WebRTCClient: NSObject, RTCVideoViewDelegate, RTCFrameEncryptorDeleg
func startCaptureLocalVideo(_ device: AVCaptureDevice.Position?, _ capturer: RTCVideoCapturer?) {
#if targetEnvironment(simulator)
guard
let capturer = (activeCall?.localCamera ?? notConnectedCall?.localCameraAndTrack?.0) as? RTCFileVideoCapturer
let capturer = (capturer ?? activeCall?.localCamera ?? notConnectedCall?.localCameraAndTrack?.0) as? RTCFileVideoCapturer
else {
logger.error("Unable to work with a file capturer")
return
@@ -759,7 +777,13 @@ final class WebRTCClient: NSObject, RTCVideoViewDelegate, RTCFrameEncryptorDeleg
private func _endCall() {
(notConnectedCall?.localCameraAndTrack?.0 as? RTCCameraVideoCapturer)?.stopCapture()
guard let call = activeCall else { return }
// The end command and the call view ending it on disappearing both end the call: closing the connection from
// both at once froze the app (CI run 41311546712), so only the first takes the call.
endCallLock.lock()
let call = activeCall
activeCall = nil
endCallLock.unlock()
guard let call else { return }
logger.debug("WebRTCClient: ending the call")
call.reconnection?.cancel()
call.iceRestarts?.cancel()
@@ -769,7 +793,6 @@ final class WebRTCClient: NSObject, RTCVideoViewDelegate, RTCFrameEncryptorDeleg
call.frameDecryptor?.delegate = nil
(call.localCamera as? RTCCameraVideoCapturer)?.stopCapture()
audioSessionToDefaults()
activeCall = nil
}
func untilIceComplete(timeoutMs: UInt64, stepMs: UInt64, action: @escaping () async -> Void) async {
@@ -1014,16 +1037,16 @@ extension WebRTCClient {
do {
let hasExternalAudioDevice = self.rtcAudioSession.session.hasExternalAudioDevice()
if enabled {
try self.rtcAudioSession.setCategory(AVAudioSession.Category.playAndRecord.rawValue, with: [.defaultToSpeaker, .allowBluetooth, .allowAirPlay, .allowBluetoothA2DP])
try self.rtcAudioSession.setMode(AVAudioSession.Mode.videoChat.rawValue)
try self.rtcAudioSession.setCategory(AVAudioSession.Category.playAndRecord, with: [.defaultToSpeaker, .allowBluetooth, .allowAirPlay, .allowBluetoothA2DP])
try self.rtcAudioSession.setMode(AVAudioSession.Mode.videoChat)
if hasExternalAudioDevice && !skipExternalDevice, let preferred = self.rtcAudioSession.session.preferredInputDevice() {
try self.rtcAudioSession.setPreferredInput(preferred)
} else {
try self.rtcAudioSession.overrideOutputAudioPort(.speaker)
}
} else {
try self.rtcAudioSession.setCategory(AVAudioSession.Category.playAndRecord.rawValue, with: [.allowBluetooth, .allowAirPlay, .allowBluetoothA2DP])
try self.rtcAudioSession.setMode(AVAudioSession.Mode.voiceChat.rawValue)
try self.rtcAudioSession.setCategory(AVAudioSession.Category.playAndRecord, with: [.allowBluetooth, .allowAirPlay, .allowBluetoothA2DP])
try self.rtcAudioSession.setMode(AVAudioSession.Mode.voiceChat)
try self.rtcAudioSession.overrideOutputAudioPort(.none)
}
if hasExternalAudioDevice && !skipExternalDevice {
@@ -1046,8 +1069,8 @@ extension WebRTCClient {
self.rtcAudioSession.unlockForConfiguration()
}
do {
try self.rtcAudioSession.setCategory(AVAudioSession.Category.ambient.rawValue)
try self.rtcAudioSession.setMode(AVAudioSession.Mode.default.rawValue)
try self.rtcAudioSession.setCategory(AVAudioSession.Category.ambient)
try self.rtcAudioSession.setMode(AVAudioSession.Mode.default)
try self.rtcAudioSession.overrideOutputAudioPort(.none)
try self.rtcAudioSession.setActive(false)
logger.debug("WebRTCClient: audioSession to defaults success")
@@ -1062,6 +1085,9 @@ extension WebRTCClient {
if activeCall != nil {
activeCall?.localAudioTrack = enabled ? createAudioTrack() : nil
activeCall?.connection.transceivers.first(where: { t in mediaSourceFromTransceiverMid(t.mid) == .mic })?.sender.track = activeCall?.localAudioTrack
if let connection = activeCall?.connection {
setAudioSendersActive(connection)
}
} else if notConnectedCall != nil {
notConnectedCall?.audioTrack = enabled ? createAudioTrack() : nil
}
@@ -1246,3 +1272,17 @@ extension RTCSignalingState {
}
}
}
// The frame encryption leaves only VP8's header in the clear for WebRTC's packetizer, so calls send and receive VP8 alone:
// with the default factories two apps on WebRTC M156 chose H.264, and no video arrived.
private final class VP8EncoderFactory: NSObject, RTCVideoEncoderFactory {
func createEncoder(_ info: RTCVideoCodecInfo) -> RTCVideoEncoder? { RTCVideoEncoderVP8.vp8Encoder() }
func supportedCodecs() -> [RTCVideoCodecInfo] { RTCVideoEncoderVP8.supportedCodecs() }
}
private final class VP8DecoderFactory: NSObject, RTCVideoDecoderFactory {
func createDecoder(_ info: RTCVideoCodecInfo) -> RTCVideoDecoder? { RTCVideoDecoderVP8.vp8Decoder() }
func supportedCodecs() -> [RTCVideoCodecInfo] { RTCVideoDecoderVP8.supportedCodecs() }
}
@@ -51,7 +51,7 @@ struct CIChatLinkHeader: View {
HStack(alignment: .top) {
ProfileImage(
imageStr: chatLink.image,
icon: Image(systemName: chatLink.iconName),
icon: chatLink.icon,
size: 44,
color: Color(uiColor: .tertiaryLabel)
)
@@ -65,7 +65,7 @@ struct CIFeaturePreferenceView: View {
func allowFeatureToContact(_ contact: Contact, _ feature: ChatFeature, param: Int? = nil) {
Task {
do {
let prefs = contactUserPreferencesToPreferences(contact.mergedPreferences).setAllowed(feature, param: param)
let prefs = contact.userPreferences.setAllowed(feature, param: param)
if let toContact = try await apiSetContactPrefs(contactId: contact.contactId, preferences: prefs) {
await MainActor.run {
ChatModel.shared.updateContact(toContact)
@@ -534,9 +534,9 @@ struct CIVideoView: View {
if let item = player.currentItem {
let dur = CMTimeGetSeconds(item.duration)
if !dur.isInfinite && !dur.isNaN {
duration = Int(dur)
duration = wholeSeconds(dur)
}
progress = Int(CMTimeGetSeconds(player.currentTime()))
progress = wholeSeconds(CMTimeGetSeconds(player.currentTime()))
// `if` prevents showing Play button while the playback seeks to start and then plays
if player.currentTime() != player.currentItem?.duration && player.currentTime() != .zero {
videoPlaying = player.timeControlStatus == .playing || player.timeControlStatus == .waitingToPlayAtSpecifiedRate
@@ -321,16 +321,16 @@ struct FramedItemView: View {
case .file:
ciQuotedMsgView(qi)
.padding(.trailing, 20).frame(minWidth: quoteMinWidth, alignment: .leading)
ciQuoteIconView("doc.fill")
ciQuoteIconView(Image(systemName: "doc.fill"))
case .voice:
ciQuotedMsgView(qi)
.padding(.trailing, 20).frame(minWidth: quoteMinWidth, alignment: .leading)
ciQuoteIconView("mic.fill")
ciQuoteIconView(Image(systemName: "mic.fill"))
case let .chat(text, chatLink, _):
let prefix = NSAttributedString(string: chatLink.displayName + (text != chatLink.connLinkStr ? " - " : ""))
ciQuotedMsgView(qi, stripLink: chatLink.connLinkStr, prefix: prefix)
.padding(.trailing, 20).frame(minWidth: quoteMinWidth, alignment: .leading)
ciQuoteIconView(chatLink.smallIconName)
ciQuoteIconView(chatLink.smallIcon())
default:
ciQuotedMsgView(qi)
}
@@ -383,8 +383,8 @@ struct FramedItemView: View {
.padding(.bottom, terminal ? 0 : 6)
}
private func ciQuoteIconView(_ image: String) -> some View {
Image(systemName: image)
private func ciQuoteIconView(_ image: Image) -> some View {
image
.resizable()
.aspectRatio(contentMode: .fit)
.foregroundColor(Color(uiColor: .tertiaryLabel))
@@ -107,7 +107,7 @@ struct MsgContentView: View {
@ViewBuilder
private func contentView() -> some View {
let fts = if let stripLink { stripFormattedTextLink(formattedText, stripLink) } else { formattedText }
if blockLayout, let fts, !fts.isEmpty, let blocks = markdownBlocks {
if blockLayout, let fts, !fts.isEmpty, let blocks = markdownBlocks, prefix == nil || !blockTextRanges(blocks).isEmpty {
MarkdownBlocksView(
formattedText: fts,
blocks: blocks,
@@ -173,7 +173,7 @@ struct MsgContentView: View {
let r = messageText(
text,
formattedText,
markdownBlocks: markdownBlocks,
markdownBlocks: blockLayout ? nil : markdownBlocks,
textStyle: textStyle,
sender: sender,
mentions: mentions,
@@ -823,15 +823,15 @@ struct MarkdownBlocksView<BlockText: View, MetaLine: View>: View {
var body: some View {
let l = BlocksLayout(formattedText, blocks, textStyle, text: text)
VStack(alignment: .leading, spacing: 0) {
emptyLinesGap(leadingEmptyLines(formattedText, blocks), l)
emptyLinesGap(leadingEmptyLines(formattedText, blocks), l, between: false)
ForEach(Array(blocks.enumerated()), id: \.offset) { k, block in
let emptyHeight = k > 0 ? emptyLinesHeight(emptyLines(formattedText, blocks[k - 1].endIndex, block.startIndex, between: true), l) : 0
if k > 0 && terminal && (blocks[k - 1].isCard || block.isCard) {
Color.clear.frame(height: max(terminalParagraphGap, emptyHeight))
Color.clear.frame(width: 0, height: max(terminalParagraphGap, emptyHeight))
} else if k > 0 && terminal && blocks[k - 1].isHeading && !block.isHeading {
Color.clear.frame(height: terminalHeadingBottomGap + emptyHeight)
Color.clear.frame(width: 0, height: terminalHeadingBottomGap + emptyHeight)
} else if k > 0 && terminal && block.isHeading {
Color.clear.frame(height: terminalLevelStep + emptyHeight)
Color.clear.frame(width: 0, height: terminalLevelStep + emptyHeight)
} else if emptyHeight > 0 {
Color.clear.frame(width: 0, height: emptyHeight)
}
@@ -953,14 +953,16 @@ struct MarkdownBlocksView<BlockText: View, MetaLine: View>: View {
}
}
@ViewBuilder private func emptyLinesGap(_ lines: Int, _ l: BlocksLayout) -> some View {
@ViewBuilder private func emptyLinesGap(_ lines: Int, _ l: BlocksLayout, between: Bool = true) -> some View {
if lines > 0 {
Color.clear.frame(width: 0, height: emptyLinesHeight(lines, l))
Color.clear.frame(width: 0, height: emptyLinesHeight(lines, l, between: between))
}
}
private func emptyLinesHeight(_ lines: Int, _ l: BlocksLayout) -> CGFloat {
CGFloat(lines) * (terminal ? terminalParagraphGap : l.font.lineHeight)
private func emptyLinesHeight(_ lines: Int, _ l: BlocksLayout, between: Bool = true) -> CGFloat {
if terminal { return CGFloat(lines) * terminalParagraphGap }
let height = CGFloat(lines) * (l.font.lineHeight + l.font.leading)
return between && lines > 0 ? height + l.font.leading : height
}
private func codeText(_ r: SegmentRange) -> String {
@@ -282,7 +282,7 @@ struct ListItem: Hashable {
// using meta.hashValue instead of parts takes much more time so better to use partial meta here
func genHash(_ prevRevealed: Bool, _ nextRevealed: Bool) -> String {
"\(item.meta.itemId) \(item.meta.updatedAt.hashValue) \(item.meta.itemEdited) \(item.meta.itemDeleted?.hashValue ?? 0) \(item.meta.itemTimed?.hashValue ?? 0) \(item.meta.itemStatus.hashValue) \(item.meta.sentViaProxy ?? false) \(item.mergeCategory?.hashValue ?? 0) \(chatDirHash(item.chatDir)) \(item.reactions.hashValue) \(item.meta.isRcvNew) \(item.text.hash) \(item.file?.hashValue ?? 0) \(item.quotedItem?.itemId ?? 0) \(unreadBefore) \(prevItem?.id ?? 0) \(chatDirHash(prevItem?.chatDir)) \(prevItem?.mergeCategory?.hashValue ?? 0) \(prevRevealed) \(nextItem?.id ?? 0) \(chatDirHash(nextItem?.chatDir)) \(nextItem?.mergeCategory?.hashValue ?? 0) \(nextItem?.reactions.isEmpty ?? true) \(nextItem?.isOneLine ?? false) \(nextRevealed)"
"\(item.meta.itemId) \(item.meta.updatedAt.hashValue) \(item.meta.itemEdited) \(item.meta.isLive) \(item.meta.itemDeleted?.hashValue ?? 0) \(item.meta.itemTimed?.hashValue ?? 0) \(item.meta.itemStatus.hashValue) \(item.meta.sentViaProxy ?? false) \(item.mergeCategory?.hashValue ?? 0) \(chatDirHash(item.chatDir)) \(item.reactions.hashValue) \(item.meta.isRcvNew) \(item.text.hash) \(item.file?.hashValue ?? 0) \(item.quotedItem?.itemId ?? 0) \(unreadBefore) \(prevItem?.id ?? 0) \(chatDirHash(prevItem?.chatDir)) \(prevItem?.mergeCategory?.hashValue ?? 0) \(prevRevealed) \(nextItem?.id ?? 0) \(chatDirHash(nextItem?.chatDir)) \(nextItem?.mergeCategory?.hashValue ?? 0) \(nextItem?.reactions.isEmpty ?? true) \(nextItem?.isOneLine ?? false) \(nextRevealed)"
}
}
+7 -7
View File
@@ -377,7 +377,7 @@ struct ChatView: View {
theme = buildTheme()
closeSearch()
mergedItems.boxedValue = MergedItems.create(im, revealedItems)
scrollView.updateItems(mergedItems.boxedValue.items)
scrollView.updateItems(mergedItems.boxedValue.items, true)
if let openAround = chatModel.openAroundItemId, let index = mergedItems.boxedValue.indexInParentItems[openAround] {
scrollView.scrollToItem(index)
@@ -917,7 +917,7 @@ struct ChatView: View {
return Group {
if case .chatBanner = ci.content {
VStack {
ChatBannerView(chat: $chat)
ChatBannerView(chat: chat)
.padding(.bottom, 90)
.padding(.top, 8)
@@ -1021,7 +1021,7 @@ struct ChatView: View {
struct ChatBannerView: View {
@EnvironmentObject var theme: AppTheme
@AppStorage(DEFAULT_CHAT_ITEM_ROUNDNESS) private var roundness = defaultChatItemRoundness
@Binding @ObservedObject var chat: Chat
@ObservedObject var chat: Chat
var body: some View {
let v = VStack(spacing: 8) {
@@ -2981,7 +2981,7 @@ struct ChatView: View {
@ViewBuilder private func contactReactionMenu(_ contact: Contact, _ r: CIReactionCount) -> some View {
if !r.userReacted || r.totalReacted > 1 {
Button { showChatInfoSheet = true } label: {
profileMenuItem(Text(contact.displayName), contact.image, radius: profileRadius)
profileMenuItem(Text(contact.displayName), contact.image, peerType: contact.profile.peerType, radius: profileRadius)
}
}
if r.userReacted {
@@ -3275,7 +3275,7 @@ struct ReactionContextMenu: View {
selectedMember = member
}
} label: {
profileMenuItem(Text(mem.displayName), mem.image, radius: profileRadius)
profileMenuItem(Text(mem.displayName), mem.image, peerType: mem.memberProfile.peerType, radius: profileRadius)
}
.disabled(userMember)
}
@@ -3298,13 +3298,13 @@ struct ReactionContextMenu: View {
}
}
func profileMenuItem(_ nameText: Text, _ image: String?, radius: CGFloat) -> some View {
func profileMenuItem(_ nameText: Text, _ image: String?, peerType: ChatPeerType? = nil, radius: CGFloat) -> some View {
HStack {
nameText
if let image, let img = imageFromBase64(image) {
Image(uiImage: maskToCustomShape(img, size: 30, radius: radius))
} else {
Image(systemName: "person.crop.circle")
peerTypeIcon(peerType, person: Image(systemName: "person.crop.circle"))
}
}
}
@@ -11,7 +11,7 @@ struct ComposeChatLinkView: View {
HStack(alignment: .center, spacing: 8) {
ProfileImage(
imageStr: chatLink.image,
icon: Image(systemName: chatLink.iconName),
icon: chatLink.icon,
size: 44
)
.padding(.leading, 12)
@@ -15,12 +15,16 @@ enum VoiceMessagePlaybackState {
case paused
}
func wholeSeconds(_ time: TimeInterval) -> Int {
Int(exactly: time.rounded(.towardZero)) ?? 0
}
func voiceMessageTime(_ time: TimeInterval) -> String {
durationText(Int(time))
durationText(wholeSeconds(time))
}
func voiceMessageTime_(_ time: TimeInterval?) -> String {
durationText(Int(time ?? 0))
durationText(wholeSeconds(time ?? 0))
}
struct ComposeVoiceView: View {
@@ -157,7 +161,7 @@ struct ComposeVoiceView: View {
var seek: (TimeInterval) -> Void
var body: some View {
Slider(value: Binding(get: { progress ?? TimeInterval(0) }, set: { seek($0) }), in: 0 ... length)
Slider(value: Binding(get: { progress ?? TimeInterval(0) }, set: { seek($0) }), in: 0 ... max(length, 0))
.frame(maxWidth: .infinity)
.frame(height: 4)
.tint(theme.colors.primary)
@@ -80,18 +80,25 @@ struct ContextItemView: View {
FileManager.default.fileExists(atPath: getAppFilePath(fileSource.filePath).path)
} else { false }
switch contextItem.content.msgContent {
case .file: return isFileLoaded ? image("doc.fill") : Text("")
case .image: return image("photo")
case .voice: return isFileLoaded ? image("play.fill") : Text("")
case .file: return isFileLoaded ? image(Image(systemName: "doc.fill")) : Text("")
case .image: return image(Image(systemName: "photo"))
case .voice: return isFileLoaded ? image(Image(systemName: "play.fill")) : Text("")
case let .chat(_, chatLink, _):
let hasText = contextItem.text != chatLink.connLinkStr
return image(chatLink.smallIconName) + Text(chatLink.displayName) + Text(verbatim: hasText ? " - " : "")
return image(chatLink.smallIcon(agent: textAgentIcon())) + Text(chatLink.displayName) + Text(verbatim: hasText ? " - " : "")
default: return Text("")
}
}
func image(_ s: String) -> Text {
Text(Image(systemName: s)).foregroundColor(Color(uiColor: .tertiaryLabel)) + textSpace
func image(_ i: Image) -> Text {
Text(i).foregroundColor(Color(uiColor: .tertiaryLabel)) + textSpace
}
func textAgentIcon() -> Image {
guard let person = UIImage(systemName: "person", withConfiguration: UIImage.SymbolConfiguration(textStyle: .body)),
let agent = UIImage(named: "agent") else { return Image("agent") }
let size = CGSize(width: person.size.height * agent.size.width / agent.size.height, height: person.size.height)
return Image(uiImage: UIGraphicsImageRenderer(size: size).image { _ in agent.draw(in: CGRect(origin: .zero, size: size)) }.withRenderingMode(.alwaysTemplate))
}
}
}
@@ -219,7 +219,7 @@ struct AddGroupMembersViewCommon: View {
}
} label: {
HStack{
ProfileImage(imageStr: contact.image, size: 30)
ProfileImage(imageStr: contact.image, icon: contact.chatIcon, size: 30)
.padding(.trailing, 2)
NameWithBadge(
Text(ChatInfo.direct(contact: contact).chatViewName)
@@ -31,10 +31,10 @@ struct ChannelMembersView: View {
Section(header: Text(subscriberCountStr(subscriberCount)).foregroundColor(theme.colors.secondary)) {
searchFieldView(text: $searchText, focussed: $searchFocussed, theme.colors.onBackground, theme.colors.secondary)
.padding(.leading, 8)
memberRow(GMember(groupInfo.membership), user: true, showRole: true)
ChannelMemberRow(chat: chat, groupInfo: groupInfo, gMember: GMember(groupInfo.membership), user: true, showRole: true)
let filteredMembers = s == "" ? members : members.filter { $0.wrapped.localAliasAndFullName.localizedLowercase.contains(s) }
ForEach(filteredMembers) { member in
memberRow(member, user: false, showRole: member.wrapped.memberRole >= .member)
ChannelMemberRow(chat: chat, groupInfo: groupInfo, gMember: member, user: false, showRole: member.wrapped.memberRole >= .member)
}
}
}
@@ -48,18 +48,27 @@ struct ChannelMembersView: View {
searchFieldView(text: $searchText, focussed: $searchFocussed, theme.colors.onBackground, theme.colors.secondary)
.padding(.leading, 8)
if groupInfo.membership.memberRole >= .member {
memberRow(GMember(groupInfo.membership), user: true, showRole: true)
ChannelMemberRow(chat: chat, groupInfo: groupInfo, gMember: GMember(groupInfo.membership), user: true, showRole: true)
}
let filteredContributors = s == "" ? contributors : contributors.filter { $0.wrapped.localAliasAndFullName.localizedLowercase.contains(s) }
ForEach(filteredContributors) { member in
memberRow(member, user: false, showRole: member.wrapped.memberRole >= .moderator)
ChannelMemberRow(chat: chat, groupInfo: groupInfo, gMember: member, user: false, showRole: member.wrapped.memberRole >= .moderator)
}
}
}
}
}
}
@ViewBuilder private func memberRow(_ gMember: GMember, user: Bool, showRole: Bool) -> some View {
private struct ChannelMemberRow: View {
var chat: Chat
var groupInfo: GroupInfo
@ObservedObject var gMember: GMember
@EnvironmentObject var theme: AppTheme
var user: Bool
var showRole: Bool
var body: some View {
let member = gMember.wrapped
let nameText = Text(member.chatViewName)
.foregroundColor(member.memberIncognito ? .indigo : theme.colors.onBackground)
@@ -831,6 +831,7 @@ func MemberProfileImage(
) -> some View {
ProfileImage(
imageStr: mem.image,
icon: peerTypeIcon(mem.memberProfile.peerType),
size: size,
color: color,
backgroundColor: backgroundColor,
@@ -37,7 +37,7 @@ struct ChatPreviewView: View {
}
.padding(.leading, 4)
let chatTs = if let cItem {
let chatTs = if let cItem, cItem.content != .chatBanner {
cItem.meta.itemTs
} else {
chat.chatInfo.chatTs
@@ -444,7 +444,7 @@ struct ChatPreviewView: View {
smallContentPreview(size: dynamicMediaSize, borderColor: chatLink.image != nil ? .secondary : .clear) {
ProfileImage(
imageStr: chatLink.image,
icon: Image(systemName: chatLink.iconName),
icon: chatLink.icon,
size: dynamicMediaSize,
color: Color(uiColor: .tertiaryLabel)
)
@@ -167,7 +167,7 @@ struct ContactListNavLink: View {
func contactPreview(_ contact: Contact, titleColor: Color) -> some View {
HStack{
ProfileImage(imageStr: contact.image, size: 30)
ProfileImage(imageStr: contact.image, icon: contact.chatIcon, size: 30)
previewTitle(contact, titleColor: titleColor)
@@ -262,7 +262,7 @@ struct ContactListNavLink: View {
func contactCardPreview(_ contact: Contact) -> some View {
HStack{
ProfileImage(imageStr: contact.image, size: 30)
ProfileImage(imageStr: contact.image, icon: contact.chatIcon, size: 30)
Text(chat.chatInfo.chatViewName)
.foregroundColor(.accentColor)
@@ -315,7 +315,7 @@ struct ContactListNavLink: View {
func contactRequestPreview(color: Color) -> some View {
HStack{
ProfileImage(imageStr: chat.chatInfo.image, size: 30)
ProfileImage(imageStr: chat.chatInfo.image, icon: chatIcon(chat.chatInfo), size: 30)
NameWithBadge(Text(chat.chatInfo.chatViewName).foregroundColor(color), chat.chatInfo.nameBadge)
.lineLimit(1)
@@ -67,3 +67,47 @@ struct ProfileImage_Previews: PreviewProvider {
.background(.black)
}
}
struct PeerTypePlaceholders_Previews: PreviewProvider {
static let peerTypes: [ChatPeerType?] = [nil, .human, .agent, .bot]
static var previews: some View {
VStack(alignment: .leading) {
row { MemberProfileImage(member($0), size: 38) }
row { ChatInfoImage(chat: Chat(chatInfo: .contactRequest(contactRequest: contactRequest($0))), size: 38) }
row { ProfileImage(icon: contactLink($0).icon, size: 38) }
row { contactLink($0).smallIcon().resizable().scaledToFit().frame(width: 38, height: 18) }
row { profileMenuItem(Text("alice"), nil, peerType: $0, radius: 50) }
ForEach(peerTypes.indices, id: \.self) { i in
ContextItemView(chat: Chat.sampleData, contextItems: [linkItem(peerTypes[i])], contextIcon: "arrowshape.turn.up.left", cancelContextItem: {})
}
}
}
static func row<V: View>(@ViewBuilder _ placeholder: @escaping (ChatPeerType?) -> V) -> some View {
HStack {
ForEach(peerTypes.indices, id: \.self) { placeholder(peerTypes[$0]) }
}
}
static func member(_ peerType: ChatPeerType?) -> GroupMember {
var m = GroupMember.sampleData
m.memberProfile.peerType = peerType
return m
}
static func contactRequest(_ peerType: ChatPeerType?) -> UserContactRequest {
var r = UserContactRequest.sampleData
r.profile.peerType = peerType
return r
}
static func contactLink(_ peerType: ChatPeerType?) -> MsgChatLink {
.contact(connLink: "https://simplex.chat/a#alice", profile: Profile(displayName: "alice", fullName: "", peerType: peerType), business: false)
}
static func linkItem(_ peerType: ChatPeerType?) -> ChatItem {
let link = contactLink(peerType)
return ChatItem(chatDir: .directRcv, meta: CIMeta.getSample(1, previewDate, link.connLinkStr), content: .rcvMsgContent(msgContent: .chat(text: link.connLinkStr, chatLink: link, ownerSig: nil)))
}
}
@@ -70,18 +70,18 @@ struct SimpleXInfo: View {
.multilineTextAlignment(.center)
.fixedSize(horizontal: false, vertical: true)
if onboarding {
Spacer(minLength: 0)
Spacer(minLength: 0)
if onboarding {
createFirstProfileButton()
.padding(.vertical, 10)
}
Button {
showWhyBuilt = true
} label: {
Label("Why SimpleX is built.", systemImage: "info.circle")
.font(.headline)
}
Button {
showWhyBuilt = true
} label: {
Label("Why SimpleX is built.", systemImage: "info.circle")
.font(.headline)
}
}
.padding(.horizontal, 25)
@@ -309,6 +309,7 @@ struct SettingsView: View {
@EnvironmentObject var theme: AppTheme
@ObservedObject private var badgeModel = BadgeModel.shared
@State private var showProgress: Bool = false
var versionText: String? = appVersion
var body: some View {
ZStack {
@@ -419,7 +420,7 @@ struct SettingsView: View {
.navigationBarTitle("App version")
.modifier(ThemedBackground(grouped: true))
} label: {
Text(verbatim: "v\(appVersion ?? "?")")
Text(verbatim: "v\(versionText ?? "?")")
}
}
@@ -637,7 +638,7 @@ struct SettingsView_Previews: PreviewProvider {
static var previews: some View {
let chatModel = ChatModel()
chatModel.currentUser = User.sampleData
return SettingsView()
return SettingsView(versionText: "7.1")
.environmentObject(chatModel)
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 KiB

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 KiB

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 91 KiB

+48 -1
View File
@@ -160,6 +160,15 @@ final class SnapshotTests: XCTestCase {
let rowHash = { (older: ChatItem) in ListItem(item: items[4], prevItem: items[5], nextItem: older, unreadBefore: 0).genHash(false, false) }
XCTAssertNotEqual(rowHash(items[3]), rowHash(unreacted))
}
func testVoiceMessageTimeFormatting() {
XCTAssertEqual(voiceMessageTime(90), "01:30")
XCTAssertEqual(voiceMessageTime(3600), "01:00:00")
XCTAssertEqual(voiceMessageTime(TimeInterval(Int.max)), "00:00")
XCTAssertEqual(voiceMessageTime(.nan), "00:00")
XCTAssertEqual(voiceMessageTime_(nil), "00:00")
XCTAssertEqual(voiceMessageTime_(TimeInterval(Int.max)), "00:00")
}
}
private func layoutCheckDir(_ env: [String: String]) -> URL {
@@ -293,6 +302,7 @@ private func previewScenes() -> [SnapshotScene] {
SnapshotScene(OperatorView_Previews.self),
SnapshotScene(PasscodeEntry_Previews.self),
SnapshotScene(PasscodeViewView_Previews.self),
SnapshotScene(PeerTypePlaceholders_Previews.self),
SnapshotScene(PreferencesView_Previews.self),
SnapshotScene(PrivacySettings_Previews.self),
SnapshotScene(ProfileImage_Previews.self),
@@ -317,6 +327,7 @@ private func previewScenes() -> [SnapshotScene] {
SnapshotScene(TerminalOverviewDirect_Previews.self),
SnapshotScene(TerminalOverviewGroup_Previews.self),
SnapshotScene(TerminalQuoteThumbnail_Previews.self, allSizes: true),
SnapshotScene(TerminalRightToLeft_Previews.self),
SnapshotScene(TerminalRuleOnly_Previews.self, allSizes: true),
SnapshotScene(TerminalSpacing_Previews.self, allSizes: true),
SnapshotScene(UserAddressLearnMore_Previews.self),
@@ -429,6 +440,12 @@ struct TerminalMedia_Previews: PreviewProvider {
}
}
struct TerminalRightToLeft_Previews: PreviewProvider {
static var previews: some View {
SnapshotFixtures().rightToLeft()
}
}
struct TerminalRuleOnly_Previews: PreviewProvider {
static var previews: some View {
SnapshotFixtures().ruleOnly()
@@ -789,6 +806,29 @@ private final class SnapshotFixtures {
.paragraph(content: SegmentRange(from: 0, to: 1)),
.codeBlock(language: nil, content: SegmentRange(from: 4, to: 5))
]
),
"# מה חדש\nגרסה חדשה של האפליקציה\n## תכונות\n| שינוי |\n|---|": ParsedMarkdown(
formattedText: [
FormattedText(text: "# ", format: .markup(token: .headingMark(level: 1))),
FormattedText(text: "מה חדש"),
FormattedText(text: "\n", format: .markup(token: .lineBreak)),
FormattedText(text: "גרסה חדשה של האפליקציה"),
FormattedText(text: "\n", format: .markup(token: .lineBreak)),
FormattedText(text: "## ", format: .markup(token: .headingMark(level: 2))),
FormattedText(text: "תכונות"),
FormattedText(text: "\n", format: .markup(token: .lineBreak)),
FormattedText(text: "| ", format: .markup(token: .rowMark)),
FormattedText(text: "שינוי"),
FormattedText(text: " |", format: .markup(token: .cellMark)),
FormattedText(text: "\n", format: .markup(token: .hardBreak)),
FormattedText(text: "|---|", format: .markup(token: .delimiterRow(columns: [.none])))
],
markdownBlocks: [
.heading(level: 1, content: SegmentRange(from: 1, to: 2)),
.paragraph(content: SegmentRange(from: 3, to: 4)),
.heading(level: 2, content: SegmentRange(from: 6, to: 7)),
.table(columns: [.none], header: [SegmentRange(from: 9, to: 10)], rows: [])
]
)
]
@@ -922,10 +962,17 @@ private final class SnapshotFixtures {
}
}
func rightToLeft() -> some View {
chatRows(direct, [
msg(.directRcv, "# מה חדש\nגרסה חדשה של האפליקציה\n## תכונות\n| שינוי |\n|---|", -10)
], terminal: true)
}
func ruleOnly() -> some View {
chatRows(direct, [
msg(.directRcv, "---", -10),
msg(.directRcv, "---", -9, quote: quote(.directSnd, "a quoted message that is much wider than the rule"))
msg(.directRcv, "---", -9, quote: quote(.directSnd, "a quoted message that is much wider than the rule")),
msg(.directRcv, "---", -8, content: .report(text: "---", reason: .spam))
], terminal: true)
}
+29 -31
View File
@@ -193,8 +193,8 @@
64C3B0212A0D359700E19930 /* CustomTimePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64C3B0202A0D359700E19930 /* CustomTimePicker.swift */; };
64C8299D2D54AEEE006B9E89 /* libgmp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 64C829982D54AEED006B9E89 /* libgmp.a */; };
64C8299E2D54AEEE006B9E89 /* libffi.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 64C829992D54AEEE006B9E89 /* libffi.a */; };
64C8299F2D54AEEE006B9E89 /* libHSsimplex-chat-7.1.0.19-EeUWDB0JSrwGrOXs6VAyZ0-ghc9.6.3.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 64C8299A2D54AEEE006B9E89 /* libHSsimplex-chat-7.1.0.19-EeUWDB0JSrwGrOXs6VAyZ0-ghc9.6.3.a */; };
64C829A02D54AEEE006B9E89 /* libHSsimplex-chat-7.1.0.19-EeUWDB0JSrwGrOXs6VAyZ0.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 64C8299B2D54AEEE006B9E89 /* libHSsimplex-chat-7.1.0.19-EeUWDB0JSrwGrOXs6VAyZ0.a */; };
64C8299F2D54AEEE006B9E89 /* libHSsimplex-chat-7.1.2.0-5kXbd19XY8rKnXbfrF9Hiz-ghc9.6.3.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 64C8299A2D54AEEE006B9E89 /* libHSsimplex-chat-7.1.2.0-5kXbd19XY8rKnXbfrF9Hiz-ghc9.6.3.a */; };
64C829A02D54AEEE006B9E89 /* libHSsimplex-chat-7.1.2.0-5kXbd19XY8rKnXbfrF9Hiz.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 64C8299B2D54AEEE006B9E89 /* libHSsimplex-chat-7.1.2.0-5kXbd19XY8rKnXbfrF9Hiz.a */; };
64C829A12D54AEEE006B9E89 /* libgmpxx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 64C8299C2D54AEEE006B9E89 /* libgmpxx.a */; };
64D0C2C029F9688300B38D5F /* UserAddressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64D0C2BF29F9688300B38D5F /* UserAddressView.swift */; };
64D0C2C229FA57AB00B38D5F /* UserAddressLearnMore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64D0C2C129FA57AB00B38D5F /* UserAddressLearnMore.swift */; };
@@ -272,7 +272,6 @@
E5AEC0C22F9C000100270665 /* SnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5AEC0C12F9C000100270665 /* SnapshotTests.swift */; };
E5AEC0AF2F91A73500270665 /* ComposeChatLinkView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5AEC0AE2F91A73500270665 /* ComposeChatLinkView.swift */; };
E5C0BBE82F82B45500EA7527 /* SimpleXAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E5C0BBE72F82B45500EA7527 /* SimpleXAssets.xcassets */; };
E5C0BBE92F82B45500EA7527 /* SimpleXAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E5C0BBE72F82B45500EA7527 /* SimpleXAssets.xcassets */; };
E5C0BBEB2F82B45500EA7527 /* SharedAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E5C0BBEA2F82B45500EA7527 /* SharedAssets.xcassets */; };
E5C0BBEC2F82B45500EA7527 /* SharedAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E5C0BBEA2F82B45500EA7527 /* SharedAssets.xcassets */; };
E5DBF1932F88169800E1D7FD /* ConnectBannerCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5DBF1922F88169800E1D7FD /* ConnectBannerCard.swift */; };
@@ -600,8 +599,8 @@
64C3B0202A0D359700E19930 /* CustomTimePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomTimePicker.swift; sourceTree = "<group>"; };
64C829982D54AEED006B9E89 /* libgmp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgmp.a; sourceTree = "<group>"; };
64C829992D54AEEE006B9E89 /* libffi.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libffi.a; sourceTree = "<group>"; };
64C8299A2D54AEEE006B9E89 /* libHSsimplex-chat-7.1.0.19-EeUWDB0JSrwGrOXs6VAyZ0-ghc9.6.3.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libHSsimplex-chat-7.1.0.19-EeUWDB0JSrwGrOXs6VAyZ0-ghc9.6.3.a"; sourceTree = "<group>"; };
64C8299B2D54AEEE006B9E89 /* libHSsimplex-chat-7.1.0.19-EeUWDB0JSrwGrOXs6VAyZ0.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libHSsimplex-chat-7.1.0.19-EeUWDB0JSrwGrOXs6VAyZ0.a"; sourceTree = "<group>"; };
64C8299A2D54AEEE006B9E89 /* libHSsimplex-chat-7.1.2.0-5kXbd19XY8rKnXbfrF9Hiz-ghc9.6.3.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libHSsimplex-chat-7.1.2.0-5kXbd19XY8rKnXbfrF9Hiz-ghc9.6.3.a"; sourceTree = "<group>"; };
64C8299B2D54AEEE006B9E89 /* libHSsimplex-chat-7.1.2.0-5kXbd19XY8rKnXbfrF9Hiz.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libHSsimplex-chat-7.1.2.0-5kXbd19XY8rKnXbfrF9Hiz.a"; sourceTree = "<group>"; };
64C8299C2D54AEEE006B9E89 /* libgmpxx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgmpxx.a; sourceTree = "<group>"; };
64D0C2BF29F9688300B38D5F /* UserAddressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserAddressView.swift; sourceTree = "<group>"; };
64D0C2C129FA57AB00B38D5F /* UserAddressLearnMore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserAddressLearnMore.swift; sourceTree = "<group>"; };
@@ -788,8 +787,8 @@
64C8299D2D54AEEE006B9E89 /* libgmp.a in Frameworks */,
64C8299E2D54AEEE006B9E89 /* libffi.a in Frameworks */,
64C829A12D54AEEE006B9E89 /* libgmpxx.a in Frameworks */,
64C8299F2D54AEEE006B9E89 /* libHSsimplex-chat-7.1.0.19-EeUWDB0JSrwGrOXs6VAyZ0-ghc9.6.3.a in Frameworks */,
64C829A02D54AEEE006B9E89 /* libHSsimplex-chat-7.1.0.19-EeUWDB0JSrwGrOXs6VAyZ0.a in Frameworks */,
64C8299F2D54AEEE006B9E89 /* libHSsimplex-chat-7.1.2.0-5kXbd19XY8rKnXbfrF9Hiz-ghc9.6.3.a in Frameworks */,
64C829A02D54AEEE006B9E89 /* libHSsimplex-chat-7.1.2.0-5kXbd19XY8rKnXbfrF9Hiz.a in Frameworks */,
CE38A29C2C3FCD72005ED185 /* SwiftyGif in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -876,8 +875,8 @@
64C829992D54AEEE006B9E89 /* libffi.a */,
64C829982D54AEED006B9E89 /* libgmp.a */,
64C8299C2D54AEEE006B9E89 /* libgmpxx.a */,
64C8299A2D54AEEE006B9E89 /* libHSsimplex-chat-7.1.0.19-EeUWDB0JSrwGrOXs6VAyZ0-ghc9.6.3.a */,
64C8299B2D54AEEE006B9E89 /* libHSsimplex-chat-7.1.0.19-EeUWDB0JSrwGrOXs6VAyZ0.a */,
64C8299A2D54AEEE006B9E89 /* libHSsimplex-chat-7.1.2.0-5kXbd19XY8rKnXbfrF9Hiz-ghc9.6.3.a */,
64C8299B2D54AEEE006B9E89 /* libHSsimplex-chat-7.1.2.0-5kXbd19XY8rKnXbfrF9Hiz.a */,
);
path = Libraries;
sourceTree = "<group>";
@@ -1602,7 +1601,6 @@
buildActionMask = 2147483647;
files = (
E5DCF9712C590272007928CC /* Localizable.strings in Resources */,
E5C0BBE92F82B45500EA7527 /* SimpleXAssets.xcassets in Resources */,
E5C0BBEC2F82B45500EA7527 /* SharedAssets.xcassets in Resources */,
E5DCF9982C5906FF007928CC /* InfoPlist.strings in Resources */,
);
@@ -2231,7 +2229,7 @@
CLANG_TIDY_MISC_REDUNDANT_EXPRESSION = YES;
CODE_SIGN_ENTITLEMENTS = "SimpleX (iOS).entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 367;
CURRENT_PROJECT_VERSION = 371;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 5NN7GUYB6T;
ENABLE_BITCODE = NO;
@@ -2256,7 +2254,7 @@
"@executable_path/Frameworks",
);
LLVM_LTO = YES_THIN;
MARKETING_VERSION = 7.1;
MARKETING_VERSION = 7.1.2;
OTHER_LDFLAGS = "-Wl,-stack_size,0x1000000";
PRODUCT_BUNDLE_IDENTIFIER = chat.simplex.app;
PRODUCT_NAME = SimpleX;
@@ -2281,7 +2279,7 @@
CLANG_TIDY_MISC_REDUNDANT_EXPRESSION = YES;
CODE_SIGN_ENTITLEMENTS = "SimpleX (iOS).entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 367;
CURRENT_PROJECT_VERSION = 371;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = 5NN7GUYB6T;
ENABLE_BITCODE = NO;
@@ -2306,7 +2304,7 @@
"@executable_path/Frameworks",
);
LLVM_LTO = YES;
MARKETING_VERSION = 7.1;
MARKETING_VERSION = 7.1.2;
OTHER_LDFLAGS = "-Wl,-stack_size,0x1000000";
PRODUCT_BUNDLE_IDENTIFIER = chat.simplex.app;
PRODUCT_NAME = SimpleX;
@@ -2323,11 +2321,11 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 367;
CURRENT_PROJECT_VERSION = 371;
DEVELOPMENT_TEAM = 5NN7GUYB6T;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MARKETING_VERSION = 7.1;
MARKETING_VERSION = 7.1.2;
PRODUCT_BUNDLE_IDENTIFIER = "chat.simplex.Tests-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
@@ -2343,11 +2341,11 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 367;
CURRENT_PROJECT_VERSION = 371;
DEVELOPMENT_TEAM = 5NN7GUYB6T;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MARKETING_VERSION = 7.1;
MARKETING_VERSION = 7.1.2;
PRODUCT_BUNDLE_IDENTIFIER = "chat.simplex.Tests-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
@@ -2405,7 +2403,7 @@
CODE_SIGN_ENTITLEMENTS = "SimpleX NSE/SimpleX NSE.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 367;
CURRENT_PROJECT_VERSION = 371;
DEVELOPMENT_TEAM = 5NN7GUYB6T;
ENABLE_BITCODE = NO;
GCC_OPTIMIZATION_LEVEL = s;
@@ -2420,7 +2418,7 @@
"@executable_path/../../Frameworks",
);
LLVM_LTO = YES;
MARKETING_VERSION = 7.1;
MARKETING_VERSION = 7.1.2;
PRODUCT_BUNDLE_IDENTIFIER = "chat.simplex.app.SimpleX-NSE";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -2442,7 +2440,7 @@
CODE_SIGN_ENTITLEMENTS = "SimpleX NSE/SimpleX NSE.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 367;
CURRENT_PROJECT_VERSION = 371;
DEVELOPMENT_TEAM = 5NN7GUYB6T;
ENABLE_BITCODE = NO;
ENABLE_CODE_COVERAGE = NO;
@@ -2457,7 +2455,7 @@
"@executable_path/../../Frameworks",
);
LLVM_LTO = YES;
MARKETING_VERSION = 7.1;
MARKETING_VERSION = 7.1.2;
PRODUCT_BUNDLE_IDENTIFIER = "chat.simplex.app.SimpleX-NSE";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -2479,7 +2477,7 @@
CLANG_TIDY_BUGPRONE_REDUNDANT_BRANCH_CONDITION = YES;
CLANG_TIDY_MISC_REDUNDANT_EXPRESSION = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 367;
CURRENT_PROJECT_VERSION = 371;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 5NN7GUYB6T;
DYLIB_COMPATIBILITY_VERSION = 1;
@@ -2505,7 +2503,7 @@
"$(PROJECT_DIR)/Libraries/sim",
);
LLVM_LTO = YES;
MARKETING_VERSION = 7.1;
MARKETING_VERSION = 7.1.2;
PRODUCT_BUNDLE_IDENTIFIER = chat.simplex.SimpleXChat;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SDKROOT = iphoneos;
@@ -2530,7 +2528,7 @@
CLANG_TIDY_BUGPRONE_REDUNDANT_BRANCH_CONDITION = YES;
CLANG_TIDY_MISC_REDUNDANT_EXPRESSION = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 367;
CURRENT_PROJECT_VERSION = 371;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 5NN7GUYB6T;
DYLIB_COMPATIBILITY_VERSION = 1;
@@ -2557,7 +2555,7 @@
"$(PROJECT_DIR)/Libraries/sim",
);
LLVM_LTO = YES;
MARKETING_VERSION = 7.1;
MARKETING_VERSION = 7.1.2;
PRODUCT_BUNDLE_IDENTIFIER = chat.simplex.SimpleXChat;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SDKROOT = iphoneos;
@@ -2584,7 +2582,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CODE_SIGN_ENTITLEMENTS = "SimpleX SE/SimpleX SE.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 367;
CURRENT_PROJECT_VERSION = 371;
DEVELOPMENT_TEAM = 5NN7GUYB6T;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
@@ -2599,7 +2597,7 @@
"@executable_path/../../Frameworks",
);
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 7.1;
MARKETING_VERSION = 7.1.2;
PRODUCT_BUNDLE_IDENTIFIER = "chat.simplex.app.SimpleX-SE";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
@@ -2618,7 +2616,7 @@
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CODE_SIGN_ENTITLEMENTS = "SimpleX SE/SimpleX SE.entitlements";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 367;
CURRENT_PROJECT_VERSION = 371;
DEVELOPMENT_TEAM = 5NN7GUYB6T;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
@@ -2633,7 +2631,7 @@
"@executable_path/../../Frameworks",
);
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 7.1;
MARKETING_VERSION = 7.1.2;
PRODUCT_BUNDLE_IDENTIFIER = "chat.simplex.app.SimpleX-SE";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
@@ -2751,7 +2749,7 @@
repositoryURL = "https://github.com/simplex-chat/WebRTC.git";
requirement = {
kind = revision;
revision = 34bedc50f9c58dccf4967ea59c7e6a47d620803b;
revision = 7771ab09f540f620d7780298e378e006a5fe5a7d;
};
};
D77B92DA2952372200A5A1CC /* XCRemoteSwiftPackageReference "SwiftyGif" */ = {
@@ -49,7 +49,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/simplex-chat/WebRTC.git",
"state" : {
"revision" : "34bedc50f9c58dccf4967ea59c7e6a47d620803b"
"revision" : "7771ab09f540f620d7780298e378e006a5fe5a7d"
}
},
{
+1 -1
View File
@@ -262,7 +262,7 @@ public struct NetCfg: Codable, Equatable {
var socksMode: SocksMode = .always
public var hostMode: HostMode = .publicHost
public var requiredHostMode = true
public var sessionMode = TransportSessionMode.user
public var sessionMode = TransportSessionMode.session
public var smpProxyMode: SMPProxyMode = .always
public var smpProxyFallback: SMPProxyFallback = .allowProtected
public var smpWebPortServers: SMPWebPortServers = .preset
+15 -27
View File
@@ -310,11 +310,11 @@ extension ChatLayout: Codable {
}
}
public func peerTypeIcon(_ peerType: ChatPeerType?) -> Image {
public func peerTypeIcon(_ peerType: ChatPeerType?, person: Image = Image(systemName: "person.crop.circle.fill"), agent: Image = Image("agent")) -> Image {
switch peerType {
case .bot: Image(systemName: "cube.fill")
case .agent: Image("agent")
default: Image(systemName: "person.crop.circle.fill")
case .agent: agent
default: person
}
}
@@ -960,18 +960,6 @@ public func fullPreferencesToPreferences(_ fullPreferences: FullPreferences) ->
)
}
public func contactUserPreferencesToPreferences(_ contactUserPreferences: ContactUserPreferences) -> Preferences {
Preferences(
timedMessages: contactUserPreferences.timedMessages.userPreference.preference,
fullDelete: contactUserPreferences.fullDelete.userPreference.preference,
reactions: contactUserPreferences.reactions.userPreference.preference,
voice: contactUserPreferences.voice.userPreference.preference,
files: contactUserPreferences.files.userPreference.preference,
calls: contactUserPreferences.calls.userPreference.preference,
commands: contactUserPreferences.commands
)
}
public protocol Preference: Codable, Equatable, Hashable {
var allow: FeatureAllowed { get set }
}
@@ -5747,25 +5735,25 @@ public enum MsgChatLink: Equatable, Hashable {
}
}
public var iconName: String {
public var icon: Image {
switch self {
case let .group(_, groupProfile):
groupProfile.isChannel ? "antenna.radiowaves.left.and.right.circle.fill" : "person.2.circle.fill"
case let .contact(_, _, business):
business ? "briefcase.circle.fill" : "person.crop.circle.fill"
case .invitation:
"person.crop.circle.fill"
Image(systemName: groupProfile.isChannel ? "antenna.radiowaves.left.and.right.circle.fill" : "person.2.circle.fill")
case let .contact(_, profile, business):
business ? Image(systemName: "briefcase.circle.fill") : peerTypeIcon(profile.peerType)
case let .invitation(_, profile):
peerTypeIcon(profile.peerType)
}
}
public var smallIconName: String {
public func smallIcon(agent: Image = Image("agent")) -> Image {
switch self {
case let .group(_, groupProfile):
groupProfile.isChannel ? "antenna.radiowaves.left.and.right" : "person.2"
case let .contact(_, _, business):
business ? "briefcase" : "person"
case .invitation:
"person"
Image(systemName: groupProfile.isChannel ? "antenna.radiowaves.left.and.right" : "person.2")
case let .contact(_, profile, business):
business ? Image(systemName: "briefcase") : peerTypeIcon(profile.peerType, person: Image(systemName: "person"), agent: agent)
case let .invitation(_, profile):
peerTypeIcon(profile.peerType, person: Image(systemName: "person"), agent: agent)
}
}
+1 -1
View File
@@ -97,7 +97,7 @@ public func chatIcon(_ cInfo: ChatInfo) -> Image {
case let .direct(contact): contact.chatIcon
case let .group(groupInfo, _): Image(systemName: groupInfo.chatIconName)
case .local: Image(systemName: "folder.circle.fill")
case .contactRequest: Image(systemName: "person.crop.circle.fill")
case let .contactRequest(contactRequest): peerTypeIcon(contactRequest.profile.peerType)
default: Image(systemName: "circle.fill")
}
}
+1
View File
@@ -151,6 +151,7 @@ Establishing contact between two SimpleX Chat users. SimpleX uses no user identi
| `ChatError.errorAgent(.SMP(_, .BLOCKED(info)))` | Server operator blocked connection | Alert: "Connection blocked" with reason |
| `ChatError.errorAgent(.SMP(_, .QUOTA))` | Too many undelivered messages | Alert: "Undelivered messages" |
| `ChatError.errorAgent(.INTERNAL("SEUniqueID"))` | Duplicate connection attempt | Alert: "Already connected?" |
| `ChatError.errorAgent(.CONN(.DUPLICATE, _))` | One-time link already used to connect | Alert: "Already connected?" |
| `ChatError.errorAgent(.BROKER(_, .TIMEOUT))` | Server timeout | Retryable via `chatApiSendCmdWithRetry` |
| `ChatError.errorAgent(.BROKER(_, .NETWORK))` | Network failure | Retryable via `chatApiSendCmdWithRetry` |
| `contactAlreadyExists` | Connecting to existing contact | Alert: "Contact already exists" with contact name |
+4 -3
View File
@@ -190,7 +190,7 @@ Renders emoji-only messages (messages containing only emoji characters) in a lar
**File**: [`Shared/Views/Chat/ChatItem/MsgContentView.swift`](../../Shared/Views/Chat/ChatItem/MsgContentView.swift)
Renders message text with SimpleX markdown formatting (bold, italic, code, links, mentions). Blocks of `markdownBlocks` (paragraphs, headings, lists, quotes, code blocks, tables, rules) are drawn as a column of views by `MarkdownBlocksView`; code blocks and tables scroll sideways. The core sends `markdownBlocks` for text with block syntax or an empty line, up to 2000 markup tokens. In bubbles, each empty line is one line of the font, in a gap of zero width: the bubble is as wide as its widest block.
Renders message text with SimpleX markdown formatting (bold, italic, code, links, mentions). Blocks of `markdownBlocks` (paragraphs, headings, lists, quotes, code blocks, tables, rules) are drawn as a column of views by `MarkdownBlocksView`; code blocks and tables scroll sideways. The core sends `markdownBlocks` for text with block syntax or an empty line, up to 2000 markup tokens. A report whose blocks have no text ranges (only rules) is drawn as one text: the reason, then the source text of the rules. In bubbles and outside chats, the gap of n empty lines is n × (`font.lineHeight` + `font.leading`), with one `font.leading` more after a block, as the same lines in one text, where the leading is added between lines only; the gap has zero width: the bubble is as wide as its widest block.
Text colour: `textColor`, else `messageTextColor(theme)`: `onSurface`, at 95% in dark themes. `FramedItemView` passes `onSurface` for quote text (terminal rows: 70%). `MarkdownView` (chat item info, group welcome message, profile description) draws its text in `messageTextColor(theme)`.
@@ -423,7 +423,8 @@ FramedItemView background, quote background and header backgrounds omitte
MsgContentView line box terminalLineBox; meta line for live messages, and in the line box after empty lines at the text end
text ends with the transparent copy of the meta (reserveSpaceForMeta)
text without markdownBlocks (over 2000 markup tokens) keeps one full line per empty line
MarkdownBlocksView code block, table or rule next to another block (MarkdownBlock.isCard): terminalParagraphGap,
MarkdownBlocksView all gaps have zero width: the column is as wide as its widest block
code block, table or rule next to another block (MarkdownBlock.isCard): terminalParagraphGap,
or the typed empty lines when they are higher
heading after another block: terminalLevelStep
block other than a heading after a heading: terminalHeadingBottomGap
@@ -560,7 +561,7 @@ Navigates to a dedicated members view with two sections:
- **Owners**: current user (if owner) + members with `memberRole >= .owner`
- **Subscribers** (admin+ only): members with `memberRole < .owner`
Member rows show profile image, display name (with verified shield), connection status, and role badge. Non-user rows link to `GroupMemberInfoView`.
Member rows show profile image, display name (with verified shield), connection status, and role badge. Non-user rows link to `GroupMemberInfoView`. `MemberProfileImage` draws a member's avatar: the member's image, otherwise the placeholder of its peer type (`peerTypeIcon`: person, agent or cube).
### Channel Link
@@ -383,7 +383,7 @@ fun IncomingCallLockScreenAlertLayout(
if (chatModel.controller.appPrefs.notificationPreviewMode.get() == NotificationPreviewMode.HIDDEN.name) {
ProfileImage(size = 192.dp)
} else {
ProfileImage(size = 192.dp, image = invitation.contact.profile.image)
ProfileImage(size = 192.dp, image = invitation.contact.profile.image, icon = invitation.contact.chatIconName)
Text(invitation.contact.chatViewName, style = MaterialTheme.typography.h2)
}
Spacer(Modifier.fillMaxHeight().weight(1f))
@@ -395,7 +395,7 @@ private fun ActiveCallOverlayLayout(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
ProfileImage(size = 192.dp, image = call.contact.profile.image)
ProfileImage(size = 192.dp, image = call.contact.profile.image, icon = call.contact.chatIconName)
AudioCallInfoView(call)
}
}
@@ -4,6 +4,7 @@ import android.os.Build.VERSION.SDK_INT
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.State
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.painter.BitmapPainter
import androidx.compose.ui.graphics.painter.Painter
@@ -12,6 +13,7 @@ import chat.simplex.common.model.CIFile
import chat.simplex.common.platform.*
import chat.simplex.common.ui.theme.CurrentColors
import chat.simplex.common.views.helpers.ModalManager
import chat.simplex.common.views.helpers.boundedImageSize
import coil.ImageLoader
import coil.compose.rememberAsyncImagePainter
import coil.decode.GifDecoder
@@ -29,8 +31,9 @@ actual fun SimpleAndAnimatedImageView(
ImageView: @Composable (painter: Painter, onClick: () -> Unit) -> Unit
) {
val context = LocalContext.current
val size = remember(data) { boundedImageSize(data) }
val imagePainter = rememberAsyncImagePainter(
ImageRequest.Builder(context).data(data = data).size(coil.size.Size.ORIGINAL).build(),
ImageRequest.Builder(context).data(data = data).size(size).build(),
placeholder = BitmapPainter(imageBitmap), // show original image while it's still loading by coil
imageLoader = imageLoader
)
@@ -13,24 +13,25 @@ import androidx.compose.ui.viewinterop.AndroidView
import androidx.core.view.isVisible
import chat.simplex.common.platform.VideoPlayer
import chat.simplex.common.platform.androidAppContext
import chat.simplex.common.views.helpers.boundedImageSize
import chat.simplex.res.*
import coil.ImageLoader
import coil.compose.rememberAsyncImagePainter
import coil.decode.GifDecoder
import coil.decode.ImageDecoderDecoder
import coil.request.ImageRequest
import coil.size.Size
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout
import com.google.android.exoplayer2.ui.StyledPlayerView
import dev.icerock.moko.resources.compose.stringResource
@Composable
actual fun FullScreenImageView(modifier: Modifier, data: ByteArray, imageBitmap: ImageBitmap) {
val size = remember(data) { boundedImageSize(data) }
// I'm using a new private instance of imageLoader here because if I use one instance in multiple places
// after end of composition here a GIF from the first instance will be paused automatically which isn't what I want
Image(
rememberAsyncImagePainter(
ImageRequest.Builder(LocalContext.current).data(data = data).size(Size.ORIGINAL).build(),
ImageRequest.Builder(LocalContext.current).data(data = data).size(size).build(),
placeholder = BitmapPainter(imageBitmap), // show original image while it's still loading by coil
imageLoader = imageLoader
),
@@ -25,10 +25,15 @@ import chat.simplex.common.helpers.*
import chat.simplex.common.model.*
import chat.simplex.common.platform.*
import chat.simplex.res.*
import coil.size.Size
import dev.icerock.moko.resources.StringResource
import java.io.*
import java.net.URI
private const val MAX_IMAGE_DIMENSION = 4320
private const val MAX_SOURCE_IMAGE_DIMENSION = 16384
private const val MAX_DECODED_PIXELS = MAX_IMAGE_DIMENSION * MAX_IMAGE_DIMENSION
fun Spanned.toHtmlWithoutParagraphs(): String {
return HtmlCompat.toHtml(this, HtmlCompat.TO_HTML_PARAGRAPH_LINES_CONSECUTIVE)
.substringAfter("<p dir=\"ltr\">").substringBeforeLast("</p>")
@@ -195,12 +200,12 @@ actual suspend fun getLoadedImage(file: CIFile?): Pair<ImageBitmap, ByteArray>?
}
// https://developer.android.com/topic/performance/graphics/load-bitmap#load-bitmap
internal fun decodeSampledBitmapFromByteArray(data: ByteArray, reqWidth: Int, reqHeight: Int, maxDimension: Int = Int.MAX_VALUE): Bitmap {
internal fun decodeSampledBitmapFromByteArray(data: ByteArray, reqWidth: Int, reqHeight: Int, maxDimension: Int = MAX_SOURCE_IMAGE_DIMENSION): Bitmap {
// First decode with inJustDecodeBounds=true to check dimensions
return BitmapFactory.Options().run {
inJustDecodeBounds = true
BitmapFactory.decodeByteArray(data, 0, data.size, this)
if (outWidth > maxDimension || outHeight > maxDimension) throw IOException("Image dimensions exceed limit")
if (outWidth !in 1..maxDimension || outHeight !in 1..maxDimension) throw IOException("Image dimensions exceed limit")
// Calculate inSampleSize
inSampleSize = calculateInSampleSize(this, reqWidth, reqHeight)
// Decode bitmap with inSampleSize set
@@ -211,6 +216,14 @@ internal fun decodeSampledBitmapFromByteArray(data: ByteArray, reqWidth: Int, re
}
}
internal fun boundedImageSize(data: ByteArray): Size =
BitmapFactory.Options().run {
inJustDecodeBounds = true
BitmapFactory.decodeByteArray(data, 0, data.size, this)
val sampleSize = calculateInSampleSize(this, MAX_IMAGE_DIMENSION, MAX_IMAGE_DIMENSION)
Size(outWidth / sampleSize, outHeight / sampleSize)
}
private fun calculateInSampleSize(options: BitmapFactory.Options, reqWidth: Int, reqHeight: Int): Int {
// Raw height and width of image
val (height: Int, width: Int) = options.run { outHeight to outWidth }
@@ -225,6 +238,9 @@ private fun calculateInSampleSize(options: BitmapFactory.Options, reqWidth: Int,
inSampleSize *= 2
}
}
while ((width / inSampleSize).toLong() * (height / inSampleSize) > MAX_DECODED_PIXELS) {
inSampleSize *= 2
}
return inSampleSize
}
@@ -91,7 +91,7 @@ fun MainScreen() {
showChatDatabaseError = chatModel.chatDbStatus.value != DBMigrationResult.OK && chatModel.chatDbStatus.value != null
}
var showAdvertiseLAAlert by remember { mutableStateOf(false) }
LaunchedEffect(showAdvertiseLAAlert) {
LaunchedEffect(showAdvertiseLAAlert, chatModel.chatRunning.value != null) {
if (
!chatModel.controller.appPrefs.laNoticeShown.get()
&& !appPrefs.performLA.get()
@@ -99,6 +99,7 @@ fun MainScreen() {
&& chatModel.controller.appPrefs.onboardingStage.get() == OnboardingStage.OnboardingComplete
&& chatModel.chats.size > 3
&& chatModel.activeCallInvitation.value == null
&& !AlertManager.shared.hasAlertsShown()
) {
AppLock.showLANotice(ChatModel.controller.appPrefs.laNoticeShown) }
}
@@ -458,6 +458,9 @@ object ChatModel {
suspend fun addChat(chat: Chat) {
chats.add(index = 0, chat)
if (secondaryContextFilter == null) {
addPresetChatTags(chat.chatInfo, chat.chatStats)
}
popChatCollector.throttlePopChat(chat.remoteHostId, chat.id, currentPosition = 0)
}
@@ -519,7 +522,6 @@ object ChatModel {
updateChatInfo(rhId, cInfo)
} else if (addMissing) {
addChat(Chat(remoteHostId = rhId, chatInfo = cInfo, chatItems = arrayListOf()))
addPresetChatTags(cInfo, Chat.ChatStats())
}
}
@@ -2255,11 +2257,11 @@ private val ChatLayoutMode?.known: ChatLayoutMode? get() = if (this is ChatLayou
fun profileChatLayout(user: User?): ChatLayoutMode =
user?.uiThemes?.chatLayout.known ?: ChatController.appPrefs.chatLayout.state.value.known ?: ChatLayoutMode.Classic
fun peerTypeIcon(peerType: ChatPeerType?): ImageResource =
fun peerTypeIcon(peerType: ChatPeerType?, person: ImageResource = MR.images.ic_account_circle_filled): ImageResource =
when (peerType) {
ChatPeerType.Bot -> MR.images.ic_cube
ChatPeerType.Agent -> MR.images.ic_agent
else -> MR.images.ic_account_circle_filled
else -> person
}
// Supporter badge. The credential/proof bytes stay core-side; the UI only sees the disclosed type + status.
@@ -5274,15 +5276,15 @@ sealed class MsgChatLink {
val iconRes: ImageResource
get() = when (this) {
is Group -> if (groupProfile.isChannel) MR.images.ic_bigtop_updates_circle_filled else MR.images.ic_supervised_user_circle_filled
is Contact -> if (business) MR.images.ic_work_filled_padded else MR.images.ic_account_circle_filled
is Invitation -> MR.images.ic_account_circle_filled
is Contact -> if (business) MR.images.ic_work_filled_padded else peerTypeIcon(profile.peerType)
is Invitation -> peerTypeIcon(profile.peerType)
}
val smallIconRes: ImageResource
get() = when (this) {
is Group -> if (groupProfile.isChannel) MR.images.ic_bigtop_updates else MR.images.ic_group
is Contact -> if (business) MR.images.ic_work else MR.images.ic_person
is Invitation -> MR.images.ic_person
is Contact -> if (business) MR.images.ic_work else peerTypeIcon(profile.peerType, MR.images.ic_person)
is Invitation -> peerTypeIcon(profile.peerType, MR.images.ic_person)
}
fun infoLine(signed: Boolean): String {
@@ -1782,6 +1782,14 @@ object ChatController {
generalGetString(MR.strings.connection_error_auth_desc)
)
}
r is API.Error && r.err is ChatError.ChatErrorAgent
&& r.err.agentError is AgentErrorType.CONN
&& r.err.agentError.connErr is ConnectionErrorType.DUPLICATE -> {
AlertManager.shared.showAlertMsg(
generalGetString(MR.strings.connection_error_duplicate),
generalGetString(MR.strings.connection_error_duplicate_desc).format("CONN DUPLICATE")
)
}
r is API.Error && r.err is ChatError.ChatErrorAgent
&& r.err.agentError is AgentErrorType.SMP
&& r.err.agentError.smpErr is SMPErrorType.BLOCKED -> {
@@ -2676,7 +2684,7 @@ object ChatController {
}
suspend fun allowFeatureToContact(rh: Long?, contact: Contact, feature: ChatFeature, param: Int? = null) {
val prefs = contact.mergedPreferences.toPreferences().setAllowed(feature, param = param)
val prefs = contact.userPreferences.setAllowed(feature, param = param)
val toContact = apiSetContactPrefs(rh, contact.contactId, prefs)
if (toContact != null) {
withContext(Dispatchers.Main) {
@@ -3808,7 +3816,7 @@ object ChatController {
generalGetString(MR.strings.marked_deleted_description)
)
}
val deleted = if (r.member_ != null && (cItem.chatDir as CIDirection.GroupRcv?)?.groupMember?.groupMemberId != r.member_.groupMemberId) {
val deleted = if (r.member_ != null && (cItem.chatDir as? CIDirection.GroupRcv)?.groupMember?.groupMemberId != r.member_.groupMemberId) {
CIDeleted.Moderated(Clock.System.now(), r.member_)
} else {
CIDeleted.Deleted(Clock.System.now())
@@ -3825,12 +3833,12 @@ object ChatController {
// Stop voice playback only inside a chat, allow to play in a chat list
AudioPlayer.stop(cItem)
}
val deleted = if (r.member_ != null && (cItem.chatDir as CIDirection.GroupRcv?)?.groupMember?.groupMemberId != r.member_.groupMemberId) {
val deleted = if (r.member_ != null && (cItem.chatDir as? CIDirection.GroupRcv)?.groupMember?.groupMemberId != r.member_.groupMemberId) {
CIDeleted.Moderated(Clock.System.now(), r.member_)
} else {
CIDeleted.Deleted(Clock.System.now())
}
chatsCtx.upsertChatItem(rhId, cInfo, cItem.copy(meta = cItem.meta.copy(itemDeleted = deleted)))
chatsCtx.upsertChatItem(rhId, cInfo.copy(groupChatScope = chatsCtx.groupScopeInfo), cItem.copy(meta = cItem.meta.copy(itemDeleted = deleted)))
}
}
}
@@ -5257,7 +5265,7 @@ data class ProtocolTestFailure(
testError is AgentErrorType.BROKER && testError.brokerErr is BrokerErrorType.NETWORK && testError.brokerErr.networkError is NetworkError.UnknownCAError ->
err + " " + generalGetString(MR.strings.error_smp_test_certificate)
else ->
err + " " + String.format(generalGetString(MR.strings.error_with_info), testError.toString())
err + " " + String.format(generalGetString(MR.strings.error_with_info), testError.string)
}
}
}
@@ -5953,16 +5961,6 @@ data class ContactUserPreferences(
val calls: ContactUserPreference,
val commands: List<ChatBotCommand>?,
) {
fun toPreferences(): ChatPreferences = ChatPreferences(
timedMessages = timedMessages.userPreference.pref,
fullDelete = fullDelete.userPreference.pref,
reactions = reactions.userPreference.pref,
voice = voice.userPreference.pref,
files = files.userPreference.pref,
calls = calls.userPreference.pref,
commands = commands,
)
companion object {
val sampleData = ContactUserPreferences(
timedMessages = ContactUserPreferenceTimed(
@@ -164,7 +164,7 @@ fun CreateProfile(chatModel: ChatModel, close: () -> Unit) {
if (chatModel.localUserCreated.value == true) {
createProfileInProfiles(chatModel, displayName.value, shortDescr.value, profileImage.value, close)
} else {
createProfileInNoProfileSetup(displayName.value, profileImage.value, close)
createProfileInNoProfileSetup(displayName.value, shortDescr.value, profileImage.value, close)
}
},
)
@@ -353,9 +353,9 @@ private fun CreateFirstProfileDesktop(chatModel: ChatModel, close: () -> Unit) {
}
}
fun createProfileInNoProfileSetup(displayName: String, image: String? = null, close: () -> Unit) {
fun createProfileInNoProfileSetup(displayName: String, shortDescr: String, image: String? = null, close: () -> Unit) {
withBGApi {
val user = controller.apiCreateActiveUser(null, Profile(displayName.trim(), "", null, image)) ?: return@withBGApi
val user = controller.apiCreateActiveUser(null, Profile(displayName.trim(), "", shortDescr.trim().ifEmpty { null }, image = image)) ?: return@withBGApi
if (!chatModel.connectedToRemote()) {
chatModel.localUserCreated.value = true
}
@@ -351,7 +351,7 @@ fun ContactCheckRow(
}
} else null
) {
ProfileImage(size = 36.dp, contact.image)
ProfileImage(size = 36.dp, contact.image, contact.chatIconName)
Spacer(Modifier.width(DEFAULT_SPACE_AFTER_ICON))
NameWithBadge(
contact.chatViewName,
Loaded 100 of 301 files, more files were not shown because too many files have changed in this diff. Show more