optimze navigationback and navigationBar

FFIB vor 6 Jahren
Ursprung
Commit
50dc35d115
62 geänderte Dateien mit 765 neuen Zeilen und 441 gelöschten Zeilen
  1. BIN
      PaiAi/.DS_Store
  2. 74 33
      PaiAi/Paiai.xcodeproj/project.pbxproj
  3. BIN
      PaiAi/Paiai.xcodeproj/project.xcworkspace/xcuserdata/FFIB.xcuserdatad/UserInterfaceState.xcuserstate
  4. 0 0
      PaiAi/Paiai/Assets.xcassets/MainPage/navigation-QR.imageset/Contents.json
  5. 0 0
      PaiAi/Paiai/Assets.xcassets/MainPage/navigation-QR.imageset/二维码 (1).png
  6. 0 0
      PaiAi/Paiai/Assets.xcassets/MainPage/navigation-right.imageset/Contents.json
  7. 0 0
      PaiAi/Paiai/Assets.xcassets/MainPage/navigation-right.imageset/更多-右上角.png
  8. 1 1
      PaiAi/PaiaiDataKit/DataLayer/Repositories/GroupPhotoRepository.swift
  9. 2 3
      PaiAi/PaiaiDataKit/DataLayer/Repositories/Remote/GroupPhotoRemoteAPI.swift
  10. 0 0
      PaiAi/PaiaiDataKit/PresentLayer/Group/GroupDetail/GroupDetailViewModel.swift
  11. 0 0
      PaiAi/PaiaiDataKit/PresentLayer/Group/GroupDetail/GroupMemberViewModel.swift
  12. 100 0
      PaiAi/PaiaiDataKit/PresentLayer/Group/GroupViewModel.swift
  13. 0 0
      PaiAi/PaiaiDataKit/PresentLayer/Home/CreateGroupConfirmViewModel.swift
  14. 4 4
      PaiAi/PaiaiDataKit/PresentLayer/home/HomeViewModel.swift
  15. 0 0
      PaiAi/PaiaiDataKit/PresentLayer/Home/ScanQRViewModel.swift
  16. 0 0
      PaiAi/PaiaiDataKit/PresentLayer/Message/MessageListViewModel.swift
  17. 0 0
      PaiAi/PaiaiDataKit/PresentLayer/Message/MessageViewModel.swift
  18. 0 0
      PaiAi/PaiaiDataKit/PresentLayer/Mine/MineFeedbackViewModel.swift
  19. 0 0
      PaiAi/PaiaiDataKit/PresentLayer/Mine/MineGroupViewModel.swift
  20. 0 0
      PaiAi/PaiaiDataKit/PresentLayer/Mine/MineOrderViewModel.swift
  21. 0 0
      PaiAi/PaiaiDataKit/PresentLayer/PhotoDetail/DetailPageViewModel.swift
  22. 0 70
      PaiAi/PaiaiDataKit/PresentLayer/home/GroupPageViewModel.swift
  23. 20 8
      PaiAi/PaiaiUIKit/Reusable/Extension/UIKit/UIBarButtonItemExt.swift
  24. 3 3
      PaiAi/PaiaiUIKit/Reusable/Extension/UIKit/UIViewController+Navigation.swift
  25. 13 0
      PaiAi/PaiaiUIKit/Reusable/Protocol/Storyboarded.swift
  26. 8 2
      PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationBack/NavigationBackDelegate.swift
  27. 2 3
      PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationBack/UINavigationController+NavigationBack.swift
  28. 0 20
      PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationBar/NavigationBarDelegate.swift
  29. 0 34
      PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationBar/NavigationBarInOut.swift
  30. 64 0
      PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationBar/NavigationBarInOutAnimator.swift
  31. 31 12
      PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationBar/NavigationBarInteractivePopDeletegate.swift
  32. 1 1
      PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationBar/NavigationBarInteractiveViewController.swift
  33. 24 5
      PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationBar/NavigationBarPushAndPopDelegate.swift
  34. 3 2
      PaiAi/PaiaiUIKit/Reusable/UIKit/PageViewController/PageViewController.swift
  35. 1 1
      PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/GestureRecognizerDelegate/GestureRecognizerProxy.swift
  36. 19 0
      PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/NavigationBarDelegate/NavigationBarDelegate.swift
  37. 38 0
      PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/NavigationBarDelegate/NavigationBarProxy.swift
  38. 23 0
      PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/NavigationControllerDelegate/NavigationControllerDelegate.swift
  39. 14 2
      PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/NavigationControllerDelegate/NavigationControllerProxy.swift
  40. 1 1
      PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/ViewControllerTransitioningDelegate/ViewControllerTransitioningDelegate.swift
  41. 1 1
      PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/ViewControllerTransitioningDelegate/ViewControllerTransitioningProxy.swift
  42. 3 1
      PaiAi/Paiai_iOS/App/AppCoordinator.swift
  43. 24 0
      PaiAi/Paiai_iOS/App/Group/GroupCoordinator.swift
  44. 0 0
      PaiAi/Paiai_iOS/App/Group/GroupDetail/ChangeGroupNameController.swift
  45. 0 0
      PaiAi/Paiai_iOS/App/Group/GroupDetail/GroupDetail.storyboard
  46. 0 0
      PaiAi/Paiai_iOS/App/Group/GroupDetail/GroupDetailController.swift
  47. 0 0
      PaiAi/Paiai_iOS/App/Group/GroupDetail/GroupDetailCoordinator.swift
  48. 0 0
      PaiAi/Paiai_iOS/App/Group/GroupDetail/GroupMebersController.swift
  49. 0 0
      PaiAi/Paiai_iOS/App/Group/GroupDetail/GroupMemberController.swift
  50. 0 0
      PaiAi/Paiai_iOS/App/Group/GroupDetail/MemberCell.swift
  51. 0 0
      PaiAi/Paiai_iOS/App/Group/GroupDetail/ShowGroupQRController.swift
  52. 252 0
      PaiAi/Paiai_iOS/App/Group/GroupViewController.swift
  53. 1 1
      PaiAi/Paiai_iOS/App/Home/CreateGroupConfirmViewController.swift
  54. 0 140
      PaiAi/Paiai_iOS/App/Home/Group/GroupPageController.swift
  55. 0 1
      PaiAi/Paiai_iOS/App/Home/HomeViewController.swift
  56. 0 76
      PaiAi/Paiai_iOS/App/Home/Main.storyboard
  57. 2 2
      PaiAi/Paiai_iOS/App/Home/ScanQRViewController.swift
  58. 6 2
      PaiAi/Paiai_iOS/App/Message/MessageCoordinator.swift
  59. 2 2
      PaiAi/Paiai_iOS/App/Mine/MineAboutViewController.swift
  60. 25 7
      PaiAi/Paiai_iOS/App/Mine/MineCoordinator.swift
  61. 1 1
      PaiAi/Paiai_iOS/App/Mine/MineFeedbackViewController.swift
  62. 2 2
      PaiAi/Paiai_iOS/App/PhotoDetail/DetailPageController.swift

BIN
PaiAi/.DS_Store


+ 74 - 33
PaiAi/Paiai.xcodeproj/project.pbxproj

@@ -54,7 +54,7 @@
54 54
 		05130FD921CA1AE0004EF1BE /* CreateGroupConfirmViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A69FFACF1E70047E0006FEE0 /* CreateGroupConfirmViewController.swift */; };
55 55
 		05130FDA21CA1AE0004EF1BE /* CreateGroupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A69FFAD01E70047E0006FEE0 /* CreateGroupViewController.swift */; };
56 56
 		05130FDB21CA1AE0004EF1BE /* ScanQRViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A69FFAD71E70047E0006FEE0 /* ScanQRViewController.swift */; };
57
-		05130FDD21CA1B04004EF1BE /* GroupPageController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A69FFAAB1E7004700006FEE0 /* GroupPageController.swift */; };
57
+		05130FDD21CA1B04004EF1BE /* GroupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A69FFAAB1E7004700006FEE0 /* GroupViewController.swift */; };
58 58
 		05130FDF21CA1B04004EF1BE /* MemberCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A69FFAB61E7004700006FEE0 /* MemberCell.swift */; };
59 59
 		05130FE021CA1B04004EF1BE /* GroupDetailController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A69FFAB11E7004700006FEE0 /* GroupDetailController.swift */; };
60 60
 		05130FE121CA1B04004EF1BE /* GroupMemberController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A69FFAB41E7004700006FEE0 /* GroupMemberController.swift */; };
@@ -117,7 +117,7 @@
117 117
 		0513103421CA1B67004EF1BE /* PhotoLocalStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 420FDBEA1EA70A9600958CBD /* PhotoLocalStorage.swift */; };
118 118
 		0513103521CA1B67004EF1BE /* RecentGroupInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = A69FFB081E700B700006FEE0 /* RecentGroupInfo.swift */; };
119 119
 		0513103921CA1B67004EF1BE /* HomeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A69FFAD51E70047E0006FEE0 /* HomeViewModel.swift */; };
120
-		0513103A21CA1B67004EF1BE /* GroupPageViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A69FFAAC1E7004700006FEE0 /* GroupPageViewModel.swift */; };
120
+		0513103A21CA1B67004EF1BE /* GroupViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A69FFAAC1E7004700006FEE0 /* GroupViewModel.swift */; };
121 121
 		0513103B21CA1B67004EF1BE /* GroupDetailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A69FFAB21E7004700006FEE0 /* GroupDetailViewModel.swift */; };
122 122
 		0513103C21CA1B67004EF1BE /* GroupMemberViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42CF50491EC0536000D23E9F /* GroupMemberViewModel.swift */; };
123 123
 		0513103D21CA1B67004EF1BE /* MineGroupViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42CF50451EC0526C00D23E9F /* MineGroupViewModel.swift */; };
@@ -200,6 +200,9 @@
200 200
 		0543E80B21D1DF4000A42807 /* GroupMemberItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0543E80A21D1DF4000A42807 /* GroupMemberItem.swift */; };
201 201
 		0543E80D21D1E2EA00A42807 /* PhotoGroupDetailRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0543E80C21D1E2EA00A42807 /* PhotoGroupDetailRepository.swift */; };
202 202
 		0543E80F21D1FD1100A42807 /* GroupDetailItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0543E80E21D1FD1100A42807 /* GroupDetailItem.swift */; };
203
+		0569F6152200438C000A75CA /* Group.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0569F613220042AF000A75CA /* Group.storyboard */; };
204
+		0569F61822014B24000A75CA /* NavigationBarDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0569F61722014B24000A75CA /* NavigationBarDelegate.swift */; };
205
+		0569F61A22014B30000A75CA /* NavigationBarProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0569F61922014B30000A75CA /* NavigationBarProxy.swift */; };
203 206
 		0572B2C121E2FB3E00EAD2A2 /* README.txt in Resources */ = {isa = PBXBuildFile; fileRef = 0572B2BC21E2FB3C00EAD2A2 /* README.txt */; };
204 207
 		0572B2C221E2FB3E00EAD2A2 /* README.txt in Resources */ = {isa = PBXBuildFile; fileRef = 0572B2BC21E2FB3C00EAD2A2 /* README.txt */; };
205 208
 		0572B2C321E2FB3E00EAD2A2 /* WXApiObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 0572B2BD21E2FB3C00EAD2A2 /* WXApiObject.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -250,14 +253,15 @@
250 253
 		05C8D21921ED985C0001E847 /* UINavigationController+NavigationBack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05C8D21821ED985C0001E847 /* UINavigationController+NavigationBack.swift */; };
251 254
 		05C8D21B21ED9A020001E847 /* UIViewController+Navigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05C8D21A21ED9A020001E847 /* UIViewController+Navigation.swift */; };
252 255
 		05C8D21D21EDD3770001E847 /* NavigationBarInteractivePopDeletegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05C8D21C21EDD3770001E847 /* NavigationBarInteractivePopDeletegate.swift */; };
253
-		05C8D22021EDD5F50001E847 /* NavigationBarInOut.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05C8D21F21EDD5F50001E847 /* NavigationBarInOut.swift */; };
256
+		05C8D22021EDD5F50001E847 /* NavigationBarInOutAnimator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05C8D21F21EDD5F50001E847 /* NavigationBarInOutAnimator.swift */; };
254 257
 		05C8D22221EED6860001E847 /* NavigationBarInteractiveViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05C8D22121EED6860001E847 /* NavigationBarInteractiveViewController.swift */; };
255 258
 		05C8D22421EED92F0001E847 /* NavigationBarPushAndPopDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05C8D22321EED92F0001E847 /* NavigationBarPushAndPopDelegate.swift */; };
256
-		05C8D22621EEE1EB0001E847 /* NavigationBarDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05C8D22521EEE1EB0001E847 /* NavigationBarDelegate.swift */; };
257 259
 		05C8D22921EF0A9F0001E847 /* NavigationControllerProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05C8D22821EF0A9F0001E847 /* NavigationControllerProxy.swift */; };
258 260
 		05C8D22B21EF0EDC0001E847 /* NavigationControllerDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05C8D22A21EF0EDC0001E847 /* NavigationControllerDelegate.swift */; };
259 261
 		05D3A3C621FF010900A29A20 /* WebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05D3A3C521FF010900A29A20 /* WebViewController.swift */; };
260 262
 		05D3A3C821FFF67F00A29A20 /* GestureRecoginzier+NavigationBack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05D3A3C721FFF67F00A29A20 /* GestureRecoginzier+NavigationBack.swift */; };
