From 94c105100ca025fb893dce0221a8bae31d095545 Mon Sep 17 00:00:00 2001 From: Andrei Ashikhmin Date: Mon, 14 Oct 2024 16:34:01 +0700 Subject: [PATCH 1/6] chore: migrating some DashPay VCs to Swift --- DashSyncCurrentCommit | 2 +- DashWallet.xcodeproj/project.pbxproj | 58 ++++++------- DashWallet/AppDelegate.m | 2 + .../Welcome/DWDPWelcomeViewController.h | 38 --------- .../Welcome/DWDPWelcomeViewController.m | 73 ----------------- .../Welcome/DWInvitationFlowViewController.h | 38 --------- .../Welcome/DWInvitationFlowViewController.m | 82 ------------------- .../GetStarted/DWGetStartedViewController.h | 41 ---------- .../GetStarted/DWGetStartedViewController.m | 68 --------------- .../GetStarted/GetStartedViewController.swift | 66 +++++++++++++++ .../InvitationFlowViewController.swift | 74 +++++++++++++++++ .../Welcome/WelcomeViewController.swift | 63 ++++++++++++++ DashWallet/dashwallet-Bridging-Header.h | 3 + Podfile.lock | 4 +- 14 files changed, 237 insertions(+), 375 deletions(-) delete mode 100644 DashWallet/Sources/UI/DashPay/Welcome/DWDPWelcomeViewController.h delete mode 100644 DashWallet/Sources/UI/DashPay/Welcome/DWDPWelcomeViewController.m delete mode 100644 DashWallet/Sources/UI/DashPay/Welcome/DWInvitationFlowViewController.h delete mode 100644 DashWallet/Sources/UI/DashPay/Welcome/DWInvitationFlowViewController.m delete mode 100644 DashWallet/Sources/UI/DashPay/Welcome/GetStarted/DWGetStartedViewController.h delete mode 100644 DashWallet/Sources/UI/DashPay/Welcome/GetStarted/DWGetStartedViewController.m create mode 100644 DashWallet/Sources/UI/DashPay/Welcome/GetStarted/GetStartedViewController.swift create mode 100644 DashWallet/Sources/UI/DashPay/Welcome/InvitationFlowViewController.swift create mode 100644 DashWallet/Sources/UI/DashPay/Welcome/WelcomeViewController.swift diff --git a/DashSyncCurrentCommit b/DashSyncCurrentCommit index 64bf52c50..329141158 100644 --- a/DashSyncCurrentCommit +++ b/DashSyncCurrentCommit @@ -1 +1 @@ -03698d4a7b17cda10bfbbd104fd7557fddf13b76 +5527d76881a78c324e8bb64036ab99e3bf9792a9 diff --git a/DashWallet.xcodeproj/project.pbxproj b/DashWallet.xcodeproj/project.pbxproj index a4e9dac00..0d9409ebb 100644 --- a/DashWallet.xcodeproj/project.pbxproj +++ b/DashWallet.xcodeproj/project.pbxproj @@ -554,6 +554,9 @@ 753130922B47EE920069C9B7 /* UpholdCapability.swift in Sources */ = {isa = PBXBuildFile; fileRef = 753130902B47EE920069C9B7 /* UpholdCapability.swift */; }; 753130972B4944130069C9B7 /* UpholdError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 753130962B4944130069C9B7 /* UpholdError.swift */; }; 753130982B4944130069C9B7 /* UpholdError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 753130962B4944130069C9B7 /* UpholdError.swift */; }; + 753261AE2CBC1040003CDE00 /* InvitationFlowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 753261AD2CBC1040003CDE00 /* InvitationFlowViewController.swift */; }; + 753261B02CBC11BF003CDE00 /* WelcomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 753261AF2CBC11BF003CDE00 /* WelcomeViewController.swift */; }; + 753261B22CBC157F003CDE00 /* GetStartedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 753261B12CBC157F003CDE00 /* GetStartedViewController.swift */; }; 753FD7E22CA44BDD00B7751F /* CoinJoinProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = 753FD7E12CA44BDD00B7751F /* CoinJoinProgress.swift */; }; 753FD7E32CA44BDD00B7751F /* CoinJoinProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = 753FD7E12CA44BDD00B7751F /* CoinJoinProgress.swift */; }; 753FDBEA2AEA422F0005EEC3 /* VotingPrefs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 753FDBE92AEA422F0005EEC3 /* VotingPrefs.swift */; }; @@ -798,11 +801,8 @@ C943B4C72A40A54600AF23C5 /* DWUserSearchResultViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C943B39A2A40A54600AF23C5 /* DWUserSearchResultViewController.m */; }; C943B4C82A40A54600AF23C5 /* DWSearchStateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C943B39B2A40A54600AF23C5 /* DWSearchStateViewController.m */; }; C943B4DB2A40A54600AF23C5 /* DWDPWelcomeCollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C943B3CA2A40A54600AF23C5 /* DWDPWelcomeCollectionViewController.m */; }; - C943B4DC2A40A54600AF23C5 /* DWInvitationFlowViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C943B3CB2A40A54600AF23C5 /* DWInvitationFlowViewController.m */; }; - C943B4DD2A40A54600AF23C5 /* DWDPWelcomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C943B3CC2A40A54600AF23C5 /* DWDPWelcomeViewController.m */; }; C943B4DE2A40A54600AF23C5 /* DWDPWelcomePageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C943B3CD2A40A54600AF23C5 /* DWDPWelcomePageViewController.m */; }; C943B4DF2A40A54600AF23C5 /* DWGetStartedContentViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C943B3CF2A40A54600AF23C5 /* DWGetStartedContentViewController.m */; }; - C943B4E02A40A54600AF23C5 /* DWGetStartedViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C943B3D12A40A54600AF23C5 /* DWGetStartedViewController.m */; }; C943B4E12A40A54600AF23C5 /* DWGetStartedItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = C943B3D62A40A54600AF23C5 /* DWGetStartedItemView.m */; }; C943B4E22A40A54600AF23C5 /* DWPassthroughView.m in Sources */ = {isa = PBXBuildFile; fileRef = C943B3DD2A40A54600AF23C5 /* DWPassthroughView.m */; }; C943B4E32A40A54600AF23C5 /* DWPassthroughStackView.m in Sources */ = {isa = PBXBuildFile; fileRef = C943B3DE2A40A54600AF23C5 /* DWPassthroughStackView.m */; }; @@ -2439,6 +2439,9 @@ 7531308C2B47EC910069C9B7 /* UpholdClient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpholdClient.swift; sourceTree = ""; }; 753130902B47EE920069C9B7 /* UpholdCapability.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpholdCapability.swift; sourceTree = ""; }; 753130962B4944130069C9B7 /* UpholdError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpholdError.swift; sourceTree = ""; }; + 753261AD2CBC1040003CDE00 /* InvitationFlowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InvitationFlowViewController.swift; sourceTree = ""; }; + 753261AF2CBC11BF003CDE00 /* WelcomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeViewController.swift; sourceTree = ""; }; + 753261B12CBC157F003CDE00 /* GetStartedViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetStartedViewController.swift; sourceTree = ""; }; 753FD7E12CA44BDD00B7751F /* CoinJoinProgress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoinJoinProgress.swift; sourceTree = ""; }; 753FDBE92AEA422F0005EEC3 /* VotingPrefs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VotingPrefs.swift; sourceTree = ""; }; 753FDBEB2AECF4CC0005EEC3 /* VotingHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = VotingHeaderView.xib; sourceTree = ""; }; @@ -2743,20 +2746,14 @@ C943B39B2A40A54600AF23C5 /* DWSearchStateViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWSearchStateViewController.m; sourceTree = ""; }; C943B3C82A40A54600AF23C5 /* DWDashPayConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWDashPayConstants.h; sourceTree = ""; }; C943B3CA2A40A54600AF23C5 /* DWDPWelcomeCollectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWDPWelcomeCollectionViewController.m; sourceTree = ""; }; - C943B3CB2A40A54600AF23C5 /* DWInvitationFlowViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWInvitationFlowViewController.m; sourceTree = ""; }; - C943B3CC2A40A54600AF23C5 /* DWDPWelcomeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWDPWelcomeViewController.m; sourceTree = ""; }; C943B3CD2A40A54600AF23C5 /* DWDPWelcomePageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWDPWelcomePageViewController.m; sourceTree = ""; }; C943B3CF2A40A54600AF23C5 /* DWGetStartedContentViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWGetStartedContentViewController.m; sourceTree = ""; }; C943B3D02A40A54600AF23C5 /* DWGetStarted.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWGetStarted.h; sourceTree = ""; }; - C943B3D12A40A54600AF23C5 /* DWGetStartedViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWGetStartedViewController.m; sourceTree = ""; }; C943B3D22A40A54600AF23C5 /* DWGetStartedContentViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWGetStartedContentViewController.h; sourceTree = ""; }; - C943B3D32A40A54600AF23C5 /* DWGetStartedViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWGetStartedViewController.h; sourceTree = ""; }; C943B3D52A40A54600AF23C5 /* DWGetStartedItemView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWGetStartedItemView.h; sourceTree = ""; }; C943B3D62A40A54600AF23C5 /* DWGetStartedItemView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWGetStartedItemView.m; sourceTree = ""; }; C943B3D72A40A54600AF23C5 /* DWDPWelcomeCollectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWDPWelcomeCollectionViewController.h; sourceTree = ""; }; - C943B3D82A40A54600AF23C5 /* DWInvitationFlowViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWInvitationFlowViewController.h; sourceTree = ""; }; C943B3D92A40A54600AF23C5 /* DWDPWelcomePageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWDPWelcomePageViewController.h; sourceTree = ""; }; - C943B3DA2A40A54600AF23C5 /* DWDPWelcomeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWDPWelcomeViewController.h; sourceTree = ""; }; C943B3DC2A40A54600AF23C5 /* DWPassthroughStackView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWPassthroughStackView.h; sourceTree = ""; }; C943B3DD2A40A54600AF23C5 /* DWPassthroughView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWPassthroughView.m; sourceTree = ""; }; C943B3DE2A40A54600AF23C5 /* DWPassthroughStackView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWPassthroughStackView.m; sourceTree = ""; }; @@ -6794,16 +6791,14 @@ C943B3C92A40A54600AF23C5 /* Welcome */ = { isa = PBXGroup; children = ( + C943B3CE2A40A54600AF23C5 /* GetStarted */, + C943B3DB2A40A54600AF23C5 /* Views */, C943B3CA2A40A54600AF23C5 /* DWDPWelcomeCollectionViewController.m */, - C943B3CB2A40A54600AF23C5 /* DWInvitationFlowViewController.m */, - C943B3CC2A40A54600AF23C5 /* DWDPWelcomeViewController.m */, C943B3CD2A40A54600AF23C5 /* DWDPWelcomePageViewController.m */, - C943B3CE2A40A54600AF23C5 /* GetStarted */, C943B3D72A40A54600AF23C5 /* DWDPWelcomeCollectionViewController.h */, - C943B3D82A40A54600AF23C5 /* DWInvitationFlowViewController.h */, C943B3D92A40A54600AF23C5 /* DWDPWelcomePageViewController.h */, - C943B3DA2A40A54600AF23C5 /* DWDPWelcomeViewController.h */, - C943B3DB2A40A54600AF23C5 /* Views */, + 753261AD2CBC1040003CDE00 /* InvitationFlowViewController.swift */, + 753261AF2CBC11BF003CDE00 /* WelcomeViewController.swift */, ); path = Welcome; sourceTree = ""; @@ -6811,11 +6806,10 @@ C943B3CE2A40A54600AF23C5 /* GetStarted */ = { isa = PBXGroup; children = ( + 753261B12CBC157F003CDE00 /* GetStartedViewController.swift */, C943B3CF2A40A54600AF23C5 /* DWGetStartedContentViewController.m */, C943B3D02A40A54600AF23C5 /* DWGetStarted.h */, - C943B3D12A40A54600AF23C5 /* DWGetStartedViewController.m */, C943B3D22A40A54600AF23C5 /* DWGetStartedContentViewController.h */, - C943B3D32A40A54600AF23C5 /* DWGetStartedViewController.h */, C943B3D42A40A54600AF23C5 /* Views */, ); path = GetStarted; @@ -9096,6 +9090,7 @@ C9D2C6A72A320AA000D15901 /* CrowdNodeResponse.swift in Sources */, C9D2C6A82A320AA000D15901 /* FileManager+DashWallet.swift in Sources */, C9D2C6A92A320AA000D15901 /* PointOfUseItemCell.swift in Sources */, + 753261B22CBC157F003CDE00 /* GetStartedViewController.swift in Sources */, C956AF142A5B5949002FAB75 /* EnterAddressViewController.swift in Sources */, C9D2C6AA2A320AA000D15901 /* DSTransaction+DashWallet.swift in Sources */, C943B4C52A40A54600AF23C5 /* DWUserSearchModel.m in Sources */, @@ -9370,6 +9365,7 @@ C943B4C82A40A54600AF23C5 /* DWSearchStateViewController.m in Sources */, C9D2C76B2A320AA000D15901 /* BaseViewController.swift in Sources */, C9D2C76C2A320AA000D15901 /* AccountListController.swift in Sources */, + 753261B02CBC11BF003CDE00 /* WelcomeViewController.swift in Sources */, C9D2C76D2A320AA000D15901 /* DWUpholdTransactionObject.m in Sources */, C943B5052A40A54600AF23C5 /* DWDPIncomingRequestCell.m in Sources */, C9D2C76E2A320AA000D15901 /* DWBaseSeedViewController.m in Sources */, @@ -9576,7 +9572,6 @@ C9D2C8122A320AA000D15901 /* SeedDB.swift in Sources */, C9D2C8132A320AA000D15901 /* DWPinField.m in Sources */, C943B3252A408CED00AF23C5 /* DWEditProfileViewController.m in Sources */, - C943B4DC2A40A54600AF23C5 /* DWInvitationFlowViewController.m in Sources */, C943B59C2A40EE5300AF23C5 /* DWNetworkErrorViewController.m in Sources */, C9D2C8142A320AA000D15901 /* DWCenteredScrollView.m in Sources */, C9D2C8162A320AA000D15901 /* DWPhraseRepairViewController.m in Sources */, @@ -9661,7 +9656,6 @@ C9D2C8502A320AA000D15901 /* DWEnvironment.m in Sources */, C9D2C8512A320AA000D15901 /* AtmItemCell.swift in Sources */, C9D2C8522A320AA000D15901 /* CoinbaseService.swift in Sources */, - C943B4E02A40A54600AF23C5 /* DWGetStartedViewController.m in Sources */, C9D2C8532A320AA000D15901 /* DWControllerCollectionView.m in Sources */, C9D2C8542A320AA000D15901 /* SFSafariViewController+DashWallet.m in Sources */, C943B4F82A40A54600AF23C5 /* DWDPPendingRequestObject.m in Sources */, @@ -9843,10 +9837,10 @@ 7573C2E32B01105F00F4C347 /* MasternodeIPCell.swift in Sources */, C9D2C8EA2A320AA000D15901 /* ConvertCryptoOrderPreviewViews.swift in Sources */, C9D2C8EB2A320AA000D15901 /* DWAboutModel.m in Sources */, + 753261AE2CBC1040003CDE00 /* InvitationFlowViewController.swift in Sources */, C943B4B52A40A54600AF23C5 /* DWContactsFetchedDataSource.m in Sources */, C9D2C8EE2A320AA000D15901 /* WelcomeToCrowdNodeViewController.swift in Sources */, C943B3282A408CED00AF23C5 /* DWAvatarEditSelectorContentView.m in Sources */, - C943B4DD2A40A54600AF23C5 /* DWDPWelcomeViewController.m in Sources */, C9D2C8EF2A320AA000D15901 /* TerritoriesListCell.swift in Sources */, 7573C2E52B01120B00F4C347 /* MasternodeKey.swift in Sources */, C9D2C8F02A320AA000D15901 /* DWProgressView.m in Sources */, @@ -10261,7 +10255,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = dashwallet/dashwallet.entitlements; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = ""; @@ -10392,7 +10386,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = dashwallet/dashwallet.entitlements; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -10599,7 +10593,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; IBSC_MODULE = WatchApp_Extension; @@ -10621,7 +10615,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; IBSC_MODULE = WatchApp_Extension; @@ -10641,7 +10635,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = C98AA93FF5283EC6405BCE4B /* Pods-WatchApp Extension.debug.xcconfig */; buildSettings = { - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = 44RJ69WHFF; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = ""; @@ -10668,7 +10662,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = CE02413EF0C60B1D1EDE6457 /* Pods-WatchApp Extension.release.xcconfig */; buildSettings = { - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = 44RJ69WHFF; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = ""; @@ -11380,7 +11374,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = dashwallet/dashwallet.entitlements; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -11582,7 +11576,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; IBSC_MODULE = WatchApp_Extension; @@ -11602,7 +11596,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 556B5EBEBAEA571D74FF69A3 /* Pods-WatchApp Extension.testflight.xcconfig */; buildSettings = { - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = 44RJ69WHFF; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = ""; @@ -11701,7 +11695,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = dashwallet/dashwallet.entitlements; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -11891,7 +11885,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; IBSC_MODULE = WatchApp_Extension; @@ -11911,7 +11905,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 29B232FD70BA2EDF87F86A56 /* Pods-WatchApp Extension.testnet.xcconfig */; buildSettings = { - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 4; DEVELOPMENT_TEAM = 44RJ69WHFF; ENABLE_BITCODE = NO; EXCLUDED_ARCHS = ""; diff --git a/DashWallet/AppDelegate.m b/DashWallet/AppDelegate.m index f923db737..227da0076 100644 --- a/DashWallet/AppDelegate.m +++ b/DashWallet/AppDelegate.m @@ -104,6 +104,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( [CurrencyExchangerObjcWrapper startExchangeRateFetching]; [CoinbaseObjcWrapper start]; [CrowdNodeObjcWrapper start]; + + setenv("RUST_BACKTRACE", "1", 1); [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dsApplicationTerminationRequestNotification:) diff --git a/DashWallet/Sources/UI/DashPay/Welcome/DWDPWelcomeViewController.h b/DashWallet/Sources/UI/DashPay/Welcome/DWDPWelcomeViewController.h deleted file mode 100644 index 417335e98..000000000 --- a/DashWallet/Sources/UI/DashPay/Welcome/DWDPWelcomeViewController.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// Created by Andrew Podkovyrin -// Copyright © 2021 Dash Core Group. All rights reserved. -// -// Licensed under the MIT License (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://opensource.org/licenses/MIT -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import "DWBaseActionButtonViewController.h" - -#import "dashwallet-Swift.h" - -NS_ASSUME_NONNULL_BEGIN - -@class DWDPWelcomeViewController; - -@protocol DWDPWelcomeViewControllerDelegate - -- (void)welcomeViewControllerDidFinish:(DWDPWelcomeViewController *)controller; - -@end - -@interface DWDPWelcomeViewController : DWBaseActionButtonViewController - -@property (nullable, nonatomic, weak) id delegate; - -@end - -NS_ASSUME_NONNULL_END diff --git a/DashWallet/Sources/UI/DashPay/Welcome/DWDPWelcomeViewController.m b/DashWallet/Sources/UI/DashPay/Welcome/DWDPWelcomeViewController.m deleted file mode 100644 index 7ca8f3f94..000000000 --- a/DashWallet/Sources/UI/DashPay/Welcome/DWDPWelcomeViewController.m +++ /dev/null @@ -1,73 +0,0 @@ -// -// Created by Andrew Podkovyrin -// Copyright © 2021 Dash Core Group. All rights reserved. -// -// Licensed under the MIT License (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://opensource.org/licenses/MIT -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import "DWDPWelcomeViewController.h" - -#import "DWDPWelcomeCollectionViewController.h" -#import "DWUIKit.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface DWDPWelcomeViewController () - -@property (nonatomic, strong) DWDPWelcomeCollectionViewController *collection; - -@end - -NS_ASSUME_NONNULL_END - -@implementation DWDPWelcomeViewController - -+ (BOOL)isActionButtonInNavigationBar { - return NO; -} - -- (NSString *)actionButtonTitle { - return NSLocalizedString(@"Continue", nil); -} - -- (void)viewDidLoad { - [super viewDidLoad]; - - self.actionButton.enabled = YES; - self.view.backgroundColor = [UIColor dw_backgroundColor]; - - UIView *contentView = [[UIView alloc] init]; - contentView.translatesAutoresizingMaskIntoConstraints = NO; - [self setupContentView:contentView]; - - DWDPWelcomeCollectionViewController *collection = [[DWDPWelcomeCollectionViewController alloc] init]; - [self dw_embedChild:collection inContainer:contentView]; - self.collection = collection; -} - -- (void)actionButtonAction:(id)sender { - if ([self.collection canSwitchToNext]) { - [self.collection switchToNext]; - } - else { - [self.delegate welcomeViewControllerDidFinish:self]; - } -} - -#pragma mark - DWNavigationFullscreenable - -- (BOOL)requiresNoNavigationBar { - return YES; -} - -@end diff --git a/DashWallet/Sources/UI/DashPay/Welcome/DWInvitationFlowViewController.h b/DashWallet/Sources/UI/DashPay/Welcome/DWInvitationFlowViewController.h deleted file mode 100644 index 3be168517..000000000 --- a/DashWallet/Sources/UI/DashPay/Welcome/DWInvitationFlowViewController.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// Created by Andrew Podkovyrin -// Copyright © 2021 Dash Core Group. All rights reserved. -// -// Licensed under the MIT License (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://opensource.org/licenses/MIT -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import - -#import "dashwallet-Swift.h" - -NS_ASSUME_NONNULL_BEGIN - -@class DWInvitationFlowViewController; - -@protocol DWInvitationFlowViewControllerDelegate - -- (void)invitationFlowViewControllerDidFinish:(DWInvitationFlowViewController *)controller; - -@end - -@interface DWInvitationFlowViewController : UIViewController - -@property (nullable, nonatomic, weak) id delegate; - -@end - -NS_ASSUME_NONNULL_END diff --git a/DashWallet/Sources/UI/DashPay/Welcome/DWInvitationFlowViewController.m b/DashWallet/Sources/UI/DashPay/Welcome/DWInvitationFlowViewController.m deleted file mode 100644 index d0d37feb0..000000000 --- a/DashWallet/Sources/UI/DashPay/Welcome/DWInvitationFlowViewController.m +++ /dev/null @@ -1,82 +0,0 @@ -// -// Created by Andrew Podkovyrin -// Copyright © 2021 Dash Core Group. All rights reserved. -// -// Licensed under the MIT License (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://opensource.org/licenses/MIT -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import "DWInvitationFlowViewController.h" - -#import "DWDPWelcomeViewController.h" -#import "DWGetStartedViewController.h" -#import "DWUIKit.h" -#import "dashwallet-Swift.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface DWInvitationFlowViewController () - -@property (nonatomic, strong) DWNavigationController *navController; - -@end - -NS_ASSUME_NONNULL_END - -@implementation DWInvitationFlowViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - - self.view.backgroundColor = [UIColor dw_backgroundColor]; - - DWDPWelcomeViewController *welcomeController = [[DWDPWelcomeViewController alloc] init]; - welcomeController.delegate = self; - DWNavigationController *navController = [[DWNavigationController alloc] initWithRootViewController:welcomeController]; - [self dw_embedChild:navController]; - self.navController = navController; -} - -#pragma mark - DWNavigationFullscreenable - -- (BOOL)requiresNoNavigationBar { - return YES; -} - -#pragma mark - DWDPWelcomeViewControllerDelegate - -- (void)welcomeViewControllerDidFinish:(DWDPWelcomeViewController *)controller { - DWGetStartedViewController *getStarted = [[DWGetStartedViewController alloc] initWithPage:DWGetStartedPage_1]; - getStarted.delegate = self; - [self.navController setViewControllers:@[ getStarted ] animated:YES]; -} - -#pragma mark - DWGetStartedViewControllerDelegate - -- (void)getStartedViewControllerDidContinue:(DWGetStartedViewController *)controller { - if (controller.page == DWGetStartedPage_1) { - DWGetStartedViewController *getStarted = [[DWGetStartedViewController alloc] initWithPage:DWGetStartedPage_2]; - getStarted.delegate = self; - [self.navController setViewControllers:@[ getStarted ] animated:YES]; - } - else if (controller.page == DWGetStartedPage_2) { - DWGetStartedViewController *getStarted = [[DWGetStartedViewController alloc] initWithPage:DWGetStartedPage_3]; - getStarted.delegate = self; - [self.navController setViewControllers:@[ getStarted ] animated:YES]; - } - else { - [self.delegate invitationFlowViewControllerDidFinish:self]; - } -} - -@end diff --git a/DashWallet/Sources/UI/DashPay/Welcome/GetStarted/DWGetStartedViewController.h b/DashWallet/Sources/UI/DashPay/Welcome/GetStarted/DWGetStartedViewController.h deleted file mode 100644 index de60e7e17..000000000 --- a/DashWallet/Sources/UI/DashPay/Welcome/GetStarted/DWGetStartedViewController.h +++ /dev/null @@ -1,41 +0,0 @@ -// -// Created by Andrew Podkovyrin -// Copyright © 2021 Dash Core Group. All rights reserved. -// -// Licensed under the MIT License (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://opensource.org/licenses/MIT -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import "DWBaseActionButtonViewController.h" -#import "DWGetStarted.h" -#import "dashwallet-Swift.h" - -NS_ASSUME_NONNULL_BEGIN - -@class DWGetStartedViewController; - -@protocol DWGetStartedViewControllerDelegate - -- (void)getStartedViewControllerDidContinue:(DWGetStartedViewController *)controller; - -@end - -@interface DWGetStartedViewController : DWBaseActionButtonViewController - -@property (readonly, nonatomic, assign) DWGetStartedPage page; -@property (nullable, nonatomic, weak) id delegate; - -- (instancetype)initWithPage:(DWGetStartedPage)page; - -@end - -NS_ASSUME_NONNULL_END diff --git a/DashWallet/Sources/UI/DashPay/Welcome/GetStarted/DWGetStartedViewController.m b/DashWallet/Sources/UI/DashPay/Welcome/GetStarted/DWGetStartedViewController.m deleted file mode 100644 index 583fd64e1..000000000 --- a/DashWallet/Sources/UI/DashPay/Welcome/GetStarted/DWGetStartedViewController.m +++ /dev/null @@ -1,68 +0,0 @@ -// -// Created by Andrew Podkovyrin -// Copyright © 2021 Dash Core Group. All rights reserved. -// -// Licensed under the MIT License (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://opensource.org/licenses/MIT -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import "DWGetStartedViewController.h" - -#import "DWGetStartedContentViewController.h" -#import "DWUIKit.h" - -@interface DWGetStartedViewController () - -@end - -@implementation DWGetStartedViewController - -+ (BOOL)isActionButtonInNavigationBar { - return NO; -} - -- (NSString *)actionButtonTitle { - return NSLocalizedString(@"Continue", nil); -} - -- (BOOL)requiresNoNavigationBar { - return YES; -} - -- (instancetype)initWithPage:(DWGetStartedPage)page { - self = [super initWithNibName:nil bundle:nil]; - if (self) { - _page = page; - } - return self; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - - self.actionButton.enabled = YES; - self.view.backgroundColor = [UIColor dw_secondaryBackgroundColor]; - - UIView *contentView = [[UIView alloc] init]; - contentView.translatesAutoresizingMaskIntoConstraints = NO; - [self setupContentView:contentView]; - - DWGetStartedContentViewController *content = [[DWGetStartedContentViewController alloc] initWithPage:self.page]; - [self dw_embedChild:content inContainer:contentView]; -} - -- (void)actionButtonAction:(id)sender { - [self.delegate getStartedViewControllerDidContinue:self]; -} - - -@end diff --git a/DashWallet/Sources/UI/DashPay/Welcome/GetStarted/GetStartedViewController.swift b/DashWallet/Sources/UI/DashPay/Welcome/GetStarted/GetStartedViewController.swift new file mode 100644 index 000000000..a5e3a2d95 --- /dev/null +++ b/DashWallet/Sources/UI/DashPay/Welcome/GetStarted/GetStartedViewController.swift @@ -0,0 +1,66 @@ +// +// Created by Andrew Podkovyrin +// Copyright © 2021 Dash Core Group. All rights reserved. +// +// Licensed under the MIT License (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import UIKit + +protocol GetStartedViewControllerDelegate: AnyObject { + func getStartedViewControllerDidContinue(_ controller: GetStartedViewController) +} + +class GetStartedViewController: ActionButtonViewController, NavigationFullscreenable { + let page: DWGetStartedPage + weak var delegate: GetStartedViewControllerDelegate? + + init(page: DWGetStartedPage) { + self.page = page + super.init(nibName: nil, bundle: nil) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override var isActionButtonInNavigationBar: Bool { + return false + } + + override var actionButtonTitle: String { + return NSLocalizedString("Continue", comment: "") + } + + var requiresNoNavigationBar: Bool { + return true + } + + override func viewDidLoad() { + super.viewDidLoad() + + actionButton?.isEnabled = true + view.backgroundColor = UIColor.dw_secondaryBackground() + + let contentView = UIView() + contentView.translatesAutoresizingMaskIntoConstraints = false + setupContentView(contentView) + + let content = DWGetStartedContentViewController(page: page) + dw_embedChild(content, inContainer: contentView) + } + + override func actionButtonAction(sender: UIView) { + delegate?.getStartedViewControllerDidContinue(self) + } +} diff --git a/DashWallet/Sources/UI/DashPay/Welcome/InvitationFlowViewController.swift b/DashWallet/Sources/UI/DashPay/Welcome/InvitationFlowViewController.swift new file mode 100644 index 000000000..6ac02adfb --- /dev/null +++ b/DashWallet/Sources/UI/DashPay/Welcome/InvitationFlowViewController.swift @@ -0,0 +1,74 @@ +// +// Created by Andrew Podkovyrin +// Copyright © 2021 Dash Core Group. All rights reserved. +// +// Licensed under the MIT License (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import UIKit + +protocol InvitationFlowViewControllerDelegate: AnyObject { + func invitationFlowViewControllerDidFinish(_ controller: InvitationFlowViewController) +} + +class InvitationFlowViewController: UIViewController, NavigationFullscreenable { + weak var delegate: InvitationFlowViewControllerDelegate? + private var navController: BaseNavigationController! + + override func viewDidLoad() { + super.viewDidLoad() + + view.backgroundColor = UIColor.dw_background() + let welcomeController = WelcomeViewController() + welcomeController.delegate = self + navController = BaseNavigationController(rootViewController: welcomeController) + dw_embedChild(navController) + } + + // MARK: - DWNavigationFullscreenable + + var requiresNoNavigationBar: Bool { + return true + } +} + +// MARK: - WelcomeViewControllerDelegate + +extension InvitationFlowViewController: WelcomeViewControllerDelegate { + func welcomeViewControllerDidFinish(_ controller: WelcomeViewController) { + let getStarted = GetStartedViewController(page: ._1) + getStarted.delegate = self + navController.setViewControllers([getStarted], animated: true) + } +} + +// MARK: - GetStartedViewControllerDelegate + +extension InvitationFlowViewController: GetStartedViewControllerDelegate { + func getStartedViewControllerDidContinue(_ controller: GetStartedViewController) { + switch controller.page { + case ._1: + let getStarted = GetStartedViewController(page: ._2) + getStarted.delegate = self + navController.setViewControllers([getStarted], animated: true) + case ._2: + let getStarted = GetStartedViewController(page: ._3) + getStarted.delegate = self + navController.setViewControllers([getStarted], animated: true) + case ._3: + delegate?.invitationFlowViewControllerDidFinish(self) + @unknown default: + break + } + } +} diff --git a/DashWallet/Sources/UI/DashPay/Welcome/WelcomeViewController.swift b/DashWallet/Sources/UI/DashPay/Welcome/WelcomeViewController.swift new file mode 100644 index 000000000..ef08ec75a --- /dev/null +++ b/DashWallet/Sources/UI/DashPay/Welcome/WelcomeViewController.swift @@ -0,0 +1,63 @@ +// +// Created by Andrew Podkovyrin +// Copyright © 2021 Dash Core Group. All rights reserved. +// +// Licensed under the MIT License (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import UIKit + +protocol WelcomeViewControllerDelegate: AnyObject { + func welcomeViewControllerDidFinish(_ controller: WelcomeViewController) +} + +class WelcomeViewController: ActionButtonViewController, NavigationFullscreenable { + weak var delegate: WelcomeViewControllerDelegate? + private var collection: DWDPWelcomeCollectionViewController! + + override var isActionButtonInNavigationBar: Bool { + return false + } + + override var actionButtonTitle: String { + return NSLocalizedString("Continue", comment: "") + } + + override func viewDidLoad() { + super.viewDidLoad() + + actionButton?.isEnabled = true + view.backgroundColor = UIColor.dw_background() + + let contentView = UIView() + contentView.translatesAutoresizingMaskIntoConstraints = false + setupContentView(contentView) + + collection = DWDPWelcomeCollectionViewController() + dw_embedChild(collection, inContainer: contentView) + } + + override func actionButtonAction(sender: UIView) { + if collection.canSwitchToNext() { + collection.switchToNext() + } else { + delegate?.welcomeViewControllerDidFinish(self) + } + } + + // MARK: - NavigationFullscreenable + + var requiresNoNavigationBar: Bool { + return true + } +} diff --git a/DashWallet/dashwallet-Bridging-Header.h b/DashWallet/dashwallet-Bridging-Header.h index 60966195a..6f317d1aa 100644 --- a/DashWallet/dashwallet-Bridging-Header.h +++ b/DashWallet/dashwallet-Bridging-Header.h @@ -132,6 +132,9 @@ static const bool _SNAPSHOT = 0; #import "DWEditProfileViewController.h" #import "DWSaveAlertViewController.h" #import "DWMainMenuContentView.h" +#import "DWDPWelcomeCollectionViewController.h" +#import "DWGetStarted.h" +#import "DWGetStartedContentViewController.h" #endif //MARK: CrowdNode diff --git a/Podfile.lock b/Podfile.lock index e4d7ba00e..800f78702 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -591,7 +591,7 @@ PODS: - "!ProtoCompiler-gRPCPlugin (~> 1.0)" - DAPI-GRPC/Messages - gRPC-ProtoRPC - - DashSharedCore (0.4.16) + - DashSharedCore (0.4.17) - DashSync (0.1.0): - CocoaLumberjack (= 3.7.2) - DAPI-GRPC (= 0.22.0-dev.8) @@ -832,7 +832,7 @@ SPEC CHECKSUMS: CocoaImageHashing: 8656031d0899abe6c1c415827de43e9798189c53 CocoaLumberjack: b7e05132ff94f6ae4dfa9d5bce9141893a21d9da DAPI-GRPC: 138d62523bbfe7e88a39896f1053c0bc12390d9f - DashSharedCore: 81d3327cbea4103114b768eed4d36e742417b63b + DashSharedCore: ae839c5f91a4e581a27090898f52ac512e0fee0c DashSync: 2438dbf626f13a8633ccc19c718c1c223c8ee831 DSDynamicOptions: 347cc5d2c4e080eb3de6a86719ad3d861b82adfc DWAlertController: 5f4cd8adf90336331c054857f709f5f8d4b16a5b From 2c47130a97c433ce0080f1acfa02b6a1b4c7cf33 Mon Sep 17 00:00:00 2001 From: Andrei Ashikhmin Date: Tue, 15 Oct 2024 19:54:00 +0700 Subject: [PATCH 2/6] feat: mixing warning on home screen --- .../Home/Views/DPWelcomeView.swift | 105 ----------------- DashWallet.xcodeproj/project.pbxproj | 8 +- .../Models/CoinJoin/CoinJoinService.swift | 10 ++ .../CoinJoinLevelsViewController.swift | 37 +++++- .../UI/DashPay/Welcome/JoinDashPayView.swift | 52 +++++++++ .../Home/HomeViewController+Shortcuts.swift | 4 +- .../Sources/UI/Home/HomeViewController.swift | 10 +- .../Home Header View/HomeHeaderView.swift | 12 +- .../Sources/UI/Home/Views/HomeView.swift | 106 +++++++++++++++++- .../Sources/UI/Home/Views/HomeViewModel.swift | 15 +-- .../Menu/Main/Views/DWMainMenuContentView.m | 2 + .../UI/SwiftUI Components/BottomSheet.swift | 2 +- .../UI/SwiftUI Components/ButtonsGroup.swift | 5 +- .../SwiftUI Components/FeatureTopText.swift | 20 +++- 14 files changed, 238 insertions(+), 150 deletions(-) delete mode 100644 DashPay/Presentation/Home/Views/DPWelcomeView.swift create mode 100644 DashWallet/Sources/UI/DashPay/Welcome/JoinDashPayView.swift diff --git a/DashPay/Presentation/Home/Views/DPWelcomeView.swift b/DashPay/Presentation/Home/Views/DPWelcomeView.swift deleted file mode 100644 index 378c930a1..000000000 --- a/DashPay/Presentation/Home/Views/DPWelcomeView.swift +++ /dev/null @@ -1,105 +0,0 @@ -// -// Created by Andrew Podkovyrin -// Copyright © 2020 Dash Core Group. All rights reserved. -// -// Licensed under the MIT License (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://opensource.org/licenses/MIT -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -import UIKit - -@objc -class DPWelcomeView: DWBasePressableControl { - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override init(frame: CGRect) { - let titleLabel = UILabel() - let subtitleLabel = UILabel() - let arrowImageView = UIImageView(image: UIImage(named: "pay_user_accessory")) - - super.init(frame: frame) - - backgroundColor = UIColor.clear - layoutMargins = UIEdgeInsets(top: 0, left: 16, bottom: 0, right: 16) - - let shadowView = ShadowView(frame: .zero) - shadowView.translatesAutoresizingMaskIntoConstraints = false - shadowView.insetsLayoutMarginsFromSafeArea = true - shadowView.isUserInteractionEnabled = false - addSubview(shadowView) - - let contentView = UIView() - contentView.translatesAutoresizingMaskIntoConstraints = false - contentView.backgroundColor = .dw_background() - contentView.layer.cornerRadius = 8.0 - contentView.layer.masksToBounds = true - contentView.isUserInteractionEnabled = false - shadowView.addSubview(contentView) - - titleLabel.translatesAutoresizingMaskIntoConstraints = false - titleLabel.textColor = UIColor.dw_darkTitle() - titleLabel.numberOfLines = 0 - titleLabel.adjustsFontForContentSizeCategory = true - titleLabel.font = .dw_font(forTextStyle: .subheadline) - titleLabel.text = NSLocalizedString("Join DashPay", comment: "") - titleLabel.isUserInteractionEnabled = false - contentView.addSubview(titleLabel) - - subtitleLabel.translatesAutoresizingMaskIntoConstraints = false - subtitleLabel.textColor = .dw_tertiaryText() - subtitleLabel.numberOfLines = 0 - subtitleLabel.adjustsFontForContentSizeCategory = true - subtitleLabel.font = .dw_font(forTextStyle: .footnote) - subtitleLabel.text = NSLocalizedString("Create a username, add your friends.", comment: "") - subtitleLabel.isUserInteractionEnabled = false - contentView.addSubview(subtitleLabel) - - arrowImageView.translatesAutoresizingMaskIntoConstraints = false - arrowImageView.isUserInteractionEnabled = false - contentView.addSubview(arrowImageView) - - titleLabel.setContentCompressionResistancePriority(.required - 1, for: .horizontal) - subtitleLabel.setContentCompressionResistancePriority(.required - 2, for: .horizontal) - titleLabel.setContentCompressionResistancePriority(.required - 1, for: .vertical) - subtitleLabel.setContentCompressionResistancePriority(.required - 2, for: .vertical) - - let guide = layoutMarginsGuide - NSLayoutConstraint.activate([ - shadowView.leadingAnchor.constraint(equalTo: guide.leadingAnchor), - shadowView.topAnchor.constraint(equalTo: topAnchor), - guide.trailingAnchor.constraint(equalTo: shadowView.trailingAnchor), - bottomAnchor.constraint(equalTo: shadowView.bottomAnchor), - - contentView.leadingAnchor.constraint(equalTo: shadowView.leadingAnchor), - contentView.topAnchor.constraint(equalTo: shadowView.topAnchor), - shadowView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor), - shadowView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor), - - titleLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 16), - titleLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 12), - - subtitleLabel.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 2.0), - subtitleLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 12), - contentView.bottomAnchor.constraint(equalTo: subtitleLabel.bottomAnchor, constant: 16), - - arrowImageView.leadingAnchor.constraint(equalTo: subtitleLabel.trailingAnchor, constant: 12), - arrowImageView.leadingAnchor.constraint(equalTo: titleLabel.trailingAnchor, constant: 12), - arrowImageView.centerYAnchor.constraint(equalTo: contentView.centerYAnchor), - contentView.trailingAnchor.constraint(equalTo: arrowImageView.trailingAnchor, constant: 12), - - arrowImageView.widthAnchor.constraint(equalToConstant: 32.0), - arrowImageView.heightAnchor.constraint(equalToConstant: 32.0), - ]) - } -} diff --git a/DashWallet.xcodeproj/project.pbxproj b/DashWallet.xcodeproj/project.pbxproj index 0d9409ebb..990b703b3 100644 --- a/DashWallet.xcodeproj/project.pbxproj +++ b/DashWallet.xcodeproj/project.pbxproj @@ -557,6 +557,7 @@ 753261AE2CBC1040003CDE00 /* InvitationFlowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 753261AD2CBC1040003CDE00 /* InvitationFlowViewController.swift */; }; 753261B02CBC11BF003CDE00 /* WelcomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 753261AF2CBC11BF003CDE00 /* WelcomeViewController.swift */; }; 753261B22CBC157F003CDE00 /* GetStartedViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 753261B12CBC157F003CDE00 /* GetStartedViewController.swift */; }; + 753261B42CBD2761003CDE00 /* JoinDashPayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 753261B32CBD2761003CDE00 /* JoinDashPayView.swift */; }; 753FD7E22CA44BDD00B7751F /* CoinJoinProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = 753FD7E12CA44BDD00B7751F /* CoinJoinProgress.swift */; }; 753FD7E32CA44BDD00B7751F /* CoinJoinProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = 753FD7E12CA44BDD00B7751F /* CoinJoinProgress.swift */; }; 753FDBEA2AEA422F0005EEC3 /* VotingPrefs.swift in Sources */ = {isa = PBXBuildFile; fileRef = 753FDBE92AEA422F0005EEC3 /* VotingPrefs.swift */; }; @@ -641,7 +642,6 @@ 75C1F0452AE26AC0006929CA /* CoinJoinLevelsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75C1F0442AE26AC0006929CA /* CoinJoinLevelsViewModel.swift */; }; 75C1F0462AE26AC0006929CA /* CoinJoinLevelsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75C1F0442AE26AC0006929CA /* CoinJoinLevelsViewModel.swift */; }; 75C1F09E2AFF675400FE675E /* EnterVotingKeyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75C1F09D2AFF675400FE675E /* EnterVotingKeyViewController.swift */; }; - 75C72CDF2B19FB0C00129504 /* DPWelcomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75C72CDE2B19FB0C00129504 /* DPWelcomeView.swift */; }; 75C83B522B11B62400C33660 /* ConfirmRequestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75C83B512B11B62400C33660 /* ConfirmRequestViewController.swift */; }; 75CDD7802C0898E400F433D2 /* Shape.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75CDD77F2C0898E400F433D2 /* Shape.swift */; }; 75CDD7812C0898E400F433D2 /* Shape.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75CDD77F2C0898E400F433D2 /* Shape.swift */; }; @@ -2442,6 +2442,7 @@ 753261AD2CBC1040003CDE00 /* InvitationFlowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InvitationFlowViewController.swift; sourceTree = ""; }; 753261AF2CBC11BF003CDE00 /* WelcomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeViewController.swift; sourceTree = ""; }; 753261B12CBC157F003CDE00 /* GetStartedViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetStartedViewController.swift; sourceTree = ""; }; + 753261B32CBD2761003CDE00 /* JoinDashPayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JoinDashPayView.swift; sourceTree = ""; }; 753FD7E12CA44BDD00B7751F /* CoinJoinProgress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoinJoinProgress.swift; sourceTree = ""; }; 753FDBE92AEA422F0005EEC3 /* VotingPrefs.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VotingPrefs.swift; sourceTree = ""; }; 753FDBEB2AECF4CC0005EEC3 /* VotingHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = VotingHeaderView.xib; sourceTree = ""; }; @@ -2502,7 +2503,6 @@ 75BDE7AB2BF3287400556791 /* Toast.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Toast.swift; sourceTree = ""; }; 75C1F0442AE26AC0006929CA /* CoinJoinLevelsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoinJoinLevelsViewModel.swift; sourceTree = ""; }; 75C1F09D2AFF675400FE675E /* EnterVotingKeyViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnterVotingKeyViewController.swift; sourceTree = ""; }; - 75C72CDE2B19FB0C00129504 /* DPWelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DPWelcomeView.swift; sourceTree = ""; }; 75C83B512B11B62400C33660 /* ConfirmRequestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfirmRequestViewController.swift; sourceTree = ""; }; 75CDD77F2C0898E400F433D2 /* Shape.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Shape.swift; sourceTree = ""; }; 75CDD7822C0898FA00F433D2 /* Wrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Wrapper.swift; sourceTree = ""; }; @@ -6799,6 +6799,7 @@ C943B3D92A40A54600AF23C5 /* DWDPWelcomePageViewController.h */, 753261AD2CBC1040003CDE00 /* InvitationFlowViewController.swift */, 753261AF2CBC11BF003CDE00 /* WelcomeViewController.swift */, + 753261B32CBD2761003CDE00 /* JoinDashPayView.swift */, ); path = Welcome; sourceTree = ""; @@ -7480,7 +7481,6 @@ C9D2C95F2A386D9700D15901 /* Views */ = { isa = PBXGroup; children = ( - 75C72CDE2B19FB0C00129504 /* DPWelcomeView.swift */, 756188202B1EE78A00B778E3 /* DPVotingResultView.swift */, ); path = Views; @@ -9318,6 +9318,7 @@ C9D2C74A2A320AA000D15901 /* ShortcutsView.swift in Sources */, C9D2C74B2A320AA000D15901 /* DWFormSectionModel.m in Sources */, C9D2C74C2A320AA000D15901 /* (null) in Sources */, + 753261B42CBD2761003CDE00 /* JoinDashPayView.swift in Sources */, C9D2C74D2A320AA000D15901 /* CoinbasePlaceBuyOrderResponse.swift in Sources */, C9D2C74E2A320AA000D15901 /* ExploreMapView.swift in Sources */, C943B32F2A408CED00AF23C5 /* DWSaveAlertViewController.m in Sources */, @@ -9831,7 +9832,6 @@ C9D2C8E72A320AA000D15901 /* DashTextAttachment.swift in Sources */, C943B5432A40AFD100AF23C5 /* DWTxDetailPopupViewController.m in Sources */, C9D2C8E82A320AA000D15901 /* HomeBalanceView.swift in Sources */, - 75C72CDF2B19FB0C00129504 /* DPWelcomeView.swift in Sources */, C9D2C8E92A320AA000D15901 /* PointOfUseListFiltersModel.swift in Sources */, C943B3262A408CED00AF23C5 /* DWCropAvatarViewController.m in Sources */, 7573C2E32B01105F00F4C347 /* MasternodeIPCell.swift in Sources */, diff --git a/DashWallet/Sources/Models/CoinJoin/CoinJoinService.swift b/DashWallet/Sources/Models/CoinJoin/CoinJoinService.swift index eeaab59d9..2f9248f31 100644 --- a/DashWallet/Sources/Models/CoinJoin/CoinJoinService.swift +++ b/DashWallet/Sources/Models/CoinJoin/CoinJoinService.swift @@ -61,6 +61,7 @@ private let kDefaultRounds: Int32 = 4 private let kDefaultSessions: Int32 = 6 private let kDefaultDenominationGoal: Int32 = 50 private let kDefaultDenominationHardcap: Int32 = 300 +private let kCoinJoinMixDashShown = "coinJoinMixDashShownKey" private let kCoinJoinMainnetMode = "coinJoinModeMainnetKey" private let kCoinJoinTestnetMode = "coinJoinModeTestnetKey" let kMaxAllowedAheadTimeskew: TimeInterval = 5 @@ -113,6 +114,15 @@ class CoinJoinService: NSObject, NetworkReachabilityHandling { } } + private var _mixDashShown: Bool? = nil + var mixDashShown: Bool { + get { _mixDashShown ?? UserDefaults.standard.bool(forKey: kCoinJoinMixDashShown) } + set(value) { + _mixDashShown = value + UserDefaults.standard.set(value, forKey: kCoinJoinMixDashShown) + } + } + @Published private(set) var mode: CoinJoinMode = .none @Published var mixingState: MixingStatus = .notStarted @Published private(set) var progress = CoinJoinProgress(progress: 0.0, totalBalance: 0, coinJoinBalance: 0) diff --git a/DashWallet/Sources/UI/DashPay/CoinJoin/CoinJoinLevelsViewController.swift b/DashWallet/Sources/UI/DashPay/CoinJoin/CoinJoinLevelsViewController.swift index a309d2e67..01e87124e 100644 --- a/DashWallet/Sources/UI/DashPay/CoinJoin/CoinJoinLevelsViewController.swift +++ b/DashWallet/Sources/UI/DashPay/CoinJoin/CoinJoinLevelsViewController.swift @@ -32,9 +32,15 @@ class CoinJoinLevelsViewController: UIViewController { @IBOutlet private var advancedTime: UILabel! @IBOutlet private var continueButton: ActionButton! + var requiresNoNavigationBar: Bool { + return true + } + @objc - static func controller() -> CoinJoinLevelsViewController { - vc(CoinJoinLevelsViewController.self, from: sb("CoinJoin")) + static func controller(isFullScreen: Bool = false) -> CoinJoinLevelsViewController { + let vc = vc(CoinJoinLevelsViewController.self, from: sb("CoinJoin")) + vc.modalPresentationStyle = isFullScreen ? .fullScreen : .formSheet + return vc } override func viewDidLoad() { @@ -51,7 +57,11 @@ class CoinJoinLevelsViewController: UIViewController { @IBAction func continueButtonAction() { if viewModel.mixingState == .notStarted { - self.navigationController?.popViewController(animated: true) + if modalPresentationStyle == .fullScreen { + dismiss(animated: true) + } else { + self.navigationController?.popViewController(animated: true) + } viewModel.startMixing() } else { let alert = UIAlertController(title: NSLocalizedString("Are you sure you want to stop mixing?", comment: "CoinJoin"), message: NSLocalizedString("Any funds that have been mixed will be combined with your un mixed funds", comment: "CoinJoin"), preferredStyle: .alert) @@ -89,6 +99,27 @@ extension CoinJoinLevelsViewController { advancedBox.layer.borderColor = UIColor.dw_separatorLine().cgColor let advancedTap = UITapGestureRecognizer(target: self, action: #selector(selectAdvanced)) advancedBox.addGestureRecognizer(advancedTap) + + if modalPresentationStyle == .fullScreen { + let backButton = UIButton(type: .system) + backButton.setImage(UIImage(systemName: "xmark"), for: .normal) + backButton.addTarget(self, action: #selector(closeButtonAction), for: .touchUpInside) + backButton.tintColor = .label + view.addSubview(backButton) + backButton.translatesAutoresizingMaskIntoConstraints = false + NSLayoutConstraint.activate([ + backButton.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 0), + backButton.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -16), + backButton.widthAnchor.constraint(equalToConstant: 44), + backButton.heightAnchor.constraint(equalToConstant: 44), + titleLabel.topAnchor.constraint(equalTo: backButton.bottomAnchor, constant: 0) + ]) + } + } + + @objc + private func closeButtonAction() { + dismiss(animated: true) } @objc diff --git a/DashWallet/Sources/UI/DashPay/Welcome/JoinDashPayView.swift b/DashWallet/Sources/UI/DashPay/Welcome/JoinDashPayView.swift new file mode 100644 index 000000000..c3725c810 --- /dev/null +++ b/DashWallet/Sources/UI/DashPay/Welcome/JoinDashPayView.swift @@ -0,0 +1,52 @@ +// +// Created by Andrei Ashikhmin +// Copyright © 2024 Dash Core Group. All rights reserved. +// +// Licensed under the MIT License (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import SwiftUI + +struct JoinDashPayView: View { + var onAction: (() -> ())? + + var body: some View { + Button(action: { + onAction?() + }) { + HStack { + VStack(alignment: .leading, spacing: 2) { + Text(NSLocalizedString("Join DashPay", comment: "")) + .font(.subheadline) + .foregroundColor(Color.primaryText) + + Text(NSLocalizedString("Create a username, add your friends.", comment: "")) + .font(.footnote) + .foregroundColor(Color.tertiaryText) + } + + Spacer() + + Image("pay_user_accessory") + .frame(width: 32, height: 32) + } + .padding(.vertical, 16) + .padding(.horizontal, 12) + .background(Color.secondaryBackground) + .cornerRadius(10) + .shadow(color: .shadow, radius: 10, x: 0, y: 5) + } + .buttonStyle(PlainButtonStyle()) + .padding(.horizontal, 16) + } +} diff --git a/DashWallet/Sources/UI/Home/HomeViewController+Shortcuts.swift b/DashWallet/Sources/UI/Home/HomeViewController+Shortcuts.swift index b51c2194b..48189986c 100644 --- a/DashWallet/Sources/UI/Home/HomeViewController+Shortcuts.swift +++ b/DashWallet/Sources/UI/Home/HomeViewController+Shortcuts.swift @@ -19,7 +19,7 @@ import UIKit extension HomeViewController: DWLocalCurrencyViewControllerDelegate, DWExploreTestnetViewControllerDelegate { - func performAction(for action: ShortcutAction, sender: UIView) { + func performAction(for action: ShortcutAction, sender: UIView?) { switch action.type { case .secureWallet: secureWalletAction() @@ -30,7 +30,7 @@ extension HomeViewController: DWLocalCurrencyViewControllerDelegate, DWExploreTe case .buySellDash: buySellDashAction() case .syncNow: - DWSettingsMenuModel.rescanBlockchainAction(from: self, sourceView: sender, sourceRect: sender.bounds, completion: nil) + DWSettingsMenuModel.rescanBlockchainAction(from: self, sourceView: sender!, sourceRect: sender!.bounds, completion: nil) case .payWithNFC: performNFCReadingAction() case .localCurrency: diff --git a/DashWallet/Sources/UI/Home/HomeViewController.swift b/DashWallet/Sources/UI/Home/HomeViewController.swift index 121a66c69..986e5b5ab 100644 --- a/DashWallet/Sources/UI/Home/HomeViewController.swift +++ b/DashWallet/Sources/UI/Home/HomeViewController.swift @@ -50,9 +50,8 @@ class HomeViewController: DWBasePayViewController, NavigationBarDisplayable { override func loadView() { let frame = UIScreen.main.bounds - homeView = HomeView(frame: frame) + homeView = HomeView(frame: frame, delegate: self) homeView.autoresizingMask = [.flexibleWidth, .flexibleHeight] - homeView.delegate = self homeView.shortcutsDelegate = self view = homeView } @@ -294,6 +293,11 @@ extension HomeViewController: RootEditProfileViewControllerDelegate { // MARK: - HomeViewDelegate extension HomeViewController: HomeViewDelegate { + func homeViewShowCoinJoin(_ homeView: HomeView?) { + let controller = CoinJoinLevelsViewController.controller(isFullScreen: true) + present(controller, animated: true, completion: nil) + } + func homeView(_ homeView: HomeView, showTxFilter sender: UIView) { showTxFilter(withSender: sender, displayModeProvider: model, shouldShowRewards: true) } @@ -303,7 +307,7 @@ extension HomeViewController: HomeViewDelegate { present(controller, animated: true, completion: nil) } - func homeViewShowDashPayRegistrationFlow(_ homeView: HomeView) { + func homeViewShowDashPayRegistrationFlow(_ homeView: HomeView?) { let action = ShortcutAction(type: .createUsername) performAction(for: action, sender: homeView) } diff --git a/DashWallet/Sources/UI/Home/Views/Home Header View/HomeHeaderView.swift b/DashWallet/Sources/UI/Home/Views/Home Header View/HomeHeaderView.swift index 3b74592f3..bc6b8bc98 100644 --- a/DashWallet/Sources/UI/Home/Views/Home Header View/HomeHeaderView.swift +++ b/DashWallet/Sources/UI/Home/Views/Home Header View/HomeHeaderView.swift @@ -43,13 +43,6 @@ final class HomeHeaderView: UIView { // Available only in DashPay #if DASHPAY - private let welcomeView: DPWelcomeView = DPWelcomeView(frame: .zero) - var isDPWelcomeViewHidden = true { - didSet { - welcomeView.isHidden = isDPWelcomeViewHidden - } - } - private let votingView: DPVotingResultView = DPVotingResultView(frame: .zero) var isVotingViewHidden = true { didSet { @@ -88,9 +81,6 @@ final class HomeHeaderView: UIView { shortcutsView.translatesAutoresizingMaskIntoConstraints = false #if DASHPAY - welcomeView.translatesAutoresizingMaskIntoConstraints = false - welcomeView.addTarget(self, action: #selector(joinDashPayAction), for: .touchUpInside) - welcomeView.isHidden = true votingView.translatesAutoresizingMaskIntoConstraints = false votingView.isHidden = true votingView.onAction = { [weak self] in @@ -110,7 +100,7 @@ final class HomeHeaderView: UIView { self.delegate?.homeHeaderViewDidUpdateContents(self) } - let views: [UIView] = [balanceView, shortcutsView, syncView, welcomeView, votingView] + let views: [UIView] = [balanceView, shortcutsView, syncView, votingView] #else let views: [UIView] = [balanceView, shortcutsView, syncView] #endif diff --git a/DashWallet/Sources/UI/Home/Views/HomeView.swift b/DashWallet/Sources/UI/Home/Views/HomeView.swift index 99c51f39c..42d7fb876 100644 --- a/DashWallet/Sources/UI/Home/Views/HomeView.swift +++ b/DashWallet/Sources/UI/Home/Views/HomeView.swift @@ -23,7 +23,8 @@ import SwiftUI protocol HomeViewDelegate: AnyObject { func homeView(_ homeView: HomeView, showTxFilter sender: UIView) func homeView(_ homeView: HomeView, showSyncingStatus sender: UIView) - func homeViewShowDashPayRegistrationFlow(_ homeView: HomeView) + func homeViewShowDashPayRegistrationFlow(_ homeView: HomeView?) + func homeViewShowCoinJoin(_ homeView: HomeView?) func homeView(_ homeView: HomeView, showReclassifyYourTransactionsFlowWithTransaction transaction: DSTransaction) #if DASHPAY @@ -63,6 +64,12 @@ final class HomeView: UIView, DWHomeModelUpdatesObserver, DWDPRegistrationErrorR super.init(frame: frame) setupView() } + + init(frame: CGRect, delegate: HomeViewDelegate?) { + super.init(frame: frame) + self.delegate = delegate + setupView() + } required init?(coder: NSCoder) { super.init(coder: coder) @@ -85,6 +92,7 @@ final class HomeView: UIView, DWHomeModelUpdatesObserver, DWDPRegistrationErrorR let content = HomeViewContent( viewModel: self.viewModel, + delegate: self.delegate, balanceHeader: { UIViewWrapper(uiView: self.headerView) }, syncingHeader: { UIViewWrapper(uiView: self.syncingHeaderView) } ) @@ -192,9 +200,8 @@ final class HomeView: UIView, DWHomeModelUpdatesObserver, DWDPRegistrationErrorR } private func setIdentity(dpInfoHidden: Bool, model: DWHomeProtocol) { - headerView.isDPWelcomeViewHidden = dpInfoHidden headerView.isVotingViewHidden = true - viewModel.showJoinDashpay = !headerView.isDPWelcomeViewHidden + viewModel.showJoinDashpay = !dpInfoHidden let status = model.dashPayModel.registrationStatus let completed = model.dashPayModel.registrationCompleted @@ -214,8 +221,7 @@ final class HomeView: UIView, DWHomeModelUpdatesObserver, DWDPRegistrationErrorR let wasClosed = VotingPrefs.shared.votingPanelClosed let now = Date().timeIntervalSince1970 headerView.isVotingViewHidden = dpInfoHidden || wasClosed || now < VotingConstants.votingEndTime - headerView.isDPWelcomeViewHidden = true - viewModel.showJoinDashpay = !headerView.isDPWelcomeViewHidden + viewModel.showJoinDashpay = false let dao = UsernameRequestsDAOImpl.shared Task { @@ -238,7 +244,7 @@ extension HomeView: HomeHeaderViewDelegate { func homeHeaderViewDidUpdateContents(_ view: HomeHeaderView) { setNeedsLayout() } - + #if DASHPAY func homeHeaderViewJoinDashPayAction(_ headerView: HomeHeaderView) { delegate?.homeViewShowDashPayRegistrationFlow(self) @@ -276,8 +282,12 @@ struct TxPreviewModel: Identifiable, Equatable { struct HomeViewContent: View { @State private var selectedTxDataItem: TransactionListDataItem? = nil + @State private var showShouldMixDialog: Bool = false + @State private var navigateToDashPayFlow: Bool = false + @State private var navigateToCoinJoin: Bool = false @StateObject var viewModel: HomeViewModel + weak var delegate: HomeViewDelegate? @ViewBuilder var balanceHeader: () -> Content @ViewBuilder var syncingHeader: () -> Content @@ -303,6 +313,19 @@ struct HomeViewContent: View { ) .padding(.horizontal, 15) .id(viewModel.coinJoinItem.id) + .onTapGesture { delegate?.homeViewShowCoinJoin(nil) } + } + + if viewModel.showJoinDashpay { + JoinDashPayView { + if viewModel.shouldShowMixDashDialog { + self.navigateToDashPayFlow = false + self.navigateToCoinJoin = false + showShouldMixDialog = true + } else { + delegate?.homeViewShowDashPayRegistrationFlow(nil) + } + } } syncingHeader() @@ -339,6 +362,37 @@ struct HomeViewContent: View { .sheet(item: $selectedTxDataItem) { item in TransactionDetailsSheet(item: item) } + .sheet(isPresented: $showShouldMixDialog, onDismiss: { + viewModel.shouldShowMixDashDialog = false + + if navigateToDashPayFlow { + navigateToDashPayFlow = false + delegate?.homeViewShowDashPayRegistrationFlow(nil) + } else if navigateToCoinJoin { + navigateToCoinJoin = false + delegate?.homeViewShowCoinJoin(nil) + } + }) { + if #available(iOS 16.0, *) { + MixDashDialog( + positiveAction: { + self.navigateToCoinJoin = true + }, + negativeAction: { + self.navigateToDashPayFlow = true + } + ).presentationDetents([.height(250)]) + } else { + MixDashDialog( + positiveAction: { + self.navigateToCoinJoin = true + }, + negativeAction: { + self.navigateToDashPayFlow = true + } + ) + } + } .onAppear { viewModel.checkTimeSkew() } @@ -465,3 +519,43 @@ struct BackgroundBlurView: UIViewRepresentable { func updateUIView(_ uiView: UIView, context: Context) {} } + +public struct MixDashDialog: View { + @Environment(\.presentationMode) private var presentationMode + var positiveAction: () -> Void = {} + var negativeAction: () -> Void = {} + + public var body: some View { + BottomSheet(showBackButton: Binding.constant(false)) { + VStack(spacing: 0) { + FeatureTopText( + title: NSLocalizedString("Mix your Dash Coins", comment: "CoinJoin"), + text: NSLocalizedString("To help prevent other people from seeing who you make payments to, it is recommended to mix your balance before you create your username.", comment: "CoinJoin"), + alignment: .leading + ) + + Spacer() + + ButtonsGroup( + orientation: .horizontal, + style: .regular, + size: .large, + positiveButtonText: NSLocalizedString("Mix coins", comment: "CoinJoin"), + positiveButtonAction: { + presentationMode.wrappedValue.dismiss() + positiveAction() + }, + negativeButtonText: NSLocalizedString("Skip", comment: ""), + negativeButtonAction: { + presentationMode.wrappedValue.dismiss() + negativeAction() + } + ) + .padding(.top, 20) + .padding(.bottom, 10) + } + .padding(.horizontal, 20) + .frame(maxHeight: .infinity) + } + } +} diff --git a/DashWallet/Sources/UI/Home/Views/HomeViewModel.swift b/DashWallet/Sources/UI/Home/Views/HomeViewModel.swift index dc7e18c18..97a5f7e61 100644 --- a/DashWallet/Sources/UI/Home/Views/HomeViewModel.swift +++ b/DashWallet/Sources/UI/Home/Views/HomeViewModel.swift @@ -36,18 +36,19 @@ class HomeViewModel: ObservableObject { @Published private(set) var coinJoinItem = CoinJoinMenuItemModel(title: NSLocalizedString("Mixing", comment: "CoinJoin"), isOn: false, state: .notStarted, progress: 0.0, mixed: 0.0, total: 0.0) @Published var showTimeSkewAlertDialog: Bool = false @Published private(set) var timeSkew: TimeInterval = 0 + @Published var showJoinDashpay: Bool = false private var model: SyncModel = SyncModelImpl() - var showJoinDashpay: Bool = false { - didSet { - self.recalculateHeight() - } - } var coinJoinMode: CoinJoinMode { get { coinJoinService.mode } } + var shouldShowMixDashDialog: Bool { + get { coinJoinService.mode == .none || !coinJoinService.mixDashShown } + set(value) { coinJoinService.mixDashShown = !value } + } + init() { model.networkStatusDidChange = { status in self.recalculateHeight() @@ -108,10 +109,6 @@ class HomeViewModel: ObservableObject { height += 85 } - if showJoinDashpay { - height += 50 - } - self.balanceHeaderHeight = height } diff --git a/DashWallet/Sources/UI/Menu/Main/Views/DWMainMenuContentView.m b/DashWallet/Sources/UI/Menu/Main/Views/DWMainMenuContentView.m index e37952710..8b9b3014f 100644 --- a/DashWallet/Sources/UI/Menu/Main/Views/DWMainMenuContentView.m +++ b/DashWallet/Sources/UI/Menu/Main/Views/DWMainMenuContentView.m @@ -170,7 +170,9 @@ - (void)currentUserProfileView:(DWCurrentUserProfileView *)view editProfileActio - (void)joinButtonAction:(UIButton *)sender { [self.delegate mainMenuContentView:self joinDashPayAction:sender]; } + #endif @end NS_ASSUME_NONNULL_END + diff --git a/DashWallet/Sources/UI/SwiftUI Components/BottomSheet.swift b/DashWallet/Sources/UI/SwiftUI Components/BottomSheet.swift index 8a1c1ec91..15169ed4d 100644 --- a/DashWallet/Sources/UI/SwiftUI Components/BottomSheet.swift +++ b/DashWallet/Sources/UI/SwiftUI Components/BottomSheet.swift @@ -25,7 +25,7 @@ struct BottomSheet: View { @ViewBuilder var content: () -> Content var body: some View { - VStack { + VStack(spacing: 0) { HStack(alignment: .top) { if showBackButton { Button { diff --git a/DashWallet/Sources/UI/SwiftUI Components/ButtonsGroup.swift b/DashWallet/Sources/UI/SwiftUI Components/ButtonsGroup.swift index 1a1eafe97..ab52e3f9c 100644 --- a/DashWallet/Sources/UI/SwiftUI Components/ButtonsGroup.swift +++ b/DashWallet/Sources/UI/SwiftUI Components/ButtonsGroup.swift @@ -25,6 +25,7 @@ struct ButtonsGroup: View { var orientation: Axis = .vertical var style: Style = .regular + var size: DashButton.Size = .medium var positiveButtonText: String? = nil var positiveButtonAction: (() -> Void)? = nil var negativeButtonText: String? = nil @@ -35,7 +36,7 @@ struct ButtonsGroup: View { return DashButton( text: text, style: negativeButtonText == nil ? .plain : .filled, - size: .medium, + size: size, action: { positiveButtonAction?() } ) } @@ -48,7 +49,7 @@ struct ButtonsGroup: View { return DashButton( text: text, style: .plain, - size: .medium, + size: size, action: { negativeButtonAction?() } ) } diff --git a/DashWallet/Sources/UI/SwiftUI Components/FeatureTopText.swift b/DashWallet/Sources/UI/SwiftUI Components/FeatureTopText.swift index 969e95502..9105b799c 100644 --- a/DashWallet/Sources/UI/SwiftUI Components/FeatureTopText.swift +++ b/DashWallet/Sources/UI/SwiftUI Components/FeatureTopText.swift @@ -21,20 +21,21 @@ struct FeatureTopText: View { var title: String var text: String var label: String? = nil + var alignment: TextAlignment = .center var labelIcon: IconName? = nil var linkAction: (() -> Void)? = nil var body: some View { - VStack(spacing: 6) { + VStack(alignment: getStackAlignment(), spacing: 6) { Text(title) .font(Font.system(size: 24).weight(.bold)) - .multilineTextAlignment(.center) + .multilineTextAlignment(alignment) .lineSpacing(3) .foregroundColor(.primaryText) Text(text) .font(Font.system(size: 14)) - .multilineTextAlignment(.center) + .multilineTextAlignment(alignment) .lineSpacing(3) .foregroundColor(.secondaryText) @@ -49,7 +50,18 @@ struct FeatureTopText: View { } } .padding(EdgeInsets(top: 0, leading: 20, bottom: 0, trailing: 20)) - .frame(maxWidth: .infinity); + .frame(maxWidth: .infinity) + } + + func getStackAlignment() -> HorizontalAlignment { + switch self.alignment { + case .leading: + return .leading + case .center: + return .center + case .trailing: + return .trailing + } } } From e53872e03787a40eeb0e6f93a30b4204c91b2ae5 Mon Sep 17 00:00:00 2001 From: Andrei Ashikhmin Date: Wed, 16 Oct 2024 15:02:25 +0700 Subject: [PATCH 3/6] chore: convert MainMenuContentView to Swift --- DashWallet.xcodeproj/project.pbxproj | 14 +- .../DWMainMenuViewController+DashPay.swift | 4 +- .../User Profile/DPWelcomeMenuView.swift | 1 - .../Sources/UI/Home/Views/HomeView.swift | 12 -- .../UI/Menu/Main/DWMainMenuViewController.m | 2 - .../Menu/Main/Views/DWMainMenuContentView.h | 60 ------ .../Menu/Main/Views/DWMainMenuContentView.m | 178 ----------------- .../Menu/Main/Views/MainMenuContentView.swift | 189 ++++++++++++++++++ DashWallet/dashwallet-Bridging-Header.h | 7 +- 9 files changed, 203 insertions(+), 264 deletions(-) delete mode 100644 DashWallet/Sources/UI/Menu/Main/Views/DWMainMenuContentView.h delete mode 100644 DashWallet/Sources/UI/Menu/Main/Views/DWMainMenuContentView.m create mode 100644 DashWallet/Sources/UI/Menu/Main/Views/MainMenuContentView.swift diff --git a/DashWallet.xcodeproj/project.pbxproj b/DashWallet.xcodeproj/project.pbxproj index 990b703b3..ddb076636 100644 --- a/DashWallet.xcodeproj/project.pbxproj +++ b/DashWallet.xcodeproj/project.pbxproj @@ -184,7 +184,6 @@ 2A74F0042305C59700C475EB /* UIViewController+DWTxFilter.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A74F0032305C59700C475EB /* UIViewController+DWTxFilter.m */; }; 2A7A7BAE234770C900451078 /* DWCaptureSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A7A7BAD234770C900451078 /* DWCaptureSessionManager.m */; }; 2A7A7BB22347927700451078 /* DWMainMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A7A7BB12347927700451078 /* DWMainMenuViewController.m */; }; - 2A7A7BB6234792A600451078 /* DWMainMenuContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A7A7BB5234792A600451078 /* DWMainMenuContentView.m */; }; 2A7A7BBE2347950700451078 /* DWMainMenuTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A7A7BBC2347950700451078 /* DWMainMenuTableViewCell.m */; }; 2A7A7BBF2347950700451078 /* DWMainMenuTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2A7A7BBD2347950700451078 /* DWMainMenuTableViewCell.xib */; }; 2A7A7BC3234797FC00451078 /* DWMainMenuModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A7A7BC2234797FC00451078 /* DWMainMenuModel.m */; }; @@ -677,6 +676,8 @@ 75EBAA262BBA9DC2004488E3 /* ZenLedger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EBAA242BBA9DC2004488E3 /* ZenLedger.swift */; }; 75EBAA292BBBE385004488E3 /* ZenLedgerViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EBAA282BBBE385004488E3 /* ZenLedgerViewModel.swift */; }; 75EBAA2A2BBBE385004488E3 /* ZenLedgerViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EBAA282BBBE385004488E3 /* ZenLedgerViewModel.swift */; }; + 75EE38D32CBE9EFC00845FFF /* MainMenuContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EE38D22CBE9EFC00845FFF /* MainMenuContentView.swift */; }; + 75EE38D42CBE9EFC00845FFF /* MainMenuContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EE38D22CBE9EFC00845FFF /* MainMenuContentView.swift */; }; 75F3F00D2C48F819004470EA /* RootEditProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 759063EC2C42687F002F2AA9 /* RootEditProfileViewController.swift */; }; 75F51AAD2ABD8C800057B499 /* IntegrationViewController+Uphold.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75F51AAC2ABD8C800057B499 /* IntegrationViewController+Uphold.swift */; }; 75F51AAF2ABD8D070057B499 /* IntegrationViewController+Coinbase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75F51AAE2ABD8D070057B499 /* IntegrationViewController+Coinbase.swift */; }; @@ -1211,7 +1212,6 @@ C9D2C7CE2A320AA000D15901 /* CrowdNodeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 470617D5299A671900DCC667 /* CrowdNodeCell.swift */; }; C9D2C7CF2A320AA000D15901 /* MerchantListLocationOffCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47AE8BD128C1305E00490F5E /* MerchantListLocationOffCell.swift */; }; C9D2C7D02A320AA000D15901 /* DWExploreTestnetContentsView.m in Sources */ = {isa = PBXBuildFile; fileRef = 47AE8BE228C1305E00490F5E /* DWExploreTestnetContentsView.m */; }; - C9D2C7D12A320AA000D15901 /* DWMainMenuContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A7A7BB5234792A600451078 /* DWMainMenuContentView.m */; }; C9D2C7D32A320AA000D15901 /* CrowdNodeAPIConfirmationTx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1186092429759C4B00279FCC /* CrowdNodeAPIConfirmationTx.swift */; }; C9D2C7D42A320AA000D15901 /* UIViewController+DWEmbedding.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A913E8F23A31713006A2A59 /* UIViewController+DWEmbedding.m */; }; C9D2C7D62A320AA000D15901 /* CALayer+DWShadow.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A2CD71222F97B65008C7BC9 /* CALayer+DWShadow.m */; }; @@ -1910,8 +1910,6 @@ 2A7A7BAD234770C900451078 /* DWCaptureSessionManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DWCaptureSessionManager.m; sourceTree = ""; }; 2A7A7BB02347927700451078 /* DWMainMenuViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DWMainMenuViewController.h; sourceTree = ""; }; 2A7A7BB12347927700451078 /* DWMainMenuViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DWMainMenuViewController.m; sourceTree = ""; }; - 2A7A7BB4234792A600451078 /* DWMainMenuContentView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DWMainMenuContentView.h; sourceTree = ""; }; - 2A7A7BB5234792A600451078 /* DWMainMenuContentView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DWMainMenuContentView.m; sourceTree = ""; }; 2A7A7BBB2347950700451078 /* DWMainMenuTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DWMainMenuTableViewCell.h; sourceTree = ""; }; 2A7A7BBC2347950700451078 /* DWMainMenuTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DWMainMenuTableViewCell.m; sourceTree = ""; }; 2A7A7BBD2347950700451078 /* DWMainMenuTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DWMainMenuTableViewCell.xib; sourceTree = ""; }; @@ -2537,6 +2535,7 @@ 75EBAA242BBA9DC2004488E3 /* ZenLedger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZenLedger.swift; sourceTree = ""; }; 75EBAA282BBBE385004488E3 /* ZenLedgerViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZenLedgerViewModel.swift; sourceTree = ""; }; 75EDC78DE1686E55AE12233C /* Pods-DashWalletScreenshotsUITests.testnet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DashWalletScreenshotsUITests.testnet.xcconfig"; path = "Pods/Target Support Files/Pods-DashWalletScreenshotsUITests/Pods-DashWalletScreenshotsUITests.testnet.xcconfig"; sourceTree = ""; }; + 75EE38D22CBE9EFC00845FFF /* MainMenuContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMenuContentView.swift; sourceTree = ""; }; 75F2E0B61BE2D5F000EAE861 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; 75F51AAC2ABD8C800057B499 /* IntegrationViewController+Uphold.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IntegrationViewController+Uphold.swift"; sourceTree = ""; }; 75F51AAE2ABD8D070057B499 /* IntegrationViewController+Coinbase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IntegrationViewController+Coinbase.swift"; sourceTree = ""; }; @@ -4149,8 +4148,7 @@ children = ( 2A7A7BC0234797E700451078 /* Model */, 2A7A7BB72347948F00451078 /* Cells */, - 2A7A7BB4234792A600451078 /* DWMainMenuContentView.h */, - 2A7A7BB5234792A600451078 /* DWMainMenuContentView.m */, + 75EE38D22CBE9EFC00845FFF /* MainMenuContentView.swift */, ); path = Views; sourceTree = ""; @@ -8510,6 +8508,7 @@ C91E919729FBACE6003E7883 /* ExtendedPublicKeysModel.swift in Sources */, C9829CE22A562CEE007132E4 /* TappableTextView.swift in Sources */, 4751CAD5297024EA00F63AC4 /* OrderPreviewViewController.swift in Sources */, + 75EE38D32CBE9EFC00845FFF /* MainMenuContentView.swift in Sources */, 478C982F294305D800FAA0F0 /* ActivePaymentMethodView.swift in Sources */, 47CDEEC72949DC38008AE06D /* BasicInfoController.swift in Sources */, 2AD1CEA822E0C8C900C99324 /* DWPreviewSeedPhraseModel.m in Sources */, @@ -8743,7 +8742,6 @@ 470617D6299A671900DCC667 /* CrowdNodeCell.swift in Sources */, 47AE8BF528C1306000490F5E /* MerchantListLocationOffCell.swift in Sources */, 47AE8C0028C1306000490F5E /* DWExploreTestnetContentsView.m in Sources */, - 2A7A7BB6234792A600451078 /* DWMainMenuContentView.m in Sources */, 1186092529759C4B00279FCC /* CrowdNodeAPIConfirmationTx.swift in Sources */, 2A913E9023A31713006A2A59 /* UIViewController+DWEmbedding.m in Sources */, 2A2CD71322F97B65008C7BC9 /* CALayer+DWShadow.m in Sources */, @@ -9079,6 +9077,7 @@ C9D2C69E2A320AA000D15901 /* AtmDetailsView.swift in Sources */, C9D2C69F2A320AA000D15901 /* DWPlaceholderFormTableViewCell.m in Sources */, C9D2C6A02A320AA000D15901 /* DWTitleDetailCellView.m in Sources */, + 75EE38D42CBE9EFC00845FFF /* MainMenuContentView.swift in Sources */, 757118DC2B0F189D000AE391 /* VerifyIdenityViewController.swift in Sources */, C9D2C6A12A320AA000D15901 /* AmountInputControl.swift in Sources */, C9D2C6A22A320AA000D15901 /* DWSegmentSliderFormTableViewCell.m in Sources */, @@ -9499,7 +9498,6 @@ 751B61C62ADFFD0A00D1C2EF /* IntegrationViewController+Coinbase.swift in Sources */, C9D2C7CF2A320AA000D15901 /* MerchantListLocationOffCell.swift in Sources */, C9D2C7D02A320AA000D15901 /* DWExploreTestnetContentsView.m in Sources */, - C9D2C7D12A320AA000D15901 /* DWMainMenuContentView.m in Sources */, C9D2C7D32A320AA000D15901 /* CrowdNodeAPIConfirmationTx.swift in Sources */, C9D2C7D42A320AA000D15901 /* UIViewController+DWEmbedding.m in Sources */, 7503643F2C89D49A0029EC0D /* CoinJoinService.swift in Sources */, diff --git a/DashWallet/Sources/UI/DashPay/Menu/DWMainMenuViewController+DashPay.swift b/DashWallet/Sources/UI/DashPay/Menu/DWMainMenuViewController+DashPay.swift index 365c0cd10..f0faadb69 100644 --- a/DashWallet/Sources/UI/DashPay/Menu/DWMainMenuViewController+DashPay.swift +++ b/DashWallet/Sources/UI/DashPay/Menu/DWMainMenuViewController+DashPay.swift @@ -19,8 +19,8 @@ import UIKit extension DWMainMenuViewController: RootEditProfileViewControllerDelegate { func editProfileViewController(_ controller: RootEditProfileViewController, updateDisplayName rawDisplayName: String, aboutMe rawAboutMe: String, avatarURLString: String?) { - guard let view = self.view as? DWMainMenuContentView else { return } - view.userModel.updateModel.update(withDisplayName: rawDisplayName, aboutMe: rawAboutMe, avatarURLString: avatarURLString) + guard let view = self.view as? MainMenuContentView else { return } + view.userModel?.updateModel.update(withDisplayName: rawDisplayName, aboutMe: rawAboutMe, avatarURLString: avatarURLString) controller.dismiss(animated: true, completion: nil) if MOCK_DASHPAY.boolValue { diff --git a/DashWallet/Sources/UI/DashPay/Profile/User Profile/DPWelcomeMenuView.swift b/DashWallet/Sources/UI/DashPay/Profile/User Profile/DPWelcomeMenuView.swift index f03847a37..6fd70db9c 100644 --- a/DashWallet/Sources/UI/DashPay/Profile/User Profile/DPWelcomeMenuView.swift +++ b/DashWallet/Sources/UI/DashPay/Profile/User Profile/DPWelcomeMenuView.swift @@ -22,7 +22,6 @@ enum DPWelcomState { case voting } -@objc(DWDPWelcomeMenuView) class DPWelcomeMenuView: UIView { private let prefs = VotingPrefs.shared diff --git a/DashWallet/Sources/UI/Home/Views/HomeView.swift b/DashWallet/Sources/UI/Home/Views/HomeView.swift index 42d7fb876..d92ee03f0 100644 --- a/DashWallet/Sources/UI/Home/Views/HomeView.swift +++ b/DashWallet/Sources/UI/Home/Views/HomeView.swift @@ -508,18 +508,6 @@ struct TransactionDetailsSheet: View { } } -struct BackgroundBlurView: UIViewRepresentable { - func makeUIView(context: Context) -> UIView { - let view = UIVisualEffectView(effect: UIBlurEffect(style: .dark)) - DispatchQueue.main.async { - view.superview?.superview?.backgroundColor = .clear - } - return view - } - - func updateUIView(_ uiView: UIView, context: Context) {} -} - public struct MixDashDialog: View { @Environment(\.presentationMode) private var presentationMode var positiveAction: () -> Void = {} diff --git a/DashWallet/Sources/UI/Menu/Main/DWMainMenuViewController.m b/DashWallet/Sources/UI/Menu/Main/DWMainMenuViewController.m index 128ca5363..775b747f1 100644 --- a/DashWallet/Sources/UI/Menu/Main/DWMainMenuViewController.m +++ b/DashWallet/Sources/UI/Menu/Main/DWMainMenuViewController.m @@ -22,7 +22,6 @@ #import "DWAboutModel.h" #import "DWExploreTestnetViewController.h" #import "DWGlobalOptions.h" -#import "DWMainMenuContentView.h" #import "DWMainMenuModel.h" #import "DWSecurityMenuViewController.h" #import "SFSafariViewController+DashWallet.h" @@ -93,7 +92,6 @@ - (void)viewDidLoad { #if DASHPAY self.view.userModel = self.userProfileModel; - self.view.dashPayReady = self.dashPayReady; #endif } diff --git a/DashWallet/Sources/UI/Menu/Main/Views/DWMainMenuContentView.h b/DashWallet/Sources/UI/Menu/Main/Views/DWMainMenuContentView.h deleted file mode 100644 index f847017c1..000000000 --- a/DashWallet/Sources/UI/Menu/Main/Views/DWMainMenuContentView.h +++ /dev/null @@ -1,60 +0,0 @@ -// -// Created by Andrew Podkovyrin -// Copyright © 2019 Dash Core Group. All rights reserved. -// -// Licensed under the MIT License (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://opensource.org/licenses/MIT -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import - -#import "DWMainMenuItem.h" - -#if DASHPAY -#import "DWCurrentUserProfileModel.h" -#import "DWDashPayReadyProtocol.h" -#endif - -NS_ASSUME_NONNULL_BEGIN - -@class DWMainMenuModel; -@class DWMainMenuContentView; - -@protocol DWMainMenuContentViewDelegate - -- (void)mainMenuContentView:(DWMainMenuContentView *)view didSelectMenuItem:(id)item; - -#if DASHPAY -- (void)mainMenuContentView:(DWMainMenuContentView *)view joinDashPayAction:(UIButton *)sender; -- (void)mainMenuContentView:(DWMainMenuContentView *)view showQRAction:(UIButton *)sender; -- (void)mainMenuContentView:(DWMainMenuContentView *)view editProfileAction:(UIButton *)sender; -#endif - -@end - -@interface DWMainMenuContentView : UIView - -@property (nonatomic, strong) DWMainMenuModel *model; -@property (nullable, nonatomic, weak) id delegate; - -- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_UNAVAILABLE; -- (instancetype)init NS_UNAVAILABLE; - -#if DASHPAY -@property (nonatomic, strong) DWCurrentUserProfileModel *userModel; -@property (nonatomic, strong) id dashPayReady; -- (void)updateUserHeader; -#endif - -@end - -NS_ASSUME_NONNULL_END diff --git a/DashWallet/Sources/UI/Menu/Main/Views/DWMainMenuContentView.m b/DashWallet/Sources/UI/Menu/Main/Views/DWMainMenuContentView.m deleted file mode 100644 index 8b9b3014f..000000000 --- a/DashWallet/Sources/UI/Menu/Main/Views/DWMainMenuContentView.m +++ /dev/null @@ -1,178 +0,0 @@ -// -// Created by Andrew Podkovyrin -// Copyright © 2019 Dash Core Group. All rights reserved. -// -// Licensed under the MIT License (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://opensource.org/licenses/MIT -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import "DWMainMenuContentView.h" - -#import "DWMainMenuModel.h" -#import "DWMainMenuTableViewCell.h" -#import "DWSharedUIConstants.h" -#import "DWUIKit.h" -#import "DWUserProfileContainerView.h" -#import "dashwallet-Swift.h" - -#if DASHPAY -#import "DWDashPayReadyProtocol.h" -#endif - -NS_ASSUME_NONNULL_BEGIN - -@interface DWMainMenuContentView () - -@property (nonatomic, strong) UITableView *tableView; - -#if DASHPAY -@property (nonatomic, strong) DWUserProfileContainerView *headerView; -@property (nonatomic, strong) DWDPWelcomeMenuView *joinHeaderView; -#endif - -@end - -@implementation DWMainMenuContentView - -- (instancetype)initWithFrame:(CGRect)frame { - self = [super initWithFrame:frame]; - if (self) { - self.backgroundColor = [UIColor dw_secondaryBackgroundColor]; - - UITableView *tableView = [[UITableView alloc] initWithFrame:self.bounds style:UITableViewStylePlain]; - tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - tableView.backgroundColor = self.backgroundColor; - tableView.dataSource = self; - tableView.delegate = self; - tableView.rowHeight = UITableViewAutomaticDimension; - tableView.estimatedRowHeight = 74.0; - tableView.separatorStyle = UITableViewCellSeparatorStyleNone; - tableView.contentInset = UIEdgeInsetsMake(DWDefaultMargin(), 0.0, DW_TABBAR_NOTCH, 0.0); - [self addSubview:tableView]; - _tableView = tableView; - -#if DASHPAY - DWUserProfileContainerView *headerView = [[DWUserProfileContainerView alloc] initWithFrame:CGRectZero]; - headerView.delegate = self; - _headerView = headerView; - - DWDPWelcomeMenuView *joinHeaderView = [[DWDPWelcomeMenuView alloc] initWithFrame:CGRectZero]; - UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(joinButtonAction:)]; - [joinHeaderView addGestureRecognizer:tapRecognizer]; - _joinHeaderView = joinHeaderView; -#endif - - NSString *cellId = DWMainMenuTableViewCell.dw_reuseIdentifier; - UINib *nib = [UINib nibWithNibName:cellId bundle:nil]; - NSParameterAssert(nib); - [tableView registerNib:nib forCellReuseIdentifier:cellId]; - } - return self; -} - -- (void)setModel:(DWMainMenuModel *)model { - _model = model; - - [self.tableView reloadData]; -} - -- (void)layoutSubviews { - [super layoutSubviews]; - -#if DASHPAY - UIView *tableHeaderView = self.tableView.tableHeaderView; - if (tableHeaderView) { - CGSize headerSize = [tableHeaderView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize]; - if (CGRectGetHeight(tableHeaderView.frame) != headerSize.height) { - tableHeaderView.frame = CGRectMake(0.0, 0.0, headerSize.width, headerSize.height); - self.tableView.tableHeaderView = tableHeaderView; - } - } - [_joinHeaderView refreshState]; -#endif -} - -#pragma mark - UITableViewDataSource - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return self.model.items.count; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - NSString *cellId = DWMainMenuTableViewCell.dw_reuseIdentifier; - DWMainMenuTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId forIndexPath:indexPath]; - - id menuItem = self.model.items[indexPath.row]; - cell.model = menuItem; - -#if SNAPSHOT - if (menuItem.type == DWMainMenuItemType_Security) { - cell.accessibilityIdentifier = @"menu_security_item"; - } -#endif /* SNAPSHOT */ - - return cell; -} - -#pragma mark - UITableViewDelegate - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - [tableView deselectRowAtIndexPath:indexPath animated:YES]; - - id menuItem = self.model.items[indexPath.row]; - [self.delegate mainMenuContentView:self didSelectMenuItem:menuItem]; -} - -#if DASHPAY - -- (void)setUserModel:(DWCurrentUserProfileModel *)userModel { - _userModel = userModel; - - self.headerView.userModel = userModel; -} - -- (void)updateUserHeader { - [self.userModel update]; - [self updateHeader]; -} - -- (void)updateHeader { - UIView *header = self.joinHeaderView; - - if (self.userModel.blockchainIdentity != nil) { - [self.headerView update]; - header = self.headerView; - } - - self.tableView.tableHeaderView = header; - [self setNeedsLayout]; -} - -#pragma mark - DWCurrentUserProfileViewDelegate - -- (void)currentUserProfileView:(DWCurrentUserProfileView *)view showQRAction:(UIButton *)sender { - [self.delegate mainMenuContentView:self showQRAction:sender]; -} - -- (void)currentUserProfileView:(DWCurrentUserProfileView *)view editProfileAction:(UIButton *)sender { - [self.delegate mainMenuContentView:self editProfileAction:sender]; -} - -- (void)joinButtonAction:(UIButton *)sender { - [self.delegate mainMenuContentView:self joinDashPayAction:sender]; -} - -#endif -@end - -NS_ASSUME_NONNULL_END - diff --git a/DashWallet/Sources/UI/Menu/Main/Views/MainMenuContentView.swift b/DashWallet/Sources/UI/Menu/Main/Views/MainMenuContentView.swift new file mode 100644 index 000000000..0ddd1cff5 --- /dev/null +++ b/DashWallet/Sources/UI/Menu/Main/Views/MainMenuContentView.swift @@ -0,0 +1,189 @@ +// +// Created by Andrew Podkovyrin +// Copyright © 2019 Dash Core Group. All rights reserved. +// +// Licensed under the MIT License (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import UIKit + +@objc(DWMainMenuContentViewDelegate) +protocol MainMenuContentViewDelegate: AnyObject { + func mainMenuContentView(_ view: MainMenuContentView, didSelectMenuItem item: DWMainMenuItem) + + #if DASHPAY + func mainMenuContentView(_ view: MainMenuContentView, joinDashPayAction sender: UIButton) + func mainMenuContentView(_ view: MainMenuContentView, showQRAction sender: UIButton) + func mainMenuContentView(_ view: MainMenuContentView, editProfileAction sender: UIButton) + #endif +} + +@objc(DWMainMenuContentView) +class MainMenuContentView: UIView { + + // MARK: - Properties + + @objc var model: DWMainMenuModel { + didSet { + tableView.reloadData() + } + } + @objc weak var delegate: MainMenuContentViewDelegate? + + private let tableView: UITableView + + #if DASHPAY + @objc var userModel: DWCurrentUserProfileModel? = nil + private let headerView: DWUserProfileContainerView + private let joinHeaderView: DPWelcomeMenuView + #endif + + // MARK: - Initialization + + override init(frame: CGRect) { + self.model = DWMainMenuModel() + self.tableView = UITableView(frame: .zero, style: .plain) + + #if DASHPAY + self.headerView = DWUserProfileContainerView(frame: .zero) + self.joinHeaderView = DPWelcomeMenuView(frame: .zero) + #endif + + super.init(frame: frame) + + setupViews() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: - Setup + + private func setupViews() { + backgroundColor = UIColor.dw_secondaryBackground() + + tableView.autoresizingMask = [.flexibleWidth, .flexibleHeight] + tableView.backgroundColor = backgroundColor + tableView.dataSource = self + tableView.delegate = self + tableView.rowHeight = UITableView.automaticDimension + tableView.estimatedRowHeight = 74.0 + tableView.separatorStyle = .none + tableView.contentInset = UIEdgeInsets(top: DWDefaultMargin(), left: 0, bottom: DW_TABBAR_NOTCH, right: 0) + addSubview(tableView) + + let cellId = DWMainMenuTableViewCell.dw_reuseIdentifier + let nib = UINib(nibName: cellId, bundle: nil) + tableView.register(nib, forCellReuseIdentifier: cellId) + + #if DASHPAY + headerView.delegate = self + + let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(joinButtonAction(_:))) + joinHeaderView.addGestureRecognizer(tapRecognizer) + #endif + } + + // MARK: - Layout + + override func layoutSubviews() { + super.layoutSubviews() + + tableView.frame = self.bounds + #if DASHPAY + if let tableHeaderView = tableView.tableHeaderView { + let headerSize = tableHeaderView.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize) + if tableHeaderView.frame.height != headerSize.height { + tableHeaderView.frame = CGRect(x: 0, y: 0, width: headerSize.width, height: headerSize.height) + tableView.tableHeaderView = tableHeaderView + } + } + joinHeaderView.refreshState() + #endif + } + + // MARK: - Public Methods + + #if DASHPAY + @objc func updateUserHeader() { + userModel?.update() + updateHeader() + } + + private func updateHeader() { + var header: UIView = joinHeaderView + + if userModel?.blockchainIdentity != nil { + headerView.update() + header = headerView + } + + tableView.tableHeaderView = header + setNeedsLayout() + } + + @objc private func joinButtonAction(_ sender: UIButton) { + delegate?.mainMenuContentView(self, joinDashPayAction: sender) + } + #endif +} + +// MARK: - UITableViewDataSource + +extension MainMenuContentView: UITableViewDataSource { + public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return model.items.count + } + + public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cellId = DWMainMenuTableViewCell.dw_reuseIdentifier + let cell = tableView.dequeueReusableCell(withIdentifier: cellId, for: indexPath) as! DWMainMenuTableViewCell + + let menuItem = model.items[indexPath.row] + cell.model = menuItem + + #if SNAPSHOT + if menuItem.type == .security { + cell.accessibilityIdentifier = "menu_security_item" + } + #endif + + return cell + } +} + +// MARK: - UITableViewDelegate + +extension MainMenuContentView: UITableViewDelegate { + public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + tableView.deselectRow(at: indexPath, animated: true) + + let menuItem = model.items[indexPath.row] + delegate?.mainMenuContentView(self, didSelectMenuItem: menuItem) + } +} + +#if DASHPAY +// MARK: - DWCurrentUserProfileViewDelegate + +extension MainMenuContentView: DWCurrentUserProfileViewDelegate { + public func currentUserProfileView(_ view: DWCurrentUserProfileView, showQRAction sender: UIButton) { + delegate?.mainMenuContentView(self, showQRAction: sender) + } + + public func currentUserProfileView(_ view: DWCurrentUserProfileView, editProfileAction sender: UIButton) { + delegate?.mainMenuContentView(self, editProfileAction: sender) + } +} +#endif diff --git a/DashWallet/dashwallet-Bridging-Header.h b/DashWallet/dashwallet-Bridging-Header.h index 6f317d1aa..c1c4ff8b6 100644 --- a/DashWallet/dashwallet-Bridging-Header.h +++ b/DashWallet/dashwallet-Bridging-Header.h @@ -131,7 +131,6 @@ static const bool _SNAPSHOT = 0; #import "UIViewController+DWDisplayError.h" #import "DWEditProfileViewController.h" #import "DWSaveAlertViewController.h" -#import "DWMainMenuContentView.h" #import "DWDPWelcomeCollectionViewController.h" #import "DWGetStarted.h" #import "DWGetStartedContentViewController.h" @@ -167,6 +166,12 @@ static const bool _SNAPSHOT = 0; #import "UIViewController+DWDisplayError.h" #import "DWFormTableViewController.h" #import "DWAboutViewController.h" +#import "DWMainMenuModel.h" +#import "DWCurrentUserProfileView.h" +#import "DWMainMenuTableViewCell.h" +#import "DWSharedUIConstants.h" +#import "DWUserProfileContainerView.h" +#import "DWDashPayReadyProtocol.h" //MARK: Onboarding #import "DWTransactionStub.h" From 44021a022f6a1a003e1722c62b8b0f22817af31f Mon Sep 17 00:00:00 2001 From: Andrei Ashikhmin Date: Wed, 16 Oct 2024 17:48:58 +0700 Subject: [PATCH 4/6] feat: mixing warning on the Menu screen --- .../CoinJoinLevelsViewController.swift | 2 +- .../Sources/UI/Home/Views/HomeView.swift | 4 +-- .../UI/Menu/Main/DWMainMenuViewController.m | 6 +++++ .../Menu/Main/Views/MainMenuContentView.swift | 27 ++++++++++++++++++- DashWallet/Sources/UI/Views/UIView+Dash.swift | 11 ++++++++ 5 files changed, 46 insertions(+), 4 deletions(-) diff --git a/DashWallet/Sources/UI/DashPay/CoinJoin/CoinJoinLevelsViewController.swift b/DashWallet/Sources/UI/DashPay/CoinJoin/CoinJoinLevelsViewController.swift index 01e87124e..074ede4b5 100644 --- a/DashWallet/Sources/UI/DashPay/CoinJoin/CoinJoinLevelsViewController.swift +++ b/DashWallet/Sources/UI/DashPay/CoinJoin/CoinJoinLevelsViewController.swift @@ -36,7 +36,7 @@ class CoinJoinLevelsViewController: UIViewController { return true } - @objc + @objc(controllerWithIsFullScreen:) static func controller(isFullScreen: Bool = false) -> CoinJoinLevelsViewController { let vc = vc(CoinJoinLevelsViewController.self, from: sb("CoinJoin")) vc.modalPresentationStyle = isFullScreen ? .fullScreen : .formSheet diff --git a/DashWallet/Sources/UI/Home/Views/HomeView.swift b/DashWallet/Sources/UI/Home/Views/HomeView.swift index d92ee03f0..4ba780539 100644 --- a/DashWallet/Sources/UI/Home/Views/HomeView.swift +++ b/DashWallet/Sources/UI/Home/Views/HomeView.swift @@ -510,8 +510,8 @@ struct TransactionDetailsSheet: View { public struct MixDashDialog: View { @Environment(\.presentationMode) private var presentationMode - var positiveAction: () -> Void = {} - var negativeAction: () -> Void = {} + var positiveAction: () -> Void + var negativeAction: () -> Void public var body: some View { BottomSheet(showBackButton: Binding.constant(false)) { diff --git a/DashWallet/Sources/UI/Menu/Main/DWMainMenuViewController.m b/DashWallet/Sources/UI/Menu/Main/DWMainMenuViewController.m index 775b747f1..ef85b324b 100644 --- a/DashWallet/Sources/UI/Menu/Main/DWMainMenuViewController.m +++ b/DashWallet/Sources/UI/Menu/Main/DWMainMenuViewController.m @@ -228,6 +228,12 @@ - (void)mainMenuContentView:(DWMainMenuContentView *)view joinDashPayAction:(UIB [self presentViewController:controller animated:YES completion:nil]; } } + +- (void)mainMenuContentView:(DWMainMenuContentView * _Nonnull)view showCoinJoin:(UIButton * _Nonnull)sender { + CoinJoinLevelsViewController *controller = [CoinJoinLevelsViewController controllerWithIsFullScreen:NO]; + controller.hidesBottomBarWhenPushed = YES; + [self.navigationController pushViewController:controller animated:YES]; +} #endif #pragma mark - DWToolsMenuViewControllerDelegate diff --git a/DashWallet/Sources/UI/Menu/Main/Views/MainMenuContentView.swift b/DashWallet/Sources/UI/Menu/Main/Views/MainMenuContentView.swift index 0ddd1cff5..e577391e0 100644 --- a/DashWallet/Sources/UI/Menu/Main/Views/MainMenuContentView.swift +++ b/DashWallet/Sources/UI/Menu/Main/Views/MainMenuContentView.swift @@ -16,6 +16,7 @@ // import UIKit +import SwiftUI @objc(DWMainMenuContentViewDelegate) protocol MainMenuContentViewDelegate: AnyObject { @@ -25,6 +26,7 @@ protocol MainMenuContentViewDelegate: AnyObject { func mainMenuContentView(_ view: MainMenuContentView, joinDashPayAction sender: UIButton) func mainMenuContentView(_ view: MainMenuContentView, showQRAction sender: UIButton) func mainMenuContentView(_ view: MainMenuContentView, editProfileAction sender: UIButton) + func mainMenuContentView(_ view: MainMenuContentView, showCoinJoin sender: UIButton) #endif } @@ -134,7 +136,30 @@ class MainMenuContentView: UIView { } @objc private func joinButtonAction(_ sender: UIButton) { - delegate?.mainMenuContentView(self, joinDashPayAction: sender) + let swiftUIView = MixDashDialog( + positiveAction: { + self.delegate?.mainMenuContentView(self, showCoinJoin: sender) + }, negativeAction: { + self.delegate?.mainMenuContentView(self, joinDashPayAction: sender) + } + ) + let hostingController = UIHostingController(rootView: swiftUIView) + + if #available(iOS 16.0, *) { + if let sheet = hostingController.sheetPresentationController { + let fitId = UISheetPresentationController.Detent.Identifier("fit") + let fitDetent = UISheetPresentationController.Detent.custom(identifier: fitId) { _ in + 250 + } + sheet.detents = [fitDetent] + } + } + + if let parentVC = self.parentViewController() { + parentVC.present(hostingController, animated: true, completion: nil) + } else { + delegate?.mainMenuContentView(self, joinDashPayAction: sender) + } } #endif } diff --git a/DashWallet/Sources/UI/Views/UIView+Dash.swift b/DashWallet/Sources/UI/Views/UIView+Dash.swift index a22413aba..3223bb0b2 100644 --- a/DashWallet/Sources/UI/Views/UIView+Dash.swift +++ b/DashWallet/Sources/UI/Views/UIView+Dash.swift @@ -91,4 +91,15 @@ extension UIView { return UIColor(cgColor: color) } } + + func parentViewController() -> UIViewController? { + var parentResponder: UIResponder? = self + while parentResponder != nil { + parentResponder = parentResponder!.next + if let viewController = parentResponder as? UIViewController { + return viewController + } + } + return nil + } } From 79631a9646c38dc091dd87f56c00d5280f7abdd5 Mon Sep 17 00:00:00 2001 From: Andrei Ashikhmin Date: Wed, 16 Oct 2024 19:05:10 +0700 Subject: [PATCH 5/6] feat: mixing warning on the contacts screen --- DashWallet.xcodeproj/project.pbxproj | 19 +- .../ContactsPlaceholderViewController.swift | 165 ++++++++++++++++++ .../DWContactsPlaceholderViewController.h | 36 ---- .../DWContactsPlaceholderViewController.m | 125 ------------- .../Contacts/DWRootContactsViewController.m | 2 +- .../RootEditProfileViewController.swift | 4 +- 6 files changed, 177 insertions(+), 174 deletions(-) create mode 100644 DashWallet/Sources/UI/DashPay/Contacts/ContactsPlaceholderViewController.swift delete mode 100644 DashWallet/Sources/UI/DashPay/Contacts/DWContactsPlaceholderViewController.h delete mode 100644 DashWallet/Sources/UI/DashPay/Contacts/DWContactsPlaceholderViewController.m diff --git a/DashWallet.xcodeproj/project.pbxproj b/DashWallet.xcodeproj/project.pbxproj index ddb076636..2a0877507 100644 --- a/DashWallet.xcodeproj/project.pbxproj +++ b/DashWallet.xcodeproj/project.pbxproj @@ -678,6 +678,7 @@ 75EBAA2A2BBBE385004488E3 /* ZenLedgerViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EBAA282BBBE385004488E3 /* ZenLedgerViewModel.swift */; }; 75EE38D32CBE9EFC00845FFF /* MainMenuContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EE38D22CBE9EFC00845FFF /* MainMenuContentView.swift */; }; 75EE38D42CBE9EFC00845FFF /* MainMenuContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EE38D22CBE9EFC00845FFF /* MainMenuContentView.swift */; }; + 75EE38D82CBFE52E00845FFF /* ContactsPlaceholderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EE38D72CBFE52B00845FFF /* ContactsPlaceholderViewController.swift */; }; 75F3F00D2C48F819004470EA /* RootEditProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 759063EC2C42687F002F2AA9 /* RootEditProfileViewController.swift */; }; 75F51AAD2ABD8C800057B499 /* IntegrationViewController+Uphold.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75F51AAC2ABD8C800057B499 /* IntegrationViewController+Uphold.swift */; }; 75F51AAF2ABD8D070057B499 /* IntegrationViewController+Coinbase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75F51AAE2ABD8D070057B499 /* IntegrationViewController+Coinbase.swift */; }; @@ -771,7 +772,6 @@ C943B3462A409FFA00AF23C5 /* DWDPAvatarView.m in Sources */ = {isa = PBXBuildFile; fileRef = C943B3442A409FFA00AF23C5 /* DWDPAvatarView.m */; }; C943B34D2A40A4C500AF23C5 /* DWInfoPopupViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C943B34A2A40A4C500AF23C5 /* DWInfoPopupViewController.m */; }; C943B34E2A40A4C500AF23C5 /* DWInfoPopupContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = C943B34B2A40A4C500AF23C5 /* DWInfoPopupContentView.m */; }; - C943B4AB2A40A54600AF23C5 /* DWContactsPlaceholderViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C943B3522A40A54500AF23C5 /* DWContactsPlaceholderViewController.m */; }; C943B4AC2A40A54600AF23C5 /* DWContactsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C943B3542A40A54500AF23C5 /* DWContactsViewController.m */; }; C943B4AD2A40A54600AF23C5 /* DWBaseContactsContentViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C943B3552A40A54500AF23C5 /* DWBaseContactsContentViewController.m */; }; C943B4AE2A40A54600AF23C5 /* DWNoContactsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C943B3572A40A54500AF23C5 /* DWNoContactsViewController.m */; }; @@ -2536,6 +2536,7 @@ 75EBAA282BBBE385004488E3 /* ZenLedgerViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZenLedgerViewModel.swift; sourceTree = ""; }; 75EDC78DE1686E55AE12233C /* Pods-DashWalletScreenshotsUITests.testnet.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DashWalletScreenshotsUITests.testnet.xcconfig"; path = "Pods/Target Support Files/Pods-DashWalletScreenshotsUITests/Pods-DashWalletScreenshotsUITests.testnet.xcconfig"; sourceTree = ""; }; 75EE38D22CBE9EFC00845FFF /* MainMenuContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMenuContentView.swift; sourceTree = ""; }; + 75EE38D72CBFE52B00845FFF /* ContactsPlaceholderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactsPlaceholderViewController.swift; sourceTree = ""; }; 75F2E0B61BE2D5F000EAE861 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; 75F51AAC2ABD8C800057B499 /* IntegrationViewController+Uphold.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IntegrationViewController+Uphold.swift"; sourceTree = ""; }; 75F51AAE2ABD8D070057B499 /* IntegrationViewController+Coinbase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IntegrationViewController+Coinbase.swift"; sourceTree = ""; }; @@ -2680,7 +2681,6 @@ C943B34B2A40A4C500AF23C5 /* DWInfoPopupContentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWInfoPopupContentView.m; sourceTree = ""; }; C943B34C2A40A4C500AF23C5 /* DWInfoPopupViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWInfoPopupViewController.h; sourceTree = ""; }; C943B3512A40A54500AF23C5 /* DWBaseContactsViewController+DWProtected.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DWBaseContactsViewController+DWProtected.h"; sourceTree = ""; }; - C943B3522A40A54500AF23C5 /* DWContactsPlaceholderViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWContactsPlaceholderViewController.m; sourceTree = ""; }; C943B3532A40A54500AF23C5 /* DWRootContactsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWRootContactsViewController.h; sourceTree = ""; }; C943B3542A40A54500AF23C5 /* DWContactsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWContactsViewController.m; sourceTree = ""; }; C943B3552A40A54500AF23C5 /* DWBaseContactsContentViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWBaseContactsContentViewController.m; sourceTree = ""; }; @@ -2715,7 +2715,6 @@ C943B3782A40A54600AF23C5 /* DWRequestsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWRequestsViewController.m; sourceTree = ""; }; C943B3792A40A54600AF23C5 /* DWRootContactsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWRootContactsViewController.m; sourceTree = ""; }; C943B37A2A40A54600AF23C5 /* DWBaseContactsContentViewController+DWProtected.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DWBaseContactsContentViewController+DWProtected.h"; sourceTree = ""; }; - C943B37B2A40A54600AF23C5 /* DWContactsPlaceholderViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWContactsPlaceholderViewController.h; sourceTree = ""; }; C943B37C2A40A54600AF23C5 /* DWContactsContentViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWContactsContentViewController.h; sourceTree = ""; }; C943B37D2A40A54600AF23C5 /* DWBaseContactsContentViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWBaseContactsContentViewController.h; sourceTree = ""; }; C943B37E2A40A54600AF23C5 /* DWContactsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWContactsViewController.h; sourceTree = ""; }; @@ -6171,6 +6170,7 @@ EBFC2EA47915CD4F5BA81564 /* Pods */, ); sourceTree = ""; + wrapsLines = 0; }; 75D5F3BF191EC270004AB296 /* Products */ = { isa = PBXGroup; @@ -6630,8 +6630,8 @@ C943B3502A40A54500AF23C5 /* Contacts */ = { isa = PBXGroup; children = ( + 75EE38D72CBFE52B00845FFF /* ContactsPlaceholderViewController.swift */, C943B3512A40A54500AF23C5 /* DWBaseContactsViewController+DWProtected.h */, - C943B3522A40A54500AF23C5 /* DWContactsPlaceholderViewController.m */, C943B3532A40A54500AF23C5 /* DWRootContactsViewController.h */, C943B3542A40A54500AF23C5 /* DWContactsViewController.m */, C943B3552A40A54500AF23C5 /* DWBaseContactsContentViewController.m */, @@ -6642,7 +6642,6 @@ C943B3712A40A54600AF23C5 /* Requests */, C943B3792A40A54600AF23C5 /* DWRootContactsViewController.m */, C943B37A2A40A54600AF23C5 /* DWBaseContactsContentViewController+DWProtected.h */, - C943B37B2A40A54600AF23C5 /* DWContactsPlaceholderViewController.h */, C943B37C2A40A54600AF23C5 /* DWContactsContentViewController.h */, C943B37D2A40A54600AF23C5 /* DWBaseContactsContentViewController.h */, C943B37E2A40A54600AF23C5 /* DWContactsViewController.h */, @@ -9260,6 +9259,7 @@ C943B4B02A40A54600AF23C5 /* DWContactsContentViewController.m in Sources */, C9D2C7242A320AA000D15901 /* WKWebView+CrowdNode.swift in Sources */, C9D2C7252A320AA000D15901 /* SyncingActivityMonitor.swift in Sources */, + 75EE38D82CBFE52E00845FFF /* ContactsPlaceholderViewController.swift in Sources */, C9D2C7262A320AA000D15901 /* EmptyView.swift in Sources */, C9D2C7272A320AA000D15901 /* (null) in Sources */, C9D2C7282A320AA000D15901 /* DWQRScanModel.m in Sources */, @@ -9322,7 +9322,6 @@ C9D2C74E2A320AA000D15901 /* ExploreMapView.swift in Sources */, C943B32F2A408CED00AF23C5 /* DWSaveAlertViewController.m in Sources */, C930784C2A6AD59700906E4B /* TitleValueCell.swift in Sources */, - C943B4AB2A40A54600AF23C5 /* DWContactsPlaceholderViewController.m in Sources */, 7566F48B2BB6CAF2005238D2 /* MenuItem.swift in Sources */, C9D2C74F2A320AA000D15901 /* DWSeedPhraseRow.m in Sources */, C943B5132A40A54600AF23C5 /* DWHistoryFilterContentView.m in Sources */, @@ -10751,7 +10750,7 @@ CLIENT_ID = 0c38beb67db0c68191326be347d7ec0abd7d77adb02a79db1abeba343f16a0f7; CLIENT_SECRET = cc980185754f905e24250f877792817c03540b3d0e0959721df291c816797e59; CODE_SIGN_ENTITLEMENTS = dashwallet/dashwallet.entitlements; - CURRENT_PROJECT_VERSION = 171; + CURRENT_PROJECT_VERSION = 173; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = ""; @@ -10887,7 +10886,7 @@ CLIENT_ID = 0c38beb67db0c68191326be347d7ec0abd7d77adb02a79db1abeba343f16a0f7; CLIENT_SECRET = cc980185754f905e24250f877792817c03540b3d0e0959721df291c816797e59; CODE_SIGN_ENTITLEMENTS = dashwallet/dashwallet.entitlements; - CURRENT_PROJECT_VERSION = 171; + CURRENT_PROJECT_VERSION = 173; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -11022,7 +11021,7 @@ CLIENT_ID = 0c38beb67db0c68191326be347d7ec0abd7d77adb02a79db1abeba343f16a0f7; CLIENT_SECRET = cc980185754f905e24250f877792817c03540b3d0e0959721df291c816797e59; CODE_SIGN_ENTITLEMENTS = dashwallet/dashwallet.entitlements; - CURRENT_PROJECT_VERSION = 171; + CURRENT_PROJECT_VERSION = 173; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -11167,7 +11166,7 @@ CLIENT_ID = 0c38beb67db0c68191326be347d7ec0abd7d77adb02a79db1abeba343f16a0f7; CLIENT_SECRET = cc980185754f905e24250f877792817c03540b3d0e0959721df291c816797e59; CODE_SIGN_ENTITLEMENTS = dashwallet/dashwallet.entitlements; - CURRENT_PROJECT_VERSION = 171; + CURRENT_PROJECT_VERSION = 173; DEVELOPMENT_TEAM = 44RJ69WHFF; EXCLUDED_ARCHS = ""; GCC_PRECOMPILE_PREFIX_HEADER = YES; diff --git a/DashWallet/Sources/UI/DashPay/Contacts/ContactsPlaceholderViewController.swift b/DashWallet/Sources/UI/DashPay/Contacts/ContactsPlaceholderViewController.swift new file mode 100644 index 000000000..03378ce49 --- /dev/null +++ b/DashWallet/Sources/UI/DashPay/Contacts/ContactsPlaceholderViewController.swift @@ -0,0 +1,165 @@ +// +// Created by Andrew Podkovyrin +// Copyright © 2020 Dash Core Group. All rights reserved. +// +// Licensed under the MIT License (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://opensource.org/licenses/MIT +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +import UIKit +import SwiftUI + +@objc(DWContactsPlaceholderViewController) +class ContactsPlaceholderViewController: ActionButtonViewController { + + // MARK: - Properties + + private let dashPayModel: DWDashPayProtocol + private let dashPayReady: DWDashPayReadyProtocol + + // MARK: - Initializers + + @objc + init(dashPayModel: DWDashPayProtocol, dashPayReady: DWDashPayReadyProtocol) { + self.dashPayModel = dashPayModel + self.dashPayReady = dashPayReady + super.init(nibName: nil, bundle: nil) + } + + @available(*, unavailable, message: "init(coder:) is not available. Use init(dashPayModel:dashPayReady:) instead.") + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + @available(*, unavailable, message: "init(nibName:bundle:) is not available. Use init(dashPayModel:dashPayReady:) instead.") + override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { + fatalError("init(nibName:bundle:) has not been implemented") + } + + // MARK: - Overrides + + override var actionButtonTitle: String { + return NSLocalizedString("Upgrade", comment: "Title for the upgrade action button") + } + + override func viewDidLoad() { + super.viewDidLoad() + + setupView() + setupNotifications() + update() + } + + // MARK: - Setup Methods + + private func setupView() { + view.backgroundColor = UIColor.dw_secondaryBackground() + + let imageView = UIImageView(image: UIImage(named: "contacts_placeholder_icon")) + imageView.translatesAutoresizingMaskIntoConstraints = false + imageView.contentMode = .center + + let titleLabel = UILabel() + titleLabel.translatesAutoresizingMaskIntoConstraints = false + titleLabel.textAlignment = .center + titleLabel.font = UIFont.dw_font(forTextStyle: .title3) + titleLabel.adjustsFontForContentSizeCategory = true + titleLabel.text = NSLocalizedString("Upgrade to Evolution", comment: "Title label text") + titleLabel.textColor = UIColor.dw_darkTitle() + titleLabel.numberOfLines = 0 + + let descriptionLabel = UILabel() + descriptionLabel.translatesAutoresizingMaskIntoConstraints = false + descriptionLabel.textAlignment = .center + descriptionLabel.font = UIFont.dw_font(forTextStyle: .subheadline) + descriptionLabel.adjustsFontForContentSizeCategory = true + descriptionLabel.text = NSLocalizedString("Create your Username, find friends & family with their usernames and add them to your contacts", comment: "Description label text") + descriptionLabel.textColor = UIColor.dw_tertiaryText() + descriptionLabel.numberOfLines = 0 + + let verticalStackView = UIStackView(arrangedSubviews: [imageView, titleLabel, descriptionLabel]) + verticalStackView.translatesAutoresizingMaskIntoConstraints = false + verticalStackView.axis = .vertical + verticalStackView.spacing = 4.0 + verticalStackView.setCustomSpacing(26.0, after: imageView) + + let contentView = UIView() + contentView.translatesAutoresizingMaskIntoConstraints = false + contentView.backgroundColor = view.backgroundColor + contentView.addSubview(verticalStackView) + + NSLayoutConstraint.activate([ + verticalStackView.centerYAnchor.constraint(equalTo: contentView.centerYAnchor), + verticalStackView.topAnchor.constraint(greaterThanOrEqualTo: contentView.topAnchor), + contentView.bottomAnchor.constraint(greaterThanOrEqualTo: verticalStackView.bottomAnchor), + verticalStackView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor), + contentView.trailingAnchor.constraint(equalTo: verticalStackView.trailingAnchor) + ]) + + setupContentView(contentView) + } + + private func setupNotifications() { + let notificationCenter = NotificationCenter.default + notificationCenter.addObserver(self, + selector: #selector(update), + name: .DWDashPayRegistrationStatusUpdatedNotification, + object: nil) + + // TODO: This notification is never posted. Check if needed + // notificationCenter.addObserver(self, + // selector: #selector(update), + // name: .DWDashPayAvailabilityStatusUpdatedNotification, + // object: nil) + } + + // MARK: - Actions + + @objc override func actionButtonAction(sender: UIView) { + let swiftUIView = MixDashDialog( + positiveAction: { + let controller = CoinJoinLevelsViewController.controller(isFullScreen: true) + self.present(controller, animated: true, completion: nil) + }, negativeAction: { + let controller = DashPaySetupFlowController(dashPayModel: self.dashPayModel, + invitationURL: nil, + definedUsername: nil) + controller.modalPresentationStyle = .fullScreen + self.present(controller, animated: true, completion: nil) + } + ) + let hostingController = UIHostingController(rootView: swiftUIView) + + if #available(iOS 16.0, *) { + if let sheet = hostingController.sheetPresentationController { + let fitId = UISheetPresentationController.Detent.Identifier("fit") + let fitDetent = UISheetPresentationController.Detent.custom(identifier: fitId) { _ in + 250 + } + sheet.detents = [fitDetent] + } + } + + present(hostingController, animated: true, completion: nil) + } + + @objc func update() { + actionButton?.isEnabled = dashPayReady.shouldShowCreateUserNameButton() + } +} + +// MARK: - Notification Names + +extension Notification.Name { + static let DWDashPayRegistrationStatusUpdatedNotification = Notification.Name("DWDashPayRegistrationStatusUpdatedNotification") + // static let DWDashPayAvailabilityStatusUpdatedNotification = Notification.Name("DWDashPayAvailabilityStatusUpdatedNotification") +} diff --git a/DashWallet/Sources/UI/DashPay/Contacts/DWContactsPlaceholderViewController.h b/DashWallet/Sources/UI/DashPay/Contacts/DWContactsPlaceholderViewController.h deleted file mode 100644 index bd817cc93..000000000 --- a/DashWallet/Sources/UI/DashPay/Contacts/DWContactsPlaceholderViewController.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// Created by Andrew Podkovyrin -// Copyright © 2020 Dash Core Group. All rights reserved. -// -// Licensed under the MIT License (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://opensource.org/licenses/MIT -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import "DWBaseActionButtonViewController.h" - -#import "DWDashPayProtocol.h" -#import "DWDashPayReadyProtocol.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface DWContactsPlaceholderViewController : DWBaseActionButtonViewController - -- (instancetype)initWithDashPayModel:(id)dashPayModel dashPayReady:(id)dashPayReady; - -- (instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil NS_UNAVAILABLE; -- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_UNAVAILABLE; -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)new NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/DashWallet/Sources/UI/DashPay/Contacts/DWContactsPlaceholderViewController.m b/DashWallet/Sources/UI/DashPay/Contacts/DWContactsPlaceholderViewController.m deleted file mode 100644 index 9005d4ef9..000000000 --- a/DashWallet/Sources/UI/DashPay/Contacts/DWContactsPlaceholderViewController.m +++ /dev/null @@ -1,125 +0,0 @@ -// -// Created by Andrew Podkovyrin -// Copyright © 2020 Dash Core Group. All rights reserved. -// -// Licensed under the MIT License (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://opensource.org/licenses/MIT -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import "DWContactsPlaceholderViewController.h" - -#import "DWDashPayModel.h" -#import "DWUIKit.h" -#import "dashwallet-Swift.h" - -@interface DWContactsPlaceholderViewController () - -@property (readonly, nonatomic, strong) id dashPayModel; -@property (readonly, nonatomic, strong) id dashPayReady; - -@end - -@implementation DWContactsPlaceholderViewController - -- (instancetype)initWithDashPayModel:(id)dashPayModel dashPayReady:(id)dashPayReady { - self = [super init]; - if (self) { - _dashPayModel = dashPayModel; - _dashPayReady = dashPayReady; - } - return self; -} - -- (NSString *)actionButtonTitle { - return NSLocalizedString(@"Upgrade", nil); -} - -- (void)viewDidLoad { - [super viewDidLoad]; - - self.view.backgroundColor = [UIColor dw_secondaryBackgroundColor]; - - UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"contacts_placeholder_icon"]]; - imageView.translatesAutoresizingMaskIntoConstraints = NO; - imageView.contentMode = UIViewContentModeCenter; - - UILabel *titleLabel = [[UILabel alloc] init]; - titleLabel.translatesAutoresizingMaskIntoConstraints = NO; - titleLabel.textAlignment = NSTextAlignmentCenter; - titleLabel.font = [UIFont dw_fontForTextStyle:UIFontTextStyleTitle3]; - titleLabel.adjustsFontForContentSizeCategory = YES; - titleLabel.text = NSLocalizedString(@"Upgrade to Evolution", nil); - titleLabel.textColor = [UIColor dw_darkTitleColor]; - titleLabel.numberOfLines = 0; - - UILabel *descriptionLabel = [[UILabel alloc] init]; - descriptionLabel.translatesAutoresizingMaskIntoConstraints = NO; - descriptionLabel.textAlignment = NSTextAlignmentCenter; - descriptionLabel.font = [UIFont dw_fontForTextStyle:UIFontTextStyleSubheadline]; - descriptionLabel.adjustsFontForContentSizeCategory = YES; - descriptionLabel.text = NSLocalizedString(@"Create your Username, find friends & family with their usernames and add them to your contacts", nil); - descriptionLabel.textColor = [UIColor dw_tertiaryTextColor]; - descriptionLabel.numberOfLines = 0; - - UIStackView *verticalStackView = [[UIStackView alloc] initWithArrangedSubviews:@[ imageView, titleLabel, descriptionLabel ]]; - verticalStackView.translatesAutoresizingMaskIntoConstraints = NO; - verticalStackView.axis = UILayoutConstraintAxisVertical; - verticalStackView.spacing = 4.0; - [verticalStackView setCustomSpacing:26.0 afterView:imageView]; - - UIView *contentView = [[UIView alloc] init]; - contentView.translatesAutoresizingMaskIntoConstraints = NO; - contentView.backgroundColor = self.view.backgroundColor; - [contentView addSubview:verticalStackView]; - - [NSLayoutConstraint activateConstraints:@[ - [verticalStackView.centerYAnchor constraintEqualToAnchor:contentView.centerYAnchor], - [verticalStackView.topAnchor constraintGreaterThanOrEqualToAnchor:contentView.topAnchor], - [contentView.bottomAnchor constraintGreaterThanOrEqualToAnchor:contentView.bottomAnchor], - [verticalStackView.leadingAnchor constraintEqualToAnchor:contentView.leadingAnchor], - [contentView.trailingAnchor constraintEqualToAnchor:verticalStackView.trailingAnchor], - ]]; - - [self setupContentView:contentView]; - - // Model: - - NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; - [notificationCenter addObserver:self - selector:@selector(update) - name:DWDashPayRegistrationStatusUpdatedNotification - object:nil]; - - // TODO: never posted. Check if needed -// [notificationCenter addObserver:self -// selector:@selector(update) -// name:DWDashPayAvailabilityStatusUpdatedNotification -// object:nil]; - - [self update]; -} - -- (void)actionButtonAction:(id)sender { - DWDashPaySetupFlowController *controller = - [[DWDashPaySetupFlowController alloc] - initWithDashPayModel:self.dashPayModel - invitationURL:nil - definedUsername:nil]; - controller.modalPresentationStyle = UIModalPresentationFullScreen; - [self presentViewController:controller animated:YES completion:nil]; -} - -- (void)update { - self.actionButton.enabled = [self.dashPayReady shouldShowCreateUserNameButton]; -} - -@end diff --git a/DashWallet/Sources/UI/DashPay/Contacts/DWRootContactsViewController.m b/DashWallet/Sources/UI/DashPay/Contacts/DWRootContactsViewController.m index 57e2f933e..e8c73bf21 100644 --- a/DashWallet/Sources/UI/DashPay/Contacts/DWRootContactsViewController.m +++ b/DashWallet/Sources/UI/DashPay/Contacts/DWRootContactsViewController.m @@ -17,11 +17,11 @@ #import "DWRootContactsViewController.h" -#import "DWContactsPlaceholderViewController.h" #import "DWContactsViewController.h" #import "DWDashPayModel.h" #import "DWGlobalOptions.h" #import "DWUIKit.h" +#import "dashwallet-Swift.h" @interface DWRootContactsViewController () diff --git a/DashWallet/Sources/UI/DashPay/Profile/Edit Profile/RootEditProfileViewController.swift b/DashWallet/Sources/UI/DashPay/Profile/Edit Profile/RootEditProfileViewController.swift index c8a768a58..5e00e3c11 100644 --- a/DashWallet/Sources/UI/DashPay/Profile/Edit Profile/RootEditProfileViewController.swift +++ b/DashWallet/Sources/UI/DashPay/Profile/Edit Profile/RootEditProfileViewController.swift @@ -25,7 +25,7 @@ protocol RootEditProfileViewControllerDelegate: AnyObject { } @objc(DWRootEditProfileViewController) -class RootEditProfileViewController: DWBaseActionButtonViewController, DWEditProfileViewControllerDelegate, DWSaveAlertViewControllerDelegate, NavigationBarDisplayable { +class RootEditProfileViewController: ActionButtonViewController, DWEditProfileViewControllerDelegate, DWSaveAlertViewControllerDelegate, NavigationBarDisplayable { var isBackButtonHidden: Bool = false @@ -73,7 +73,7 @@ class RootEditProfileViewController: DWBaseActionButtonViewController, DWEditPro } } - @objc override func actionButtonAction(_ sender: Any) { + @objc override func actionButtonAction(sender: UIView) { performSave() } From 5a61436588c6c0e58a5879dd0a3d2df6d773e053 Mon Sep 17 00:00:00 2001 From: Andrei Ashikhmin Date: Thu, 17 Oct 2024 20:11:51 +0700 Subject: [PATCH 6/6] fix: cleanup --- DashWallet/AppDelegate.m | 2 -- 1 file changed, 2 deletions(-) diff --git a/DashWallet/AppDelegate.m b/DashWallet/AppDelegate.m index 227da0076..f923db737 100644 --- a/DashWallet/AppDelegate.m +++ b/DashWallet/AppDelegate.m @@ -104,8 +104,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( [CurrencyExchangerObjcWrapper startExchangeRateFetching]; [CoinbaseObjcWrapper start]; [CrowdNodeObjcWrapper start]; - - setenv("RUST_BACKTRACE", "1", 1); [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(dsApplicationTerminationRequestNotification:)