add contactView

dev
wenlei 9 months ago
parent 385ab8b2bf
commit 31f371d2a1

@ -110,6 +110,7 @@
7773EBF82B8A0A8E0054CFE6 /* RefreshFooter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7773EBF72B8A0A8E0054CFE6 /* RefreshFooter.swift */; };
7773EBFA2B8B3D4D0054CFE6 /* CircularIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7773EBF92B8B3D4D0054CFE6 /* CircularIndicatorView.swift */; };
7773EBFC2B8B7C2C0054CFE6 /* ScrollableNavBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7773EBFB2B8B7C2C0054CFE6 /* ScrollableNavBar.swift */; };
77754A7D2B9C0755007534FF /* ContactViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77754A7C2B9C0755007534FF /* ContactViewController.swift */; };
778638942B4D123D00B00AF9 /* CommentDetailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 778638932B4D123D00B00AF9 /* CommentDetailViewModel.swift */; };
778B8A212AF8E36D0034AFD4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 778B8A202AF8E36D0034AFD4 /* AppDelegate.swift */; };
778B8A232AF8E36D0034AFD4 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 778B8A222AF8E36D0034AFD4 /* SceneDelegate.swift */; };
@ -392,6 +393,7 @@
7773EBF72B8A0A8E0054CFE6 /* RefreshFooter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefreshFooter.swift; sourceTree = "<group>"; };
7773EBF92B8B3D4D0054CFE6 /* CircularIndicatorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircularIndicatorView.swift; sourceTree = "<group>"; };
7773EBFB2B8B7C2C0054CFE6 /* ScrollableNavBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollableNavBar.swift; sourceTree = "<group>"; };
77754A7C2B9C0755007534FF /* ContactViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactViewController.swift; sourceTree = "<group>"; };
778638932B4D123D00B00AF9 /* CommentDetailViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommentDetailViewModel.swift; sourceTree = "<group>"; };
778B8A1D2AF8E36D0034AFD4 /* IndieMusic.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IndieMusic.app; sourceTree = BUILT_PRODUCTS_DIR; };
778B8A202AF8E36D0034AFD4 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@ -1088,6 +1090,7 @@
77A659DE2B51023100B408C3 /* TestViewController.swift */,
7773EBFB2B8B7C2C0054CFE6 /* ScrollableNavBar.swift */,
770FC4082B95929E0023DE28 /* VersionViewController.swift */,
77754A7C2B9C0755007534FF /* ContactViewController.swift */,
);
path = Setting;
sourceTree = "<group>";
@ -1513,6 +1516,7 @@
77C9B9C62B4B81890006C83F /* Timing.swift in Sources */,
77C9B9EB2B4BE7E50006C83F /* Comment.swift in Sources */,
778B8A832AF8ECE50034AFD4 /* HomeViewController.swift in Sources */,
77754A7D2B9C0755007534FF /* ContactViewController.swift in Sources */,
77C9B9CA2B4B90D40006C83F /* PhotoConfirmViewController.swift in Sources */,
77C9C08A2B884017000A277B /* PersonalSongViewController.swift in Sources */,
778B8ABE2AF8ED280034AFD4 /* ViewModel.swift in Sources */,
@ -1896,7 +1900,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 8;
CURRENT_PROJECT_VERSION = 9;
DEVELOPMENT_TEAM = AY569L2R6W;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;
@ -1937,7 +1941,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 8;
CURRENT_PROJECT_VERSION = 9;
DEVELOPMENT_TEAM = AY569L2R6W;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;

@ -69,6 +69,7 @@ class Navigator {
case player(viewModel: PlayerViewModel)
case commentableWeb(viewModel: CommentableWebViewModel)
case version(viewMode: VersionViewModel)
case contact
case alert
case test
@ -192,6 +193,8 @@ class Navigator {
case .version(let viewModel):
let version = VersionViewController.init(viewModel: viewModel, navigator: self)
return version
case .contact:
return ContactViewController.init(viewModel: nil, navigator: self)
case .alert:
return AlertViewController.init()

@ -236,10 +236,14 @@ class CardPresentationController: PresentationController, UIGestureRecognizerDel
self?.containerView?.backgroundColor = UIColor.black.withAlphaComponent(0.8)
}, completion: nil)
let tapGesture = UITapGestureRecognizer.init(target: self, action: #selector(dismiss))
tapGesture.delegate = self
if isTapDismiss {
let tapGesture = UITapGestureRecognizer.init(target: self, action: #selector(dismiss))
tapGesture.delegate = self
self.containerView?.addGestureRecognizer(tapGesture)
self.containerView?.addGestureRecognizer(tapGesture)
}
}
}

@ -31,6 +31,7 @@ struct Configs {
static let universalLink = ""
static let bundleIdentifier = "cn.indie.queyue"
static let wechatURL = "https://api.weixin.qq.com"
static let wechatContact = "indier"
}

