Compare commits

...

10 Commits

Author SHA1 Message Date
IC Rainbow 4c92e32dc2 WIP: add batching 2023-12-06 01:31:13 +02:00
Evgeny Poberezkin 9df63160e5 ios: fix simplex address view (#3515)
* ios: fix simplex address view

* fix lib paths

* fix call
2023-12-05 09:48:04 +00:00
Stanislav Dmitrenko c8e9788c29 desktop: enhancements to remote desktop connect UI (#3513)
* desktop: enhancements to remote desktop connect UI

* changes

* more changes

This reverts commit e8323e8bfa.

* color

* random port
2023-12-04 21:04:58 +00:00
spaced4ndy 7099776357 docs: fix typo 2023-12-04 19:17:24 +04:00
Evgeny Poberezkin 3481d379c6 core: compatibility with GHC 8.10.7, narrow dependency ranges (#3503)
* Revert "raise lower bound on mtl to a real version (#3499)"

This reverts commit f94c0311c1.

* Revert "core: expand ranges to fit ghc 8.10 & 9.6 (#3496)"

This reverts commit 9a1c7f41f7.

* update simplexmq

* remove netword-transport fork

* simplexmq

* fix test

* fix index-state in cabal.project

* simplexmq

* simplexmq

* bytestring,simplexmq

* template-haskell, simplexmq

* simplexmq

* simplexmq

* mtl

* simplexmq
2023-12-04 10:01:37 +00:00
Evgeny Poberezkin 85c1e871dc Merge branch 'stable' 2023-12-04 00:06:53 +00:00
Evgeny Poberezkin fec5ff3f15 docs: SimpleX address (#3508)
* docs: SimpleX address

* table

* header
2023-12-03 22:21:13 +00:00
Evgeny Poberezkin acaa597c90 desktop, android: fix image not appearing in view when received (#3504)
* desktop, android: fix image not appearing in view when received

* change to KeyChangeEffect
2023-12-03 15:42:43 +00:00
Evgeny Poberezkin 6a9a67db14 cli: option to mark shown messages as read (off by default) (#3506)
* cli: option to mark shown messages as read (off by default)

* fix tests

* fix tests
2023-12-03 15:42:26 +00:00
Stanislav Dmitrenko f31054de4f desktop (windows): fix action (#3479) 2023-11-27 22:11:53 +00:00
31 changed files with 440 additions and 293 deletions
+1 -1
View File
@@ -262,7 +262,7 @@ jobs:
# rm -rf dist-newstyle/src/direct-sq* is here because of the bug in cabal's dependency which prevents second build from finishing # rm -rf dist-newstyle/src/direct-sq* is here because of the bug in cabal's dependency which prevents second build from finishing
- name: 'Setup MSYS2' - name: 'Setup MSYS2'
if: startsWith(github.ref, 'refs/tags/v') && matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
uses: msys2/setup-msys2@v2 uses: msys2/setup-msys2@v2
with: with:
msystem: ucrt64 msystem: ucrt64
+12 -20
View File
@@ -11,20 +11,12 @@ import CoreImage.CIFilterBuiltins
struct MutableQRCode: View { struct MutableQRCode: View {
@Binding var uri: String @Binding var uri: String
@State private var image: UIImage? var withLogo: Bool = true
var tintColor = UIColor(red: 0.023, green: 0.176, blue: 0.337, alpha: 1)
var body: some View { var body: some View {
ZStack { QRCode(uri: uri, withLogo: withLogo, tintColor: tintColor)
if let image = image { .id("simplex-qrcode-view-for-\(uri)")
qrCodeImage(image)
}
}
.onAppear {
image = generateImage(uri)
}
.onChange(of: uri) { _ in
image = generateImage(uri)
}
} }
} }
@@ -49,7 +41,7 @@ struct QRCode: View {
var withLogo: Bool = true var withLogo: Bool = true
var tintColor = UIColor(red: 0.023, green: 0.176, blue: 0.337, alpha: 1) var tintColor = UIColor(red: 0.023, green: 0.176, blue: 0.337, alpha: 1)
@State private var image: UIImage? = nil @State private var image: UIImage? = nil
@State private var makeScreenshotBinding: () -> Void = {} @State private var makeScreenshotFunc: () -> Void = {}
var body: some View { var body: some View {
ZStack { ZStack {
@@ -70,18 +62,18 @@ struct QRCode: View {
} }
} }
.onAppear { .onAppear {
makeScreenshotBinding = { makeScreenshotFunc = {
let size = CGSizeMake(1024 / UIScreen.main.scale, 1024 / UIScreen.main.scale) let size = CGSizeMake(1024 / UIScreen.main.scale, 1024 / UIScreen.main.scale)
showShareSheet(items: [makeScreenshot(geo.frame(in: .local).origin, size)])} showShareSheet(items: [makeScreenshot(geo.frame(in: .local).origin, size)])
}
} }
.frame(width: geo.size.width, height: geo.size.height) .frame(width: geo.size.width, height: geo.size.height)
} }
} }
.onTapGesture(perform: makeScreenshotBinding) .onTapGesture(perform: makeScreenshotFunc)
.onAppear { .onAppear {
image = image ?? generateImage(uri)?.replaceColor(UIColor.black, tintColor) image = image ?? generateImage(uri, tintColor: tintColor)
} }
} }
} }
@@ -93,13 +85,13 @@ private func qrCodeImage(_ image: UIImage) -> some View {
.textSelection(.enabled) .textSelection(.enabled)
} }
private func generateImage(_ uri: String) -> UIImage? { private func generateImage(_ uri: String, tintColor: UIColor) -> UIImage? {
let context = CIContext() let context = CIContext()
let filter = CIFilter.qrCodeGenerator() let filter = CIFilter.qrCodeGenerator()
filter.message = Data(uri.utf8) filter.message = Data(uri.utf8)
if let outputImage = filter.outputImage, if let outputImage = filter.outputImage,
let cgImage = context.createCGImage(outputImage, from: outputImage.extent) { let cgImage = context.createCGImage(outputImage, from: outputImage.extent) {
return UIImage(cgImage: cgImage) return UIImage(cgImage: cgImage).replaceColor(UIColor.black, tintColor)
} }
return nil return nil
} }
@@ -190,7 +190,8 @@ struct UserAddressView: View {
@ViewBuilder private func existingAddressView(_ userAddress: UserContactLink) -> some View { @ViewBuilder private func existingAddressView(_ userAddress: UserContactLink) -> some View {
Section { Section {
MutableQRCode(uri: Binding.constant(simplexChatLink(userAddress.connReqContact))) SimpleXLinkQRCode(uri: userAddress.connReqContact)
.id("simplex-contact-address-qrcode-\(userAddress.connReqContact)")
shareQRCodeButton(userAddress) shareQRCodeButton(userAddress)
if MFMailComposeViewController.canSendMail() { if MFMailComposeViewController.canSendMail() {
shareViaEmailButton(userAddress) shareViaEmailButton(userAddress)
+20 -20
View File
@@ -43,6 +43,11 @@
5C3F1D562842B68D00EC8A82 /* IntegrityErrorItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C3F1D552842B68D00EC8A82 /* IntegrityErrorItemView.swift */; }; 5C3F1D562842B68D00EC8A82 /* IntegrityErrorItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C3F1D552842B68D00EC8A82 /* IntegrityErrorItemView.swift */; };
5C3F1D58284363C400EC8A82 /* PrivacySettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C3F1D57284363C400EC8A82 /* PrivacySettings.swift */; }; 5C3F1D58284363C400EC8A82 /* PrivacySettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C3F1D57284363C400EC8A82 /* PrivacySettings.swift */; };
5C4B3B0A285FB130003915F2 /* DatabaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C4B3B09285FB130003915F2 /* DatabaseView.swift */; }; 5C4B3B0A285FB130003915F2 /* DatabaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C4B3B09285FB130003915F2 /* DatabaseView.swift */; };
5C4BB4B82B1E7D75007981AA /* libgmp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C4BB4B32B1E7D75007981AA /* libgmp.a */; };
5C4BB4B92B1E7D75007981AA /* libHSsimplex-chat-5.4.0.6-DWi9o3X1dc6Jx2FZ4ew1fo-ghc8.10.7.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C4BB4B42B1E7D75007981AA /* libHSsimplex-chat-5.4.0.6-DWi9o3X1dc6Jx2FZ4ew1fo-ghc8.10.7.a */; };
5C4BB4BA2B1E7D75007981AA /* libHSsimplex-chat-5.4.0.6-DWi9o3X1dc6Jx2FZ4ew1fo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C4BB4B52B1E7D75007981AA /* libHSsimplex-chat-5.4.0.6-DWi9o3X1dc6Jx2FZ4ew1fo.a */; };
5C4BB4BB2B1E7D75007981AA /* libffi.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C4BB4B62B1E7D75007981AA /* libffi.a */; };
5C4BB4BC2B1E7D75007981AA /* libgmpxx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C4BB4B72B1E7D75007981AA /* libgmpxx.a */; };
5C5346A827B59A6A004DF848 /* ChatHelp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C5346A727B59A6A004DF848 /* ChatHelp.swift */; }; 5C5346A827B59A6A004DF848 /* ChatHelp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C5346A727B59A6A004DF848 /* ChatHelp.swift */; };
5C55A91F283AD0E400C4E99E /* CallManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C55A91E283AD0E400C4E99E /* CallManager.swift */; }; 5C55A91F283AD0E400C4E99E /* CallManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C55A91E283AD0E400C4E99E /* CallManager.swift */; };
5C55A921283CCCB700C4E99E /* IncomingCallView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C55A920283CCCB700C4E99E /* IncomingCallView.swift */; }; 5C55A921283CCCB700C4E99E /* IncomingCallView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C55A920283CCCB700C4E99E /* IncomingCallView.swift */; };
@@ -120,11 +125,6 @@
5CCD403727A5F9A200368C90 /* ScanToConnectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CCD403627A5F9A200368C90 /* ScanToConnectView.swift */; }; 5CCD403727A5F9A200368C90 /* ScanToConnectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CCD403627A5F9A200368C90 /* ScanToConnectView.swift */; };
5CD67B8F2B0E858A00C510B1 /* hs_init.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD67B8D2B0E858A00C510B1 /* hs_init.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5CD67B8F2B0E858A00C510B1 /* hs_init.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CD67B8D2B0E858A00C510B1 /* hs_init.h */; settings = {ATTRIBUTES = (Public, ); }; };
5CD67B902B0E858A00C510B1 /* hs_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 5CD67B8E2B0E858A00C510B1 /* hs_init.c */; }; 5CD67B902B0E858A00C510B1 /* hs_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 5CD67B8E2B0E858A00C510B1 /* hs_init.c */; };
5CD67BA02B120ADF00C510B1 /* libgmp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CD67B9B2B120ADF00C510B1 /* libgmp.a */; };
5CD67BA12B120ADF00C510B1 /* libgmpxx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CD67B9C2B120ADF00C510B1 /* libgmpxx.a */; };
5CD67BA22B120ADF00C510B1 /* libHSsimplex-chat-5.4.0.6-9DfazyElTA72omjHp0C93u.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CD67B9D2B120ADF00C510B1 /* libHSsimplex-chat-5.4.0.6-9DfazyElTA72omjHp0C93u.a */; };
5CD67BA32B120ADF00C510B1 /* libHSsimplex-chat-5.4.0.6-9DfazyElTA72omjHp0C93u-ghc8.10.7.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CD67B9E2B120ADF00C510B1 /* libHSsimplex-chat-5.4.0.6-9DfazyElTA72omjHp0C93u-ghc8.10.7.a */; };
5CD67BA42B120ADF00C510B1 /* libffi.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CD67B9F2B120ADF00C510B1 /* libffi.a */; };
5CDCAD482818589900503DA2 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CDCAD472818589900503DA2 /* NotificationService.swift */; }; 5CDCAD482818589900503DA2 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CDCAD472818589900503DA2 /* NotificationService.swift */; };
5CE2BA702845308900EC33A6 /* SimpleXChat.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CE2BA682845308900EC33A6 /* SimpleXChat.framework */; }; 5CE2BA702845308900EC33A6 /* SimpleXChat.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CE2BA682845308900EC33A6 /* SimpleXChat.framework */; };
5CE2BA712845308900EC33A6 /* SimpleXChat.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5CE2BA682845308900EC33A6 /* SimpleXChat.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 5CE2BA712845308900EC33A6 /* SimpleXChat.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 5CE2BA682845308900EC33A6 /* SimpleXChat.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
@@ -290,6 +290,11 @@
5C3F1D57284363C400EC8A82 /* PrivacySettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrivacySettings.swift; sourceTree = "<group>"; }; 5C3F1D57284363C400EC8A82 /* PrivacySettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrivacySettings.swift; sourceTree = "<group>"; };
5C422A7C27A9A6FA0097A1E1 /* SimpleX (iOS).entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "SimpleX (iOS).entitlements"; sourceTree = "<group>"; }; 5C422A7C27A9A6FA0097A1E1 /* SimpleX (iOS).entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "SimpleX (iOS).entitlements"; sourceTree = "<group>"; };
5C4B3B09285FB130003915F2 /* DatabaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseView.swift; sourceTree = "<group>"; }; 5C4B3B09285FB130003915F2 /* DatabaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DatabaseView.swift; sourceTree = "<group>"; };
5C4BB4B32B1E7D75007981AA /* libgmp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgmp.a; sourceTree = "<group>"; };
5C4BB4B42B1E7D75007981AA /* libHSsimplex-chat-5.4.0.6-DWi9o3X1dc6Jx2FZ4ew1fo-ghc8.10.7.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libHSsimplex-chat-5.4.0.6-DWi9o3X1dc6Jx2FZ4ew1fo-ghc8.10.7.a"; sourceTree = "<group>"; };
5C4BB4B52B1E7D75007981AA /* libHSsimplex-chat-5.4.0.6-DWi9o3X1dc6Jx2FZ4ew1fo.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libHSsimplex-chat-5.4.0.6-DWi9o3X1dc6Jx2FZ4ew1fo.a"; sourceTree = "<group>"; };
5C4BB4B62B1E7D75007981AA /* libffi.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libffi.a; sourceTree = "<group>"; };
5C4BB4B72B1E7D75007981AA /* libgmpxx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgmpxx.a; sourceTree = "<group>"; };
5C5346A727B59A6A004DF848 /* ChatHelp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatHelp.swift; sourceTree = "<group>"; }; 5C5346A727B59A6A004DF848 /* ChatHelp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatHelp.swift; sourceTree = "<group>"; };
5C55A91E283AD0E400C4E99E /* CallManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallManager.swift; sourceTree = "<group>"; }; 5C55A91E283AD0E400C4E99E /* CallManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallManager.swift; sourceTree = "<group>"; };
5C55A920283CCCB700C4E99E /* IncomingCallView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IncomingCallView.swift; sourceTree = "<group>"; }; 5C55A920283CCCB700C4E99E /* IncomingCallView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IncomingCallView.swift; sourceTree = "<group>"; };
@@ -403,11 +408,6 @@
5CCD403627A5F9A200368C90 /* ScanToConnectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScanToConnectView.swift; sourceTree = "<group>"; }; 5CCD403627A5F9A200368C90 /* ScanToConnectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScanToConnectView.swift; sourceTree = "<group>"; };
5CD67B8D2B0E858A00C510B1 /* hs_init.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = hs_init.h; sourceTree = "<group>"; }; 5CD67B8D2B0E858A00C510B1 /* hs_init.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = hs_init.h; sourceTree = "<group>"; };
5CD67B8E2B0E858A00C510B1 /* hs_init.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hs_init.c; sourceTree = "<group>"; }; 5CD67B8E2B0E858A00C510B1 /* hs_init.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hs_init.c; sourceTree = "<group>"; };
5CD67B9B2B120ADF00C510B1 /* libgmp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgmp.a; sourceTree = "<group>"; };
5CD67B9C2B120ADF00C510B1 /* libgmpxx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgmpxx.a; sourceTree = "<group>"; };
5CD67B9D2B120ADF00C510B1 /* libHSsimplex-chat-5.4.0.6-9DfazyElTA72omjHp0C93u.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libHSsimplex-chat-5.4.0.6-9DfazyElTA72omjHp0C93u.a"; sourceTree = "<group>"; };
5CD67B9E2B120ADF00C510B1 /* libHSsimplex-chat-5.4.0.6-9DfazyElTA72omjHp0C93u-ghc8.10.7.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libHSsimplex-chat-5.4.0.6-9DfazyElTA72omjHp0C93u-ghc8.10.7.a"; sourceTree = "<group>"; };
5CD67B9F2B120ADF00C510B1 /* libffi.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libffi.a; sourceTree = "<group>"; };
5CDCAD452818589900503DA2 /* SimpleX NSE.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "SimpleX NSE.appex"; sourceTree = BUILT_PRODUCTS_DIR; }; 5CDCAD452818589900503DA2 /* SimpleX NSE.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "SimpleX NSE.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
5CDCAD472818589900503DA2 /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; }; 5CDCAD472818589900503DA2 /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
5CDCAD492818589900503DA2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 5CDCAD492818589900503DA2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -511,13 +511,13 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
5CD67BA12B120ADF00C510B1 /* libgmpxx.a in Frameworks */,
5CD67BA22B120ADF00C510B1 /* libHSsimplex-chat-5.4.0.6-9DfazyElTA72omjHp0C93u.a in Frameworks */,
5CE2BA93284534B000EC33A6 /* libiconv.tbd in Frameworks */, 5CE2BA93284534B000EC33A6 /* libiconv.tbd in Frameworks */,
5CD67BA02B120ADF00C510B1 /* libgmp.a in Frameworks */, 5C4BB4BB2B1E7D75007981AA /* libffi.a in Frameworks */,
5CD67BA42B120ADF00C510B1 /* libffi.a in Frameworks */, 5C4BB4BA2B1E7D75007981AA /* libHSsimplex-chat-5.4.0.6-DWi9o3X1dc6Jx2FZ4ew1fo.a in Frameworks */,
5CD67BA32B120ADF00C510B1 /* libHSsimplex-chat-5.4.0.6-9DfazyElTA72omjHp0C93u-ghc8.10.7.a in Frameworks */, 5C4BB4B92B1E7D75007981AA /* libHSsimplex-chat-5.4.0.6-DWi9o3X1dc6Jx2FZ4ew1fo-ghc8.10.7.a in Frameworks */,
5C4BB4B82B1E7D75007981AA /* libgmp.a in Frameworks */,
5CE2BA94284534BB00EC33A6 /* libz.tbd in Frameworks */, 5CE2BA94284534BB00EC33A6 /* libz.tbd in Frameworks */,
5C4BB4BC2B1E7D75007981AA /* libgmpxx.a in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@@ -579,11 +579,11 @@
5C764E5C279C70B7000C6508 /* Libraries */ = { 5C764E5C279C70B7000C6508 /* Libraries */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
5CD67B9F2B120ADF00C510B1 /* libffi.a */, 5C4BB4B62B1E7D75007981AA /* libffi.a */,
5CD67B9B2B120ADF00C510B1 /* libgmp.a */, 5C4BB4B32B1E7D75007981AA /* libgmp.a */,
5CD67B9C2B120ADF00C510B1 /* libgmpxx.a */, 5C4BB4B72B1E7D75007981AA /* libgmpxx.a */,
5CD67B9E2B120ADF00C510B1 /* libHSsimplex-chat-5.4.0.6-9DfazyElTA72omjHp0C93u-ghc8.10.7.a */, 5C4BB4B42B1E7D75007981AA /* libHSsimplex-chat-5.4.0.6-DWi9o3X1dc6Jx2FZ4ew1fo-ghc8.10.7.a */,
5CD67B9D2B120ADF00C510B1 /* libHSsimplex-chat-5.4.0.6-9DfazyElTA72omjHp0C93u.a */, 5C4BB4B52B1E7D75007981AA /* libHSsimplex-chat-5.4.0.6-DWi9o3X1dc6Jx2FZ4ew1fo.a */,
); );
path = Libraries; path = Libraries;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -164,6 +164,12 @@ fun CIImageView(
} }
} }
} }
} else {
KeyChangeEffect(file) {
if (res.value == null) {
res.value = imageAndFilePath(file)
}
}
} }
val loaded = res.value val loaded = res.value
if (loaded != null) { if (loaded != null) {
@@ -19,8 +19,8 @@ import dev.icerock.moko.resources.compose.painterResource
import androidx.compose.ui.text.* import androidx.compose.ui.text.*
import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.* import androidx.compose.ui.text.input.*
import androidx.compose.ui.unit.dp import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.*
import chat.simplex.common.views.database.PassphraseStrength import chat.simplex.common.views.database.PassphraseStrength
import chat.simplex.common.views.database.validKey import chat.simplex.common.views.database.validKey
import chat.simplex.res.MR import chat.simplex.res.MR
@@ -123,6 +123,7 @@ fun DefaultConfigurableTextField(
isValid: (String) -> Boolean, isValid: (String) -> Boolean,
keyboardActions: KeyboardActions = KeyboardActions(), keyboardActions: KeyboardActions = KeyboardActions(),
keyboardType: KeyboardType = KeyboardType.Text, keyboardType: KeyboardType = KeyboardType.Text,
fontSize: TextUnit = 16.sp,
dependsOn: State<Any?>? = null, dependsOn: State<Any?>? = null,
) { ) {
var valid by remember { mutableStateOf(isValid(state.value.text)) } var valid by remember { mutableStateOf(isValid(state.value.text)) }
@@ -175,14 +176,14 @@ fun DefaultConfigurableTextField(
textStyle = TextStyle.Default.copy( textStyle = TextStyle.Default.copy(
color = color, color = color,
fontWeight = FontWeight.Normal, fontWeight = FontWeight.Normal,
fontSize = 16.sp fontSize = fontSize
), ),
interactionSource = interactionSource, interactionSource = interactionSource,
decorationBox = @Composable { innerTextField -> decorationBox = @Composable { innerTextField ->
TextFieldDefaults.TextFieldDecorationBox( TextFieldDefaults.TextFieldDecorationBox(
value = state.value.text, value = state.value.text,
innerTextField = innerTextField, innerTextField = innerTextField,
placeholder = { Text(placeholder, color = MaterialTheme.colors.secondary) }, placeholder = { Text(placeholder, color = MaterialTheme.colors.secondary, fontSize = fontSize, maxLines = 1, overflow = TextOverflow.Ellipsis) },
singleLine = true, singleLine = true,
enabled = enabled, enabled = enabled,
isError = !valid, isError = !valid,
@@ -20,6 +20,7 @@ fun <T> ExposedDropDownSetting(
values: List<Pair<T, String>>, values: List<Pair<T, String>>,
selection: State<T>, selection: State<T>,
textColor: Color = MaterialTheme.colors.secondary, textColor: Color = MaterialTheme.colors.secondary,
fontSize: TextUnit = 16.sp,
label: String? = null, label: String? = null,
enabled: State<Boolean> = mutableStateOf(true), enabled: State<Boolean> = mutableStateOf(true),
minWidth: Dp = 200.dp, minWidth: Dp = 200.dp,
@@ -43,7 +44,8 @@ fun <T> ExposedDropDownSetting(
Modifier.widthIn(max = maxWidth), Modifier.widthIn(max = maxWidth),
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
color = textColor color = textColor,
fontSize = fontSize,
) )
Spacer(Modifier.size(12.dp)) Spacer(Modifier.size(12.dp))
Icon( Icon(
@@ -69,6 +71,7 @@ fun <T> ExposedDropDownSetting(
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
color = if (isInDarkTheme()) MenuTextColorDark else Color.Black, color = if (isInDarkTheme()) MenuTextColorDark else Color.Black,
fontSize = fontSize,
) )
} }
} }
@@ -91,6 +94,6 @@ fun <T> ExposedDropDownSettingRow(
onSelected: (T) -> Unit onSelected: (T) -> Unit
) { ) {
SettingsActionItemWithContent(icon, title, iconColor = iconTint, disabled = !enabled.value) { SettingsActionItemWithContent(icon, title, iconColor = iconTint, disabled = !enabled.value) {
ExposedDropDownSetting(values, selection ,textColor, label, enabled, minWidth, maxWidth, onSelected) ExposedDropDownSetting(values, selection ,textColor, label = label, enabled = enabled, minWidth = minWidth, maxWidth = maxWidth, onSelected = onSelected)
} }
} }
@@ -174,8 +174,6 @@ private fun ConnectMobileViewLayout(
sessionCode: String?, sessionCode: String?,
port: String?, port: String?,
staleQrCode: Boolean = false, staleQrCode: Boolean = false,
editEnabled: Boolean = false,
editClicked: () -> Unit = {},
refreshQrCode: () -> Unit = {}, refreshQrCode: () -> Unit = {},
UnderQrLayout: @Composable () -> Unit = {}, UnderQrLayout: @Composable () -> Unit = {},
) { ) {
@@ -201,16 +199,7 @@ private fun ConnectMobileViewLayout(
} }
} }
SectionTextFooter(annotatedStringResource(MR.strings.open_on_mobile_and_scan_qr_code), textAlign = TextAlign.Center) SectionTextFooter(annotatedStringResource(MR.strings.open_on_mobile_and_scan_qr_code), textAlign = TextAlign.Center)
Row(verticalAlignment = Alignment.CenterVertically) { SectionTextFooter(annotatedStringResource(MR.strings.waiting_for_mobile_to_connect), textAlign = TextAlign.Center)
SectionTextFooter(annotatedStringResource(MR.strings.waiting_for_mobile_to_connect_on_port, port), textAlign = TextAlign.Center)
if (editEnabled) {
Spacer(Modifier.width(4.dp))
IconButton(editClicked, Modifier.size(16.dp)) {
Icon(painterResource(MR.images.ic_edit), stringResource(MR.strings.edit_verb), Modifier.size(16.dp), tint = MaterialTheme.colors.primary)
}
Spacer(Modifier.width(DEFAULT_PADDING))
}
}
UnderQrLayout() UnderQrLayout()
@@ -249,7 +238,9 @@ private fun ConnectMobileViewLayout(
} }
} }
} }
SectionBottomSpacer() if (invitation != null) {
SectionBottomSpacer()
}
} }
} }
@@ -275,10 +266,9 @@ private fun showAddingMobileDevice(connecting: MutableState<Boolean>) {
@Composable @Composable
fun AddingMobileDevice(showTitle: Boolean, staleQrCode: MutableState<Boolean>, connecting: MutableState<Boolean>, close: () -> Unit) { fun AddingMobileDevice(showTitle: Boolean, staleQrCode: MutableState<Boolean>, connecting: MutableState<Boolean>, close: () -> Unit) {
val cachedR = remember { mutableStateOf<CR.RemoteHostStarted?>(null) } var cachedR by remember { mutableStateOf<CR.RemoteHostStarted?>(null) }
val customAddress = rememberSaveable { mutableStateOf<RemoteCtrlAddress?>(null) } val customAddress = rememberSaveable { mutableStateOf<RemoteCtrlAddress?>(null) }
val customPort = rememberSaveable { mutableStateOf<Int?>(null) } val customPort = rememberSaveable { mutableStateOf<Int?>(null) }
var editing by rememberSaveable { mutableStateOf(false) }
val startRemoteHost = suspend { val startRemoteHost = suspend {
val r = chatModel.controller.startRemoteHost( val r = chatModel.controller.startRemoteHost(
rhId = null, rhId = null,
@@ -287,9 +277,9 @@ fun AddingMobileDevice(showTitle: Boolean, staleQrCode: MutableState<Boolean>, c
port = if (customPort.value != cachedR.port) customPort.value else cachedR.rh?.bindPort_ port = if (customPort.value != cachedR.port) customPort.value else cachedR.rh?.bindPort_
) )
if (r != null) { if (r != null) {
cachedR.value = r cachedR = r
connecting.value = true connecting.value = true
customAddress.value = cachedR.address customAddress.value = cachedR.addresses.firstOrNull()
customPort.value = cachedR.port customPort.value = cachedR.port
chatModel.remoteHostPairing.value = null to RemoteHostSessionState.Starting chatModel.remoteHostPairing.value = null to RemoteHostSessionState.Starting
} }
@@ -307,23 +297,20 @@ fun AddingMobileDevice(showTitle: Boolean, staleQrCode: MutableState<Boolean>, c
val remoteDeviceName = pairing.value?.first?.hostDeviceName val remoteDeviceName = pairing.value?.first?.hostDeviceName
ConnectMobileViewLayout( ConnectMobileViewLayout(
title = if (!showTitle) null else if (cachedSessionCode == null) stringResource(MR.strings.link_a_mobile) else stringResource(MR.strings.verify_connection), title = if (!showTitle) null else if (cachedSessionCode == null) stringResource(MR.strings.link_a_mobile) else stringResource(MR.strings.verify_connection),
invitation = cachedR.invitation, invitation = cachedR?.invitation,
deviceName = remoteDeviceName, deviceName = remoteDeviceName,
sessionCode = cachedSessionCode, sessionCode = cachedSessionCode,
port = cachedR.value?.ctrlPort, port = cachedR?.ctrlPort,
staleQrCode = staleQrCode.value || (cachedR.address != customAddress.value && customAddress.value != null) || (cachedR.port != customPort.value && customPort.value != null), staleQrCode = staleQrCode.value || (cachedR.address != customAddress.value && customAddress.value != null) || cachedR.port != customPort.value,
editEnabled = !editing && cachedR.addresses.isNotEmpty(),
editClicked = { editing = true },
refreshQrCode = { refreshQrCode = {
withBGApi { withBGApi {
if (chatController.stopRemoteHost(null)) { if (chatController.stopRemoteHost(null)) {
startRemoteHost() startRemoteHost()
staleQrCode.value = false staleQrCode.value = false
editing = false
} }
} }
}, },
UnderQrLayout = { UnderQrLayout(editing, cachedR, customAddress, customPort) } UnderQrLayout = { UnderQrLayout(cachedR, customAddress, customPort) }
) )
val oldRemoteHostId by remember { mutableStateOf(chatModel.currentRemoteHost.value?.remoteHostId) } val oldRemoteHostId by remember { mutableStateOf(chatModel.currentRemoteHost.value?.remoteHostId) }
LaunchedEffect(remember { chatModel.currentRemoteHost }.value) { LaunchedEffect(remember { chatModel.currentRemoteHost }.value) {
@@ -353,10 +340,9 @@ fun AddingMobileDevice(showTitle: Boolean, staleQrCode: MutableState<Boolean>, c
private fun showConnectMobileDevice(rh: RemoteHostInfo, connecting: MutableState<Boolean>) { private fun showConnectMobileDevice(rh: RemoteHostInfo, connecting: MutableState<Boolean>) {
ModalManager.start.showModalCloseable { close -> ModalManager.start.showModalCloseable { close ->
val cachedR = remember { mutableStateOf<CR.RemoteHostStarted?>(null) } var cachedR by remember { mutableStateOf<CR.RemoteHostStarted?>(null) }
val customAddress = rememberSaveable { mutableStateOf<RemoteCtrlAddress?>(null) } val customAddress = rememberSaveable { mutableStateOf<RemoteCtrlAddress?>(null) }
val customPort = rememberSaveable { mutableStateOf<Int?>(null) } val customPort = rememberSaveable { mutableStateOf<Int?>(null) }
var editing by rememberSaveable { mutableStateOf(false) }
val startRemoteHost = suspend { val startRemoteHost = suspend {
val r = chatModel.controller.startRemoteHost( val r = chatModel.controller.startRemoteHost(
rhId = rh.remoteHostId, rhId = rh.remoteHostId,
@@ -365,9 +351,9 @@ private fun showConnectMobileDevice(rh: RemoteHostInfo, connecting: MutableState
port = if (customPort.value != cachedR.port) customPort.value else cachedR.rh?.bindPort_ ?: rh.bindPort_ port = if (customPort.value != cachedR.port) customPort.value else cachedR.rh?.bindPort_ ?: rh.bindPort_
) )
if (r != null) { if (r != null) {
cachedR.value = r cachedR = r
connecting.value = true connecting.value = true
customAddress.value = cachedR.address customAddress.value = cachedR.addresses.firstOrNull()
customPort.value = cachedR.port customPort.value = cachedR.port
chatModel.remoteHostPairing.value = null to RemoteHostSessionState.Starting chatModel.remoteHostPairing.value = null to RemoteHostSessionState.Starting
} }
@@ -384,22 +370,19 @@ private fun showConnectMobileDevice(rh: RemoteHostInfo, connecting: MutableState
} }
ConnectMobileViewLayout( ConnectMobileViewLayout(
title = if (cachedSessionCode == null) stringResource(MR.strings.scan_from_mobile) else stringResource(MR.strings.verify_connection), title = if (cachedSessionCode == null) stringResource(MR.strings.scan_from_mobile) else stringResource(MR.strings.verify_connection),
invitation = cachedR.invitation, invitation = cachedR?.invitation,
deviceName = pairing.value?.first?.hostDeviceName ?: rh.hostDeviceName, deviceName = pairing.value?.first?.hostDeviceName ?: rh.hostDeviceName,
sessionCode = cachedSessionCode, sessionCode = cachedSessionCode,
port = cachedR.value?.ctrlPort, port = cachedR?.ctrlPort,
staleQrCode = (cachedR.address != customAddress.value && customAddress.value != null) || (cachedR.port != customPort.value && customPort.value != null), staleQrCode = (cachedR.address != customAddress.value && customAddress.value != null) || cachedR.port != customPort.value,
editEnabled = !editing && cachedR.addresses.isNotEmpty(),
editClicked = { editing = true },
refreshQrCode = { refreshQrCode = {
withBGApi { withBGApi {
if (chatController.stopRemoteHost(rh.remoteHostId)) { if (chatController.stopRemoteHost(rh.remoteHostId)) {
startRemoteHost() startRemoteHost()
editing = false
} }
} }
}, },
UnderQrLayout = { UnderQrLayout(editing, cachedR, customAddress, customPort) } UnderQrLayout = { UnderQrLayout(cachedR, customAddress, customPort) }
) )
LaunchedEffect(remember { chatModel.currentRemoteHost }.value) { LaunchedEffect(remember { chatModel.currentRemoteHost }.value) {
if (cachedR.remoteHostId != null && chatModel.currentRemoteHost.value?.remoteHostId == cachedR.remoteHostId) { if (cachedR.remoteHostId != null && chatModel.currentRemoteHost.value?.remoteHostId == cachedR.remoteHostId) {
@@ -453,48 +436,75 @@ private fun showConnectedMobileDevice(rh: RemoteHostInfo, disconnectHost: () ->
} }
@Composable @Composable
private fun UnderQrLayout(editing: Boolean, cachedR: State<CR.RemoteHostStarted?>, customAddress: MutableState<RemoteCtrlAddress?>, customPort: MutableState<Int?>) { private fun UnderQrLayout(cachedR: CR.RemoteHostStarted?, customAddress: MutableState<RemoteCtrlAddress?>, customPort: MutableState<Int?>) {
if (editing) { Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Center) {
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Center) { if (cachedR.addresses.size > 1) {
ExposedDropDownSetting( ExposedDropDownSetting(
cachedR.addresses.map { it to it.address + " (${it.`interface`})" }, cachedR.addresses.map { it to it.address + " (${it.`interface`})" },
customAddress, customAddress,
textColor = MaterialTheme.colors.onBackground, textColor = MaterialTheme.colors.onBackground,
fontSize = 14.sp,
minWidth = 250.dp, minWidth = 250.dp,
maxWidth = with(LocalDensity.current) { 250.sp.toDp() }, maxWidth = with(LocalDensity.current) { 250.sp.toDp() },
enabled = remember { mutableStateOf(cachedR.addresses.size > 1) },
onSelected = { onSelected = {
customAddress.value = it customAddress.value = it
} }
) )
val portUnsaved = rememberSaveable(stateSaver = TextFieldValue.Saver) { } else {
mutableStateOf(TextFieldValue((customPort.value ?: cachedR.port!!).toString())) Spacer(Modifier.width(10.dp))
} Text(customAddress.value?.address + " (${customAddress.value?.`interface`})", fontSize = 14.sp, color = MaterialTheme.colors.onBackground)
Spacer(Modifier.width(DEFAULT_PADDING)) }
val portUnsaved = rememberSaveable(stateSaver = TextFieldValue.Saver) {
mutableStateOf(TextFieldValue((customPort.value ?: cachedR.port!!).toString()))
}
Spacer(Modifier.width(DEFAULT_PADDING))
Box {
DefaultConfigurableTextField( DefaultConfigurableTextField(
portUnsaved, portUnsaved,
stringResource(MR.strings.port_verb), stringResource(MR.strings.random_port),
modifier = Modifier.widthIn(max = 100.dp), modifier = Modifier.widthIn(max = 132.dp),
isValid = { validPort(it) && it.toInt() > 1023 }, isValid = { (validPort(it) && it.toInt() > 1023) || it.isBlank() },
keyboardActions = KeyboardActions(onDone = { defaultKeyboardAction(ImeAction.Done) }), keyboardActions = KeyboardActions(onDone = { defaultKeyboardAction(ImeAction.Done) }),
keyboardType = KeyboardType.Number, keyboardType = KeyboardType.Number,
fontSize = 14.sp,
) )
LaunchedEffect(Unit) { if (validPort(portUnsaved.value.text) && portUnsaved.value.text.toInt() > 1023) {
snapshotFlow { portUnsaved.value.text } Icon(painterResource(MR.images.ic_edit), stringResource(MR.strings.edit_verb), Modifier.padding(end = 56.dp).size(16.dp).align(Alignment.CenterEnd), tint = MaterialTheme.colors.secondary)
.distinctUntilChanged() IconButton(::showOpenPortAlert, Modifier.align(Alignment.TopEnd).padding(top = 2.dp)) {
.collect { Icon(painterResource(MR.images.ic_info), null, tint = MaterialTheme.colors.primary)
if (validPort(it) && it.toInt() > 1023) { }
customPort.value = it.toInt() }
} }
LaunchedEffect(Unit) {
snapshotFlow { portUnsaved.value.text }
.distinctUntilChanged()
.collect {
if (validPort(it) && it.toInt() > 1023) {
customPort.value = it.toInt()
} else {
customPort.value = null
} }
}
}
KeyChangeEffect(customPort.value) {
if (customPort.value != null) {
portUnsaved.value = portUnsaved.value.copy(text = customPort.value.toString())
} }
} }
} }
} }
private val State<CR.RemoteHostStarted?>.rh: RemoteHostInfo? get() = value?.remoteHost_ private fun showOpenPortAlert() {
private val State<CR.RemoteHostStarted?>.remoteHostId: Long? get() = value?.remoteHost_?.remoteHostId AlertManager.shared.showAlertMsg(
private val State<CR.RemoteHostStarted?>.invitation: String? get() = value?.invitation title = generalGetString(MR.strings.open_port_in_firewall_title),
private val State<CR.RemoteHostStarted?>.address: RemoteCtrlAddress? get() = value?.localAddrs?.firstOrNull() text = generalGetString(MR.strings.open_port_in_firewall_desc),
private val State<CR.RemoteHostStarted?>.addresses: List<RemoteCtrlAddress> get() = )
(if (controller.appPrefs.developerTools.get()) value?.localAddrs else value?.localAddrs?.filterNot { it.address == "127.0.0.1" }) ?: emptyList() }
private val State<CR.RemoteHostStarted?>.port: Int? get() = value?.ctrlPort?.toIntOrNull()
private val CR.RemoteHostStarted?.rh: RemoteHostInfo? get() = this?.remoteHost_
private val CR.RemoteHostStarted?.remoteHostId: Long? get() = this?.remoteHost_?.remoteHostId
private val CR.RemoteHostStarted?.address: RemoteCtrlAddress? get() = this?.localAddrs?.firstOrNull()
private val CR.RemoteHostStarted?.addresses: List<RemoteCtrlAddress> get() =
(if (controller.appPrefs.developerTools.get() || this?.localAddrs?.indexOfFirst { it.address == "127.0.0.1" } == 0) this?.localAddrs else this?.localAddrs?.filterNot { it.address == "127.0.0.1" }) ?: emptyList()
private val CR.RemoteHostStarted?.port: Int? get() = this?.ctrlPort?.toIntOrNull()
@@ -1665,7 +1665,7 @@
<string name="disconnect_desktop_question">Disconnect desktop?</string> <string name="disconnect_desktop_question">Disconnect desktop?</string>
<string name="only_one_device_can_work_at_the_same_time">Only one device can work at the same time</string> <string name="only_one_device_can_work_at_the_same_time">Only one device can work at the same time</string>
<string name="open_on_mobile_and_scan_qr_code"><![CDATA[Open <i>Use from desktop</i> in mobile app and scan QR code.]]></string> <string name="open_on_mobile_and_scan_qr_code"><![CDATA[Open <i>Use from desktop</i> in mobile app and scan QR code.]]></string>
<string name="waiting_for_mobile_to_connect_on_port"><![CDATA[Waiting for mobile to connect on port <i>%s</i>]]></string> <string name="waiting_for_mobile_to_connect">Waiting for mobile to connect:</string>
<string name="bad_desktop_address">Bad desktop address</string> <string name="bad_desktop_address">Bad desktop address</string>
<string name="desktop_incompatible_version">Incompatible version</string> <string name="desktop_incompatible_version">Incompatible version</string>
<string name="desktop_app_version_is_incompatible">Desktop app version %s is not compatible with this app.</string> <string name="desktop_app_version_is_incompatible">Desktop app version %s is not compatible with this app.</string>
@@ -1693,6 +1693,9 @@
<string name="not_compatible">Not compatible!</string> <string name="not_compatible">Not compatible!</string>
<string name="refresh_qr_code">Refresh</string> <string name="refresh_qr_code">Refresh</string>
<string name="no_connected_mobile">No connected mobile</string> <string name="no_connected_mobile">No connected mobile</string>
<string name="random_port">Random</string>
<string name="open_port_in_firewall_title">Open port in firewall</string>
<string name="open_port_in_firewall_desc">To allow a mobile app to connect to the desktop, open this port in your firewall, if you have it enabled</string>
<!-- Under development --> <!-- Under development -->
<string name="in_developing_title">Coming soon!</string> <string name="in_developing_title">Coming soon!</string>
@@ -1581,7 +1581,7 @@
<string name="v5_4_better_groups_descr">Schnellerer Gruppenbeitritt und zuverlässigere Nachrichtenzustellung.</string> <string name="v5_4_better_groups_descr">Schnellerer Gruppenbeitritt und zuverlässigere Nachrichtenzustellung.</string>
<string name="linked_mobiles">Verknüpfte Mobiltelefone</string> <string name="linked_mobiles">Verknüpfte Mobiltelefone</string>
<string name="this_device_name">Dieser Gerätename</string> <string name="this_device_name">Dieser Gerätename</string>
<string name="waiting_for_mobile_to_connect_on_port"><![CDATA[Auf die Mobiltelefonverbindung über Port <i>%s</i> warten]]></string> <string name="waiting_for_mobile_to_connect">Auf die Mobiltelefonverbindung warten:</string>
<string name="loading_remote_file_title">Laden der Datei</string> <string name="loading_remote_file_title">Laden der Datei</string>
<string name="link_a_mobile">Zu einem Mobiltelefon verbinden</string> <string name="link_a_mobile">Zu einem Mobiltelefon verbinden</string>
<string name="settings_section_title_use_from_desktop">Vom Desktop aus nutzen</string> <string name="settings_section_title_use_from_desktop">Vom Desktop aus nutzen</string>
@@ -1486,7 +1486,7 @@
<string name="desktop_device">Bureau</string> <string name="desktop_device">Bureau</string>
<string name="connected_to_desktop">Connecté au bureau</string> <string name="connected_to_desktop">Connecté au bureau</string>
<string name="this_device_name">Ce nom d\'appareil</string> <string name="this_device_name">Ce nom d\'appareil</string>
<string name="waiting_for_mobile_to_connect_on_port"><![CDATA[En attente d\'une connexion mobile sur le port <i>%s</i>]]></string> <string name="waiting_for_mobile_to_connect">En attente d\'une connexion mobile:</string>
<string name="loading_remote_file_title">Chargement du fichier</string> <string name="loading_remote_file_title">Chargement du fichier</string>
<string name="connecting_to_desktop">Connexion au bureau</string> <string name="connecting_to_desktop">Connexion au bureau</string>
<string name="desktop_devices">Appareils de bureau</string> <string name="desktop_devices">Appareils de bureau</string>
@@ -1517,6 +1517,6 @@
<string name="v5_4_more_things_descr">- avvisa facoltativamente i contatti eliminati. <string name="v5_4_more_things_descr">- avvisa facoltativamente i contatti eliminati.
\n- nomi del profilo con spazi. \n- nomi del profilo con spazi.
\n- e molto altro!</string> \n- e molto altro!</string>
<string name="waiting_for_mobile_to_connect_on_port"><![CDATA[In attesa che il cellulare si connetta alla porta <i>%s</i>]]></string> <string name="waiting_for_mobile_to_connect">In attesa che il cellulare si connette:</string>
<string name="group_member_role_author">autore</string> <string name="group_member_role_author">autore</string>
</resources> </resources>
@@ -1516,7 +1516,7 @@
\n- en meer!</string> \n- en meer!</string>
<string name="remote_host_was_disconnected_toast"><![CDATA[Mobiele verbinding <b>%s</b> is verbroken]]></string> <string name="remote_host_was_disconnected_toast"><![CDATA[Mobiele verbinding <b>%s</b> is verbroken]]></string>
<string name="group_member_role_author">auteur</string> <string name="group_member_role_author">auteur</string>
<string name="waiting_for_mobile_to_connect_on_port"><![CDATA[Wachten tot mobiel verbinding maakt op poort <i>%s</i>]]></string> <string name="waiting_for_mobile_to_connect">Wachten tot mobiel verbinding maakt:</string>
<string name="multicast_connect_automatically">Automatisch verbinden</string> <string name="multicast_connect_automatically">Automatisch verbinden</string>
<string name="waiting_for_desktop">Wachten op desktop…</string> <string name="waiting_for_desktop">Wachten op desktop…</string>
<string name="found_desktop">Desktop gevonden</string> <string name="found_desktop">Desktop gevonden</string>
@@ -1496,7 +1496,7 @@
<string name="v5_4_better_groups_descr">Szybsze dołączenie i bardziej niezawodne wiadomości.</string> <string name="v5_4_better_groups_descr">Szybsze dołączenie i bardziej niezawodne wiadomości.</string>
<string name="linked_mobiles">Połączone telefony</string> <string name="linked_mobiles">Połączone telefony</string>
<string name="this_device_name">Nazwa tego urządzenia</string> <string name="this_device_name">Nazwa tego urządzenia</string>
<string name="waiting_for_mobile_to_connect_on_port"><![CDATA[Oczekiwanie na połączenie telefonu na port <i>%s</i>]]></string> <string name="waiting_for_mobile_to_connect">Oczekiwanie na połączenie telefonu:</string>
<string name="loading_remote_file_title">Ładowanie pliku</string> <string name="loading_remote_file_title">Ładowanie pliku</string>
<string name="found_desktop">Znaleziono komputer</string> <string name="found_desktop">Znaleziono komputer</string>
<string name="desktop_devices">Urządzenia komputerowe</string> <string name="desktop_devices">Urządzenia komputerowe</string>
@@ -1601,7 +1601,7 @@
<string name="verify_connection">Проверить соединение</string> <string name="verify_connection">Проверить соединение</string>
<string name="multicast_connect_automatically">Соединяться автоматически</string> <string name="multicast_connect_automatically">Соединяться автоматически</string>
<string name="waiting_for_desktop">Ожидается подключение…</string> <string name="waiting_for_desktop">Ожидается подключение…</string>
<string name="waiting_for_mobile_to_connect_on_port"><![CDATA[Ожидается подключение мобильного через порт <i>%s</i>]]></string> <string name="waiting_for_mobile_to_connect">Ожидается подключение мобильного:</string>
<string name="found_desktop">Компьютер найден</string> <string name="found_desktop">Компьютер найден</string>
<string name="not_compatible">Несовместимая версия!</string> <string name="not_compatible">Несовместимая версия!</string>
<string name="group_member_role_author">автор</string> <string name="group_member_role_author">автор</string>
@@ -1517,7 +1517,7 @@
<string name="v5_4_more_things_descr">- 可选择通知已删除的联系人。 <string name="v5_4_more_things_descr">- 可选择通知已删除的联系人。
\n- 带空格的个人资料名称。 \n- 带空格的个人资料名称。
\n- 以及更多!</string> \n- 以及更多!</string>
<string name="waiting_for_mobile_to_connect_on_port"><![CDATA[正等待移动设备在端口 <i>%s</i> 进行连接]]></string> <string name="waiting_for_mobile_to_connect">正等待移动设备 进行连接:</string>
<string name="group_member_role_author">作者</string> <string name="group_member_role_author">作者</string>
<string name="multicast_connect_automatically">自动连接</string> <string name="multicast_connect_automatically">自动连接</string>
<string name="waiting_for_desktop">等待桌面中…</string> <string name="waiting_for_desktop">等待桌面中…</string>
@@ -83,5 +83,6 @@ mkChatOpts BroadcastBotOpts {coreOptions} =
allowInstantFiles = True, allowInstantFiles = True,
autoAcceptFileSize = 0, autoAcceptFileSize = 0,
muteNotifications = True, muteNotifications = True,
markRead = False,
maintenance = False maintenance = False
} }
@@ -5,10 +5,10 @@
{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE ScopedTypeVariables #-}
module Directory.Options module Directory.Options
( DirectoryOpts (..), ( DirectoryOpts (..),
getDirectoryOpts, getDirectoryOpts,
mkChatOpts, mkChatOpts,
) )
where where
import Options.Applicative import Options.Applicative
@@ -35,8 +35,8 @@ directoryOpts appDir defaultDbFileName = do
<> help "Comma-separated list of super-users in the format CONTACT_ID:DISPLAY_NAME who will be allowed to manage the directory" <> help "Comma-separated list of super-users in the format CONTACT_ID:DISPLAY_NAME who will be allowed to manage the directory"
) )
directoryLog <- directoryLog <-
Just <$> Just
strOption <$> strOption
( long "directory-file" ( long "directory-file"
<> metavar "DIRECTORY_FILE" <> metavar "DIRECTORY_FILE"
<> help "Append only log for directory state" <> help "Append only log for directory state"
@@ -81,5 +81,6 @@ mkChatOpts DirectoryOpts {coreOptions} =
allowInstantFiles = True, allowInstantFiles = True,
autoAcceptFileSize = 0, autoAcceptFileSize = 0,
muteNotifications = True, muteNotifications = True,
markRead = False,
maintenance = False maintenance = False
} }
+9 -1
View File
@@ -4,12 +4,14 @@ packages: .
with-compiler: ghc-9.6.3 with-compiler: ghc-9.6.3
index-state: 2023-10-20T00:00:00Z
constraints: zip +disable-bzip2 +disable-zstd constraints: zip +disable-bzip2 +disable-zstd
source-repository-package source-repository-package
type: git type: git
location: https://github.com/simplex-chat/simplexmq.git location: https://github.com/simplex-chat/simplexmq.git
tag: 117168ccce93ef5ac478c02e3f02a018fa8a2200 tag: eaf5317834b069144b5f4897f9c79831983e54dd
source-repository-package source-repository-package
type: git type: git
@@ -45,3 +47,9 @@ source-repository-package
type: git type: git
location: https://github.com/simplex-chat/android-support.git location: https://github.com/simplex-chat/android-support.git
tag: 9aa09f148089d6752ce563b14c2df1895718d806 tag: 9aa09f148089d6752ce563b14c2df1895718d806
-- TODO this fork is only needed to compile with GHC 8.10.7 - it allows previous base version
source-repository-package
type: git
location: https://github.com/simplex-chat/zip.git
tag: bd421c6b19cc4c465cd7af1f6f26169fb8ee1ebc
+2
View File
@@ -45,6 +45,8 @@ When people connect to you via this address, you will receive a connection reque
If you start receiving too many requests via this address it is always safe to remove it – all the connections you created via this address will remain active, as this address is not used to deliver the messages. If you start receiving too many requests via this address it is always safe to remove it – all the connections you created via this address will remain active, as this address is not used to deliver the messages.
See the comparison with [1-time invitation links](./making-connections.md#comparison-of-1-time-invitation-links-and-simplex-contact-addresses).
Read more in [this post](../../blog/20221108-simplex-chat-v4.2-security-audit-new-website.md#auto-accept-contact-requests). Read more in [this post](../../blog/20221108-simplex-chat-v4.2-security-audit-new-website.md#auto-accept-contact-requests).
### Chat preferences ### Chat preferences
+65
View File
@@ -13,6 +13,71 @@ Private Connection — connect using an invitation link or QR code via video or
Group Chat — Users have the option to create a secret group, share their contact link [which can be deleted later on], or generate a one-time invitation link. Group Chat — Users have the option to create a secret group, share their contact link [which can be deleted later on], or generate a one-time invitation link.
## Your SimpleX contact address
You can [create an optional long term address](./app-settings.md#your-simplex-contact-address) for other people to connect with you. Unlike 1-time invitation links, these addresses can be used many times, that makes them good to share online, e.g. on social media platforms, or in email signatures. That helps more people discover SimpleX Chat, so please do it!
When people connect to you via this address, you will receive a connection request that you can accept or reject. You can configure an automatic acceptance of connection request and an automatic welcome message that will be sent to the new contacts. You can also share this address as part of your SimpleX profile, so group members can connect to you, and your contacts can share it with others - if this is something that you want.
If you start receiving too many requests via this address it is always safe to remove it – all the connections you created via this address will remain active, as this address is not used to deliver the messages.
### Comparison of 1-time invitation links and SimpleX Contact addresses
<table>
<tr>
<th></th>
<th>1-time invitation link</th>
<th>SimpleX contact address</th>
</tr>
<tr>
<td>Can be used many times?</td>
<td>No</td>
<td>Yes</td>
</tr>
<tr>
<td>Can be included in user profile?</td>
<td>No, as it can only be used once.</td>
<td>Yes, to allow group members to connect directly, and your contacts to pass it on to their contacts.</td>
</tr>
<tr>
<td>When to use it?</td>
<td>With somebody you know, via another communication channel or QR code (in person or during a video call)</td>
<td>Where many people can see and connect via it, e.g. in email signature, website, social media or group chat.</td>
</tr>
<tr>
<td>Security</td>
<td>More secure, as can only be used once, and the initial connection request (including profile) is encrypted with double ratchet.</td>
<td>Initial connection request is also e2e encrypted, but without double ratchet (it is initialized when request is accepted).</td>
</tr>
<tr>
<td>Identification</td>
<td>Both sides know who they connect to, as they know with whom and by who the link was shared. You can attach alias to this invitation as soon as you share it or use it, to identify the other person when connection is established.</td>
<td>Only the person using the address knows who they connect to, via the channel where they found the address (email, social media, etc.). The address owner can only see the user profile of the request, and has no proof of identity from the person sending the request<sup>*</sup>.</td>
</tr>
<tr>
<td>Advantages over other platforms</td>
<td>There is no direct analogy, other platforms don’t offer one-time invitations without any fixed part identifying the user.</td>
<td>Unlike addresses in other platforms, SimpleX addresses are not used to deliver the messages &mdash; only the initial connection requests.<br>It means that removing this address will not break the contacts made via it (like changing an email address would), it would only prevent new connections, which makes it a good solution against spam and abuse.</td>
</tr>
<tr>
<td>Vulnerability to attacks</td>
<td>Until the connection is established, anybody who intercepts this link can connect to it, so it has to be verified with the original contact that the connection succeeded.</td>
<td>These addresses are vulnerable to connection request spam. Unlike other platforms, you can delete or change the address, without losing any contacts (see above).</td>
</tr>
<tr>
<td>Passive attacks on connection links</td>
<td colspan="2">Both types of links are not vulnerable if simply observed &mdash; they only contain public keys. So they can be safely shared via insecure or public channels, as long as you can confirm that you connected to the intended person.</td>
</tr>
<tr>
<td>Active attacks on connection links</td>
<td colspan="2">If the link is substituted via the attack on the channel used to share it, the connection security can be compromised, and the original messages monitored (man-in-the-middle attack). If it is a real risk then security code should be verified to mitigate it - doing so proves<sup>**</sup> that the link and keys were not substituted, and that the end-to-end encryption is secure.</td>
</tr>
</table>
<sup>*</sup> Adding optional verified identities that we plan in the future will change it &mdash; the address owner will have an option to request identity verification before accepting the connection.
<sup>**</sup> Connection security code is the cryptographic hash (SHA256) of combined public keys of both sides &mdash; there are 2<sup>256</sup> possible security codes (1 with 77 zeros – about [1000 times smaller](https://www.wolframalpha.com/input?i=2%5E256) than the estimated number of atoms in the visible universe).
## Conversation preferences ## Conversation preferences
Tap on one of your conversations to open conversation preferences. Tap on one of your conversations to open conversation preferences.
+14 -7
View File
@@ -19,7 +19,6 @@ dependencies:
- attoparsec == 0.14.* - attoparsec == 0.14.*
- base >= 4.7 && < 5 - base >= 4.7 && < 5
- base64-bytestring >= 1.0 && < 1.3 - base64-bytestring >= 1.0 && < 1.3
- bytestring == 0.11.*
- composition == 1.0.* - composition == 1.0.*
- constraints >= 0.12 && < 0.14 - constraints >= 0.12 && < 0.14
- containers == 0.6.* - containers == 0.6.*
@@ -32,10 +31,10 @@ dependencies:
- filepath == 1.4.* - filepath == 1.4.*
- http-types == 0.12.* - http-types == 0.12.*
- http2 >= 4.2.2 && < 4.3 - http2 >= 4.2.2 && < 4.3
- memory >= 0.15 && < 0.19 - memory == 0.18.*
- mtl >= 2.3.1 && < 3 - mtl >= 2.3.1 && < 3.0
- network >= 3.1.2.7 && < 3.2 - network >= 3.1.2.7 && < 3.2
- network-transport >= 0.5.6 && < 0.6 - network-transport == 0.5.6
- optparse-applicative >= 0.15 && < 0.17 - optparse-applicative >= 0.15 && < 0.17
- process == 1.6.* - process == 1.6.*
- random >= 1.1 && < 1.3 - random >= 1.1 && < 1.3
@@ -45,14 +44,12 @@ dependencies:
- socks == 0.6.* - socks == 0.6.*
- sqlcipher-simple == 0.4.* - sqlcipher-simple == 0.4.*
- stm == 2.5.* - stm == 2.5.*
- template-haskell >= 2.16 && < 2.21
- terminal == 0.2.* - terminal == 0.2.*
- text >= 2.0 && < 3
- time == 1.9.* - time == 1.9.*
- tls >= 1.6.0 && < 1.7 - tls >= 1.6.0 && < 1.7
- unliftio == 0.2.* - unliftio == 0.2.*
- unliftio-core == 0.2.* - unliftio-core == 0.2.*
- zip >= 1.7 && < 2.1 - zip == 2.0.*
flags: flags:
swift: swift:
@@ -64,6 +61,16 @@ when:
- condition: flag(swift) - condition: flag(swift)
cpp-options: cpp-options:
- -DswiftJSON - -DswiftJSON
- condition: impl(ghc >= 9.6.2)
dependencies:
- bytestring == 0.11.*
- template-haskell == 2.20.*
- text >= 2.0.1 && < 2.2
- condition: impl(ghc < 9.6.2)
dependencies:
- bytestring == 0.10.*
- template-haskell == 2.16.*
- text >= 1.2.3.0 && < 1.3
library: library:
source-dirs: src source-dirs: src
+2 -1
View File
@@ -1,5 +1,5 @@
{ {
"https://github.com/simplex-chat/simplexmq.git"."117168ccce93ef5ac478c02e3f02a018fa8a2200" = "1091c4b8qjp9v29z862b7clda90w3kb4v2aqp5b2jh6yprlga98w"; "https://github.com/simplex-chat/simplexmq.git"."eaf5317834b069144b5f4897f9c79831983e54dd" = "0jlic1q08mq9p9sgvigmc59r6x1r5fa1zsfqvvrwd97pwain36mj";
"https://github.com/simplex-chat/hs-socks.git"."a30cc7a79a08d8108316094f8f2f82a0c5e1ac51" = "0yasvnr7g91k76mjkamvzab2kvlb1g5pspjyjn2fr6v83swjhj38"; "https://github.com/simplex-chat/hs-socks.git"."a30cc7a79a08d8108316094f8f2f82a0c5e1ac51" = "0yasvnr7g91k76mjkamvzab2kvlb1g5pspjyjn2fr6v83swjhj38";
"https://github.com/kazu-yamamoto/http2.git"."f5525b755ff2418e6e6ecc69e877363b0d0bcaeb" = "0fyx0047gvhm99ilp212mmz37j84cwrfnpmssib5dw363fyb88b6"; "https://github.com/kazu-yamamoto/http2.git"."f5525b755ff2418e6e6ecc69e877363b0d0bcaeb" = "0fyx0047gvhm99ilp212mmz37j84cwrfnpmssib5dw363fyb88b6";
"https://github.com/simplex-chat/direct-sqlcipher.git"."f814ee68b16a9447fbb467ccc8f29bdd3546bfd9" = "1ql13f4kfwkbaq7nygkxgw84213i0zm7c1a8hwvramayxl38dq5d"; "https://github.com/simplex-chat/direct-sqlcipher.git"."f814ee68b16a9447fbb467ccc8f29bdd3546bfd9" = "1ql13f4kfwkbaq7nygkxgw84213i0zm7c1a8hwvramayxl38dq5d";
@@ -7,4 +7,5 @@
"https://github.com/simplex-chat/aeson.git"."aab7b5a14d6c5ea64c64dcaee418de1bb00dcc2b" = "0jz7kda8gai893vyvj96fy962ncv8dcsx71fbddyy8zrvc88jfrr"; "https://github.com/simplex-chat/aeson.git"."aab7b5a14d6c5ea64c64dcaee418de1bb00dcc2b" = "0jz7kda8gai893vyvj96fy962ncv8dcsx71fbddyy8zrvc88jfrr";
"https://github.com/simplex-chat/haskell-terminal.git"."f708b00009b54890172068f168bf98508ffcd495" = "0zmq7lmfsk8m340g47g5963yba7i88n4afa6z93sg9px5jv1mijj"; "https://github.com/simplex-chat/haskell-terminal.git"."f708b00009b54890172068f168bf98508ffcd495" = "0zmq7lmfsk8m340g47g5963yba7i88n4afa6z93sg9px5jv1mijj";
"https://github.com/simplex-chat/android-support.git"."9aa09f148089d6752ce563b14c2df1895718d806" = "0pbf2pf13v2kjzi397nr13f1h3jv0imvsq8rpiyy2qyx5vd50pqn"; "https://github.com/simplex-chat/android-support.git"."9aa09f148089d6752ce563b14c2df1895718d806" = "0pbf2pf13v2kjzi397nr13f1h3jv0imvsq8rpiyy2qyx5vd50pqn";
"https://github.com/simplex-chat/zip.git"."bd421c6b19cc4c465cd7af1f6f26169fb8ee1ebc" = "1csqfjhvc8wb5h4kxxndmb6iw7b4ib9ff2n81hrizsmnf45a6gg0";
} }
+99 -50
View File
@@ -1,6 +1,6 @@
cabal-version: 1.12 cabal-version: 1.12
-- This file has been generated from package.yaml by hpack version 0.35.5. -- This file has been generated from package.yaml by hpack version 0.35.0.
-- --
-- see: https://github.com/sol/hpack -- see: https://github.com/sol/hpack
@@ -171,7 +171,6 @@ library
, attoparsec ==0.14.* , attoparsec ==0.14.*
, base >=4.7 && <5 , base >=4.7 && <5
, base64-bytestring >=1.0 && <1.3 , base64-bytestring >=1.0 && <1.3
, bytestring ==0.11.*
, composition ==1.0.* , composition ==1.0.*
, constraints >=0.12 && <0.14 , constraints >=0.12 && <0.14
, containers ==0.6.* , containers ==0.6.*
@@ -184,10 +183,10 @@ library
, filepath ==1.4.* , filepath ==1.4.*
, http-types ==0.12.* , http-types ==0.12.*
, http2 >=4.2.2 && <4.3 , http2 >=4.2.2 && <4.3
, memory >=0.15 && <0.19 , memory ==0.18.*
, mtl >=2.3.1 && <3 , mtl >=2.3.1 && <3.0
, network >=3.1.2.7 && <3.2 , network >=3.1.2.7 && <3.2
, network-transport >=0.5.6 && <0.6 , network-transport ==0.5.6
, optparse-applicative >=0.15 && <0.17 , optparse-applicative >=0.15 && <0.17
, process ==1.6.* , process ==1.6.*
, random >=1.1 && <1.3 , random >=1.1 && <1.3
@@ -197,17 +196,25 @@ library
, socks ==0.6.* , socks ==0.6.*
, sqlcipher-simple ==0.4.* , sqlcipher-simple ==0.4.*
, stm ==2.5.* , stm ==2.5.*
, template-haskell >=2.16 && <2.21
, terminal ==0.2.* , terminal ==0.2.*
, text >=2.0 && <3
, time ==1.9.* , time ==1.9.*
, tls >=1.6.0 && <1.7 , tls >=1.6.0 && <1.7
, unliftio ==0.2.* , unliftio ==0.2.*
, unliftio-core ==0.2.* , unliftio-core ==0.2.*
, zip >=1.7 && <2.1 , zip ==2.0.*
default-language: Haskell2010 default-language: Haskell2010
if flag(swift) if flag(swift)
cpp-options: -DswiftJSON cpp-options: -DswiftJSON
if impl(ghc >= 9.6.2)
build-depends:
bytestring ==0.11.*
, template-haskell ==2.20.*
, text >=2.0.1 && <2.2
if impl(ghc < 9.6.2)
build-depends:
bytestring ==0.10.*
, template-haskell ==2.16.*
, text >=1.2.3.0 && <1.3
executable simplex-bot executable simplex-bot
main-is: Main.hs main-is: Main.hs
@@ -223,7 +230,6 @@ executable simplex-bot
, attoparsec ==0.14.* , attoparsec ==0.14.*
, base >=4.7 && <5 , base >=4.7 && <5
, base64-bytestring >=1.0 && <1.3 , base64-bytestring >=1.0 && <1.3
, bytestring ==0.11.*
, composition ==1.0.* , composition ==1.0.*
, constraints >=0.12 && <0.14 , constraints >=0.12 && <0.14
, containers ==0.6.* , containers ==0.6.*
@@ -236,10 +242,10 @@ executable simplex-bot
, filepath ==1.4.* , filepath ==1.4.*
, http-types ==0.12.* , http-types ==0.12.*
, http2 >=4.2.2 && <4.3 , http2 >=4.2.2 && <4.3
, memory >=0.15 && <0.19 , memory ==0.18.*
, mtl >=2.3.1 && <3 , mtl >=2.3.1 && <3.0
, network >=3.1.2.7 && <3.2 , network >=3.1.2.7 && <3.2
, network-transport >=0.5.6 && <0.6 , network-transport ==0.5.6
, optparse-applicative >=0.15 && <0.17 , optparse-applicative >=0.15 && <0.17
, process ==1.6.* , process ==1.6.*
, random >=1.1 && <1.3 , random >=1.1 && <1.3
@@ -250,17 +256,25 @@ executable simplex-bot
, socks ==0.6.* , socks ==0.6.*
, sqlcipher-simple ==0.4.* , sqlcipher-simple ==0.4.*
, stm ==2.5.* , stm ==2.5.*
, template-haskell >=2.16 && <2.21
, terminal ==0.2.* , terminal ==0.2.*
, text >=2.0 && <3
, time ==1.9.* , time ==1.9.*
, tls >=1.6.0 && <1.7 , tls >=1.6.0 && <1.7
, unliftio ==0.2.* , unliftio ==0.2.*
, unliftio-core ==0.2.* , unliftio-core ==0.2.*
, zip >=1.7 && <2.1 , zip ==2.0.*
default-language: Haskell2010 default-language: Haskell2010
if flag(swift) if flag(swift)
cpp-options: -DswiftJSON cpp-options: -DswiftJSON
if impl(ghc >= 9.6.2)
build-depends:
bytestring ==0.11.*
, template-haskell ==2.20.*
, text >=2.0.1 && <2.2
if impl(ghc < 9.6.2)
build-depends:
bytestring ==0.10.*
, template-haskell ==2.16.*
, text >=1.2.3.0 && <1.3
executable simplex-bot-advanced executable simplex-bot-advanced
main-is: Main.hs main-is: Main.hs
@@ -276,7 +290,6 @@ executable simplex-bot-advanced
, attoparsec ==0.14.* , attoparsec ==0.14.*
, base >=4.7 && <5 , base >=4.7 && <5
, base64-bytestring >=1.0 && <1.3 , base64-bytestring >=1.0 && <1.3
, bytestring ==0.11.*
, composition ==1.0.* , composition ==1.0.*
, constraints >=0.12 && <0.14 , constraints >=0.12 && <0.14
, containers ==0.6.* , containers ==0.6.*
@@ -289,10 +302,10 @@ executable simplex-bot-advanced
, filepath ==1.4.* , filepath ==1.4.*
, http-types ==0.12.* , http-types ==0.12.*
, http2 >=4.2.2 && <4.3 , http2 >=4.2.2 && <4.3
, memory >=0.15 && <0.19 , memory ==0.18.*
, mtl >=2.3.1 && <3 , mtl >=2.3.1 && <3.0
, network >=3.1.2.7 && <3.2 , network >=3.1.2.7 && <3.2
, network-transport >=0.5.6 && <0.6 , network-transport ==0.5.6
, optparse-applicative >=0.15 && <0.17 , optparse-applicative >=0.15 && <0.17
, process ==1.6.* , process ==1.6.*
, random >=1.1 && <1.3 , random >=1.1 && <1.3
@@ -303,17 +316,25 @@ executable simplex-bot-advanced
, socks ==0.6.* , socks ==0.6.*
, sqlcipher-simple ==0.4.* , sqlcipher-simple ==0.4.*
, stm ==2.5.* , stm ==2.5.*
, template-haskell >=2.16 && <2.21
, terminal ==0.2.* , terminal ==0.2.*
, text >=2.0 && <3
, time ==1.9.* , time ==1.9.*
, tls >=1.6.0 && <1.7 , tls >=1.6.0 && <1.7
, unliftio ==0.2.* , unliftio ==0.2.*
, unliftio-core ==0.2.* , unliftio-core ==0.2.*
, zip >=1.7 && <2.1 , zip ==2.0.*
default-language: Haskell2010 default-language: Haskell2010
if flag(swift) if flag(swift)
cpp-options: -DswiftJSON cpp-options: -DswiftJSON
if impl(ghc >= 9.6.2)
build-depends:
bytestring ==0.11.*
, template-haskell ==2.20.*
, text >=2.0.1 && <2.2
if impl(ghc < 9.6.2)
build-depends:
bytestring ==0.10.*
, template-haskell ==2.16.*
, text >=1.2.3.0 && <1.3
executable simplex-broadcast-bot executable simplex-broadcast-bot
main-is: ../Main.hs main-is: ../Main.hs
@@ -331,7 +352,6 @@ executable simplex-broadcast-bot
, attoparsec ==0.14.* , attoparsec ==0.14.*
, base >=4.7 && <5 , base >=4.7 && <5
, base64-bytestring >=1.0 && <1.3 , base64-bytestring >=1.0 && <1.3
, bytestring ==0.11.*
, composition ==1.0.* , composition ==1.0.*
, constraints >=0.12 && <0.14 , constraints >=0.12 && <0.14
, containers ==0.6.* , containers ==0.6.*
@@ -344,10 +364,10 @@ executable simplex-broadcast-bot
, filepath ==1.4.* , filepath ==1.4.*
, http-types ==0.12.* , http-types ==0.12.*
, http2 >=4.2.2 && <4.3 , http2 >=4.2.2 && <4.3
, memory >=0.15 && <0.19 , memory ==0.18.*
, mtl >=2.3.1 && <3 , mtl >=2.3.1 && <3.0
, network >=3.1.2.7 && <3.2 , network >=3.1.2.7 && <3.2
, network-transport >=0.5.6 && <0.6 , network-transport ==0.5.6
, optparse-applicative >=0.15 && <0.17 , optparse-applicative >=0.15 && <0.17
, process ==1.6.* , process ==1.6.*
, random >=1.1 && <1.3 , random >=1.1 && <1.3
@@ -358,17 +378,25 @@ executable simplex-broadcast-bot
, socks ==0.6.* , socks ==0.6.*
, sqlcipher-simple ==0.4.* , sqlcipher-simple ==0.4.*
, stm ==2.5.* , stm ==2.5.*
, template-haskell >=2.16 && <2.21
, terminal ==0.2.* , terminal ==0.2.*
, text >=2.0 && <3
, time ==1.9.* , time ==1.9.*
, tls >=1.6.0 && <1.7 , tls >=1.6.0 && <1.7
, unliftio ==0.2.* , unliftio ==0.2.*
, unliftio-core ==0.2.* , unliftio-core ==0.2.*
, zip >=1.7 && <2.1 , zip ==2.0.*
default-language: Haskell2010 default-language: Haskell2010
if flag(swift) if flag(swift)
cpp-options: -DswiftJSON cpp-options: -DswiftJSON
if impl(ghc >= 9.6.2)
build-depends:
bytestring ==0.11.*
, template-haskell ==2.20.*
, text >=2.0.1 && <2.2
if impl(ghc < 9.6.2)
build-depends:
bytestring ==0.10.*
, template-haskell ==2.16.*
, text >=1.2.3.0 && <1.3
executable simplex-chat executable simplex-chat
main-is: Main.hs main-is: Main.hs
@@ -385,7 +413,6 @@ executable simplex-chat
, attoparsec ==0.14.* , attoparsec ==0.14.*
, base >=4.7 && <5 , base >=4.7 && <5
, base64-bytestring >=1.0 && <1.3 , base64-bytestring >=1.0 && <1.3
, bytestring ==0.11.*
, composition ==1.0.* , composition ==1.0.*
, constraints >=0.12 && <0.14 , constraints >=0.12 && <0.14
, containers ==0.6.* , containers ==0.6.*
@@ -398,10 +425,10 @@ executable simplex-chat
, filepath ==1.4.* , filepath ==1.4.*
, http-types ==0.12.* , http-types ==0.12.*
, http2 >=4.2.2 && <4.3 , http2 >=4.2.2 && <4.3
, memory >=0.15 && <0.19 , memory ==0.18.*
, mtl >=2.3.1 && <3 , mtl >=2.3.1 && <3.0
, network ==3.1.* , network ==3.1.*
, network-transport >=0.5.6 && <0.6 , network-transport ==0.5.6
, optparse-applicative >=0.15 && <0.17 , optparse-applicative >=0.15 && <0.17
, process ==1.6.* , process ==1.6.*
, random >=1.1 && <1.3 , random >=1.1 && <1.3
@@ -412,18 +439,26 @@ executable simplex-chat
, socks ==0.6.* , socks ==0.6.*
, sqlcipher-simple ==0.4.* , sqlcipher-simple ==0.4.*
, stm ==2.5.* , stm ==2.5.*
, template-haskell >=2.16 && <2.21
, terminal ==0.2.* , terminal ==0.2.*
, text >=2.0 && <3
, time ==1.9.* , time ==1.9.*
, tls >=1.6.0 && <1.7 , tls >=1.6.0 && <1.7
, unliftio ==0.2.* , unliftio ==0.2.*
, unliftio-core ==0.2.* , unliftio-core ==0.2.*
, websockets ==0.12.* , websockets ==0.12.*
, zip >=1.7 && <2.1 , zip ==2.0.*
default-language: Haskell2010 default-language: Haskell2010
if flag(swift) if flag(swift)
cpp-options: -DswiftJSON cpp-options: -DswiftJSON
if impl(ghc >= 9.6.2)
build-depends:
bytestring ==0.11.*
, template-haskell ==2.20.*
, text >=2.0.1 && <2.2
if impl(ghc < 9.6.2)
build-depends:
bytestring ==0.10.*
, template-haskell ==2.16.*
, text >=1.2.3.0 && <1.3
executable simplex-directory-service executable simplex-directory-service
main-is: ../Main.hs main-is: ../Main.hs
@@ -443,7 +478,6 @@ executable simplex-directory-service
, attoparsec ==0.14.* , attoparsec ==0.14.*
, base >=4.7 && <5 , base >=4.7 && <5
, base64-bytestring >=1.0 && <1.3 , base64-bytestring >=1.0 && <1.3
, bytestring ==0.11.*
, composition ==1.0.* , composition ==1.0.*
, constraints >=0.12 && <0.14 , constraints >=0.12 && <0.14
, containers ==0.6.* , containers ==0.6.*
@@ -456,10 +490,10 @@ executable simplex-directory-service
, filepath ==1.4.* , filepath ==1.4.*
, http-types ==0.12.* , http-types ==0.12.*
, http2 >=4.2.2 && <4.3 , http2 >=4.2.2 && <4.3
, memory >=0.15 && <0.19 , memory ==0.18.*
, mtl >=2.3.1 && <3 , mtl >=2.3.1 && <3.0
, network >=3.1.2.7 && <3.2 , network >=3.1.2.7 && <3.2
, network-transport >=0.5.6 && <0.6 , network-transport ==0.5.6
, optparse-applicative >=0.15 && <0.17 , optparse-applicative >=0.15 && <0.17
, process ==1.6.* , process ==1.6.*
, random >=1.1 && <1.3 , random >=1.1 && <1.3
@@ -470,17 +504,25 @@ executable simplex-directory-service
, socks ==0.6.* , socks ==0.6.*
, sqlcipher-simple ==0.4.* , sqlcipher-simple ==0.4.*
, stm ==2.5.* , stm ==2.5.*
, template-haskell >=2.16 && <2.21
, terminal ==0.2.* , terminal ==0.2.*
, text >=2.0 && <3
, time ==1.9.* , time ==1.9.*
, tls >=1.6.0 && <1.7 , tls >=1.6.0 && <1.7
, unliftio ==0.2.* , unliftio ==0.2.*
, unliftio-core ==0.2.* , unliftio-core ==0.2.*
, zip >=1.7 && <2.1 , zip ==2.0.*
default-language: Haskell2010 default-language: Haskell2010
if flag(swift) if flag(swift)
cpp-options: -DswiftJSON cpp-options: -DswiftJSON
if impl(ghc >= 9.6.2)
build-depends:
bytestring ==0.11.*
, template-haskell ==2.20.*
, text >=2.0.1 && <2.2
if impl(ghc < 9.6.2)
build-depends:
bytestring ==0.10.*
, template-haskell ==2.16.*
, text >=1.2.3.0 && <1.3
test-suite simplex-chat-test test-suite simplex-chat-test
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0
@@ -524,7 +566,6 @@ test-suite simplex-chat-test
, attoparsec ==0.14.* , attoparsec ==0.14.*
, base >=4.7 && <5 , base >=4.7 && <5
, base64-bytestring >=1.0 && <1.3 , base64-bytestring >=1.0 && <1.3
, bytestring ==0.11.*
, composition ==1.0.* , composition ==1.0.*
, constraints >=0.12 && <0.14 , constraints >=0.12 && <0.14
, containers ==0.6.* , containers ==0.6.*
@@ -540,10 +581,10 @@ test-suite simplex-chat-test
, hspec ==2.11.* , hspec ==2.11.*
, http-types ==0.12.* , http-types ==0.12.*
, http2 >=4.2.2 && <4.3 , http2 >=4.2.2 && <4.3
, memory >=0.15 && <0.19 , memory ==0.18.*
, mtl >=2.3.1 && <3 , mtl >=2.3.1 && <3.0
, network ==3.1.* , network ==3.1.*
, network-transport >=0.5.6 && <0.6 , network-transport ==0.5.6
, optparse-applicative >=0.15 && <0.17 , optparse-applicative >=0.15 && <0.17
, process ==1.6.* , process ==1.6.*
, random >=1.1 && <1.3 , random >=1.1 && <1.3
@@ -555,14 +596,22 @@ test-suite simplex-chat-test
, socks ==0.6.* , socks ==0.6.*
, sqlcipher-simple ==0.4.* , sqlcipher-simple ==0.4.*
, stm ==2.5.* , stm ==2.5.*
, template-haskell >=2.16 && <2.21
, terminal ==0.2.* , terminal ==0.2.*
, text >=2.0 && <3
, time ==1.9.* , time ==1.9.*
, tls >=1.6.0 && <1.7 , tls >=1.6.0 && <1.7
, unliftio ==0.2.* , unliftio ==0.2.*
, unliftio-core ==0.2.* , unliftio-core ==0.2.*
, zip >=1.7 && <2.1 , zip ==2.0.*
default-language: Haskell2010 default-language: Haskell2010
if flag(swift) if flag(swift)
cpp-options: -DswiftJSON cpp-options: -DswiftJSON
if impl(ghc >= 9.6.2)
build-depends:
bytestring ==0.11.*
, template-haskell ==2.20.*
, text >=2.0.1 && <2.2
if impl(ghc < 9.6.2)
build-depends:
bytestring ==0.10.*
, template-haskell ==2.16.*
, text >=1.2.3.0 && <1.3
+90 -6
View File
@@ -1,8 +1,11 @@
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DataKinds #-}
{-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-} {-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-} {-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE MultiWayIf #-} {-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedRecordDot #-} {-# LANGUAGE OverloadedRecordDot #-}
@@ -4989,9 +4992,10 @@ processAgentMessageConn user@User {userId} corrId agentConnId agentMessage = do
Left _ -> messageError "x.grp.mem.inv error: referenced member does not exist" Left _ -> messageError "x.grp.mem.inv error: referenced member does not exist"
Right reMember -> do Right reMember -> do
GroupMemberIntro {introId} <- withStore $ \db -> saveIntroInvitation db reMember m introInv GroupMemberIntro {introId} <- withStore $ \db -> saveIntroInvitation db reMember m introInv
void . sendGroupMessage' user [reMember] (XGrpMemFwd (memberInfo m) introInv) groupId (Just introId) $ void . runDBSuspendingChat_ $ sendGroupMessage' user [reMember] (XGrpMemFwd (memberInfo m) introInv) groupId (Just introId) $
withStore' $ -- withStore' $ \db ->
\db -> updateIntroStatus db introId GMIntroInvForwarded suspendDB $ \db ->
updateIntroStatus db introId GMIntroInvForwarded
_ -> messageError "x.grp.mem.inv can be only sent by invitee member" _ -> messageError "x.grp.mem.inv can be only sent by invitee member"
xGrpMemFwd :: GroupInfo -> GroupMember -> MemberInfo -> IntroInvitation -> m () xGrpMemFwd :: GroupInfo -> GroupMember -> MemberInfo -> IntroInvitation -> m ()
@@ -5522,11 +5526,91 @@ deliverMessage conn@Connection {connId} cmEventTag msgBody msgId = do
let sndMsgDelivery = SndMsgDelivery {connId, agentMsgId} let sndMsgDelivery = SndMsgDelivery {connId, agentMsgId}
withStore' $ \db -> createSndMsgDelivery db sndMsgDelivery msgId withStore' $ \db -> createSndMsgDelivery db sndMsgDelivery msgId
newtype Sus i a = Sus
{ runSus :: ReaderT (TVar [i], ChatController) IO a
} deriving (Functor, Applicative, Monad, MonadIO, MonadUnliftIO)
-- Recover MonadError via MonadUnliftIO
instance MonadError ChatError (Sus i) where
throwError = E.throwIO
{-# INLINE throwError #-}
catchError = E.catch
{-# INLINE catchError #-}
-- Alas, there's no MonadCont IO, and no MonadUnliftIO (ContT IO)
-- instance MonadCont Sus where
-- callCC a'susB_susA = Sus $ do
-- callCC $ \a'rB ->
-- let Sus s = a'susB_susA $ \a -> Sus (a'rB a)
-- in s
-- Hide our extra state var from ChatMonad/Reader
instance MonadReader ChatController (Sus i) where
ask = Sus $ asks snd
{-# INLINE ask #-}
local f (Sus action) = Sus $ local (fmap f) action
{-# INLINE local #-}
-- Instantiate TVar-powered MonadState, breaking atomic updates
-- instance MonadState [IO ()] Sus where
-- state f = Sus $ asks fst >>= \st -> atomically (stateTVar st f)
-- get = Sus $ asks fst >>= readTVarIO
-- put x = seq x $ Sus $ asks fst >>= \st -> atomically (writeTVar st x)
-- Or not... just use our hidden state directly
suspend :: i -> Sus i ()
suspend action = Sus $ asks fst >>= \st -> atomically $ modifyTVar' st (action :) -- XXX: pushing actions to a stack - reverse to get original order (if needed)
{-# INLINE suspend #-}
-- Make it classy to prevent monomorphization of ChatMonad constraints
class SuspendIO m where
suspendIO :: IO () -> m ()
instance SuspendIO (Sus (IO ())) where
suspendIO = suspend
suspendM :: (MonadUnliftIO m, SuspendIO m) => m () -> m ()
suspendM action = toIO action >>= suspendIO
-- Boo, does not aggregate transactions
-- withStoreLater :: (ChatMonad m, SuspendIO m) => (DB.Connection -> IO ()) -> m ()
-- withStoreLater action = suspendM (withStore' action)
withStoreLater :: SuspendDB m => (DB.Connection -> IO ()) -> m ()
withStoreLater = suspendDB
class SuspendDB m where
suspendDB :: (DB.Connection -> IO ()) -> m ()
instance SuspendDB (Sus (DB.Connection -> IO ())) where
suspendDB = suspend
runSuspendingChat :: ChatMonad m => ([i] -> m r) -> Sus i a -> m (r, a)
runSuspendingChat animate (Sus action) = do
cc <- ask
suspended <- newTVarIO []
r <- E.try (liftIO $ runReaderT action (suspended, cc)) >>= liftEither
readTVarIO suspended >>= animate >>= \susResults -> pure (susResults, r)
runIOSuspendingChat_ :: forall m a . ChatMonad m => Sus (IO ()) a -> m a
runIOSuspendingChat_ action = snd <$> runSuspendingChat animate_ action
where
animate_ :: [IO ()] -> m ()
animate_ = mapM_ liftIO
runDBSuspendingChat_ :: forall m a . ChatMonad m => Sus (DB.Connection -> IO ()) a -> m a
runDBSuspendingChat_ action = snd <$> runSuspendingChat animate action
where
animate :: [DB.Connection -> IO ()] -> m ()
animate batch = withStore' $ \db -> mapM_ ($ db) $ reverse batch -- XXX: recover original order from consing to []
sendGroupMessage :: (MsgEncodingI e, ChatMonad m) => User -> GroupInfo -> [GroupMember] -> ChatMsgEvent e -> m (SndMessage, [GroupMember]) sendGroupMessage :: (MsgEncodingI e, ChatMonad m) => User -> GroupInfo -> [GroupMember] -> ChatMsgEvent e -> m (SndMessage, [GroupMember])
sendGroupMessage user GroupInfo {groupId} members chatMsgEvent = sendGroupMessage user GroupInfo {groupId} members chatMsgEvent =
sendGroupMessage' user members chatMsgEvent groupId Nothing $ pure () -- Give SuspendDB powers
runDBSuspendingChat_ $ sendGroupMessage' user members chatMsgEvent groupId Nothing $ pure ()
sendGroupMessage' :: forall e m. (MsgEncodingI e, ChatMonad m) => User -> [GroupMember] -> ChatMsgEvent e -> Int64 -> Maybe Int64 -> m () -> m (SndMessage, [GroupMember]) -- Require SuspendDB powers
sendGroupMessage' :: forall e m. (MsgEncodingI e, ChatMonad m, SuspendDB m) => User -> [GroupMember] -> ChatMsgEvent e -> Int64 -> Maybe Int64 -> m () -> m (SndMessage, [GroupMember])
sendGroupMessage' user members chatMsgEvent groupId introId_ postDeliver = do sendGroupMessage' user members chatMsgEvent groupId introId_ postDeliver = do
msg <- createSndMessage chatMsgEvent (GroupId groupId) msg <- createSndMessage chatMsgEvent (GroupId groupId)
-- TODO collect failed deliveries into a single error -- TODO collect failed deliveries into a single error
@@ -5551,7 +5635,7 @@ sendGroupMessage' user members chatMsgEvent groupId introId_ postDeliver = do
| forwardSupported && isForwardedGroupMsg chatMsgEvent = pure Nothing | forwardSupported && isForwardedGroupMsg chatMsgEvent = pure Nothing
| isXGrpMsgForward chatMsgEvent = pure Nothing | isXGrpMsgForward chatMsgEvent = pure Nothing
| otherwise = do | otherwise = do
withStore' $ \db -> createPendingGroupMessage db groupMemberId msgId introId_ withStoreLater $ \db -> createPendingGroupMessage db groupMemberId msgId introId_
pure $ Just m pure $ Just m
forwardSupported = do forwardSupported = do
let mcvr = memberChatVRange' m let mcvr = memberChatVRange' m
+8
View File
@@ -42,6 +42,7 @@ data ChatOpts = ChatOpts
allowInstantFiles :: Bool, allowInstantFiles :: Bool,
autoAcceptFileSize :: Integer, autoAcceptFileSize :: Integer,
muteNotifications :: Bool, muteNotifications :: Bool,
markRead :: Bool,
maintenance :: Bool maintenance :: Bool
} }
@@ -268,6 +269,12 @@ chatOptsP appDir defaultDbFileName = do
( long "mute" ( long "mute"
<> help "Mute notifications" <> help "Mute notifications"
) )
markRead <-
switch
( long "mark-read"
<> short 'r'
<> help "Mark shown messages as read"
)
maintenance <- maintenance <-
switch switch
( long "maintenance" ( long "maintenance"
@@ -286,6 +293,7 @@ chatOptsP appDir defaultDbFileName = do
allowInstantFiles, allowInstantFiles,
autoAcceptFileSize, autoAcceptFileSize,
muteNotifications, muteNotifications,
markRead,
maintenance maintenance
} }
+3 -3
View File
@@ -44,7 +44,7 @@ simplexChatTerminal cfg opts t =
handle checkDBKeyError . simplexChatCore cfg opts $ \u cc -> do handle checkDBKeyError . simplexChatCore cfg opts $ \u cc -> do
ct <- newChatTerminal t opts ct <- newChatTerminal t opts
when (firstTime cc) . printToTerminal ct $ chatWelcome u when (firstTime cc) . printToTerminal ct $ chatWelcome u
runChatTerminal ct cc runChatTerminal ct cc opts
checkDBKeyError :: SQLError -> IO () checkDBKeyError :: SQLError -> IO ()
checkDBKeyError e = case sqlError e of checkDBKeyError e = case sqlError e of
@@ -53,5 +53,5 @@ checkDBKeyError e = case sqlError e of
exitFailure exitFailure
_ -> throwIO e _ -> throwIO e
runChatTerminal :: ChatTerminal -> ChatController -> IO () runChatTerminal :: ChatTerminal -> ChatController -> ChatOpts -> IO ()
runChatTerminal ct cc = raceAny_ [runTerminalInput ct cc, runTerminalOutput ct cc, runInputLoop ct cc] runChatTerminal ct cc opts = raceAny_ [runTerminalInput ct cc, runTerminalOutput ct cc opts, runInputLoop ct cc]
+4 -4
View File
@@ -142,13 +142,13 @@ withTermLock ChatTerminal {termLock} action = do
action action
atomically $ putTMVar termLock () atomically $ putTMVar termLock ()
runTerminalOutput :: ChatTerminal -> ChatController -> IO () runTerminalOutput :: ChatTerminal -> ChatController -> ChatOpts -> IO ()
runTerminalOutput ct cc@ChatController {outputQ, showLiveItems, logFilePath} = do runTerminalOutput ct cc@ChatController {outputQ, showLiveItems, logFilePath} ChatOpts {markRead} = do
forever $ do forever $ do
(_, outputRH, r) <- atomically $ readTBQueue outputQ (_, outputRH, r) <- atomically $ readTBQueue outputQ
case r of case r of
CRNewChatItem u ci -> markChatItemRead u ci CRNewChatItem u ci -> when markRead $ markChatItemRead u ci
CRChatItemUpdated u ci -> markChatItemRead u ci CRChatItemUpdated u ci -> when markRead $ markChatItemRead u ci
CRRemoteHostConnected {remoteHost = RemoteHostInfo {remoteHostId}} -> getRemoteUser remoteHostId CRRemoteHostConnected {remoteHost = RemoteHostInfo {remoteHostId}} -> getRemoteUser remoteHostId
CRRemoteHostStopped {remoteHostId_} -> mapM_ removeRemoteUser remoteHostId_ CRRemoteHostStopped {remoteHostId_} -> mapM_ removeRemoteUser remoteHostId_
_ -> pure () _ -> pure ()
-96
View File
@@ -1,96 +0,0 @@
# This file was automatically generated by 'stack init'
#
# Some commonly used options have been documented as comments in this file.
# For advanced use and comprehensive documentation of the format, please see:
# https://docs.haskellstack.org/en/stable/yaml_configuration/
# Resolver to choose a 'specific' stackage snapshot or a compiler version.
# A snapshot resolver dictates the compiler version and the set of packages
# to be used for project dependencies. For example:
#
# resolver: lts-3.5
# resolver: nightly-2015-09-21
# resolver: ghc-7.10.2
#
# The location of a snapshot can be provided as a file or url. Stack assumes
# a snapshot provided as a file might change, whereas a url resource does not.
#
# resolver: ./custom-snapshot.yaml
# resolver: https://example.com/snapshots/2018-01-01.yaml
resolver: lts-18.21
# User packages to be built.
# Various formats can be used as shown in the example below.
#
# packages:
# - some-directory
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
# subdirs:
# - auto-update
# - wai
packages:
- .
# Dependency packages to be pulled from upstream that are not in the resolver.
# These entries can reference officially published versions as well as
# forks / in-progress versions pinned to a git hash. For example:
#
extra-deps:
- cryptostore-0.2.1.0@sha256:9896e2984f36a1c8790f057fd5ce3da4cbcaf8aa73eb2d9277916886978c5b19,3881
- network-3.1.2.7@sha256:e3d78b13db9512aeb106e44a334ab42b7aa48d26c097299084084cb8be5c5568,4888
- simple-logger-0.1.0@sha256:be8ede4bd251a9cac776533bae7fb643369ebd826eb948a9a18df1a8dd252ff8,1079
- tls-1.6.0@sha256:7ae39373fd2de27fb80e90f76d22aeeb9a074a0ddd120cbd02c9c52f516a9e55,6987
# below hackage dependencies are to update Aeson to 2.0.3
- OneTuple-0.3.1@sha256:a848c096c9d29e82ffdd30a9998aa2931cbccb3a1bc137539d80f6174d31603e,2262
- attoparsec-0.14.4@sha256:79584bdada8b730cb5138fca8c35c76fbef75fc1d1e01e6b1d815a5ee9843191,5810
- hashable-1.4.0.2@sha256:0cddd0229d1aac305ea0404409c0bbfab81f075817bd74b8b2929eff58333e55,5005
- semialign-1.2.0.1@sha256:0e179b4d3a8eff79001d374d6c91917c6221696b9620f0a4d86852fc6a9b9501,2836
- text-short-0.1.5@sha256:962c6228555debdc46f758d0317dea16e5240d01419b42966674b08a5c3d8fa6,3498
- time-compat-1.9.6.1@sha256:42d8f2e08e965e1718917d54ad69e1d06bd4b87d66c41dc7410f59313dba4ed1,5033
# - simplexmq-1.0.0@sha256:34b2004728ae396e3ae449cd090ba7410781e2b3cefc59259915f4ca5daa9ea8,8561
# - ../simplexmq
- github: simplex-chat/simplexmq
commit: 117168ccce93ef5ac478c02e3f02a018fa8a2200
- github: kazu-yamamoto/http2
commit: f5525b755ff2418e6e6ecc69e877363b0d0bcaeb
# - ../direct-sqlcipher
- github: simplex-chat/direct-sqlcipher
commit: f814ee68b16a9447fbb467ccc8f29bdd3546bfd9
# - ../sqlcipher-simple
- github: simplex-chat/sqlcipher-simple
commit: a46bd361a19376c5211f1058908fc0ae6bf42446
# - terminal-0.2.0.0@sha256:de6770ecaae3197c66ac1f0db5a80cf5a5b1d3b64a66a05b50f442de5ad39570,2977
- github: simplex-chat/aeson
commit: aab7b5a14d6c5ea64c64dcaee418de1bb00dcc2b
- github: simplex-chat/haskell-terminal
commit: f708b00009b54890172068f168bf98508ffcd495
- github: simplex-chat/android-support
commit: 9aa09f148089d6752ce563b14c2df1895718d806
#
# extra-deps: []
# Override default flag values for local packages and extra-deps
flags:
zip:
disable-bzip2: true
disable-zstd: true
direct-sqlcipher:
openssl: true
# Extra package databases containing global packages
# extra-package-dbs: []
# Control whether we use the GHC we find on the path
# system-ghc: true
#
# Require a specific version of stack, using version ranges
# require-stack-version: -any # Default
# require-stack-version: ">=2.1"
#
# Override the architecture used by stack, especially useful on Windows
# arch: i386
# arch: x86_64
#
# Extra directories used by stack for building
# extra-lib-dirs: [/path/to/dir]
#
# Allow a newer minor version of GHC than the snapshot specifies
# compiler-check: newer-minor
+2 -1
View File
@@ -82,6 +82,7 @@ testOpts =
allowInstantFiles = True, allowInstantFiles = True,
autoAcceptFileSize = 0, autoAcceptFileSize = 0,
muteNotifications = True, muteNotifications = True,
markRead = True,
maintenance = False maintenance = False
} }
@@ -174,7 +175,7 @@ startTestChat_ db cfg opts user = do
t <- withVirtualTerminal termSettings pure t <- withVirtualTerminal termSettings pure
ct <- newChatTerminal t opts ct <- newChatTerminal t opts
cc <- newChatController db (Just user) cfg opts cc <- newChatController db (Just user) cfg opts
chatAsync <- async . runSimplexChat opts user cc . const $ runChatTerminal ct chatAsync <- async . runSimplexChat opts user cc $ \_u cc' -> runChatTerminal ct cc' opts
atomically . unless (maintenance opts) $ readTVar (agentAsync cc) >>= \a -> when (isNothing a) retry atomically . unless (maintenance opts) $ readTVar (agentAsync cc) >>= \a -> when (isNothing a) retry
termQ <- newTQueueIO termQ <- newTQueueIO
termAsync <- async $ readTerminalOutput t termQ termAsync <- async $ readTerminalOutput t termQ
+3 -3
View File
@@ -162,13 +162,13 @@ storedBindingsTest = testChat2 aliceProfile aliceDesktopProfile $ \mobile deskto
desktop ##> "/list remote hosts" desktop ##> "/list remote hosts"
desktop <## "Remote hosts:" desktop <## "Remote hosts:"
desktop <## "1. Mobile (connected) [lo 127.0.0.1:52230]" desktop <##. "1. Mobile (connected) ["
stopDesktop mobile desktop stopDesktop mobile desktop
desktop ##> "/list remote hosts" desktop ##> "/list remote hosts"
desktop <## "Remote hosts:" desktop <## "Remote hosts:"
desktop <## "1. Mobile [lo 127.0.0.1:52230]" desktop <##. "1. Mobile ["
-- TODO: more parser tests -- TODO: more parser tests
remoteMessageTest :: HasCallStack => FilePath -> IO () remoteMessageTest :: HasCallStack => FilePath -> IO ()
remoteMessageTest = testChat3 aliceProfile aliceDesktopProfile bobProfile $ \mobile desktop bob -> do remoteMessageTest = testChat3 aliceProfile aliceDesktopProfile bobProfile $ \mobile desktop bob -> do