Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Removing old documents directory cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
soner-yuksel committed Nov 14, 2023
1 parent 33781d7 commit 7be9412
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions Sources/Brave/Migration/Migration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ public class Migration {
Preferences.migratePreferences(keyPrefix: keyPrefix)
Preferences.migrateWalletPreferences()
Preferences.migrateAdAndTrackingProtection()

if !Preferences.Migration.documentsDirectoryCleanupCompleted.value {
documentsDirectoryCleanup()
Preferences.Migration.documentsDirectoryCleanupCompleted.value = true
}

if Preferences.General.isFirstLaunch.value {
if UIDevice.current.userInterfaceIdiom == .phone {
Expand Down Expand Up @@ -57,18 +52,6 @@ public class Migration {

braveCore.syncAPI.enableSyncTypes(syncProfileService: braveCore.syncProfileService)
}

/// Adblock files don't have to be moved, they now have a new directory and will be downloaded there.
/// Downloads folder was nefer used before, it's a leftover from FF.
private func documentsDirectoryCleanup() {
FileManager.default.removeFolder(withName: "abp-data", location: .documentDirectory)
FileManager.default.removeFolder(withName: "https-everywhere-data", location: .documentDirectory)

FileManager.default.moveFile(
sourceName: "CookiesData.json", sourceLocation: .documentDirectory,
destinationName: "CookiesData.json",
destinationLocation: .applicationSupportDirectory)
}

// Migrate from TabMO to SessionTab and SessionWindow
public static func migrateTabStateToWebkitState(diskImageStore: DiskImageStore?) {
Expand Down Expand Up @@ -212,11 +195,6 @@ fileprivate extension Preferences {
/// Migration preferences
final class Migration {
static let completed = Option<Bool>(key: "migration.completed", default: false)
/// Old app versions were using documents directory to store app files, database, adblock files.
/// These files are now moved to 'Application Support' folder, and documents directory is left
/// for user downloaded files.
static let documentsDirectoryCleanupCompleted =
Option<Bool>(key: "migration.documents-dir-completed", default: false)
// This is new preference introduced in iOS 1.32.3, tracks whether we should perform database migration.
// It should be called only for users who have not completed the migration beforehand.
// The reason for second migration flag is to first do file system migrations like moving database files,
Expand Down

0 comments on commit 7be9412

Please sign in to comment.