Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental min size #215

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -41,6 +43,8 @@
8AFC95CF269DC12D00B4114B /* BNBLicenseUtils.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = BNBLicenseUtils.xcframework; sourceTree = "<group>"; };
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>"; };
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 = "<group>"; };
DBF5B7562CC28E8000F2FDF2 /* bnb-resources.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = "bnb-resources.zip"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand Down Expand Up @@ -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 */,
Expand Down
46 changes: 46 additions & 0 deletions Example/Example/ExternalResourcesManager.swift
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
}
}
}
}
10 changes: 8 additions & 2 deletions Example/Example/PhotoEditorModule.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import BanubaPhotoEditorSDK
import BanubaPhotoEditorSDKLight
import BNBSdkCore

class PhotoEditorModule {
var photoEditorSDK: BanubaPhotoEditor?

init(token: String) {
let configuration = PhotoEditorConfig()
let configuration = PhotoEditorConfig(
previewScreenMode: .disabled,
beautyMaskURL: ExternalResourcesManager.shared.resourcesBundleLocalURL.appendingPathComponent("photo_editor"),
effectPlayerResourcesURL: ExternalResourcesManager.shared.resourcesBundleLocalURL

)
photoEditorSDK = BanubaPhotoEditor(
token: token,
configuration: configuration
Expand Down
3 changes: 3 additions & 0 deletions Example/Example/VideoEditorModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Photos
import BSImagePicker
import VEExportSDK
import BanubaAudioBrowserSDK
import BNBSdkCore

// Adopting CountdownView to using in BanubaVideoEditorSDK
extension CountdownView: MusicEditorCountdownAnimatableView {}
Expand All @@ -27,6 +28,8 @@ class VideoEditorModule {
configuration: config
)

BNBUtilityManager.addResourcePath(ExternalResourcesManager.shared.resourcesBundleLocalURL.path)

self.videoEditorSDK = videoEditorSDK
}

Expand Down
26 changes: 23 additions & 3 deletions Example/Example/ViewController.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import UIKit
import BanubaVideoEditorSDK
import BanubaPhotoEditorSDK
import BanubaPhotoEditorSDKLight

import VideoEditor
import AVFoundation
Expand All @@ -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 {
Expand Down Expand Up @@ -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)
}
Expand Down
Binary file added Example/Example/bnb-resources.zip
Binary file not shown.
8 changes: 4 additions & 4 deletions Example/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ inhibit_all_warnings!

target 'Example' do

banuba_sdk_version = '1.37.1'
banuba_sdk_version = '1.39.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
Expand All @@ -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.5'
end
Loading