263
+		05D3A3CD22000C3A00A29A20 /* GroupCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05D3A3CC22000C3900A29A20 /* GroupCoordinator.swift */; };
264
+		05D3A3D02200288400A29A20 /* Storyboarded.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05D3A3CF2200288400A29A20 /* Storyboarded.swift */; };
261 265
 		05E80E3021DF65D5006368C4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 05E80E2F21DF65D4006368C4 /* Assets.xcassets */; };
262 266
 /* End PBXBuildFile section */
263 267
 
@@ -449,6 +453,9 @@
449 453
 		05468AF11F8B73A000B8F469 /* PhotoItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoItem.swift; sourceTree = "<group>"; };
450 454
 		054863661FA326CB00A39DA0 /* PhotoCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoCell.swift; sourceTree = "<group>"; };
451 455
 		054863671FA326CB00A39DA0 /* PhotoCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PhotoCell.xib; sourceTree = "<group>"; };
456
+		0569F613220042AF000A75CA /* Group.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Group.storyboard; sourceTree = "<group>"; };
457
+		0569F61722014B24000A75CA /* NavigationBarDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationBarDelegate.swift; sourceTree = "<group>"; };
458
+		0569F61922014B30000A75CA /* NavigationBarProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationBarProxy.swift; sourceTree = "<group>"; };
452 459
 		0572B2BC21E2FB3C00EAD2A2 /* README.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.txt; sourceTree = "<group>"; };
453 460
 		0572B2BD21E2FB3C00EAD2A2 /* WXApiObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXApiObject.h; sourceTree = "<group>"; };
454 461
 		0572B2BE21E2FB3D00EAD2A2 /* WechatAuthSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WechatAuthSDK.h; sourceTree = "<group>"; };
@@ -504,14 +511,15 @@
504 511
 		05C8D21821ED985C0001E847 /* UINavigationController+NavigationBack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UINavigationController+NavigationBack.swift"; sourceTree = "<group>"; };
505 512
 		05C8D21A21ED9A020001E847 /* UIViewController+Navigation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+Navigation.swift"; sourceTree = "<group>"; };
506 513
 		05C8D21C21EDD3770001E847 /* NavigationBarInteractivePopDeletegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationBarInteractivePopDeletegate.swift; sourceTree = "<group>"; };
507
-		05C8D21F21EDD5F50001E847 /* NavigationBarInOut.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationBarInOut.swift; sourceTree = "<group>"; };
514
+		05C8D21F21EDD5F50001E847 /* NavigationBarInOutAnimator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationBarInOutAnimator.swift; sourceTree = "<group>"; };
508 515
 		05C8D22121EED6860001E847 /* NavigationBarInteractiveViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationBarInteractiveViewController.swift; sourceTree = "<group>"; };
509 516
 		05C8D22321EED92F0001E847 /* NavigationBarPushAndPopDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationBarPushAndPopDelegate.swift; sourceTree = "<group>"; };
510
-		05C8D22521EEE1EB0001E847 /* NavigationBarDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationBarDelegate.swift; sourceTree = "<group>"; };
511 517
 		05C8D22821EF0A9F0001E847 /* NavigationControllerProxy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationControllerProxy.swift; sourceTree = "<group>"; };
512 518
 		05C8D22A21EF0EDC0001E847 /* NavigationControllerDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationControllerDelegate.swift; sourceTree = "<group>"; };
513 519
 		05D3A3C521FF010900A29A20 /* WebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewController.swift; sourceTree = "<group>"; };
514 520
 		05D3A3C721FFF67F00A29A20 /* GestureRecoginzier+NavigationBack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GestureRecoginzier+NavigationBack.swift"; sourceTree = "<group>"; };
521
+		05D3A3CC22000C3900A29A20 /* GroupCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupCoordinator.swift; sourceTree = "<group>"; };
522
+		05D3A3CF2200288400A29A20 /* Storyboarded.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Storyboarded.swift; sourceTree = "<group>"; };
515 523
 		05E80E2F21DF65D4006368C4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
516 524
 		3864C06C1CAD27EC0048ADAD /* Swift-bridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Swift-bridge.h"; sourceTree = "<group>"; };
517 525
 		420FDBEA1EA70A9600958CBD /* PhotoLocalStorage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoLocalStorage.swift; sourceTree = "<group>"; };
@@ -536,8 +544,8 @@
536 544
 		A69FFAA61E7004700006FEE0 /* ImageCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageCell.swift; sourceTree = "<group>"; wrapsLines = 0; };
537 545
 		A69FFAA81E7004700006FEE0 /* ShareController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShareController.swift; sourceTree = "<group>"; };
538 546
 		A69FFAA91E7004700006FEE0 /* ShowFullPicController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShowFullPicController.swift; sourceTree = "<group>"; };
539
-		A69FFAAB1E7004700006FEE0 /* GroupPageController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupPageController.swift; sourceTree = "<group>"; };
540
-		A69FFAAC1E7004700006FEE0 /* GroupPageViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupPageViewModel.swift; sourceTree = "<group>"; };
547
+		A69FFAAB1E7004700006FEE0 /* GroupViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupViewController.swift; sourceTree = "<group>"; };
548
+		A69FFAAC1E7004700006FEE0 /* GroupViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupViewModel.swift; sourceTree = "<group>"; };
541 549
 		A69FFAAE1E7004700006FEE0 /* ChangeGroupNameController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChangeGroupNameController.swift; sourceTree = "<group>"; };
542 550
 		A69FFAB01E7004700006FEE0 /* GroupDetailModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupDetailModel.swift; sourceTree = "<group>"; };
543 551
 		A69FFAB11E7004700006FEE0 /* GroupDetailController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GroupDetailController.swift; sourceTree = "<group>"; };
@@ -674,6 +682,7 @@
674 682
 			children = (
675 683
 				42FECF071EE0339500D4C695 /* HardwareAuthorization.swift */,
676 684
 				05C5285921FEABBB0090ECB5 /* UIKitDelegate */,
685
+				05D3A3CE2200281D00A29A20 /* Protocol */,
677 686
 				0500C26121E7508B009A7013 /* Animationes */,
678 687
 				05130F4D21C94B72004EF1BE /* UIKit */,
679 688
 				0543272621C68C1900C6388D /* Extension */,
@@ -754,11 +763,11 @@
754 763
 			isa = PBXGroup;
755 764
 			children = (
756 765
 				0543E7F321CB911200A42807 /* UserInfoViewModel.swift */,
757
-				0543E80121D0CD9900A42807 /* home */,
758
-				0543E80321D0CD9E00A42807 /* message */,
759
-				0543E80221D0CD9C00A42807 /* mine */,
760
-				0543E80421D0CDA000A42807 /* groupDetail */,
761
-				0543E80521D0CDDA00A42807 /* photoDetail */,
766
+				05D3A3CB21FFFA3500A29A20 /* Group */,
767
+				0543E80121D0CD9900A42807 /* Home */,
768
+				0543E80321D0CD9E00A42807 /* Message */,
769
+				0543E80221D0CD9C00A42807 /* Mine */,
770
+				0543E80521D0CDDA00A42807 /* PhotoDetail */,
762 771
 			);
763 772
 			path = PresentLayer;
764 773
 			sourceTree = "<group>";
@@ -845,7 +854,7 @@
845 854
 				054863661FA326CB00A39DA0 /* PhotoCell.swift */,
846 855
 				054863671FA326CB00A39DA0 /* PhotoCell.xib */,
847 856
 				05D790AD1FC50E7C00469AD1 /* Home */,
848
-				05D790AE1FC50E7C00469AD1 /* GroupDetail */,
857
+				05D790AF1FC50E7C00469AD1 /* Group */,
849 858
 				05D790AA1FC50E7C00469AD1 /* Message */,
850 859
 				05D790AC1FC50E7C00469AD1 /* Mine */,
851 860
 				05D790AB1FC50E7C00469AD1 /* PhotoDetail */,
@@ -999,51 +1008,59 @@
999 1008
 			path = UIKit;
1000 1009
 			sourceTree = "<group>";
1001 1010
 		};
1002
-		0543E80121D0CD9900A42807 /* home */ = {
1011
+		0543E80121D0CD9900A42807 /* Home */ = {
1003 1012
 			isa = PBXGroup;
1004 1013
 			children = (
1005 1014
 				A69FFAD51E70047E0006FEE0 /* HomeViewModel.swift */,
1006
-				A69FFAAC1E7004700006FEE0 /* GroupPageViewModel.swift */,
1007 1015
 				05130F2721C88D35004EF1BE /* ScanQRViewModel.swift */,
1008 1016
 				05A0E8A821C782D700EAB9A2 /* CreateGroupConfirmViewModel.swift */,
1009 1017
 			);
1010
-			path = home;
1018
+			path = Home;
1011 1019
 			sourceTree = "<group>";
1012 1020
 		};
1013
-		0543E80221D0CD9C00A42807 /* mine */ = {
1021
+		0543E80221D0CD9C00A42807 /* Mine */ = {
1014 1022
 			isa = PBXGroup;
1015 1023
 			children = (
1016 1024
 				42CF50451EC0526C00D23E9F /* MineGroupViewModel.swift */,
1017 1025
 				42CF50471EC052B200D23E9F /* MineOrderViewModel.swift */,
1018 1026
 				0543E80621D0CDFA00A42807 /* MineFeedbackViewModel.swift */,
1019 1027
 			);
1020
-			path = mine;
1028
+			path = Mine;
1021 1029
 			sourceTree = "<group>";
1022 1030
 		};
1023
-		0543E80321D0CD9E00A42807 /* message */ = {
1031
+		0543E80321D0CD9E00A42807 /* Message */ = {
1024 1032
 			isa = PBXGroup;
1025 1033
 			children = (
1026 1034
 				059AA62A21BA85B000485188 /* MessageViewModel.swift */,
1027 1035
 				A69FFADE1E70047E0006FEE0 /* MessageListViewModel.swift */,
1028 1036
 			);
1029
-			path = message;
1037
+			path = Message;
1030 1038
 			sourceTree = "<group>";
1031 1039
 		};
1032
-		0543E80421D0CDA000A42807 /* groupDetail */ = {
1040
+		0543E80421D0CDA000A42807 /* GroupDetail */ = {
1033 1041
 			isa = PBXGroup;
1034 1042
 			children = (
1035 1043
 				A69FFAB21E7004700006FEE0 /* GroupDetailViewModel.swift */,
1036 1044
 				42CF50491EC0536000D23E9F /* GroupMemberViewModel.swift */,
1037 1045
 			);
1038
-			path = groupDetail;
1046
+			path = GroupDetail;
1039 1047
 			sourceTree = "<group>";
1040 1048
 		};
1041
-		0543E80521D0CDDA00A42807 /* photoDetail */ = {
1049
+		0543E80521D0CDDA00A42807 /* PhotoDetail */ = {
1042 1050
 			isa = PBXGroup;
1043 1051
 			children = (
1044 1052
 				A69FFAA41E7004700006FEE0 /* DetailPageViewModel.swift */,
1045 1053
 			);
1046
-			path = photoDetail;
1054
+			path = PhotoDetail;
1055
+			sourceTree = "<group>";
1056
+		};
1057
+		0569F61622014AF9000A75CA /* NavigationBarDelegate */ = {
1058
+			isa = PBXGroup;
1059
+			children = (
1060
+				0569F61922014B30000A75CA /* NavigationBarProxy.swift */,
1061
+				0569F61722014B24000A75CA /* NavigationBarDelegate.swift */,
1062
+			);
1063
+			path = NavigationBarDelegate;
1047 1064
 			sourceTree = "<group>";
1048 1065
 		};
1049 1066
 		0572B2BB21E2FAEE00EAD2A2 /* wxSDK */ = {
@@ -1129,6 +1146,7 @@
1129 1146
 		05C5285921FEABBB0090ECB5 /* UIKitDelegate */ = {
1130 1147
 			isa = PBXGroup;
1131 1148
 			children = (
1149
+				0569F61622014AF9000A75CA /* NavigationBarDelegate */,
1132 1150
 				05C5285C21FEAFAA0090ECB5 /* ViewControllerTransitioningDelegate */,
1133 1151
 				05C5285421FE98E70090ECB5 /* GestureRecognizerDelegate */,
1134 1152
 				05C8D22C21EF0F8E0001E847 /* NavigationControllerDelegate */,
@@ -1160,8 +1178,7 @@
1160 1178
 			isa = PBXGroup;
1161 1179
 			children = (
1162 1180
 				05C8D22121EED6860001E847 /* NavigationBarInteractiveViewController.swift */,
1163
-				05C8D21F21EDD5F50001E847 /* NavigationBarInOut.swift */,
1164
-				05C8D22521EEE1EB0001E847 /* NavigationBarDelegate.swift */,
1181
+				05C8D21F21EDD5F50001E847 /* NavigationBarInOutAnimator.swift */,
1165 1182
 				05C8D21C21EDD3770001E847 /* NavigationBarInteractivePopDeletegate.swift */,
1166 1183
 				05C8D22321EED92F0001E847 /* NavigationBarPushAndPopDelegate.swift */,
1167 1184
 			);
@@ -1177,6 +1194,23 @@
1177 1194
 			path = NavigationControllerDelegate;
1178 1195
 			sourceTree = "<group>";
1179 1196
 		};
1197
+		05D3A3CB21FFFA3500A29A20 /* Group */ = {
1198
+			isa = PBXGroup;
1199
+			children = (
1200
+				A69FFAAC1E7004700006FEE0 /* GroupViewModel.swift */,
1201
+				0543E80421D0CDA000A42807 /* GroupDetail */,
1202
+			);
1203
+			path = Group;
1204
+			sourceTree = "<group>";
1205
+		};
1206
+		05D3A3CE2200281D00A29A20 /* Protocol */ = {
1207
+			isa = PBXGroup;
1208
+			children = (
1209
+				05D3A3CF2200288400A29A20 /* Storyboarded.swift */,
1210
+			);
1211
+			path = Protocol;
1212
+			sourceTree = "<group>";
1213
+		};
1180 1214
 		05D790AA1FC50E7C00469AD1 /* Message */ = {
1181 1215
 			isa = PBXGroup;
1182 1216
 			children = (
@@ -1233,7 +1267,6 @@
1233 1267
 				A69FFAD01E70047E0006FEE0 /* CreateGroupViewController.swift */,
1234 1268
 				A69FFAD71E70047E0006FEE0 /* ScanQRViewController.swift */,
1235 1269
 				A69FFB8E1E7018CC0006FEE0 /* Main.storyboard */,
1236
-				05D790AF1FC50E7C00469AD1 /* Group */,
1237 1270
 			);
1238 1271
 			path = Home;
1239 1272
 			sourceTree = "<group>";
@@ -1255,7 +1288,10 @@
1255 1288
 		05D790AF1FC50E7C00469AD1 /* Group */ = {
1256 1289
 			isa = PBXGroup;
1257 1290
 			children = (
1258
-				A69FFAAB1E7004700006FEE0 /* GroupPageController.swift */,
1291
+				05D3A3CC22000C3900A29A20 /* GroupCoordinator.swift */,
1292
+				A69FFAAB1E7004700006FEE0 /* GroupViewController.swift */,
1293
+				0569F613220042AF000A75CA /* Group.storyboard */,
1294
+				05D790AE1FC50E7C00469AD1 /* GroupDetail */,
1259 1295
 			);
1260 1296
 			path = Group;
1261 1297
 			sourceTree = "<group>";
@@ -1537,6 +1573,7 @@
1537 1573
 			knownRegions = (
1538 1574
 				en,
1539 1575
 				Base,
1576
+				global,
1540 1577
 			);
1541 1578
 			mainGroup = 6CEBD0F61CA8D680004DBDE0;
1542 1579
 			productRefGroup = 6CEBD1001CA8D680004DBDE0 /* Products */;
@@ -1573,6 +1610,7 @@
1573 1610
 			isa = PBXResourcesBuildPhase;
1574 1611
 			buildActionMask = 2147483647;
1575 1612
 			files = (
1613
+				0569F6152200438C000A75CA /* Group.storyboard in Resources */,
1576 1614
 				0572B2C921E30D8000EAD2A2 /* PhotoCell.xib in Resources */,
1577 1615
 				0513105B21CA1D50004EF1BE /* Mine.storyboard in Resources */,
1578 1616
 				0513105821CA1D50004EF1BE /* Main.storyboard in Resources */,
@@ -1669,9 +1707,8 @@
1669 1707
 				0513100021CA1B39004EF1BE /* CLLocationExt.swift in Sources */,
1670 1708
 				059B58AA21F83B2E00FA64C2 /* CenterConfirmItem.swift in Sources */,
1671 1709
 				05C5285E21FEB03F0090ECB5 /* ViewControllerTransitioningProxy.swift in Sources */,
1672
-				05C8D22621EEE1EB0001E847 /* NavigationBarDelegate.swift in Sources */,
1673 1710
 				057317A421F5C6C0009B2FCE /* BottomCancelItem.swift in Sources */,
1674
-				05C8D22021EDD5F50001E847 /* NavigationBarInOut.swift in Sources */,
1711
+				05C8D22021EDD5F50001E847 /* NavigationBarInOutAnimator.swift in Sources */,
1675 1712
 				0513100121CA1B39004EF1BE /* CGPointExt.swift in Sources */,
1676 1713
 				0584FD7521F9C70D00FA1E3E /* SideAnimator.swift in Sources */,
1677 1714
 				0584FD7721F9C8A300FA1E3E /* PresentAnimatorDelegate.swift in Sources */,
@@ -1698,6 +1735,7 @@
1698 1735
 				05C8D21221ED7B620001E847 /* UINavigationBar+FixSpace.swift in Sources */,
1699 1736
 				05C8D21021ED7B280001E847 /* UIApplication+Swizzle.swift in Sources */,
1700 1737
 				0513100E21CA1B39004EF1BE /* UIButtonExt.swift in Sources */,
1738
+				0569F61A22014B30000A75CA /* NavigationBarProxy.swift in Sources */,
1701 1739
 				0513100F21CA1B39004EF1BE /* UIViewExt.swift in Sources */,
1702 1740
 				053E125F21F16BA400A64893 /* ToastTextView.swift in Sources */,
1703 1741
 				0513109B21CA3915004EF1BE /* QRCodeConfiguration.swift in Sources */,
@@ -1710,6 +1748,7 @@
1710 1748
 				0513109921CA3915004EF1BE /* NotificationExt.swift in Sources */,
1711 1749
 				0513101921CA1B39004EF1BE /* UIImageExt.swift in Sources */,
1712 1750
 				05C8D22921EF0A9F0001E847 /* NavigationControllerProxy.swift in Sources */,
1751
+				05D3A3D02200288400A29A20 /* Storyboarded.swift in Sources */,
1713 1752
 				05C0CEFB21F85A7700993DE2 /* ActionSheetController.swift in Sources */,
1714 1753
 				05C8D21421ED8B9B0001E847 /* NavigationBackViewController.swift in Sources */,
1715 1754
 				053E126121F16BB100A64893 /* ToastImageView.swift in Sources */,
@@ -1732,6 +1771,7 @@
1732 1771
 				0513107C21CA3907004EF1BE /* FFAlertController.swift in Sources */,
1733 1772
 				05130F5721C94C12004EF1BE /* AlertAnimator.swift in Sources */,
1734 1773
 				0513109321CA3915004EF1BE /* ColorQR.swift in Sources */,
1774
+				0569F61822014B24000A75CA /* NavigationBarDelegate.swift in Sources */,
1735 1775
 				05130F5C21C94C12004EF1BE /* ActionSheetAnimator.swift in Sources */,
1736 1776
 				05130F5B21C94C12004EF1BE /* PresentAnimatable.swift in Sources */,
1737 1777
 				0513107E21CA3907004EF1BE /* FFAlertControllerRepresentable.swift in Sources */,
@@ -1791,7 +1831,7 @@
1791 1831
 				0513103521CA1B67004EF1BE /* RecentGroupInfo.swift in Sources */,
1792 1832
 				0513103921CA1B67004EF1BE /* HomeViewModel.swift in Sources */,
1793 1833
 				0543E80F21D1FD1100A42807 /* GroupDetailItem.swift in Sources */,
1794
-				0513103A21CA1B67004EF1BE /* GroupPageViewModel.swift in Sources */,
1834
+				0513103A21CA1B67004EF1BE /* GroupViewModel.swift in Sources */,
1795 1835
 				05C0D99021D2219A000B7B2A /* CommentItem.swift in Sources */,
1796 1836
 				0513103B21CA1B67004EF1BE /* GroupDetailViewModel.swift in Sources */,
1797 1837
 				05B2C62B21D750F1008063B3 /* FeedbackRemoteAPI.swift in Sources */,
@@ -1824,13 +1864,14 @@
1824 1864
 			buildActionMask = 2147483647;
1825 1865
 			files = (
1826 1866
 				051310B621CB675A004EF1BE /* UIImageView+Kingfisher.swift in Sources */,
1827
-				05130FDD21CA1B04004EF1BE /* GroupPageController.swift in Sources */,
1867
+				05130FDD21CA1B04004EF1BE /* GroupViewController.swift in Sources */,
1828 1868
 				05130FDF21CA1B04004EF1BE /* MemberCell.swift in Sources */,
1829 1869
 				05130FE021CA1B04004EF1BE /* GroupDetailController.swift in Sources */,
1830 1870
 				05130FE121CA1B04004EF1BE /* GroupMemberController.swift in Sources */,
1831 1871
 				05130FE221CA1B04004EF1BE /* ChangeGroupNameController.swift in Sources */,
1832 1872
 				05130FE321CA1B04004EF1BE /* ShowGroupQRController.swift in Sources */,
1833 1873
 				05130FE421CA1B04004EF1BE /* MessageCommentAndThumbupCell.swift in Sources */,
1874
+				05D3A3CD22000C3A00A29A20 /* GroupCoordinator.swift in Sources */,
1834 1875
 				05130FE521CA1B04004EF1BE /* MessageSystemCell.swift in Sources */,
1835 1876
 				05130FE621CA1B04004EF1BE /* MessageCoordinator.swift in Sources */,
1836 1877
 				05130FE721CA1B04004EF1BE /* MessageViewController.swift in Sources */,

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


PaiAi/Paiai/Assets.xcassets/MainPage/二维码.imageset/Contents.json → PaiAi/Paiai/Assets.xcassets/MainPage/navigation-QR.imageset/Contents.json


PaiAi/Paiai/Assets.xcassets/MainPage/二维码.imageset/二维码 (1).png → PaiAi/Paiai/Assets.xcassets/MainPage/navigation-QR.imageset/二维码 (1).png


PaiAi/Paiai/Assets.xcassets/MainPage/更多-右上角-1.imageset/Contents.json → PaiAi/Paiai/Assets.xcassets/MainPage/navigation-right.imageset/Contents.json


PaiAi/Paiai/Assets.xcassets/MainPage/更多-右上角-1.imageset/更多-右上角.png → PaiAi/Paiai/Assets.xcassets/MainPage/navigation-right.imageset/更多-右上角.png


+ 1 - 1
PaiAi/PaiaiDataKit/DataLayer/Repositories/GroupPhotoRepository.swift

@@ -18,7 +18,7 @@ struct GroupPhotoRepository {
18 18
         groupPhotoRemoteAPI = GroupPhotoRemoteAPI(groupId: groupId)
19 19
     }
20 20
     
21
-    func load(page: Int) -> Single<[PhotoItem]> {
21
+    func load() -> Single<[PhotoItem]> {
22 22
         return groupPhotoRemoteAPI.loadContent()
23 23
     }
24 24
     

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

@@ -32,18 +32,17 @@ struct GroupPhotoRemoteAPI {
32 32
  
33 33
     func loadContent() -> Single<[PhotoItem]> {
34 34
         let resource = ContentResource<[PhotoItem]>(path: .groupPhotoList,
35
-                                                     parameter: ["user_id": "",
35
+                                                     parameter: ["user_id": ShareUserId,
36 36
                                                                  "group_id": groupId],
37 37
                                                      parseJSON: parse)
38 38
         return resource.loadContent()
39 39
     }
40 40
     
41 41
     func uploadPhoto(data: Data) -> Single<PhotoItem> {
42
-        #warning("user_id")
43 42
         let name = groupId + "" + "\(Date.timeIntervalSinceReferenceDate)"
44 43
         let file = FileModel(name: name, fileData: data)
45 44
         let uploadResource = UploadResource<PhotoItem>(path: .photoUpload,
46
-                                                       parameter: ["user_id": "",
45
+                                                       parameter: ["user_id": ShareUserId,
47 46
                                                                    "group_id": groupId,
48 47
                                                                    "photo": file],
49 48
                                                        parseJSON: parseUpload)

PaiAi/PaiaiDataKit/PresentLayer/groupDetail/GroupDetailViewModel.swift → PaiAi/PaiaiDataKit/PresentLayer/Group/GroupDetail/GroupDetailViewModel.swift


PaiAi/PaiaiDataKit/PresentLayer/groupDetail/GroupMemberViewModel.swift → PaiAi/PaiaiDataKit/PresentLayer/Group/GroupDetail/GroupMemberViewModel.swift


+ 100 - 0
PaiAi/PaiaiDataKit/PresentLayer/Group/GroupViewModel.swift

@@ -0,0 +1,100 @@
1
+//
2
+//  GroupViewModel.swift
3
+//  PaiAi
4
+//
5
+//  Created by zhengjianfei on 2017/1/4.
6
+//  Copyright © 2017年 FFIB. All rights reserved.
7
+//
8
+
9
+import Foundation
10
+import UIKit
11
+import RxSwift
12
+import RxCocoa
13
+import RxDataSources
14
+
15
+public protocol GroupViewModelDelegate: class {
16
+    func didSelect(_ item: PhotoItem)
17
+    func navigateToGroupDetail()
18
+    func presentGroupQR()
19
+}
20
+
21
+public class GroupViewModel {
22
+    
23
+    private let disposeBag = DisposeBag()
24
+    
25
+    private var respository: GroupPhotoRepository
26
+    
27
+    private var _isLoading = PublishSubject<Void>()
28
+    private let items = BehaviorRelay<[PhotoItem]>(value: [])
29
+    
30
+    public var photographBtnTapped = PublishSubject<Void>()
31
+    
32
+    
33
+    public var isLoading: Observable<Void> {
34
+        return _isLoading.asObservable()
35
+    }
36
+
37
+    public var contents: Observable<[AnimatableSectionModel<Int, PhotoItem>]> {
38
+        return items.map({ model in
39
+            return [AnimatableSectionModel(model: 0, items: model)]
40
+        })
41
+    }
42
+    
43
+    public weak var delegate: GroupViewModelDelegate?
44
+    
45
+    public init(groupItem: GroupItem) {
46
+        self.respository = GroupPhotoRepository(groupId: groupItem.group_id)
47
+        
48
+        
49
+        photographBtnTapped.subscribe({
50
+            [weak self] (_) in
51
+            guard let `self` = self else { return }
52
+//            self.delegate?.scanQR()
53
+        }).disposed(by: disposeBag)
54
+    }
55
+    
56
+    public func reload() {
57
+        respository.load()
58
+            .subscribe(onSuccess: {[weak self] (result) in
59
+                guard let `self` = self else { return }                
60
+                self._isLoading.onNext(())
61
+                self.items.accept(result)
62
+                }, onError: {[weak self] (_) in
63
+                    guard let `self` = self else { return }
64
+                    self._isLoading.onNext(())
65
+            }).disposed(by: disposeBag)
66
+    }
67
+
68
+    public func submit(image: UIImage) {
69
+        let edge = image.size.width > image.size.height ? image.size.height : image.size.width
70
+//        let newImage = image.scaledImage(1280 / edge),
71
+        guard let data = image.jpegData(compressionQuality: 0.4) else { return }
72
+
73
+        respository.upload(data: data)
74
+    }
75
+    
76
+    public func layoutSizeForIndexPath(_ indexPath: IndexPath) -> CGSize {
77
+        let item = items.value[indexPath.row]
78
+        let w = item.photo_thumbnail_w
79
+        let h = item.photo_thumbnail_h
80
+        
81
+        //        header 42, footer: 32
82
+        return CGSize(width: w, height: h + 74)
83
+    }
84
+}
85
+
86
+/// GroupViewModelDelegate
87
+public extension GroupViewModel {
88
+    func didSelect(_ item: PhotoItem) {
89
+        delegate?.didSelect(item)
90
+    }
91
+    
92
+    @objc func navigateToGroupDetail() {
93
+        delegate?.navigateToGroupDetail()
94
+    }
95
+    
96
+    
97
+    @objc func presentGroupQR() {
98
+        delegate?.presentGroupQR()
99
+    }
100
+}

PaiAi/PaiaiDataKit/PresentLayer/home/CreateGroupConfirmViewModel.swift → PaiAi/PaiaiDataKit/PresentLayer/Home/CreateGroupConfirmViewModel.swift


+ 4 - 4
PaiAi/PaiaiDataKit/PresentLayer/home/HomeViewModel.swift

@@ -51,14 +51,14 @@ public class HomeViewModel {
51 51
     public init() {
52 52
         self.respository = HomePhotoRepository()
53 53
         
54
-        scanBtnTapped.asObserver().subscribe(onNext: {
55
-            [weak self] in
54
+        scanBtnTapped.subscribe({
55
+            [weak self] (_) in
56 56
             guard let `self` = self else { return }
57 57
             self.delegate?.scanQR()
58 58
         }).disposed(by: disposeBag)
59 59
         
60
-        createBtnTapped.asObserver().subscribe(onNext: {
61
-            [weak self] in
60
+        createBtnTapped.subscribe({
61
+            [weak self] (_) in
62 62
             guard let `self` = self else { return }
63 63
             self.delegate?.createGroup()
64 64
         }).disposed(by: disposeBag)

PaiAi/PaiaiDataKit/PresentLayer/home/ScanQRViewModel.swift → PaiAi/PaiaiDataKit/PresentLayer/Home/ScanQRViewModel.swift


PaiAi/PaiaiDataKit/PresentLayer/message/MessageListViewModel.swift → PaiAi/PaiaiDataKit/PresentLayer/Message/MessageListViewModel.swift


PaiAi/PaiaiDataKit/PresentLayer/message/MessageViewModel.swift → PaiAi/PaiaiDataKit/PresentLayer/Message/MessageViewModel.swift


PaiAi/PaiaiDataKit/PresentLayer/mine/MineFeedbackViewModel.swift → PaiAi/PaiaiDataKit/PresentLayer/Mine/MineFeedbackViewModel.swift


PaiAi/PaiaiDataKit/PresentLayer/mine/MineGroupViewModel.swift → PaiAi/PaiaiDataKit/PresentLayer/Mine/MineGroupViewModel.swift


PaiAi/PaiaiDataKit/PresentLayer/mine/MineOrderViewModel.swift → PaiAi/PaiaiDataKit/PresentLayer/Mine/MineOrderViewModel.swift


PaiAi/PaiaiDataKit/PresentLayer/photoDetail/DetailPageViewModel.swift → PaiAi/PaiaiDataKit/PresentLayer/PhotoDetail/DetailPageViewModel.swift


+ 0 - 70
PaiAi/PaiaiDataKit/PresentLayer/home/GroupPageViewModel.swift

@@ -1,70 +0,0 @@
1
-//
2
-//  GroupPageViewModel.swift
3
-//  PaiAi
4
-//
5
-//  Created by zhengjianfei on 2017/1/4.
6
-//  Copyright © 2017年 FFIB. All rights reserved.
7
-//
8
-
9
-import Foundation
10
-import UIKit
11
-import RxSwift
12
-import RxCocoa
13
-import RxDataSources
14
-
15
-public protocol GroupPageViewModelDelegate: class {
16
-    func didSelect(_ item: PhotoItem)
17
-    func navigateToGroupDetail()
18
-    func navigateToGroupQR()
19
-}
20
-
21
-public class GroupPageViewModel {
22
-    private let respository: GroupPhotoRepository
23
-    private let items: BehaviorRelay<[PhotoItem]>
24
-    
25
-    weak var delegate: GroupPageViewModelDelegate?
26
-    
27
-    init(groupId: String) {
28
-        respository = GroupPhotoRepository(groupId: groupId)
29
-        items = BehaviorRelay<[PhotoItem]>(value: [])
30
-    }
31
-    
32
-    public var groupPhotoContents: Observable<[AnimatableSectionModel<Int, PhotoItem>]> {
33
-        return items.map({ model in
34
-            return [AnimatableSectionModel(model: 0, items: model)]
35
-        })
36
-    }
37
-
38
-    public func submit(image: UIImage) {
39
-        let edge = image.size.width > image.size.height ? image.size.height : image.size.width
40
-//        let newImage = image.scaledImage(1280 / edge),
41
-        guard let data = image.jpegData(compressionQuality: 0.4) else { return }
42
-
43
-        respository.upload(data: data)
44
-    }
45
-    
46
-    public func reload() {
47
-        respository.load(page: 1)
48
-    }
49
-    
50
-    public func layoutSizeForIndexPath(_ indexPath: IndexPath) -> CGSize {
51
-        let item = items.value[indexPath.row]
52
-        let w = item.photo_thumbnail_w
53
-        let h = item.photo_thumbnail_h
54
-        return CGSize(width: w, height: h)
55
-    }
56
-}
57
-
58
-extension GroupPageViewModel {
59
-    public func didSelect(_ item: PhotoItem) {
60
-        delegate?.didSelect(item)
61
-    }
62
-    
63
-    public func navigateToGroupDetail() {
64
-        delegate?.navigateToGroupDetail()
65
-    }
66
-    
67
-    public func navigateToGroupQR() {
68
-        delegate?.navigateToGroupDetail()
69
-    }
70
-}

+ 20 - 8
PaiAi/PaiaiUIKit/Reusable/Extension/UIKit/UIBarButtonItemExt.swift

@@ -8,13 +8,13 @@
8 8
 
9 9
 import UIKit
10 10
 
11
-extension UIBarButtonItem {
11
+public extension UIBarButtonItem {
12 12
     convenience init(space: CGFloat) {
13 13
         self.init(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
14 14
         self.width = space
15 15
     }
16 16
     
17
-    convenience init(image: UIImage, target: Any, action: Selector) {
17
+    convenience init(image: UIImage?, target: Any, action: Selector) {
18 18
         let button = UIButton(type: .custom)
19 19
         button.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
20 20
         button.setImage(image, for: .normal)
@@ -49,18 +49,30 @@ extension UIBarButtonItem {
49 49
     }
50 50
     
51 51
     convenience init(images: [UIImage?], btnSpace: CGFloat, target: Any, actions: [Selector]) {
52
-        let barView = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 44))
53
-        var lastX: CGFloat = 0
52
+        let barView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 36))
53
+        barView.backgroundColor = UIColor.cyan
54
+        
55
+        var last: UIButton?
54 56
         for (image, action) in zip(images, actions) {
55 57
             let button = UIButton(type: .custom)
56
-            button.frame = CGRect(x: lastX, y: 2, width: 40, height: 40)
58
+            button.translatesAutoresizingMaskIntoConstraints = false
57 59
             button.setImage(image, for: .normal)
58 60
             button.addTarget(target, action: action, for: .touchDown)
59
-            button.center = CGPoint(x: button.center.x, y: barView.center.y)
60 61
             barView.addSubview(button)
61
-            lastX += button.width + btnSpace
62
+            
63
+            NSLayoutConstraint.activate([
64
+                button.widthAnchor.constraint(equalToConstant: 36),
65
+                button.heightAnchor.constraint(equalToConstant: 36),
66
+                button.centerYAnchor.constraint(equalTo: barView.centerYAnchor),
67
+                button.leadingAnchor.constraint(equalTo: last?.trailingAnchor ?? barView.leadingAnchor)
68
+                ])
69
+            last = button
62 70
         }
63
-        barView.width = lastX
71
+        
72
+        if let l = last {
73
+            NSLayoutConstraint.activate([l.trailingAnchor.constraint(equalTo: barView.trailingAnchor)])
74
+        }
75
+        
64 76
         self.init(customView: barView)
65 77
     }
66 78
 }

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

@@ -20,9 +20,9 @@ public extension UIViewController {
20 20
     }
21 21
     
22 22
     
23
-    @objc func popController(animated: Bool = true) {
24
-        navigationController?.popViewController(animated: animated)
25
-    }
23
+//    @objc func popViewController(animated: Bool = true) {
24
+//        navigationController?.popViewController(animated: animated)
25
+//    }
26 26
     
27 27
     func popToController(_ vc: UIViewController, animated: Bool = true) {
28 28
         navigationController?.popToViewController(vc, animated: animated)

+ 13 - 0
PaiAi/PaiaiUIKit/Reusable/Protocol/Storyboarded.swift

@@ -0,0 +1,13 @@
1
+//
2
+//  Storyboarded.swift
3
+//  PaiaiUIKit
4
+//
5
+//  Created by ffib on 2019/1/29.
6
+//  Copyright © 2019 yb. All rights reserved.
7
+//
8
+
9
+import UIKit
10
+
11
+public protocol Storyboarded where Self: UIViewController {
12
+    static func instantiate() -> Self
13
+}

+ 8 - 2
PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationBack/NavigationBackDelegate.swift

@@ -6,7 +6,7 @@
6 6
 //  Copyright © 2019 yb. All rights reserved.
7 7
 //
8 8
 
9
-import UIKit
9
+import Foundation
10 10
 
11 11
 public protocol NavigationBackDelegate: class {
12 12
     func setupNavigationBackItem()
@@ -19,7 +19,7 @@ public extension NavigationBackDelegate where Self: UIViewController {
19 19
         btn.contentHorizontalAlignment = .left
20 20
         btn.frame = CGRect(x: 0, y: 0, width: 40 , height: 40)
21 21
         btn.setImage(UIImage(named: "navigation-back"), for: .normal)
22
-        btn.addTarget(self, action: #selector(navigationController?.popViewController(animated:)), for: .touchUpInside)
22
+        btn.addTarget(self, action: #selector(backToViewController), for: .touchUpInside)
23 23
         
24 24
         let backItem = UIBarButtonItem(customView: btn)
25 25
         let spaceItem = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
@@ -28,3 +28,9 @@ public extension NavigationBackDelegate where Self: UIViewController {
28 28
         navigationItem.leftBarButtonItems = [spaceItem, backItem]
29 29
     }
30 30
 }
31
+
32
+fileprivate extension UIViewController {
33
+    @objc func backToViewController() {
34
+        navigationController?.popViewController(animated: true)
35
+    }
36
+}

+ 2 - 3
PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationBack/UINavigationController+NavigationBack.swift

@@ -11,9 +11,8 @@ import UIKit
11 11
 public extension UINavigationController {
12 12
     func pushViewController<T: UIViewController & NavigationBackViewController>(_ vc: T, animted: Bool = true) {
13 13
         vc.setupNavigationBackItem()
14
+        (vc as? NavigationBarPushAndPopDelegate)?.setupNavigationBarPushAndPopDelegate()
14 15
         pushViewController(vc, animated: animted)
15
-        guard let recognizer = interactivePopGestureRecognizer else { return }
16
-        recognizer.isEnabled = true
17
-        recognizer.setDelegate(vc)
16
+        (vc as? NavigationBarInteractivePopDeletegate)?.setupNavigationBarInteractivePopDelegate()
18 17
     }
19 18
 }

+ 0 - 20
PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationBar/NavigationBarDelegate.swift

@@ -1,20 +0,0 @@
1
-//
2
-//  NavigationBarDelegate.swift
3
-//  PaiaiUIKit
4
-//
5
-//  Created by ffib on 2019/1/16.
6
-//  Copyright © 2019 yb. All rights reserved.
7
-//
8
-
9
-import Foundation
10
-
11
-protocol NavigationBarDelegate {
12
-    func setupNavigationBarDelegate()
13
-}
14
-
15
-extension NavigationBarDelegate where Self: NavigationBarPushAndPopDelegate & NavigationBarInteractivePopDeletegate {
16
-    func setupNavigationBarDelegate() {
17
-        setupNavigationBarPushAndPopDelegate()
18
-        setupNavigationBarInteractivePopDelegate()
19
-    }
20
-}

+ 0 - 34
PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationBar/NavigationBarInOut.swift

@@ -1,34 +0,0 @@
1
-//
2
-//  NavigationBarInOut.swift
3
-//  PaiaiUIKit
4
-//
5
-//  Created by ffib on 2019/1/15.
6
-//  Copyright © 2019 yb. All rights reserved.
7
-//
8
-
9
-import UIKit
10
-
11
-public protocol NavigationBarInOut: class {
12
-    var navigationView: UIView { get }
13
-    func navigationBarFadeIn()
14
-    func navigationBarFadeOut()
15
-    func navigationBarFadeOutWithPercentage(_ percentage: CGFloat)
16
-}
17
-
18
-public extension NavigationBarInOut where Self: UIViewController {
19
-    func navigationBarFadeIn() {
20
-        UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 0, options: [], animations: {
21
-            self.navigationView.alpha = 0
22
-        }, completion: nil)
23
-    }
24
-    
25
-    func navigationBarFadeOut() {
26
-        UIView.animate(withDuration: 0.5, animations: {
27
-            self.navigationView.alpha = 1
28
-        }, completion: nil)
29
-    }
30
-    
31
-    func navigationBarFadeOutWithPercentage(_ percentage: CGFloat) {
32
-        self.navigationView.alpha = 1 * percentage
33
-    }
34
-}

+ 64 - 0
PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationBar/NavigationBarInOutAnimator.swift

@@ -0,0 +1,64 @@
1
+//
2
+//  NavigationBarInOutAnimator.swift
3
+//  PaiaiUIKit
4
+//
5
+//  Created by ffib on 2019/1/15.
6
+//  Copyright © 2019 yb. All rights reserved.
7
+//
8
+
9
+import UIKit
10
+
11
+public protocol NavigationBarInOutAnimator: class {
12
+    var navigationView: UIView { get }
13
+    func navigationBarFadeIn()
14
+    func navigationBarFadeOut()
15
+    func navigationBarFadeAndMoveIn()
16
+    func navigationBarFadeAndMoveOut()
17
+    func navigationBarFadeOutWithPercentage(_ percentage: CGFloat)
18
+    func navigationBarFadeInWithPercentage(_ percentage: CGFloat)
19
+}
20
+
21
+public extension NavigationBarInOutAnimator where Self: UIViewController & NavigationBarPushAndPopDelegate {
22
+    func navigationBarFadeIn() {
23
+        UIView.animate(withDuration: 0.3, animations: {
24
+            self.navigationView.alpha = 1
25
+        }, completion: nil)
26
+    }
27
+    
28
+    func navigationBarFadeOut() {
29
+        UIView.animate(withDuration: 0.3, animations: {
30
+            self.navigationView.alpha = 0
31
+        }, completion: nil)
32
+    }
33
+    
34
+    func navigationBarFadeAndMoveIn() {
35
+        setNavigationBar()
36
+        navigationController?.navigationBar.layoutIfNeeded()
37
+        
38
+        let originX = navigationView.center.x
39
+        navigationView.center.x = UIScreen.main.bounds.width
40
+        
41
+        UIView.animate(withDuration: 0.3, animations: {
42
+            self.navigationView.alpha = 1
43
+            self.navigationView.center.x = originX
44
+        }, completion: nil)
45
+    }
46
+    
47
+    func navigationBarFadeAndMoveOut() {
48
+        UIView.animate(withDuration: 0.3, animations: {
49
+            self.navigationView.alpha = 0
50
+            self.navigationView.center.x = UIScreen.main.bounds.width
51
+        }, completion: { _ in
52
+            self.navigationView.removeFromSuperview()
53
+        })
54
+    }
55
+    
56
+    func navigationBarFadeOutWithPercentage(_ percentage: CGFloat) {
57
+        navigationView.alpha = 1 * (1 - 1.1 * percentage)
58
+        navigationView.center.x = UIScreen.main.bounds.width / 2  * (1 + 1.1 * percentage)
59
+    }
60
+    
61
+    func navigationBarFadeInWithPercentage(_ percentage: CGFloat) {
62
+        navigationView.alpha = 1 * percentage
63
+    }
64
+}

+ 31 - 12
PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationBar/NavigationBarInteractivePopDeletegate.swift

@@ -12,8 +12,7 @@ public protocol NavigationBarInteractivePopDeletegate: class {
12 12
     func setupNavigationBarInteractivePopDelegate()
13 13
 }
14 14
 
15
-public extension NavigationBarInteractivePopDeletegate where Self: UIViewController & NavigationBarInOut {
16
-    
15
+public extension NavigationBarInteractivePopDeletegate where Self: UIViewController & NavigationBarInOutAnimator {
17 16
     func setupNavigationBarInteractivePopDelegate() {
18 17
         guard let nav = navigationController else { return }
19 18
         nav.interactivePopGestureRecognizer?.addTarget(self, action: #selector(interactivePopAnimation(gesture:)))
@@ -22,23 +21,43 @@ public extension NavigationBarInteractivePopDeletegate where Self: UIViewControl
22 21
 
23 22
 extension UIViewController {
24 23
     @objc func interactivePopAnimation(gesture: UIPanGestureRecognizer) {
24
+        guard let `self` =  self as? (NavigationBarInOutAnimator & UIViewController) else { return }
25 25
         let point = gesture.translation(in: view)
26 26
         let percentage = calculatePercentageOfOffsets(point: point)
27
-        (self as? NavigationBarInOut)?.navigationBarFadeOutWithPercentage(percentage)
28 27
         
29
-        switch gesture.state {
30
-        case .ended:
31
-            if percentage > 0.5 {
32
-                (self as? NavigationBarInOut)?.navigationBarFadeOut()
33
-            } else {
34
-                (self as? NavigationBarInOut)?.navigationBarFadeIn()
35
-            }
36
-        default:
28
+        /// naivgationController == nil  popped viewController
29
+        /// navigationController?.visibleViewController == self pop to viewController
30
+        
31
+        let percentageAnimation: ((CGFloat) -> Void)
32
+        let fadeInAnimation: (() -> Void)
33
+        let fadeOutAnimation: (() -> Void)
34
+        if navigationController == nil {
35
+            percentageAnimation = self.navigationBarFadeOutWithPercentage
36
+            fadeInAnimation = self.navigationBarFadeAndMoveIn
37
+            fadeOutAnimation = self.navigationBarFadeAndMoveOut
38
+        } else if navigationController?.visibleViewController == self {
39
+            percentageAnimation = self.navigationBarFadeInWithPercentage
40
+            fadeInAnimation = self.navigationBarFadeIn
41
+            fadeOutAnimation = self.navigationBarFadeOut
42
+        } else {
37 43
             return
38 44
         }
45
+        
46
+        percentageAnimation(percentage)
47
+        
48
+        guard gesture.state == .ended else { return }
49
+
50
+        for vc in navigationController?.viewControllers ?? [] { print(vc) }
51
+        if (percentage > 0.5 && navigationController == nil) ||
52
+            (percentage < 0.5 && navigationController?.visibleViewController == self) {
53
+            fadeOutAnimation()
54
+        } else if (percentage < 0.5 && navigationController == nil) ||
55
+            (percentage > 0.5 && navigationController?.visibleViewController == self) {
56
+            fadeInAnimation()
57
+        }
39 58
     }
40 59
     
41
-    func calculatePercentageOfOffsets(point: CGPoint) -> CGFloat {
60
+    private func calculatePercentageOfOffsets(point: CGPoint) -> CGFloat {
42 61
         return point.x / view.bounds.width
43 62
     }
44 63
 }

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

@@ -8,5 +8,5 @@
8 8
 
9 9
 import Foundation
10 10
 
11
-typealias NavigationBarInteractiveViewController = NavigationBarDelegate & NavigationBarInteractivePopDeletegate & NavigationBarPushAndPopDelegate & NavigationBarInOut & NavigationControllerDelegate
11
+public typealias NavigationBarInteractiveViewController = NavigationBarInteractivePopDeletegate & NavigationBarPushAndPopDelegate & NavigationBarInOutAnimator & NavigationControllerDelegate
12 12
 

+ 24 - 5
PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationBar/NavigationBarPushAndPopDelegate.swift

@@ -10,21 +10,40 @@ import Foundation
10 10
 
11 11
 public protocol NavigationBarPushAndPopDelegate: class {
12 12
     func setupNavigationBarPushAndPopDelegate()
13
+    func setNavigationBar()
13 14
 }
14 15
 
15 16
 public extension NavigationBarPushAndPopDelegate where Self: UIViewController & NavigationControllerDelegate {
16 17
     func setupNavigationBarPushAndPopDelegate() {
17 18
         navigationController?.setDelegate(self)
18 19
     }
20
+    
21
+    func setNavigationBar() {}
19 22
 }
20 23
 
21
-public extension NavigationControllerDelegate where Self: UIViewController & NavigationBarInOut {
24
+public extension NavigationControllerDelegate where Self: UIViewController {
25
+    
22 26
     func navigationController(_ navigationController: UINavigationController,
23
-                              willShow viewController: UIViewController, animated: Bool) {
24
-        if viewController != self {
25
-            navigationBarFadeIn()
27
+                              animationControllerFor operation: UINavigationController.Operation,
28
+                              from fromVC: UIViewController,
29
+                              to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
30
+        
31
+        if operation == .push {
32
+            (toVC as? NavigationBarInOutAnimator)?.navigationBarFadeAndMoveIn()
33
+            (fromVC as? NavigationBarInOutAnimator)?.navigationBarFadeOut()
26 34
         } else {
27
-            navigationBarFadeOut()
35
+            (toVC as? NavigationBarInOutAnimator)?.navigationBarFadeIn()
36
+            (fromVC as? NavigationBarInOutAnimator)?.navigationBarFadeAndMoveOut()
28 37
         }
38
+        
39
+        return nil
40
+    }
41
+    
42
+    func navigationController(_ navigationController: UINavigationController,
43
+                              didShow viewController: UIViewController, animated: Bool) {
44
+        guard let recognizer = navigationController.interactivePopGestureRecognizer else { return }
45
+        recognizer.isEnabled = true
46
+        guard let vc = viewController as? GestureRecognizerDelegate else { return }
47
+        recognizer.setDelegate(vc)
29 48
     }
30 49
 }

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

@@ -72,7 +72,8 @@ open class PageViewController: UIViewController {
72 72
         constructViewHierarchy()
73 73
         activateConstraints()
74 74
         setMenuGestureRecognizer()
75
-        setupNavigationBarDelegate()
75
+        setupNavigationBarPushAndPopDelegate()
76
+        setupNavigationBarInteractivePopDelegate()
76 77
     }
77 78
     
78 79
     open override func viewDidLayoutSubviews() {
@@ -367,7 +368,7 @@ fileprivate extension PageViewController {
367 368
     }
368 369
 }
369 370
 
370
-extension PageViewController: NavigationBarInteractiveViewController {
371
+extension PageViewController: NavigationBarInteractiveViewController {    
371 372
     public var navigationView: UIView {
372 373
         return menuView
373 374
     }

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

@@ -37,7 +37,7 @@ extension UIGestureRecognizer {
37 37
         set { objc_setAssociatedObject(self, &AssociatedKeys.proxyKey, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC) }
38 38
     }
39 39
     
40
-    func setDelegate<T: GestureRecognizerDelegate>(_ target: T) {
40
+    func setDelegate(_ target: GestureRecognizerDelegate) {
41 41
         proxy = GestureRecognizerProxy(target: target)
42 42
         delegate = proxy
43 43
     }

+ 19 - 0
PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/NavigationBarDelegate/NavigationBarDelegate.swift

@@ -0,0 +1,19 @@
1
+//
2
+//  NavigationBarDelegate.swift
3
+//  PaiaiUIKit
4
+//
5
+//  Created by ffib on 2019/1/30.
6
+//  Copyright © 2019 yb. All rights reserved.
7
+//
8
+
9
+import Foundation
10
+
11
+public protocol NavigationBarDelegate: class {
12
+    func navigationBar(_ navigationBar: UINavigationBar, shouldPush item: UINavigationItem) -> Bool
13
+}
14
+
15
+public extension NavigationBarDelegate {
16
+    func navigationBar(_ navigationBar: UINavigationBar, shouldPush item: UINavigationItem) -> Bool {
17
+         return true
18
+    }
19
+}

+ 38 - 0
PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/NavigationBarDelegate/NavigationBarProxy.swift

@@ -0,0 +1,38 @@
1
+//
2
+//  NavigationBarProxy.swift
3
+//  PaiaiUIKit
4
+//
5
+//  Created by ffib on 2019/1/30.
6
+//  Copyright © 2019 yb. All rights reserved.
7
+//
8
+
9
+import UIKit
10
+
11
+class NavigationBarProxy: NSObject, UINavigationBarDelegate {
12
+    weak var delegate: NavigationBarDelegate?
13
+
14
+    init(target: NavigationBarDelegate) {
15
+        delegate = target
16
+    }
17
+    
18
+    func navigationBar(_ navigationBar: UINavigationBar, shouldPush item: UINavigationItem) -> Bool {
19
+        guard let d = delegate else { return true }
20
+        return d.navigationBar(navigationBar, shouldPush: item)
21
+    }
22
+}
23
+
24
+extension UINavigationBar {
25
+    private struct AssociatedKeys {
26
+        static var proxyKey = "NavigationBarProxyKey"
27
+    }
28
+    
29
+    private var proxy: NavigationBarProxy? {
30
+        get { return objc_getAssociatedObject(self, &AssociatedKeys.proxyKey) as? NavigationBarProxy }
31
+        set { objc_setAssociatedObject(self, &AssociatedKeys.proxyKey, newValue, objc_AssociationPolicy.OBJC_ASSOCIATION_RETAIN_NONATOMIC) }
32
+    }
33
+    
34
+    func setDelegate<T: NavigationBarDelegate>(_ target: T) {
35
+        proxy = NavigationBarProxy(target: target)
36
+        delegate = proxy
37
+    }
38
+}

+ 23 - 0
PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/NavigationControllerDelegate/NavigationControllerDelegate.swift

@@ -11,4 +11,27 @@ import Foundation
11 11
 public protocol NavigationControllerDelegate: class {
12 12
     func navigationController(_ navigationController: UINavigationController,
13 13
                               willShow viewController: UIViewController, animated: Bool)
14
+    
15
+    func navigationController(_ navigationController: UINavigationController,
16
+                              didShow viewController: UIViewController, animated: Bool)
17
+    
18
+    func navigationController(_ navigationController: UINavigationController,
19
+                              animationControllerFor operation: UINavigationController.Operation,
20
+                              from fromVC: UIViewController,
21
+                              to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning?
22
+}
23
+
24
+public extension NavigationControllerDelegate {
25
+    
26
+    func navigationController(_ navigationController: UINavigationController,
27
+                              willShow viewController: UIViewController, animated: Bool) {}
28
+    
29
+    func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) {}
30
+    
31
+    func navigationController(_ navigationController: UINavigationController,
32
+                              animationControllerFor operation: UINavigationController.Operation,
33
+                              from fromVC: UIViewController,
34
+                              to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
35
+        return nil
36
+    }
14 37
 }

+ 14 - 2
PaiAi/PaiaiUIKit/Reusable/UIKitDelegate/NavigationControllerDelegate/NavigationControllerProxy.swift

@@ -15,9 +15,21 @@ class NavigationControllerProxy: NSObject, UINavigationControllerDelegate {
15 15
         delegate = target
16 16
     }
17 17
     
18
+    func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
19
+        delegate?.navigationController(navigationController, willShow: viewController, animated: true)
20
+    }
21
+    
22
+    func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) {
23
+        delegate?.navigationController(navigationController, didShow: viewController, animated: true)
24
+    }
25
+    
18 26
     func navigationController(_ navigationController: UINavigationController,
19
-                              willShow viewController: UIViewController, animated: Bool) {
20
-        delegate?.navigationController(navigationController, willShow: viewController, animated: animated)
27
+                              animationControllerFor operation: UINavigationController.Operation,
28
+                              from fromVC: UIViewController,
29
+                              to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
30
+        return delegate?.navigationController(navigationController,
31
+                                              animationControllerFor: operation,
32
+                                              from: fromVC, to: toVC)
21 33
     }
22 34
 }
23 35
 

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

@@ -8,7 +8,7 @@
8 8
 
9 9
 import Foundation
10 10
 
11
-public protocol ViewControllerTransitioningDelegate where Self: UIViewController {
11
+public protocol ViewControllerTransitioningDelegate: class {
12 12
     func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning?
13 13
     
14 14
     func animationController(forPresented presented: UIViewController,

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

@@ -9,7 +9,7 @@
9 9
 import Foundation
10 10
 
11 11
 class ViewControllerTransitioningProxy: NSObject, UIViewControllerTransitioningDelegate {
12
-    var delegate: ViewControllerTransitioningDelegate?
12
+    weak var delegate: ViewControllerTransitioningDelegate?
13 13
     
14 14
     init(target: ViewControllerTransitioningDelegate) {
15 15
         delegate = target

+ 3 - 1
PaiAi/Paiai_iOS/App/AppCoordinator.swift

@@ -46,7 +46,9 @@ public final class AppCoordinator {
46 46
                                                       viewController: messageVC)]
47 47
         
48 48
         let homeCoordinator = HomeCoordinator(homeVC, userInfoViewModel: shareUserInfoViewModel)
49
-        let messageCoordinator = MessageCoordinator(messageVC, userInfoViewModel: shareUserInfoViewModel)
49
+        let messageCoordinator = MessageCoordinator(messageVC,
50
+                                                    navigationController: navigationController,
51
+                                                    userInfoViewModel: shareUserInfoViewModel)
50 52
         
51 53
         coordinators[.home] = homeCoordinator
52 54
         coordinators[.message] = messageCoordinator

+ 24 - 0
PaiAi/Paiai_iOS/App/Group/GroupCoordinator.swift

@@ -0,0 +1,24 @@
1
+//
2
+//  GroupCoordinator.swift
3
+//  Paiai_iOS
4
+//
5
+//  Created by ffib on 2019/1/29.
6
+//  Copyright © 2019 yb. All rights reserved.
7
+//
8
+
9
+import Foundation
10
+
11
+class GroupCoordinator: Coordinator {
12
+    
13
+    var navigationController: UINavigationController
14
+    
15
+    init(navigationController: UINavigationController) {
16
+        self.navigationController = navigationController
17
+    }
18
+}
19
+
20
+extension UIStoryboard {
21
+    static var group: UIStoryboard {
22
+        return UIStoryboard(name: "Group", bundle: Bundle(identifier: "com.Paiai-iOS"))
23
+    }
24
+}

PaiAi/Paiai_iOS/App/GroupDetail/ChangeGroupNameController.swift → PaiAi/Paiai_iOS/App/Group/GroupDetail/ChangeGroupNameController.swift


PaiAi/Paiai_iOS/App/GroupDetail/GroupDetail.storyboard → PaiAi/Paiai_iOS/App/Group/GroupDetail/GroupDetail.storyboard


PaiAi/Paiai_iOS/App/GroupDetail/GroupDetailController.swift → PaiAi/Paiai_iOS/App/Group/GroupDetail/GroupDetailController.swift


PaiAi/Paiai_iOS/App/GroupDetail/GroupDetailCoordinator.swift → PaiAi/Paiai_iOS/App/Group/GroupDetail/GroupDetailCoordinator.swift


PaiAi/Paiai_iOS/App/GroupDetail/GroupMebersController.swift → PaiAi/Paiai_iOS/App/Group/GroupDetail/GroupMebersController.swift


PaiAi/Paiai_iOS/App/GroupDetail/GroupMemberController.swift → PaiAi/Paiai_iOS/App/Group/GroupDetail/GroupMemberController.swift


PaiAi/Paiai_iOS/App/GroupDetail/MemberCell.swift → PaiAi/Paiai_iOS/App/Group/GroupDetail/MemberCell.swift


PaiAi/Paiai_iOS/App/GroupDetail/ShowGroupQRController.swift → PaiAi/Paiai_iOS/App/Group/GroupDetail/ShowGroupQRController.swift


+ 252 - 0
PaiAi/Paiai_iOS/App/Group/GroupViewController.swift

@@ -0,0 +1,252 @@
1
+//
2
+//  GroupViewController.swift
3
+//  PaiAi
4
+//
5
+//  Created by zhengjianfei on 16/3/28.
6
+//  Copyright © 2016年 FFIB. All rights reserved.
7
+//
8
+
9
+import UIKit
10
+import RxSwift
11
+import RxCocoa
12
+import RxDataSources
13
+import PaiaiUIKit
14
+import PaiaiDataKit
15
+import PullToRefresh
16
+
17
+final class GroupViewController: UIViewController {
18
+
19
+    // MARK: Storyboard property
20
+    @IBOutlet var collectionView: UICollectionView!
21
+    @IBOutlet weak var photographBtn: UIButton!
22
+
23
+    // MARK: custom UI property
24
+    var navigationBarView: UIView = {
25
+        let view = UIView()
26
+        view.alpha = 0
27
+        
28
+        return view
29
+    }()
30
+    
31
+    var navigationBarViewTitle: UILabel = {
32
+        let label = UILabel()
33
+        label.textColor = UIColor.white
34
+        
35
+        return label
36
+    }()
37
+    
38
+    var navigationBarViewImage: UIImageView = {
39
+        let image = UIImageView()
40
+        image.cornerRadius = 20
41
+        return image
42
+    }()
43
+    
44
+    // MARK: data property
45
+    var viewModel: GroupViewModel!
46
+    var groupItem: GroupItem!
47
+    
48
+    fileprivate var navigationViewNotReady = true
49
+    fileprivate let disposeBag = DisposeBag()
50
+    
51
+    override func viewDidLoad() {
52
+        super.viewDidLoad()
53
+        initalize()
54
+    }
55
+    
56
+    func initalize() {
57
+        collectionView.register(UINib(nibName: "PhotoCell",
58
+                                      bundle: Bundle(identifier: "com.Paiai-iOS")),
59
+                                forCellWithReuseIdentifier: "photoCell")
60
+        setup()
61
+        binding()
62
+    }
63
+    
64
+    private func setup() {
65
+        setupReloadControl()
66
+    }
67
+    
68
+    private func setupReloadControl() {
69
+        collectionView.addPullToRefresh(PullToRefresh()) {
70
+            [unowned self] in
71
+            self.viewModel.reload()
72
+        }
73
+    }
74
+}
75
+
76
+/// UI bindings
77
+fileprivate extension GroupViewController {
78
+    
79
+    var dataSource: RxCollectionViewSectionedAnimatedDataSource<AnimatableSectionModel<Int, PhotoItem>> {
80
+        return RxCollectionViewSectionedAnimatedDataSource<AnimatableSectionModel<Int, PhotoItem>>(configureCell:
81
+            { (dataSource, collectionView, indexPath, item) -> UICollectionViewCell in
82
+                let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "photoCell", for: indexPath) as! PhotoCell
83
+                cell.setInfo(item, source: .group)
84
+                return cell
85
+        })
86
+    }
87
+    
88
+    func binding() {
89
+        bindInteraction()
90
+        bindViewModelToRefreshing()
91
+        bindCollectionViewDelegate()
92
+        bindViewModelToCollectionView()
93
+        bindCollectionViewToViewModel()
94
+        bindViewModelToNavigationBarImage()
95
+        bindViewModelToNavigationBarTitle()
96
+    }
97
+    
98
+    func bindInteraction() {
99
+        photographBtn.rx.tap.bind(to: viewModel.photographBtnTapped).disposed(by: disposeBag)
100
+    }
101
+    
102
+    func bindViewModelToRefreshing() {
103
+        viewModel.isLoading
104
+            .subscribe(onNext: {[unowned self] flag in
105
+                self.collectionView.endRefreshing(at: .top)
106
+            }).disposed(by: disposeBag)
107
+    }
108
+    
109
+    func bindCollectionViewDelegate() {
110
+        collectionView.rx.setDelegate(self).disposed(by: disposeBag)
111
+    }
112
+    
113
+    func bindViewModelToCollectionView() {
114
+        viewModel.contents
115
+            .bind(to: collectionView.rx.items(dataSource: dataSource))
116
+            .disposed(by: disposeBag)
117
+    }
118
+    
119
+    func bindCollectionViewToViewModel() {
120
+        collectionView.rx.modelSelected(PhotoItem.self)
121
+            .asDriver()
122
+            .drive(onNext: { [unowned self] in self.viewModel.didSelect($0) })
123
+            .disposed(by: disposeBag)
124
+    }
125
+    
126
+    func bindViewModelToNavigationBarTitle() {
127
+        navigationBarViewTitle.text = groupItem.group_name
128
+    }
129
+    
130
+    func bindViewModelToNavigationBarImage() {
131
+        navigationBarViewImage.setImage(groupItem.group_avatar,
132
+                                        placeholder: UIImage(named: "Group\(groupItem.group_default_avatar)"))
133
+    }
134
+}
135
+
136
+extension GroupViewController: NavigationBarInteractiveViewController {
137
+    var navigationView: UIView {
138
+        return navigationBarView
139
+    }
140
+    
141
+    func setNavigationBar() {
142
+        guard navigationViewNotReady else { return }
143
+        setRightBarButtonItems()
144
+        construvtNaivgationViewHierarchy()
145
+        activateConstraintsNavigation()
146
+        
147
+        navigationViewNotReady = false
148
+    }
149
+    
150
+    private func construvtNaivgationViewHierarchy() {
151
+        navigationController?.navigationBar.addSubview(navigationBarView)
152
+        navigationBarView.addSubview(navigationBarViewImage)
153
+        navigationBarView.addSubview(navigationBarViewTitle)
154
+    }
155
+    
156
+    private func setRightBarButtonItems() {
157
+        let item = UIBarButtonItem(images: [UIImage(named: "navigation-QR"),
158
+                                            UIImage(named: "navigation-right")],
159
+                                   btnSpace: 6,
160
+                                   target: self,
161
+                                   actions: [#selector(viewModel!.presentGroupQR),
162
+                                             #selector(viewModel!.navigateToGroupDetail)])
163
+        navigationItem.rightBarButtonItem = item
164
+    }
165
+}
166
+
167
+/// layout
168
+fileprivate extension GroupViewController {
169
+    
170
+    func activateConstraintsNavigation() {
171
+        activateConstraintsNavigationBarView()
172
+        activateConstraintsNavigationBarViewImage()
173
+        activateConstraintsNavigationBarViewTitle()
174
+    }
175
+    
176
+    func activateConstraintsNavigationBarView() {
177
+        guard let barContentView = navigationController?.navigationBar else {  return }
178
+        
179
+        navigationBarView.translatesAutoresizingMaskIntoConstraints = false
180
+        
181
+        NSLayoutConstraint.activate([
182
+            navigationBarView.topAnchor.constraint(equalTo: barContentView.topAnchor),
183
+            navigationBarView.bottomAnchor.constraint(equalTo: barContentView.bottomAnchor),
184
+            navigationBarView.centerXAnchor.constraint(equalTo: barContentView.centerXAnchor)
185
+            ])
186
+    }
187
+    
188
+    func activateConstraintsNavigationBarViewTitle() {
189
+        navigationBarViewTitle.translatesAutoresizingMaskIntoConstraints = false
190
+        NSLayoutConstraint.activate([
191
+            navigationBarViewTitle.centerYAnchor.constraint(equalTo: navigationBarView.centerYAnchor),
192
+            navigationBarViewTitle.leadingAnchor.constraint(equalTo: navigationBarViewImage.trailingAnchor, constant: 6),
193
+            navigationBarViewTitle.trailingAnchor.constraint(equalTo: navigationBarView.trailingAnchor),
194
+            navigationBarViewTitle.widthAnchor.constraint(lessThanOrEqualToConstant: view.width - 200)
195
+            ])
196
+    }
197
+    
198
+    func activateConstraintsNavigationBarViewImage() {
199
+        navigationBarViewImage.translatesAutoresizingMaskIntoConstraints = false
200
+        
201
+        NSLayoutConstraint.activate([
202
+            navigationBarViewImage.widthAnchor.constraint(equalToConstant: 40),
203
+            navigationBarViewImage.heightAnchor.constraint(equalToConstant: 40),
204
+            navigationBarViewImage.centerYAnchor.constraint(equalTo: navigationBarView.centerYAnchor),
205
+            navigationBarViewImage.leadingAnchor.constraint(equalTo: navigationBarView.leadingAnchor),
206
+            ])
207
+    }
208
+}
209
+
210
+extension GroupViewController: UICollectionViewDelegateFlowLayout {
211
+    func collectionView(_ collectionView: UICollectionView,
212
+                        layout collectionViewLayout: UICollectionViewLayout,
213
+                        sizeForItemAt indexPath: IndexPath) -> CGSize {
214
+        return viewModel.layoutSizeForIndexPath(indexPath)
215
+    }
216
+}
217
+
218
+/// MARK: imagepicker delegate
219
+extension GroupViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
220
+
221
+    @IBAction func takePhotoAction() {
222
+        let vc = UIImagePickerController()
223
+        #if (arch(i386) || arch(x86_64))
224
+            vc.sourceType = .photoLibrary
225
+        #else
226
+            vc.sourceType = .camera
227
+        #endif
228
+        vc.delegate = self
229
+        present(vc, animated: true, completion: nil)
230
+    }
231
+
232
+    func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
233
+        dismiss(animated: true, completion: nil)
234
+        
235
+        guard let image = info[.originalImage] as? UIImage else { return }
236
+        
237
+        viewModel.submit(image: image)
238
+    }
239
+    
240
+    func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
241
+        dismiss(animated: true, completion: nil)
242
+    }
243
+}
244
+
245
+extension GroupViewController: NavigationBackViewController {}
246
+
247
+extension GroupViewController: Storyboarded {
248
+    static func instantiate() -> GroupViewController {
249
+        let vc = UIStoryboard.group.instantiateController(GroupViewController.self)
250
+        return vc
251
+    }
252
+}

+ 1 - 1
PaiAi/Paiai_iOS/App/Home/CreateGroupConfirmViewController.swift

@@ -54,7 +54,7 @@ final class CreateGroupConfirmViewController: AlertViewController {
54 54
 //    }
55 55
 
56 56
 //    func confirmAndJump() {
57
-//        let ctl = UIStoryboard.main.instantiateController(GroupPageController.self)
57
+//        let ctl = UIStoryboard.main.instantiateController(GroupViewController.self)
58 58
 //        ctl.groupModel = group
59 59
 //        ctl.isCreate = true
60 60
 //        guard let parentController = presentingViewController as? UINavigationController else {

+ 0 - 140
PaiAi/Paiai_iOS/App/Home/Group/GroupPageController.swift

@@ -1,140 +0,0 @@
1
-//
2
-//  GroupPageController.swift
3
-//  PaiAi
4
-//
5
-//  Created by zhengjianfei on 16/3/28.
6
-//  Copyright © 2016年 FFIB. All rights reserved.
7
-//
8
-
9
-import UIKit
10
-import RxSwift
11
-import RxCocoa
12
-import RxDataSources
13
-import PaiaiUIKit
14
-import PaiaiDataKit
15
-
16
-final class GroupPageController: UIViewController {
17
-
18
-    // MARK: Storyboard property
19
-    @IBOutlet var collectionView: UICollectionView!
20
-    @IBOutlet weak var photographLabel: UILabel!
21
-    @IBOutlet weak var photographBtn: UIButton!
22
-
23
-    // MARK: custom UI property
24
-    var maskImageView = UIImageView()
25
-    var maskLabel = UILabel()
26
-
27
-    // MARK: data property
28
-    var viewModel: GroupPageViewModel!
29
-    fileprivate let disposeBag = DisposeBag()
30
-    
31
-    // MARK: view function
32
-    override func viewDidLoad() {
33
-        super.viewDidLoad()
34
-        
35
-        collectionView.register(UINib(nibName: "PhotoCell", bundle: nil),
36
-                                forCellWithReuseIdentifier: "photoCell")
37
-        
38
-        configurationRx()
39
-        
40
-        addReloadControl()
41
-    }
42
-
43
-    override func viewWillAppear(_ animated: Bool) {
44
-        super.viewWillAppear(true)
45
-        makeNavigationBar()
46
-    }
47
-
48
-    // MARK: init interface
49
-    func makeNavigationBar() {
50
-//        navigationItem.setRightBars(buttonSpace: 0,
51
-//                                    images: [UIImage(named: "二维码"), UIImage(named: "更多-右上角-1")],
52
-//                                    actions: [#selector(showEWM), #selector(pushToGroupDetailController)],
53
-//                                    target: self)
54
-//        titleWithbackBar = ""
55
-//        let barView = UIView(frame: CGRect(x: 0, y: 0, width: kScreenWidth - 150, height: 40))
56
-//        let label = UILabel()
57
-////        label.text = groupModel.group_name
58
-//        label.textColor = UIColor.white
59
-//        let labelWidth = min(label.sizeThatFits(CGSize(width: kScreenWidth - 200, height: 40)).width, kScreenWidth - 200)
60
-//        let imageView = UIImageView(frame: CGRect(x: 0, y: 2, width: 40, height: 40))
61
-//        imageView.center = CGPoint(x: barView.center.x - labelWidth / 2, y: barView.center.y)
62
-////        imageView.setImageWithNullableURL(groupModel.group_avatar, placeholderImage: UIImage(named: "Group\(groupModel.group_default_avatar)"))
63
-//        imageView.cornerRadius = 20
64
-//        label.frame = CGRect(x: 40 + imageView.x + 5, y: 2, width: kScreenWidth - 200, height: 40)
65
-//        barView.addSubViews([imageView, label])
66
-//        navigationItem.titleView = barView
67
-    }
68
-    
69
-    var dataSource: RxCollectionViewSectionedAnimatedDataSource<AnimatableSectionModel<Int, PhotoItem>> {
70
-        return RxCollectionViewSectionedAnimatedDataSource<AnimatableSectionModel<Int, PhotoItem>>(configureCell: { (dataSource, collectionView, indexPath, item) -> UICollectionViewCell in
71
-            let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "photoCell", for: indexPath) as! PhotoCell
72
-            cell.setInfo(item, source: .group)
73
-            return cell
74
-        })
75
-    }
76
-
77
-    func configurationRx() {
78
-        
79
-        collectionView.rx.setDelegate(self).disposed(by: disposeBag)
80
-        
81
-//        viewModel.isReload.subscribe(onNext: {
82
-//            [weak self] _ in
83
-//            guard let `self` = self else { return }
84
-//            self.collectionView.es.stopPullToRefresh()
85
-//        }).disposed(by: disposeBag)
86
-        
87
-        viewModel.groupPhotoContents
88
-            .bind(to: collectionView.rx.items(dataSource: dataSource))
89
-            .disposed(by: disposeBag)
90
-        
91
-        collectionView.rx.modelSelected(PhotoItem.self)
92
-            .subscribe(onNext: { [unowned self] in self.viewModel.didSelect($0) })
93
-            .disposed(by: disposeBag)
94
-        
95
-        collectionView.collectionViewLayout = WaterfallFlowLayout()
96
-    }
97
-    
98
-    func addReloadControl() {
99
-//        collectionView.es.addPullToRefresh {
100
-//            [unowned self] in
101
-//            self.viewModel.reload()
102
-//        }
103
-//        collectionView.es.startPullToRefresh()
104
-    }
105
-}
106
-
107
-extension GroupPageController: UICollectionViewDelegateFlowLayout {
108
-
109
-    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
110
-        return viewModel.layoutSizeForIndexPath(indexPath)
111
-    }
112
-}
113
-
114
-// MARK: imagepicker delegate
115
-extension GroupPageController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
116
-
117
-    @IBAction func takePhotoAction() {
118
-        let vc = UIImagePickerController()
119
-        #if (arch(i386) || arch(x86_64))
120
-            vc.sourceType = .photoLibrary
121
-        #else
122
-            vc.sourceType = .camera
123
-        #endif
124
-        vc.delegate = self
125
-        present(vc, animated: true, completion: nil)
126
-    }
127
-
128
-    func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
129
-        dismiss(animated: true, completion: nil)
130
-        
131
-        guard let image = info[.originalImage] as? UIImage else { return }
132
-        
133
-        viewModel.submit(image: image)
134
-    }
135
-    
136
-    func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
137
-        dismiss(animated: true, completion: nil)
138
-    }
139
-
140
-}

+ 0 - 1
PaiAi/Paiai_iOS/App/Home/HomeViewController.swift

@@ -21,7 +21,6 @@ final class HomeViewController: UIViewController {
21 21
     @IBOutlet weak var collectionView: UICollectionView!
22 22
     // MARK: data property
23 23
     fileprivate let disposeBag = DisposeBag()
24
-    fileprivate let refresher = PullToRefresh()
25 24
     
26 25
     internal var viewModel: HomeViewModel!
27 26
     internal var userInfoViewModel: UserInfoViewModel!

+ 0 - 76
PaiAi/Paiai_iOS/App/Home/Main.storyboard

@@ -158,80 +158,6 @@
158 158
             </objects>
159 159
             <point key="canvasLocation" x="1705" y="-152"/>
160 160
         </scene>
161
-        <!--GroupPageController-->
162
-        <scene sceneID="ntn-JA-tbk">
163
-            <objects>
164
-                <viewController storyboardIdentifier="GroupPageController" automaticallyAdjustsScrollViewInsets="NO" id="R29-hC-gNv" userLabel="GroupPageController" customClass="GroupPageController" customModule="PaiAi" sceneMemberID="viewController">
165
-                    <view key="view" contentMode="scaleToFill" id="ljL-8h-aZ0">
166
-                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
167
-                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
168
-                        <subviews>
169
-                            <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="lAJ-ZU-GPi">
170
-                                <rect key="frame" x="6" y="25" width="363" height="642"/>
171
-                                <color key="backgroundColor" red="0.8784313725490196" green="0.8784313725490196" blue="0.8784313725490196" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
172
-                                <collectionViewLayout key="collectionViewLayout" id="D17-J3-rSa" customClass="WaterfallFlowLayout" customModule="Paiai_iOS" customModuleProvider="target"/>
173
-                                <cells/>
174
-                                <connections>
175
-                                    <outlet property="delegate" destination="R29-hC-gNv" id="XgJ-WA-ub2"/>
176
-                                </connections>
177
-                            </collectionView>
178
-                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="lOt-ls-oe7">
179
-                                <rect key="frame" x="199" y="493" width="168" height="168"/>
180
-                                <state key="normal" image="BTN-拍照"/>
181
-                                <state key="selected" image="BTN-拍照-press"/>
182
-                                <connections>
183
-                                    <action selector="takePhotoAction" destination="R29-hC-gNv" eventType="touchUpInside" id="YIr-6E-LS2"/>
184
-                                </connections>
185
-                            </button>
186
-                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6Ai-Cd-a0J">
187
-                                <rect key="frame" x="199" y="525" width="168" height="168"/>
188
-                                <state key="normal" image="BTN-扫码"/>
189
-                                <state key="selected" image="BTN-扫码-press"/>
190
-                            </button>
191
-                            <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="点我,拍摄照片" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zdv-Nb-P68">
192
-                                <rect key="frame" x="72.5" y="567" width="121.5" height="20.5"/>
193
-                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
194
-                                <color key="textColor" red="0.1960784314" green="0.1960784314" blue="0.1960784314" alpha="1" colorSpace="calibratedRGB"/>
195
-                                <nil key="highlightedColor"/>
196
-                            </label>
197
-                            <view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="88M-NH-Qgh" customClass="FFProgress" customModule="Paiai_iOS" customModuleProvider="target">
198
-                                <rect key="frame" x="162.5" y="308.5" width="50" height="50"/>
199
-                                <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
200
-                                <constraints>
201
-                                    <constraint firstAttribute="height" constant="50" id="6A3-02-EsP"/>
202
-                                    <constraint firstAttribute="width" constant="50" id="g6l-6C-4jG"/>
203
-                                </constraints>
204
-                            </view>
205
-                        </subviews>
206
-                        <color key="backgroundColor" red="0.8784313725490196" green="0.8784313725490196" blue="0.8784313725490196" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
207
-                        <constraints>
208
-                            <constraint firstItem="efW-A4-fyT" firstAttribute="bottom" secondItem="lAJ-ZU-GPi" secondAttribute="bottom" id="23G-aq-F9a"/>
209
-                            <constraint firstItem="efW-A4-fyT" firstAttribute="bottom" secondItem="lOt-ls-oe7" secondAttribute="bottom" constant="6" id="2ff-CO-xJk"/>
210
-                            <constraint firstItem="lOt-ls-oe7" firstAttribute="leading" secondItem="zdv-Nb-P68" secondAttribute="trailing" constant="5" id="3cy-f1-xck"/>
211
-                            <constraint firstItem="6Ai-Cd-a0J" firstAttribute="centerX" secondItem="lOt-ls-oe7" secondAttribute="centerX" id="9rZ-z1-OKI"/>
212
-                            <constraint firstItem="lOt-ls-oe7" firstAttribute="top" secondItem="6Ai-Cd-a0J" secondAttribute="bottom" constant="-200" id="Chs-ne-dS2"/>
213
-                            <constraint firstItem="88M-NH-Qgh" firstAttribute="centerX" secondItem="efW-A4-fyT" secondAttribute="centerX" id="IRY-CY-KnW"/>
214
-                            <constraint firstItem="efW-A4-fyT" firstAttribute="trailing" secondItem="lOt-ls-oe7" secondAttribute="trailing" constant="8" id="IUI-dd-MNf"/>
215
-                            <constraint firstItem="lAJ-ZU-GPi" firstAttribute="leading" secondItem="efW-A4-fyT" secondAttribute="leading" constant="6" id="TN2-dq-Bfm"/>
216
-                            <constraint firstItem="zdv-Nb-P68" firstAttribute="centerY" secondItem="lOt-ls-oe7" secondAttribute="centerY" id="Tkh-kV-puR"/>
217
-                            <constraint firstItem="efW-A4-fyT" firstAttribute="trailing" secondItem="lAJ-ZU-GPi" secondAttribute="trailing" constant="6" id="j5S-4o-gNP"/>
218
-                            <constraint firstItem="88M-NH-Qgh" firstAttribute="centerY" secondItem="ljL-8h-aZ0" secondAttribute="centerY" id="qMc-hm-LSD"/>
219
-                            <constraint firstItem="lAJ-ZU-GPi" firstAttribute="top" secondItem="efW-A4-fyT" secondAttribute="top" constant="5" id="tdF-Kt-yAO"/>
220
-                        </constraints>
221
-                        <viewLayoutGuide key="safeArea" id="efW-A4-fyT"/>
222
-                    </view>
223
-                    <navigationItem key="navigationItem" id="aeg-ac-MGk"/>
224
-                    <connections>
225
-                        <outlet property="collectionView" destination="lAJ-ZU-GPi" id="MGB-rX-4dB"/>
226
-                        <outlet property="photographBtn" destination="lOt-ls-oe7" id="ynl-na-505"/>
227
-                        <outlet property="photographLabel" destination="zdv-Nb-P68" id="NJO-Ae-y4X"/>
228
-                        <outlet property="progressView" destination="88M-NH-Qgh" id="2bw-7m-FfB"/>
229
-                    </connections>
230
-                </viewController>
231
-                <placeholder placeholderIdentifier="IBFirstResponder" id="Wws-ea-mVh" sceneMemberID="firstResponder"/>
232
-            </objects>
233
-            <point key="canvasLocation" x="700" y="57.121439280359823"/>
234
-        </scene>
235 161
         <!--CreateGroupViewController-->
236 162
         <scene sceneID="AAe-LB-J2k">
237 163
             <objects>
@@ -556,8 +482,6 @@
556 482
     <resources>
557 483
         <image name="BTN-扫码" width="168" height="168"/>
558 484
         <image name="BTN-扫码-press" width="168" height="168"/>
559
-        <image name="BTN-拍照" width="168" height="168"/>
560
-        <image name="BTN-拍照-press" width="168" height="168"/>
561 485
         <image name="BTN-新增" width="168" height="168"/>
562 486
         <image name="BTN-新增-press" width="168" height="168"/>
563 487
         <image name="guide1" width="1462" height="2600"/>

+ 2 - 2
PaiAi/Paiai_iOS/App/Home/ScanQRViewController.swift

@@ -63,7 +63,7 @@ extension ScanQRViewController: QRCodeScanViewDelegate {
63 63
 
64 64
 //            let request = GroupNetworkRequest(path: .joinTourGroup, parameter: params)
65 65
 //            NetworkApi.share.post(request: request, handler: { (res) in
66
-//                let ctl = UIStoryboard.main.instantiateController(GroupPageController.self)
66
+//                let ctl = UIStoryboard.main.instantiateController(GroupViewController.self)
67 67
 //                ctl.isCreate = true
68 68
 //                ctl.isScan = true
69 69
 //                ctl.groupModel = res[0]
@@ -101,7 +101,7 @@ extension ScanQRViewController: QRCodeScanViewDelegate {
101 101
 
102 102
 //        let request = GroupNetworkRequest(path: path, parameter: params)
103 103
 //        NetworkApi.share.post(request: request, handler: { (res) in
104
-//            let ctl = UIStoryboard.main.instantiateController(GroupPageController.self)
104
+//            let ctl = UIStoryboard.main.instantiateController(GroupViewController.self)
105 105
 //            ctl.isCreate = true
106 106
 //            ctl.isScan = true
107 107
 //            ctl.groupModel = res[0]

+ 6 - 2
PaiAi/Paiai_iOS/App/Message/MessageCoordinator.swift

@@ -11,10 +11,14 @@ import PaiaiDataKit
11 11
 
12 12
 class MessageCoordinator: Coordinator {
13 13
     let messageViewController: MessageViewController
14
+    let navigationController: UINavigationController
14 15
     var shareUserInfoViewModel: UserInfoViewModel
15 16
     
16
-    init(_ messageVC: MessageViewController, userInfoViewModel: UserInfoViewModel) {
17
+    init(_ messageVC: MessageViewController,
18
+         navigationController: UINavigationController,
19
+         userInfoViewModel: UserInfoViewModel) {
17 20
         messageViewController = messageVC
21
+        self.navigationController = navigationController
18 22
         shareUserInfoViewModel = userInfoViewModel
19 23
         messageViewController.viewModel.delegate = self
20 24
     }
@@ -33,7 +37,7 @@ extension MessageCoordinator {
33 37
 extension MessageCoordinator: MessageViewModelDelegate {
34 38
     func didSelect(type: MessageType) {
35 39
         let messageListVC = makeMessageListViewContorller(type: type)
36
-        messageViewController.pushViewController(messageListVC)
40
+        navigationController.pushViewController(messageListVC)
37 41
     }
38 42
 }
39 43
 

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

@@ -46,7 +46,7 @@ fileprivate extension MineAboutViewController {
46 46
             .subscribe { (_) in
47 47
                 let webVC = WebViewController(title: "联系我们",
48 48
                                               path: "https://pai.ai/page/contact_us")
49
-                self.pushViewController(webVC)
49
+                self.navigationController?.pushViewController(webVC)
50 50
             }.disposed(by: disposeBag)
51 51
     }
52 52
     
@@ -67,7 +67,7 @@ fileprivate extension MineAboutViewController {
67 67
             .subscribe { (_) in
68 68
                 let webVC = WebViewController(title: "用户协议",
69 69
                                               path: "https://pai.ai/page/user_agreement")
70
-                self.pushViewController(webVC)
70
+                self.navigationController?.pushViewController(webVC)
71 71
             }.disposed(by: disposeBag)
72 72
     }
73 73
 }

+ 25 - 7
PaiAi/Paiai_iOS/App/Mine/MineCoordinator.swift

@@ -14,9 +14,10 @@ class MineCoordinator: Coordinator {
14 14
     
15 15
     let mineViewController: MineViewController
16 16
     let navigationController: UINavigationController
17
+    var childCoordinator = [String: Coordinator]()
17 18
 //    let shareUserInfoViewModel
18 19
     
19
-    init(_ mineViewController: MineViewController, containerViewController: UINavigationController) {
20
+    init(_ mineViewController: MineViewController, navigationController: UINavigationController) {
20 21
         self.mineViewController = mineViewController
21 22
         self.navigationController = navigationController
22 23
         self.mineViewController.delegate = self
@@ -30,7 +31,7 @@ class MineCoordinator: Coordinator {
30 31
 extension MineCoordinator: MineViewControllerDelegate {
31 32
     func logout() {
32 33
         let vc = makeLoginViewController()
33
-        containerViewController.presentController(vc)
34
+        navigationController.presentController(vc)
34 35
     }
35 36
     
36 37
     func didSelect(_ item: MineItem) {
@@ -39,17 +40,17 @@ extension MineCoordinator: MineViewControllerDelegate {
39 40
         switch item {
40 41
         case .group:
41 42
             let vc = makeMineGroupViewController()
42
-            navigationController
43
-            containerViewController.pushViewController(vc)
43
+            vc.viewModel.delegate = self
44
+            navigationController.pushViewController(vc)
44 45
         case .order:
45 46
             let vc = makeMineOrderViewController()
46
-            containerViewController.pushViewController(vc)
47
+            navigationController.pushViewController(vc)
47 48
         case .feedback:
48 49
             let vc = makeMineFeedbackViewController()
49
-            containerViewController.pushViewController(vc)
50
+            navigationController.pushViewController(vc)
50 51
         case .about:
51 52
             let vc = makeMineAboutViewController()
52
-            containerViewController.pushViewController(vc)
53
+            navigationController.pushViewController(vc)
53 54
         }
54 55
     }
55 56
     
@@ -57,6 +58,16 @@ extension MineCoordinator: MineViewControllerDelegate {
57 58
     }
58 59
 }
59 60
 
61
+extension MineCoordinator: MineGroupViewModelDelegate {
62
+    func didSelect(_ item: GroupItem) {
63
+        let vc = makeGroupViewController(item: item)
64
+        let coordinator = GroupCoordinator(navigationController: navigationController)
65
+        childCoordinator["group"] = coordinator
66
+        
67
+        navigationController.pushViewController(vc)
68
+    }
69
+}
70
+
60 71
 fileprivate extension MineCoordinator {
61 72
     func makeLoginViewController() -> LoginViewController {
62 73
         let vc = UIStoryboard.main.instantiateController(LoginViewController.self)
@@ -86,6 +97,13 @@ fileprivate extension MineCoordinator {
86 97
         let vc = UIStoryboard.mine.instantiateController(MineAboutViewController.self)
87 98
         return vc
88 99
     }
100
+    
101
+    func makeGroupViewController(item: GroupItem) -> GroupViewController {
102
+        let vc = GroupViewController.instantiate()
103
+        vc.viewModel = GroupViewModel(groupItem: item)
104
+        vc.groupItem = item
105
+        return vc
106
+    }
89 107
 }
90 108
 
91 109
 extension UIStoryboard {

+ 1 - 1
PaiAi/Paiai_iOS/App/Mine/MineFeedbackViewController.swift

@@ -32,7 +32,7 @@ final class MineFeedbackViewController: UIViewController {
32 32
     @IBAction func sendFeedBack() {
33 33
         feedbackAPI.submit(text: textView.text).subscribe(onCompleted: {[weak self] in
34 34
             guard let `self` = self else { return }
35
-            self.popController()
35
+            self.navigationController?.popViewController(animated: true)
36 36
             Toast.show(message: "感谢您的建议")
37 37
         }) { (error) in
38 38
             

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

@@ -65,7 +65,7 @@ final class DetailPageController: UIViewController {
65 65
 ////            last.mainViewModel.models.value = datas
66 66
 //        }
67 67
 //
68
-//        if let last = navigationController?.viewControllers[(navigationController?.viewControllers.count)! - 1] as? GroupPageController {
68
+//        if let last = navigationController?.viewControllers[(navigationController?.viewControllers.count)! - 1] as? GroupViewController {
69 69
 ////            last.MineGroupViewModel.models.value = datas
70 70
 //        }
71 71
 //    }
@@ -287,7 +287,7 @@ extension DetailPageController: CellDelegate {
287 287
     }
288 288
 
289 289
     func pushNext() {
290
-        let ctl = UIStoryboard.main.instantiateController(GroupPageController.self)
290
+        let ctl = UIStoryboard.main.instantiateController(GroupViewController.self)
291 291
 
292 292
 //        ctl.groupModel = GroupModel(map: Map(mappingType: .fromJSON, JSON: datas[currentPhotoIndex].toJSON()))
293 293
         show(ctl, sender: nil)