diff --git a/.gitmodules b/.gitmodules index 38d4aca6a50..27713b11bdb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -15,7 +15,7 @@ url = https://github.com/telegramdesktop/libtgvoip.git [submodule "submodules/TgVoipWebrtc/tgcalls"] path = submodules/TgVoipWebrtc/tgcalls - url = https://github.com/TelegramMessenger/tgcalls.git + url = git@bitbucket.org:mobyrix/tgcalls.git [submodule "third-party/libvpx/libvpx"] path = third-party/libvpx/libvpx url = https://github.com/webmproject/libvpx.git @@ -26,7 +26,7 @@ # Perhaps the crash is related to the minimum version of iOS (we have iOS 14, telegram has iOS 12). [submodule "third-party/webrtc/webrtc"] path = third-party/webrtc/webrtc - url = https://github.com/denis15yo/webrtc.git + url = https://github.com/nicegram/webrtc.git [submodule "third-party/libx264/x264"] path = third-party/libx264/x264 url = https://github.com/mirror/x264.git @@ -35,4 +35,4 @@ url = https://github.com/MobileNativeFoundation/rules_xcodeproj.git [submodule "submodules/LottieCpp/lottiecpp"] path = submodules/LottieCpp/lottiecpp - url = https://github.com/ali-fareed/lottiecpp.git + url = https://github.com/ali-fareed/lottiecpp.git \ No newline at end of file diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index fc112237f35..a4a0c035a7b 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -2981,8 +2981,8 @@ "general": { "bzlTransitiveDigest": "YjE3dFjYQ4sj5gn2Iz1cWVK14/ZJ5cmnAUUGjDbACAA=", "recordedFileInputs": { - "@@//Package.resolved": "30140fa448ac62bfa0781affd60171e7fbacc1f2d1e0f02a336c356162c102c7", - "@@//Package.swift": "fb3cb1d48066e64f8bf17fe1a49f689b7a6bf4bfc07aa90b9b80a02188501951" + "@@//Package.resolved": "02b7002695fb73684ed45f2bfeb2b621b09e810529d4fcb8b3f276d04657a806", + "@@//Package.swift": "b55c7ef028c6f3d7460b682fbf5d3c7be38b92396f24d18cbe8467244e35b673" }, "recordedDirentsInputs": {}, "envVariables": {}, @@ -3082,7 +3082,7 @@ "ruleClassName": "swift_package", "attributes": { "bazel_package_name": "swiftpkg_swiftui_flow", - "commit": "9d122ace53e143dc3e1bf61c01a024535b0c7ab7", + "commit": "3086a602b98155eec28b4be79210d6cb1a43e339", "remote": "https://github.com/denis15yo/SwiftUI-Flow.git", "init_submodules": false, "recursive_init_submodules": true, @@ -3208,7 +3208,7 @@ "ruleClassName": "swift_package", "attributes": { "bazel_package_name": "swiftpkg_core_swift", - "commit": "78f8920a260775686dd0e04f5045677447bb7a6c", + "commit": "a37b52af6bc6ca9d7e4d2fe0942f91ed16c7c6ac", "remote": "https://github.com/denis15yo/core-swift.git", "init_submodules": false, "recursive_init_submodules": true, @@ -3226,7 +3226,7 @@ "ruleClassName": "swift_package", "attributes": { "bazel_package_name": "swiftpkg_walletconnectswiftv2", - "commit": "b6e9e37ab5981444f3898653c34fd39284534aad", + "commit": "3327c0a8c014b155534b91520554d812e2960077", "remote": "https://github.com/WalletConnect/WalletConnectSwiftV2.git", "init_submodules": false, "recursive_init_submodules": true, @@ -3460,7 +3460,7 @@ "ruleClassName": "swift_package", "attributes": { "bazel_package_name": "swiftpkg_nicegram_assistant_ios", - "commit": "fda1e89c94fc546d2762d0b2d754e9654965774f", + "commit": "074eb3968c63b72ddf36e77b729245fed7c03f52", "remote": "git@bitbucket.org:mobyrix/nicegram-assistant-ios.git", "init_submodules": false, "recursive_init_submodules": true, @@ -3532,7 +3532,7 @@ "ruleClassName": "swift_package", "attributes": { "bazel_package_name": "swiftpkg_grdb.swift", - "commit": "afc958017ee4feefd3c61c8e2cddf81d079d2e39", + "commit": "156d630c7a4175ddf4d529244f4672428cc6e2fc", "remote": "https://github.com/denis15yo/GRDB.swift.git", "init_submodules": false, "recursive_init_submodules": true, @@ -3568,7 +3568,7 @@ "ruleClassName": "swift_package", "attributes": { "bazel_package_name": "swiftpkg_floatingpanel", - "commit": "71f419a3cd212afc7615e2179c2fec1df1aa74da", + "commit": "b6e8928b1a3ad909e6db6a0278d286c33cfd0dc3", "remote": "https://github.com/scenee/FloatingPanel", "init_submodules": false, "recursive_init_submodules": true, @@ -3658,7 +3658,7 @@ "ruleClassName": "swift_package", "attributes": { "bazel_package_name": "swiftpkg_wallet_core", - "commit": "160a6e6275d25c0edb91823ae62c605d3d66c013", + "commit": "db50956fe49d7feb5aca3a4406f49b722e5cfab5", "remote": "https://github.com/trustwallet/wallet-core.git", "init_submodules": false, "recursive_init_submodules": true, @@ -3694,7 +3694,7 @@ "ruleClassName": "swift_package", "attributes": { "bazel_package_name": "swiftpkg_xcodeedit", - "commit": "b6b67389a0f1a6fdd9c6457a8ab5b02eaab13c5c", + "commit": "49734e514af8e917f5aa2112ce59a0eea542580c", "remote": "https://github.com/tomlokhorst/XcodeEdit", "init_submodules": false, "recursive_init_submodules": true, @@ -3712,7 +3712,7 @@ "ruleClassName": "swift_package", "attributes": { "bazel_package_name": "swiftpkg_nicegram_wallet_ios", - "commit": "458be079925da10ff15a2b41961ae3bfb4468835", + "commit": "a28ea13441d33fa4c6f6aa5886eb7151916dc8ec", "remote": "git@bitbucket.org:mobyrix/nicegram-wallet-ios.git", "init_submodules": false, "recursive_init_submodules": true, diff --git a/Nicegram/NGEnv/Sources/NGEnv.swift b/Nicegram/NGEnv/Sources/NGEnv.swift index e4f4a3d26e9..b8b5b5232f0 100644 --- a/Nicegram/NGEnv/Sources/NGEnv.swift +++ b/Nicegram/NGEnv/Sources/NGEnv.swift @@ -25,6 +25,8 @@ public struct NGEnvObj: Decodable { public let web3AuthBackupQuestion: String public let web3AuthClientId: String public let web3AuthVerifier: String + public let stonfiApiUrl: String + public let stonfiNicegramApiUrl: String } } diff --git a/Package.resolved b/Package.resolved index 99006631a0e..a1a5f19238d 100644 --- a/Package.resolved +++ b/Package.resolved @@ -33,7 +33,7 @@ "location" : "https://github.com/denis15yo/core-swift.git", "state" : { "branch" : "release/1.0.0", - "revision" : "78f8920a260775686dd0e04f5045677447bb7a6c" + "revision" : "a37b52af6bc6ca9d7e4d2fe0942f91ed16c7c6ac" } }, { @@ -122,8 +122,8 @@ "kind" : "remoteSourceControl", "location" : "git@bitbucket.org:mobyrix/nicegram-assistant-ios.git", "state" : { - "branch" : "develop", - "revision" : "45a45218abe43b456b86a36b21645f394a6de4e8" + "branch" : "feat/stonfi-swap", + "revision" : "074eb3968c63b72ddf36e77b729245fed7c03f52" } }, { @@ -131,8 +131,8 @@ "kind" : "remoteSourceControl", "location" : "git@bitbucket.org:mobyrix/nicegram-wallet-ios.git", "state" : { - "branch" : "develop", - "revision" : "fc71fd8b134e190f54f717965c1a6e86b0668af9" + "branch" : "feat/stonfi-swap", + "revision" : "a28ea13441d33fa4c6f6aa5886eb7151916dc8ec" } }, { @@ -176,8 +176,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Web3Auth/session-manager-swift.git", "state" : { - "revision" : "20cc7bff065d7fe53164d17e7714a3f17d4cea2a", - "version" : "4.0.2" + "revision" : "cad9cf59c2aaf062d80b6ad88e6d3ef2680b94ef", + "version" : "4.1.0" } }, { @@ -374,8 +374,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/tomlokhorst/XcodeEdit", "state" : { - "revision" : "b6b67389a0f1a6fdd9c6457a8ab5b02eaab13c5c", - "version" : "2.9.2" + "revision" : "49734e514af8e917f5aa2112ce59a0eea542580c", + "version" : "2.10.1" } } ], diff --git a/Package.swift b/Package.swift index fbff9b5bdb3..fc571616479 100644 --- a/Package.swift +++ b/Package.swift @@ -5,7 +5,7 @@ import PackageDescription let package = Package( name: "nicegram-package", dependencies: [ - .package(url: "git@bitbucket.org:mobyrix/nicegram-assistant-ios.git", branch: "develop"), - .package(url: "git@bitbucket.org:mobyrix/nicegram-wallet-ios.git", branch: "develop") + .package(url: "git@bitbucket.org:mobyrix/nicegram-assistant-ios.git", branch: "feat/stonfi-swap"), + .package(url: "git@bitbucket.org:mobyrix/nicegram-wallet-ios.git", branch: "feat/stonfi-swap") ] ) diff --git a/submodules/TelegramUI/Sources/AppDelegate.swift b/submodules/TelegramUI/Sources/AppDelegate.swift index 7b76b902c0d..8daaa91b392 100644 --- a/submodules/TelegramUI/Sources/AppDelegate.swift +++ b/submodules/TelegramUI/Sources/AppDelegate.swift @@ -452,7 +452,9 @@ private class UserInterfaceStyleObserverWindow: UIWindow { walletConnectProjectId: NGENV.wallet.walletConnectProjectId, web3AuthBackupQuestion: NGENV.wallet.web3AuthBackupQuestion, web3AuthClientId: NGENV.wallet.web3AuthClientId, - web3AuthVerifier: NGENV.wallet.web3AuthVerifier + web3AuthVerifier: NGENV.wallet.web3AuthVerifier, + stonfiApiUrl: NGENV.wallet.stonfiApiUrl, + stonfiNicegramApiUrl: NGENV.wallet.stonfiNicegramApiUrl ) }, contactImageProvider: { diff --git a/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift b/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift index 42c0ab9f5f4..90acce94fbc 100644 --- a/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift +++ b/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift @@ -1938,132 +1938,132 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState } // - // MARK: Nicegram MessageContextMenu, helpers - let isSecretChat = message.id.peerId.namespace == Namespaces.Peer.SecretChat - let presentationData = context.sharedContext.currentPresentationData.with { $0 } + // MARK: NG Context Menu let nicegramIcon: (PresentationTheme) -> UIImage? = { theme in return generateTintedImage(image: UIImage(bundleImageName: "logo-nicegram"), color: theme.actionSheet.primaryTextColor, customSize: CGSize(width: 24, height: 24)) } - // - - // MARK: Nicegram ForwardAsCopy - if !message.isCopyProtected() { - actions.append(.action(ContextMenuActionItem(text: l("Chat.ForwardAsCopy"), icon: { theme in - return generateTintedImage(image: UIImage(bundleImageName: "CopyForward"), color: theme.actionSheet.primaryTextColor) - }, action: { _, f in - interfaceInteraction.copyForwardMessages(selectAll ? messages : [message]) - f(.dismissWithoutContent) - }))) - } - // - - // MARK: Nicegram Translate - let textToTranslate = message.textToTranslate() - if !isSecretChat, - !textToTranslate.isEmpty { - var title = l("Messages.Translate") - if message.hasNicegramTranslation() { - title = l("Messages.UndoTranslate") + let isSecretChat = message.id.peerId.namespace == Namespaces.Peer.SecretChat + let presentationData = context.sharedContext.currentPresentationData.with { $0 } + actions.append(.action(ContextMenuActionItem(text: l("AppName") + "...", icon: nicegramIcon, action: { controller, f in + var ngContextItems: [ContextMenuItem] = [] + + // Copyforward + if !message.isCopyProtected() { + ngContextItems.append(.action(ContextMenuActionItem(text: l("Chat.ForwardAsCopy"), icon: { theme in + return generateTintedImage(image: UIImage(bundleImageName: "CopyForward"), color: theme.actionSheet.primaryTextColor) + }, action: { _, f in + interfaceInteraction.copyForwardMessages(selectAll ? messages : [message]) + f(.dismissWithoutContent) + }))) } - actions.append(.action(ContextMenuActionItem(text: title, icon: { theme in - return generateTintedImage(image: UIImage(bundleImageName: "NGTranslateIcon"), color: theme.actionSheet.primaryTextColor) - }, action: { _, f in + + // Translate + let textToTranslate = message.textToTranslate() + if !isSecretChat, + !textToTranslate.isEmpty { + var title = l("Messages.Translate") if message.hasNicegramTranslation() { - message.removeNicegramTranslation( - context: context - ) - } else { - let toLang = getPreferredTranslationTargetLanguage(presentationData) - let _ = (gtranslate(textToTranslate, toLang) |> deliverOnMainQueue).start(next: { translated in - message.addNicegramTranslation( - translated, + title = l("Messages.UndoTranslate") + } + ngContextItems.append(.action(ContextMenuActionItem(text: title, icon: { theme in + return generateTintedImage(image: UIImage(bundleImageName: "NGTranslateIcon"), color: theme.actionSheet.primaryTextColor) + }, action: { _, f in + if message.hasNicegramTranslation() { + message.removeNicegramTranslation( context: context ) - }, error: { _ in - let c = getIAPErrorController(context: context, "Messages.TranslateError", presentationData) - controllerInteraction.presentGlobalOverlayController(c, nil) - }) - } - f(.default) - }))) - } - // - - // MARK: Nicegram RestrictFromContextMenu - if let peer = chatPresentationInterfaceState.renderedPeer?.peer ?? message.peers[message.id.peerId] { - let hasRestrictPermission: Bool - if let channel = peer as? TelegramChannel { - hasRestrictPermission = channel.hasPermission(.banMembers) - } else if let group = peer as? TelegramGroup { - switch group.role { - case .creator: - hasRestrictPermission = true - case let .admin(adminRights, _): - hasRestrictPermission = adminRights.rights.contains(.canBanUsers) - case .member: + } else { + let toLang = getPreferredTranslationTargetLanguage(presentationData) + let _ = (gtranslate(textToTranslate, toLang) |> deliverOnMainQueue).start(next: { translated in + message.addNicegramTranslation( + translated, + context: context + ) + }, error: { _ in + let c = getIAPErrorController(context: context, "Messages.TranslateError", presentationData) + controllerInteraction.presentGlobalOverlayController(c, nil) + }) + } + f(.default) + }))) + } + + if let peer = chatPresentationInterfaceState.renderedPeer?.peer ?? message.peers[message.id.peerId] { + let hasRestrictPermission: Bool + if let channel = peer as? TelegramChannel { + hasRestrictPermission = channel.hasPermission(.banMembers) + } else if let group = peer as? TelegramGroup { + switch group.role { + case .creator: + hasRestrictPermission = true + case let .admin(adminRights, _): + hasRestrictPermission = adminRights.rights.contains(.canBanUsers) + case .member: + hasRestrictPermission = false + } + } else { hasRestrictPermission = false } - } else { - hasRestrictPermission = false + + if let user = message.author as? TelegramUser { + if (user.id != context.account.peerId) && hasRestrictPermission { + let banDisposables = DisposableDict() + // TODO: Check is user an admin? + ngContextItems.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ContextMenuBan, icon: { theme in + return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Restrict"), color: theme.actionSheet.primaryTextColor) + }, action: { _, f in + let participantSignal: Signal + if peer is TelegramChannel { + participantSignal = context.engine.peers.fetchChannelParticipant(peerId: peer.id, participantId: user.id) + } else if peer is TelegramGroup { + participantSignal = .single(.member(id: user.id, invitedAt: 0, adminInfo: nil, banInfo: nil, rank: nil, subscriptionUntilDate: nil)) + } else { + participantSignal = .single(nil) + } + banDisposables.set((participantSignal + |> deliverOnMainQueue).start(next: { participant in + controllerInteraction.presentController(channelBannedMemberController(context: context, peerId: peer.id, memberId: message.author!.id, initialParticipant: participant, updated: { _ in }, upgradedToSupergroup: { _, f in f() }), ViewControllerPresentationArguments(presentationAnimation: .modalSheet)) + }), forKey: user.id) + f(.dismissWithoutContent) + })) + ) + } + } } - if let user = message.author as? TelegramUser { - if (user.id != context.account.peerId) && hasRestrictPermission { - let banDisposables = DisposableDict() - // TODO: Check is user an admin? - actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ContextMenuBan, icon: { theme in - return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Restrict"), color: theme.actionSheet.primaryTextColor) - }, action: { _, f in - let participantSignal: Signal - if peer is TelegramChannel { - participantSignal = context.engine.peers.fetchChannelParticipant(peerId: peer.id, participantId: user.id) - } else if peer is TelegramGroup { - participantSignal = .single(.member(id: user.id, invitedAt: 0, adminInfo: nil, banInfo: nil, rank: nil, subscriptionUntilDate: nil)) - } else { - participantSignal = .single(nil) + // MARK: Nicegram MessageMetadata + if !isCopyProtected, !isSecretChat, #available(iOS 15.0, *) { + let messageMetadataAction = ContextMenuActionItem( + text: "Metadata", + icon: { theme in + generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Info"), color: theme.actionSheet.primaryTextColor) + }, + action: { _, f in + Task { + let data = try wrap( + message, + writingOptions: [ + .prettyPrinted, + .sortedKeys, + .withoutEscapingSlashes + ] + ) + let text = String(data: data, encoding: .utf8) + + await showMessageMetadataPopup( + text: text ?? "" + ) } - banDisposables.set((participantSignal - |> deliverOnMainQueue).start(next: { participant in - controllerInteraction.presentController(channelBannedMemberController(context: context, peerId: peer.id, memberId: message.author!.id, initialParticipant: participant, updated: { _ in }, upgradedToSupergroup: { _, f in f() }), ViewControllerPresentationArguments(presentationAnimation: .modalSheet)) - }), forKey: user.id) - f(.dismissWithoutContent) - })) - ) - } - } - } - // - - // MARK: Nicegram MessageMetadata - if !isCopyProtected, !isSecretChat, #available(iOS 15.0, *) { - let messageMetadataAction = ContextMenuActionItem( - text: "Metadata", - icon: { theme in - generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Info"), color: theme.actionSheet.primaryTextColor) - }, - action: { _, f in - Task { - let data = try wrap( - message, - writingOptions: [ - .prettyPrinted, - .sortedKeys, - .withoutEscapingSlashes - ] - ) - let text = String(data: data, encoding: .utf8) - await showMessageMetadataPopup( - text: text ?? "" - ) + f(.dismissWithoutContent) } - - f(.dismissWithoutContent) - } - ) - actions.append(.action(messageMetadataAction)) - } - // + ) + ngContextItems.append(.action(messageMetadataAction)) + } + // + + controller?.setItems(.single(ContextController.Items(content: .list(ngContextItems))), minHeight: nil, animated: true) + }))) // MARK: Nicegram SelectAllMessagesWithAuthor if let authorId = message.author?.id { diff --git a/submodules/TgVoipWebrtc/tgcalls b/submodules/TgVoipWebrtc/tgcalls index 8344f8ca2a0..c879c0f496a 160000 --- a/submodules/TgVoipWebrtc/tgcalls +++ b/submodules/TgVoipWebrtc/tgcalls @@ -1 +1 @@ -Subproject commit 8344f8ca2a043d0812743260c31a086a82190489 +Subproject commit c879c0f496a12e2c79235ff9529c7a745558063b diff --git a/third-party/webrtc/webrtc b/third-party/webrtc/webrtc index c75f2a397ec..731c1599867 160000 --- a/third-party/webrtc/webrtc +++ b/third-party/webrtc/webrtc @@ -1 +1 @@ -Subproject commit c75f2a397ec3c7db12677b39b52d2b3f8ee9161e +Subproject commit 731c15998672bd3b5ebc52975834e17ea63b1efb