133 132
         itemViewModel.item.accept(_items.value[index])

+ 15 - 12
PaiAi/PaiaiUIKit/Reusable/UIKit/NavigationController/NavigationController.swift

@@ -11,10 +11,10 @@ import UIKit
11 11
 public class NavigationController: UINavigationController {
12 12
     
13 13
     private var operation: Operation = .none
14
-    private var barConfigures: [UIViewController?: NavigationBarConfiguration] = [:]
14
+    private var barConfigures = [UIViewController: NavigationBarConfiguration]()
15 15
     
16
-    private var _fromFakeBar = UIToolbar()
17
-    private var _toFakeBar = UIToolbar()
16
+    private var _fromFakeBar: UIToolbar? = nil
17
+    private var _toFakeBar: UIToolbar? = nil
18 18
     
19 19
     override public init(rootViewController: UIViewController) {
20 20
         super.init(navigationBarClass: NavigationBar.classForCoder(), toolbarClass: nil)
@@ -73,24 +73,27 @@ fileprivate extension NavigationController {
73 73
     func setFromFakeNavigationBar(for from: UIViewController) {
74 74
         if let navBarFrame = from.getFakeBarFrame(for: navigationBar) {
75 75
             _fromFakeBar = UIToolbar(configure: barConfigures[from] ?? .default)
76
-            _fromFakeBar.delegate = self
77
-            _fromFakeBar.frame = navBarFrame
78
-            from.view.addSubview(_fromFakeBar)
76
+            _fromFakeBar?.delegate = self
77
+            _fromFakeBar?.frame = navBarFrame
78
+            from.view.addSubview(_fromFakeBar!)
79 79
         }
80 80
     }
81 81
     
82 82
     func setToFakeNavigationBar(for to: UIViewController) {
83 83
         if let navBarFrame = to.getFakeBarFrame(for: navigationBar) {
84 84
             _toFakeBar = UIToolbar(configure: barConfigures[to] ?? .default)
85
-            _toFakeBar.delegate = self
86
-            _toFakeBar.frame = navBarFrame
87
-            to.view.addSubview(_toFakeBar)
85
+            _toFakeBar?.delegate = self
86
+            _toFakeBar?.frame = navBarFrame
87
+            to.view.addSubview(_toFakeBar!)
88 88
         }
89 89
     }
90 90
     
91 91
     func clearFake() {
92
-        _fromFakeBar.removeFromSuperview()
93
-        _toFakeBar.removeFromSuperview()
92
+        _fromFakeBar?.removeFromSuperview()
93
+        _toFakeBar?.removeFromSuperview()
94
+        
95
+        _fromFakeBar = nil
96
+        _toFakeBar = nil
94 97
         
95 98
         guard let from = transitionCoordinator?.viewController(forKey: .from),
96 99
             operation == .pop else { return }
@@ -130,7 +133,7 @@ extension NavigationController: UINavigationControllerDelegate {
130 133
                 vc = context.viewController(forKey: .to)
131 134
             }
132 135
             self.navigationBar.getBarBackground()?.alpha = 1
133
-            self.navigationBar.apply(for: self.barConfigures[vc] ?? .default)
136
+            self.navigationBar.apply(for: self.barConfigures[vc!] ?? .default)
134 137
             self.clearFake()
135 138
         })
136 139
     }

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

@@ -23,7 +23,6 @@ public final class AppCoordinator: BaseCoordinator<Void> {
23 23
     public init(window: UIWindow) {
24 24
         self.window = window
25 25
         self.containerViewController = ContainerViewController()
26
-
27 26
         super.init(navigationController: NavigationController(rootViewController: containerViewController),
28 27
                    viewController: containerViewController)
29 28
     }

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

@@ -82,6 +82,11 @@ final class GroupViewController: UIViewController {
82 82
         collectionView.startRefreshing(at: .top)
83 83
     }
84 84
 
85
+    override func removeFromParent() {
86
+        super.removeFromParent()
87
+        print(self)
88
+    }
89
+    
85 90
     deinit {
86 91
         collectionView.removeAllPullToRefresh()
87 92
     }

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

@@ -29,7 +29,7 @@ class HomeCoordinator: BaseCoordinator<Void> {
29 29
     @discardableResult
30 30
     override func start() -> Observable<Void> {
31 31
         homeViewController.viewModel.delegate = self
32
-
32
+        deallocatedDispose.dispose()
33 33
         return Observable.never()
34 34
     }
35 35
 }

+ 17 - 25
PaiAi/Paiai_iOS/App/Home/HomeViewController.swift

@@ -10,7 +10,7 @@ import RxCocoa
10 10
 import RxDataSources
11 11
 import PaiaiDataKit
12 12
 import PaiaiUIKit
13
-import PullToRefresh
13
+import ESPullToRefresh
14 14
 
15 15
 final class HomeViewController: UIViewController {
16 16
 
@@ -20,22 +20,14 @@ final class HomeViewController: UIViewController {
20 20
     // MARK: data property
21 21
     fileprivate let disposeBag = DisposeBag()
22 22
 
23
-    internal var viewModel: HomeViewModel!
24
-    internal var userInfoViewModel: UserInfoViewModel!
23
+    var viewModel: HomeViewModel!
24
+    var userInfoViewModel: UserInfoViewModel!
25 25
 
26 26
     override func viewDidLoad() {
27 27
         super.viewDidLoad()
28 28
         initalize()
29 29
     }
30 30
 
31
-    override func viewDidAppear(_ animated: Bool) {
32
-        super.viewDidAppear(animated)
33
-    }
34
-    
35
-    override func viewDidDisappear(_ animated: Bool) {
36
-        super.viewDidDisappear(animated)
37
-    }
38
-
39 31
     func initalize() {
40 32
         collectionView.register(UINib(nibName: "PhotoCell",
41 33
                                       bundle: Bundle(identifier: "com.Paiai-iOS")),
@@ -51,22 +43,22 @@ final class HomeViewController: UIViewController {
51 43
     }
52 44
 
53 45
     private func setupReloadControl() {
54
-        collectionView.addPullToRefresh(PullToRefresh()) {
46
+        collectionView.es.addPullToRefresh {
55 47
             [unowned self] in
56 48
             self.viewModel.reload()
57 49
         }
58 50
     }
59 51
 
60 52
     private func setupLoadingControl() {
61
-        collectionView.addPullToRefresh(PullToRefresh(position: .bottom)) {
62
-            [weak self] in
63
-            guard let `self` = self else { return }
53
+        collectionView.es.addInfiniteScrolling {
54
+            [unowned self] in
64 55
             self.viewModel.preload()
65 56
         }
66 57
     }
67 58
 
68 59
     deinit {
69
-        collectionView.removeAllPullToRefresh()
60
+        collectionView.es.removeRefreshFooter()
61
+        collectionView.es.removeRefreshHeader()
70 62
     }
71 63
 }
72 64
 
@@ -100,11 +92,12 @@ fileprivate extension HomeViewController {
100 92
     func bindViewModelToRefreshing() {
101 93
         viewModel.isLoading
102 94
             .asDriver(onErrorJustReturn: true)
103
-            .drive(onNext: {[unowned self] flag in
95
+            .drive(onNext: {[weak self] flag in
96
+                guard let `self` = self else { return }
104 97
                 if flag {
105
-                    self.collectionView.endRefreshing(at: .top)
98
+                    self.collectionView.es.stopPullToRefresh()
106 99
                 } else {
107
-                    self.collectionView.endRefreshing(at: .bottom)
100
+                    self.collectionView.es.stopLoadingMore()
108 101
                 }
109 102
             }).disposed(by: disposeBag)
110 103
     }
@@ -114,12 +107,11 @@ fileprivate extension HomeViewController {
114 107
     }
115 108
 
116 109
     func bindUserInfoViewModelToView() {
117
-        userInfoViewModel.isLoggedIn
118
-            .asDriver(onErrorJustReturn: ())
119
-            .drive(onNext: {[unowned self] _ in
120
-                self.viewModel.clear()
121
-                self.collectionView.startRefreshing(at: .top)
122
-            }).disposed(by: disposeBag)
110
+        userInfoViewModel.isLoggedIn.subscribe({[weak self] _ in
111
+            guard let `self` = self else { return }
112
+            self.viewModel.clear()
113
+            self.collectionView.startRefreshing(at: .top)
114
+        }).disposed(by: disposeBag)
123 115
     }
124 116
 
125 117
     func bindViewModelToCollectionView() {

+ 1 - 0
PaiAi/Paiai_iOS/App/Message/MessageCoordinator.swift

@@ -22,6 +22,7 @@ class MessageCoordinator: BaseCoordinator<Void> {
22 22
 
23 23
     override func start() -> Observable<Void> {
24 24
         messageViewController.viewModel.delegate = self
25
+        deallocatedDispose.dispose()
25 26
         return Observable.never()
26 27
     }
27 28
 }

+ 14 - 4
PaiAi/Paiai_iOS/App/Mine/MineAboutViewController.swift

@@ -7,8 +7,8 @@
7 7
 //
8 8
 
9 9
 import UIKit
10
-import PaiaiDataKit
11 10
 import PaiaiUIKit
11
+
12 12
 import RxSwift
13 13
 
14 14
 final class MineAboutViewController: UIViewController {
@@ -30,6 +30,15 @@ final class MineAboutViewController: UIViewController {
30 30
         versionLabel.text = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
31 31
         bindGestures()
32 32
     }
33
+    
34
+    override func viewDidDisappear(_ animated: Bool) {
35
+        super.viewDidDisappear(animated)
36
+        
37
+    }
38
+    
39
+    deinit {
40
+        print("deinit")
41
+    }
33 42
 }
34 43
 
35 44
 fileprivate extension MineAboutViewController {
@@ -42,7 +51,7 @@ fileprivate extension MineAboutViewController {
42 51
     func bindGestureToContactUsAction() {
43 52
         contactUsBtn.rx.tap
44 53
             .asObservable()
45
-            .subscribe { (_) in
54
+            .subscribe { [unowned self] _ in
46 55
                 let webVC = WebViewController(title: "联系我们",
47 56
                                               path: "https://pai.ai/page/contact_us")
48 57
                 self.navigationController?.pushViewController(webVC)
@@ -52,7 +61,7 @@ fileprivate extension MineAboutViewController {
52 61
     func bindGestureToScoreAction() {
53 62
         scoreBtn.rx.tap
54 63
             .asObservable()
55
-            .subscribe { (_) in
64
+            .subscribe {  _ in
56 65
                 guard let url = URL(string: "https://itunes.apple.com/cn/app/pai-aipaiai/id1163960351?mt=8") else {
57 66
                     return
58 67
                 }
@@ -63,7 +72,7 @@ fileprivate extension MineAboutViewController {
63 72
     func bindGestureToUserAgreementAction() {
64 73
         userAgreementBtn.rx.tap
65 74
             .asObservable()
66
-            .subscribe { (_) in
75
+            .subscribe { [unowned self] _ in
67 76
                 let webVC = WebViewController(title: "用户协议",
68 77
                                               path: "https://pai.ai/page/user_agreement")
69 78
                 self.navigationController?.pushViewController(webVC)
@@ -78,3 +87,4 @@ extension MineAboutViewController: Storyboarded {
78 87
         return UIStoryboard.mine.instantiateViewController(type: MineAboutViewController.self)
79 88
     }
80 89
 }
90
+

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

@@ -25,8 +25,6 @@ class MineCoordinator: BaseCoordinator<Void> {
25 25
         mineViewController.delegate = self
26 26
         return didCancel
27 27
     }
28
-
29
-    override func listenDeallocate() {}
30 28
 }
31 29
 
32 30
 extension MineCoordinator: MineViewControllerDelegate {
@@ -46,7 +44,7 @@ extension MineCoordinator: MineViewControllerDelegate {
46 44
 
47 45
     func didSelect(_ item: MineItem) {
48 46
         mineViewController.dismissController()
49
-
47
+        deallocatedDispose.dispose()
50 48
         let vc: UIViewController
51 49
         switch item {
52 50
         case .group:
@@ -58,8 +56,8 @@ extension MineCoordinator: MineViewControllerDelegate {
58 56
         case .about:
59 57
             vc = makeMineAboutViewController()
60 58
         }
61
-
62
-        vc.rx.deallocated.subscribe(onNext: { _ in
59
+        
60
+        vc.rx.deallocating.subscribe(onNext: { _ in
63 61
             self.didCancel.onNext(())
64 62
         }).disposed(by: disposeBag)
65 63
     }
@@ -103,8 +101,8 @@ fileprivate extension MineCoordinator {
103 101
 
104 102
     func makeMineAboutViewController() -> MineAboutViewController {
105 103
         let vc = MineAboutViewController.instantiate()
106
-        navigationController.pushViewController(vc)
107
-
104
+        navigationController.pushViewController(vc, animated: true)
105
+        print(navigationController)
108 106
         return vc
109 107
     }
110 108
 

+ 10 - 11
PaiAi/Paiai_iOS/Reusable/BaseCoordinator.swift

@@ -7,7 +7,7 @@
7 7
 //
8 8
 
9 9
 import RxSwift
10
-import Foundation
10
+import UIKit
11 11
 
12 12
 public class BaseCoordinator<ResultType> {
13 13
 
@@ -15,6 +15,7 @@ public class BaseCoordinator<ResultType> {
15 15
 
16 16
     let disposeBag = DisposeBag()
17 17
     var didCancel = PublishSubject<Void>()
18
+    var deallocatedDispose = Disposables.create()
18 19
     var navigationController: UINavigationController
19 20
     var viewController: UIViewController
20 21
 
@@ -25,7 +26,13 @@ public class BaseCoordinator<ResultType> {
25 26
     init(navigationController: UINavigationController, viewController: UIViewController) {
26 27
         self.viewController = viewController
27 28
         self.navigationController = navigationController
28
-        listenDeallocate()
29
+        
30
+        deallocatedDispose = viewController.rx.viewDidDisappear.subscribe(onNext: {[weak self] _ in
31
+            guard let `self` = self else { return }
32
+            if !self.navigationController.viewControllers.contains(viewController) {
33
+                self.didCancel.onNext(())
34
+            }
35
+        })
29 36
     }
30 37
 
31 38
     private func store<T>(coordinator: BaseCoordinator<T>) {
@@ -33,6 +40,7 @@ public class BaseCoordinator<ResultType> {
33 40
     }
34 41
 
35 42
     private func free<T>(coordinator: BaseCoordinator<T>) {
43
+        print(coordinator)
36 44
         childCoordinators[coordinator.identifier] = nil
37 45
     }
38 46
 
@@ -48,13 +56,4 @@ public class BaseCoordinator<ResultType> {
48 56
     func start() -> Observable<ResultType> {
49 57
         fatalError("Start method should be implemented.")
50 58
     }
51
-
52
-    func listenDeallocate() {
53
-        navigationController.rx.willShow.subscribe(onNext: {[weak self] (_, _) in
54
-            guard let `self` = self else { return }
55
-            if !self.navigationController.viewControllers.contains(self.viewController) {
56
-                self.didCancel.onNext(())
57
-            }
58
-        }).disposed(by: disposeBag)
59
-    }
60 59
 }

kodo - Gogs: Go Git Service

Sin Descripción

supersr_views.py 910B

    # -*- coding: utf-8 -*- from django.conf import settings from django_logit import logit from json_render import json_render from sales.models import SalesResponsibilityInfo @logit def supersr_oauthqr(request): brand_id = request.GET.get('brand_id', settings.KODO_DEFAULT_BRAND_ID) return json_render(request, 'page/supersr_oauth_qrcode.html', unjsondumpsdict={ 'qr': settings.KODO_SUPERSR_AUTH_URL.format(brand_id) }) @logit def supersr_oauth(request): brand_id = request.GET.get('brand_id', settings.KODO_DEFAULT_BRAND_ID) unionid = request.GET.get('unionid', '') SalesResponsibilityInfo.objects.update_or_create(brand_id=brand_id, unionid=unionid, defaults={ 'user_status': SalesResponsibilityInfo.ACTIVATED, 'is_auth': True, 'is_super': True, }) return json_render(request, 'page/supersr_oauth_success.html', unjsondumpsdict={ })
Pai2/pai2 - Gogs: Go Git Service

171 Commits (86aa86bbba5924d0c804d4d5f29b9067758e7c55)

Author SHA1 Message Date
  Brightcells 86aa86bbba add GROUP_PHOTO_WATCHER_SET 10 years ago
  Brightcells 47eb096687 fix bug add cls=DjangoJSONEncoder for json.dumps 10 years ago
  Brightcells e920b279d1 send message for all watched users 10 years ago
  Brightcells 1a0427282e change to auto_response of django-json-response 10 years ago
  Brightcells 29185bf2d4 reback to use raw sql instead of records 10 years ago
  Brightcells a02504cc21 Fix Bug: created_at format error 10 years ago
  Brightcells 148da098dd add wexin diy share for session_detail 10 years ago
  Brightcells 5a00022a72 close debug 10 years ago
  Brightcells 4f1aa43391 nonceStr 10 years ago
  Brightcells f3edf9f11f add wexin diy share 10 years ago
  Brightcells 8f43551640 add api wx_jsapi_signature_api 10 years ago
  Brightcells b5857bab0c dialect[+driver]://user:password@host/dbname[?key=value..] 10 years ago
  Brightcells d50a6c1bae update django-detect in requirements.txt 10 years ago
  Brightcells 3253541b10 change to exec raw sql from django.db.connection to records 10 years ago
  Brightcells 8263625d9c new website 10 years ago
  Brightcells 8d6858fb00 adjust website content 10 years ago
  Brightcells 80a3496489 fix user join group by session after remove 10 years ago
  Brightcells e4567ea2de fix call set_group_users_info after group user removed 10 years ago
  Brightcells 1e620ebab6 *_download.html 10 years ago
  Brightcells 2f29afecbd modify version in operation 10 years ago
  Brightcells 65ab52f95a spell error 10 years ago
  Brightcells 535ac34ee1 add api download_api 10 years ago
  Brightcells af2b3f483f change download.html to be generated from download.tmpl.html 10 years ago
  Brightcells 696c8d2e2b adjust download section of photo_detail/session_detail 10 years ago
  Brightcells 9671c0e989 wrongly written or mispronounced characters 10 years ago
  Brightcells 5a0b6447ca change RotatingFileHandler to TimedRotatingFileHandler to support rotation of disk log files at certain timed intervals. 10 years ago
  Brightcells cce055cdf4 change FileHandler to RotatingFileHandler to to supports rotation of disk log files. 10 years ago
  Brightcells 51959f199b remove overflow: hidden; 10 years ago
  Brightcells 88294e7647 change title of photo detail 10 years ago
  Brightcells 4b7cfa2426 adjust photo detail page 10 years ago
  Brightcells f679be700a adjust title of user_agreement 10 years ago
  Brightcells a80a911457 change time.time() to int(time.time()) in upload_path 10 years ago
  Brightcells 771845b52e add param pfrom for statistic_thumbnail_size 10 years ago
  Brightcells 5c9e21b29b add Only Once Function statistic_thumbnail_size to statistic thumbnail size 10 years ago
  Brightcells 0339d3dce4 Fix Bug: set_group_photo_data should after group_photo.save() 10 years ago
  Brightcells bbc43c96ec add photo_share_url 10 years ago
  Brightcells 398957153c add pk in user's nickname 10 years ago
  Brightcells 85eb6c6f2d Fix Bug: nickname for GroupPhotoInfo error 10 years ago
  Brightcells afcdf74a49 add api group_data_api 10 years ago
  Brightcells e1b319d9a4 'charset': 'utf8mb4' 10 years ago
  Brightcells a8d890cb70 filter order by pay_status 10 years ago
  Brightcells 03304ad48a add api guest_status_api & modify api guest_login_api 10 years ago
  Brightcells c209e83d29 add delete_guest_entrance_control 10 years ago
  Brightcells 63eaee0951 modify guest_login_api 10 years ago
  Brightcells 70689e758c add lensman and user's balance 10 years ago
  Brightcells 269576f8b9 add guest user 10 years ago
  Brightcells 818e5ae2cd adjust page 10 years ago
  Brightcells 10fdf9ba1f adjust page 10 years ago
  Brightcells 805b221885 add content for contact_us.html 10 years ago
  Brightcells 60b2bc0c09 add content for user_agreement.html 10 years ago
pai2 - Gogs: Go Git Service

拍爱

Brightcells: 8263625d9c new website 10 年之前
..
website 8263625d9c new website 10 年之前