diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 00bcd677107..de1f816ce05 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -633,8 +633,8 @@ "bzlTransitiveDigest": "8/YWyYftd8THfVoADvrOmQLl45wUGfP2MVjLM5FFn50=", "usagesDigest": "voXBMcSNlo2fnK6JIvInIrncYhBKKG8nBeKvToaUA0Y=", "recordedFileInputs": { - "@@//Package.resolved": "58828440f7f4efc2b0076c8769d34b8426c4c3f9bab5905c69faf03c1f6271c0", - "@@//Package.swift": "fb3cb1d48066e64f8bf17fe1a49f689b7a6bf4bfc07aa90b9b80a02188501951" + "@@//Package.resolved": "cbab4c6f919a4d9ea6bd55bbc879f936b936f643b6a3561618087edf67b5456c", + "@@//Package.swift": "e6b78ba262c3206e4307bb4dc146aaf555cb65f25ff03700d7617ff744a4813e" }, "recordedDirentsInputs": {}, "envVariables": {}, @@ -1119,7 +1119,7 @@ "ruleClassName": "swift_package", "attributes": { "bazel_package_name": "swiftpkg_nicegram_assistant_ios", - "commit": "e8d24197d62be4f93ab446a3d93aa0893c849f64", + "commit": "f4f77eb4091f73aaea3aff82167b3e316bf52213", "remote": "git@bitbucket.org:mobyrix/nicegram-assistant-ios.git", "version": "", "init_submodules": false, @@ -1309,9 +1309,9 @@ "ruleClassName": "swift_package", "attributes": { "bazel_package_name": "swiftpkg_wallet_core", - "commit": "99b69d1c2267354270769f6adef2d370553ce436", + "commit": "7b1bee59813f2d93e15e20c8e331cb0b1fafc51b", "remote": "https://github.com/trustwallet/wallet-core.git", - "version": "4.1.21", + "version": "", "init_submodules": false, "recursive_init_submodules": true, "patch_args": [ @@ -1366,7 +1366,7 @@ "ruleClassName": "swift_package", "attributes": { "bazel_package_name": "swiftpkg_nicegram_wallet_ios", - "commit": "06891aea6566814a75a07c9403a80ad091db5a43", + "commit": "edd47a758b9c9eafff4106932929934dda9b0e09", "remote": "git@bitbucket.org:mobyrix/nicegram-wallet-ios.git", "version": "", "init_submodules": false, diff --git a/Package.resolved b/Package.resolved index 22708a08b5b..4a3f9a51bdd 100644 --- a/Package.resolved +++ b/Package.resolved @@ -114,7 +114,7 @@ "location" : "git@bitbucket.org:mobyrix/nicegram-assistant-ios.git", "state" : { "branch" : "feat/solana", - "revision" : "9da2d9f9c7e49e13dcf4a54aba4d6d5ea338a2c7" + "revision" : "d5f748efb1f63263de7266c2d6e0778ff833393f" } }, { @@ -123,7 +123,7 @@ "location" : "git@bitbucket.org:mobyrix/nicegram-wallet-ios.git", "state" : { "branch" : "feat/solana", - "revision" : "acf8b65ebe8dece0608f8912cd072624de627387" + "revision" : "edd47a758b9c9eafff4106932929934dda9b0e09" } }, { @@ -339,7 +339,7 @@ "location" : "https://github.com/trustwallet/wallet-core.git", "state" : { "branch" : "master", - "revision" : "b73c8841a52b1ad3b23fbb3b396e87e3e6ce4bd9" + "revision" : "7b1bee59813f2d93e15e20c8e331cb0b1fafc51b" } }, { diff --git a/submodules/DebugSettingsUI/Sources/DebugController.swift b/submodules/DebugSettingsUI/Sources/DebugController.swift index 4da143df2e8..722f6cb3158 100644 --- a/submodules/DebugSettingsUI/Sources/DebugController.swift +++ b/submodules/DebugSettingsUI/Sources/DebugController.swift @@ -1,6 +1,7 @@ // MARK: Nicegram Imports import NGAppCache import NGData +import NicegramWallet // import Foundation import UIKit @@ -65,6 +66,7 @@ private enum DebugControllerSection: Int32 { private enum DebugControllerEntry: ItemListNodeEntry { // MARK: Nicegram DebugMenu case showOnboarding(Bool) + case multichainEnabled(Bool) // case testStickerImport(PresentationTheme) case sendLogs(PresentationTheme) @@ -135,7 +137,7 @@ private enum DebugControllerEntry: ItemListNodeEntry { var section: ItemListSectionId { switch self { // MARK: Nicegram DebugMenu - case .showOnboarding: + case .showOnboarding, .multichainEnabled: return DebugControllerSection.nicegram.rawValue // case .testStickerImport: @@ -169,6 +171,8 @@ private enum DebugControllerEntry: ItemListNodeEntry { switch self { // MARK: Nicegram DebugMenu case .showOnboarding: + return -4 + case .multichainEnabled: return -3 // case .sendNGLogs: @@ -314,6 +318,13 @@ private enum DebugControllerEntry: ItemListNodeEntry { return ItemListSwitchItem(presentationData: presentationData, title: "Show onboarding", value: value, sectionId: self.section, style: .blocks, updated: { value in AppCache.wasOnboardingShown = !value }) + case let .multichainEnabled(value): + return ItemListSwitchItem(presentationData: presentationData, title: "Enable Multichain Wallet", value: value, sectionId: self.section, style: .blocks, updated: { value in + Task { + let updateUserBlockchainsUseCase = WalletSettingsModule.shared.updateUserBlockchainsUseCase() + await updateUserBlockchainsUseCase.set(multichainEnabled: value) + } + }) // case .testStickerImport: return ItemListActionItem(presentationData: presentationData, title: "Simulate Stickers Import", kind: .generic, alignment: .natural, sectionId: self.section, style: .blocks, action: { @@ -1584,10 +1595,12 @@ private enum DebugControllerEntry: ItemListNodeEntry { } } -private func debugControllerEntries(sharedContext: SharedAccountContext, presentationData: PresentationData, loggingSettings: LoggingSettings, mediaInputSettings: MediaInputSettings, experimentalSettings: ExperimentalUISettings, networkSettings: NetworkSettings?, hasLegacyAppData: Bool, useBetaFeatures: Bool) -> [DebugControllerEntry] { +// MARK: Nicegram Wallet, added multichainEnabled +private func debugControllerEntries(sharedContext: SharedAccountContext, presentationData: PresentationData, loggingSettings: LoggingSettings, mediaInputSettings: MediaInputSettings, experimentalSettings: ExperimentalUISettings, networkSettings: NetworkSettings?, hasLegacyAppData: Bool, useBetaFeatures: Bool, multichainEnabled: Bool) -> [DebugControllerEntry] { var entries: [DebugControllerEntry] = [] // MARK: Nicegram DebugMenu entries.append(.showOnboarding(!AppCache.wasOnboardingShown)) + entries.append(.multichainEnabled(multichainEnabled)) // entries.append(.sendNGLogs(presentationData.theme)) // MARK: Nicegram NCG-5828 call recording @@ -1738,8 +1751,16 @@ public func debugController(sharedContext: SharedAccountContext, context: Accoun preferencesSignal = .single(nil) } - let signal = combineLatest(sharedContext.presentationData, sharedContext.accountManager.sharedData(keys: Set([SharedDataKeys.loggingSettings, ApplicationSpecificSharedDataKeys.mediaInputSettings, ApplicationSpecificSharedDataKeys.experimentalUISettings])), preferencesSignal) - |> map { presentationData, sharedData, preferences -> (ItemListControllerState, (ItemListNodeState, Any)) in + // MARK: Nicegram Wallet + let multichainEnabledSignal = WalletSettingsModule.shared.getUserBlockchainsUseCase() + .multichainEnabledPublisher() + .toSignal() + .skipError() + // + + // MARK: Nicegram Wallet, added multichainEnabled + let signal = combineLatest(sharedContext.presentationData, sharedContext.accountManager.sharedData(keys: Set([SharedDataKeys.loggingSettings, ApplicationSpecificSharedDataKeys.mediaInputSettings, ApplicationSpecificSharedDataKeys.experimentalUISettings])), preferencesSignal, multichainEnabledSignal) + |> map { presentationData, sharedData, preferences, multichainEnabled -> (ItemListControllerState, (ItemListNodeState, Any)) in let loggingSettings: LoggingSettings if let value = sharedData.entries[SharedDataKeys.loggingSettings]?.get(LoggingSettings.self) { loggingSettings = value @@ -1771,7 +1792,8 @@ public func debugController(sharedContext: SharedAccountContext, context: Accoun } let controllerState = ItemListControllerState(presentationData: ItemListPresentationData(presentationData), title: .text("Debug"), leftNavigationButton: leftNavigationButton, rightNavigationButton: nil, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back)) - let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: debugControllerEntries(sharedContext: sharedContext, presentationData: presentationData, loggingSettings: loggingSettings, mediaInputSettings: mediaInputSettings, experimentalSettings: experimentalSettings, networkSettings: networkSettings, hasLegacyAppData: hasLegacyAppData, useBetaFeatures: useBetaFeatures), style: .blocks) + // MARK: Nicegram Wallet, added multichainEnabled + let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: debugControllerEntries(sharedContext: sharedContext, presentationData: presentationData, loggingSettings: loggingSettings, mediaInputSettings: mediaInputSettings, experimentalSettings: experimentalSettings, networkSettings: networkSettings, hasLegacyAppData: hasLegacyAppData, useBetaFeatures: useBetaFeatures, multichainEnabled: multichainEnabled), style: .blocks) return (controllerState, (listState, arguments)) } diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoData.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoData.swift index 3260dcecdbf..9d7dcb0e0fc 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoData.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoData.swift @@ -1,6 +1,7 @@ // MARK: Nicegram Imports import FeatTgUserNotes import NGData +import NicegramWallet // import Foundation import UIKit @@ -390,6 +391,9 @@ final class PeerInfoScreenData { let revenueStatsContext: RevenueStatsContext? let profileGiftsContext: ProfileGiftsContext? let premiumGiftOptions: [PremiumGiftCodeOption] + // MARK: Nicegram Wallet + var blockchains: [Blockchain] + // // MARK: Nicegram TgUserNotes var note: String // @@ -442,6 +446,9 @@ final class PeerInfoScreenData { revenueStatsContext: RevenueStatsContext?, profileGiftsContext: ProfileGiftsContext?, premiumGiftOptions: [PremiumGiftCodeOption], + // MARK: Nicegram Wallet + blockchains: [Blockchain] = [], + // // MARK: Nicegram TgUserNotes note: String = "" // @@ -482,6 +489,9 @@ final class PeerInfoScreenData { self.revenueStatsContext = revenueStatsContext self.profileGiftsContext = profileGiftsContext self.premiumGiftOptions = premiumGiftOptions + // MARK: Nicegram Wallet + self.blockchains = blockchains + // // MARK: Nicegram TgUserNotes self.note = note // @@ -983,6 +993,23 @@ func peerInfoScreenSettingsData(context: AccountContext, peerId: EnginePeer.Id, premiumGiftOptions: [] ) } + // MARK: Nicegram Wallet + |> mapToSignal { peerInfoScreenData -> Signal in + let blockchains = WalletSettingsModule.shared.getAvailableBlockchainsUseCase() + .onlyExactPublisher() + .prepend([]) + .removeDuplicates() + .toSignal() + .skipError() + + return blockchains + |> map { blockchains in + var peerInfoScreenData = peerInfoScreenData + peerInfoScreenData.blockchains = blockchains + return peerInfoScreenData + } + } + // } func peerInfoScreenData(context: AccountContext, peerId: PeerId, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, isSettings: Bool, isMyProfile: Bool, hintGroupInCommon: PeerId?, existingRequestsContext: PeerInvitationImportersContext?, chatLocation: ChatLocation, chatLocationContextHolder: Atomic, privacySettings: Signal) -> Signal { diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift index c49e2c7f6f2..de1dc041f27 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PeerInfoScreen.swift @@ -993,8 +993,20 @@ private func settingsItems(data: PeerInfoScreenData?, context: AccountContext, p // MARK: Nicegram Wallet let getWalletAvailabilityUseCase = WalletContainer.shared.getWalletAvailabilityUseCase() if #available(iOS 15.0, *), getWalletAvailabilityUseCase() { - items[.nicegramWallet]?.append(PeerInfoScreenHeaderItem(id: 0, text: "Multichain, Non-custodial")) - items[.nicegramWallet]!.append(PeerInfoScreenDisclosureItem(id: 1, text: "Nicegram Wallet", icon: PresentationResourcesSettings.ngWalletIcon, action: { + let blockchains = data.blockchains + let sectionTitle: String + let buttonText: String + if blockchains.count == 1 { + let blockchain = blockchains[0] + sectionTitle = "Non-custodial" + buttonText = "\(blockchain.title) Wallet" + } else { + sectionTitle = "Multichain, Non-custodial" + buttonText = "Nicegram Wallet" + } + + items[.nicegramWallet]?.append(PeerInfoScreenHeaderItem(id: 0, text: sectionTitle)) + items[.nicegramWallet]!.append(PeerInfoScreenDisclosureItem(id: 1, text: buttonText, icon: PresentationResourcesSettings.ngWalletIcon, action: { Task { @MainActor in WalletEntryPoints.openHome() }