diff --git a/Example/Example.xcodeproj/project.pbxproj b/Example/Example.xcodeproj/project.pbxproj index f65a48d..8ad8c45 100644 --- a/Example/Example.xcodeproj/project.pbxproj +++ b/Example/Example.xcodeproj/project.pbxproj @@ -19,6 +19,8 @@ 70113E7129C1D01800CBA08B /* VideoEditorModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70113E7029C1D01800CBA08B /* VideoEditorModule.swift */; }; 8A32EED0258CB5430098F852 /* bundleEffects in Resources */ = {isa = PBXBuildFile; fileRef = 8A32EECF258CB5430098F852 /* bundleEffects */; }; 8A32EEDF258CB70C0098F852 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8A32EEDE258CB70C0098F852 /* Assets.xcassets */; }; + DBF5B72E2CC271D900F2FDF2 /* ExternalResourcesManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBF5B72D2CC271CC00F2FDF2 /* ExternalResourcesManager.swift */; }; + DBF5B7572CC28E8000F2FDF2 /* bnb-resources.zip in Resources */ = {isa = PBXBuildFile; fileRef = DBF5B7562CC28E8000F2FDF2 /* bnb-resources.zip */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -41,6 +43,8 @@ 8AFC95CF269DC12D00B4114B /* BNBLicenseUtils.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = BNBLicenseUtils.xcframework; sourceTree = ""; }; 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 = ""; }; A24378930003F0F910117502 /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + DBF5B72D2CC271CC00F2FDF2 /* ExternalResourcesManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalResourcesManager.swift; sourceTree = ""; }; + DBF5B7562CC28E8000F2FDF2 /* bnb-resources.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = "bnb-resources.zip"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -102,6 +106,8 @@ 70113E7029C1D01800CBA08B /* VideoEditorModule.swift */, 636C55232B0DF24100678849 /* PhotoEditorModule.swift */, 639DA00F254700290011C153 /* ViewController.swift */, + DBF5B7562CC28E8000F2FDF2 /* bnb-resources.zip */, + DBF5B72D2CC271CC00F2FDF2 /* ExternalResourcesManager.swift */, 63F7115F29D1F21A00045A06 /* short_music_20.wav */, 634FAC06255C351900FB0DBC /* Localizable.strings */, 639DA011254700290011C153 /* Main.storyboard */, @@ -176,6 +182,7 @@ 634FAC04255C351900FB0DBC /* Localizable.strings in Resources */, 639DA0182547002C0011C153 /* LaunchScreen.storyboard in Resources */, 635DB1AC2548541000B1C799 /* luts in Resources */, + DBF5B7572CC28E8000F2FDF2 /* bnb-resources.zip in Resources */, 639DA013254700290011C153 /* Main.storyboard in Resources */, 8A32EEDF258CB70C0098F852 /* Assets.xcassets in Resources */, 8A32EED0258CB5430098F852 /* bundleEffects in Resources */, @@ -249,6 +256,7 @@ buildActionMask = 2147483647; files = ( 639DA010254700290011C153 /* ViewController.swift in Sources */, + DBF5B72E2CC271D900F2FDF2 /* ExternalResourcesManager.swift in Sources */, 636C55242B0DF24100678849 /* PhotoEditorModule.swift in Sources */, 70113E7129C1D01800CBA08B /* VideoEditorModule.swift in Sources */, 639DA00C254700290011C153 /* AppDelegate.swift in Sources */, diff --git a/Example/Example/ExternalResourcesManager.swift b/Example/Example/ExternalResourcesManager.swift new file mode 100644 index 0000000..a094d62 --- /dev/null +++ b/Example/Example/ExternalResourcesManager.swift @@ -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 + } + } + } +} diff --git a/Example/Example/PhotoEditorModule.swift b/Example/Example/PhotoEditorModule.swift index 144a403..b12c9a2 100644 --- a/Example/Example/PhotoEditorModule.swift +++ b/Example/Example/PhotoEditorModule.swift @@ -1,10 +1,14 @@ -import BanubaPhotoEditorSDK +import BanubaPhotoEditorSDKLight +import BNBSdkCore class PhotoEditorModule { var photoEditorSDK: BanubaPhotoEditor? init(token: String) { - let configuration = PhotoEditorConfig() + let configuration = PhotoEditorConfig( + previewScreenMode: .disabled, + resourcesURL: ExternalResourcesManager.shared.resourcesBundleLocalURL + ) photoEditorSDK = BanubaPhotoEditor( token: token, configuration: configuration diff --git a/Example/Example/VideoEditorModule.swift b/Example/Example/VideoEditorModule.swift index c9ce2a1..18218f4 100644 --- a/Example/Example/VideoEditorModule.swift +++ b/Example/Example/VideoEditorModule.swift @@ -9,6 +9,7 @@ import Photos import BSImagePicker import VEExportSDK import BanubaAudioBrowserSDK +import BNBSdkCore // Adopting CountdownView to using in BanubaVideoEditorSDK extension CountdownView: MusicEditorCountdownAnimatableView {} @@ -27,6 +28,8 @@ class VideoEditorModule { configuration: config ) + BNBUtilityManager.addResourcePath(ExternalResourcesManager.shared.resourcesBundleLocalURL.path) + self.videoEditorSDK = videoEditorSDK } diff --git a/Example/Example/ViewController.swift b/Example/Example/ViewController.swift index aaa0d67..ce90ee5 100644 --- a/Example/Example/ViewController.swift +++ b/Example/Example/ViewController.swift @@ -1,6 +1,6 @@ import UIKit import BanubaVideoEditorSDK -import BanubaPhotoEditorSDK +import BanubaPhotoEditorSDKLight import VideoEditor import AVFoundation @@ -25,6 +25,26 @@ class ViewController: UIViewController, BanubaVideoEditorDelegate, BanubaPhotoEd // Use “true” if you want users could restore the last video editing session. private let restoreLastVideoEditingSession: Bool = false + override func viewDidLoad() { + super.viewDidLoad() + + + let activityIndicator = UIActivityIndicatorView(style: .large) + view.addSubview(activityIndicator) + activityIndicator.center = view.frame.getCenter() + activityIndicator.center.y = view.frame.maxY - activityIndicator.frame.height - 20 + activityIndicator.startAnimating() + view.isUserInteractionEnabled = false + + Task(priority: .medium) { + ExternalResourcesManager.shared.prepareResources() + Task { @MainActor in + activityIndicator.removeFromSuperview() + view.isUserInteractionEnabled = true + } + } + } + // MARK: - Handle BanubaVideoEditor callbacks func videoEditorDidCancel(_ videoEditor: BanubaVideoEditor) { if restoreLastVideoEditingSession == false { @@ -214,12 +234,12 @@ class ViewController: UIViewController, BanubaVideoEditorDelegate, BanubaPhotoEd // MARK: - BanubaPhotoEditorDelegate extension ViewController { - func photoEditorDidCancel(_ photoEditor: BanubaPhotoEditorSDK.BanubaPhotoEditor) { + func photoEditorDidCancel(_ photoEditor: BanubaPhotoEditor) { print("User has closed the photo editor") photoEditor.dismissPhotoEditor(animated: true, completion: nil) } - func photoEditorDidFinishWithImage(_ photoEditor: BanubaPhotoEditorSDK.BanubaPhotoEditor, image: UIImage) { + func photoEditorDidFinishWithImage(_ photoEditor: BanubaPhotoEditor, image: UIImage) { print("User has saved the edited image") photoEditor.dismissPhotoEditor(animated: true, completion: nil) } diff --git a/Example/Example/bnb-resources.zip b/Example/Example/bnb-resources.zip new file mode 100644 index 0000000..330d7e4 Binary files /dev/null and b/Example/Example/bnb-resources.zip differ diff --git a/Example/Podfile b/Example/Podfile index 61bf751..e60955a 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -8,15 +8,14 @@ inhibit_all_warnings! target 'Example' do - banuba_sdk_version = '1.37.1' + banuba_sdk_version = '1.38.0' # Video Editor pod 'BanubaARCloudSDK', banuba_sdk_version #optional pod 'BanubaVideoEditorSDK', banuba_sdk_version pod 'BanubaAudioBrowserSDK', banuba_sdk_version #optional - pod 'BanubaSDKSimple', banuba_sdk_version - pod 'BanubaSDK', banuba_sdk_version + pod 'BanubaSDKLight', banuba_sdk_version pod 'BanubaSDKServicing', banuba_sdk_version pod 'VideoEditor', banuba_sdk_version pod 'BanubaUtilities', banuba_sdk_version @@ -28,10 +27,11 @@ target 'Example' do pod 'VEExportSDK', banuba_sdk_version pod 'VEEffectsSDK', banuba_sdk_version pod 'VEPlaybackSDK', banuba_sdk_version + pod "BSImagePicker" # Photo Editor - pod 'BanubaPhotoEditorSDK', '1.2.3' + pod 'BanubaPhotoEditorSDKLight', '1.2.4' end diff --git a/Example/Podfile.lock b/Example/Podfile.lock index d4d3532..7f6164f 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,106 +1,55 @@ PODS: - - BanubaARCloudSDK (1.37.1) - - BanubaAudioBrowserSDK (1.37.1) - - BanubaLicenseServicingSDK (1.37.1) - - BanubaPhotoEditorSDK (1.2.3): + - BanubaARCloudSDK (1.38.0) + - BanubaAudioBrowserSDK (1.38.0) + - BanubaLicenseServicingSDK (1.38.0) + - BanubaPhotoEditorSDKLight (1.2.4): - BanubaLicenseServicingSDK (>= 1.35.5) - BanubaUtilities (>= 1.35.5) - - BNBAcneEyebagsRemoval (~> 1.14.1) - - BNBBackground (~> 1.14.1) - - BNBEffectPlayer (~> 1.14.1) - - BNBEyes (~> 1.14.1) - - BNBHair (~> 1.14.1) - BNBLicenseUtils (>= 1.35.5) - - BNBLips (~> 1.14.1) - - BNBScripting (~> 1.14.1) - BNBSdkApi (~> 1.14.1) - BNBSdkCore (~> 1.14.1) - - BNBSkin (~> 1.14.1) - - BanubaSDK (1.37.1): - - BNBBackground (~> 1.14.1) - - BNBEffectPlayer (~> 1.14.1) - - BNBEyes (~> 1.14.1) - - BNBHair (~> 1.14.1) - - BNBLips (~> 1.14.1) - - BNBScripting (~> 1.14.1) + - BanubaSDKLight (1.37.5): - BNBSdkApi (~> 1.14.1) - BNBSdkCore (~> 1.14.1) - - BNBSkin (~> 1.14.1) - - BanubaSDKServicing (1.37.1) - - BanubaSDKSimple (1.37.1) - - BanubaUtilities (1.37.1) - - BanubaVideoEditorGallerySDK (1.37.1) - - BanubaVideoEditorSDK (1.37.1) - - BNBAcneEyebagsRemoval (1.14.2): - - BNBEffectPlayer (= 1.14.2) - - BNBFaceTracker (= 1.14.2) - - BNBScripting (= 1.14.2) - - BNBSdkCore (= 1.14.2) - - BNBBackground (1.14.2): - - BNBEffectPlayer (= 1.14.2) - - BNBScripting (= 1.14.2) - - BNBSdkCore (= 1.14.2) - - BNBEffectPlayer (1.14.2) - - BNBEyes (1.14.2): - - BNBEffectPlayer (= 1.14.2) - - BNBFaceTracker (= 1.14.2) - - BNBScripting (= 1.14.2) - - BNBSdkCore (= 1.14.2) - - BNBFaceTracker (1.14.2): - - BNBEffectPlayer (= 1.14.2) - - BNBScripting (= 1.14.2) - - BNBSdkCore (= 1.14.2) - - BNBHair (1.14.2): - - BNBEffectPlayer (= 1.14.2) - - BNBScripting (= 1.14.2) - - BNBSdkCore (= 1.14.2) - - BNBLicenseUtils (1.37.1) - - BNBLips (1.14.2): - - BNBEffectPlayer (= 1.14.2) - - BNBFaceTracker (= 1.14.2) - - BNBScripting (= 1.14.2) - - BNBSdkCore (= 1.14.2) - - BNBScripting (1.14.2) + - BanubaSDKServicing (1.38.0) + - BanubaUtilities (1.38.0) + - BanubaVideoEditorGallerySDK (1.38.0) + - BanubaVideoEditorSDK (1.38.0) + - BNBLicenseUtils (1.38.0) - BNBSdkApi (1.14.2): - BNBSdkCore (= 1.14.2) - BNBSdkCore (1.14.2) - - BNBSkin (1.14.2): - - BNBEffectPlayer (= 1.14.2) - - BNBScripting (= 1.14.2) - - BNBSdkCore (= 1.14.2) - BSImagePicker (3.3.3) - - VEEffectsSDK (1.37.1) - - VEExportSDK (1.37.1) - - VEPlaybackSDK (1.37.1) - - VideoEditor (1.37.1) + - VEEffectsSDK (1.38.0) + - VEExportSDK (1.38.0) + - VEPlaybackSDK (1.38.0) + - VideoEditor (1.38.0) DEPENDENCIES: - - BanubaARCloudSDK (= 1.37.1) - - BanubaAudioBrowserSDK (= 1.37.1) - - BanubaLicenseServicingSDK (= 1.37.1) - - BanubaPhotoEditorSDK (= 1.2.3) - - BanubaSDK (= 1.37.1) - - BanubaSDKServicing (= 1.37.1) - - BanubaSDKSimple (= 1.37.1) - - BanubaUtilities (= 1.37.1) - - BanubaVideoEditorGallerySDK (= 1.37.1) - - BanubaVideoEditorSDK (= 1.37.1) - - BNBLicenseUtils (= 1.37.1) + - BanubaARCloudSDK (= 1.38.0) + - BanubaAudioBrowserSDK (= 1.38.0) + - BanubaLicenseServicingSDK (= 1.38.0) + - BanubaPhotoEditorSDKLight (= 1.2.4) + - BanubaSDKLight (= 1.38.0) + - BanubaSDKServicing (= 1.38.0) + - BanubaUtilities (= 1.38.0) + - BanubaVideoEditorGallerySDK (= 1.38.0) + - BanubaVideoEditorSDK (= 1.38.0) + - BNBLicenseUtils (= 1.38.0) - BSImagePicker - - VEEffectsSDK (= 1.37.1) - - VEExportSDK (= 1.37.1) - - VEPlaybackSDK (= 1.37.1) - - VideoEditor (= 1.37.1) + - VEEffectsSDK (= 1.38.0) + - VEExportSDK (= 1.38.0) + - VEPlaybackSDK (= 1.38.0) + - VideoEditor (= 1.38.0) SPEC REPOS: https://github.com/Banuba/specs.git: - BanubaARCloudSDK - BanubaAudioBrowserSDK - BanubaLicenseServicingSDK - - BanubaPhotoEditorSDK - - BanubaSDK + - BanubaPhotoEditorSDKLight + - BanubaSDKLight - BanubaSDKServicing - - BanubaSDKSimple - BanubaUtilities - BanubaVideoEditorGallerySDK - BanubaVideoEditorSDK @@ -110,49 +59,30 @@ SPEC REPOS: - VEPlaybackSDK - VideoEditor https://github.com/sdk-banuba/banuba-sdk-podspecs.git: - - BNBAcneEyebagsRemoval - - BNBBackground - - BNBEffectPlayer - - BNBEyes - - BNBFaceTracker - - BNBHair - - BNBLips - - BNBScripting - BNBSdkApi - BNBSdkCore - - BNBSkin trunk: - BSImagePicker SPEC CHECKSUMS: - BanubaARCloudSDK: 28fffa85e02e8de929de61ace4c952eb27acaf25 - BanubaAudioBrowserSDK: 4dbb333bfa737de2a97ee21602db27b6daa1133d - BanubaLicenseServicingSDK: 81882cd6fbe927b945d918f147c4d371e9002d90 - BanubaPhotoEditorSDK: cc6d999829bcfc58d263a0992ed61518d3962267 - BanubaSDK: a23b46ede1912f42b53eaadff879dd90682b7c12 - BanubaSDKServicing: 77fd85e08755a9a86a5e97089f1ed483d9fd4e97 - BanubaSDKSimple: 4c108aa916996d4d038106711266a80527400d50 - BanubaUtilities: b3fb4b333415892638b035cfb72c125715882436 - BanubaVideoEditorGallerySDK: 2bd502c5427ede1b44f0abfb30763e8c6bf81c31 - BanubaVideoEditorSDK: 32a12671ed6a620e009f9400e9ab17224bfa50c1 - BNBAcneEyebagsRemoval: ed7554ecc8dc7c8b4716e5aa48b8275423d64b29 - BNBBackground: ca29dc26acd50be890a7a65c78540be65e2c7448 - BNBEffectPlayer: 4a1bc6579d19c41ba9b4c49c9aba979d1c873464 - BNBEyes: ade036243d9f2cca81946c19c3ea2be145d8fea2 - BNBFaceTracker: 555de45ab376c4e07fb7f1bd7b093891e4d6c680 - BNBHair: a79ab74a0c0c7386d2623e03147450833af64507 - BNBLicenseUtils: 4c3c2e6ec90b743e4f633641a9cdc063d07180d9 - BNBLips: 4548a9ab1be43a67beaed67a4c51dde59ad9730d - BNBScripting: 8ca85618df16c24b47a04cf9cba82d175d4bd4cb + BanubaARCloudSDK: 630705c0d0e9036d5bb5c09ac81d06d80acd655a + BanubaAudioBrowserSDK: c16d2b2a0f49e7b90bce1c58ef40a04d371c0e66 + BanubaLicenseServicingSDK: c4e0f919cf1e363ff8f0922ec411fa7cd35cd75c + BanubaPhotoEditorSDKLight: 309dbdd3b175ff46165cfb39f8280a7eed02ae32 + BanubaSDKLight: c80f68492fe3b7a7e133de540c0f47bc0222c22f + BanubaSDKServicing: 57f199cfed87eeaa8021aa1ed9fe48b54b463bc4 + BanubaUtilities: d0024abe7bc39d8b7fa94a1839f0377a900c3baa + BanubaVideoEditorGallerySDK: d81de9ad81713c8c0e96256d90af60f4dee8b1e9 + BanubaVideoEditorSDK: abc6e368bec07d938cc61f789c451641b3156e90 + BNBLicenseUtils: 3d034fd6efbc8b5276e4b46c72b34d2ec759d67d BNBSdkApi: c86bbb2a1286e27f08d86dbceabadcfccf5237ce BNBSdkCore: 5d4ac8e8ba51a032720057da736cb060b3ff6986 - BNBSkin: f7c0e200fad3f3195ae102d4b437fbe1e5f2f82c BSImagePicker: 57900b323f951711608acaf97d52e9183530cb6d - VEEffectsSDK: 71d9f4e28afc4a651816a9ea7f5debba6bf6b876 - VEExportSDK: 295b85ea0f0b224616e2998c54bd3b8385f00cc9 - VEPlaybackSDK: 98fdab6ebd1e86dea3360c462308366a0e80a7db - VideoEditor: fbaeba96f6d478d7cf77669c0ca21ecf47693c97 + VEEffectsSDK: 8abe358e29ee64bf0df88bf07078f40c93b0a138 + VEExportSDK: 3f68b6e61617fb105151138f9ed289be61e24768 + VEPlaybackSDK: d5024002d81ad1933408d9b415667ca2dd299012 + VideoEditor: 1a4afa254dabe0b35d452ad5a0e679d128601f09 -PODFILE CHECKSUM: 2ffd73fe8f3baad7f20aa527ff95bd63ba6a2ad8 +PODFILE CHECKSUM: 3b136af839342fd9a5df4f0920eccc6fbe6ca4fc COCOAPODS: 1.15.2