Archived
Added empty food menu notice, code for checking the app version, possible fix for jumpy CollectionView behaviour, TODO: check on real device
This commit is contained in:
@@ -119,6 +119,13 @@ class CustomizationViewController: UITableViewController, UITextFieldDelegate, U
|
||||
self.prefs.set(newValue, forKey: "use_test_urls")
|
||||
toastMessage = "Test URLs set to \(newValue)"
|
||||
break
|
||||
case "_version":
|
||||
if let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String {
|
||||
toastMessage = "App version: \(version)"
|
||||
} else {
|
||||
toastMessage = "Version couldn't be resolved"
|
||||
}
|
||||
break
|
||||
default:
|
||||
toastMessage = NSLocalizedString("invalid_code", comment: "")
|
||||
break
|
||||
|
||||
@@ -169,6 +169,7 @@ class DataFetcher {
|
||||
|
||||
var isPlanEmpty = true
|
||||
var isPersonalEmpty = true
|
||||
var isFoodMenuEmpty = true
|
||||
var personalPlanCount = 0
|
||||
var mWebsitePriority = 0
|
||||
|
||||
@@ -267,6 +268,7 @@ class DataFetcher {
|
||||
indices.append(foodItems.size())
|
||||
|
||||
for l in 0..<indices.count - 1 {
|
||||
isFoodMenuEmpty = false
|
||||
var s = ""
|
||||
for i2 in indices[l]..<indices[l + 1] {
|
||||
if (s.isEmpty) {
|
||||
@@ -290,8 +292,12 @@ class DataFetcher {
|
||||
|
||||
prefs.set(infoString.trimmingCharacters(in: .whitespacesAndNewlines), forKey: "information")
|
||||
|
||||
for food in foodmenuList {
|
||||
try db.run(foodmenu.insert(text <- food))
|
||||
if isFoodMenuEmpty {
|
||||
try db.run(foodmenu.insert(text <- NSLocalizedString("food_menu_empty", comment: "")))
|
||||
} else {
|
||||
for food in foodmenuList {
|
||||
try db.run(foodmenu.insert(text <- food))
|
||||
}
|
||||
}
|
||||
|
||||
} catch {
|
||||
|
||||
@@ -22,6 +22,11 @@ class MenuViewController : UICollectionViewController, UICollectionViewDelegateM
|
||||
collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
|
||||
}
|
||||
|
||||
override func loadView() {
|
||||
super.loadView()
|
||||
self.collectionView.isPrefetchingEnabled = false
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
@@ -58,7 +63,6 @@ class MenuViewController : UICollectionViewController, UICollectionViewDelegateM
|
||||
self.extendedLayoutIncludesOpaqueBars = true
|
||||
self.collectionView.contentInsetAdjustmentBehavior = .always
|
||||
self.navigationController?.navigationBar.topItem?.title = NSLocalizedString("food_menu", comment: "")
|
||||
self.collectionView.isPrefetchingEnabled = false
|
||||
}
|
||||
|
||||
@objc private func objDoAsync(_ sender: Any) {
|
||||
|
||||
@@ -28,6 +28,11 @@ class PlanViewController : UICollectionViewController, UICollectionViewDelegateM
|
||||
collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
|
||||
}
|
||||
|
||||
override func loadView() {
|
||||
super.loadView()
|
||||
self.collectionView.isPrefetchingEnabled = false
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
|
||||
if !self.prefs.bool(forKey: "logged_in") {
|
||||
@@ -96,7 +101,6 @@ class PlanViewController : UICollectionViewController, UICollectionViewDelegateM
|
||||
|
||||
self.collectionView.contentInsetAdjustmentBehavior = .always
|
||||
self.df.setTabBarBadge(for: self.tabBarController?.tabBar.items)
|
||||
self.collectionView.isPrefetchingEnabled = false
|
||||
}
|
||||
|
||||
func getViewType() -> String {
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
|
||||
"plan_empty" = "Der Vertretungsplan ist leer";
|
||||
"personal_plan_empty" = "Dein Plan ist leer :(";
|
||||
"food_menu_empty" = "Der Speiseplan ist leer";
|
||||
|
||||
// titles
|
||||
"avh_plan" = "AvH-Plan";
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
|
||||
"plan_empty" = "The substitution plan is empty";
|
||||
"personal_plan_empty" = "Your plan is empty :(";
|
||||
"food_menu_empty" = "The food menu is empty";
|
||||
|
||||
// titles
|
||||
"avh_plan" = "AvH Plan";
|
||||
|
||||
Reference in New Issue
Block a user