n>
<image name="logo" width="140" height="140"/>
- <image name="navigation-background" width="12" height="132"/>
+ <image name="navigation-background" width="6" height="66"/>
<image name="默认头像" width="240" height="240"/>
</resources>
</document>
@@ -15,11 +15,13 @@ class MineCoordinator: Coordinator {
|
||
| 15 | 15 |
let mineViewController: MineViewController |
| 16 | 16 |
let navigationController: UINavigationController |
| 17 | 17 |
var childCoordinator = [CoordinatorKey: Coordinator]() |
| 18 |
+ let mainViewController: ContainerViewController |
|
| 18 | 19 |
// let shareUserInfoViewModel |
| 19 | 20 |
|
| 20 |
- init(_ mineViewController: MineViewController, navigationController: UINavigationController) {
|
|
| 21 |
+ init(_ mineViewController: MineViewController, navigationController: UINavigationController, mainViewController: ContainerViewController) {
|
|
| 21 | 22 |
self.mineViewController = mineViewController |
| 22 | 23 |
self.navigationController = navigationController |
| 24 |
+ self.mainViewController = mainViewController |
|
| 23 | 25 |
self.mineViewController.delegate = self |
| 24 | 26 |
} |
| 25 | 27 |
|
@@ -30,8 +32,11 @@ class MineCoordinator: Coordinator {
|
||
| 30 | 32 |
|
| 31 | 33 |
extension MineCoordinator: MineViewControllerDelegate {
|
| 32 | 34 |
func logout() {
|
| 35 |
+ mineViewController.dismissController() |
|
| 36 |
+ |
|
| 33 | 37 |
let vc = makeLoginViewController() |
| 34 |
- navigationController.presentController(vc) |
|
| 38 |
+ vc.userInfoViewModel = mineViewController.userInfoViewModel |
|
| 39 |
+ navigationController.addFullScreen(childViewController: vc) |
|
| 35 | 40 |
} |
| 36 | 41 |
|
| 37 | 42 |
func didSelect(_ item: MineItem) {
|
@@ -33,7 +33,6 @@ class MineViewController: SideViewController {
|
||
| 33 | 33 |
|
| 34 | 34 |
@IBOutlet weak var headerImageView: UIImageView! |
| 35 | 35 |
@IBOutlet weak var nickNameLabel: UILabel! |
| 36 |
- @IBOutlet weak var logoutBtn: UIButton! |
|
| 37 | 36 |
@IBOutlet weak var tableView: UITableView! |
| 38 | 37 |
@IBOutlet weak var mineView: UIView! |
| 39 | 38 |
|
@@ -12,23 +12,19 @@ import PaiaiDataKit |
||
| 12 | 12 |
final class PhotoDetailCoordinator: Coordinator {
|
| 13 | 13 |
let navigationController: UINavigationController |
| 14 | 14 |
let photoDetailViewController: PhotoDetailViewController |
| 15 |
- let shareListViewModel: PhotoDetailListViewModel |
|
| 15 |
+ let shareViewModel: PhotoDetailViewModel |
|
| 16 | 16 |
|
| 17 | 17 |
fileprivate var coordinators = [CoordinatorKey: Coordinator]() |
| 18 | 18 |
|
| 19 | 19 |
init(_ photoDetailVC: PhotoDetailViewController, |
| 20 | 20 |
nav: UINavigationController, |
| 21 |
- viewModel: PhotoDetailViewModel, |
|
| 22 |
- listViewModel: PhotoDetailListViewModel) {
|
|
| 21 |
+ viewModel: PhotoDetailViewModel) {
|
|
| 23 | 22 |
photoDetailViewController = photoDetailVC |
| 24 |
- shareListViewModel = listViewModel |
|
| 23 |
+ shareViewModel = viewModel |
|
| 25 | 24 |
navigationController = nav |
| 26 |
- photoDetailViewController.listViewModel = shareListViewModel |
|
| 27 | 25 |
photoDetailViewController.viewModel = viewModel |
| 28 | 26 |
|
| 29 | 27 |
viewModel.delegate = self |
| 30 |
- shareListViewModel.synchronization = viewModel |
|
| 31 |
- shareListViewModel.delegate = self |
|
| 32 | 28 |
} |
| 33 | 29 |
|
| 34 | 30 |
func start() {
|
@@ -46,12 +42,10 @@ extension PhotoDetailCoordinator: PhotoDetailViewModelDelegate {
|
||
| 46 | 42 |
|
| 47 | 43 |
navigationController.pushViewController(vc) |
| 48 | 44 |
} |
| 49 |
-} |
|
| 50 |
- |
|
| 51 |
-extension PhotoDetailCoordinator: PhotoDetailListViewModelDelegate {
|
|
| 45 |
+ |
|
| 52 | 46 |
func didSelected() {
|
| 53 | 47 |
let vc = UIStoryboard.photoDetail.instantiateController(PhotoPreviewViewController.self) |
| 54 |
- vc.viewModel = shareListViewModel |
|
| 48 |
+ vc.viewModel = shareViewModel |
|
| 55 | 49 |
photoDetailViewController.presentController(vc) |
| 56 | 50 |
} |
| 57 | 51 |
} |
@@ -13,9 +13,6 @@ import RxDataSources |
||
| 13 | 13 |
import PaiaiDataKit |
| 14 | 14 |
import PaiaiUIKit |
| 15 | 15 |
|
| 16 |
-let kPhotographerMark = 1 |
|
| 17 |
- |
|
| 18 |
- |
|
| 19 | 16 |
final class PhotoDetailViewController: UIViewController {
|
| 20 | 17 |
|
| 21 | 18 |
@IBOutlet weak var enterGroupView: UIView! |
@@ -50,7 +47,6 @@ final class PhotoDetailViewController: UIViewController {
|
||
| 50 | 47 |
|
| 51 | 48 |
// MARK: data property |
| 52 | 49 |
var viewModel: PhotoDetailViewModel! |
| 53 |
- var listViewModel: PhotoDetailListViewModel! |
|
| 54 | 50 |
|
| 55 | 51 |
let disposeBag = DisposeBag() |
| 56 | 52 |
|
@@ -90,11 +86,11 @@ extension PhotoDetailViewController {
|
||
| 90 | 86 |
} |
| 91 | 87 |
|
| 92 | 88 |
@IBAction func purchase(_ sender: UITapGestureRecognizer) {
|
| 93 |
- |
|
| 89 |
+ viewModel.purchase() |
|
| 94 | 90 |
} |
| 95 | 91 |
|
| 96 | 92 |
@IBAction func enterGroup(_ sender: UITapGestureRecognizer) {
|
| 97 |
- self.viewModel.navigateToGroup() |
|
| 93 |
+ viewModel.navigateToGroup() |
|
| 98 | 94 |
} |
| 99 | 95 |
} |
| 100 | 96 |
|
@@ -139,7 +135,7 @@ extension PhotoDetailViewController {
|
||
| 139 | 135 |
var photoCollectionViewDataSource: RxCollectionViewSectionedAnimatedDataSource<AnimatableSectionModel<Int, PhotoItem>> {
|
| 140 | 136 |
return RxCollectionViewSectionedAnimatedDataSource<AnimatableSectionModel<Int, PhotoItem>>(configureCell: { (dataSource, collectionView, indexPath, item) in
|
| 141 | 137 |
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "photoDetailImageCell", for: indexPath) as! PhotoDetailImageCell |
| 142 |
- cell.imageView.setImage(item.photo_thumbnail2_url, placeholder: UIImage.photoPlaceholder) |
|
| 138 |
+ cell.imageView.setImage(item.murl.isEmpty ? item.photo_thumbnail2_url : item.murl, placeholder: UIImage.photoPlaceholder) |
|
| 143 | 139 |
return cell |
| 144 | 140 |
}) |
| 145 | 141 |
} |
@@ -168,6 +164,11 @@ extension PhotoDetailViewController {
|
||
| 168 | 164 |
bindCollectionViewToListViewModel() |
| 169 | 165 |
bindListViewModelToCollectionView() |
| 170 | 166 |
|
| 167 |
+ bindViewModelToWatermarkImage() |
|
| 168 |
+ bindViewModelToWatermarkLabel() |
|
| 169 |
+ bindViewModelToWatermarkImageWithBought() |
|
| 170 |
+ bindViewModelToWatermarkLabelWithBought() |
|
| 171 |
+ |
|
| 171 | 172 |
bindViewWillAppear() |
| 172 | 173 |
|
| 173 | 174 |
monitorKeyboardWillShow() |
@@ -244,7 +245,7 @@ extension PhotoDetailViewController {
|
||
| 244 | 245 |
} |
| 245 | 246 |
|
| 246 | 247 |
func bindListViewModelToCollectionView() {
|
| 247 |
- listViewModel.content |
|
| 248 |
+ viewModel.content |
|
| 248 | 249 |
.bind(to: photoCollectionView.rx.items(dataSource: photoCollectionViewDataSource)) |
| 249 | 250 |
.disposed(by: disposeBag) |
| 250 | 251 |
} |
@@ -253,7 +254,7 @@ extension PhotoDetailViewController {
|
||
| 253 | 254 |
photoCollectionView.rx.willDisplayCell |
| 254 | 255 |
.asDriver() |
| 255 | 256 |
.drive(onNext: { [unowned self] in
|
| 256 |
- self.listViewModel.willShow(index: $0.at.row) |
|
| 257 |
+ self.viewModel.willShow(index: $0.at.row) |
|
| 257 | 258 |
}) |
| 258 | 259 |
.disposed(by: disposeBag) |
| 259 | 260 |
} |
@@ -261,15 +262,31 @@ extension PhotoDetailViewController {
|
||
| 261 | 262 |
func bindCollectionViewSelected() {
|
| 262 | 263 |
photoCollectionView.rx.itemSelected |
| 263 | 264 |
.asDriver(onErrorJustReturn: IndexPath(item: 0, section: 0)) |
| 264 |
- .drive(onNext: { [unowned self] _ in self.listViewModel.didSelected() })
|
|
| 265 |
+ .drive(onNext: { [unowned self] _ in self.viewModel.didSelected() })
|
|
| 265 | 266 |
.disposed(by: disposeBag) |
| 266 | 267 |
} |
| 267 | 268 |
|
| 269 |
+ func bindViewModelToWatermarkImage() {
|
|
| 270 |
+ viewModel.watermarkImage.bind(to: waterMarkImage.rx.isHidden).disposed(by: disposeBag) |
|
| 271 |
+ } |
|
| 272 |
+ |
|
| 273 |
+ func bindViewModelToWatermarkLabel() {
|
|
| 274 |
+ viewModel.watermarkText.bind(to: waterMarkLabel.rx.text).disposed(by: disposeBag) |
|
| 275 |
+ } |
|
| 276 |
+ |
|
| 277 |
+ func bindViewModelToWatermarkImageWithBought() {
|
|
| 278 |
+ viewModel.watermarkImageWithBought.bind(to: waterMarkImage.rx.isHidden).disposed(by: disposeBag) |
|
| 279 |
+ } |
|
| 280 |
+ |
|
| 281 |
+ func bindViewModelToWatermarkLabelWithBought() {
|
|
| 282 |
+ viewModel.watermarkTextWithBought.bind(to: waterMarkLabel.rx.text).disposed(by: disposeBag) |
|
| 283 |
+ } |
|
| 284 |
+ |
|
| 268 | 285 |
func bindViewWillAppear() {
|
| 269 | 286 |
viewModel.viewWillAppear |
| 270 | 287 |
.asDriver() |
| 271 | 288 |
.drive(onNext: { [unowned self] _ in
|
| 272 |
- self.photoCollectionView.scrollToItem(at: IndexPath(item: self.listViewModel.currIndex, section: 0), at: .right, animated: false) |
|
| 289 |
+ self.photoCollectionView.scrollToItem(at: IndexPath(item: self.viewModel.currIndex, section: 0), at: .right, animated: false) |
|
| 273 | 290 |
}) |
| 274 | 291 |
.disposed(by: disposeBag) |
| 275 | 292 |
} |
@@ -17,7 +17,7 @@ final class PhotoPreviewViewController: UIViewController {
|
||
| 17 | 17 |
|
| 18 | 18 |
/// MARK: Storyboard property |
| 19 | 19 |
@IBOutlet weak var collectionView: UICollectionView! |
| 20 |
- var viewModel: PhotoDetailListViewModel! |
|
| 20 |
+ var viewModel: PhotoDetailViewModel! |
|
| 21 | 21 |
var disposeBag = DisposeBag() |
| 22 | 22 |
|
| 23 | 23 |
override var prefersStatusBarHidden: Bool {
|
@@ -29,7 +29,6 @@ final class PhotoPreviewViewController: UIViewController {
|
||
| 29 | 29 |
binding() |
| 30 | 30 |
scrollToSpecifiedImage() |
| 31 | 31 |
navigationController?.setNavigationBarHidden(true, animated: true) |
| 32 |
- |
|
| 33 | 32 |
} |
| 34 | 33 |
|
| 35 | 34 |
func scrollToSpecifiedImage() {
|