Skip to content

Commit 1ed9279

Browse files
Andrey SakAndrey Sak
authored andcommitted
external resources manager
1 parent f7e5445 commit 1ed9279

File tree

8 files changed

+105
-87
lines changed

8 files changed

+105
-87
lines changed

Example/Example.xcodeproj/project.pbxproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
70113E7129C1D01800CBA08B /* VideoEditorModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70113E7029C1D01800CBA08B /* VideoEditorModule.swift */; };
2020
8A32EED0258CB5430098F852 /* bundleEffects in Resources */ = {isa = PBXBuildFile; fileRef = 8A32EECF258CB5430098F852 /* bundleEffects */; };
2121
8A32EEDF258CB70C0098F852 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8A32EEDE258CB70C0098F852 /* Assets.xcassets */; };
22+
DBF5B72E2CC271D900F2FDF2 /* ExternalResourcesManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBF5B72D2CC271CC00F2FDF2 /* ExternalResourcesManager.swift */; };
23+
DBF5B7572CC28E8000F2FDF2 /* bnb-resources.zip in Resources */ = {isa = PBXBuildFile; fileRef = DBF5B7562CC28E8000F2FDF2 /* bnb-resources.zip */; };
2224
/* End PBXBuildFile section */
2325

2426
/* Begin PBXFileReference section */
@@ -41,6 +43,8 @@
4143
8AFC95CF269DC12D00B4114B /* BNBLicenseUtils.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = BNBLicenseUtils.xcframework; sourceTree = "<group>"; };
4244
8D879ADE024EEEC9574AAB2D /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = "<group>"; };
4345
A24378930003F0F910117502 /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
46+
DBF5B72D2CC271CC00F2FDF2 /* ExternalResourcesManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalResourcesManager.swift; sourceTree = "<group>"; };
47+
DBF5B7562CC28E8000F2FDF2 /* bnb-resources.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = "bnb-resources.zip"; sourceTree = "<group>"; };
4448
/* End PBXFileReference section */
4549

