nes-num-new">
-
- func configurationRx() {
-
- collectionView.rx.setDelegate(self).disposed(by: disposeBag)
-
-// viewModel.isReload.subscribe(onNext: {
-// [weak self] _ in
-// guard let `self` = self else { return }
-// self.collectionView.es.stopPullToRefresh()
-// }).disposed(by: disposeBag)
-
- viewModel.groupPhotoContents
- .bind(to: collectionView.rx.items(dataSource: dataSource))
- .disposed(by: disposeBag)
-
- collectionView.rx.modelSelected(PhotoItem.self)
- .subscribe(onNext: { [unowned self] in self.viewModel.didSelect($0) })
- .disposed(by: disposeBag)
-
- collectionView.collectionViewLayout = WaterfallFlowLayout()
- }
-
- func addReloadControl() {
-// collectionView.es.addPullToRefresh {
-// [unowned self] in
-// self.viewModel.reload()
-// }
-// collectionView.es.startPullToRefresh()
- }
-}
-
-extension GroupPageController: UICollectionViewDelegateFlowLayout {
-
- func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
- return viewModel.layoutSizeForIndexPath(indexPath)
- }
-}
-
-// MARK: imagepicker delegate
-extension GroupPageController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
-
- @IBAction func takePhotoAction() {
- let vc = UIImagePickerController()
- #if (arch(i386) || arch(x86_64))
- vc.sourceType = .photoLibrary
- #else
- vc.sourceType = .camera
- #endif
- vc.delegate = self
- present(vc, animated: true, completion: nil)
- }
-
- func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
- dismiss(animated: true, completion: nil)
-
- guard let image = info[.originalImage] as? UIImage else { return }
-
- viewModel.submit(image: image)
- }
-
- func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
- dismiss(animated: true, completion: nil)
- }
-
-}
@@ -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! |
@@ -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"/> |
@@ -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] |
@@ -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 |
|
@@ -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 |
} |
@@ -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 {
|
@@ -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 |
|
@@ -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) |