From 16f6f3b7e998d51dab78f6f6458673d9b8d94886 Mon Sep 17 00:00:00 2001 From: advplyr Date: Thu, 28 Jul 2022 19:14:29 -0500 Subject: [PATCH] iOS Realm migration to add new altViewEnabled device setting --- ios/App/App/AppDelegate.swift | 15 +++++++++++++++ ios/App/Podfile | 12 ++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/ios/App/App/AppDelegate.swift b/ios/App/App/AppDelegate.swift index 447182a3..105aefab 100644 --- a/ios/App/App/AppDelegate.swift +++ b/ios/App/App/AppDelegate.swift @@ -1,5 +1,6 @@ import UIKit import Capacitor +import RealmSwift @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { @@ -8,6 +9,20 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. + + let configuration = Realm.Configuration( + schemaVersion: 1, + migrationBlock: { migration, oldSchemaVersion in + if (oldSchemaVersion < 1) { + NSLog("Realm schema version was \(oldSchemaVersion)") + migration.enumerateObjects(ofType: DeviceSettings.className()) { oldObject, newObject in + newObject?["enableAltView"] = false + } + } + } + ) + Realm.Configuration.defaultConfiguration = configuration + return true } diff --git a/ios/App/Podfile b/ios/App/Podfile index 89125e80..dcdae730 100644 --- a/ios/App/Podfile +++ b/ios/App/Podfile @@ -9,12 +9,12 @@ install! 'cocoapods', :disable_input_output_paths => true def capacitor_pods pod 'Capacitor', :path => '../../node_modules/@capacitor/ios' pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios' - pod 'CapacitorApp', :path => '..\..\node_modules\@capacitor\app' - pod 'CapacitorDialog', :path => '..\..\node_modules\@capacitor\dialog' - pod 'CapacitorHaptics', :path => '..\..\node_modules\@capacitor\haptics' - pod 'CapacitorNetwork', :path => '..\..\node_modules\@capacitor\network' - pod 'CapacitorStatusBar', :path => '..\..\node_modules\@capacitor\status-bar' - pod 'CapacitorStorage', :path => '..\..\node_modules\@capacitor\storage' + pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app' + pod 'CapacitorDialog', :path => '../../node_modules/@capacitor/dialog' + pod 'CapacitorHaptics', :path => '../../node_modules/@capacitor/haptics' + pod 'CapacitorNetwork', :path => '../../node_modules/@capacitor/network' + pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar' + pod 'CapacitorStorage', :path => '../../node_modules/@capacitor/storage' end target 'App' do