Skip to content

Commit

Permalink
Merge branch 'develop' into feat/crowdnode-withdrawal-limits
Browse files Browse the repository at this point in the history
  • Loading branch information
Syn-McJ committed Dec 5, 2023
2 parents 20d8630 + deb5fbd commit 67a07da
Show file tree
Hide file tree
Showing 104 changed files with 5,283 additions and 572 deletions.
2 changes: 1 addition & 1 deletion DashPay/Presentation/Home/Views/DWDPWelcomeView.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

#import "DWDPWelcomeView.h"

#import "DWShadowView.h"
#import "DWUIKit.h"
#import "UIView+DWAnimations.h"
#import "dashwallet-Swift.h"

NS_ASSUME_NONNULL_BEGIN

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

#import "DWEditProfileBaseCell.h"

#import "DWShadowView.h"
#import "DWUIKit.h"
#import "dashwallet-Swift.h"


NS_ASSUME_NONNULL_BEGIN
Expand Down
148 changes: 148 additions & 0 deletions DashPay/Presentation/Profile/UserProfile/DPWelcomeMenuView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
//
// 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

enum DPWelcomState {
case none
case voting
}

@objc(DWDPWelcomeMenuView)
class DPWelcomeMenuView: UIView {
private let prefs = VotingPrefs.shared

private let titleLabel: UILabel = {
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
label.textColor = .dw_label()
label.numberOfLines = 1
label.adjustsFontForContentSizeCategory = true
label.font = .dw_mediumFont(ofSize: 15)
label.text = NSLocalizedString("Join DashPay", comment: "")

return label
}()

private let subtitleLabel: UILabel = {
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
label.textColor = .dw_tertiaryText()
label.numberOfLines = 1
label.adjustsFontForContentSizeCategory = true
label.font = .dw_regularFont(ofSize: 12)
label.text = NSLocalizedString("Request your username", comment: "")

return label
}()

override init(frame: CGRect) {
super.init(frame: frame)
setupView()
}

required init?(coder: NSCoder) {
super.init(coder: coder)
setupView()
}

@objc
func refreshState() {
changeState(state: prefs.requestedUsernameId != nil ? .voting : .none, username: prefs.requestedUsername)
}

private func setupView() {
backgroundColor = UIColor.clear

let shadowView = ShadowView(frame: .zero)
shadowView.translatesAutoresizingMaskIntoConstraints = false
shadowView.insetsLayoutMarginsFromSafeArea = true
addSubview(shadowView)

let contentView = UIView()
contentView.translatesAutoresizingMaskIntoConstraints = false
contentView.backgroundColor = .dw_background()
contentView.layer.cornerRadius = 8.0
contentView.layer.masksToBounds = true
shadowView.addSubview(contentView)

let imageView = UIImageView(image: UIImage(named: "dp_user_generic"))
imageView.translatesAutoresizingMaskIntoConstraints = false
contentView.addSubview(imageView)

contentView.addSubview(titleLabel)
contentView.addSubview(subtitleLabel)

let chevronView = UIImageView(image: UIImage(named: "greyarrow"))
chevronView.translatesAutoresizingMaskIntoConstraints = false
contentView.addSubview(chevronView)

let padding: CGFloat = 20.0
let horizontalPadding: CGFloat = 12

NSLayoutConstraint.activate([
contentView.heightAnchor.constraint(equalToConstant: 68),

shadowView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: padding),
shadowView.topAnchor.constraint(equalTo: topAnchor),
shadowView.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -padding),
shadowView.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),

contentView.leadingAnchor.constraint(equalTo: shadowView.leadingAnchor),
contentView.topAnchor.constraint(equalTo: shadowView.topAnchor),
contentView.trailingAnchor.constraint(equalTo: shadowView.trailingAnchor),
bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: 12),

imageView.heightAnchor.constraint(equalToConstant: 34),
imageView.widthAnchor.constraint(equalToConstant: 34),
imageView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 15),
imageView.centerYAnchor.constraint(equalTo: contentView.centerYAnchor),

titleLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 20),
titleLabel.leadingAnchor.constraint(equalTo: imageView.trailingAnchor, constant: horizontalPadding),

contentView.trailingAnchor.constraint(equalTo: titleLabel.trailingAnchor, constant: horizontalPadding),

subtitleLabel.topAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 2),
subtitleLabel.leadingAnchor.constraint(equalTo: imageView.trailingAnchor, constant: horizontalPadding),

chevronView.heightAnchor.constraint(equalToConstant: 16),
chevronView.widthAnchor.constraint(equalToConstant: 9),
chevronView.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -25),
chevronView.centerYAnchor.constraint(equalTo: contentView.centerYAnchor)
])

refreshState()
}

private func changeState(state: DPWelcomState, username: String?) {
switch state {
case .none:
titleLabel.text = NSLocalizedString("Join DashPay", comment: "")
subtitleLabel.text = NSLocalizedString("Request your username", comment: "")
case .voting:
titleLabel.text = username ?? ""
let startDate = Date(timeIntervalSince1970: VotingConstants.votingStartTime)
let endDate = Date(timeIntervalSince1970: VotingConstants.votingEndTime)
let startDateStr = DWDateFormatter.sharedInstance.dateOnly(from: startDate)
let endDateStr = DWDateFormatter.sharedInstance.dateOnly(from: endDate)
let votingPeriod = "\(startDateStr) - \(endDateStr)"
subtitleLabel.text = String.localizedStringWithFormat(NSLocalizedString("Requested · Voting: %@", comment: ""), votingPeriod)
}
}
}

28 changes: 0 additions & 28 deletions DashPay/Presentation/Profile/UserProfile/DWDPWelcomeMenuView.h

This file was deleted.

126 changes: 0 additions & 126 deletions DashPay/Presentation/Profile/UserProfile/DWDPWelcomeMenuView.m

This file was deleted.

Loading

0 comments on commit 67a07da

Please sign in to comment.