Version 1.6.1
This commit is contained in:
@@ -662,7 +662,7 @@
|
|||||||
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
|
||||||
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
|
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
|
||||||
MACOSX_DEPLOYMENT_TARGET = 14.0;
|
MACOSX_DEPLOYMENT_TARGET = 14.0;
|
||||||
MARKETING_VERSION = 1.6;
|
MARKETING_VERSION = 1.6.1;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "VincentMeilinger.Nextcloud-Cookbook-iOS-Client";
|
PRODUCT_BUNDLE_IDENTIFIER = "VincentMeilinger.Nextcloud-Cookbook-iOS-Client";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SDKROOT = auto;
|
SDKROOT = auto;
|
||||||
@@ -705,7 +705,7 @@
|
|||||||
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
|
||||||
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
|
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
|
||||||
MACOSX_DEPLOYMENT_TARGET = 14.0;
|
MACOSX_DEPLOYMENT_TARGET = 14.0;
|
||||||
MARKETING_VERSION = 1.6;
|
MARKETING_VERSION = 1.6.1;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = "VincentMeilinger.Nextcloud-Cookbook-iOS-Client";
|
PRODUCT_BUNDLE_IDENTIFIER = "VincentMeilinger.Nextcloud-Cookbook-iOS-Client";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SDKROOT = auto;
|
SDKROOT = auto;
|
||||||
|
|||||||
Binary file not shown.
@@ -18,7 +18,7 @@ import UIKit
|
|||||||
@Published var recipeDetails: [Int: RecipeDetail] = [:]
|
@Published var recipeDetails: [Int: RecipeDetail] = [:]
|
||||||
var recipeImages: [Int: [String: UIImage]] = [:]
|
var recipeImages: [Int: [String: UIImage]] = [:]
|
||||||
var imagesNeedUpdate: [Int: [String: Bool]] = [:]
|
var imagesNeedUpdate: [Int: [String: Bool]] = [:]
|
||||||
private var requestQueue: [RequestWrapper] = []
|
var lastUpdates: [String: Date] = [:]
|
||||||
|
|
||||||
private let api: CookbookApi.Type
|
private let api: CookbookApi.Type
|
||||||
private let dataStore: DataStore
|
private let dataStore: DataStore
|
||||||
@@ -65,6 +65,11 @@ import UIKit
|
|||||||
print("Failure!")
|
print("Failure!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize the lastUpdates with distantPast dates, so that each recipeDetail is updated on launch for all categories
|
||||||
|
for category in self.categories {
|
||||||
|
lastUpdates[category.name] = Date.distantPast
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -132,7 +137,7 @@ import UIKit
|
|||||||
guard userSettings.storeRecipes else { return }
|
guard userSettings.storeRecipes else { return }
|
||||||
guard let recipes = self.recipes[category] else { return }
|
guard let recipes = self.recipes[category] else { return }
|
||||||
for recipe in recipes {
|
for recipe in recipes {
|
||||||
if needsUpdate(lastModified: recipe.dateModified) {
|
if needsUpdate(category: category, lastModified: recipe.dateModified) {
|
||||||
print("\(recipe.name) needs an update. (last modified: \(recipe.dateModified)")
|
print("\(recipe.name) needs an update. (last modified: \(recipe.dateModified)")
|
||||||
await updateRecipeDetail(id: recipe.recipe_id, withThumb: userSettings.storeThumb, withImage: userSettings.storeImages)
|
await updateRecipeDetail(id: recipe.recipe_id, withThumb: userSettings.storeThumb, withImage: userSettings.storeImages)
|
||||||
} else {
|
} else {
|
||||||
@@ -394,7 +399,6 @@ import UIKit
|
|||||||
self.categories = []
|
self.categories = []
|
||||||
self.recipes = [:]
|
self.recipes = [:]
|
||||||
self.recipeDetails = [:]
|
self.recipeDetails = [:]
|
||||||
self.requestQueue = []
|
|
||||||
self.recipeImages = [:]
|
self.recipeImages = [:]
|
||||||
self.imagesNeedUpdate = [:]
|
self.imagesNeedUpdate = [:]
|
||||||
}
|
}
|
||||||
@@ -572,22 +576,21 @@ extension MainViewModel {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private func needsUpdate(lastModified: String) -> Bool {
|
private func needsUpdate(category: String, lastModified: String) -> Bool {
|
||||||
print("=======================")
|
print("=======================")
|
||||||
print("original date string: \(lastModified)")
|
print("original date string: \(lastModified)")
|
||||||
// Create a DateFormatter
|
// Create a DateFormatter
|
||||||
let dateFormatter = DateFormatter()
|
let dateFormatter = DateFormatter()
|
||||||
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
|
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
|
||||||
dateFormatter.timeZone = TimeZone(secondsFromGMT: 0)
|
dateFormatter.timeZone = TimeZone(secondsFromGMT: 0)
|
||||||
//dateFormatter.locale = Locale(identifier: "en_US_POSIX") // Set the locale to posix
|
|
||||||
|
|
||||||
// Convert the string to a Date object
|
// Convert the string to a Date object
|
||||||
if let date = dateFormatter.date(from: lastModified) {
|
if let date = dateFormatter.date(from: lastModified), let lastUpdate = lastUpdates[category] {
|
||||||
if date < userSettings.lastUpdate {
|
if date < lastUpdate {
|
||||||
print("No update needed. (recipe: \(dateFormatter.string(from: date)), last: \(dateFormatter.string(from: userSettings.lastUpdate))")
|
print("No update needed. (recipe: \(dateFormatter.string(from: date)), last: \(dateFormatter.string(from: lastUpdate))")
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
print("Update needed. (recipe: \(dateFormatter.string(from: date)), last: \(dateFormatter.string(from: userSettings.lastUpdate))")
|
print("Update needed. (recipe: \(dateFormatter.string(from: date)), last: \(dateFormatter.string(from: lastUpdate))")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user