Move checkSomeDiskSpaceAvailable to Swift
This change should have no user impact.
This commit is contained in:
parent
8a13595143
commit
5db672b039
@ -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];
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user