Handle memory issues

dev
wenlei 11 months ago
parent acf994d619
commit 5d79917804

@ -136,6 +136,8 @@
77C9B9ED2B4BEA610006C83F /* CommentListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77C9B9EC2B4BEA610006C83F /* CommentListViewModel.swift */; };
77C9B9EF2B4C2A910006C83F /* AudioTrackListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77C9B9EE2B4C2A910006C83F /* AudioTrackListViewController.swift */; };
77C9B9F12B4C2B3A0006C83F /* AudioTrackListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77C9B9F02B4C2B3A0006C83F /* AudioTrackListViewModel.swift */; };
77DFA9C52B4E8388005B8B13 /* MineDownloadViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77DFA9C42B4E8388005B8B13 /* MineDownloadViewController.swift */; };
77DFA9C72B4E83B0005B8B13 /* MineDownloadViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77DFA9C62B4E83B0005B8B13 /* MineDownloadViewModel.swift */; };
77FA0B282B0B3E1E00404C5E /* Journal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77FA0B272B0B3E1E00404C5E /* Journal.swift */; };
77FA0B2A2B0B5F0D00404C5E /* AudioMoreActionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77FA0B292B0B5F0D00404C5E /* AudioMoreActionView.swift */; };
77FA0B2C2B0C480B00404C5E /* AudioMoreActionViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77FA0B2B2B0C480B00404C5E /* AudioMoreActionViewModel.swift */; };
@ -331,6 +333,8 @@
77C9B9EC2B4BEA610006C83F /* CommentListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommentListViewModel.swift; sourceTree = "<group>"; };
77C9B9EE2B4C2A910006C83F /* AudioTrackListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioTrackListViewController.swift; sourceTree = "<group>"; };
77C9B9F02B4C2B3A0006C83F /* AudioTrackListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioTrackListViewModel.swift; sourceTree = "<group>"; };
77DFA9C42B4E8388005B8B13 /* MineDownloadViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MineDownloadViewController.swift; sourceTree = "<group>"; };
77DFA9C62B4E83B0005B8B13 /* MineDownloadViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MineDownloadViewModel.swift; sourceTree = "<group>"; };
77FA0B272B0B3E1E00404C5E /* Journal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Journal.swift; sourceTree = "<group>"; };
77FA0B292B0B5F0D00404C5E /* AudioMoreActionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioMoreActionView.swift; sourceTree = "<group>"; };
77FA0B2B2B0C480B00404C5E /* AudioMoreActionViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioMoreActionViewModel.swift; sourceTree = "<group>"; };
@ -697,6 +701,8 @@
77FA0B572B0F4C0800404C5E /* MineSingleViewModel.swift */,
77FB7A752B4A4B5600B64030 /* MineJournalViewController.swift */,
77FB7A772B4A4B6400B64030 /* MineJournalViewModel.swift */,
77DFA9C42B4E8388005B8B13 /* MineDownloadViewController.swift */,
77DFA9C62B4E83B0005B8B13 /* MineDownloadViewModel.swift */,
);
path = Mine;
sourceTree = "<group>";
@ -1187,7 +1193,9 @@
778B8A9A2AF8ECFC0034AFD4 /* AudioManager.swift in Sources */,
774A180E2B07000C00F56DF1 /* JournalDetailView.swift in Sources */,
778B8A842AF8ECE50034AFD4 /* HomeTabBarController.swift in Sources */,
77DFA9C52B4E8388005B8B13 /* MineDownloadViewController.swift in Sources */,
77FA0B3A2B0C55D900404C5E /* FilterViewModel.swift in Sources */,
77DFA9C72B4E83B0005B8B13 /* MineDownloadViewModel.swift in Sources */,
778B8A9E2AF8ECFC0034AFD4 /* ThemeManager.swift in Sources */,
77C9B9CD2B4B93F40006C83F /* PersonalViewController.swift in Sources */,
7751D3682B42E96200F1F2BD /* ThanksViewController.swift in Sources */,
@ -1414,7 +1422,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = com.luoo.IndieMusic;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@ -1451,7 +1459,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = com.luoo.IndieMusic;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";

