td> 870
 			path = Reusable;
@@ -861,6 +878,15 @@
861 878
 			path = Extension;
862 879
 			sourceTree = "<group>";
863 880
 		};
881
+		051FA66A2277F02100A5ECC2 /* Login */ = {
882
+			isa = PBXGroup;
883
+			children = (
884
+				051FA66B2277F03700A5ECC2 /* LoginCoordinator.swift */,
885
+				A69FFA791E7002970006FEE0 /* LoginViewController.swift */,
886
+			);
887
+			path = Login;
888
+			sourceTree = "<group>";
889
+		};
864 890
 		0521144421EF38B60047C55A /* PaiaiDataKitTests */ = {
865 891
 			isa = PBXGroup;
866 892
 			children = (
@@ -1047,7 +1073,7 @@
1047 1073
 		058C33EC2272F79800A435E9 /* NavigationBack */ = {
1048 1074
 			isa = PBXGroup;
1049 1075
 			children = (
1050
-				0500C26421E8644E009A7013 /* NavigationBackItemDelegate.swift */,
1076
+				0500C26421E8644E009A7013 /* NavigationBackViewController.swift */,
1051 1077
 				058C33ED2272F7BE00A435E9 /* UINavigationController+NavigationBack.swift */,
1052 1078
 			);
1053 1079
 			path = NavigationBack;
@@ -1150,6 +1176,25 @@
1150 1176
 			path = NavigationControllerDelegate;
1151 1177
 			sourceTree = "<group>";
1152 1178
 		};
1179
+		05D269E7227EDF490030062C /* ModelExtension */ = {
1180
+			isa = PBXGroup;
1181
+			children = (
1182
+				05D269E8227EDFA10030062C /* Array+GroupItem.swift */,
1183
+				05D269EA227EDFB00030062C /* Array+PhotoItem.swift */,
1184
+			);
1185
+			path = ModelExtension;
1186
+			sourceTree = "<group>";
1187
+		};
1188
+		05D269EC227EE0D60030062C /* Reusable */ = {
1189
+			isa = PBXGroup;
1190
+			children = (
1191
+				05D269ED227EE0EB0030062C /* GroupItemsOperator.swift */,
1192
+				05D269EF227EE0FC0030062C /* PhotoItemsOperator.swift */,
1193
+				05D269F5227EE7F40030062C /* ItemOperator.swift */,
1194
+			);
1195
+			path = Reusable;
1196
+			sourceTree = "<group>";
1197
+		};
1153 1198
 		05D3A3CB21FFFA3500A29A20 /* Group */ = {
1154 1199
 			isa = PBXGroup;
1155 1200
 			children = (
@@ -1620,7 +1665,7 @@
1620 1665
 				0513100221CA1B39004EF1BE /* CGSizeExt.swift in Sources */,
1621 1666
 				0513109A21CA3915004EF1BE /* QRCodeScanView.swift in Sources */,
1622 1667
 				05D3A3C621FF010900A29A20 /* WebViewController.swift in Sources */,
1623
-				0500C26521E8644E009A7013 /* NavigationBackItemDelegate.swift in Sources */,
1668
+				0500C26521E8644E009A7013 /* NavigationBackViewController.swift in Sources */,
1624 1669
 				057317A221F5C6A0009B2FCE /* BottomDefaultItem.swift in Sources */,
1625 1670
 				0513106021CA1E53004EF1BE /* UIStoryboardExt.swift in Sources */,
1626 1671
 				059B58A821F83B1600FA64C2 /* CenterCancelItem.swift in Sources */,
@@ -1702,9 +1747,11 @@
1702 1747
 				05C0D9A421D28591000B7B2A /* UserInfoRemoteAPI.swift in Sources */,
1703 1748
 				0513102B21CA1B67004EF1BE /* HomeRepository.swift in Sources */,
1704 1749
 				0535D6D921D32A89008D9403 /* WXUserInfoRemoteAPI.swift in Sources */,
1750
+				05D269F0227EE0FC0030062C /* PhotoItemsOperator.swift in Sources */,
1705 1751
 				0513102C21CA1B67004EF1BE /* OrderRepository.swift in Sources */,
1706 1752
 				057CA9BA21DC836B00FB7D03 /* GroupPhotoRemoteAPI.swift in Sources */,
1707 1753
 				0513102D21CA1B67004EF1BE /* GroupPhotoRepository.swift in Sources */,
1754
+				05D269E9227EDFA10030062C /* Array+GroupItem.swift in Sources */,
1708 1755
 				05C0D98E21D22119000B7B2A /* PhotoThumbupUserItem.swift in Sources */,
1709 1756
 				05C71C0821DDBD55003E7CEE /* JSONCode.swift in Sources */,
1710 1757
 				0513102E21CA1B67004EF1BE /* PhotoGroupRepository.swift in Sources */,
@@ -1716,6 +1763,8 @@
1716 1763
 				0513103121CA1B67004EF1BE /* MessageRepository.swift in Sources */,
1717 1764
 				0513103321CA1B67004EF1BE /* UserInfoRepository.swift in Sources */,
1718 1765
 				0513103521CA1B67004EF1BE /* RecentGroupInfo.swift in Sources */,
1766
+				05D269F6227EE7F40030062C /* ItemOperator.swift in Sources */,
1767
+				05D269EE227EE0EB0030062C /* GroupItemsOperator.swift in Sources */,
1719 1768
 				0513103921CA1B67004EF1BE /* HomeViewModel.swift in Sources */,
1720 1769
 				0543E80F21D1FD1100A42807 /* GroupDetailItem.swift in Sources */,
1721 1770
 				0513103A21CA1B67004EF1BE /* GroupViewModel.swift in Sources */,
@@ -1737,6 +1786,7 @@
1737 1786
 				0513104221CA1B67004EF1BE /* CreateGroupViewModel.swift in Sources */,
1738 1787
 				0513104321CA1B67004EF1BE /* ScanQRViewModel.swift in Sources */,
1739 1788
 				05130FB721C9E80F004EF1BE /* MessageListItem.swift in Sources */,
1789
+				05D269EB227EDFB00030062C /* Array+PhotoItem.swift in Sources */,
1740 1790
 				05B2C62121D727AA008063B3 /* StatusResource.swift in Sources */,
1741 1791
 				051310C021CB6EF4004EF1BE /* UserInfo.swift in Sources */,
1742 1792
 				05594BFF2240BEDE002D4910 /* PhotoDetailViewModel.swift in Sources */,
@@ -1774,15 +1824,17 @@
1774 1824
 				05130FEC21CA1B04004EF1BE /* MineCoordinator.swift in Sources */,
1775 1825
 				05130FED21CA1B04004EF1BE /* MineViewController.swift in Sources */,
1776 1826
 				05130FEE21CA1B04004EF1BE /* MineGroupViewController.swift in Sources */,
1827
+				05D269E6227ED9980030062C /* NavigationSource.swift in Sources */,
1777 1828
 				05130FEF21CA1B04004EF1BE /* MineFeedbackViewController.swift in Sources */,
1778 1829
 				05594C032240E94E002D4910 /* PhotoDetailImageCell.swift in Sources */,
1830
+				051FA6692276FA4300A5ECC2 /* BaseCoordinator.swift in Sources */,
1779 1831
 				05130FF021CA1B04004EF1BE /* MineOrderViewController.swift in Sources */,
1780 1832
 				05130FF121CA1B04004EF1BE /* MineAboutViewController.swift in Sources */,
1781 1833
 				05130FF721CA1B04004EF1BE /* PhotoDetailCommentCell.swift in Sources */,
1782
-				058D0C9D2249C94F006CA488 /* CoordinatorKey.swift in Sources */,
1783 1834
 				0513106B21CA3545004EF1BE /* PhotoDetailCoordinator.swift in Sources */,
1784 1835
 				05130FF821CA1B04004EF1BE /* ImageCell.swift in Sources */,
1785 1836
 				05130FF921CA1B04004EF1BE /* PhotoDetailViewController.swift in Sources */,
1837
+				051FA66C2277F03700A5ECC2 /* LoginCoordinator.swift in Sources */,
1786 1838
 				05130FFB21CA1B04004EF1BE /* ShareController.swift in Sources */,
1787 1839
 				05130FFC21CA1B04004EF1BE /* PhotoPreviewViewController.swift in Sources */,
1788 1840
 				05130FD721CA1ADF004EF1BE /* HomeCoordinator.swift in Sources */,

BIN
PaiAi/Paiai.xcodeproj/project.xcworkspace/xcuserdata/FFIB.xcuserdatad/UserInterfaceState.xcuserstate


+ 12 - 0
PaiAi/Paiai.xcodeproj/xcuserdata/FFIB.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -2,4 +2,16 @@
2 2
 <Bucket
3 3
    type = "1"
4 4
    version = "2.0">
5
+   <Breakpoints>
6
+      <BreakpointProxy
7
+         BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
8
+         <BreakpointContent
9
+            shouldBeEnabled = "Yes"
10
+            ignoreCount = "0"
11
+            continueAfterRunningActions = "No"
12
+            scope = "0"
13
+            stopOnStyle = "0">
14
+         </BreakpointContent>
15
+      </BreakpointProxy>
16
+   </Breakpoints>
5 17
 </Bucket>

+ 7 - 11
PaiAi/Paiai/AppDelegate.swift

@@ -1,16 +1,15 @@
1 1
 //
2 2
 //  AppDelegate.swift
3
-//  PaiAi
3
+//  Paiai
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
 
9 9
 import UIKit
10
-import PaiaiUIKit
11
-import PaiaiDataKit
10
+import RxSwift
12 11
 import Paiai_iOS
13
-
12
+import PaiaiDataKit
14 13
 
15 14
 let WXAppid = "wx4e22a0c8ae6d766d"
16 15
 let WXSecret = "636ac848016c593575d11143c55c8333"
@@ -27,20 +26,17 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
27 26
 
28 27
     var window: UIWindow?
29 28
     var coordinator: AppCoordinator?
29
+    let disposeBag = DisposeBag()
30 30
     
31 31
     func application(_ application: UIApplication,
32 32
                      didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?)
33 33
         -> Bool {
34 34
             registerAppConfiguration()
35
-            let rootViewController = ContainerViewController()
36
-            let nav = NavigationController(rootViewController: rootViewController)
37 35
             
38 36
             window = UIWindow(frame: UIScreen.main.bounds)
39
-            window?.rootViewController = nav
40
-            window?.makeKeyAndVisible()
41
-            
42
-            coordinator = AppCoordinator(rootViewController, navigationController: nav)
37
+            coordinator = AppCoordinator(window: window!)
43 38
             
39
+            coordinator?.start().subscribe().disposed(by: disposeBag)
44 40
             
45 41
             return true
46 42
     }

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Model/GroupDetailItem.swift

@@ -2,8 +2,8 @@
2 2
 //  GroupDetail.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2018/12/25.
6
-//  Copyright © 2018 yb. All rights reserved.
5
+//  Created by FFIB on 2018/12/25.
6
+//  Copyright © 2018 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Model/GroupItem.swift

@@ -2,8 +2,8 @@
2 2
 //  GroupItem.swift
3 3
 //  PaiaiDataKit
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 Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Model/GroupMemberItem.swift

@@ -2,8 +2,8 @@
2 2
 //  GroupMemberItem.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2018/12/25.
6
-//  Copyright © 2018 yb. All rights reserved.
5
+//  Created by FFIB on 2018/12/25.
6
+//  Copyright © 2018 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Model/MessageItem.swift

@@ -2,8 +2,8 @@
2 2
 //  MessageItem.swift
3 3
 //  PaiaiDataKit
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 Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Model/MessageListItem.swift

@@ -2,8 +2,8 @@
2 2
 //  MessageListItem.swift
3 3
 //  PaiaiDataKit
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 Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Model/OrderItem.swift

@@ -2,8 +2,8 @@
2 2
 //  OrderItem.swift
3 3
 //  PaiaiDataKit
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 Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Model/PhotoCommentItem.swift

@@ -2,8 +2,8 @@
2 2
 //  PhotoCommentItem.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2018/12/25.
6
-//  Copyright © 2018 yb. All rights reserved.
5
+//  Created by FFIB on 2018/12/25.
6
+//  Copyright © 2018 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 3
PaiAi/PaiaiDataKit/DataLayer/Model/PhotoItem.swift

@@ -1,9 +1,9 @@
1 1
 //
2 2
 //  PhotoItem.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5 5
 //  Created by FFIB on 2017/10/9.
6
-//  Copyright © 2017年 yb. All rights reserved.
6
+//  Copyright © 2017年 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation
@@ -35,7 +35,6 @@ public struct PhotoItem: JSONCode {
35 35
     public var group_default_avatar = 0
36 36
     public var group_name = ""
37 37
     
38
-    
39 38
     public var photo_thumbnail_url = ""
40 39
     public var photo_thumbnail2_url = ""
41 40
     public var photo_url = ""

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Model/PhotoThumbupUserItem.swift

@@ -2,8 +2,8 @@
2 2
 //  PhotoThumbupUserItem.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2018/12/25.
6
-//  Copyright © 2018 yb. All rights reserved.
5
+//  Created by FFIB on 2018/12/25.
6
+//  Copyright © 2018 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Model/Reusable/FileModel.swift

@@ -1,9 +1,9 @@
1 1
 //
2 2
 //  FileModel.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5 5
 //  Created by FFIB on 2017/10/10.
6
-//  Copyright © 2017年 yb. All rights reserved.
6
+//  Copyright © 2017年 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Model/JSONCode.swift

@@ -2,8 +2,8 @@
2 2
 //  JSONCode.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2019/1/3.
6
-//  Copyright © 2019 yb. All rights reserved.
5
+//  Created by FFIB on 2019/1/3.
6
+//  Copyright © 2019 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 14 - 0
PaiAi/PaiaiDataKit/DataLayer/Model/Reusable/ModelExtension/Array+GroupItem.swift

@@ -0,0 +1,14 @@
1
+//
2
+//  Array+GroupItem.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
+extension Array where Element == GroupItem {
11
+    mutating func command() {
12
+        
13
+    }
14
+}

+ 15 - 0
PaiAi/PaiaiDataKit/DataLayer/Model/Reusable/ModelExtension/Array+PhotoItem.swift

@@ -0,0 +1,15 @@
1
+//
2
+//  Array+PhotoItem.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
+extension Array where Element == PhotoItem {
12
+    mutating func command() {
13
+        
14
+    }
15
+}

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Model/Reusable/NetworkArrayData.swift

@@ -2,8 +2,8 @@
2 2
 //  NetworkArrayData.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2019/1/3.
6
-//  Copyright © 2019 yb. All rights reserved.
5
+//  Created by FFIB on 2019/1/3.
6
+//  Copyright © 2019 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Model/Reusable/OriginData.swift

@@ -2,8 +2,8 @@
2 2
 //  OriginData.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2019/3/20.
6
-//  Copyright © 2019 yb. All rights reserved.
5
+//  Created by FFIB on 2019/3/20.
6
+//  Copyright © 2019 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Model/Reusable/StatusModel.swift

@@ -1,9 +1,9 @@
1 1
 //
2 2
 //  StatusModel.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5 5
 //  Created by FFIB on 2017/10/10.
6
-//  Copyright © 2017年 yb. All rights reserved.
6
+//  Copyright © 2017年 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Model/UserInfo.swift

@@ -2,8 +2,8 @@
2 2
 //  UserInfo.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

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/GroupDetailRepository.swift

@@ -2,8 +2,8 @@
2 2
 //  GroupDetailRepository.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2019/1/3.
6
-//  Copyright © 2019 yb. All rights reserved.
5
+//  Created by FFIB on 2019/1/3.
6
+//  Copyright © 2019 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/GroupRepository.swift

@@ -2,8 +2,8 @@
2 2
 //  GroupRepository.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2019/1/2.
6
-//  Copyright © 2019 yb. All rights reserved.
5
+//  Created by FFIB on 2019/1/2.
6
+//  Copyright © 2019 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Implementation/GroupPhotoRepository.swift

@@ -1,9 +1,9 @@
1 1
 //
2 2
 //  GroupPhotoRepository.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5 5
 //  Created by FFIB on 2017/10/10.
6
-//  Copyright © 2017年 yb. All rights reserved.
6
+//  Copyright © 2017年 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 1 - 1
PaiAi/PaiaiDataKit/DataLayer/Repositories/Implementation/HomeRepository.swift

@@ -1,6 +1,6 @@
1 1
 //
2 2
 //  HomeRepository.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5 5
 //  Created by FFIB on 16/3/31.
6 6
 //  Copyright © 2016年 FFIB. All rights reserved.

+ 3 - 3
PaiAi/PaiaiDataKit/DataLayer/Repositories/Implementation/MessageRepository.swift

@@ -1,9 +1,9 @@
1 1
 //
2 2
 //  MessageRepository.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
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 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Implementation/OrderRepository.swift

@@ -1,8 +1,8 @@
1 1
 //
2 2
 //  OrderRepository.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
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 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Implementation/PhotoDetailRepository.swift

@@ -2,8 +2,8 @@
2 2
 //  PhotoDetailRepository.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2018/12/25.
6
-//  Copyright © 2018 yb. All rights reserved.
5
+//  Created by FFIB on 2018/12/25.
6
+//  Copyright © 2018 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Implementation/PhotoGroupDetailRepository.swift

@@ -2,8 +2,8 @@
2 2
 //  PhotoGroupDetailRepository.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2018/12/25.
6
-//  Copyright © 2018 yb. All rights reserved.
5
+//  Created by FFIB on 2018/12/25.
6
+//  Copyright © 2018 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 1 - 1
PaiAi/PaiaiDataKit/DataLayer/Repositories/Implementation/PhotoGroupRepository.swift

@@ -1,6 +1,6 @@
1 1
 //
2 2
 //  GroupRepository.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5 5
 //  Created by FFIB on 16/4/1.
6 6
 //  Copyright © 2016年 FFIB. All rights reserved.

+ 1 - 1
PaiAi/PaiaiDataKit/DataLayer/Repositories/Implementation/UserInfoRepository.swift

@@ -1,6 +1,6 @@
1 1
 //
2 2
 //  UserInfoRepository.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5 5
 //  Created by FFIB on 16/4/1.
6 6
 //  Copyright © 2016年 FFIB. All rights reserved.

+ 3 - 3
PaiAi/PaiaiDataKit/DataLayer/Repositories/Persistence/RecentGroupInfo.swift

@@ -1,12 +1,12 @@
1 1
 //
2 2
 //  LocalStorage.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5
-//  Created by mac on 2016/10/28.
5
+//  Created by FFIB on 2016/10/28.
6 6
 //  Copyright © 2016年 FFIB. All rights reserved.
7 7
 //
8 8
 
9
-import UIKit
9
+import Foundation
10 10
 
11 11
 extension GroupItem: ArrayUserDefaultCodable {
12 12
     public init(value: [String: AnyObject]) {

+ 2 - 3
PaiAi/PaiaiDataKit/DataLayer/Repositories/Persistence/UserInfoStore.swift

@@ -2,8 +2,8 @@
2 2
 //  UserSessionStore.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
@@ -22,7 +22,6 @@ fileprivate extension UserDefaults {
22 22
 }
23 23
 
24 24
 final class UserInfoStore {
25
-    #warning("是否加密存储userId")
26 25
     func save(_ userInfo: UserInfo) {
27 26
         UserDefaults.Account.set(true, forKey: .isLogin)
28 27
         UserDefaults.Account.set(userInfo.toJSON(), forKey: .userInfo)

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/PhotoRepository.swift

@@ -2,8 +2,8 @@
2 2
 //  PhotoRepository.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2019/1/2.
6
-//  Copyright © 2019 yb. All rights reserved.
5
+//  Created by FFIB on 2019/1/2.
6
+//  Copyright © 2019 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/FeedbackRemoteAPI.swift

@@ -2,8 +2,8 @@
2 2
 //  FeedbackRemoteAPI.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2018/12/29.
6
-//  Copyright © 2018 yb. All rights reserved.
5
+//  Created by FFIB on 2018/12/29.
6
+//  Copyright © 2018 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/GroupDetailRemoteAPI.swift

@@ -2,8 +2,8 @@
2 2
 //  GroupDetailRemoteAPI.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2018/12/29.
6
-//  Copyright © 2018 yb. All rights reserved.
5
+//  Created by FFIB on 2018/12/29.
6
+//  Copyright © 2018 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/GroupPhotoRemoteAPI.swift

@@ -2,8 +2,8 @@
2 2
 //  GroupPhotoRemoteAPI.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2019/1/2.
6
-//  Copyright © 2019 yb. All rights reserved.
5
+//  Created by FFIB on 2019/1/2.
6
+//  Copyright © 2019 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/GroupRemoteAPI.swift

@@ -2,8 +2,8 @@
2 2
 //  GroupRemoteAPI.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2018/12/29.
6
-//  Copyright © 2018 yb. All rights reserved.
5
+//  Created by FFIB on 2018/12/29.
6
+//  Copyright © 2018 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/GuestUserInfoRemoteAPI.swift

@@ -2,8 +2,8 @@
2 2
 //  GuestUserInfoRemoteAPI.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2018/12/26.
6
-//  Copyright © 2018 yb. All rights reserved.
5
+//  Created by FFIB on 2018/12/26.
6
+//  Copyright © 2018 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/HomeRemoteAPI.swift

@@ -2,8 +2,8 @@
2 2
 //  HomeRemoteAPI.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2018/12/27.
6
-//  Copyright © 2018 yb. All rights reserved.
5
+//  Created by FFIB on 2018/12/27.
6
+//  Copyright © 2018 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/MessageRemoteAPI.swift

@@ -2,8 +2,8 @@
2 2
 //  MessageRemoteAPI.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2018/12/29.
6
-//  Copyright © 2018 yb. All rights reserved.
5
+//  Created by FFIB on 2018/12/29.
6
+//  Copyright © 2018 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/OrderRemoteAPI.swift

@@ -2,8 +2,8 @@
2 2
 //  OrderRemoteAPI.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2018/12/29.
6
-//  Copyright © 2018 yb. All rights reserved.
5
+//  Created by FFIB on 2018/12/29.
6
+//  Copyright © 2018 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 3 - 3
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/PhotoDetailRemoteAPI.swift

@@ -2,8 +2,8 @@
2 2
 //  PhotoDetailRemoteAPI.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2019/3/18.
6
-//  Copyright © 2019 yb. All rights reserved.
5
+//  Created by FFIB on 2019/3/18.
6
+//  Copyright © 2019 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation
@@ -75,6 +75,6 @@ struct PhotoDetailRemoteAPI {
75 75
                                                                        "photo_id": photoId,
76 76
                                                                        "user_id": ShareUserId],
77 77
                                                            parseJSON: parseCommtents)
78
-        resource.loadContent()
78
+        let _ = resource.loadContent()
79 79
     }
80 80
 }

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/PhotoPurchaseRemoteAPI.swift

@@ -2,8 +2,8 @@
2 2
 //  PhotoPurchaseRemoteAPI.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

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/Reusable/ContentResource.swift

@@ -2,8 +2,8 @@
2 2
 //  ContentResource.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2018/12/29.
6
-//  Copyright © 2018 yb. All rights reserved.
5
+//  Created by FFIB on 2018/12/29.
6
+//  Copyright © 2018 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 3 - 3
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/Reusable/NetWork/Interfaces.swift

@@ -1,12 +1,12 @@
1 1
 //
2 2
 //  Interfaces.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5 5
 //  Created by FFIB on 2017/8/30.
6
-//  Copyright © 2017年 yb. All rights reserved.
6
+//  Copyright © 2017年 FFIB. All rights reserved.
7 7
 //
8 8
 
9
-import UIKit
9
+import Foundation
10 10
 
11 11
 public enum Interfaces: String {
12 12
     case baseUrl = "https://api.xfoto.com.cn"

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/Reusable/NetWork/NetWorkCache.swift

@@ -1,12 +1,12 @@
1 1
 //
2 2
 //  NetWorkCache.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5 5
 //  Created by yangbin on 4/20/16.
6 6
 //  Copyright © 2016 FFIB. All rights reserved.
7 7
 //
8 8
 
9
-import UIKit
9
+import Foundation
10 10
 import Alamofire
11 11
 
12 12
 let DefaultNetWorkCache = NetWorkCache()

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/Reusable/NetWork/NetworkApi.swift

@@ -1,9 +1,9 @@
1 1
 //
2 2
 //  NetworkApi.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5 5
 //  Created by FFIB on 2017/9/29.
6
-//  Copyright © 2017年 yb. All rights reserved.
6
+//  Copyright © 2017年 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import UIKit

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/Reusable/NetWork/Resource.swift

@@ -1,9 +1,9 @@
1 1
 //
2 2
 //  Resource.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5 5
 //  Created by FFIB on 2017/9/29.
6
-//  Copyright © 2017年 yb. All rights reserved.
6
+//  Copyright © 2017年 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/Reusable/StatusResource.swift

@@ -2,8 +2,8 @@
2 2
 //  StatusResource.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2018/12/29.
6
-//  Copyright © 2018 yb. All rights reserved.
5
+//  Created by FFIB on 2018/12/29.
6
+//  Copyright © 2018 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/Reusable/UploadResource.swift

@@ -2,8 +2,8 @@
2 2
 //  UploadResource.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2019/1/2.
6
-//  Copyright © 2019 yb. All rights reserved.
5
+//  Created by FFIB on 2019/1/2.
6
+//  Copyright © 2019 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/UserInfoRemoteAPI.swift

@@ -2,8 +2,8 @@
2 2
 //  UserInfoRemoteAPI.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2018/12/25.
6
-//  Copyright © 2018 yb. All rights reserved.
5
+//  Created by FFIB on 2018/12/25.
6
+//  Copyright © 2018 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/WXUserInfoRemoteAPI.swift

@@ -2,8 +2,8 @@
2 2
 //  WXUserInfoRemoteAPI.swift
3 3
 //  PaiaiDataKit
4 4
 //
5
-//  Created by ffib on 2018/12/26.
6
-//  Copyright © 2018 yb. All rights reserved.
5
+//  Created by FFIB on 2018/12/26.
6
+//  Copyright © 2018 FFIB. All rights reserved.
7 7
 //
8 8
 
9 9
 import Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/PaiaiDataKit.h

@@ -2,8 +2,8 @@
2 2
 //  PaiaiDataKit.h
3 3
 //  PaiaiDataKit
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>

+ 24 - 2
PaiAi/PaiaiDataKit/PresentLayer/Group/GroupDetail/GroupDetailViewModel.swift

@@ -1,8 +1,8 @@
1 1
 //
2 2
 //  GroupDetailViewModel.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5
-//  Created by zhengjianfei on 2017/1/3.
5
+//  Created by FFIB on 2017/1/3.
6 6
 //  Copyright © 2017年 FFIB. All rights reserved.
7 7
 //
8 8
 
@@ -14,6 +14,7 @@ public protocol GroupDetailViewModelDelegate: class {
14 14
     func navigateToGroupMember(_ item: GroupDetailItem)
15 15
     func navigateToGroupNameModification(_ item: GroupDetailItem)
16 16
     func navigateToRootViewController()
17
+    func navigationBackToGroupDetail()
17 18
 }
18 19
 
19 20
 public class GroupDetailViewModel {
@@ -23,7 +24,10 @@ public class GroupDetailViewModel {
23 24
     
24 25
     public weak var delegate: GroupDetailViewModelDelegate?
25 26
     
27
+    public let didCancel = PublishSubject<Void>()
28
+    public let didQuit = PublishSubject<Void>()
26 29
     public let item: BehaviorRelay<GroupDetailItem>
30
+    
27 31
     public var groupName: Observable<String> {
28 32
         return item.asObservable().flatMapLatest({ (item) -> Observable<String> in
29 33
             return Observable.just(item.group.group_name)
@@ -94,9 +98,27 @@ public class GroupDetailViewModel {
94 98
         repository.quit()
95 99
             .subscribe(onCompleted: {[unowned self] in
96 100
                 Toast.show(message: "退出群成功")
101
+                self.didQuit.onNext(())
102
+                NotificationCenter.default.post(name: .GroupItemsChanged, object: nil, userInfo: [GroupItemsOperator.key: GroupItemsOperator.remove(self.item.value.group_id)])
97 103
                 self.delegate?.navigateToRootViewController()
98 104
             }).disposed(by: disposeBag)
99 105
     }
106
+    
107
+    public func changeName(name: String) {
108
+        repository.update(name: name)
109
+            .subscribe(onCompleted: {[unowned self] in
110
+                Toast.show(message: "群名称已修改")
111
+                var v = self.item.value
112
+                v.group.group_name = name
113
+                self.item.accept(v)
114
+                NotificationCenter.default.post(name: .GroupItemsChanged, object: nil, userInfo: [GroupItemsOperator.key: GroupItemsOperator.update(v.group_id, v.group)])
115
+                self.delegate?.navigationBackToGroupDetail()
116
+        }).disposed(by: disposeBag)
117
+    }
118
+    
119
+    deinit {
120
+        didCancel.onNext(())
121
+    }
100 122
 }
101 123
 
102 124
 public extension GroupDetailViewModel {

+ 4 - 4
PaiAi/PaiaiDataKit/PresentLayer/Group/GroupDetail/GroupMemberViewModel.swift

@@ -1,12 +1,12 @@
1 1
 //
2 2
 //  GroupMemberViewModel.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5
-//  Created by LISA on 2017/5/8.
6
-//  Copyright © 2017年 yb. All rights reserved.
5
+//  Created by FFIB on 2017/5/8.
6
+//  Copyright © 2017年 FFIB. All rights reserved.
7 7
 //
8 8
 
9
-import UIKit
9
+import Foundation
10 10
 import RxSwift
11 11
 import RxCocoa
12 12
 import RxDataSources

+ 41 - 10
PaiAi/PaiaiDataKit/PresentLayer/Group/GroupViewModel.swift

@@ -1,18 +1,18 @@
1 1
 //
2 2
 //  GroupViewModel.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5
-//  Created by zhengjianfei on 2017/1/4.
5
+//  Created by FFIB on 2017/1/4.
6 6
 //  Copyright © 2017年 FFIB. All rights reserved.
7 7
 //
8 8
 
9
-import UIKit
9
+import Foundation
10 10
 import RxSwift
11 11
 import RxCocoa
12 12
 import RxDataSources
13 13
 
14 14
 public protocol GroupViewModelDelegate: class {
15
-    func didSelect(_ items: [PhotoItem], currIndex: Int)
15
+    func didSelect(_ _items: [PhotoItem], currIndex: Int)
16 16
     func navigateToGroupDetail(_ item: GroupItem)
17 17
 }
18 18
 
@@ -24,7 +24,7 @@ public class GroupViewModel {
24 24
     
25 25
     
26 26
     private var _isLoading = PublishSubject<Void>()
27
-    private let items = BehaviorRelay<[PhotoItem]>(value: [])
27
+    private let _items = BehaviorRelay<[PhotoItem]>(value: [])
28 28
     private let _hasData = BehaviorRelay<Bool>(value: false)
29 29
     
30 30
     public var groupItem: BehaviorRelay<GroupItem>
@@ -50,7 +50,7 @@ public class GroupViewModel {
50 50
     }
51 51
 
52 52
     public var contents: Observable<[AnimatableSectionModel<Int, PhotoItem>]> {
53
-        return items.map({ model in
53
+        return _items.map({ model in
54 54
             return [AnimatableSectionModel(model: 0, items: model)]
55 55
         })
56 56
     }
@@ -61,6 +61,7 @@ public class GroupViewModel {
61 61
         self.repository = GroupPhotoRepository(groupId: groupItem.group_id)
62 62
         self.groupItem = BehaviorRelay<GroupItem>(value: groupItem)
63 63
         ShareRecentGroupInfo.add(groupItem)
64
+        setNotification()
64 65
     }
65 66
     
66 67
     public func reload() {
@@ -68,7 +69,7 @@ public class GroupViewModel {
68 69
             .subscribe(onSuccess: {[weak self] (result) in
69 70
                 guard let `self` = self else { return }
70 71
                 self._isLoading.onNext(())
71
-                self.items.accept(result)
72
+                self._items.accept(result)
72 73
                 self._hasData.accept(result.count > 0)
73 74
                 }, onError: {[weak self] (error) in
74 75
                     guard let `self` = self else { return }
@@ -79,7 +80,10 @@ public class GroupViewModel {
79 80
     public func submit(data: Data) {
80 81
         repository.upload(data: data).subscribe(onSuccess: { [weak self] result in
81 82
             guard let `self` = self else { return }
82
-            self.items.accept(result)
83
+            self._items.accept(result)
84
+            var item = self.groupItem.value
85
+            item.group_photo_num = result.count
86
+            NotificationCenter.default.post(name: .GroupItemsChanged, object: nil, userInfo: [GroupItemsOperator.key: GroupItemsOperator.update(self.groupItem.value.group_id, item)])
83 87
             Toast.show(message: "照片已上传")
84 88
             self._isLoading.onNext(())
85 89
         }) {[weak self] (error) in
@@ -90,19 +94,46 @@ public class GroupViewModel {
90 94
     }
91 95
     
92 96
     public func layoutSizeForIndexPath(_ indexPath: IndexPath) -> CGSize {
93
-        let item = items.value[indexPath.row]
97
+        let item = _items.value[indexPath.row]
94 98
         let w = item.photo_thumbnail_w
95 99
         let h = item.photo_thumbnail_h
96 100
 
97 101
         //        header 42, footer: 32
98 102
         return CGSize(width: w, height: h + 74)
99 103
     }
104
+    
105
+    private func setNotification() {
106
+        NotificationCenter.default.rx.notification(.GroupItemsChanged).subscribe(onNext: { (notification) in
107
+            guard let itemOperator = notification.userInfo?[GroupItemsOperator.key] as? GroupItemsOperator,
108
+                case let .update(_, v) = itemOperator else { return }
109
+            self.groupItem.accept(v)
110
+            ShareRecentGroupInfo.add(v)
111
+            
112
+            var items = self._items.value
113
+            items = items.map({ item in
114
+                var tmp = item
115
+                tmp.group_name = v.group_name
116
+                return tmp
117
+            })
118
+            self._items.accept(items)
119
+            
120
+        }).disposed(by: disposeBag)
121
+        
122
+        NotificationCenter.default.rx.notification(.PhotoItemsChanged).subscribe(onNext: { (notification) in
123
+            guard let itemOperator = notification.userInfo?[PhotoItemsOperator.key] as? PhotoItemsOperator,
124
+                case let .update(id, v) = itemOperator,
125
+                let index = self._items.value.firstIndex(where: { $0.photo_id == id }) else { return }
126
+            var items = self._items.value
127
+            items[index] = v
128
+            self._items.accept(items)
129
+        }).disposed(by: disposeBag)
130
+    }
100 131
 }
101 132
 
102 133
 /// GroupViewModelDelegate
103 134
 public extension GroupViewModel {
104 135
     func didSelect(_ index: Int) {
105
-        delegate?.didSelect(items.value, currIndex: index)
136
+        delegate?.didSelect(_items.value, currIndex: index)
106 137
     }
107 138
     
108 139
     @objc func navigateToGroupDetail() {

+ 3 - 3
PaiAi/PaiaiDataKit/PresentLayer/Home/CreateGroupViewModel.swift

@@ -1,9 +1,9 @@
1 1
 //
2 2
 //  CreateGroupViewModel.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
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 Foundation

+ 45 - 10
PaiAi/PaiaiDataKit/PresentLayer/Home/HomeViewModel.swift

@@ -1,8 +1,8 @@
1 1
 //
2 2
 //  HomeViewModel.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5
-//  Created by zhengjianfei on 2016/12/29.
5
+//  Created by FFIB on 2016/12/29.
6 6
 //  Copyright © 2016年 FFIB. All rights reserved.
7 7
 //
8 8
 
@@ -14,7 +14,7 @@ import RxDataSources
14 14
 public protocol HomeViewModelDelegate: class {
15 15
     func scanQR()
16 16
     func createGroup()
17
-    func didSelect(_ items: [PhotoItem], currIndex: Int)
17
+    func didSelect(_ _items: [PhotoItem], currIndex: Int)
18 18
 }
19 19
 
20 20
 public class HomeViewModel {
@@ -26,7 +26,7 @@ public class HomeViewModel {
26 26
     
27 27
     private var _isLoading = PublishSubject<Bool>()
28 28
     private var _hasMoreData = BehaviorRelay<Bool>(value: true)
29
-    private let items = BehaviorRelay<[PhotoItem]>(value: [])
29
+    private let _items = BehaviorRelay<[PhotoItem]>(value: [])
30 30
     
31 31
     public var scanBtnTapped = PublishSubject<Void>()
32 32
     public var createBtnTapped = PublishSubject<Void>()
@@ -41,7 +41,7 @@ public class HomeViewModel {
41 41
     }
42 42
     
43 43
     public var contents: Observable<[AnimatableSectionModel<Int, PhotoItem>]> {
44
-        return items.map({ model in
44
+        return _items.map({ model in
45 45
             return [AnimatableSectionModel(model: 0, items: model)]
46 46
         })
47 47
     }
@@ -62,6 +62,8 @@ public class HomeViewModel {
62 62
             guard let `self` = self else { return }
63 63
             self.delegate?.createGroup()
64 64
         }).disposed(by: disposeBag)
65
+        
66
+        setNotification()
65 67
     }
66 68
 
67 69
     public func reload() {
@@ -70,7 +72,7 @@ public class HomeViewModel {
70 72
             .subscribe(onSuccess: {[weak self] (result) in
71 73
                 guard let `self` = self else { return }
72 74
                 self._isLoading.onNext(true)
73
-                self.items.accept(result.data)
75
+                self._items.accept(result.data)
74 76
                 self._hasMoreData.accept(result.hasMore)
75 77
             }, onError: {[weak self] (_) in
76 78
                 guard let `self` = self else { return }
@@ -86,7 +88,7 @@ public class HomeViewModel {
86 88
                 guard let `self` = self else { return }
87 89
                 self._isLoading.onNext(false)
88 90
                 self._hasMoreData.accept(result.hasMore)
89
-                self.items.accept(self.items.value + result.data)
91
+                self._items.accept(self._items.value + result.data)
90 92
                 }, onError: {[weak self] (_) in
91 93
                     guard let `self` = self else { return }
92 94
                     self._isLoading.onNext(false)
@@ -94,18 +96,51 @@ public class HomeViewModel {
94 96
     }
95 97
     
96 98
     public func layoutSizeForIndexPath(_ indexPath: IndexPath) -> CGSize {
97
-        let item = items.value[indexPath.row]
99
+        let item = _items.value[indexPath.row]
98 100
         let w = item.photo_thumbnail_w
99 101
         let h = item.photo_thumbnail_h
100 102
         
101 103
 //        header 42, footer: 32
102 104
         return CGSize(width: w, height: h + 74)
103 105
     }
106
+    
107
+    private func setNotification() {
108
+        NotificationCenter.default.rx.notification(.GroupItemsChanged).subscribe(onNext: { (notification) in
109
+            guard let itemOperator = notification.userInfo?[GroupItemsOperator.key] as? GroupItemsOperator else { return }
110
+            var items = self._items.value
111
+            switch itemOperator {
112
+            case let .update(id, v):
113
+                items = items.map({ (item) -> PhotoItem in
114
+                    
115
+                    if item.group_id == id {
116
+                        var tmp = item
117
+                        tmp.group_name = v.group_name
118
+                        
119
+                        return tmp
120
+                    }
121
+                    return item
122
+                })
123
+                self._items.accept(items)
124
+                break
125
+            case let .remove(id):
126
+                items.removeAll(where: { $0.group_id == id })
127
+                self._items.accept(items)
128
+            }
129
+        }).disposed(by: disposeBag)
130
+        
131
+        NotificationCenter.default.rx.notification(.PhotoItemsChanged).subscribe(onNext: { (notification) in
132
+            guard let itemOperator = notification.userInfo?[PhotoItemsOperator.key] as? PhotoItemsOperator,
133
+                case let .update(id, v) = itemOperator,
134
+                let index = self._items.value.firstIndex(where: { $0.photo_id == id }) else { return }
135
+            var items = self._items.value
136
+            items[index] = v
137
+            self._items.accept(items)
138
+        }).disposed(by: disposeBag)
139
+    }
104 140
 }
105 141
 
106 142
 //coordinator delegate
107 143
 extension HomeViewModel {
108
-    
109 144
     public func scanQR() {
110 145
         delegate?.scanQR()
111 146
     }
@@ -115,6 +150,6 @@ extension HomeViewModel {
115 150
     }
116 151
     
117 152
     public func didSelect(_ currIndex: Int) {
118
-        delegate?.didSelect(items.value, currIndex: currIndex)
153
+        delegate?.didSelect(_items.value, currIndex: currIndex)
119 154
     }
120 155
 }

+ 3 - 3
PaiAi/PaiaiDataKit/PresentLayer/Home/ScanQRViewModel.swift

@@ -1,9 +1,9 @@
1 1
 //
2 2
 //  ScanQRViewModel.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
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 Foundation

+ 2 - 2
PaiAi/PaiaiDataKit/PresentLayer/Message/MessageListViewModel.swift

@@ -1,8 +1,8 @@
1 1
 //
2 2
 //  MessageListViewModel.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5
-//  Created by mac on 2016/10/19.
5
+//  Created by FFIB on 2016/10/19.
6 6
 //  Copyright © 2016年 FFIB. All rights reserved.
7 7
 //
8 8
 

+ 8 - 3
PaiAi/PaiaiDataKit/PresentLayer/Message/MessageViewModel.swift

@@ -1,9 +1,9 @@
1 1
 //
2 2
 //  MessageViewModel.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
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 9
 import Foundation
@@ -25,6 +25,8 @@ public class MessageViewModel {
25 25
     public var commentReadedTip = BehaviorRelay<Bool>(value: true)
26 26
     public var thumbupReadedTip = BehaviorRelay<Bool>(value: true)
27 27
     
28
+    public var readedTip = BehaviorRelay<Bool>(value: true)
29
+    
28 30
     public var sysBtnTapped = PublishSubject<Void>()
29 31
     public var commentBtnTapped = PublishSubject<Void>()
30 32
     public var thumbupBtnTapped = PublishSubject<Void>()
@@ -34,16 +36,19 @@ public class MessageViewModel {
34 36
         
35 37
         sysBtnTapped.asObservable().subscribe {[weak self] (_) in
36 38
             guard let `self` = self else { return }
39
+            self.readedTip = self.sysReadedTip
37 40
             self.delegate?.didSelect(type: .system)
38 41
         }.disposed(by: disposeBag)
39 42
         
40 43
         commentBtnTapped.asObservable().subscribe {[weak self] (_) in
41 44
             guard let `self` = self else { return }
45
+            self.readedTip = self.commentReadedTip
42 46
             self.delegate?.didSelect(type: .comment)
43 47
         }.disposed(by: disposeBag)
44 48
         
45 49
         thumbupBtnTapped.asObservable().subscribe {[weak self] (_) in
46 50
             guard let `self` = self else { return }
51
+            self.readedTip = self.thumbupReadedTip
47 52
             self.delegate?.didSelect(type: .thumbup)
48 53
         }.disposed(by: disposeBag)
49 54
     }

+ 35 - 13
PaiAi/PaiaiDataKit/PresentLayer/Mine/MineGroupViewModel.swift

@@ -1,12 +1,12 @@
1 1
 //
2 2
 //  MineGroupViewModel.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5
-//  Created by LISA on 2017/5/8.
6
-//  Copyright © 2017年 yb. All rights reserved.
5
+//  Created by FFIB on 2017/5/8.
6
+//  Copyright © 2017年 FFIB. All rights reserved.
7 7
 //
8 8
 
9
-import UIKit
9
+import Foundation
10 10
 import RxSwift
11 11
 import RxCocoa
12 12
 import RxDataSources
@@ -25,7 +25,7 @@ public class MineGroupViewModel {
25 25
     private var _isEmpty = BehaviorRelay<Bool>(value: false)
26 26
     private var _hasMoreData = PublishSubject<Bool>()
27 27
     private var _showMessage = PublishSubject<String>()
28
-    private let items = BehaviorRelay<[GroupItem]>(value: [])
28
+    private let _items = BehaviorRelay<[GroupItem]>(value: [])
29 29
     
30 30
     public weak var delegate: MineGroupViewModelDelegate?
31 31
     
@@ -46,13 +46,14 @@ public class MineGroupViewModel {
46 46
     }
47 47
     
48 48
     public var contents: Observable<[AnimatableSectionModel<Int, GroupItem>]> {
49
-        return items.map({ model in
49
+        return _items.map({ model in
50 50
             return [AnimatableSectionModel(model: 0, items: model)]
51 51
         })
52 52
     }
53 53
     
54 54
     public init() {
55 55
         self.repository = PhotoGroupRepository()
56
+        setNotification()
56 57
     }
57 58
     
58 59
     public func reload() {
@@ -64,7 +65,7 @@ public class MineGroupViewModel {
64 65
                 self._hasMoreData.onNext(model.hasMore)
65 66
                 self._isEmpty.accept(!model.data.isEmpty)
66 67
                 
67
-                self.items.accept(model.data)
68
+                self._items.accept(model.data)
68 69
                 }, onDisposed: {[weak self] in
69 70
                     guard let `self` = self else { return }
70 71
                     self._isLoading.onNext(true)
@@ -79,7 +80,7 @@ public class MineGroupViewModel {
79 80
             .drive(onNext: {[weak self] (model) in
80 81
                 guard let `self` = self else { return }
81 82
                 self._hasMoreData.onNext(model.hasMore)
82
-                self.items.accept(self.items.value + model.data)
83
+                self._items.accept(self._items.value + model.data)
83 84
                 }, onDisposed: {[weak self] in
84 85
                     guard let `self` = self else { return }
85 86
                     self._isLoading.onNext(false)
@@ -88,17 +89,38 @@ public class MineGroupViewModel {
88 89
     
89 90
     public func remove(of index: Int) {
90 91
         Toast.showActivity(message: "正在删除此群")
91
-        repository.remove(groupId: items.value[index].group_id)
92
+        repository.remove(groupId: _items.value[index].group_id)
92 93
             .subscribe(onCompleted: {[weak self] in
93 94
                 guard let `self` = self else { return }
94
-                var _items = self.items.value
95
-                _items.remove(at: index)
96
-                self.items.accept(_items)
95
+                var __items = self._items.value
96
+                __items.remove(at: index)
97
+                self._items.accept(__items)
97 98
                 self._showMessage.onNext("群已删除")
98 99
             }).disposed(by: disposeBag)
99 100
     }
100 101
     
101
-    public func didSelect(_ item: GroupItem) {
102
+    private func setNotification() {
103
+        NotificationCenter.default.rx.notification(.GroupItemsChanged).subscribe(onNext: { (notification) in
104
+            guard let itemOperator = notification.userInfo?[GroupItemsOperator.key] as? GroupItemsOperator else { return }
105
+            switch itemOperator {
106
+            case let .update(id, v):
107
+                guard let index = self._items.value.firstIndex(where: { $0.group_id == id }) else { return }
108
+                var items = self._items.value
109
+                items[index] = v
110
+                self._items.accept(items)
111
+                break
112
+            case let .remove(id):
113
+                var items = self._items.value
114
+                items.removeAll(where: { $0.group_id == id })
115
+                self._items.accept(items)
116
+            }
117
+        }).disposed(by: disposeBag)
118
+    }
119
+}
120
+
121
+/// ViewModel delegate
122
+public extension MineGroupViewModel {
123
+    func didSelect(_ item: GroupItem) {
102 124
         delegate?.didSelect(item)
103 125
     }
104 126
 }

+ 10 - 4
PaiAi/PaiaiDataKit/PresentLayer/Mine/MineOrderViewModel.swift

@@ -1,12 +1,12 @@
1 1
 //
2 2
 //  MineOrderViewModel.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5
-//  Created by LISA on 2017/5/8.
6
-//  Copyright © 2017年 yb. All rights reserved.
5
+//  Created by FFIB on 2017/5/8.
6
+//  Copyright © 2017年 FFIB. All rights reserved.
7 7
 //
8 8
 
9
-import UIKit
9
+import Foundation
10 10
 import RxSwift
11 11
 import RxCocoa
12 12
 import RxDataSources
@@ -41,6 +41,8 @@ public class MineOrderViewModel {
41 41
         return _isLoading.asObserver()
42 42
     }
43 43
     
44
+    public var didCancel = PublishSubject<Void>()
45
+    
44 46
     public init() {
45 47
         self.repository = OrderRepository()
46 48
     }
@@ -85,4 +87,8 @@ public class MineOrderViewModel {
85 87
     public func didSelect(_ item: OrderItem) {
86 88
         delegate?.didSelect(item)
87 89
     }
90
+    
91
+    deinit {
92
+        didCancel.onNext(())
93
+    }
88 94
 }

+ 16 - 10
PaiAi/PaiaiDataKit/PresentLayer/PhotoDetail/PhotoDetailItemViewModel.swift

@@ -1,8 +1,8 @@
1 1
 //
2 2
 //  PhotoDetailViewModel.swift
3
-//  PaiAi
3
+//  PaiaiDataKit
4 4
 //
5
-//  Created by zhengjianfei on 2017/1/4.
5
+//  Created by FFIB on 2017/1/4.
6 6
 //  Copyright © 2017年 FFIB. All rights reserved.
7 7
 //
8 8
 
@@ -27,21 +27,27 @@ public final class PhotoDetailItemViewModel {
27 27
         
28 28
         self.item.subscribe(onNext: {[unowned self] (photoItem) in
29 29
             self.repository = PhotoDetailRepository(photoId: photoItem.photo_id, groupId: photoItem.group_id)
30
-            self.loadCommentItems()
31
-            self.loadThumbupUserItems()
30
+            self.loadCommentItems().concat(self.loadThumbupUserItems()).subscribe(onCompleted: {
31
+                var v = self.item.value
32
+                v.comment_num = self.commentItems.value.count
33
+                v.thumbup_num = self.thumbupItems.value.count
34
+                self.item.accept(v)
35
+                
36
+                NotificationCenter.default.post(name: .PhotoItemsChanged, object: nil, userInfo: [PhotoItemsOperator.key: PhotoItemsOperator.update(v.photo_id, v)])
37
+            }).disposed(by: self.disposeBag)
32 38
         }).disposed(by: disposeBag)
33 39
     }
34 40
     
35
-    private func loadThumbupUserItems() {
36
-        repository.loadThumbups().subscribe(onSuccess: { (items) in
41
+    private func loadThumbupUserItems() -> Completable {
42
+        return repository.loadThumbups().do(onSuccess: { (items) in
37 43
             self.thumbupItems.accept(items)
38
-        }).disposed(by: disposeBag)
44
+        }).asCompletable()
39 45
     }
40 46
     
41
-    private func loadCommentItems() {
42
-        repository.loadComments().subscribe(onSuccess: { (items) in
47
+    private func loadCommentItems() -> Completable {
48
+        return repository.loadComments().do(onSuccess: { (items) in
43 49
             self.commentItems.accept(items)
44
-        }).disposed(by: disposeBag)
50
+        }).asCompletable()
45 51
     }
46 52
 
47 53
     public func submitThumbup() {

+ 27 - 10
PaiAi/PaiaiDataKit/PresentLayer/PhotoDetail/PhotoDetailViewModel.swift

@@ -2,8 +2,8 @@
2 2
 //  PhotoDetailListViewModel.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
@@ -18,7 +18,7 @@ public protocol PhotoDetailViewModelDelegate: class {
18 18
 
19 19
 
20 20
 public final class PhotoDetailViewModel {
21
-    private var items: BehaviorRelay<[PhotoItem]>
21
+    private var _items: BehaviorRelay<[PhotoItem]>
22 22
     private var itemViewModel: PhotoDetailItemViewModel
23 23
     private var purchaseViewModel: PhotoPurchaseViewModel
24 24
     private var _hasGetPrice = BehaviorRelay<Bool>(value: false)
@@ -113,23 +113,25 @@ public final class PhotoDetailViewModel {
113 113
     public weak var delegate: PhotoDetailViewModelDelegate?
114 114
     
115 115
     public var content: Observable<[AnimatableSectionModel<Int, PhotoItem>]> {
116
-        return items.map({ model in
116
+        return _items.map({ model in
117 117
             return [AnimatableSectionModel(model: 0, items: model)]
118 118
         })
119 119
     }
120 120
  
121 121
     public init(items: [PhotoItem], currIndex: Int) {
122
-        self.items = BehaviorRelay<[PhotoItem]>(value: items)
122
+        self._items = BehaviorRelay<[PhotoItem]>(value: items)
123 123
         self.currIndex = currIndex
124 124
         self.itemViewModel = PhotoDetailItemViewModel(item: items[currIndex])
125 125
         self.purchaseViewModel = PhotoPurchaseViewModel(item: items[currIndex])
126
+        
127
+        setNotification()
126 128
     }
127 129
     
128 130
     public func willShow(index: Int) {
129 131
         currIndex = index
130 132
         _hasGetPrice.accept(false)
131
-        itemViewModel.item.accept(items.value[index])
132
-        purchaseViewModel.switchItem(item: items.value[index])
133
+        itemViewModel.item.accept(_items.value[index])
134
+        purchaseViewModel.switchItem(item: _items.value[index])
133 135
         
134 136
         purchaseViewModel.notifyPhotoChanged.subscribe(onNext: payDidFinish(item:)).disposed(by: disposeBag)
135 137
     }
@@ -156,14 +158,29 @@ public final class PhotoDetailViewModel {
156 158
     }
157 159
     
158 160
     public func payDidFinish(item: PhotoItem) {
159
-        var originItems = items.value
161
+        var originItems = _items.value
160 162
         originItems[currIndex] = item
161
-        items.accept(originItems)
163
+        _items.accept(originItems)
162 164
         itemViewModel.item.accept(item)
163 165
     }
164 166
     
167
+    private func setNotification() {
168
+        NotificationCenter.default.rx.notification(.PhotoItemsChanged).subscribe(onNext: { (notification) in
169
+            guard let itemOperator = notification.userInfo?[PhotoItemsOperator.key] as? PhotoItemsOperator,
170
+                case let .update(id, v) = itemOperator,
171
+                let index = self._items.value.firstIndex(where: { $0.photo_id == id }) else { return }
172
+            var items = self._items.value
173
+            items[index] = v
174
+            self._items.accept(items)
175
+        }).disposed(by: disposeBag)
176
+    }
177
+    
178
+    
179
+}
180
+
181
+extension PhotoDetailViewModel {
165 182
     public func navigateToGroup() {
166
-        delegate?.navigateToGroup(GroupItem(json: items.value[currIndex].toJSON() as [String : AnyObject]))
183
+        delegate?.navigateToGroup(GroupItem(json: _items.value[currIndex].toJSON() as [String : AnyObject]))
167 184
     }
168 185
     
169 186
     public func didSelected() {

+ 20 - 19
PaiAi/PaiaiDataKit/PresentLayer/PhotoDetail/PhotoPurchaseViewModel.swift

@@ -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
     

+ 21 - 0
PaiAi/PaiaiDataKit/PresentLayer/Reusable/GroupItemsOperator.swift

@@ -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
+}

+ 9 - 0
PaiAi/PaiaiDataKit/PresentLayer/Reusable/ItemOperator.swift

@@ -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

+ 19 - 0
PaiAi/PaiaiDataKit/PresentLayer/Reusable/PhotoItemsOperator.swift

@@ -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
+}

+ 3 - 7
PaiAi/PaiaiDataKit/PresentLayer/UserInfoViewModel.swift

@@ -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 - 2
PaiAi/PaiaiDataKit/Resuable/Error.swift

@@ -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

+ 2 - 2
PaiAi/PaiaiDataKit/Resuable/Extension/DateExt.swift

@@ -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 - 2
PaiAi/PaiaiDataKit/Resuable/Extension/DictionaryExt.swift

@@ -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 - 2
PaiAi/PaiaiDataKit/Resuable/Extension/Notification+wxPay.swift

@@ -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 - 1
PaiAi/PaiaiDataKit/Resuable/Extension/StringExt.swift

@@ -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 - 1
PaiAi/PaiaiDataKit/Resuable/Extension/UserDefaultsExt.swift

@@ -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.

+ 3 - 3
PaiAi/PaiaiDataKit/Resuable/Toast/FadeToastAnimator.swift

@@ -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

+ 3 - 3
PaiAi/PaiaiDataKit/Resuable/Toast/Toast.swift

@@ -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

+ 3 - 3
PaiAi/PaiaiDataKit/Resuable/Toast/ToastAnimator.swift

@@ -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

+ 3 - 3
PaiAi/PaiaiDataKit/Resuable/Toast/ToastOption.swift

@@ -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

+ 2 - 2
PaiAi/PaiaiDataKit/Resuable/Toast/ToastView.swift

@@ -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 - 2
PaiAi/PaiaiDataKitTests/PaiaiDataKitTests.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/PaiaiUIKit.h

@@ -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 - 1
PaiAi/PaiaiUIKit/Reusable/Extension/CoreGraphics/CGPointExt.swift

@@ -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 - 1
PaiAi/PaiaiUIKit/Reusable/Extension/CoreGraphics/CGSizeExt.swift

@@ -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 - 1
PaiAi/PaiaiUIKit/Reusable/Extension/CoreGraphics/CLLocationExt.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/Extension/UIKit/UIApplication+Swizzle.swift

@@ -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 - 1
PaiAi/PaiaiUIKit/Reusable/Extension/UIKit/UIBarButtonItemExt.swift

@@ -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 - 1
PaiAi/PaiaiUIKit/Reusable/Extension/UIKit/UIColorExt.swift

@@ -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 - 1
PaiAi/PaiaiUIKit/Reusable/Extension/UIKit/UIImageExt.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/Extension/UIKit/UINavigationBar+FixSpace.swift

@@ -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

+ 1 - 1
PaiAi/PaiaiUIKit/Reusable/Extension/UIKit/UINavigationItem+UIBarButttonItem.swift

@@ -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
 

+ 2 - 2
PaiAi/PaiaiUIKit/Reusable/Extension/UIKit/UIStoryboardExt.swift

@@ -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 - 1
PaiAi/PaiaiUIKit/Reusable/Extension/UIKit/UITextFieldExt.swift

@@ -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 - 1
PaiAi/PaiaiUIKit/Reusable/Extension/UIKit/UITextViewExt.swift

@@ -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.

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/Extension/UIKit/UIViewController+Navigation.swift

@@ -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 - 1
PaiAi/PaiaiUIKit/Reusable/Extension/UIKit/UIViewControllerExt.swift

@@ -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 - 1
PaiAi/PaiaiUIKit/Reusable/Extension/UIKit/UIViewExt.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/HardwareAuthorization.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/Protocol/Storyboarded.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/AlertViewController/ActionSheetAnimator.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/AlertViewController/AlertAnimator.swift

@@ -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

+ 1 - 1
PaiAi/PaiaiUIKit/Reusable/UIKit/AlertViewController/AlertViewController.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/AlertViewController/Default/ActionSheetController.swift

@@ -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

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/UIKit/AlertViewController/Default/AlertAction/AlertAction.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/AlertViewController/Default/AlertAction/AlertItem.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/AlertViewController/Default/AlertAction/BottomCancelItem.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/AlertViewController/Default/AlertAction/BottomDefaultItem.swift

@@ -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

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/UIKit/AlertViewController/Default/AlertAction/CenterCancelItem.swift

@@ -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
     

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/UIKit/AlertViewController/Default/AlertAction/CenterConfirmItem.swift

@@ -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
     

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/UIKit/AlertViewController/Default/AlertController.swift

@@ -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
     

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationBack/NavigationBackItemDelegate.swift

@@ -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

+ 1 - 1
PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationBack/UINavigationController+NavigationBack.swift

@@ -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
 

+ 1 - 1
PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationController/NavigationBar.swift

@@ -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
 

+ 1 - 1
PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationController/NavigationController.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/Nibless/NiblessView.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/Nibless/NiblessViewController.swift

@@ -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

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/UIKit/PageViewController/PageItem.swift

@@ -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

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/UIKit/PageViewController/PageOption.swift

@@ -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

+ 7 - 4
PaiAi/PaiaiUIKit/Reusable/UIKit/PageViewController/PageViewController.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/Present/PresentAnimatable.swift

@@ -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

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/UIKit/Present/PresentAnimatorDelegate.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/Present/PresentAppearAnimatedTransitioning.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/Present/PresentDisappearAnimatedTransitioning.swift

@@ -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

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/UIKit/Present/PresentExtension.swift

@@ -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,

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/UIKit/Present/PresentViewController.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/QR/ColorQR.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/QR/NotificationExt.swift

@@ -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 {

+ 1 - 1
PaiAi/PaiaiUIKit/Reusable/UIKit/QR/QRCodeConfiguration.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/QR/QRCodeMaskView.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/QR/QRCodeScanDelegate.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/QR/QRCodeScanResult.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/QR/QRCodeScanView.swift

@@ -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 {

+ 1 - 1
PaiAi/PaiaiUIKit/Reusable/UIKit/QR/QRCodeScanner.swift

@@ -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
 

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/UIKit/SideViewController/SideAnimator.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/SideViewController/SideViewController.swift

@@ -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

+ 1 - 1
PaiAi/PaiaiUIKit/Reusable/UIKit/WaterfallFlowLayout/WaterfallFlowConfiguration.swift

@@ -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

+ 1 - 1
PaiAi/PaiaiUIKit/Reusable/UIKit/WaterfallFlowLayout/WaterfallFlowLayout.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/WebViewController.swift

@@ -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

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/GestureRecognizerDelegate/GestureRecognizerDelegate.swift

@@ -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,

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/GestureRecognizerDelegate/GestureRecognizerProxy.swift

@@ -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?

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/NavigationBarDelegate/NavigationBarDelegate.swift

@@ -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 - 2
PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/NavigationBarDelegate/NavigationBarProxy.swift

@@ -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

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/NavigationControllerDelegate/NavigationControllerDelegate.swift

@@ -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,

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/NavigationControllerDelegate/NavigationControllerProxy.swift

@@ -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?

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/ViewControllerTransitioningDelegate/ViewControllerTransitioningDelegate.swift

@@ -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?

+ 3 - 3
PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/ViewControllerTransitioningDelegate/ViewControllerTransitioningProxy.swift

@@ -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?

+ 59 - 53
PaiAi/Paiai_iOS/App/AppCoordinator.swift

@@ -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
     }

+ 4 - 3
PaiAi/Paiai_iOS/App/ContainerViewController.swift

@@ -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() {

+ 0 - 18
PaiAi/Paiai_iOS/App/CoordinatorKey.swift

@@ -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
-}

+ 49 - 19
PaiAi/Paiai_iOS/App/Group/GroupCoordinator.swift

@@ -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

+ 39 - 10
PaiAi/Paiai_iOS/App/Group/GroupDetail/GroupDetailCoordinator.swift

@@ -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 - 3
PaiAi/Paiai_iOS/App/Group/GroupDetail/GroupDetailMemeberView.swift

@@ -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
-

+ 8 - 2
PaiAi/Paiai_iOS/App/Group/GroupDetail/GroupDetailViewController.swift

@@ -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
+}

+ 2 - 2
PaiAi/Paiai_iOS/App/Group/GroupDetail/GroupMemberCell.swift

@@ -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
 

+ 8 - 2
PaiAi/Paiai_iOS/App/Group/GroupDetail/GroupMemberViewController.swift

@@ -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
+}

+ 12 - 25
PaiAi/Paiai_iOS/App/Group/GroupDetail/GroupNameModificationViewController.swift

@@ -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 - 2
PaiAi/Paiai_iOS/App/Group/GroupQRView.swift

@@ -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

+ 3 - 4
PaiAi/Paiai_iOS/App/Group/GroupViewController.swift

@@ -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
 }

+ 8 - 2
PaiAi/Paiai_iOS/App/Home/CreateGroupConfirmViewController.swift

@@ -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
+}

+ 9 - 4
PaiAi/Paiai_iOS/App/Home/CreateGroupViewController.swift

@@ -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
+}

+ 38 - 54
PaiAi/Paiai_iOS/App/Home/HomeCoordinator.swift

@@ -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
 

+ 8 - 2
PaiAi/Paiai_iOS/App/Home/HomeViewController.swift

@@ -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
+}

+ 10 - 5
PaiAi/Paiai_iOS/App/Home/ScanQRViewController.swift

@@ -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
+}

+ 28 - 0
PaiAi/Paiai_iOS/App/Login/LoginCoordinator.swift

@@ -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
+}

+ 8 - 2
PaiAi/Paiai_iOS/App/LoginViewController.swift

@@ -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
+}

+ 2 - 2
PaiAi/Paiai_iOS/App/Message/MessageCommentAndThumbupCell.swift

@@ -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
 

+ 22 - 15
PaiAi/Paiai_iOS/App/Message/MessageCoordinator.swift

@@ -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
-

+ 8 - 2
PaiAi/Paiai_iOS/App/Message/MessageListViewController.swift

@@ -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
+}

+ 2 - 2
PaiAi/Paiai_iOS/App/Message/MessageSystemCell.swift

@@ -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
 

+ 10 - 3
PaiAi/Paiai_iOS/App/Message/MessageViewController.swift

@@ -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
+}

+ 2 - 2
PaiAi/Paiai_iOS/App/Mine/GroupCell.swift

@@ -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
 

+ 15 - 2
PaiAi/Paiai_iOS/App/Mine/MineAboutViewController.swift

@@ -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
+}

+ 36 - 23
PaiAi/Paiai_iOS/App/Mine/MineCoordinator.swift

@@ -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
     

+ 14 - 2
PaiAi/Paiai_iOS/App/Mine/MineFeedbackViewController.swift

@@ -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
+}

+ 8 - 2
PaiAi/Paiai_iOS/App/Mine/MineGroupViewController.swift

@@ -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
+}

+ 8 - 2
PaiAi/Paiai_iOS/App/Mine/MineOrderViewController.swift

@@ -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
+}

+ 12 - 6
PaiAi/Paiai_iOS/App/Mine/MineViewController.swift

@@ -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
+}

+ 2 - 2
PaiAi/Paiai_iOS/App/Mine/OrderCell.swift

@@ -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
 

+ 2 - 3
PaiAi/Paiai_iOS/App/PhotoCell.swift

@@ -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:

+ 2 - 2
PaiAi/Paiai_iOS/App/PhotoDetail/ImageCell.swift

@@ -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
 

+ 2 - 2
PaiAi/Paiai_iOS/App/PhotoDetail/PhotoDetailCommentCell.swift

@@ -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
 

+ 13 - 14
PaiAi/Paiai_iOS/App/PhotoDetail/PhotoDetailCoordinator.swift

@@ -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 - 2
PaiAi/Paiai_iOS/App/PhotoDetail/PhotoDetailImageCell.swift

@@ -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

+ 13 - 7
PaiAi/Paiai_iOS/App/PhotoDetail/PhotoDetailViewController.swift

@@ -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
+}

+ 8 - 2
PaiAi/Paiai_iOS/App/PhotoDetail/PhotoPreviewViewController.swift

@@ -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
+}

+ 2 - 2
PaiAi/Paiai_iOS/App/PhotoDetail/ShareController.swift

@@ -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 - 2
PaiAi/Paiai_iOS/Paiai_iOS.h

@@ -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>

+ 41 - 0
PaiAi/Paiai_iOS/Reusable/BaseCoordinator.swift

@@ -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
+}

+ 2 - 2
PaiAi/Paiai_iOS/Reusable/Extension/UIImageView+Kingfisher.swift

@@ -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
 

+ 11 - 0
PaiAi/Paiai_iOS/Reusable/NavigationSource.swift

@@ -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 {}

pai2 - Gogs: Go Git Service

拍爱

Brightcells: 5301e7237e unify join group logic vor 10 Jahren
..
migrations 4defb80fdc gogs first init vor 10 Jahren
__init__.py 4defb80fdc gogs first init vor 10 Jahren
admin.py 4defb80fdc gogs first init vor 10 Jahren
models.py 4defb80fdc gogs first init vor 10 Jahren
tests.py 4defb80fdc gogs first init vor 10 Jahren
urls.py 5301e7237e unify join group logic vor 10 Jahren
views.py 4defb80fdc gogs first init vor 10 Jahren