diff --git a/SakaiClientiOS.xcworkspace/xcuserdata/pran1999.xcuserdatad/UserInterfaceState.xcuserstate b/SakaiClientiOS.xcworkspace/xcuserdata/pran1999.xcuserdatad/UserInterfaceState.xcuserstate index 7c3d268..2dd917a 100644 Binary files a/SakaiClientiOS.xcworkspace/xcuserdata/pran1999.xcuserdatad/UserInterfaceState.xcuserstate and b/SakaiClientiOS.xcworkspace/xcuserdata/pran1999.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/SakaiClientiOS.xcworkspace/xcuserdata/pran1999.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/SakaiClientiOS.xcworkspace/xcuserdata/pran1999.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index a4c1ad7..e17c174 100644 --- a/SakaiClientiOS.xcworkspace/xcuserdata/pran1999.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/SakaiClientiOS.xcworkspace/xcuserdata/pran1999.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -10,7 +10,7 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "SakaiClientiOS/Controllers/Announcement/AnnouncementDataFetcher.swift" - timestampString = "568602196.6907099" + timestampString = "568619912.786104" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" startingLineNumber = "70" diff --git a/SakaiClientiOS/AppDelegate.swift b/SakaiClientiOS/AppDelegate.swift index 95746e6..05d4e47 100644 --- a/SakaiClientiOS/AppDelegate.swift +++ b/SakaiClientiOS/AppDelegate.swift @@ -29,7 +29,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } func applicationDidEnterBackground(_ application: UIApplication) { - + FileManager.default.clearDocumentsDirectory() } func applicationWillEnterForeground(_ application: UIApplication) { @@ -48,8 +48,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } func applicationWillTerminate(_ application: UIApplication) { - // Called when the application is about to terminate. Save data if - // appropriate. See also applicationDidEnterBackground:. + } func application(_ application: UIApplication, diff --git a/SakaiClientiOS/Info.plist b/SakaiClientiOS/Info.plist index 5f7a408..0264c40 100644 --- a/SakaiClientiOS/Info.plist +++ b/SakaiClientiOS/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 0.2.0 CFBundleVersion - 1454 + 1460 LSRequiresIPhoneOS NSAppTransportSecurity diff --git a/SakaiClientiOS/Models/Networking/DownloadService.swift b/SakaiClientiOS/Models/Networking/DownloadService.swift index d40e306..f07073f 100644 --- a/SakaiClientiOS/Models/Networking/DownloadService.swift +++ b/SakaiClientiOS/Models/Networking/DownloadService.swift @@ -20,3 +20,25 @@ protocol DownloadService { completion: @escaping (_ fileDestination: URL?) -> Void ) } + +extension FileManager { + func clearDocumentsDirectory() { + do { + guard + let documentsUrl = FileManager.default.urls(for: .documentDirectory, + in: .userDomainMask).first + else { + return + } + let documentDirectory = try contentsOfDirectory(atPath: documentsUrl.path) + try documentDirectory.forEach { file in + let fileUrl = documentsUrl.appendingPathComponent(file) + try removeItem(atPath: fileUrl.path) + } + } catch let err { + // TODO handle appropriately + print(err) + return + } + } +}