Skip to content

Commit

Permalink
feat: mixing warning on the contacts screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Syn-McJ committed Oct 16, 2024
1 parent 44021a0 commit 79631a9
Show file tree
Hide file tree
Showing 6 changed files with 177 additions and 174 deletions.
19 changes: 9 additions & 10 deletions DashWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -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 */; };
Expand Down Expand Up @@ -2536,6 +2536,7 @@
75EBAA282BBBE385004488E3 /* ZenLedgerViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZenLedgerViewModel.swift; sourceTree = "<group>"; };
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 = "<group>"; };
75EE38D22CBE9EFC00845FFF /* MainMenuContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMenuContentView.swift; sourceTree = "<group>"; };
75EE38D72CBFE52B00845FFF /* ContactsPlaceholderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactsPlaceholderViewController.swift; sourceTree = "<group>"; };
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 = "<group>"; };
75F51AAE2ABD8D070057B499 /* IntegrationViewController+Coinbase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IntegrationViewController+Coinbase.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2680,7 +2681,6 @@
C943B34B2A40A4C500AF23C5 /* DWInfoPopupContentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWInfoPopupContentView.m; sourceTree = "<group>"; };
C943B34C2A40A4C500AF23C5 /* DWInfoPopupViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWInfoPopupViewController.h; sourceTree = "<group>"; };
C943B3512A40A54500AF23C5 /* DWBaseContactsViewController+DWProtected.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DWBaseContactsViewController+DWProtected.h"; sourceTree = "<group>"; };
C943B3522A40A54500AF23C5 /* DWContactsPlaceholderViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWContactsPlaceholderViewController.m; sourceTree = "<group>"; };
C943B3532A40A54500AF23C5 /* DWRootContactsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWRootContactsViewController.h; sourceTree = "<group>"; };
C943B3542A40A54500AF23C5 /* DWContactsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWContactsViewController.m; sourceTree = "<group>"; };
C943B3552A40A54500AF23C5 /* DWBaseContactsContentViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWBaseContactsContentViewController.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2715,7 +2715,6 @@
C943B3782A40A54600AF23C5 /* DWRequestsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWRequestsViewController.m; sourceTree = "<group>"; };
C943B3792A40A54600AF23C5 /* DWRootContactsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DWRootContactsViewController.m; sourceTree = "<group>"; };
C943B37A2A40A54600AF23C5 /* DWBaseContactsContentViewController+DWProtected.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "DWBaseContactsContentViewController+DWProtected.h"; sourceTree = "<group>"; };
C943B37B2A40A54600AF23C5 /* DWContactsPlaceholderViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWContactsPlaceholderViewController.h; sourceTree = "<group>"; };
C943B37C2A40A54600AF23C5 /* DWContactsContentViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWContactsContentViewController.h; sourceTree = "<group>"; };
C943B37D2A40A54600AF23C5 /* DWBaseContactsContentViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWBaseContactsContentViewController.h; sourceTree = "<group>"; };
C943B37E2A40A54600AF23C5 /* DWContactsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWContactsViewController.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -6171,6 +6170,7 @@
EBFC2EA47915CD4F5BA81564 /* Pods */,
);
sourceTree = "<group>";
wrapsLines = 0;
};
75D5F3BF191EC270004AB296 /* Products */ = {
isa = PBXGroup;
Expand Down Expand Up @@ -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 */,
Expand All @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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*]" = "";
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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")
}

This file was deleted.

Loading

0 comments on commit 79631a9

Please sign in to comment.