@ -26,8 +26,9 @@ class Navigator {
case audioMore(viewModel: AudioMoreActionViewModel)
case share(viewModel: ShareActionViewModel)
case musicStyle(viewModel: MusicStyleViewModel)
case mineSingle(viewModel: MineViewModel)
case mineSingle(viewModel: MineSingleViewModel)
case mineJourna(viewModel: MineJournalViewModel)
case mineDownload(viewModel: MineDownloadViewModel)
case setting(viewModel: SettingViewMdel)
case message(viewModel: MessageViewModel)
case editInfo(viewModel: EditInfoViewModel)
@ -51,6 +52,11 @@ class Navigator {
case audioTrackList(viewModel: AudioTrackListViewModel)
case photoConfirm
case phoneCode(viewModel: PhoneCodeViewModel)
case login(viewModel: LoginViewModel)
case bindPhone(viewModel: BindPhoneViewModel)
case alert
case test
case safari(URL)
@ -103,6 +109,8 @@ class Navigator {
return MineSingleController.init(viewModel: viewModel, navigator: self)
case .mineJourna(viewModel: let viewModel):
return MineJournalViewController.init(viewModel: viewModel, navigator: self)
case .mineDownload(viewModel: let viewModel):
return MineDownloadViewController.init(viewModel: viewModel, navigator: self)
case .setting(viewModel: let viewModel):
return SettingViewController.init(viewModel: viewModel, navigator: self)
case .message(viewModel: let viewModel):
@ -146,6 +154,13 @@ class Navigator {
case .photoConfirm:
return PhotoConfirmViewController.init()
case .phoneCode(viewModel: let viewModel):
return PhoneCodeController(viewModel: viewModel, navigator: self)
case .login(viewModel: let viewModel):
return LoginViewController(viewModel: viewModel, navigator: self)
case .bindPhone(viewModel: let viewModel):
return BindPhoneViewController(viewModel: viewModel, navigator: self)
case .alert:
return AlertViewController.init()
case .test:

@ -52,6 +52,21 @@ class CardPresentationController: PresentationController {
super.init(presentedViewController: presentedViewController, presenting: presentingViewController)
// switch viewType {
// case .audioMore:
//
// case .tips(let isTapDismiss):
// if isTapDismiss {
// let tapGes = UITapGestureRecognizer.init(target: self, action: #selector(dismiss))
// self.containerView?.addGestureRecognizer(tapGes)
// }
// default:
// break
// }
}
override var frameOfPresentedViewInContainerView: CGRect {
@ -113,6 +128,10 @@ class CardPresentationController: PresentationController {
self?.containerView?.backgroundColor = UIColor.black.withAlphaComponent(0.8)
}, completion: nil)
let tapGes = UITapGestureRecognizer.init(target: self, action: #selector(dismiss))
self.containerView?.addGestureRecognizer(tapGes)
case .share:
coordinator.animate(alongsideTransition: { [weak self] _ in
@ -135,16 +154,24 @@ class CardPresentationController: PresentationController {
self?.containerView?.backgroundColor = UIColor.black.withAlphaComponent(0.8)
}, completion: nil)
if isTapDismiss {
let tapGes = UITapGestureRecognizer.init(target: self, action: #selector(dismiss))
self.containerView?.addGestureRecognizer(tapGes)
}
let tapGes = UITapGestureRecognizer.init(target: self, action: #selector(dismiss))
self.containerView?.addGestureRecognizer(tapGes)
}
}
}
@objc func dismiss() {
@objc func dismiss(gesture: UITapGestureRecognizer) {
let touchLocation = gesture.location(in: containerView)
guard let presentedView = presentedView, presentedView.frame.contains(touchLocation) == false else { return }
presentedViewController.dismiss(animated: true)
}
override func dismissalTransitionWillBegin() {

@ -88,9 +88,9 @@ class FilterViewController: ViewController {
output.items.bind(to: collectionView.rx.items(dataSource: dataSource)).disposed(by: rx.disposeBag)
output.itemSelected.subscribe { sectionItem in
output.itemSelected.subscribe { [weak self] sectionItem in
self.navigator.dismiss(sender: self)
self?.navigator.dismiss(sender: self)
}.disposed(by: rx.disposeBag)
}

@ -96,7 +96,7 @@ class HomeViewController: TableViewController {
output.items.bind(to: tableView.rx.items(dataSource: dataSource)).disposed(by: rx.disposeBag)
output.itemSelected.subscribe { sectionItem in
output.itemSelected.subscribe { [weak self] sectionItem in
switch sectionItem {
@ -105,7 +105,7 @@ class HomeViewController: TableViewController {
let journalDetailViewModel = JournalDetailViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .journalDetail(viewModel: journalDetailViewModel), sender: self)
self?.navigator.show(segue: .journalDetail(viewModel: journalDetailViewModel), sender: self)
}

@ -72,17 +72,17 @@ class AudioMoreActionController: ViewController, UIScrollViewDelegate {
output.items.bind(to: tableView.rx.items(dataSource: dataSource)).disposed(by: rx.disposeBag)
output.itemSelected.subscribe { sectionItem in
output.itemSelected.subscribe { [weak self] sectionItem in
}.disposed(by: rx.disposeBag)
output.selection.drive { indexPath in
output.selection.drive { [weak self] indexPath in
guard let vc = self.presentingViewController else { return }
guard let vc = self?.presentingViewController else { return }
self.navigator.dismiss(sender: self)
self?.navigator.dismiss(sender: self)
let share = ShareActionViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .share(viewModel: share), sender: vc, transition: .navigationPresent(type: .share))
self?.navigator.show(segue: .share(viewModel: share), sender: vc, transition: .navigationPresent(type: .share))
}.disposed(by: rx.disposeBag)
@ -90,8 +90,8 @@ class AudioMoreActionController: ViewController, UIScrollViewDelegate {
audioMoreActionBottomView.closeButton.rx.tap.subscribe { _ in
self.navigator.dismiss(sender: self)
audioMoreActionBottomView.closeButton.rx.tap.subscribe { [weak self] _ in
self?.navigator.dismiss(sender: self)
}.disposed(by: rx.disposeBag)

@ -43,7 +43,7 @@ class CommentDetailViewController: TableViewController {
output.itemSelected.subscribe { sectionItem in
output.itemSelected.subscribe { [weak self] sectionItem in
}.disposed(by: rx.disposeBag)

@ -45,7 +45,7 @@ class CommentViewController: TableViewController {
output.itemSelected.subscribe { sectionItem in
output.itemSelected.subscribe { [weak self] sectionItem in
}.disposed(by: rx.disposeBag)

@ -79,17 +79,17 @@ class JournalDetailController: ViewController, UIScrollViewDelegate {
let output = viewModel.transform(input: input)
let dataSource = JournalDetailController.dataSource { cell, audioTrack in
let dataSource = JournalDetailController.dataSource { [weak self] cell, audioTrack in
let audioMoreActionViewModel = AudioMoreActionViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .audioMore(viewModel: audioMoreActionViewModel), sender: self, transition: .navigationPresent(type: .audioMore))
self?.navigator.show(segue: .audioMore(viewModel: audioMoreActionViewModel), sender: self, transition: .navigationPresent(type: .audioMore))
}
output.items.bind(to: tableView.rx.items(dataSource: dataSource)).disposed(by: rx.disposeBag)
output.itemSelected.subscribe { sectionItem in
output.itemSelected.subscribe { [weak self] sectionItem in
switch sectionItem {
default: break
@ -104,11 +104,11 @@ class JournalDetailController: ViewController, UIScrollViewDelegate {
.bind(to: self.headerView.dropButton.rx.isSelected)
.disposed(by: rx.disposeBag)
viewModel.isExpand.subscribe { isExpand in
viewModel.isExpand.subscribe { [weak self] isExpand in
print("dropButtonTrigger \(isExpand)")
self.headerView.isExpand = isExpand
self.updateHeader()
self?.headerView.isExpand = isExpand
self?.updateHeader()
} .disposed(by: rx.disposeBag)

@ -64,13 +64,13 @@ class ShareActionController: ViewController {
output.items.bind(to: collectionView.rx.items(dataSource: dataSource)).disposed(by: rx.disposeBag)
output.itemSelected.subscribe { sectionItem in
output.itemSelected.subscribe { [weak self] sectionItem in
}.disposed(by: rx.disposeBag)
audioMoreActionBottomView.closeButton.rx.tap.subscribe { _ in
self.navigator.dismiss(sender: self)
audioMoreActionBottomView.closeButton.rx.tap.subscribe { [weak self] _ in
self?.navigator.dismiss(sender: self)
}.disposed(by: rx.disposeBag)

@ -81,13 +81,12 @@ class BindPhoneViewController: ViewController {
override func bindViewModel() {
super.bindViewModel()
guard let viewModel = self.viewModel as? BindPhoneViewModel else { return }
loginButton.rx.tap.subscribe { _ in
let code = PhoneCodeController.init(viewModel: self.viewModel, navigator: self.navigator)
self.navigationController?.pushViewController(code, animated: true)
loginButton.rx.tap.subscribe { [weak self] _ in
let phoneCodeViewModel = PhoneCodeViewModel.init(phone: "", provider: viewModel.provider)
self?.navigator.show(segue: .phoneCode(viewModel: phoneCodeViewModel), sender: self)
}.disposed(by: rx.disposeBag)
}

@ -10,7 +10,7 @@ import UIKit
class LoginViewController: ViewController {
var backgroundImageView: UIImageView = {
let backgroundImageView = UIImageView.init(image: UIImage.init(named: "login_bakcground"))
let backgroundImageView = UIImageView.init(image: UIImage.init(named: "launch_bakcground"))
// backgroundImageView.contentMode = .bottom
return backgroundImageView
@ -112,7 +112,7 @@ class LoginViewController: ViewController {
_ = phoneView.phoneTextFiele.rx.textInput <-> viewModel.phone
loginButton.rx.tap.subscribe { _ in
loginButton.rx.tap.subscribe { [weak self] _ in
// let phoneCodeViewModel = PhoneCodeViewModel.init(phone: "+86 18551843868", provider: viewModel.provider)
@ -121,10 +121,8 @@ class LoginViewController: ViewController {
// self.navigationController?.pushViewController(code, animated: true)
let bindPhoneViewModel = BindPhoneViewModel.init(provider: viewModel.provider)
let phone = BindPhoneViewController.init(viewModel: bindPhoneViewModel, navigator: self.navigator)
self.navigationController?.pushViewController(phone, animated: true)
self?.navigator.show(segue: .bindPhone(viewModel: bindPhoneViewModel), sender: self)
}.disposed(by: rx.disposeBag)
}

@ -115,9 +115,9 @@ class PhoneCodeController: ViewController {
.disposed(by: rx.disposeBag)
output.isButtonEnabled
.drive(onNext: { isEnabled in
self.codeButton.isEnabled = isEnabled
self.codeButton.setTitleColor(isEnabled ? UIColor.primaryText() : UIColor.tertiaryText(), for: .normal)
.drive(onNext: { [weak self] isEnabled in
self?.codeButton.isEnabled = isEnabled
self?.codeButton.setTitleColor(isEnabled ? UIColor.primaryText() : UIColor.tertiaryText(), for: .normal)
})
.disposed(by: rx.disposeBag)

@ -23,7 +23,7 @@
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="launch_icon" translatesAutoresizingMaskIntoConstraints="NO" id="Vhs-1v-WXg">
<rect key="frame" x="135.66666666666666" y="384" width="121.99999999999997" height="18"/>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="login_bakcground" translatesAutoresizingMaskIntoConstraints="NO" id="Adv-Ys-NiE">
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="launch_bakcground" translatesAutoresizingMaskIntoConstraints="NO" id="Adv-Ys-NiE">
<rect key="frame" x="0.0" y="477" width="393" height="375"/>
<constraints>
<constraint firstAttribute="height" constant="375" id="wva-Ot-qwI"/>
@ -49,9 +49,9 @@
</scene>
</scenes>
<resources>
<image name="launch_bakcground" width="375" height="375"/>
<image name="launch_icon" width="122" height="18"/>
<image name="launch_slogn" width="90" height="90"/>
<image name="login_bakcground" width="375" height="352"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>

@ -76,10 +76,10 @@ class MessageViewController: ViewController, UIScrollViewDelegate {
output.tableViewItems.bind(to: tableView.rx.items(dataSource: dataSource)).disposed(by: rx.disposeBag)
output.tableViewItemSelected.subscribe { message in
output.tableViewItemSelected.subscribe { [weak self] message in
let commentListViewModel = CommentListViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .commentList(viewModel: commentListViewModel), sender: self)
self?.navigator.show(segue: .commentList(viewModel: commentListViewModel), sender: self)
}.disposed(by: rx.disposeBag)

@ -0,0 +1,20 @@
//
// MineDownloadViewController.swift
// IndieMusic
//
// Created by WenLei on 2024/1/10.
//
import UIKit
class MineDownloadViewController: ViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}

@ -0,0 +1,53 @@
//
// MineDownloadViewModel.swift
// IndieMusic
//
// Created by WenLei on 2024/1/10.
//
import Foundation
import RxSwift
import RxCocoa
class MineDownloadViewModel: ViewModel, ViewModelType {
struct Input {
let viewWillAppear: ControlEvent<Bool>
let selection: Driver<IndexPath>
}
struct Output {
let items: BehaviorRelay<[MineSingleSection]>
let selection: Driver<IndexPath>
let itemSelected: PublishSubject<MineSingle>
}
let itemSelected = PublishSubject<MineSingle>()
let items = BehaviorRelay<[MineSingleSection]>.init(value: [])
func transform(input: Input) -> Output {
input.viewWillAppear.subscribe { (_) in
}.disposed(by: rx.disposeBag)
let mine = MineSingle.init(cover: "", title: "", detail: "")
items.accept([MineSingleSection.init(items: [mine, mine, mine])])
input.selection.drive { indexPath in
guard let sectionItem = self.items.value.first?.items[indexPath.row] else { return }
self.itemSelected.onNext(sectionItem)
}.disposed(by: rx.disposeBag)
return Output.init(items: items,
selection: input.selection,
itemSelected: itemSelected)
}
}

@ -72,7 +72,7 @@ class MineJournalViewController: ViewController {
output.items.bind(to: collectionView.rx.items(dataSource: dataSource)).disposed(by: rx.disposeBag)
output.itemSelected.subscribe { sectionItem in
output.itemSelected.subscribe { [weak self] sectionItem in
switch sectionItem {
default: break

@ -10,13 +10,26 @@ import RxSwift
import RxCocoa
import RxDataSources
class MineSingleController: TableViewController, UITableViewDataSource {
class MineSingleController: ViewController {
let mineSingleNoDataView: MineSingleNoDataView = {
let mineSingleNoDataView = MineSingleNoDataView.init()
mineSingleNoDataView.isHidden = true
return mineSingleNoDataView
}()
let headerView: MineSingleHeaderView = {
let headerView = MineSingleHeaderView.init()
return headerView
}()
let tableView: UITableView = {
let tableView = UITableView.init()
tableView.register(SongViewCell.self, forCellReuseIdentifier: "SongViewCell")
return tableView
}()
override func viewDidLoad() {
super.viewDidLoad()
@ -32,14 +45,14 @@ class MineSingleController: TableViewController, UITableViewDataSource {
view.backgroundColor = .white
// tableView.delegate = self
tableView.dataSource = self
tableView.register(SongViewCell.self
, forCellReuseIdentifier: "SongViewCell")
tableView.register(MineSingleHeaderView.self, forHeaderFooterViewReuseIdentifier: "MineSingleHeaderView")
view.addSubview(mineSingleNoDataView)
view.addSubview(headerView)
view.addSubview(tableView)
}
override func bindViewModel() {
@ -51,10 +64,10 @@ class MineSingleController: TableViewController, UITableViewDataSource {
selection: tableView.rx.itemSelected.asDriver())
let output = viewModel.transform(input: input)
let dataSource = MineSingleController.dataSource { cell, audioTrack in
let dataSource = MineSingleController.dataSource { [weak self] cell, audioTrack in
let audioMoreActionViewModel = AudioMoreActionViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .audioMore(viewModel: audioMoreActionViewModel), sender: self, transition: .navigationPresent(type: .audioMore))
self?.navigator.show(segue: .audioMore(viewModel: audioMoreActionViewModel), sender: self, transition: .navigationPresent(type: .audioMore))
}
@ -63,7 +76,7 @@ class MineSingleController: TableViewController, UITableViewDataSource {
output.items.bind(to: tableView.rx.items(dataSource: dataSource)).disposed(by: rx.disposeBag)
output.itemSelected.subscribe { sectionItem in
output.itemSelected.subscribe { [weak self] sectionItem in
}.disposed(by: rx.disposeBag)
@ -75,6 +88,20 @@ class MineSingleController: TableViewController, UITableViewDataSource {
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
headerView.snp.makeConstraints { make in
make.left.equalTo(view)
make.right.equalTo(view)
make.top.equalTo(view)
make.height.equalTo(64)
}
tableView.snp.makeConstraints { make in
make.left.equalTo(view)
make.right.equalTo(view)
make.top.equalTo(headerView.snp.bottom)
make.bottom.equalTo(view)
}
mineSingleNoDataView.snp.makeConstraints { make in
make.left.equalTo(view)
make.right.equalTo(view)
@ -87,37 +114,37 @@ class MineSingleController: TableViewController, UITableViewDataSource {
extension MineSingleController {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if let cell = tableView.dequeueReusableCell(withIdentifier: "SongViewCell", for: indexPath) as? SongViewCell {
cell.titleLabel.text = "123"
cell.detailLabel.text = "321"
cell.buttonTapCallback = {[weak self] audioTrack in
guard let viewModel = self?.viewModel as? MineSingleViewModel else { return }
let audioMoreActionViewModel = AudioMoreActionViewModel.init(provider: viewModel.provider)
self?.navigator.show(segue: .audioMore(viewModel: audioMoreActionViewModel), sender: self, transition: .navigationPresent(type: .audioMore))
}
return cell
}
return UITableViewCell()
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let header = MineSingleHeaderView.init()
return header
}
// func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// return 1
// }
//
// func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// if let cell = tableView.dequeueReusableCell(withIdentifier: "SongViewCell", for: indexPath) as? SongViewCell {
// cell.titleLabel.text = "123"
// cell.detailLabel.text = "321"
//
//
// cell.buttonTapCallback = {[weak self] audioTrack in
// guard let viewModel = self?.viewModel as? MineSingleViewModel else { return }
//
// let audioMoreActionViewModel = AudioMoreActionViewModel.init(provider: viewModel.provider)
//
// self?.navigator.show(segue: .audioMore(viewModel: audioMoreActionViewModel), sender: self, transition: .navigationPresent(type: .audioMore))
//
// }
//
// return cell
// }
// return UITableViewCell()
// }
//
//
// func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
//
// let header = MineSingleHeaderView.init()
// return header
//
// }
}
extension MineSingleController {
@ -142,21 +169,39 @@ extension MineSingleController {
}
class MineSingleHeaderView: UITableViewHeaderFooterView {
class MineSingleHeaderView: UIView {
let playAllButton: UIButton = {
let playAllButton = UIButton.init()
var configuration = UIButton.Configuration.plain()
configuration.title = "播放全部"
configuration.image = UIImage(systemName: "audio_playAll_btn")
configuration.baseBackgroundColor = .white
configuration.titlePadding = 9
configuration.imagePadding = 9
configuration.contentInsets = NSDirectionalEdgeInsets(top: 10, leading: 10, bottom: 10, trailing: 10)
let attributes: [NSAttributedString.Key: Any] = [
.foregroundColor: UIColor.primaryText(),
.font: UIFont.systemFont(ofSize: 15, weight: .medium)
]
// configuration.attributedTitle = AttributedString("", attributes: attributes)
configuration.attributedTitle = AttributedString("播放全部", attributes: .init(attributes))
let playAllButton = UIButton.init(configuration: configuration)
playAllButton.setImage(UIImage.init(named: "audio_playAll_btn"), for: .normal)
playAllButton.setTitle("播放全部", for: .normal)
playAllButton.setTitleColor(.primaryText(), for: .normal)
playAllButton.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .medium)
// playAllButton.imageEdgeInsets
return playAllButton
}()
override init(reuseIdentifier: String?) {
super.init(reuseIdentifier: reuseIdentifier)
makeUI()
override init(frame: CGRect) {
super.init(frame: frame)
makeUI()
}
required init?(coder: NSCoder) {
@ -172,17 +217,17 @@ class MineSingleHeaderView: UITableViewHeaderFooterView {
func makeUI() {
contentView.backgroundColor = .white
backgroundColor = .white
contentView.addSubview(playAllButton)
addSubview(playAllButton)
}
override func layoutSubviews() {
super.layoutSubviews()
playAllButton.snp.makeConstraints { make in
make.left.equalTo(contentView).offset(18)
make.centerY.equalTo(contentView)
make.left.equalTo(self).offset(18)
make.centerY.equalTo(self)
}
}

@ -205,7 +205,7 @@ class MineMenuView: UIView {
}
class MineMenuSubView: UIView {
class MineMenuSubView: UIControl {
lazy var titleLabel: UILabel = {
let titleLabel = UILabel.init()
titleLabel.font = UIFont.systemFont(ofSize: 12)

@ -18,12 +18,12 @@ class MineViewController: TableViewController {
}()
lazy var messageBarButton: BarButtonItem = {
let view = BarButtonItem(image: UIImage.init(named: "mine_message_btn"), style: .plain, target: nil, action: nil)
let view = BarButtonItem(image: UIImage.init(named: "mine_message_btn")?.withRenderingMode(.alwaysOriginal), style: .plain, target: nil, action: nil)
return view
}()
lazy var settingBarButton: BarButtonItem = {
let view = BarButtonItem(image: UIImage.init(named: "mine_setting_btn"), style: .plain, target: nil, action: nil)
let view = BarButtonItem(image: UIImage.init(named: "mine_setting_btn")?.withRenderingMode(.alwaysOriginal), style: .plain, target: nil, action: nil)
return view
}()
@ -73,6 +73,10 @@ class MineViewController: TableViewController {
let fixedSpaceBarButtonItem = UIBarButtonItem.init(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
fixedSpaceBarButtonItem.width = -10
let spacerView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 1))
let spacer = UIBarButtonItem(customView: spacerView)
navigationItem.rightBarButtonItems = [settingBarButton, fixedSpaceBarButtonItem, messageBarButton]
@ -90,37 +94,72 @@ class MineViewController: TableViewController {
selection: tableView.rx.itemSelected.asDriver())
let output = viewModel.transform(input: input)
let dataSource = MineViewController.dataSource()
output.items.bind(to: tableView.rx.items(dataSource: dataSource)).disposed(by: rx.disposeBag)
headerView.mineMenuView.followingView.rx.controlEvent(.touchUpInside).subscribe { [weak self] _ in
let followingViewModel = FollowingViewModel.init(provider: viewModel.provider)
self?.navigator.show(segue: .following(viewModel: followingViewModel), sender: self)
}.disposed(by: rx.disposeBag)
output.itemSelected.subscribe { sectionItem in
headerView.mineMenuView.followersView.rx.controlEvent(.touchUpInside).subscribe { [weak self] _ in
let followersViewModel = FollowersViewModel.init(provider: viewModel.provider)
self?.navigator.show(segue: .followers(viewModel: followersViewModel), sender: self)
//
// let mineViewModel = MineViewModel.init(provider: viewModel.provider)
// self.navigator.show(segue: .mineSingle(viewModel: mineViewModel), sender: self)
}.disposed(by: rx.disposeBag)
headerView.mineMenuView.likeView.rx.controlEvent(.touchUpInside).subscribe { [weak self] _ in
let likeListViewModel = LikeListViewModel.init(provider: viewModel.provider)
self?.navigator.show(segue: .likeList(viewModel: likeListViewModel), sender: self)
let mineJournalViewModel = MineJournalViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .mineJourna(viewModel: mineJournalViewModel), sender: self)
}.disposed(by: rx.disposeBag)
headerView.mineMenuView.commentView.rx.controlEvent(.touchUpInside).subscribe { [weak self] _ in
let commentListViewModel = CommentListViewModel.init(provider: viewModel.provider)
self?.navigator.show(segue: .commentList(viewModel: commentListViewModel), sender: self)
}.disposed(by: rx.disposeBag)
let dataSource = MineViewController.dataSource()
output.items.bind(to: tableView.rx.items(dataSource: dataSource)).disposed(by: rx.disposeBag)
output.selection.drive { [weak self] indexPath in
switch indexPath.row {
case 0:
let mineSingleViewModel = MineSingleViewModel.init(provider: viewModel.provider)
self?.navigator.show(segue: .mineSingle(viewModel: mineSingleViewModel), sender: self)
case 1:
let mineJournalViewModel = MineJournalViewModel.init(provider: viewModel.provider)
self?.navigator.show(segue: .mineJourna(viewModel: mineJournalViewModel), sender: self)
case 2:
let mineDownloadViewModel = MineDownloadViewModel.init(provider: viewModel.provider)
self?.navigator.show(segue: .mineDownload(viewModel: mineDownloadViewModel), sender: self)
default: break
}
}.disposed(by: rx.disposeBag)
settingBarButton.rx.tap.subscribe { _ in
settingBarButton.rx.tap.subscribe { [weak self] _ in
let settingViewModel = SettingViewMdel.init(provider: viewModel.provider)
self.navigator.show(segue: .setting(viewModel: settingViewModel), sender: self)
self?.navigator.show(segue: .setting(viewModel: settingViewModel), sender: self)
}.disposed(by: rx.disposeBag)
messageBarButton.rx.tap.subscribe { _ in
messageBarButton.rx.tap.subscribe { [weak self] _ in
let messageViewModel = MessageViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .message(viewModel: messageViewModel), sender: self)
self?.navigator.show(segue: .message(viewModel: messageViewModel), sender: self)
}.disposed(by: rx.disposeBag)

@ -26,6 +26,7 @@ class CommentListViewController: TableViewController {
override func makeUI() {
super.makeUI()
view.backgroundColor = .init(hex: 0xf5f5f5)
navigationItem.title = "收到的评论"
tableView.mj_header = nil
tableView.mj_footer = nil
@ -46,7 +47,7 @@ class CommentListViewController: TableViewController {
let output = viewModel.transform(input: input)
let dataSource = CommentListViewController.dataSource { cell, like in
let dataSource = CommentListViewController.dataSource { [weak self] cell, like in
}

@ -55,10 +55,6 @@ class FollowersViewController: ViewController, UIScrollViewDelegate {
override func bindViewModel() {
super.bindViewModel()
// self.segmentControl.currentSearchType = .single
guard let viewModel = viewModel as? FollowersViewModel else { return }
let input = FollowersViewModel.Input.init(viewWillAppear: rx.viewWillAppear)
@ -67,7 +63,7 @@ class FollowersViewController: ViewController, UIScrollViewDelegate {
let output = viewModel.transform(input: input)
let dataSource = FollowersViewController.dataSource { cell, following in
let dataSource = FollowersViewController.dataSource { [weak self] cell, following in
}

@ -30,6 +30,7 @@ class FollowingViewController: TableViewController {
override func makeUI() {
super.makeUI()
view.backgroundColor = .init(hex: 0xf5f5f5)
navigationItem.title = "我的关注"
tableView.mj_header = nil
tableView.mj_footer = nil
@ -56,11 +57,11 @@ class FollowingViewController: TableViewController {
output.itemSelected.subscribe { sectionItem in
output.itemSelected.subscribe { [weak self] sectionItem in
}.disposed(by: rx.disposeBag)
output.selection.drive { sectionItem in
output.selection.drive { [weak self] sectionItem in
}.disposed(by: rx.disposeBag)

@ -27,7 +27,8 @@ class LikeListViewController: TableViewController {
override func makeUI() {
super.makeUI()
view.backgroundColor = .init(hex: 0xf5f5f5)
navigationItem.title = "收到的赞"
tableView.mj_header = nil
tableView.mj_footer = nil

@ -72,10 +72,10 @@ class PersonalViewController: ViewController {
let output = viewModel.transform(input: input)
let tableViewDataSource = PersonalViewController.tableViewDataSource { cell, audioTrack in
let tableViewDataSource = PersonalViewController.tableViewDataSource { [weak self] cell, audioTrack in
let audioMoreActionViewModel = AudioMoreActionViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .audioMore(viewModel: audioMoreActionViewModel), sender: self, transition: .navigationPresent(type: .audioMore))
self?.navigator.show(segue: .audioMore(viewModel: audioMoreActionViewModel), sender: self, transition: .navigationPresent(type: .audioMore))
}
let collectionViewDataSource = SearchResultsController.collectionViewDataSource()
@ -86,36 +86,36 @@ class PersonalViewController: ViewController {
self.personalHeaderView.followingControl.rx.controlEvent(.touchUpInside).subscribe { _ in
self.personalHeaderView.followingControl.rx.controlEvent(.touchUpInside).subscribe { [weak self] _ in
let followingViewModel = FollowingViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .following(viewModel: followingViewModel), sender: self)
self?.navigator.show(segue: .following(viewModel: followingViewModel), sender: self)
}.disposed(by: rx.disposeBag)
self.personalHeaderView.followersControl.rx.controlEvent(.touchUpInside).subscribe { _ in
self.personalHeaderView.followersControl.rx.controlEvent(.touchUpInside).subscribe { [weak self] _ in
let followersViewModel = FollowersViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .followers(viewModel: followersViewModel), sender: self)
self?.navigator.show(segue: .followers(viewModel: followersViewModel), sender: self)
}.disposed(by: rx.disposeBag)
self.personalHeaderView.likeControl.rx.controlEvent(.touchUpInside).subscribe { _ in
self.personalHeaderView.likeControl.rx.controlEvent(.touchUpInside).subscribe { [weak self] _ in
let likeListViewModel = LikeListViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .likeList(viewModel: likeListViewModel), sender: self)
self?.navigator.show(segue: .likeList(viewModel: likeListViewModel), sender: self)
}.disposed(by: rx.disposeBag)
self.personalHeaderView.messageButton.rx.tap.subscribe { _ in
self.personalHeaderView.messageButton.rx.tap.subscribe { [weak self] _ in
let messageViewModel = MessageViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .message(viewModel: messageViewModel), sender: self)
self?.navigator.show(segue: .message(viewModel: messageViewModel), sender: self)
}.disposed(by: rx.disposeBag)

@ -39,10 +39,10 @@ class AudioTrackListViewController: TableViewController {
selection: tableView.rx.itemSelected.asDriver())
let output = viewModel.transform(input: input)
let dataSource = AudioTrackListViewController.dataSource { cell, audioTrack in
let dataSource = AudioTrackListViewController.dataSource { [weak self] cell, audioTrack in
let audioMoreActionViewModel = AudioMoreActionViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .audioMore(viewModel: audioMoreActionViewModel), sender: self, transition: .navigationPresent(type: .audioMore))
self?.navigator.show(segue: .audioMore(viewModel: audioMoreActionViewModel), sender: self, transition: .navigationPresent(type: .audioMore))
}
@ -51,7 +51,7 @@ class AudioTrackListViewController: TableViewController {
output.items.bind(to: tableView.rx.items(dataSource: dataSource)).disposed(by: rx.disposeBag)
output.itemSelected.subscribe { sectionItem in
output.itemSelected.subscribe { [weak self] sectionItem in
}.disposed(by: rx.disposeBag)

@ -71,7 +71,7 @@ class MusicStyleViewController: ViewController {
output.items.bind(to: collectionView.rx.items(dataSource: dataSource)).disposed(by: rx.disposeBag)
output.itemSelected.subscribe { sectionItem in
output.itemSelected.subscribe { [weak self] sectionItem in
switch sectionItem {
default: break
@ -86,11 +86,11 @@ class MusicStyleViewController: ViewController {
.bind(to: self.headerView.dropButton.rx.isSelected)
.disposed(by: rx.disposeBag)
viewModel.isExpand.subscribe { isExpand in
viewModel.isExpand.subscribe { [weak self] isExpand in
print("dropButtonTrigger \(isExpand)")
self.headerView.isExpand = isExpand
self.updateHeader()
self?.headerView.isExpand = isExpand
self?.updateHeader()
} .disposed(by: rx.disposeBag)

@ -82,10 +82,10 @@ class SearchResultsController: ViewController {
let output = viewModel.transform(input: input)
let tableViewDataSource = SearchResultsController.tableViewDataSource { cell, audioTrack in
let tableViewDataSource = SearchResultsController.tableViewDataSource { [weak self] cell, audioTrack in
let audioMoreActionViewModel = AudioMoreActionViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .audioMore(viewModel: audioMoreActionViewModel), sender: self, transition: .navigationPresent(type: .audioMore))
self?.navigator.show(segue: .audioMore(viewModel: audioMoreActionViewModel), sender: self, transition: .navigationPresent(type: .audioMore))
}
let collectionViewDataSource = SearchResultsController.collectionViewDataSource()
@ -96,8 +96,8 @@ class SearchResultsController: ViewController {
searchTopBar.cancelButton.rx.tap.subscribe { _ in
self.navigator.pop(sender: self)
searchTopBar.cancelButton.rx.tap.subscribe { [weak self] _ in
self?.navigator.pop(sender: self)
}.disposed(by: rx.disposeBag)

@ -34,7 +34,14 @@ class SearchViewController: ViewController, UIScrollViewDelegate {
}()
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if let tabbar = self.tabBarController as? HomeTabBarController {
tabbar.showTabBar(true, animated: true)
}
}
override func viewDidLoad() {
super.viewDidLoad()
@ -69,13 +76,13 @@ class SearchViewController: ViewController, UIScrollViewDelegate {
output.items.bind(to: collectionView.rx.items(dataSource: dataSource)).disposed(by: rx.disposeBag)
output.itemSelected.subscribe { sectionItem in
output.itemSelected.subscribe { [weak self] sectionItem in
// let musicStyleViewModel = MusicStyleViewModel.init(provider: viewModel.provider)
// self.navigator.show(segue: .musicStyle(viewModel: musicStyleViewModel), sender: self)
let searchResultsViewModel = SearchResultsViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .searchResults(viewModel: searchResultsViewModel), sender: self)
self?.navigator.show(segue: .searchResults(viewModel: searchResultsViewModel), sender: self)
}.disposed(by: rx.disposeBag)

@ -63,7 +63,7 @@ class AboutViewController: TableViewController {
output.items.bind(to: tableView.rx.items(dataSource: dataSource)).disposed(by: rx.disposeBag)
output.itemSelected.subscribe { sectionItem in
output.itemSelected.subscribe { [weak self] sectionItem in
}.disposed(by: rx.disposeBag)

@ -48,16 +48,16 @@ class AccountViewController: TableViewController {
output.itemSelected.subscribe { sectionItem in
output.itemSelected.subscribe { [weak self] sectionItem in
}.disposed(by: rx.disposeBag)
output.selection.drive { sectionItem in
output.selection.drive { [weak self] sectionItem in
let accountViewModel = AccountViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .account(viewModel: accountViewModel), sender: self)
self?.navigator.show(segue: .account(viewModel: accountViewModel), sender: self)
}.disposed(by: rx.disposeBag)

@ -53,16 +53,16 @@ class EditInfoViewController: TableViewController {
output.itemSelected.subscribe { sectionItem in
output.itemSelected.subscribe { [weak self] sectionItem in
}.disposed(by: rx.disposeBag)
output.selection.drive { sectionItem in
output.selection.drive { [weak self] sectionItem in
let accountViewModel = AccountViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .account(viewModel: accountViewModel), sender: self)
self?.navigator.show(segue: .account(viewModel: accountViewModel), sender: self)
}.disposed(by: rx.disposeBag)

@ -48,16 +48,16 @@ class PrivacyViewController: TableViewController {
output.itemSelected.subscribe { sectionItem in
output.itemSelected.subscribe { [weak self] sectionItem in
}.disposed(by: rx.disposeBag)
output.selection.drive { sectionItem in
output.selection.drive { [weak self] sectionItem in
let accountViewModel = AccountViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .account(viewModel: accountViewModel), sender: self)
self?.navigator.show(segue: .account(viewModel: accountViewModel), sender: self)
}.disposed(by: rx.disposeBag)

@ -74,14 +74,16 @@ class SettingViewCell: UITableViewCell {
}
detailLabel.snp.makeConstraints { make in
make.right.equalTo(arrowView.snp.left).offset(2)
make.right.equalTo(arrowView.snp.left).offset(-2)
make.centerY.equalTo(contentView)
}
titleLabel.snp.makeConstraints { make in
make.left.equalTo(contentView).offset(18)
make.centerY.equalTo(contentView)
make.right.equalTo(detailLabel.snp.left).offset(-18)
make.height.equalTo(52)
make.top.equalTo(contentView)
make.bottom.equalTo(contentView)
}
switchButton.snp.makeConstraints { make in
@ -103,6 +105,7 @@ class SettingViewFooterView: UIView {
logoutButton.titleLabel?.font = UIFont.systemFont(ofSize: 15)
logoutButton.setTitle("退出登录", for: .normal)
logoutButton.setTitleColor(.primary(), for: .normal)
logoutButton.backgroundColor = .white
return logoutButton
}()
@ -112,10 +115,14 @@ class SettingViewFooterView: UIView {
super.init(frame: frame)
addSubview(logoutButton)
backgroundColor = .white
// backgroundColor = .white
logoutButton.snp.makeConstraints { make in
make.edges.equalTo(self)
// make.edges.equalTo(self)
make.top.equalTo(self).offset(9)
make.left.equalTo(self)
make.right.equalTo(self)
make.bottom.equalTo(self)
}
}

@ -13,7 +13,7 @@ import RxDataSources
class SettingViewController: TableViewController {
let footerView: SettingViewFooterView = {
let footerView = SettingViewFooterView.init(frame: CGRect.init(x: 0, y: 0, width: BaseDimensions.screenWidth, height: 52))
return footerView
}()
@ -28,8 +28,12 @@ class SettingViewController: TableViewController {
super.makeUI()
view.backgroundColor = .init(hex: 0xf5f5f5)
navigationItem.title = "设置"
tableView.mj_header = nil
tableView.mj_footer = nil
tableView.sectionHeaderHeight = 9
tableView.sectionFooterHeight = 0
tableView.register(SettingViewCell.self, forCellReuseIdentifier: "SettingViewCell")
tableView.tableFooterView = footerView
@ -44,7 +48,7 @@ class SettingViewController: TableViewController {
guard let viewModel = viewModel as? SettingViewMdel else { return }
let input = SettingViewMdel.Input.init(viewWillAppear: rx.viewWillAppear,
selection: tableView.rx.itemSelected.asDriver())
modelSelected: tableView.rx.modelSelected(SettingType.self).asDriver())
let output = viewModel.transform(input: input)
let dataSource = SettingViewController.dataSource()
@ -54,76 +58,60 @@ class SettingViewController: TableViewController {
output.itemSelected.subscribe { sectionItem in
guard let sectionItem = sectionItem.element else { return }
output.modelSelected.drive { [weak self] sectionItem in
switch sectionItem {
case .editInfo(let setting):
case .editInfo:
let editInfo = EditInfoViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .editInfo(viewModel: editInfo), sender: self)
self?.navigator.show(segue: .editInfo(viewModel: editInfo), sender: self)
case .account(let setting):
case .account:
let accountViewModel = AccountViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .account(viewModel: accountViewModel), sender: self)
self?.navigator.show(segue: .account(viewModel: accountViewModel), sender: self)
case .privacy(let setting):
case .privacy:
let privacyViewModel = PrivacyViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .privacy(viewModel: privacyViewModel), sender: self)
self?.navigator.show(segue: .privacy(viewModel: privacyViewModel), sender: self)
case .timing(let setting):
case .timing:
let timingViewModel = TimingViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .timing(viewModel: timingViewModel), sender: self, transition: .navigationPresent(type: .timing))
self?.navigator.show(segue: .timing(viewModel: timingViewModel), sender: self, transition: .navigationPresent(type: .timing))
case .cache(let setting):
case .cache:
let cacheViewModel = CacheViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .cache(viewModel: cacheViewModel), sender: self)
self?.navigator.show(segue: .cache(viewModel: cacheViewModel), sender: self)
case .permission(let setting):
case .permission:
let accountViewModel = AccountViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .account(viewModel: accountViewModel), sender: self)
self?.navigator.show(segue: .account(viewModel: accountViewModel), sender: self)
case .feedback(let setting):
// let accountViewModel = Feedbackview.init(provider: viewModel.provider)
self.navigator.show(segue: .feedback, sender: self)
case .feedback:
self?.navigator.show(segue: .feedback, sender: self)
case .about(let setting):
case .about:
let aboutViewModel = AboutViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .about(viewModel: aboutViewModel), sender: self)
self?.navigator.show(segue: .about(viewModel: aboutViewModel), sender: self)
case .contributors(let setting):
case .contributors:
let thanksViewModel = ThanksViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .thanks(viewModel: thanksViewModel), sender: self)
self?.navigator.show(segue: .thanks(viewModel: thanksViewModel), sender: self)
case .version(let setting):
case .version:
let personalViewModel = PersonalViewModel.init(provider: viewModel.provider)
self.navigator.show(segue: .personal(viewModel: personalViewModel), sender: self)
self?.navigator.show(segue: .personal(viewModel: personalViewModel), sender: self)
case .setting(_):
break
}
// let editInfoViewModel = EditInfoViewModel.init(provider: viewModel.provider)
//
// self.navigator.show(segue: .editInfo(viewModel: editInfoViewModel), sender: self)
}.disposed(by: rx.disposeBag)
output.selection.drive { sectionItem in
// let editInfoViewModel = EditInfoViewModel.init(provider: viewModel.provider)
//
// self.navigator.show(segue: .editInfo(viewModel: editInfoViewModel), sender: self)
self.footerView.logoutButton.rx.tap.subscribe { [weak self]_ in
// let thanksViewModel = ThanksViewModel.init(provider: viewModel.provider)
//
// self.navigator.show(segue: .thanks(viewModel: thanksViewModel), sender: self)
}.disposed(by: rx.disposeBag)
}
@ -139,8 +127,10 @@ extension SettingViewController {
cell.setting = item.setting
return cell
}) { dataSource, index in
return " "
}
)
}
}

@ -15,18 +15,16 @@ class SettingViewMdel: ViewModel, ViewModelType {
struct Input {
let viewWillAppear: ControlEvent<Bool>
let selection: Driver<IndexPath>
let modelSelected: Driver<SettingType>
}
struct Output {
let items: BehaviorRelay<[SettingSection]>
let selection: Driver<IndexPath>
let itemSelected: PublishSubject<SettingType>
let modelSelected: Driver<SettingType>
}
let itemSelected = PublishSubject<SettingType>()
let items = BehaviorRelay<[SettingSection]>.init(value: [])
func transform(input: Input) -> Output {
@ -41,50 +39,28 @@ class SettingViewMdel: ViewModel, ViewModelType {
let timing = Setting.init(title: "定时关闭", detail: "", arrowIcon: "setting_arrow")
let cache = Setting.init(title: "清理缓存", detail: "", arrowIcon: "setting_arrow")
let cache = Setting.init(title: "清理缓存", detail: "201.4MB", arrowIcon: "setting_arrow")
let permission = Setting.init(title: "个人信息与权限", detail: "", arrowIcon: "setting_arrow")
let feedback = Setting.init(title: "意见反馈", detail: "", arrowIcon: "setting_arrow")
let about = Setting.init(title: "关于雀乐", detail: "", arrowIcon: "setting_arrow")
let contributors = Setting.init(title: "贡献者名单", detail: "", arrowIcon: "setting_arrow")
let version = Setting.init(title: "检查版本", detail: "", arrowIcon: "setting_arrow")
let version = Setting.init(title: "检查版本", detail: "1.0.0", arrowIcon: "setting_arrow")
let section0 = SettingSection.init(items: [.editInfo(editInfo), .account(account), .privacy(privacy)])
let section1 = SettingSection.init(items: [.timing(timing), .cache(cache), .permission(permission)])
let section2 = SettingSection.init(items: [.feedback(feedback), .about(about), .contributors(contributors), .version(version)])
items.accept([SettingSection.init(items: [.editInfo(editInfo), .account(account), .privacy(privacy), .timing(timing), .cache(cache), .privacy(privacy), .feedback(feedback), .about(about), .contributors(contributors), .version(version)])])
items.accept([section0, section1, section2])
input.selection.drive { indexPath in
guard let sectionItem = self.items.value.first?.items[indexPath.row] else { return }
self.itemSelected.onNext(sectionItem)
// switch sectionItem {
// case .about(let setting):
// case .account(let setting):
// case .privacy(let setting):
// case .timing(let setting):
// case .cache(let setting):
// case .permission(let setting):
// case .feedback(let setting):
// case .about(let setting):
// case .contributors(let setting):
// case .version(let setting):
// default: break
//
// }
}.disposed(by: rx.disposeBag)
return Output.init(items: items,
selection: input.selection,
itemSelected: itemSelected)
modelSelected: input.modelSelected)
}
}

@ -61,13 +61,13 @@ class TimingViewController: ViewController {
output.itemSelected.subscribe { sectionItem in
output.itemSelected.subscribe { [weak self] sectionItem in
}.disposed(by: rx.disposeBag)
output.selection.drive { sectionItem in
output.selection.drive { [weak self] sectionItem in
}.disposed(by: rx.disposeBag)

@ -1,5 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 8.26665C2 6.25436 2 5.24821 2.41187 4.41226C2.7599 3.70588 3.383 3.05418 4.07307 2.67484C4.88972 2.22591 5.84195 2.18318 7.74642 2.09772C9.03021 2.04011 10.4367 2 11.8647 2C13.3604 2 14.8561 2.044 16.2215 2.10602C18.1486 2.19356 19.1121 2.23733 19.9283 2.6864C20.6209 3.06747 21.2392 3.71451 21.5884 4.42367C22 5.25938 22 6.27257 22 8.29895V11.2377C22 13.3564 22 14.4158 21.5755 15.2622C21.2102 15.9906 20.5893 16.6248 19.8688 17.0056C19.0317 17.4479 18.0028 17.4698 15.945 17.5136C14.7643 17.5387 13.4867 17.5556 12.185 17.5556C10.7809 17.5556 9.37679 17.5359 8.07944 17.5075C6.00393 17.462 4.96618 17.4393 4.1296 16.9967C3.40737 16.6147 2.79026 15.9839 2.42412 15.2535C2 14.4074 2 13.3428 2 11.2136V8.26665Z" stroke="#37373D" style="stroke:#37373D;stroke:color(display-p3 0.2157 0.2157 0.2392);stroke-opacity:1;" stroke-width="1.5"/>
<path d="M6.955 6.904H10.679V7.877H7.963V9.221H10.399V10.201H7.963V12.329H6.955V6.904ZM11.3915 6.904H12.8125L14.1915 10.803H14.2125L15.5705 6.904H16.9985V12.329H15.9835V8.717H15.9625L14.6955 12.329H13.7015L12.4205 8.717H12.3995V12.329H11.3915V6.904Z" fill="#37373D" style="fill:#37373D;fill:color(display-p3 0.2157 0.2157 0.2392);fill-opacity:1;"/>
<path d="M8 22C8 22 10 21 12 21C14 21 16 22 16 22" stroke="#37373D" style="stroke:#37373D;stroke:color(display-p3 0.2157 0.2157 0.2392);stroke-opacity:1;" stroke-width="1.5"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.7555 5.29102C13.058 5.18671 13.3933 5.28579 13.5906 5.53774L17 9.89314L20.4094 5.53774C20.6067 5.28579 20.942 5.18671 21.2445 5.29102C21.547 5.39534 21.75 5.68007 21.75 6.00004V13C21.75 13.4143 21.4142 13.75 21 13.75C20.5858 13.75 20.25 13.4143 20.25 13V8.17487L17.5906 11.5722C17.4484 11.7538 17.2306 11.8599 17 11.8599C16.7694 11.8599 16.5516 11.7538 16.4094 11.5722L13.75 8.17487V13C13.75 13.4143 13.4142 13.75 13 13.75C12.5858 13.75 12.25 13.4143 12.25 13V6.00004C12.25 5.68007 12.453 5.39534 12.7555 5.29102ZM11.8529 17.2646C11.95 17.2452 12.05 17.2452 12.1471 17.2646L17.1471 18.2646C17.5533 18.3458 17.8167 18.741 17.7354 19.1471C17.6542 19.5533 17.2591 19.8167 16.8529 19.7355L12 18.7649L7.14709 19.7355C6.74092 19.8167 6.3458 19.5533 6.26456 19.1471C6.18333 18.741 6.44674 18.3458 6.85291 18.2646L11.8529 17.2646ZM3 5.25004C2.58579 5.25004 2.25 5.58583 2.25 6.00004V9.42679V13C2.25 13.4143 2.58579 13.75 3 13.75C3.41421 13.75 3.75 13.4143 3.75 13V10.1768H9C9.41421 10.1768 9.75 9.84101 9.75 9.42679C9.75 9.01258 9.41421 8.67679 9 8.67679H3.75V6.75004H10C10.4142 6.75004 10.75 6.41426 10.75 6.00004C10.75 5.58583 10.4142 5.25004 10 5.25004H3Z" fill="#17171A"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -1,15 +1,16 @@
{
"images" : [
{
"filename" : "login_bakcground.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "launch_bakcground@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "launch_bakcground@3x.png",
"idiom" : "universal",
"scale" : "3x"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.1 MiB

Loading…
Cancel
Save