@ -895,6 +895,8 @@ class PlayerSlider: UIView {
}
func formatTimeForDisplay(seconds: TimeInterval) -> String {
guard !seconds.isNaN else { return "00:00"}
let hours = Int(seconds) / 3600
let minutes = Int(seconds) % 3600 / 60
let seconds = Int(seconds) % 60

@ -0,0 +1,183 @@
//
// ContactViewController.swift
// IndieMusic
//
// Created by WenLei on 2024/3/9.
//
import UIKit
class ContactViewController: ViewController {
let contactView: ContactView = {
let contactView = ContactView.init()
return contactView
}()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func makeUI() {
view.addSubview(contactView)
}
override func bindViewModel() {
super.bindViewModel()
contactView.cancelButton.rx.tap.subscribe { _ in
self.navigator.dismiss(sender: self)
}.disposed(by: rx.disposeBag)
contactView.confirmButton.rx.tap.subscribe { _ in
self.navigator.dismiss(sender: self)
UIPasteboard.general.string = Configs.App.wechatContact
}.disposed(by: rx.disposeBag)
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
contactView.snp.makeConstraints { make in
make.centerX.equalTo(view)
make.centerY.equalTo(view)
make.left.equalTo(view).offset(46)
make.right.equalTo(view).offset(-46)
}
}
}
extension ContactViewController: UIViewControllerTransitioningDelegate {
func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController? {
let carePresentationVC = CardPresentationController.init(presentedViewController: presented, presenting: presenting)
carePresentationVC.viewType = .tips(true)
return carePresentationVC
}
}
class ContactView: UIView {
let titleLabel: UILabel = {
let titleLabel = UILabel.init()
titleLabel.font = UIFont.systemFont(ofSize: 20, weight: .medium)
titleLabel.textColor = .primaryText()
titleLabel.text = "添加微信联系我们"
return titleLabel
}()
let tipsLabel: UILabel = {
let tipsLabel = UILabel.init()
tipsLabel.textColor = .tertiaryText()
tipsLabel.font = UIFont.systemFont(ofSize: 12)
tipsLabel.text = "微信号indier"
return tipsLabel
}()
let qrCodeView: UIImageView = {
let qrCodeView = UIImageView.init()
qrCodeView.image = UIImage.init(named: "contact_qr")
return qrCodeView
}()
let cancelButton: UIButton = {
let cancelButton = UIButton.init()
cancelButton.titleLabel?.font = UIFont.systemFont(ofSize: 15)
cancelButton.backgroundColor = .init(hex: 0x000000, alpha: 0.05)
cancelButton.layer.cornerRadius = 22
cancelButton.layer.masksToBounds = true
cancelButton.setTitle("取消", for: .normal)
cancelButton.setTitleColor(.secondaryText(), for: .normal)
return cancelButton
}()
let confirmButton: UIButton = {
let confirmButton = UIButton.init()
confirmButton.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .medium)
confirmButton.setTitle("复制微信", for: .normal)
confirmButton.setTitleColor(.white, for: .normal)
confirmButton.layer.cornerRadius = 22
confirmButton.layer.masksToBounds = true
confirmButton.backgroundColor = .primary()
return confirmButton
}()
override init(frame: CGRect) {
super.init(frame: frame)
makeUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func makeUI() {
backgroundColor = .white
layer.cornerRadius = 12
layer.masksToBounds = true
addSubview(titleLabel)
addSubview(tipsLabel)
addSubview(qrCodeView)
addSubview(cancelButton)
addSubview(confirmButton)
}
override func layoutSubviews() {
super.layoutSubviews()
titleLabel.snp.makeConstraints { make in
make.centerX.equalTo(self)
make.top.equalTo(self).offset(24)
}
tipsLabel.snp.makeConstraints { make in
make.centerX.equalTo(self)
make.top.equalTo(titleLabel.snp.bottom).offset(3)
}
qrCodeView.snp.makeConstraints { make in
make.top.equalTo(tipsLabel.snp.bottom).offset(9)
make.size.equalTo(CGSize.init(width: 142, height: 142))
make.centerX.equalTo(self)
}
cancelButton.snp.makeConstraints { make in
make.left.equalTo(self).offset(18)
make.right.equalTo(self.snp.centerX).offset(-6)
make.height.equalTo(44)
make.top.equalTo(qrCodeView.snp.bottom).offset(28)
make.bottom.equalTo(self).offset(-24)
}
confirmButton.snp.makeConstraints { make in
make.right.equalTo(self).offset(-18)
make.top.equalTo(qrCodeView.snp.bottom).offset(28)
make.height.equalTo(44)
make.left.equalTo(self.snp.centerX).offset(6)
make.bottom.equalTo(self).offset(-24)
}
}
}

@ -111,7 +111,10 @@ class ThanksViewController: ViewController, UIScrollViewDelegate {
}.disposed(by: rx.disposeBag)
thanksBottomView.button.rx.tap.subscribe { [weak self] _ in
self?.navigator.show(segue: .contact, sender: self, transition: .navigationPresent(type: .tips(true)))
}.disposed(by: rx.disposeBag)
}

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "contact_qr.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Loading…
Cancel
Save