- Fixed: attempt migrations fix from 0.5.10 to 0.6.0

This commit is contained in:
mahee96
2025-03-11 04:44:23 +05:30
parent 3785891923
commit ae8e9a3506
9 changed files with 964 additions and 849 deletions

View File

@@ -11,7 +11,7 @@ import UIKit
public extension Source
{
static let altStoreIdentifier = try! Source.sourceID(from: Source.altStoreSourceURL)
static let altStoreIdentifier = "com.SideStore.SideStore"
#if STAGING
@@ -280,6 +280,8 @@ public class Source: BaseEntity, Decodable
case news
case featuredApps
case userInfo
case identifier
}
private override init(entity: NSEntityDescription, insertInto context: NSManagedObjectContext?)
@@ -304,6 +306,9 @@ public class Source: BaseEntity, Decodable
// use sourceversion = 1 by default if not specified in source json
self.version = try container.decodeIfPresent(Int.self, forKey: .version) ?? 1
// use sourceURL as identifier is one is not present for backwards compatibility
self.identifier = try container.decodeIfPresent(String.self, forKey: .identifier) ?? Source.sourceID(from: sourceURL)
self.subtitle = try container.decodeIfPresent(String.self, forKey: .subtitle)
self.websiteURL = try container.decodeIfPresent(URL.self, forKey: .websiteURL)
self.localizedDescription = try container.decodeIfPresent(String.self, forKey: .localizedDescription)
@@ -451,9 +456,10 @@ public extension Source
{
func setSourceURL(_ sourceURL: URL) throws
{
let identifier = try Source.sourceID(from: sourceURL)
self.identifier = identifier
// commented out to retain source id as-is (independent of sourceURL)
// let identifier = try Source.sourceID(from: sourceURL)
// self.identifier = identifier
self.sourceURL = sourceURL
for app in self.apps