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:
Deniz Duezgoeren
2019-10-19 09:29:59 +02:00
parent fc8349d30c
commit ede4f0cc0a
7 changed files with 29 additions and 6 deletions
+2 -2
View File
@@ -722,7 +722,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.denizd.substitutionplan;
PRODUCT_BUNDLE_IDENTIFIER = "denizd.AvH-Plan";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -742,7 +742,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.denizd.substitutionplan;
PRODUCT_BUNDLE_IDENTIFIER = "denizd.AvH-Plan";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -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
+8 -2
View File
@@ -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 {
+5 -1
View File
@@ -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) {
+5 -1
View File
@@ -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 {
+1
View File
@@ -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";
+1
View File
@@ -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";