Skip to content

Commit

Permalink
1.9.3 (399)
Browse files Browse the repository at this point in the history
  • Loading branch information
denis15yo committed Dec 18, 2024
1 parent 66fbf7d commit 3bcf16b
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 16 deletions.
12 changes: 6 additions & 6 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
"location" : "[email protected]:mobyrix/nicegram-assistant-ios.git",
"state" : {
"branch" : "feat/solana",
"revision" : "9da2d9f9c7e49e13dcf4a54aba4d6d5ea338a2c7"
"revision" : "d5f748efb1f63263de7266c2d6e0778ff833393f"
}
},
{
Expand All @@ -123,7 +123,7 @@
"location" : "[email protected]:mobyrix/nicegram-wallet-ios.git",
"state" : {
"branch" : "feat/solana",
"revision" : "acf8b65ebe8dece0608f8912cd072624de627387"
"revision" : "edd47a758b9c9eafff4106932929934dda9b0e09"
}
},
{
Expand Down Expand Up @@ -339,7 +339,7 @@
"location" : "https://github.com/trustwallet/wallet-core.git",
"state" : {
"branch" : "master",
"revision" : "b73c8841a52b1ad3b23fbb3b396e87e3e6ce4bd9"
"revision" : "7b1bee59813f2d93e15e20c8e331cb0b1fafc51b"
}
},
{
Expand Down
32 changes: 27 additions & 5 deletions submodules/DebugSettingsUI/Sources/DebugController.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// MARK: Nicegram Imports
import NGAppCache
import NGData
import NicegramWallet
//
import Foundation
import UIKit
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -169,6 +171,8 @@ private enum DebugControllerEntry: ItemListNodeEntry {
switch self {
// MARK: Nicegram DebugMenu
case .showOnboarding:
return -4
case .multichainEnabled:
return -3
//
case .sendNGLogs:
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// MARK: Nicegram Imports
import FeatTgUserNotes
import NGData
import NicegramWallet
//
import Foundation
import UIKit
Expand Down Expand Up @@ -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
//
Expand Down Expand Up @@ -442,6 +446,9 @@ final class PeerInfoScreenData {
revenueStatsContext: RevenueStatsContext?,
profileGiftsContext: ProfileGiftsContext?,
premiumGiftOptions: [PremiumGiftCodeOption],
// MARK: Nicegram Wallet
blockchains: [Blockchain] = [],
//
// MARK: Nicegram TgUserNotes
note: String = ""
//
Expand Down Expand Up @@ -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
//
Expand Down Expand Up @@ -983,6 +993,23 @@ func peerInfoScreenSettingsData(context: AccountContext, peerId: EnginePeer.Id,
premiumGiftOptions: []
)
}
// MARK: Nicegram Wallet
|> mapToSignal { peerInfoScreenData -> Signal<PeerInfoScreenData, NoError> 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<ChatLocationContextHolder?>, privacySettings: Signal<AccountPrivacySettings?, NoError>) -> Signal<PeerInfoScreenData, NoError> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit 3bcf16b

Please sign in to comment.