From c7b5f6afa0b6ba31787238ad9e33b9b173864e39 Mon Sep 17 00:00:00 2001 From: AlexCHUN <39689240+daikeung@users.noreply.github.com> Date: Mon, 10 Jun 2019 15:01:57 +0800 Subject: [PATCH] Update MigrateLocalStorage.m --- src/ios/MigrateLocalStorage.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ios/MigrateLocalStorage.m b/src/ios/MigrateLocalStorage.m index f5cce5e..a38a810 100644 --- a/src/ios/MigrateLocalStorage.m +++ b/src/ios/MigrateLocalStorage.m @@ -58,6 +58,16 @@ - (void) migrateLocalStorage [self copyFrom:[original stringByAppendingString:@"-shm"] to:[target stringByAppendingString:@"-shm"]]; [self copyFrom:[original stringByAppendingString:@"-wal"] to:[target stringByAppendingString:@"-wal"]]; } + + // for using hostname in config.xml, local storage path changed + NSString* target2 = [appLibraryFolder stringByAppendingPathComponent:@"WebKit/WebsiteData/LocalStorage/httpsionic_app.topo.cc_0.localstorage"]; + // Only copy data if no existing localstorage data exists yet for hostname + if (![[NSFileManager defaultManager] fileExistsAtPath:target2]) { + NSLog(@"No existing localstorage data found for hostname. Migrating data from normal wkwebview"); + [self copyFrom:target to:target2]; + [self copyFrom:[target stringByAppendingString:@"-shm"] to:[target2 stringByAppendingString:@"-shm"]]; + [self copyFrom:[target stringByAppendingString:@"-wal"] to:[target2 stringByAppendingString:@"-wal"]]; + } } - (void)pluginInitialize