Page MenuHomePhabricator

D4180.id13273.diff
No OneTemporary

D4180.id13273.diff

diff --git a/native/ios/Comm/AppDelegate.mm b/native/ios/Comm/AppDelegate.mm
--- a/native/ios/Comm/AppDelegate.mm
+++ b/native/ios/Comm/AppDelegate.mm
@@ -19,8 +19,6 @@
#import "NetworkModule.h"
#import "SQLiteQueryExecutor.h"
#import "Tools.h"
-#import <cstdio>
-#import <stdexcept>
#import <string>
#ifdef FB_SONARKIT_ENABLED
@@ -234,23 +232,6 @@
- (void)attemptDatabaseInitialization {
std::string sqliteFilePath =
std::string([[Tools getSQLiteFilePath] UTF8String]);
-
- // Previous versions of Comm app used to keep SQLite database at location
- // that was specific to the app. Now that we share SQLite database with
- // NotificationService extension we need to keep the database in place
- // defined by App Groups. The code below is a migration fired if user
- // upgrades from version using app-specific path to newer that uses
- // App Groups.
- NSString *appSpecificSQLiteFilePath = [Tools getAppSpecificSQLiteFilePath];
- if ([NSFileManager.defaultManager
- fileExistsAtPath:appSpecificSQLiteFilePath] &&
- std::rename(
- std::string([appSpecificSQLiteFilePath UTF8String]).c_str(),
- sqliteFilePath.c_str())) {
- throw std::runtime_error(
- "Failed to move SQLite database from app-specific to app group "
- "location");
- }
comm::SQLiteQueryExecutor::initialize(sqliteFilePath);
}
diff --git a/native/ios/Comm/Tools.h b/native/ios/Comm/Tools.h
--- a/native/ios/Comm/Tools.h
+++ b/native/ios/Comm/Tools.h
@@ -3,6 +3,5 @@
#import <UIKit/UIKit.h>
@interface Tools : NSObject
-+ (NSString *)getAppSpecificSQLiteFilePath;
+ (NSString *)getSQLiteFilePath;
@end
diff --git a/native/ios/Comm/Tools.mm b/native/ios/Comm/Tools.mm
--- a/native/ios/Comm/Tools.mm
+++ b/native/ios/Comm/Tools.mm
@@ -5,16 +5,6 @@
@implementation Tools
+ (NSString *)getSQLiteFilePath {
- NSURL *groupUrl = [NSFileManager.defaultManager
- containerURLForSecurityApplicationGroupIdentifier:@"group.app.comm"];
- if (groupUrl == nil) {
- throw std::runtime_error(
- "Failed to resolve database path - could not find groupUrl");
- }
- return [groupUrl URLByAppendingPathComponent:@"comm.sqlite"].path;
-}
-
-+ (NSString *)getAppSpecificSQLiteFilePath {
NSError *err = nil;
NSURL *documentsUrl =
[NSFileManager.defaultManager URLForDirectory:NSDocumentDirectory

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 1:25 AM (20 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2595373
Default Alt Text
D4180.id13273.diff (2 KB)

Event Timeline