-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Andrey Sak
authored and
Andrey Sak
committed
Oct 23, 2024
1 parent
f7e5445
commit 0b0cc83
Showing
8 changed files
with
135 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// ExternalResourcesManager.swift | ||
// Example | ||
// | ||
// Created by Andrey Sak on 18.10.24. | ||
// | ||
|
||
import BNBSdkCore | ||
import BanubaUtilities | ||
|
||
class ExternalResourcesManager { | ||
|
||
static let shared = ExternalResourcesManager() | ||
|
||
private init() {} | ||
|
||
let fileManager = FileManager.default | ||
|
||
var resourcesBundleLocalURL: URL { | ||
let applicationSupportRoot = fileManager.urls( | ||
for: .applicationSupportDirectory, | ||
in: .userDomainMask | ||
).last! | ||
return applicationSupportRoot.appendingPathComponent("bnb-resources", isDirectory: true) | ||
} | ||
|
||
func prepareResources() { | ||
guard let zipURL = Bundle.main.url(forResource: "bnb-resources", withExtension: "zip") else { | ||
print("Unable to locate zip file") | ||
return | ||
} | ||
|
||
if !fileManager.fileExists(atPath: resourcesBundleLocalURL.path) { | ||
|
||
let isSuccess = SSZipArchive.unzipFile( | ||
atPath: zipURL.path, | ||
toDestination: resourcesBundleLocalURL.path | ||
) | ||
|
||
if !isSuccess { | ||
print("Unable to unarchive zip file") | ||
return | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters