Added testing menu, made layout changes, optimised DataFetcher.swift, removed Alamofire dependency

This commit is contained in:
Deniz Duezgoeren
2019-10-13 16:53:08 +02:00
parent 882c6acecc
commit f34392041f
59 changed files with 3865 additions and 10543 deletions
+15 -9
View File
@@ -47,8 +47,12 @@ class PlanViewController : UICollectionViewController, UICollectionViewDelegateM
if self.prefs.bool(forKey: "logged_in") {
Messaging.messaging().subscribe(toTopic: "substitutions-ios")
Messaging.messaging().subscribe(toTopic: "substitutions-broadcast")
Crashlytics.sharedInstance().setUserIdentifier(UserDefaults.standard.string(forKey: "username"))
// TODO: check if these can be put in AppDelegate
if self.prefs.bool(forKey: "subscribed_to_dev_channel") {
Messaging.messaging().subscribe(toTopic: "substitutions-debug")
} else {
Messaging.messaging().unsubscribe(fromTopic: "substitutions-debug")
}
}
view.addSubview(collectionView)
@@ -112,13 +116,15 @@ class PlanViewController : UICollectionViewController, UICollectionViewDelegateM
}
@objc private func objDoAsync(_ sender: Any) {
self.df.doAsync(do: self.getViewType()) { substitutions in
self.substs = substitutions as! [SubstModel]
// UIView.performWithoutAnimation {
self.collectionView.reloadData()
// }
self.refreshControl.endRefreshing()
self.df.setTabBarBadge(for: self.tabBarController?.tabBar.items)
self.df.doAsync(do: self.getViewType()) {
DispatchQueue.main.async {
self.substs = self.getFromDatabase()
// UIView.performWithoutAnimation {
self.collectionView.reloadData()
// }
self.refreshControl.endRefreshing()
self.df.setTabBarBadge(for: self.tabBarController?.tabBar.items)
}
}
}