diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index 8b913255fe..1383bc4a88 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -244,19 +244,6 @@ static void uncaughtExceptionHandler(NSException *exception) return YES; } -- (BOOL)checkSomeDiskSpaceAvailable -{ - NSString *tempDir = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSUUID new].UUIDString]; - BOOL succeededCreatingDir = [OWSFileSystem ensureDirectoryExists:tempDir]; - - // Best effort at deleting temp dir, which shouldn't ever fail - if (succeededCreatingDir && ![OWSFileSystem deleteFile:tempDir]) { - OWSFailDebug(@"Failed to delete temp dir used for checking disk space!"); - } - - return succeededCreatingDir; -} - - (BOOL)launchToHomeScreen:(NSDictionary *_Nullable)launchOptions instrumentsMonitorId:(unsigned long long)monitorId { [self setupNSEInteroperation]; diff --git a/Signal/src/AppDelegate.swift b/Signal/src/AppDelegate.swift index 1cf0025a82..6edcead90b 100644 --- a/Signal/src/AppDelegate.swift +++ b/Signal/src/AppDelegate.swift @@ -16,6 +16,21 @@ enum LaunchFailure: UInt { } extension AppDelegate { + @objc(checkSomeDiskSpaceAvailable) + func checkSomeDiskSpaceAvailable() -> Bool { + let tempDir = URL(fileURLWithPath: NSTemporaryDirectory()) + .appendingPathComponent(UUID().uuidString) + .path + let succeededCreatingDir = OWSFileSystem.ensureDirectoryExists(tempDir) + + // Best effort at deleting temp dir, which shouldn't ever fail + if succeededCreatingDir && !OWSFileSystem.deleteFile(tempDir) { + owsFailDebug("Failed to delete temp dir used for checking disk space!") + } + + return succeededCreatingDir + } + @objc(getActionSheetForLaunchFailure:fromViewController:onContinue:) func getActionSheet(for launchFailure: LaunchFailure, from viewController: UIViewController,