re> itemViewModel.item.accept(item)
}
+ private func setNotification() {
+ NotificationCenter.default.rx.notification(.PhotoItemsChanged).subscribe(onNext: { (notification) in
+ guard let itemOperator = notification.userInfo?[PhotoItemsOperator.key] as? PhotoItemsOperator,
+ case let .update(id, v) = itemOperator,
+ let index = self._items.value.firstIndex(where: { $0.photo_id == id }) else { return }
+ var items = self._items.value
+ items[index] = v
+ self._items.accept(items)
+ }).disposed(by: disposeBag)
+ }
+
+
+}
+
+extension PhotoDetailViewModel {
public func navigateToGroup() {
- delegate?.navigateToGroup(GroupItem(json: items.value[currIndex].toJSON() as [String : AnyObject]))
+ delegate?.navigateToGroup(GroupItem(json: _items.value[currIndex].toJSON() as [String : AnyObject]))
}
public func didSelected() {
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// PhotoPurchaseViewModel.swift |
3 | 3 |
// PaiaiDataKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/3/19. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/3/19. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import Foundation |
@@ -36,23 +36,24 @@ public class PhotoPurchaseViewModel { |
||
36 | 36 |
} |
37 | 37 |
|
38 | 38 |
private func payDidFinish() { |
39 |
- NotificationCenter.default.rx.notification(Notification.wxNotification.payDidFinish).subscribe(onNext: { (notification) in |
|
40 |
- guard let userInfo = notification.userInfo as? [String: Int], |
|
41 |
- let code = userInfo["code"] else { |
|
42 |
- Toast.show(message: "支付失败") |
|
43 |
- return |
|
44 |
- } |
|
45 |
- |
|
46 |
- switch code { |
|
47 |
- case 0: |
|
48 |
- self.getOrderDetail() |
|
49 |
- break |
|
50 |
- case -2: |
|
51 |
- Toast.show(message: "取消支付") |
|
52 |
- break |
|
53 |
- default: |
|
54 |
- Toast.show(message: "发生未知错误") |
|
55 |
- } |
|
39 |
+ NotificationCenter.default.rx.notification(Notification.wxNotification.payDidFinish) |
|
40 |
+ .subscribe(onNext: { (notification) in |
|
41 |
+ guard let userInfo = notification.userInfo as? [String: Int], |
|
42 |
+ let code = userInfo["code"] else { |
|
43 |
+ Toast.show(message: "支付失败") |
|
44 |
+ return |
|
45 |
+ } |
|
46 |
+ |
|
47 |
+ switch code { |
|
48 |
+ case 0: |
|
49 |
+ self.getOrderDetail() |
|
50 |
+ break |
|
51 |
+ case -2: |
|
52 |
+ Toast.show(message: "取消支付") |
|
53 |
+ break |
|
54 |
+ default: |
|
55 |
+ Toast.show(message: "发生未知错误") |
|
56 |
+ } |
|
56 | 57 |
}).disposed(by: disposeBag) |
57 | 58 |
} |
58 | 59 |
|
@@ -0,0 +1,21 @@ |
||
1 |
+// |
|
2 |
+// GroupItemsOperator.swift |
|
3 |
+// PaiaiDataKit |
|
4 |
+// |
|
5 |
+// Created by ffib on 2019/5/5. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 |
+// |
|
8 |
+ |
|
9 |
+import Foundation |
|
10 |
+ |
|
11 |
+ |
|
12 |
+public extension Notification.Name { |
|
13 |
+ static let GroupItemsChanged = Notification.Name("GroupItemsChanged") |
|
14 |
+} |
|
15 |
+ |
|
16 |
+enum GroupItemsOperator { |
|
17 |
+ case remove(String) |
|
18 |
+ case update(String, GroupItem) |
|
19 |
+ |
|
20 |
+ static var key = "operator" |
|
21 |
+} |
@@ -0,0 +1,9 @@ |
||
1 |
+// |
|
2 |
+// ItemOperator.swift |
|
3 |
+// PaiaiDataKit |
|
4 |
+// |
|
5 |
+// Created by ffib on 2019/5/5. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 |
+// |
|
8 |
+ |
|
9 |
+import Foundation |
@@ -0,0 +1,19 @@ |
||
1 |
+// |
|
2 |
+// PhotoItemsOperator.swift |
|
3 |
+// PaiaiDataKit |
|
4 |
+// |
|
5 |
+// Created by ffib on 2019/5/5. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 |
+// |
|
8 |
+ |
|
9 |
+import Foundation |
|
10 |
+ |
|
11 |
+public extension Notification.Name { |
|
12 |
+ static let PhotoItemsChanged = Notification.Name("PhotoItemsChanged") |
|
13 |
+} |
|
14 |
+ |
|
15 |
+enum PhotoItemsOperator { |
|
16 |
+ case update(String, PhotoItem) |
|
17 |
+ |
|
18 |
+ static var key = "operator" |
|
19 |
+} |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// UserInfoViewModel.swift |
3 | 3 |
// PaiaiDataKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2018/12/20. |
|
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2018/12/20. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import Foundation |
@@ -18,7 +18,7 @@ public class UserInfoViewModel { |
||
18 | 18 |
|
19 | 19 |
public var isLoggedIn: Observable<Void> { |
20 | 20 |
return shareUserInfo.asObservable() |
21 |
- .filter{ $0.userId != "" } |
|
21 |
+ .filter { $0.userId != "" } |
|
22 | 22 |
.flatMapLatest { _ in |
23 | 23 |
return Observable.just(()) |
24 | 24 |
} |
@@ -82,8 +82,4 @@ public class UserInfoViewModel { |
||
82 | 82 |
Toast.hide() |
83 | 83 |
}).disposed(by: disposeBag) |
84 | 84 |
} |
85 |
- |
|
86 |
- deinit { |
|
87 |
- print("销毁") |
|
88 |
- } |
|
89 | 85 |
} |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// Error.swift |
3 | 3 |
// PaiaiDataKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/21. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/21. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import Foundation |
@@ -1,12 +1,12 @@ |
||
1 | 1 |
// |
2 | 2 |
// DateExt.swift |
3 |
-// ExtensionKit |
|
3 |
+// PaiaiDataKit |
|
4 | 4 |
// |
5 | 5 |
// Created by FFIB on 2017/9/24. |
6 | 6 |
// Copyright © 2017年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
9 |
-import UIKit |
|
9 |
+import Foundation |
|
10 | 10 |
|
11 | 11 |
extension String { |
12 | 12 |
public func convertTimeStringToDate(format: String) -> Date? { |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// DictionaryExt.swift |
3 | 3 |
// PaiaiDataKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2018/12/28. |
|
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2018/12/28. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import Foundation |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// Notification+wxPay.swift |
3 | 3 |
// PaiaiDataKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/4/1. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/4/1. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import Foundation |
@@ -1,6 +1,6 @@ |
||
1 | 1 |
// |
2 | 2 |
// StringExt.swift |
3 |
-// ExtensionKit |
|
3 |
+// PaiaiDataKit |
|
4 | 4 |
// |
5 | 5 |
// Created by FFIB on 2017/9/20. |
6 | 6 |
// Copyright © 2017年 FFIB. All rights reserved. |
@@ -1,6 +1,6 @@ |
||
1 | 1 |
// |
2 | 2 |
// UserDefaultsExt.swift |
3 |
-// ExtensionKit |
|
3 |
+// PaiaiDataKit |
|
4 | 4 |
// |
5 | 5 |
// Created by FFIB on 2017/9/22. |
6 | 6 |
// Copyright © 2017年 FFIB. All rights reserved. |
@@ -1,9 +1,9 @@ |
||
1 | 1 |
// |
2 | 2 |
// FadeToastAnimator.swift |
3 |
-// PaiaiUIKit |
|
3 |
+// PaiaiDataKit |
|
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/21. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/21. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -1,9 +1,9 @@ |
||
1 | 1 |
// |
2 | 2 |
// Toast.swift |
3 |
-// PaiaiUIKit |
|
3 |
+// PaiaiDataKit |
|
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/21. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/21. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -1,9 +1,9 @@ |
||
1 | 1 |
// |
2 | 2 |
// ToastAnimator.swift |
3 |
-// PaiaiUIKit |
|
3 |
+// PaiaiDataKit |
|
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/21. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/21. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -1,9 +1,9 @@ |
||
1 | 1 |
// |
2 | 2 |
// ToastOption.swift |
3 |
-// PaiaiUIKit |
|
3 |
+// PaiaiDataKit |
|
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/18. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/18. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// ToastView.swift |
3 |
-// PaiAi |
|
3 |
+// PaiaiDataKit |
|
4 | 4 |
// |
5 |
-// Created by mac on 16/7/21. |
|
5 |
+// Created by FFIB on 16/7/21. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// PaiaiDataKitTests.swift |
3 | 3 |
// PaiaiDataKitTests |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/16. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/16. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import XCTest |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// PaiaiUIKit.h |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2018/12/18. |
|
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2018/12/18. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
#import <UIKit/UIKit.h> |
@@ -1,6 +1,6 @@ |
||
1 | 1 |
// |
2 | 2 |
// CGPointExt.swift |
3 |
-// ExtensionKit |
|
3 |
+// PaiaiUIKit |
|
4 | 4 |
// |
5 | 5 |
// Created by FFIB on 2017/9/13. |
6 | 6 |
// Copyright © 2017年 FFIB. All rights reserved. |
@@ -1,6 +1,6 @@ |
||
1 | 1 |
// |
2 | 2 |
// CGSizeExt.swift |
3 |
-// ExtensionKit |
|
3 |
+// PaiaiUIKit |
|
4 | 4 |
// |
5 | 5 |
// Created by FFIB on 2017/9/14. |
6 | 6 |
// Copyright © 2017年 FFIB. All rights reserved. |
@@ -1,6 +1,6 @@ |
||
1 | 1 |
// |
2 | 2 |
// CLLocationExt.swift |
3 |
-// ExtensionKit |
|
3 |
+// PaiaiUIKit |
|
4 | 4 |
// |
5 | 5 |
// Created by FFIB on 2017/9/24. |
6 | 6 |
// Copyright © 2017年 FFIB. All rights reserved. |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// UIApplication+Swizzle.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/15. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/15. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -1,6 +1,6 @@ |
||
1 | 1 |
// |
2 | 2 |
// UIBarButtonItemExt.swift |
3 |
-// ExtensionKit |
|
3 |
+// PaiaiUIKit |
|
4 | 4 |
// |
5 | 5 |
// Created by FFIB on 2017/9/14. |
6 | 6 |
// Copyright © 2017年 FFIB. All rights reserved. |
@@ -1,6 +1,6 @@ |
||
1 | 1 |
// |
2 | 2 |
// UIColorExt.swift |
3 |
-// ExtensionKit |
|
3 |
+// PaiaiUIKit |
|
4 | 4 |
// |
5 | 5 |
// Created by FFIB on 2017/9/14. |
6 | 6 |
// Copyright © 2017年 FFIB. All rights reserved. |
@@ -1,6 +1,6 @@ |
||
1 | 1 |
// |
2 | 2 |
// UIImageExt.swift |
3 |
-// ExtensionKit |
|
3 |
+// PaiaiUIKit |
|
4 | 4 |
// |
5 | 5 |
// Created by FFIB on 2017/9/14. |
6 | 6 |
// Copyright © 2017年 FFIB. All rights reserved. |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// UINavigationBar+FixSpace.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/15. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/15. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,7 +2,7 @@ |
||
2 | 2 |
// UINavigationItem+UIBarButttonItem.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/4/28. |
|
5 |
+// Created by FFIB on 2019/4/28. |
|
6 | 6 |
// Copyright © 2019 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -1,6 +1,6 @@ |
||
1 | 1 |
// |
2 | 2 |
// UIStoryboardExt.swift |
3 |
-// ExtensionKit |
|
3 |
+// PaiaiUIKit |
|
4 | 4 |
// |
5 | 5 |
// Created by FFIB on 2017/9/14. |
6 | 6 |
// Copyright © 2017年 FFIB. All rights reserved. |
@@ -9,7 +9,7 @@ |
||
9 | 9 |
import UIKit |
10 | 10 |
|
11 | 11 |
extension UIStoryboard { |
12 |
- public func instantiateController<T: UIViewController> (_ type: T.Type) -> T { |
|
12 |
+ public func instantiateViewController<T: UIViewController> (type: T.Type) -> T { |
|
13 | 13 |
return instantiateViewController(withIdentifier: String(describing: type)) as? T ?? T() |
14 | 14 |
} |
15 | 15 |
} |
@@ -1,6 +1,6 @@ |
||
1 | 1 |
// |
2 | 2 |
// UITextFieldExt.swift |
3 |
-// ExtensionKit |
|
3 |
+// PaiaiUIKit |
|
4 | 4 |
// |
5 | 5 |
// Created by FFIB on 2017/9/14. |
6 | 6 |
// Copyright © 2017年 FFIB. All rights reserved. |
@@ -1,6 +1,6 @@ |
||
1 | 1 |
// |
2 | 2 |
// UITextViewExt.swift |
3 |
-// ExtensionKit |
|
3 |
+// PaiaiUIKit |
|
4 | 4 |
// |
5 | 5 |
// Created by FFIB on 2017/9/13. |
6 | 6 |
// Copyright © 2017年 FFIB. All rights reserved. |
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// UIViewController+Navigation.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/15. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/15. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
/// MARK: extension |
12 | 12 |
public extension UIViewController { |
@@ -1,6 +1,6 @@ |
||
1 | 1 |
// |
2 | 2 |
// UIViewControllerExt.swift |
3 |
-// ExtensionKit |
|
3 |
+// PaiaiUIKit |
|
4 | 4 |
// |
5 | 5 |
// Created by FFIB on 2017/9/13. |
6 | 6 |
// Copyright © 2017年 FFIB. All rights reserved. |
@@ -1,6 +1,6 @@ |
||
1 | 1 |
// |
2 | 2 |
// UIViewExt.swift |
3 |
-// ExtensionKit |
|
3 |
+// PaiaiUIKit |
|
4 | 4 |
// |
5 | 5 |
// Created by FFIB on 2017/9/13. |
6 | 6 |
// Copyright © 2017年 FFIB. All rights reserved. |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// HardwareAuthorization.swift |
3 | 3 |
// Function |
4 | 4 |
// |
5 |
-// Created by mac on 2016/11/21. |
|
6 |
-// Copyright © 2016年 mac. All rights reserved. |
|
5 |
+// Created by FFIB on 2016/11/21. |
|
6 |
+// Copyright © 2016年 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// Storyboarded.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/29. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/29. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// ActionSheetAnimator.swift |
3 | 3 |
// PaiAi |
4 | 4 |
// |
5 |
-// Created by ffib on 2018/12/17. |
|
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2018/12/17. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// AlertAnimator.swift |
3 | 3 |
// PaiAi |
4 | 4 |
// |
5 |
-// Created by ffib on 2018/12/17. |
|
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2018/12/17. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -3,7 +3,7 @@ |
||
3 | 3 |
// PaiAi |
4 | 4 |
// |
5 | 5 |
// Created by FFIB on 2017/11/21. |
6 |
-// Copyright © 2017年 yb. All rights reserved. |
|
6 |
+// Copyright © 2017年 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// ActionSheetController.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/23. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/23. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// AlertAction.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/22. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/22. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
public struct AlertAction { |
12 | 12 |
public enum Style { |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// AlertItem.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/22. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/22. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// BottomCancelItem.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/21. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/21. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// BottomDefaultItem.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/21. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/21. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// CenterCancelItem.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/23. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/23. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
final class CenterCancelItem: AlertItem { |
12 | 12 |
|
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// CenterConfirmItem.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/23. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/23. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
final class CenterConfirmItem: AlertItem { |
12 | 12 |
|
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// AlertController.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/21. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/21. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
public class AlertController: AlertViewController { |
12 | 12 |
|
@@ -1,9 +1,9 @@ |
||
1 | 1 |
// |
2 |
-// NavigationBackItemDelegate.swift |
|
2 |
+// NavigationBackViewController.swift |
|
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/11. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/11. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,7 +2,7 @@ |
||
2 | 2 |
// UINavigationController+NavigationBack.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/4/26. |
|
5 |
+// Created by FFIB on 2019/4/26. |
|
6 | 6 |
// Copyright © 2019 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -2,7 +2,7 @@ |
||
2 | 2 |
// NavigationBar.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/4/23. |
|
5 |
+// Created by FFIB on 2019/4/23. |
|
6 | 6 |
// Copyright © 2019 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -2,7 +2,7 @@ |
||
2 | 2 |
// NavigationController.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/4/23. |
|
5 |
+// Created by FFIB on 2019/4/23. |
|
6 | 6 |
// Copyright © 2019 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// NiblessView.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/2/6. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/2/6. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// NiblessViewController.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/2/6. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/2/6. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// PageItem.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/18. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/18. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
public struct PageItem { |
12 | 12 |
public var title: String |
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// PageOption.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/18. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/18. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
public struct PageOption { |
12 | 12 |
var font: UIFont |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// PageViewController.swift |
3 | 3 |
// PaiAi |
4 | 4 |
// |
5 |
-// Created by ffib on 2018/12/6. |
|
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2018/12/6. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -57,10 +57,13 @@ open class PageViewController: UIViewController { |
||
57 | 57 |
public var option = PageOption() |
58 | 58 |
public var pageItems = [PageItem]() { |
59 | 59 |
didSet { |
60 |
- setPageItems() |
|
61 |
- setMenuItems() |
|
60 |
+ DispatchQueue.main.async { |
|
61 |
+ self.setPageItems() |
|
62 |
+ self.setMenuItems() |
|
63 |
+ } |
|
62 | 64 |
} |
63 | 65 |
} |
66 |
+ |
|
64 | 67 |
override open func viewDidLoad() { |
65 | 68 |
super.viewDidLoad() |
66 | 69 |
contentRect = CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height) |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// PresentAnimatable.swift |
3 | 3 |
// PaiAi |
4 | 4 |
// |
5 |
-// Created by ffib on 2018/12/17. |
|
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2018/12/17. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// PresentAnimatorDelegate.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/24. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/24. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
public protocol PresentAnimatorDelegate: class { |
12 | 12 |
var animationView: UIView? { get } |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// PresentAppearAnimatedTransitioning.swift |
3 | 3 |
// PaiAi |
4 | 4 |
// |
5 |
-// Created by ffib on 2018/12/16. |
|
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2018/12/16. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// PresentDisappearAnimatedTransitioning.swift |
3 | 3 |
// PaiAi |
4 | 4 |
// |
5 |
-// Created by ffib on 2018/12/17. |
|
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2018/12/17. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// PresentExtension.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/25. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/25. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
public extension GestureRecognizerDelegate where Self: UIViewController & PresentAnimatorDelegate { |
12 | 12 |
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, |
@@ -2,10 +2,10 @@ |
||
2 | 2 |
// PresentViewController.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/25. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/25. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
typealias PresentViewController = PresentAnimatorDelegate & GestureRecognizerDelegate & ViewControllerTransitioningDelegate |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// ColorQR.swift |
3 | 3 |
// Function |
4 | 4 |
// |
5 |
-// Created by mac on 2016/11/24. |
|
6 |
-// Copyright © 2016年 mac. All rights reserved. |
|
5 |
+// Created by FFIB on 2016/11/24. |
|
6 |
+// Copyright © 2016年 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// NotificationExt.swift |
3 | 3 |
// QRView |
4 | 4 |
// |
5 |
-// Created by LISA on 2017/7/17. |
|
5 |
+// Created by FFIB on 2017/7/17. |
|
6 | 6 |
// Copyright © 2017年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
extension Notification { |
12 | 12 |
struct QRNotification { |
@@ -2,7 +2,7 @@ |
||
2 | 2 |
// QRCodeConfiguration.swift |
3 | 3 |
// QRView |
4 | 4 |
// |
5 |
-// Created by LISA on 2017/7/19. |
|
5 |
+// Created by FFIB on 2017/7/19. |
|
6 | 6 |
// Copyright © 2017年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// QRCodeMaskView.swift |
3 | 3 |
// PaiAi-Guide |
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 2017/1/20. |
|
6 |
-// Copyright © 2017年 mac. All rights reserved. |
|
5 |
+// Created by FFIB on 2017/1/20. |
|
6 |
+// Copyright © 2017年 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// QRCodeScanDelegate.swift |
3 | 3 |
// QRView |
4 | 4 |
// |
5 |
-// Created by LISA on 2017/7/19. |
|
5 |
+// Created by FFIB on 2017/7/19. |
|
6 | 6 |
// Copyright © 2017年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
public protocol QRCodeScanViewDelegate: class { |
12 | 12 |
func scanView(_ scanner: QRCodeScanView, receivedScanResult: QRCodeScanResult) |
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// QRCodeScanResult.swift |
3 | 3 |
// QRCodeScanner |
4 | 4 |
// |
5 |
-// Created by LISA on 2017/7/24. |
|
5 |
+// Created by FFIB on 2017/7/24. |
|
6 | 6 |
// Copyright © 2017年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
public struct QRCodeScanResult { |
12 | 12 |
public let metadataType: String |
@@ -2,7 +2,7 @@ |
||
2 | 2 |
// QRCodeScanView.swift |
3 | 3 |
// PaiAi |
4 | 4 |
// |
5 |
-// Created by mac on 16/7/21. |
|
5 |
+// Created by FFIB on 16/7/21. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -82,7 +82,7 @@ import CoreImage |
||
82 | 82 |
} |
83 | 83 |
|
84 | 84 |
@objc func start() { |
85 |
- let queue = DispatchQueue(label: "ffib.startScan.com") |
|
85 |
+ let queue = DispatchQueue(label: "FFIB.startScan.com") |
|
86 | 86 |
queue.async { |
87 | 87 |
self.qrscanner?.startScan() |
88 | 88 |
DispatchQueue.main.async { |
@@ -2,7 +2,7 @@ |
||
2 | 2 |
// QRCodeScanner.swift |
3 | 3 |
// QRView |
4 | 4 |
// |
5 |
-// Created by LISA on 2017/7/19. |
|
5 |
+// Created by FFIB on 2017/7/19. |
|
6 | 6 |
// Copyright © 2017年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// SideAnimator.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/24. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/24. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
struct SideAnimator: PresentAnimatable { |
12 | 12 |
func contentViewAppearAnimation(duration: TimeInterval, in view: UIView) { |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// SideViewController.swift |
3 | 3 |
// PaiAi |
4 | 4 |
// |
5 |
-// Created by ffib on 2018/12/12. |
|
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2018/12/12. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -3,7 +3,7 @@ |
||
3 | 3 |
// PaiAi |
4 | 4 |
// |
5 | 5 |
// Created by FFIB on 2017/11/13. |
6 |
-// Copyright © 2017年 yb. All rights reserved. |
|
6 |
+// Copyright © 2017年 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -3,7 +3,7 @@ |
||
3 | 3 |
// PaiAi |
4 | 4 |
// |
5 | 5 |
// Created by FFIB on 2017/11/13. |
6 |
-// Copyright © 2017年 yb. All rights reserved. |
|
6 |
+// Copyright © 2017年 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// WebViewController.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/28. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/28. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// GestureRecognizerDelegate.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/28. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/28. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
public protocol GestureRecognizerDelegate: class { |
12 | 12 |
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, |
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// GestureRecognizerProxy.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/28. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/28. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
class GestureRecognizerProxy: NSObject, UIGestureRecognizerDelegate { |
12 | 12 |
weak var delegate: GestureRecognizerDelegate? |
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// NavigationBarDelegate.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/30. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/30. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
public protocol NavigationBarDelegate: class { |
12 | 12 |
func navigationBar(_ navigationBar: UINavigationBar, shouldPush item: UINavigationItem) -> Bool |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// NavigationBarProxy.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/30. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/30. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// NavigationControllerDelegate.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/16. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/16. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
public protocol NavigationControllerDelegate: class { |
12 | 12 |
func navigationController(_ navigationController: UINavigationController, |
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// NavigationControllerProxy.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/16. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/16. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
class NavigationControllerProxy: NSObject, UINavigationControllerDelegate { |
12 | 12 |
weak var delegate: NavigationControllerDelegate? |
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// ViewControllerTransitioningDelegate.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/28. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/28. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
public protocol ViewControllerTransitioningDelegate: class { |
12 | 12 |
func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? |
@@ -2,11 +2,11 @@ |
||
2 | 2 |
// ViewControllerTransitioningProxy.swift |
3 | 3 |
// PaiaiUIKit |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/28. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/28. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 | 10 |
|
11 | 11 |
class ViewControllerTransitioningProxy: NSObject, UIViewControllerTransitioningDelegate { |
12 | 12 |
weak var delegate: ViewControllerTransitioningDelegate? |
@@ -1,105 +1,111 @@ |
||
1 | 1 |
// |
2 | 2 |
// Coordinator.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by ffib on 2018/12/6. |
|
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2018/12/6. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
10 |
-import PaiaiDataKit |
|
10 |
+import RxSwift |
|
11 | 11 |
import PaiaiUIKit |
12 |
+import PaiaiDataKit |
|
12 | 13 |
|
13 | 14 |
let kScreenWidth = UIScreen.main.bounds.size.width |
14 | 15 |
let kScreenHeight = UIScreen.main.bounds.size.height |
15 | 16 |
|
16 |
-protocol Coordinator {} |
|
17 |
- |
|
18 |
-public final class AppCoordinator { |
|
17 |
+public final class AppCoordinator: BaseCoordinator<Void> { |
|
19 | 18 |
|
19 |
+ private let window: UIWindow |
|
20 | 20 |
var shareUserInfoViewModel = UserInfoViewModel() |
21 |
- var containerViewController: ContainerViewController |
|
22 | 21 |
var navigationController: UINavigationController |
22 |
+ var containerViewController: ContainerViewController |
|
23 | 23 |
|
24 |
- fileprivate var coordinators = [CoordinatorKey: Coordinator]() |
|
24 |
+ public init(window: UIWindow) { |
|
25 |
+ self.window = window |
|
26 |
+ self.containerViewController = ContainerViewController() |
|
27 |
+ self.navigationController = NavigationController(rootViewController: containerViewController) |
|
28 |
+ } |
|
25 | 29 |
|
26 |
- public init(_ containerVC: ContainerViewController, navigationController: UINavigationController) { |
|
27 |
- self.containerViewController = containerVC |
|
28 |
- self.navigationController = navigationController |
|
29 |
- containerViewController.delegate = self |
|
30 |
- containerViewController.userInfo = shareUserInfoViewModel |
|
31 |
- |
|
32 |
- containerViewController.loadViewIfNeeded() |
|
33 |
- |
|
34 |
- |
|
35 |
- let homeVC = makeHomeViewController() |
|
36 |
- let messageVC = makeMessageViewController() |
|
37 |
- containerViewController.pageItems = [PageItem(title: "首页", |
|
38 |
- viewController: homeVC), |
|
39 |
- PageItem(title: "消息", |
|
40 |
- viewController: messageVC)] |
|
30 |
+ override public func start() -> Observable<Void> { |
|
31 |
+ makeContainerViewController() |
|
41 | 32 |
|
42 |
- let homeCoordinator = HomeCoordinator(homeVC, |
|
43 |
- navigationController: navigationController, |
|
44 |
- userInfoViewModel: shareUserInfoViewModel) |
|
45 |
- let messageCoordinator = MessageCoordinator(messageVC, |
|
46 |
- navigationController: navigationController, |
|
47 |
- userInfoViewModel: shareUserInfoViewModel) |
|
48 |
- |
|
49 |
- coordinators[.home] = homeCoordinator |
|
50 |
- coordinators[.message] = messageCoordinator |
|
51 |
- } |
|
52 |
- func start() { |
|
33 |
+ window.rootViewController = navigationController |
|
34 |
+ window.makeKeyAndVisible() |
|
53 | 35 |
|
36 |
+ return .never() |
|
54 | 37 |
} |
55 | 38 |
} |
56 | 39 |
|
57 | 40 |
extension AppCoordinator: ContainerViewControllerDelegate { |
58 | 41 |
func presentLogin() { |
59 |
- let loginVC = makeLoginViewController() |
|
60 |
- navigationController.addFullScreen(childViewController: loginVC) |
|
42 |
+ let vc = makeLoginViewController() |
|
43 |
+ coordinate(to: LoginCoordinator(vc, |
|
44 |
+ rootViewController: containerViewController)) |
|
45 |
+ .subscribe(onNext: { (userInfo) in |
|
46 |
+ vc.removeFromParentAndView() |
|
47 |
+ }).disposed(by: disposeBag) |
|
48 |
+ navigationController.addFullScreen(childViewController: vc) |
|
61 | 49 |
} |
62 | 50 |
|
63 | 51 |
func presentMine() { |
64 |
- let mineCoordinator = makeMineCoordinator() |
|
65 |
- coordinators[.mine] = mineCoordinator |
|
66 |
- |
|
52 |
+ let vc = makeMineViewController() |
|
53 |
+ let mineCoordinator = MineCoordinator(vc, |
|
54 |
+ navigationController: navigationController) |
|
55 |
+ coordinate(to: mineCoordinator).subscribe().disposed(by: disposeBag) |
|
67 | 56 |
containerViewController.presentController(mineCoordinator.mineViewController) |
68 | 57 |
} |
69 | 58 |
} |
70 | 59 |
|
71 | 60 |
fileprivate extension AppCoordinator { |
72 |
- func makeMineCoordinator() -> MineCoordinator { |
|
73 |
- let mineVC = makeMineViewController() |
|
74 |
- mineVC.userInfoViewModel = shareUserInfoViewModel |
|
75 |
- let mineCoordinator = MineCoordinator(mineVC, navigationController: navigationController, mainViewController: containerViewController) |
|
61 |
+ func makeContainerViewController() { |
|
62 |
+ containerViewController.userInfo = shareUserInfoViewModel |
|
63 |
+ containerViewController.delegate = self |
|
64 |
+ |
|
65 |
+ containerViewController.loadViewIfNeeded() |
|
76 | 66 |
|
77 |
- return mineCoordinator |
|
67 |
+ let homeVC = makeHomeViewController() |
|
68 |
+ let messageVC = makeMessageViewController() |
|
69 |
+ |
|
70 |
+ let homeCoordinator = HomeCoordinator(homeVC, |
|
71 |
+ navigationController: navigationController, |
|
72 |
+ userInfoViewModel: shareUserInfoViewModel) |
|
73 |
+ coordinate(to: homeCoordinator).subscribe().disposed(by: disposeBag) |
|
74 |
+ |
|
75 |
+ let messageCoordinator = MessageCoordinator(messageVC, |
|
76 |
+ navigationController: navigationController) |
|
77 |
+ coordinate(to: messageCoordinator).subscribe().disposed(by: disposeBag) |
|
78 |
+ |
|
79 |
+ containerViewController.pageItems = [PageItem(title: "首页", |
|
80 |
+ viewController: homeVC), |
|
81 |
+ PageItem(title: "消息", |
|
82 |
+ viewController: messageVC)] |
|
78 | 83 |
} |
79 |
-} |
|
80 |
- |
|
81 |
-fileprivate extension AppCoordinator { |
|
84 |
+ |
|
82 | 85 |
func makeHomeViewController() -> HomeViewController { |
83 |
- let vc = UIStoryboard.main.instantiateController(HomeViewController.self) |
|
86 |
+ let vc = HomeViewController.instantiate() |
|
84 | 87 |
vc.viewModel = HomeViewModel() |
85 | 88 |
vc.userInfoViewModel = shareUserInfoViewModel |
86 | 89 |
return vc |
87 | 90 |
} |
88 | 91 |
|
89 | 92 |
func makeMessageViewController() -> MessageViewController { |
90 |
- let vc = UIStoryboard.message.instantiateController(MessageViewController.self) |
|
93 |
+ let vc = MessageViewController.instantiate() |
|
91 | 94 |
vc.viewModel = MessageViewModel() |
92 | 95 |
vc.userInfoViewModel = shareUserInfoViewModel |
93 | 96 |
return vc |
94 | 97 |
} |
95 |
- |
|
98 |
+} |
|
99 |
+ |
|
100 |
+fileprivate extension AppCoordinator { |
|
96 | 101 |
func makeMineViewController() -> MineViewController { |
97 |
- let vc = UIStoryboard.mine.instantiateController(MineViewController.self) |
|
102 |
+ let vc = MineViewController.instantiate() |
|
103 |
+ vc.userInfoViewModel = shareUserInfoViewModel |
|
98 | 104 |
return vc |
99 | 105 |
} |
100 | 106 |
|
101 | 107 |
func makeLoginViewController() -> LoginViewController { |
102 |
- let vc = UIStoryboard.main.instantiateController(LoginViewController.self) |
|
108 |
+ let vc = LoginViewController.instantiate() |
|
103 | 109 |
vc.userInfoViewModel = shareUserInfoViewModel |
104 | 110 |
return vc |
105 | 111 |
} |
@@ -1,9 +1,9 @@ |
||
1 | 1 |
// |
2 | 2 |
// ContainerViewController.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by ffib on 2018/12/6. |
|
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2018/12/6. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -57,6 +57,7 @@ public final class ContainerViewController: PageViewController { |
||
57 | 57 |
public override func viewDidAppear(_ animated: Bool) { |
58 | 58 |
super.viewDidAppear(animated) |
59 | 59 |
bindLoggedInInteraction() |
60 |
+ bindUserInfoToHeaderView() |
|
60 | 61 |
} |
61 | 62 |
|
62 | 63 |
func setupNavigationBar() { |
@@ -1,18 +0,0 @@ |
||
1 |
-// |
|
2 |
-// CoordinatorKey.swift |
|
3 |
-// Paiai_iOS |
|
4 |
-// |
|
5 |
-// Created by ffib on 2019/3/26. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
7 |
-// |
|
8 |
- |
|
9 |
-import Foundation |
|
10 |
- |
|
11 |
-enum CoordinatorKey: String { |
|
12 |
- case home = "home" |
|
13 |
- case message = "message" |
|
14 |
- case mine = "mine" |
|
15 |
- case group = "group" |
|
16 |
- case groupDetail = "groupDetail" |
|
17 |
- case photoDetail = "photoDetail" |
|
18 |
-} |
@@ -2,53 +2,83 @@ |
||
2 | 2 |
// GroupCoordinator.swift |
3 | 3 |
// Paiai_iOS |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/1/29. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/1/29. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
10 |
+import RxSwift |
|
11 |
+import RxCocoa |
|
10 | 12 |
import PaiaiDataKit |
11 | 13 |
|
12 |
-class GroupCoordinator: Coordinator { |
|
14 |
+enum GroupCoordinatorResult { |
|
15 |
+ |
|
16 |
+} |
|
17 |
+ |
|
18 |
+extension NavigationSource { |
|
19 |
+ enum Group { |
|
20 |
+ case scan /// 扫码 |
|
21 |
+ case mineGroup /// 侧边栏 照片群 |
|
22 |
+ case createGroup /// 创建群 |
|
23 |
+ case photoDetail /// 照片详情页 |
|
24 |
+ case recentGroup /// 最近访问的照片群 |
|
25 |
+ } |
|
26 |
+} |
|
27 |
+ |
|
28 |
+class GroupCoordinator: BaseCoordinator<Void> { |
|
29 |
+ |
|
30 |
+ fileprivate let navigationController: UINavigationController |
|
13 | 31 |
|
14 |
- let navigationController: UINavigationController |
|
15 | 32 |
let groupViewController: GroupViewController |
33 |
+ let source: NavigationSource.Group |
|
16 | 34 |
|
17 |
- var coordinators: [CoordinatorKey: Coordinator] = [:] |
|
18 | 35 |
|
19 |
- init(_ groupVC: GroupViewController, navigationController: UINavigationController) { |
|
20 |
- self.groupViewController = groupVC |
|
36 |
+ init(_ viewController: GroupViewController, |
|
37 |
+ navigationController: UINavigationController, |
|
38 |
+ navigationSource: NavigationSource.Group) { |
|
39 |
+ self.groupViewController = viewController |
|
21 | 40 |
self.navigationController = navigationController |
22 |
- |
|
41 |
+ self.source = navigationSource |
|
42 |
+ } |
|
43 |
+ |
|
44 |
+ override func start() -> Observable<Void> { |
|
23 | 45 |
groupViewController.viewModel.delegate = self |
24 |
- |
|
46 |
+ return didCancel.asObservable() |
|
25 | 47 |
} |
26 | 48 |
} |
27 | 49 |
|
28 | 50 |
extension GroupCoordinator: GroupViewModelDelegate { |
29 | 51 |
func navigateToGroupDetail(_ item: GroupItem) { |
30 |
- let coordinator = GroupDetailCoordinator(makeGroupDetailViewController(item), navigationController: navigationController) |
|
31 |
- coordinators[.groupDetail] = coordinator |
|
52 |
+ let coordinator = GroupDetailCoordinator(makeGroupDetailViewController(item), |
|
53 |
+ navigationController: navigationController, |
|
54 |
+ navigationSource: source) |
|
32 | 55 |
|
56 |
+ coordinate(to: coordinator).subscribe(onNext: {[weak self] res in |
|
57 |
+ switch res { |
|
58 |
+ case .quit: |
|
59 |
+ self?.didCancel.onNext(()) |
|
60 |
+ break |
|
61 |
+ case .cancel: |
|
62 |
+ break |
|
63 |
+ } |
|
64 |
+ }).disposed(by: disposeBag) |
|
33 | 65 |
navigationController.pushViewController(coordinator.groupDetailViewController) |
34 | 66 |
} |
35 | 67 |
|
36 | 68 |
func didSelect(_ items: [PhotoItem], currIndex: Int) { |
37 |
- let ctl = UIStoryboard.photoDetail.instantiateController(PhotoDetailViewController.self) |
|
69 |
+ let vc = PhotoDetailViewController.instantiate() |
|
38 | 70 |
let viewModel = PhotoDetailViewModel(items: items, currIndex: currIndex) |
39 | 71 |
viewModel.isHiddenEnterGroupBtn.accept(true) |
40 |
- let coordinator = PhotoDetailCoordinator(ctl, nav: navigationController, |
|
72 |
+ let coordinator = PhotoDetailCoordinator(vc, nav: navigationController, |
|
41 | 73 |
viewModel: viewModel) |
42 |
- coordinators[.photoDetail] = coordinator |
|
43 |
- coordinator.start() |
|
44 |
- navigationController.pushViewController(coordinator.photoDetailViewController) |
|
74 |
+ coordinate(to: coordinator).subscribe().disposed(by: disposeBag) |
|
75 |
+ navigationController.pushViewController(vc) |
|
45 | 76 |
} |
46 | 77 |
} |
47 | 78 |
|
48 | 79 |
fileprivate extension GroupCoordinator { |
49 |
- func makeGroupDetailViewController(_ item: GroupItem) -> GroupDetailViewController |
|
50 |
- { |
|
51 |
- let vc = UIStoryboard.groupDetail.instantiateController(GroupDetailViewController.self) |
|
80 |
+ func makeGroupDetailViewController(_ item: GroupItem) -> GroupDetailViewController { |
|
81 |
+ let vc = GroupDetailViewController.instantiate() |
|
52 | 82 |
vc.viewModel = GroupDetailViewModel(item: item) |
53 | 83 |
|
54 | 84 |
return vc |
@@ -2,28 +2,57 @@ |
||
2 | 2 |
// GroupDetailCoordinator.swift |
3 | 3 |
// Paiai_iOS |
4 | 4 |
// |
5 |
-// Created by ffib on 2018/12/19. |
|
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2018/12/19. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
10 |
+import RxSwift |
|
10 | 11 |
import PaiaiDataKit |
11 | 12 |
|
12 |
-class GroupDetailCoordinator: Coordinator { |
|
13 |
+enum GroupDetailCoordinatorResult { |
|
14 |
+ case quit |
|
15 |
+ case cancel |
|
16 |
+} |
|
17 |
+ |
|
18 |
+class GroupDetailCoordinator: BaseCoordinator<GroupDetailCoordinatorResult> { |
|
13 | 19 |
let navigationController: UINavigationController |
14 | 20 |
let groupDetailViewController: GroupDetailViewController |
21 |
+ let source: NavigationSource.Group |
|
22 |
+ var coordinatorResult = PublishSubject<GroupDetailCoordinatorResult>() |
|
15 | 23 |
|
16 |
- init(_ groupDetailVC: GroupDetailViewController, navigationController: UINavigationController) { |
|
17 |
- self.groupDetailViewController = groupDetailVC |
|
24 |
+ init(_ viewController: GroupDetailViewController, |
|
25 |
+ navigationController: UINavigationController, |
|
26 |
+ navigationSource: NavigationSource.Group) { |
|
27 |
+ self.source = navigationSource |
|
28 |
+ self.groupDetailViewController = viewController |
|
18 | 29 |
self.navigationController = navigationController |
19 |
- |
|
30 |
+ } |
|
31 |
+ |
|
32 |
+ override func start() -> Observable<GroupDetailCoordinatorResult> { |
|
20 | 33 |
groupDetailViewController.viewModel.delegate = self |
34 |
+ |
|
35 |
+ let cancel = groupDetailViewController.viewModel.didQuit.map { _ in GroupDetailCoordinatorResult.quit } |
|
36 |
+ let quit = groupDetailViewController.viewModel.didCancel.map { _ in GroupDetailCoordinatorResult.cancel } |
|
37 |
+ return Observable.amb([cancel, quit]) |
|
21 | 38 |
} |
22 | 39 |
} |
23 | 40 |
|
24 | 41 |
extension GroupDetailCoordinator: GroupDetailViewModelDelegate { |
42 |
+ func navigationBackToGroupDetail() { |
|
43 |
+ navigationController.popViewController(animated: true) |
|
44 |
+ } |
|
45 |
+ |
|
25 | 46 |
func navigateToRootViewController() { |
26 |
- navigationController.popToRootViewController(animated: true) |
|
47 |
+ coordinatorResult.onNext(.quit) |
|
48 |
+ switch source { |
|
49 |
+ case .createGroup, .scan, .photoDetail, .recentGroup: |
|
50 |
+ navigationController.popToRootViewController(animated: true) |
|
51 |
+ break |
|
52 |
+ case .mineGroup: |
|
53 |
+ let targetVC = navigationController.viewControllers[navigationController.viewControllers.count - 3] |
|
54 |
+ navigationController.popToViewController(targetVC, animated: true) |
|
55 |
+ } |
|
27 | 56 |
} |
28 | 57 |
|
29 | 58 |
func navigateToGroupMember(_ item: GroupDetailItem) { |
@@ -37,14 +66,14 @@ extension GroupDetailCoordinator: GroupDetailViewModelDelegate { |
||
37 | 66 |
|
38 | 67 |
extension GroupDetailCoordinator { |
39 | 68 |
func makeGroupMemberViewController(_ item: GroupDetailItem) -> GroupMemberViewController { |
40 |
- let vc = UIStoryboard.groupDetail.instantiateController(GroupMemberViewController.self) |
|
69 |
+ let vc = GroupMemberViewController.instantiate() |
|
41 | 70 |
vc.viewModel = GroupMemberViewModel(item: item) |
42 | 71 |
return vc |
43 | 72 |
} |
44 | 73 |
|
45 | 74 |
func makeGroupNameModificationViewController(_ item: GroupDetailItem) -> GroupNameModificationViewController { |
46 |
- let vc = UIStoryboard.groupDetail.instantiateController(GroupNameModificationViewController.self) |
|
47 |
- vc.item = item |
|
75 |
+ let vc = GroupNameModificationViewController.instantiate() |
|
76 |
+ vc.viewModel = groupDetailViewController.viewModel |
|
48 | 77 |
return vc |
49 | 78 |
} |
50 | 79 |
} |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// GroupDetailMemeberView.swift |
3 | 3 |
// Paiai_iOS |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/2/18. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/2/18. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -57,4 +57,3 @@ class GroupDetailMemeberView: UIView { |
||
57 | 57 |
} |
58 | 58 |
} |
59 | 59 |
} |
60 |
- |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// GroupDetailViewController.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/4/5. |
|
5 |
+// Created by FFIB on 16/4/5. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -115,3 +115,9 @@ extension GroupDetailViewController { |
||
115 | 115 |
} |
116 | 116 |
|
117 | 117 |
extension GroupDetailViewController: NavigationBackViewController {} |
118 |
+ |
|
119 |
+extension GroupDetailViewController: Storyboarded { |
|
120 |
+ static func instantiate() -> GroupDetailViewController { |
|
121 |
+ return UIStoryboard.groupDetail.instantiateViewController(type: GroupDetailViewController.self) |
|
122 |
+ } |
|
123 |
+} |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// GroupMemberCell.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by mac on 16/5/20. |
|
5 |
+// Created by FFIB on 16/5/20. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// GroupMemberViewController.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/4/6. |
|
5 |
+// Created by FFIB on 16/4/6. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -64,3 +64,9 @@ extension GroupMemberViewController: GroupMemberCellDelegate { |
||
64 | 64 |
} |
65 | 65 |
|
66 | 66 |
extension GroupMemberViewController: NavigationBackViewController {} |
67 |
+ |
|
68 |
+extension GroupMemberViewController: Storyboarded { |
|
69 |
+ static func instantiate() -> GroupMemberViewController { |
|
70 |
+ return UIStoryboard.groupDetail.instantiateViewController(type: GroupMemberViewController.self) |
|
71 |
+ } |
|
72 |
+} |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// GroupNameModificationViewController.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/4/6. |
|
5 |
+// Created by FFIB on 16/4/6. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -18,7 +18,7 @@ final class GroupNameModificationViewController: UIViewController { |
||
18 | 18 |
@IBOutlet weak var textField: UITextField! |
19 | 19 |
@IBOutlet weak var saveButton: UIButton! |
20 | 20 |
|
21 |
- var item = GroupDetailItem(json: [:]) |
|
21 |
+ var viewModel: GroupDetailViewModel! |
|
22 | 22 |
|
23 | 23 |
let disposeBag = DisposeBag() |
24 | 24 |
// MARK: view function |
@@ -33,7 +33,7 @@ final class GroupNameModificationViewController: UIViewController { |
||
33 | 33 |
let leftView = UIView(frame: CGRect(x: 0, y: 0, width: 12, height: textField.width)) |
34 | 34 |
textField.leftView = leftView |
35 | 35 |
textField.leftViewMode = .always |
36 |
- textField.placeholder = item.group.group_name |
|
36 |
+ textField.placeholder = viewModel.item.value.group.group_name |
|
37 | 37 |
} |
38 | 38 |
|
39 | 39 |
func bindTextFieldToSaveButton() { |
@@ -47,30 +47,12 @@ final class GroupNameModificationViewController: UIViewController { |
||
47 | 47 |
extension GroupNameModificationViewController { |
48 | 48 |
|
49 | 49 |
@IBAction func saveName() { |
50 |
- if (textField.text ?? "").count > 20 { |
|
50 |
+ guard let text = textField.text, text.count <= 20 else { |
|
51 | 51 |
saveFailed() |
52 | 52 |
return |
53 | 53 |
} |
54 | 54 |
|
55 |
- |
|
56 |
- |
|
57 |
- // guard let info = detailData else { |
|
58 |
- // return |
|
59 |
- // } |
|
60 |
- // guard let group = detailData?.group else { |
|
61 |
- // return |
|
62 |
- // } |
|
63 |
- // let params = ["group_id": info.group_id, |
|
64 |
- // "admin_id": group.admin_id, "group_name": textField.text ?? ""] as [String: AnyObject] |
|
65 |
- // let request = StatusNetworkRequest(param: params, path: .groupUpdate) |
|
66 |
- // NetworkApi.share.post(request: request) { (res) in |
|
67 |
- // guard res.status == 200 else { |
|
68 |
- // return |
|
69 |
- // } |
|
70 |
- // addGroupInfoToRecent(group) |
|
71 |
- // FFToastView.showToast(inView: self.view, withText: "保存成功") |
|
72 |
- // self.textField.resignFirstResponder() |
|
73 |
- // } |
|
55 |
+ viewModel.changeName(name: text) |
|
74 | 56 |
} |
75 | 57 |
|
76 | 58 |
func saveFailed() { |
@@ -80,10 +62,15 @@ extension GroupNameModificationViewController { |
||
80 | 62 |
presentController(alert) |
81 | 63 |
} |
82 | 64 |
|
83 |
- |
|
84 | 65 |
@IBAction func tapView() { |
85 | 66 |
textField.resignFirstResponder() |
86 | 67 |
} |
87 | 68 |
} |
88 | 69 |
|
89 | 70 |
extension GroupNameModificationViewController: NavigationBackViewController {} |
71 |
+ |
|
72 |
+extension GroupNameModificationViewController: Storyboarded { |
|
73 |
+ static func instantiate() -> GroupNameModificationViewController { |
|
74 |
+ return UIStoryboard.groupDetail.instantiateViewController(type: GroupNameModificationViewController.self) |
|
75 |
+ } |
|
76 |
+} |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// GroupQRView.swift |
3 | 3 |
// Paiai_iOS |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/2/18. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/2/18. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// GroupViewController.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/3/28. |
|
5 |
+// Created by FFIB on 16/3/28. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -259,7 +259,6 @@ extension GroupViewController: NavigationBackViewController {} |
||
259 | 259 |
|
260 | 260 |
extension GroupViewController: Storyboarded { |
261 | 261 |
static func instantiate() -> GroupViewController { |
262 |
- let vc = UIStoryboard.group.instantiateController(GroupViewController.self) |
|
263 |
- return vc |
|
262 |
+ return UIStoryboard.group.instantiateViewController(type: GroupViewController.self) |
|
264 | 263 |
} |
265 | 264 |
} |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// CreateGroupConfirmViewController.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/4/2. |
|
5 |
+// Created by FFIB on 16/4/2. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -56,3 +56,9 @@ extension CreateGroupConfirmViewController { |
||
56 | 56 |
imageView.image = UIImage(named: viewModel.avatar) |
57 | 57 |
} |
58 | 58 |
} |
59 |
+ |
|
60 |
+extension CreateGroupConfirmViewController: Storyboarded { |
|
61 |
+ static func instantiate() -> CreateGroupConfirmViewController { |
|
62 |
+ return UIStoryboard.main.instantiateViewController(type: CreateGroupConfirmViewController.self) |
|
63 |
+ } |
|
64 |
+} |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// CreateGroupViewController.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/4/2. |
|
5 |
+// Created by FFIB on 16/4/2. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -11,7 +11,7 @@ import PaiaiDataKit |
||
11 | 11 |
import PaiaiUIKit |
12 | 12 |
|
13 | 13 |
protocol CreateGroupViewControllerDelegate: class { |
14 |
- func didSelect(_ item: GroupItem) |
|
14 |
+ func createGroupViewControllerDidSelect(_ item: GroupItem) |
|
15 | 15 |
func navigateToCreateGroupConfirm() |
16 | 16 |
} |
17 | 17 |
|
@@ -59,7 +59,7 @@ extension CreateGroupViewController: UITableViewDataSource, UITableViewDelegate |
||
59 | 59 |
case 0: |
60 | 60 |
self.delegate?.navigateToCreateGroupConfirm() |
61 | 61 |
default: |
62 |
- self.delegate?.didSelect(ShareRecentGroupInfo[indexPath.row - 1]) |
|
62 |
+ self.delegate?.createGroupViewControllerDidSelect(ShareRecentGroupInfo[indexPath.row - 1]) |
|
63 | 63 |
} |
64 | 64 |
} |
65 | 65 |
|
@@ -79,3 +79,8 @@ extension CreateGroupViewController: UITableViewDataSource, UITableViewDelegate |
||
79 | 79 |
} |
80 | 80 |
} |
81 | 81 |
|
82 |
+extension CreateGroupViewController: Storyboarded { |
|
83 |
+ static func instantiate() -> CreateGroupViewController { |
|
84 |
+ return UIStoryboard.main.instantiateViewController(type: CreateGroupViewController.self) |
|
85 |
+ } |
|
86 |
+} |
@@ -1,71 +1,67 @@ |
||
1 | 1 |
// |
2 | 2 |
// HomeCoordinator.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by ffib on 2018/12/6. |
|
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2018/12/6. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 |
+import RxSwift |
|
10 | 11 |
import PaiaiDataKit |
11 |
-import PaiaiUIKit |
|
12 | 12 |
|
13 |
-class HomeCoordinator: Coordinator { |
|
14 |
- fileprivate var coordinators = [CoordinatorKey: Coordinator]() |
|
13 |
+class HomeCoordinator: BaseCoordinator<Void> { |
|
15 | 14 |
|
16 | 15 |
var homeViewController: HomeViewController |
17 | 16 |
var navigationController: UINavigationController |
18 | 17 |
var shareUserInfoViewModel: UserInfoViewModel |
19 | 18 |
|
20 |
- init(_ homeVC: HomeViewController, |
|
19 |
+ init(_ viewController: HomeViewController, |
|
21 | 20 |
navigationController: UINavigationController, |
22 | 21 |
userInfoViewModel: UserInfoViewModel) { |
23 |
- homeViewController = homeVC |
|
22 |
+ self.homeViewController = viewController |
|
24 | 23 |
self.navigationController = navigationController |
25 |
- shareUserInfoViewModel = userInfoViewModel |
|
26 |
- homeViewController.viewModel.delegate = self |
|
24 |
+ self.shareUserInfoViewModel = userInfoViewModel |
|
27 | 25 |
} |
28 | 26 |
|
29 |
- func start() { |
|
27 |
+ @discardableResult |
|
28 |
+ override func start() -> Observable<Void> { |
|
29 |
+ homeViewController.viewModel.delegate = self |
|
30 | 30 |
|
31 |
+ return Observable.never() |
|
31 | 32 |
} |
32 | 33 |
} |
33 | 34 |
|
34 | 35 |
extension HomeCoordinator: HomeViewModelDelegate { |
35 | 36 |
func didSelect(_ items: [PhotoItem], currIndex: Int) { |
36 |
- let ctl = UIStoryboard.photoDetail.instantiateController(PhotoDetailViewController.self) |
|
37 |
- let coordinator = PhotoDetailCoordinator(ctl, nav: navigationController, |
|
37 |
+ let vc = PhotoDetailViewController.instantiate() |
|
38 |
+ let coordinator = PhotoDetailCoordinator(vc, |
|
39 |
+ nav: navigationController, |
|
38 | 40 |
viewModel: PhotoDetailViewModel(items: items, currIndex: currIndex)) |
39 |
- coordinators[.photoDetail] = coordinator |
|
40 |
- coordinator.start() |
|
41 |
+ coordinator.start().subscribe().disposed(by: disposeBag) |
|
41 | 42 |
navigationController.pushViewController(coordinator.photoDetailViewController) |
42 | 43 |
} |
43 | 44 |
|
44 | 45 |
func createGroup() { |
45 |
- let ctl = UIStoryboard.main.instantiateCreateGroupViewController() |
|
46 |
+ let ctl = CreateGroupViewController.instantiate() |
|
46 | 47 |
ctl.delegate = self |
47 | 48 |
homeViewController.presentController(ctl) |
48 | 49 |
} |
49 | 50 |
|
50 | 51 |
func scanQR() { |
51 |
- let ctl = UIStoryboard.main.instantiateScanQRViewController() |
|
52 |
+ let ctl = ScanQRViewController.instantiate() |
|
52 | 53 |
ctl.viewModel.delegate = self |
53 | 54 |
navigationController.pushViewController(ctl) |
54 | 55 |
} |
55 | 56 |
} |
56 | 57 |
|
57 | 58 |
extension HomeCoordinator: CreateGroupViewControllerDelegate { |
58 |
- func didSelect(_ item: GroupItem) { |
|
59 |
- let ctl = UIStoryboard.group.instantiateController(GroupViewController.self) |
|
60 |
- ctl.viewModel = GroupViewModel(groupItem: item) |
|
61 |
- let coordinator = GroupCoordinator(ctl, |
|
62 |
- navigationController: navigationController) |
|
63 |
- coordinators[.group] = coordinator |
|
64 |
- navigationController.pushViewController(ctl) |
|
59 |
+ func createGroupViewControllerDidSelect(_ item: GroupItem) { |
|
60 |
+ coordinateToGroupCoordinator(item: item, navigationSource: .recentGroup) |
|
65 | 61 |
} |
66 | 62 |
|
67 | 63 |
func navigateToCreateGroupConfirm() { |
68 |
- let ctl = UIStoryboard.main.instantiateCreateGroupConfirmViewController() |
|
64 |
+ let ctl = CreateGroupConfirmViewController.instantiate() |
|
69 | 65 |
ctl.viewModel = CreateGroupViewModel(userInfoViewModel: shareUserInfoViewModel) |
70 | 66 |
ctl.viewModel.delegate = self |
71 | 67 |
homeViewController.presentController(ctl) |
@@ -74,43 +70,31 @@ extension HomeCoordinator: CreateGroupViewControllerDelegate { |
||
74 | 70 |
|
75 | 71 |
extension HomeCoordinator: CreateGroupViewModelDelegate { |
76 | 72 |
func navigateToGroup(_ item: GroupItem) { |
77 |
- guard let vc = homeViewController.presentedViewController, vc.isMember(of: CreateGroupConfirmViewController.self) else { return } |
|
73 |
+ guard let vc = homeViewController.presentedViewController, |
|
74 |
+ vc.isMember(of: CreateGroupConfirmViewController.self) else { return } |
|
78 | 75 |
vc.dismissController() |
79 |
- |
|
80 |
- let ctl = UIStoryboard.group.instantiateController(GroupViewController.self) |
|
81 |
- ctl.viewModel = GroupViewModel(groupItem: item) |
|
82 |
- let coordinator = GroupCoordinator(ctl, |
|
83 |
- navigationController: navigationController) |
|
84 |
- coordinators[.group] = coordinator |
|
85 |
- navigationController.pushViewController(ctl) |
|
76 |
+ coordinateToGroupCoordinator(item: item, navigationSource: .createGroup) |
|
86 | 77 |
} |
87 | 78 |
} |
88 | 79 |
|
89 | 80 |
extension HomeCoordinator: ScanQRViewModelDelegate { |
90 | 81 |
func navigateToGroupFromScanQR(_ item: GroupItem) { |
91 |
- let ctl = UIStoryboard.group.instantiateController(GroupViewController.self) |
|
92 |
- ctl.viewModel = GroupViewModel(groupItem: item) |
|
93 |
- let coordinator = GroupCoordinator(ctl, |
|
94 |
- navigationController: navigationController) |
|
95 |
- coordinators[.group] = coordinator |
|
96 |
- navigationController.pushViewController(ctl) |
|
82 |
+ coordinateToGroupCoordinator(item: item, navigationSource: .scan) |
|
97 | 83 |
} |
98 | 84 |
} |
99 | 85 |
|
100 |
-extension UIStoryboard { |
|
101 |
- fileprivate func instantiateCreateGroupViewController() -> CreateGroupViewController { |
|
102 |
- let createGroupVC = instantiateController(CreateGroupViewController.self) |
|
103 |
- return createGroupVC |
|
104 |
- } |
|
105 |
- |
|
106 |
- fileprivate func instantiateCreateGroupConfirmViewController() -> CreateGroupConfirmViewController { |
|
107 |
- let createGroupConfirmVC = instantiateController(CreateGroupConfirmViewController.self) |
|
108 |
- return createGroupConfirmVC |
|
109 |
- } |
|
110 |
- |
|
111 |
- fileprivate func instantiateScanQRViewController() -> ScanQRViewController { |
|
112 |
- let scanQRVC = instantiateController(ScanQRViewController.self) |
|
113 |
- return scanQRVC |
|
86 |
+fileprivate extension HomeCoordinator { |
|
87 |
+ func coordinateToGroupCoordinator(item: GroupItem, navigationSource: NavigationSource.Group) { |
|
88 |
+ let vc = GroupViewController.instantiate() |
|
89 |
+ vc.viewModel = GroupViewModel(groupItem: item) |
|
90 |
+ |
|
91 |
+ let coordinator = GroupCoordinator(vc, |
|
92 |
+ navigationController: navigationController, |
|
93 |
+ navigationSource: navigationSource) |
|
94 |
+ coordinate(to: coordinator).subscribe().disposed(by: disposeBag) |
|
95 |
+ |
|
96 |
+ navigationController.pushViewController(vc) |
|
97 |
+ |
|
114 | 98 |
} |
115 | 99 |
} |
116 | 100 |
|
@@ -1,6 +1,6 @@ |
||
1 | 1 |
// HomeViewController.swift |
2 |
-// PaiAi// |
|
3 |
-// Created by zhengjianfei on 16/3/28. |
|
2 |
+// Paiai_iOS |
|
3 |
+// Created by FFIB on 16/3/28. |
|
4 | 4 |
// Copyright © 2016年 FFIB. All rights reserved. |
5 | 5 |
// |
6 | 6 |
|
@@ -146,3 +146,9 @@ extension HomeViewController: UICollectionViewDelegateFlowLayout { |
||
146 | 146 |
return viewModel.layoutSizeForIndexPath(indexPath) |
147 | 147 |
} |
148 | 148 |
} |
149 |
+ |
|
150 |
+extension HomeViewController: Storyboarded { |
|
151 |
+ static func instantiate() -> HomeViewController { |
|
152 |
+ return UIStoryboard.main.instantiateViewController(type: HomeViewController.self) |
|
153 |
+ } |
|
154 |
+} |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// ScanQRViewController.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/4/8. |
|
5 |
+// Created by FFIB on 16/4/8. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -24,8 +24,7 @@ final class ScanQRViewController: UIViewController { |
||
24 | 24 |
override func viewDidLoad() { |
25 | 25 |
super.viewDidLoad() |
26 | 26 |
scanView.delegate = self |
27 |
-// viewModel.join(code: "http://pai.ai/g/SpA5be3") |
|
28 |
- setNavigationBar() |
|
27 |
+ viewModel.join(code: "http://pai.ai/g/SpA5be3") |
|
29 | 28 |
} |
30 | 29 |
|
31 | 30 |
func setNavigationBar() { |
@@ -35,7 +34,7 @@ final class ScanQRViewController: UIViewController { |
||
35 | 34 |
|
36 | 35 |
override func viewWillAppear(_ animated: Bool) { |
37 | 36 |
super.viewWillAppear(animated) |
38 |
- |
|
37 |
+ setNavigationBar() |
|
39 | 38 |
} |
40 | 39 |
|
41 | 40 |
override func viewWillDisappear(_ animated: Bool) { |
@@ -67,3 +66,9 @@ extension ScanQRViewController: QRCodeScanViewDelegate { |
||
67 | 66 |
} |
68 | 67 |
|
69 | 68 |
extension ScanQRViewController: NavigationBackViewController {} |
69 |
+ |
|
70 |
+extension ScanQRViewController: Storyboarded { |
|
71 |
+ static func instantiate() -> ScanQRViewController { |
|
72 |
+ return UIStoryboard.main.instantiateViewController(type: ScanQRViewController.self) |
|
73 |
+ } |
|
74 |
+} |
@@ -0,0 +1,28 @@ |
||
1 |
+// |
|
2 |
+// LoginCoordinator.swift |
|
3 |
+// Paiai_iOS |
|
4 |
+// |
|
5 |
+// Created by ffib on 2019/4/30. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 |
+// |
|
8 |
+ |
|
9 |
+import UIKit |
|
10 |
+import RxSwift |
|
11 |
+import PaiaiDataKit |
|
12 |
+ |
|
13 |
+class LoginCoordinator: BaseCoordinator<UserInfo> { |
|
14 |
+ private let rootViewController: UIViewController |
|
15 |
+ private let loginViewController: LoginViewController |
|
16 |
+ |
|
17 |
+ init(_ loginViewController: LoginViewController, |
|
18 |
+ rootViewController: UIViewController) { |
|
19 |
+ self.rootViewController = rootViewController |
|
20 |
+ self.loginViewController = loginViewController |
|
21 |
+ } |
|
22 |
+ |
|
23 |
+ override func start() -> Observable<UserInfo> { |
|
24 |
+ let viewModel = UserInfoViewModel() |
|
25 |
+ loginViewController.userInfoViewModel = viewModel |
|
26 |
+ return viewModel.shareUserInfo.asObservable() |
|
27 |
+ } |
|
28 |
+} |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// LoginViewController.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/4/17. |
|
5 |
+// Created by FFIB on 16/4/17. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -85,3 +85,9 @@ extension LoginViewController { |
||
85 | 85 |
}).disposed(by: disposeBag) |
86 | 86 |
} |
87 | 87 |
} |
88 |
+ |
|
89 |
+extension LoginViewController: Storyboarded { |
|
90 |
+ static func instantiate() -> LoginViewController { |
|
91 |
+ return UIStoryboard.main.instantiateViewController(type: LoginViewController.self) |
|
92 |
+ } |
|
93 |
+} |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// MessageCommentAndThumbupCell.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/4/8. |
|
5 |
+// Created by FFIB on 16/4/8. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -1,35 +1,43 @@ |
||
1 | 1 |
// |
2 | 2 |
// MessageCoordinator.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by ffib on 2018/12/7. |
|
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2018/12/7. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 |
+import RxSwift |
|
10 | 11 |
import PaiaiDataKit |
11 | 12 |
|
12 |
-class MessageCoordinator: Coordinator { |
|
13 |
- let messageViewController: MessageViewController |
|
14 |
- let navigationController: UINavigationController |
|
15 |
- var shareUserInfoViewModel: UserInfoViewModel |
|
13 |
+class MessageCoordinator: BaseCoordinator<Void> { |
|
14 |
+ fileprivate let messageViewController: MessageViewController |
|
15 |
+ fileprivate let navigationController: UINavigationController |
|
16 | 16 |
|
17 |
- init(_ messageVC: MessageViewController, |
|
18 |
- navigationController: UINavigationController, |
|
19 |
- userInfoViewModel: UserInfoViewModel) { |
|
20 |
- messageViewController = messageVC |
|
17 |
+ init(_ viewController: MessageViewController, |
|
18 |
+ navigationController: UINavigationController) { |
|
19 |
+ messageViewController = viewController |
|
21 | 20 |
self.navigationController = navigationController |
22 |
- shareUserInfoViewModel = userInfoViewModel |
|
21 |
+ } |
|
22 |
+ |
|
23 |
+ override func start() -> Observable<Void> { |
|
23 | 24 |
messageViewController.viewModel.delegate = self |
25 |
+ |
|
26 |
+ return Observable.never() |
|
24 | 27 |
} |
25 | 28 |
} |
26 | 29 |
|
27 | 30 |
extension MessageCoordinator { |
28 | 31 |
fileprivate func makeMessageListViewContorller(type: MessageType) -> MessageListViewController { |
29 |
- let vc = UIStoryboard.message.instantiateController(MessageListViewController.self) |
|
32 |
+ let vc = MessageListViewController.instantiate() |
|
30 | 33 |
vc.type = type |
31 | 34 |
vc.viewModel = MessageListViewModel(type: type) |
32 | 35 |
vc.viewModel.delegate = self |
36 |
+ |
|
37 |
+ /// 已读消息,红点提示显示与否 |
|
38 |
+ vc.viewModel.messageReaded.subscribe(onNext: { isReaded in |
|
39 |
+ self.messageViewController.viewModel.readedTip.accept(!isReaded) |
|
40 |
+ }).disposed(by: disposeBag) |
|
33 | 41 |
return vc |
34 | 42 |
} |
35 | 43 |
} |
@@ -52,4 +60,3 @@ extension UIStoryboard { |
||
52 | 60 |
return UIStoryboard(name: "Message", bundle: Bundle(identifier: "com.Paiai-iOS")) |
53 | 61 |
} |
54 | 62 |
} |
55 |
- |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// MessageListViewController.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by mac on 16/5/13. |
|
5 |
+// Created by FFIB on 16/5/13. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -179,3 +179,9 @@ fileprivate extension MessageListViewController { |
||
179 | 179 |
} |
180 | 180 |
|
181 | 181 |
extension MessageListViewController: NavigationBackViewController {} |
182 |
+ |
|
183 |
+extension MessageListViewController: Storyboarded { |
|
184 |
+ static func instantiate() -> MessageListViewController { |
|
185 |
+ return UIStoryboard.message.instantiateViewController(type: MessageListViewController.self) |
|
186 |
+ } |
|
187 |
+} |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// MessageSystemCell.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by mac on 16/5/13. |
|
5 |
+// Created by FFIB on 16/5/13. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -1,16 +1,17 @@ |
||
1 | 1 |
// |
2 | 2 |
// MessageViewController.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 | 5 |
// Created by FFIB on 2018/6/14. |
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
10 | 10 |
import RxSwift |
11 |
+import PaiaiUIKit |
|
11 | 12 |
import PaiaiDataKit |
12 | 13 |
|
13 |
-class MessageViewController: UIViewController { |
|
14 |
+final class MessageViewController: UIViewController { |
|
14 | 15 |
|
15 | 16 |
@IBOutlet weak var sysUnreadTip: UIView! |
16 | 17 |
@IBOutlet weak var thumbupUnreadTip: UIView! |
@@ -62,3 +63,9 @@ extension MessageViewController { |
||
62 | 63 |
}).disposed(by: disposeBag) |
63 | 64 |
} |
64 | 65 |
} |
66 |
+ |
|
67 |
+extension MessageViewController: Storyboarded { |
|
68 |
+ static func instantiate() -> MessageViewController { |
|
69 |
+ return UIStoryboard.message.instantiateViewController(type: MessageViewController.self) |
|
70 |
+ } |
|
71 |
+} |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// GroupCell.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/4/4. |
|
5 |
+// Created by FFIB on 16/4/4. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// MineAboutViewController.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/4/7. |
|
5 |
+// Created by FFIB on 16/4/7. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -21,6 +21,8 @@ final class MineAboutViewController: UIViewController { |
||
21 | 21 |
|
22 | 22 |
private var disposeBag = DisposeBag() |
23 | 23 |
|
24 |
+ var didCancel = PublishSubject<Void>() |
|
25 |
+ |
|
24 | 26 |
// MARK: view function |
25 | 27 |
override func viewDidLoad() { |
26 | 28 |
super.viewDidLoad() |
@@ -31,6 +33,11 @@ final class MineAboutViewController: UIViewController { |
||
31 | 33 |
versionLabel.text = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String |
32 | 34 |
bindGestures() |
33 | 35 |
} |
36 |
+ |
|
37 |
+ override func viewWillDisappear(_ animated: Bool) { |
|
38 |
+ super.viewWillDisappear(animated) |
|
39 |
+ didCancel.onNext(()) |
|
40 |
+ } |
|
34 | 41 |
} |
35 | 42 |
|
36 | 43 |
fileprivate extension MineAboutViewController { |
@@ -73,3 +80,9 @@ fileprivate extension MineAboutViewController { |
||
73 | 80 |
} |
74 | 81 |
|
75 | 82 |
extension MineAboutViewController: NavigationBackViewController {} |
83 |
+ |
|
84 |
+extension MineAboutViewController: Storyboarded { |
|
85 |
+ static func instantiate() -> MineAboutViewController { |
|
86 |
+ return UIStoryboard.mine.instantiateViewController(type: MineAboutViewController.self) |
|
87 |
+ } |
|
88 |
+} |
@@ -1,38 +1,36 @@ |
||
1 | 1 |
// |
2 | 2 |
// MineCoordinator.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by ffib on 2018/12/6. |
|
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2018/12/6. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 |
+import RxSwift |
|
10 | 11 |
import PaiaiDataKit |
11 |
-import PaiaiUIKit |
|
12 | 12 |
|
13 |
-class MineCoordinator: Coordinator { |
|
13 |
+class MineCoordinator: BaseCoordinator<Void> { |
|
14 | 14 |
|
15 | 15 |
let mineViewController: MineViewController |
16 |
- let navigationController: UINavigationController |
|
17 |
- var childCoordinator = [CoordinatorKey: Coordinator]() |
|
18 |
- let mainViewController: ContainerViewController |
|
19 |
-// let shareUserInfoViewModel |
|
16 |
+ fileprivate let navigationController: UINavigationController |
|
20 | 17 |
|
21 |
- init(_ mineViewController: MineViewController, navigationController: UINavigationController, mainViewController: ContainerViewController) { |
|
22 |
- self.mineViewController = mineViewController |
|
18 |
+ init(_ viewController: MineViewController, |
|
19 |
+ navigationController: UINavigationController) { |
|
20 |
+ self.mineViewController = viewController |
|
23 | 21 |
self.navigationController = navigationController |
24 |
- self.mainViewController = mainViewController |
|
25 |
- self.mineViewController.delegate = self |
|
26 | 22 |
} |
27 | 23 |
|
28 |
- func start() { |
|
29 |
- |
|
24 |
+ override func start() -> Observable<Void> { |
|
25 |
+ mineViewController.delegate = self |
|
26 |
+ return didCancel |
|
30 | 27 |
} |
31 | 28 |
} |
32 | 29 |
|
33 | 30 |
extension MineCoordinator: MineViewControllerDelegate { |
34 | 31 |
func logout() { |
35 | 32 |
mineViewController.dismissController() |
33 |
+ didCancel.onNext(()) |
|
36 | 34 |
|
37 | 35 |
let vc = makeLoginViewController() |
38 | 36 |
vc.userInfoViewModel = mineViewController.userInfoViewModel |
@@ -49,12 +47,24 @@ extension MineCoordinator: MineViewControllerDelegate { |
||
49 | 47 |
navigationController.pushViewController(vc) |
50 | 48 |
case .order: |
51 | 49 |
let vc = makeMineOrderViewController() |
50 |
+ |
|
51 |
+ vc.viewModel.didCancel.subscribe { _ in |
|
52 |
+ self.didCancel.onNext(()) |
|
53 |
+ }.disposed(by: disposeBag) |
|
52 | 54 |
navigationController.pushViewController(vc) |
53 | 55 |
case .feedback: |
54 | 56 |
let vc = makeMineFeedbackViewController() |
57 |
+ |
|
58 |
+ vc.didCancel.subscribe { _ in |
|
59 |
+ self.didCancel.onNext(()) |
|
60 |
+ }.disposed(by: disposeBag) |
|
55 | 61 |
navigationController.pushViewController(vc) |
56 | 62 |
case .about: |
57 | 63 |
let vc = makeMineAboutViewController() |
64 |
+ |
|
65 |
+ vc.didCancel.subscribe { _ in |
|
66 |
+ self.didCancel.onNext(()) |
|
67 |
+ }.disposed(by: disposeBag) |
|
58 | 68 |
navigationController.pushViewController(vc) |
59 | 69 |
} |
60 | 70 |
} |
@@ -66,39 +76,42 @@ extension MineCoordinator: MineViewControllerDelegate { |
||
66 | 76 |
extension MineCoordinator: MineGroupViewModelDelegate { |
67 | 77 |
func didSelect(_ item: GroupItem) { |
68 | 78 |
let coordinator = GroupCoordinator(makeGroupViewController(item: item), |
69 |
- navigationController: navigationController) |
|
70 |
- childCoordinator[.group] = coordinator |
|
79 |
+ navigationController: navigationController, |
|
80 |
+ navigationSource: .mineGroup) |
|
81 |
+ coordinate(to: coordinator).subscribe({[weak self] _ in |
|
82 |
+ self?.didCancel.onNext(()) |
|
83 |
+ }).disposed(by: disposeBag) |
|
71 | 84 |
navigationController.pushViewController(coordinator.groupViewController) |
72 | 85 |
} |
73 | 86 |
} |
74 | 87 |
|
75 | 88 |
fileprivate extension MineCoordinator { |
76 | 89 |
func makeLoginViewController() -> LoginViewController { |
77 |
- let vc = UIStoryboard.main.instantiateController(LoginViewController.self) |
|
90 |
+ let vc = LoginViewController.instantiate() |
|
78 | 91 |
// vc.userInfoViewModel = shareUserInfoViewModel |
79 | 92 |
return vc |
80 | 93 |
} |
81 | 94 |
|
82 | 95 |
func makeMineGroupViewController() -> MineGroupViewController { |
83 |
- let vc = UIStoryboard.mine.instantiateController(MineGroupViewController.self) |
|
96 |
+ let vc = MineGroupViewController.instantiate() |
|
84 | 97 |
vc.viewModel = MineGroupViewModel() |
85 | 98 |
return vc |
86 | 99 |
} |
87 | 100 |
|
88 | 101 |
func makeMineOrderViewController() -> MineOrderViewController { |
89 |
- let vc = UIStoryboard.mine.instantiateController(MineOrderViewController.self) |
|
102 |
+ let vc = MineOrderViewController.instantiate() |
|
90 | 103 |
vc.viewModel = MineOrderViewModel() |
91 | 104 |
return vc |
92 | 105 |
} |
93 | 106 |
|
94 | 107 |
func makeMineFeedbackViewController() -> MineFeedbackViewController { |
95 |
- let vc = UIStoryboard.mine.instantiateController(MineFeedbackViewController.self) |
|
108 |
+ let vc = MineFeedbackViewController.instantiate() |
|
96 | 109 |
vc.feedbackAPI = FeedbackRemoteAPI() |
97 | 110 |
return vc |
98 | 111 |
} |
99 | 112 |
|
100 | 113 |
func makeMineAboutViewController() -> MineAboutViewController { |
101 |
- let vc = UIStoryboard.mine.instantiateController(MineAboutViewController.self) |
|
114 |
+ let vc = MineAboutViewController.instantiate() |
|
102 | 115 |
return vc |
103 | 116 |
} |
104 | 117 |
|
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// MineFeedbackViewController.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/4/7. |
|
5 |
+// Created by FFIB on 16/4/7. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -19,6 +19,7 @@ final class MineFeedbackViewController: UIViewController { |
||
19 | 19 |
|
20 | 20 |
fileprivate let disposeBag = DisposeBag() |
21 | 21 |
var feedbackAPI: FeedbackRemoteAPI! |
22 |
+ var didCancel = PublishSubject<Void>() |
|
22 | 23 |
|
23 | 24 |
override func viewDidLoad() { |
24 | 25 |
super.viewDidLoad() |
@@ -27,6 +28,11 @@ final class MineFeedbackViewController: UIViewController { |
||
27 | 28 |
textView.textContainerInset = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10) |
28 | 29 |
bindTextViewToSendBtn() |
29 | 30 |
} |
31 |
+ |
|
32 |
+ override func viewWillDisappear(_ animated: Bool) { |
|
33 |
+ super.viewWillDisappear(animated) |
|
34 |
+ didCancel.onNext(()) |
|
35 |
+ } |
|
30 | 36 |
} |
31 | 37 |
|
32 | 38 |
/// storyboard button action |
@@ -60,3 +66,9 @@ extension MineFeedbackViewController { |
||
60 | 66 |
} |
61 | 67 |
|
62 | 68 |
extension MineFeedbackViewController: NavigationBackViewController {} |
69 |
+ |
|
70 |
+extension MineFeedbackViewController: Storyboarded { |
|
71 |
+ static func instantiate() -> MineFeedbackViewController { |
|
72 |
+ return UIStoryboard.mine.instantiateViewController(type: MineFeedbackViewController.self) |
|
73 |
+ } |
|
74 |
+} |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// MineGroupViewController.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/4/4. |
|
5 |
+// Created by FFIB on 16/4/4. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -132,3 +132,9 @@ fileprivate extension MineGroupViewController { |
||
132 | 132 |
} |
133 | 133 |
|
134 | 134 |
extension MineGroupViewController: NavigationBackViewController {} |
135 |
+ |
|
136 |
+extension MineGroupViewController: Storyboarded { |
|
137 |
+ static func instantiate() -> MineGroupViewController { |
|
138 |
+ return UIStoryboard.mine.instantiateViewController(type: MineGroupViewController.self) |
|
139 |
+ } |
|
140 |
+} |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// MineOrderViewController.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/4/7. |
|
5 |
+// Created by FFIB on 16/4/7. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -115,3 +115,9 @@ fileprivate extension MineOrderViewController { |
||
115 | 115 |
} |
116 | 116 |
|
117 | 117 |
extension MineOrderViewController: NavigationBackViewController {} |
118 |
+ |
|
119 |
+extension MineOrderViewController: Storyboarded { |
|
120 |
+ static func instantiate() -> MineOrderViewController { |
|
121 |
+ return UIStoryboard.mine.instantiateViewController(type: MineOrderViewController.self) |
|
122 |
+ } |
|
123 |
+} |
@@ -1,9 +1,9 @@ |
||
1 | 1 |
// |
2 | 2 |
// MineViewController.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by ffib on 2018/12/6. |
|
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2018/12/6. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -29,7 +29,7 @@ extension MineItem: CaseIterable { |
||
29 | 29 |
} |
30 | 30 |
} |
31 | 31 |
|
32 |
-class MineViewController: SideViewController { |
|
32 |
+final class MineViewController: SideViewController { |
|
33 | 33 |
|
34 | 34 |
@IBOutlet weak var headerImageView: UIImageView! |
35 | 35 |
@IBOutlet weak var nickNameLabel: UILabel! |
@@ -40,10 +40,10 @@ class MineViewController: SideViewController { |
||
40 | 40 |
return mineView |
41 | 41 |
} |
42 | 42 |
|
43 |
- lazy var menuImage: [String] = { |
|
43 |
+ fileprivate lazy var menuImage: [String] = { |
|
44 | 44 |
return ["mine-group", "mine-order", "mine-feedback", "mine-about"] |
45 | 45 |
}() |
46 |
- lazy var menuTitle: [String] = { |
|
46 |
+ fileprivate lazy var menuTitle: [String] = { |
|
47 | 47 |
return ["我的照片群", "订单记录", "意见反馈", "关于"] |
48 | 48 |
}() |
49 | 49 |
|
@@ -93,3 +93,9 @@ extension MineViewController: UITableViewDelegate { |
||
93 | 93 |
delegate?.didSelect(MineItem.allCases[indexPath.row]) |
94 | 94 |
} |
95 | 95 |
} |
96 |
+ |
|
97 |
+extension MineViewController: Storyboarded { |
|
98 |
+ static func instantiate() -> MineViewController { |
|
99 |
+ return UIStoryboard.mine.instantiateViewController(type: MineViewController.self) |
|
100 |
+ } |
|
101 |
+} |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// OrderCell.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/4/21. |
|
5 |
+// Created by FFIB on 16/4/21. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -1,9 +1,9 @@ |
||
1 | 1 |
// |
2 | 2 |
// PhotoCell.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 | 5 |
// Created by FFIB on 2017/10/27. |
6 |
-// Copyright © 2017年 yb. All rights reserved. |
|
6 |
+// Copyright © 2017年 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -27,7 +27,6 @@ class PhotoCell: UICollectionViewCell { |
||
27 | 27 |
func setInfo(_ info: PhotoItem, source: PhotoCellSource) { |
28 | 28 |
headImageView.cornerRadius = 15 |
29 | 29 |
headImageView.borderWidth = 0.5 |
30 |
- headLabel.text = info.group_name |
|
31 | 30 |
|
32 | 31 |
switch source { |
33 | 32 |
case .home: |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// ImageCell.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/4/9. |
|
5 |
+// Created by FFIB on 16/4/9. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// PhotoDetailCommentCell.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/4/8. |
|
5 |
+// Created by FFIB on 16/4/8. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -2,33 +2,31 @@ |
||
2 | 2 |
// PhotoDetailCoordinator.swift |
3 | 3 |
// Paiai_iOS |
4 | 4 |
// |
5 |
-// Created by ffib on 2018/12/19. |
|
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2018/12/19. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 |
-import Foundation |
|
9 |
+import UIKit |
|
10 |
+import RxSwift |
|
10 | 11 |
import PaiaiDataKit |
11 | 12 |
|
12 |
-final class PhotoDetailCoordinator: Coordinator { |
|
13 |
+final class PhotoDetailCoordinator: BaseCoordinator<Void> { |
|
13 | 14 |
let navigationController: UINavigationController |
14 | 15 |
let photoDetailViewController: PhotoDetailViewController |
15 | 16 |
let shareViewModel: PhotoDetailViewModel |
16 | 17 |
|
17 |
- fileprivate var coordinators = [CoordinatorKey: Coordinator]() |
|
18 |
- |
|
19 | 18 |
init(_ photoDetailVC: PhotoDetailViewController, |
20 | 19 |
nav: UINavigationController, |
21 | 20 |
viewModel: PhotoDetailViewModel) { |
22 | 21 |
photoDetailViewController = photoDetailVC |
23 | 22 |
shareViewModel = viewModel |
24 | 23 |
navigationController = nav |
25 |
- photoDetailViewController.viewModel = viewModel |
|
26 |
- |
|
27 |
- viewModel.delegate = self |
|
24 |
+ photoDetailViewController.viewModel = viewModel |
|
28 | 25 |
} |
29 | 26 |
|
30 |
- func start() { |
|
31 |
- |
|
27 |
+ override func start() -> Observable<Void> { |
|
28 |
+ photoDetailViewController.viewModel.delegate = self |
|
29 |
+ return .never() |
|
32 | 30 |
} |
33 | 31 |
} |
34 | 32 |
|
@@ -37,14 +35,15 @@ extension PhotoDetailCoordinator: PhotoDetailViewModelDelegate { |
||
37 | 35 |
let vc = GroupViewController.instantiate() |
38 | 36 |
vc.viewModel = GroupViewModel(groupItem: item) |
39 | 37 |
let coordinator = GroupCoordinator(vc, |
40 |
- navigationController: navigationController) |
|
41 |
- coordinators[.group] = coordinator |
|
38 |
+ navigationController: navigationController, |
|
39 |
+ navigationSource: .photoDetail) |
|
42 | 40 |
|
41 |
+ coordinate(to: coordinator).subscribe().disposed(by: disposeBag) |
|
43 | 42 |
navigationController.pushViewController(vc) |
44 | 43 |
} |
45 | 44 |
|
46 | 45 |
func didSelected() { |
47 |
- let vc = UIStoryboard.photoDetail.instantiateController(PhotoPreviewViewController.self) |
|
46 |
+ let vc = PhotoPreviewViewController.instantiate() |
|
48 | 47 |
vc.viewModel = shareViewModel |
49 | 48 |
photoDetailViewController.presentController(vc) |
50 | 49 |
} |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// PhotoDetailImageCell.swift |
3 | 3 |
// Paiai_iOS |
4 | 4 |
// |
5 |
-// Created by ffib on 2019/3/19. |
|
6 |
-// Copyright © 2019 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2019/3/19. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
import UIKit |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// PhotoDetailViewController.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/4/6. |
|
5 |
+// Created by FFIB on 16/4/6. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -97,11 +97,11 @@ extension PhotoDetailViewController { |
||
97 | 97 |
/// bind storyboard button action |
98 | 98 |
extension PhotoDetailViewController { |
99 | 99 |
@IBAction func share() { |
100 |
- let ctl = UIStoryboard.photoDetail.instantiateController(ShareViewController.self) |
|
101 |
- ctl.shareContent = "我使用拍爱分享了一张美图,你也快来试试吧" |
|
102 |
- // ctl.shareImgUrlThumb = datas[currentPhotoIndex].photo_thumbnail_url |
|
103 |
- // ctl.shareUrl = datas[currentPhotoIndex].photo_share_url |
|
104 |
- presentController(ctl) |
|
100 |
+// let ctl = ShareViewController UIStoryboard.photoDetail.instantiateController(ShareViewController.self) |
|
101 |
+// ctl.shareContent = "我使用拍爱分享了一张美图,你也快来试试吧" |
|
102 |
+// // ctl.shareImgUrlThumb = datas[currentPhotoIndex].photo_thumbnail_url |
|
103 |
+// // ctl.shareUrl = datas[currentPhotoIndex].photo_share_url |
|
104 |
+// presentController(ctl) |
|
105 | 105 |
} |
106 | 106 |
|
107 | 107 |
@IBAction func comment() { |
@@ -380,3 +380,9 @@ extension PhotoDetailViewController: UICollectionViewDelegateFlowLayout { |
||
380 | 380 |
} |
381 | 381 |
|
382 | 382 |
extension PhotoDetailViewController: NavigationBackViewController {} |
383 |
+ |
|
384 |
+extension PhotoDetailViewController: Storyboarded { |
|
385 |
+ static func instantiate() -> PhotoDetailViewController { |
|
386 |
+ return UIStoryboard.photoDetail.instantiateViewController(type: PhotoDetailViewController.self) |
|
387 |
+ } |
|
388 |
+} |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// PhotoPreviewViewController.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/4/9. |
|
5 |
+// Created by FFIB on 16/4/9. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -122,3 +122,9 @@ extension PhotoPreviewViewController: UICollectionViewDelegateFlowLayout { |
||
122 | 122 |
return CGSize(width: collectionView.width, height: collectionView.height - 20) |
123 | 123 |
} |
124 | 124 |
} |
125 |
+ |
|
126 |
+extension PhotoPreviewViewController: Storyboarded { |
|
127 |
+ static func instantiate() -> PhotoPreviewViewController { |
|
128 |
+ return UIStoryboard.photoDetail.instantiateViewController(type: PhotoPreviewViewController.self) |
|
129 |
+ } |
|
130 |
+} |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// ShareViewController.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by zhengjianfei on 16/4/7. |
|
5 |
+// Created by FFIB on 16/4/7. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -2,8 +2,8 @@ |
||
2 | 2 |
// Paiai_iOS.h |
3 | 3 |
// Paiai_iOS |
4 | 4 |
// |
5 |
-// Created by ffib on 2018/12/19. |
|
6 |
-// Copyright © 2018 yb. All rights reserved. |
|
5 |
+// Created by FFIB on 2018/12/19. |
|
6 |
+// Copyright © 2018 FFIB. All rights reserved. |
|
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
#import <UIKit/UIKit.h> |
@@ -0,0 +1,41 @@ |
||
1 |
+// |
|
2 |
+// BaseCoordinator.swift |
|
3 |
+// Paiai_iOS |
|
4 |
+// |
|
5 |
+// Created by FFIB on 2019/4/29. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 |
+// |
|
8 |
+ |
|
9 |
+import RxSwift |
|
10 |
+import Foundation |
|
11 |
+ |
|
12 |
+public class BaseCoordinator<ResultType> { |
|
13 |
+ |
|
14 |
+ typealias CoordinationResult = ResultType |
|
15 |
+ |
|
16 |
+ let disposeBag = DisposeBag() |
|
17 |
+ let didCancel = PublishSubject<Void>() |
|
18 |
+ |
|
19 |
+ private let identifier = UUID() |
|
20 |
+ private var childCoordinators = [UUID: Any]() |
|
21 |
+ |
|
22 |
+ private func store<T>(coordinator: BaseCoordinator<T>) { |
|
23 |
+ childCoordinators[coordinator.identifier] = coordinator |
|
24 |
+ } |
|
25 |
+ |
|
26 |
+ private func free<T>(coordinator: BaseCoordinator<T>) { |
|
27 |
+ childCoordinators[coordinator.identifier] = nil |
|
28 |
+ } |
|
29 |
+ |
|
30 |
+ func coordinate<T>(to coordinator: BaseCoordinator<T>) -> Observable<T> { |
|
31 |
+ store(coordinator: coordinator) |
|
32 |
+ return coordinator.start() |
|
33 |
+ .do(onNext: { [weak self] _ in |
|
34 |
+ self?.free(coordinator: coordinator) |
|
35 |
+ }) |
|
36 |
+ } |
|
37 |
+ |
|
38 |
+ func start() -> Observable<ResultType> { |
|
39 |
+ fatalError("Start method should be implemented.") |
|
40 |
+ } |
|
41 |
+} |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
// |
2 | 2 |
// UIImageView+Kingfisher.swift |
3 |
-// PaiAi |
|
3 |
+// Paiai_iOS |
|
4 | 4 |
// |
5 |
-// Created by mac on 16/7/21. |
|
5 |
+// Created by FFIB on 16/7/21. |
|
6 | 6 |
// Copyright © 2016年 FFIB. All rights reserved. |
7 | 7 |
// |
8 | 8 |
|
@@ -0,0 +1,11 @@ |
||
1 |
+// |
|
2 |
+// NavigationSource.swift |
|
3 |
+// Paiai_iOS |
|
4 |
+// |
|
5 |
+// Created by ffib on 2019/5/5. |
|
6 |
+// Copyright © 2019 FFIB. All rights reserved. |
|
7 |
+// |
|
8 |
+ |
|
9 |
+import Foundation |
|
10 |
+ |
|
11 |
+enum NavigationSource {} |