4650
/* Begin PBXFrameworksBuildPhase section */
@@ -102,6 +106,8 @@
102106
70113E7029C1D01800CBA08B /* VideoEditorModule.swift */,
103107
636C55232B0DF24100678849 /* PhotoEditorModule.swift */,
104108
639DA00F254700290011C153 /* ViewController.swift */,
109+
DBF5B7562CC28E8000F2FDF2 /* bnb-resources.zip */,
110+
DBF5B72D2CC271CC00F2FDF2 /* ExternalResourcesManager.swift */,
105111
63F7115F29D1F21A00045A06 /* short_music_20.wav */,
106112
634FAC06255C351900FB0DBC /* Localizable.strings */,
107113
639DA011254700290011C153 /* Main.storyboard */,
@@ -176,6 +182,7 @@
176182
634FAC04255C351900FB0DBC /* Localizable.strings in Resources */,
177183
639DA0182547002C0011C153 /* LaunchScreen.storyboard in Resources */,
178184
635DB1AC2548541000B1C799 /* luts in Resources */,
185+
DBF5B7572CC28E8000F2FDF2 /* bnb-resources.zip in Resources */,
179186
639DA013254700290011C153 /* Main.storyboard in Resources */,
180187
8A32EEDF258CB70C0098F852 /* Assets.xcassets in Resources */,
181188
8A32EED0258CB5430098F852 /* bundleEffects in Resources */,
@@ -249,6 +256,7 @@
249256
buildActionMask = 2147483647;
250257
files = (
251258
639DA010254700290011C153 /* ViewController.swift in Sources */,
259+
DBF5B72E2CC271D900F2FDF2 /* ExternalResourcesManager.swift in Sources */,
252260
636C55242B0DF24100678849 /* PhotoEditorModule.swift in Sources */,
253261
70113E7129C1D01800CBA08B /* VideoEditorModule.swift in Sources */,
254262
639DA00C254700290011C153 /* AppDelegate.swift in Sources */,
@@ -411,6 +419,7 @@
411419
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
412420
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
413421
CODE_SIGN_STYLE = Automatic;
422+
CURRENT_PROJECT_VERSION = 2;
414423
DEVELOPMENT_TEAM = 8W9QCBMQCU;
415424
ENABLE_BITCODE = NO;
416425
FRAMEWORK_SEARCH_PATHS = (
@@ -423,6 +432,7 @@
423432
"$(inherited)",
424433
"@executable_path/Frameworks",
425434
);
435+
MARKETING_VERSION = 1.0.0;
426436
ONLY_ACTIVE_ARCH = YES;
427437
PRODUCT_BUNDLE_IDENTIFIER = com.banuba.VESDKSample;
428438
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -440,6 +450,7 @@
440450
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
441451
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
442452
CODE_SIGN_STYLE = Automatic;
453+
CURRENT_PROJECT_VERSION = 2;
443454
DEVELOPMENT_TEAM = 8W9QCBMQCU;
444455
ENABLE_BITCODE = NO;
445456
FRAMEWORK_SEARCH_PATHS = (
@@ -452,6 +463,7 @@
452463
"$(inherited)",
453464
"@executable_path/Frameworks",
454465
);
466+
MARKETING_VERSION = 1.0.0;
455467
ONLY_ACTIVE_ARCH = YES;
456468
PRODUCT_BUNDLE_IDENTIFIER = com.banuba.VESDKSample;
457469
PRODUCT_NAME = "$(TARGET_NAME)";
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// ExternalResourcesManager.swift
3+
// Example
4+
//
5+
// Created by Andrey Sak on 18.10.24.
6+
//
7+
8+
import BNBSdkCore
9+
import BanubaUtilities
10+
11+
class ExternalResourcesManager {
12+
13+
static let shared = ExternalResourcesManager()
14+
15+
private init() {}
16+
17+
let fileManager = FileManager.default
18+
19+
var resourcesBundleLocalURL: URL {
20+
let applicationSupportRoot = fileManager.urls(for: .applicationSupportDirectory, in: .userDomainMask).last!
21+
return applicationSupportRoot.appendingPathComponent("bnb-resources", isDirectory: true)
22+
}
23+
24+
func prepareResources() {
25+
guard let zipURL = Bundle.main.url(forResource: "bnb-resources", withExtension: "zip") else {
26+
print("Unable to locate zip file")
27+
return
28+
}
29+
30+
if !fileManager.fileExists(atPath: resourcesBundleLocalURL.path) {
31+
32+
let isSuccess = SSZipArchive.unzipFile(atPath: zipURL.path, toDestination: resourcesBundleLocalURL.path)
33+
34+
if !isSuccess {
35+
print("Unable to unarchive zip file")
36+
return
37+
}
38+
}
39+
40+
}
41+
}

Example/Example/PhotoEditorModule.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
import BanubaPhotoEditorSDK
1+
import BanubaPhotoEditorSDKLight
2+
import BNBSdkCore
23

34
class PhotoEditorModule {
45
var photoEditorSDK: BanubaPhotoEditor?
56

67
init(token: String) {
7-
let configuration = PhotoEditorConfig()
8+
let configuration = PhotoEditorConfig(
9+
previewScreenMode: .disabled,
10+
resourcesURL: ExternalResourcesManager.shared.resourcesBundleLocalURL
11+
)
812
photoEditorSDK = BanubaPhotoEditor(
913
token: token,
1014
configuration: configuration

Example/Example/VideoEditorModule.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Photos
99
import BSImagePicker
1010
import VEExportSDK
1111
import BanubaAudioBrowserSDK
12+
import BNBSdkCore
1213

1314
// Adopting CountdownView to using in BanubaVideoEditorSDK
1415
extension CountdownView: MusicEditorCountdownAnimatableView {}
@@ -27,6 +28,8 @@ class VideoEditorModule {
2728
configuration: config
2829
)
2930

31+
BNBUtilityManager.addResourcePath(ExternalResourcesManager.shared.resourcesBundleLocalURL.path)
32+
3033
self.videoEditorSDK = videoEditorSDK
3134
}
3235

Example/Example/ViewController.swift

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import UIKit
22
import BanubaVideoEditorSDK
3-
import BanubaPhotoEditorSDK
3+
import BanubaPhotoEditorSDKLight
44

55
import VideoEditor
66
import AVFoundation
@@ -25,6 +25,26 @@ class ViewController: UIViewController, BanubaVideoEditorDelegate, BanubaPhotoEd
2525
// Use “true” if you want users could restore the last video editing session.
2626
private let restoreLastVideoEditingSession: Bool = false
2727

28+
override func viewDidLoad() {
29+
super.viewDidLoad()
30+
31+
32+
let activityIndicator = UIActivityIndicatorView(style: .large)
33+
view.addSubview(activityIndicator)
34+
activityIndicator.center = view.frame.getCenter()
35+
activityIndicator.center.y = view.frame.maxY - activityIndicator.frame.height - 20
36+
activityIndicator.startAnimating()
37+
view.isUserInteractionEnabled = false
38+
39+
Task(priority: .medium) {
40+
ExternalResourcesManager.shared.prepareResources()
41+
Task { @MainActor in
42+
activityIndicator.removeFromSuperview()
43+
view.isUserInteractionEnabled = true
44+
}
45+
}
46+
}
47+
2848
// MARK: - Handle BanubaVideoEditor callbacks
2949
func videoEditorDidCancel(_ videoEditor: BanubaVideoEditor) {
3050
if restoreLastVideoEditingSession == false {
@@ -214,12 +234,12 @@ class ViewController: UIViewController, BanubaVideoEditorDelegate, BanubaPhotoEd
214234

215235
// MARK: - BanubaPhotoEditorDelegate
216236
extension ViewController {
217-
func photoEditorDidCancel(_ photoEditor: BanubaPhotoEditorSDK.BanubaPhotoEditor) {
237+
func photoEditorDidCancel(_ photoEditor: BanubaPhotoEditor) {
218238
print("User has closed the photo editor")
219239
photoEditor.dismissPhotoEditor(animated: true, completion: nil)
220240
}
221241

222-
func photoEditorDidFinishWithImage(_ photoEditor: BanubaPhotoEditorSDK.BanubaPhotoEditor, image: UIImage) {
242+
func photoEditorDidFinishWithImage(_ photoEditor: BanubaPhotoEditor, image: UIImage) {
223243
print("User has saved the edited image")
224244
photoEditor.dismissPhotoEditor(animated: true, completion: nil)
225245
}

Example/Example/bnb-resources.zip

61.9 MB
Binary file not shown.

Example/Podfile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ target 'Example' do
1515
pod 'BanubaARCloudSDK', banuba_sdk_version #optional
1616
pod 'BanubaVideoEditorSDK', banuba_sdk_version
1717
pod 'BanubaAudioBrowserSDK', banuba_sdk_version #optional
18-
pod 'BanubaSDKSimple', banuba_sdk_version
19-
pod 'BanubaSDK', banuba_sdk_version
18+
pod 'BanubaSDKLight', '1.38.0'
2019
pod 'BanubaSDKServicing', banuba_sdk_version
2120
pod 'VideoEditor', banuba_sdk_version
2221
pod 'BanubaUtilities', banuba_sdk_version
@@ -29,9 +28,18 @@ target 'Example' do
2928
pod 'VEEffectsSDK', banuba_sdk_version
3029
pod 'VEPlaybackSDK', banuba_sdk_version
3130

31+
# pod 'BNBEffectPlayer', '1.14.2'
32+
# pod 'BNBScripting', '1.14.2'
33+
# pod 'BNBLips', '1.14.2'
34+
# pod 'BNBHair', '1.14.2'
35+
# pod 'BNBEyes', '1.14.2'
36+
# pod 'BNBBackground', '1.14.2'
37+
# pod 'BNBSkin', '1.14.2'
38+
39+
3240
pod "BSImagePicker"
3341

3442
# Photo Editor
3543

36-
pod 'BanubaPhotoEditorSDK', '1.2.3'
44+
pod 'BanubaPhotoEditorSDKLight', '1.2.4'
3745
end

Example/Podfile.lock

Lines changed: 9 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -2,72 +2,23 @@ PODS:
22
- BanubaARCloudSDK (1.37.1)
33
- BanubaAudioBrowserSDK (1.37.1)
44
- BanubaLicenseServicingSDK (1.37.1)
5-
- BanubaPhotoEditorSDK (1.2.3):
5+
- BanubaPhotoEditorSDKLight (1.2.4):
66
- BanubaLicenseServicingSDK (>= 1.35.5)
77
- BanubaUtilities (>= 1.35.5)
8-
- BNBAcneEyebagsRemoval (~> 1.14.1)
9-
- BNBBackground (~> 1.14.1)
10-
- BNBEffectPlayer (~> 1.14.1)
11-
- BNBEyes (~> 1.14.1)
12-
- BNBHair (~> 1.14.1)
138
- BNBLicenseUtils (>= 1.35.5)
14-
- BNBLips (~> 1.14.1)
15-
- BNBScripting (~> 1.14.1)
169
- BNBSdkApi (~> 1.14.1)
1710
- BNBSdkCore (~> 1.14.1)
18-
- BNBSkin (~> 1.14.1)
19-
- BanubaSDK (1.37.1):
20-
- BNBBackground (~> 1.14.1)
21-
- BNBEffectPlayer (~> 1.14.1)
22-
- BNBEyes (~> 1.14.1)
23-
- BNBHair (~> 1.14.1)
24-
- BNBLips (~> 1.14.1)
25-
- BNBScripting (~> 1.14.1)
11+
- BanubaSDKLight (1.37.5):
2612
- BNBSdkApi (~> 1.14.1)
2713
- BNBSdkCore (~> 1.14.1)
28-
- BNBSkin (~> 1.14.1)
2914
- BanubaSDKServicing (1.37.1)
30-
- BanubaSDKSimple (1.37.1)
3115
- BanubaUtilities (1.37.1)
3216
- BanubaVideoEditorGallerySDK (1.37.1)
3317
- BanubaVideoEditorSDK (1.37.1)
34-
- BNBAcneEyebagsRemoval (1.14.2):
35-
- BNBEffectPlayer (= 1.14.2)
36-
- BNBFaceTracker (= 1.14.2)
37-
- BNBScripting (= 1.14.2)
38-
- BNBSdkCore (= 1.14.2)
39-
- BNBBackground (1.14.2):
40-
- BNBEffectPlayer (= 1.14.2)
41-
- BNBScripting (= 1.14.2)
42-
- BNBSdkCore (= 1.14.2)
43-
- BNBEffectPlayer (1.14.2)
44-
- BNBEyes (1.14.2):
45-
- BNBEffectPlayer (= 1.14.2)
46-
- BNBFaceTracker (= 1.14.2)
47-
- BNBScripting (= 1.14.2)
48-
- BNBSdkCore (= 1.14.2)
49-
- BNBFaceTracker (1.14.2):
50-
- BNBEffectPlayer (= 1.14.2)
51-
- BNBScripting (= 1.14.2)
52-
- BNBSdkCore (= 1.14.2)
53-
- BNBHair (1.14.2):
54-
- BNBEffectPlayer (= 1.14.2)
55-
- BNBScripting (= 1.14.2)
56-
- BNBSdkCore (= 1.14.2)
5718
- BNBLicenseUtils (1.37.1)
58-
- BNBLips (1.14.2):
59-
- BNBEffectPlayer (= 1.14.2)
60-
- BNBFaceTracker (= 1.14.2)
61-
- BNBScripting (= 1.14.2)
62-
- BNBSdkCore (= 1.14.2)
63-
- BNBScripting (1.14.2)
6419
- BNBSdkApi (1.14.2):
6520
- BNBSdkCore (= 1.14.2)
6621
- BNBSdkCore (1.14.2)
67-
- BNBSkin (1.14.2):
68-
- BNBEffectPlayer (= 1.14.2)
69-
- BNBScripting (= 1.14.2)
70-
- BNBSdkCore (= 1.14.2)
7122
- BSImagePicker (3.3.3)
7223
- VEEffectsSDK (1.37.1)
7324
- VEExportSDK (1.37.1)
@@ -78,10 +29,9 @@ DEPENDENCIES:
7829
- BanubaARCloudSDK (= 1.37.1)
7930
- BanubaAudioBrowserSDK (= 1.37.1)
8031
- BanubaLicenseServicingSDK (= 1.37.1)
81-
- BanubaPhotoEditorSDK (= 1.2.3)
82-
- BanubaSDK (= 1.37.1)
32+
- BanubaPhotoEditorSDKLight (= 1.2.4)
33+
- BanubaSDKLight (= 1.38.0)
8334
- BanubaSDKServicing (= 1.37.1)
84-
- BanubaSDKSimple (= 1.37.1)
8535
- BanubaUtilities (= 1.37.1)
8636
- BanubaVideoEditorGallerySDK (= 1.37.1)
8737
- BanubaVideoEditorSDK (= 1.37.1)
@@ -97,10 +47,9 @@ SPEC REPOS:
9747
- BanubaARCloudSDK
9848
- BanubaAudioBrowserSDK
9949
- BanubaLicenseServicingSDK
100-
- BanubaPhotoEditorSDK
101-
- BanubaSDK
50+
- BanubaPhotoEditorSDKLight
51+
- BanubaSDKLight
10252
- BanubaSDKServicing
103-
- BanubaSDKSimple
10453
- BanubaUtilities
10554
- BanubaVideoEditorGallerySDK
10655
- BanubaVideoEditorSDK
@@ -110,49 +59,30 @@ SPEC REPOS:
11059
- VEPlaybackSDK
11160
- VideoEditor
11261
https://github.com/sdk-banuba/banuba-sdk-podspecs.git:
113-
- BNBAcneEyebagsRemoval
114-
- BNBBackground
115-
- BNBEffectPlayer
116-
- BNBEyes
117-
- BNBFaceTracker
118-
- BNBHair
119-
- BNBLips
120-
- BNBScripting
12162
- BNBSdkApi
12263
- BNBSdkCore
123-
- BNBSkin
12464
trunk:
12565
- BSImagePicker
12666

12767
SPEC CHECKSUMS:
12868
BanubaARCloudSDK: 28fffa85e02e8de929de61ace4c952eb27acaf25
12969
BanubaAudioBrowserSDK: 4dbb333bfa737de2a97ee21602db27b6daa1133d
13070
BanubaLicenseServicingSDK: 81882cd6fbe927b945d918f147c4d371e9002d90
131-
BanubaPhotoEditorSDK: cc6d999829bcfc58d263a0992ed61518d3962267
132-
BanubaSDK: a23b46ede1912f42b53eaadff879dd90682b7c12
71+
BanubaPhotoEditorSDKLight: 309dbdd3b175ff46165cfb39f8280a7eed02ae32
72+
BanubaSDKLight: c80f68492fe3b7a7e133de540c0f47bc0222c22f
13373
BanubaSDKServicing: 77fd85e08755a9a86a5e97089f1ed483d9fd4e97
134-
BanubaSDKSimple: 4c108aa916996d4d038106711266a80527400d50
13574
BanubaUtilities: b3fb4b333415892638b035cfb72c125715882436
13675
BanubaVideoEditorGallerySDK: 2bd502c5427ede1b44f0abfb30763e8c6bf81c31
13776
BanubaVideoEditorSDK: 32a12671ed6a620e009f9400e9ab17224bfa50c1
138-
BNBAcneEyebagsRemoval: ed7554ecc8dc7c8b4716e5aa48b8275423d64b29
139-
BNBBackground: ca29dc26acd50be890a7a65c78540be65e2c7448
140-
BNBEffectPlayer: 4a1bc6579d19c41ba9b4c49c9aba979d1c873464
141-
BNBEyes: ade036243d9f2cca81946c19c3ea2be145d8fea2
142-
BNBFaceTracker: 555de45ab376c4e07fb7f1bd7b093891e4d6c680
143-
BNBHair: a79ab74a0c0c7386d2623e03147450833af64507
14477
BNBLicenseUtils: 4c3c2e6ec90b743e4f633641a9cdc063d07180d9
145-
BNBLips: 4548a9ab1be43a67beaed67a4c51dde59ad9730d
146-
BNBScripting: 8ca85618df16c24b47a04cf9cba82d175d4bd4cb
14778
BNBSdkApi: c86bbb2a1286e27f08d86dbceabadcfccf5237ce
14879
BNBSdkCore: 5d4ac8e8ba51a032720057da736cb060b3ff6986
149-
BNBSkin: f7c0e200fad3f3195ae102d4b437fbe1e5f2f82c
15080
BSImagePicker: 57900b323f951711608acaf97d52e9183530cb6d
15181
VEEffectsSDK: 71d9f4e28afc4a651816a9ea7f5debba6bf6b876
15282
VEExportSDK: 295b85ea0f0b224616e2998c54bd3b8385f00cc9
15383
VEPlaybackSDK: 98fdab6ebd1e86dea3360c462308366a0e80a7db
15484
VideoEditor: fbaeba96f6d478d7cf77669c0ca21ecf47693c97
15585

156-
PODFILE CHECKSUM: 2ffd73fe8f3baad7f20aa527ff95bd63ba6a2ad8
86+
PODFILE CHECKSUM: ffe1d22e4f0aca48aa736ed8e0e6dbf5d71660b6
15787

15888
COCOAPODS: 1.15.2

0 commit comments

Comments
 (0)