From d2e8c5f86ea3423f66a37930dd4670b538818b29 Mon Sep 17 00:00:00 2001 From: Kwangsoo Yeo Date: Fri, 3 Nov 2023 15:17:36 -0700 Subject: [PATCH 1/7] initial eagle v0.2 ios changes --- binding/ios/Eagle-iOS.podspec | 6 ++-- binding/ios/Eagle.swift | 11 +++++-- binding/ios/EagleBase.swift | 54 +++++++++++++++++++++++++-------- binding/ios/EagleErrors.swift | 17 ++++++----- binding/ios/EagleProfiler.swift | 20 ++++++++---- 5 files changed, 76 insertions(+), 32 deletions(-) diff --git a/binding/ios/Eagle-iOS.podspec b/binding/ios/Eagle-iOS.podspec index f1035802..54c1fe4f 100644 --- a/binding/ios/Eagle-iOS.podspec +++ b/binding/ios/Eagle-iOS.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'Eagle-iOS' s.module_name = 'Eagle' - s.version = '0.1.0' + s.version = '0.2.0' s.license = {:type => 'Apache 2.0'} s.summary = 'iOS binding for Picovoice\'s Eagle speaker recognition engine' s.description = @@ -10,8 +10,8 @@ Pod::Spec.new do |s| DESC s.homepage = 'https://github.com/Picovoice/eagle/tree/master/binding/ios' s.author = { 'Picovoice' => 'hello@picovoice.ai' } - s.source = { :git => "https://github.com/Picovoice/eagle.git", :tag => "Eagle-iOS-v0.1.0" } - s.ios.deployment_target = '11.0' + s.source = { :git => "https://github.com/Picovoice/eagle.git", :tag => "Eagle-iOS-v0.2.0" } + s.ios.deployment_target = '13.0' s.swift_version = '5.0' s.vendored_frameworks = 'lib/ios/PvEagle.xcframework' s.resources = 'lib/common/eagle_params.pv' diff --git a/binding/ios/Eagle.swift b/binding/ios/Eagle.swift index 04c7d476..165da359 100644 --- a/binding/ios/Eagle.swift +++ b/binding/ios/Eagle.swift @@ -57,6 +57,8 @@ public class Eagle: EagleBase { speakerCount = speakerProfiles.count + pv_set_sdk(self.sdk) + let status = pv_eagle_init( accessKey, modelPathArg, @@ -64,7 +66,8 @@ public class Eagle: EagleBase { speakerHandles, &handle) if status != PV_STATUS_SUCCESS { - throw pvStatusToEagleError(status, "Eagle init failed") + let messageStack = try getMessageStack() + throw pvStatusToEagleError(status, "Eagle init failed", messageStack) } } @@ -116,7 +119,8 @@ public class Eagle: EagleBase { scores.baseAddress) if status != PV_STATUS_SUCCESS { - throw pvStatusToEagleError(status, "Eagle process failed") + let messageStack = try getMessageStack() + throw pvStatusToEagleError(status, "Eagle process failed", messageStack) } return Array(scores) @@ -137,7 +141,8 @@ public class Eagle: EagleBase { let status = pv_eagle_reset(handle) if status != PV_STATUS_SUCCESS { - throw pvStatusToEagleError(status, "Eagle reset failed") + let messageStack = try getMessageStack() + throw pvStatusToEagleError(status, "Eagle reset failed", messageStack) } } } diff --git a/binding/ios/EagleBase.swift b/binding/ios/EagleBase.swift index be5274e2..2dca2ad2 100644 --- a/binding/ios/EagleBase.swift +++ b/binding/ios/EagleBase.swift @@ -9,6 +9,12 @@ public class EagleBase { /// Eagle/EagleProfiler version public static let version = String(cString: pv_eagle_version()) + private static var sdk = "ios" + + public static func setSdk(sdk: String) { + self.sdk = sdk + } + /// Given a path, return the full path to the resource. /// /// - Parameters: @@ -31,34 +37,38 @@ public class EagleBase { /// - Parameters: /// - status: C enum value. /// - message: message to include with the EagleError. + /// - messageStack: Error stack returned from Eagle. /// - Returns: An EagleError. - internal func pvStatusToEagleError(_ status: pv_status_t, _ message: String) -> EagleError { + internal func pvStatusToEagleError( + _ status: pv_status_t, + _ message: String, + _ messageStack: [String] = []) -> EagleError { switch status { case PV_STATUS_OUT_OF_MEMORY: - return EagleMemoryError(message) + return EagleMemoryError(message, messageStack) case PV_STATUS_IO_ERROR: - return EagleIOError(message) + return EagleIOError(message, messageStack) case PV_STATUS_INVALID_ARGUMENT: - return EagleInvalidArgumentError(message) + return EagleInvalidArgumentError(message, messageStack) case PV_STATUS_STOP_ITERATION: - return EagleStopIterationError(message) + return EagleStopIterationError(message, messageStack) case PV_STATUS_KEY_ERROR: - return EagleKeyError(message) + return EagleKeyError(message, messageStack) case PV_STATUS_INVALID_STATE: - return EagleInvalidStateError(message) + return EagleInvalidStateError(message, messageStack) case PV_STATUS_RUNTIME_ERROR: - return EagleRuntimeError(message) + return EagleRuntimeError(message, messageStack) case PV_STATUS_ACTIVATION_ERROR: - return EagleActivationError(message) + return EagleActivationError(message, messageStack) case PV_STATUS_ACTIVATION_LIMIT_REACHED: - return EagleActivationLimitError(message) + return EagleActivationLimitError(message, messageStack) case PV_STATUS_ACTIVATION_THROTTLED: - return EagleActivationThrottledError(message) + return EagleActivationThrottledError(message, messageStack) case PV_STATUS_ACTIVATION_REFUSED: - return EagleActivationRefusedError(message) + return EagleActivationRefusedError(message, messageStack) default: let pvStatusString = String(cString: pv_status_to_string(status)) - return EagleError("\(pvStatusString): \(message)") + return EagleError("\(pvStatusString): \(message)", messageStack) } } @@ -84,4 +94,22 @@ public class EagleBase { return EagleProfilerEnrollFeedback.AUDIO_OK } } + + private func getMessageStack() throws -> [String] { + var messageStackRef: UnsafeMutablePointer?>? + var messageStackDepth: Int32 = 0 + let status = pv_get_error_stack(&messageStackRef, &messageStackDepth) + if status != PV_STATUS_SUCCESS { + throw pvStatusToKoalaError(status, "Unable to get Eagle error state") + } + + var messageStack: [String] = [] + for i in 0.. 0 { + messageString += ":" + for i in 0.. Date: Fri, 3 Nov 2023 15:42:05 -0700 Subject: [PATCH 2/7] v0.2 ios --- .../EagleAppTestUITests.swift | 80 +++++++++++++++++++ binding/ios/EagleAppTest/Podfile | 8 +- binding/ios/EagleAppTest/Podfile.lock | 16 ++-- demo/ios/EagleDemo/EagleDemo/ViewModel.swift | 4 +- demo/ios/EagleDemo/Podfile | 2 +- demo/ios/EagleDemo/Podfile.lock | 15 ++-- 6 files changed, 104 insertions(+), 21 deletions(-) diff --git a/binding/ios/EagleAppTest/EagleAppTestUITests/EagleAppTestUITests.swift b/binding/ios/EagleAppTest/EagleAppTestUITests/EagleAppTestUITests.swift index 2e7bd362..2357a89a 100644 --- a/binding/ios/EagleAppTest/EagleAppTestUITests/EagleAppTestUITests.swift +++ b/binding/ios/EagleAppTest/EagleAppTestUITests/EagleAppTestUITests.swift @@ -123,4 +123,84 @@ class EagleAppTestUITests: BaseTest { XCTAssertLessThan(scores.max()!, 0.5) eagle.delete() } + + func testMessageStack() throws { + let enrollUrls = enrollUrls() + + let eagleProfiler = try EagleProfiler(accessKey: accessKey) + for url in enrollUrls { + let pcm = try readPcmFromFile(testAudioURL: url) + (_, _) = try eagleProfiler.enroll(pcm: pcm) + } + + let profile = try eagleProfiler.export() + eagleProfiler.delete() + + var first_error: String = "" + do { + let eagle = try Eagle(accessKey: "invalid", speakerProfiles: [profile]) + XCTAssertNil(eagle) + } catch { + first_error = "\(error.localizedDescription)" + XCTAssert(first_error.count < 1024) + } + + do { + let eagle = try Eagle(accessKey: "invalid", speakerProfiles: [profile]) + XCTAssertNil(eagle) + } catch { + XCTAssert("\(error.localizedDescription)".count == first_error.count) + } + } + + func testEnrollExportMessageStack() throws { + let e = try EagleProfiler.init(accessKey: accessKey) + e.delete() + + var testPcm: [Int16] = [] + testPcm.reserveCapacity(Int(Eagle.frameLength)) + + do { + let (res, _) = try e.enroll(pcm: testPcm) + XCTAssert(res == -1) + } catch { + XCTAssert("\(error.localizedDescription)".count > 0) + XCTAssert("\(error.localizedDescription)".count < 8) + } + + do { + let res = try e.export() + XCTAssertNil(res) + } catch { + XCTAssert("\(error.localizedDescription)".count > 0) + XCTAssert("\(error.localizedDescription)".count < 8) + } + } + + func testProcessMessageStack() throws { + let enrollUrls = enrollUrls() + + let eagleProfiler = try EagleProfiler(accessKey: accessKey) + for url in enrollUrls { + let pcm = try readPcmFromFile(testAudioURL: url) + (_, _) = try eagleProfiler.enroll(pcm: pcm) + } + + let profile = try eagleProfiler.export() + eagleProfiler.delete() + + let e = try Eagle.init(accessKey: accessKey, speakerProfiles: [profile]) + e.delete() + + var testPcm: [Int16] = [] + testPcm.reserveCapacity(Int(Eagle.frameLength)) + + do { + let res = try e.process(pcm: testPcm) + XCTAssert(res.count == -1) + } catch { + XCTAssert("\(error.localizedDescription)".count > 0) + XCTAssert("\(error.localizedDescription)".count < 8) + } + } } diff --git a/binding/ios/EagleAppTest/Podfile b/binding/ios/EagleAppTest/Podfile index 25cfc8b2..ac899177 100644 --- a/binding/ios/EagleAppTest/Podfile +++ b/binding/ios/EagleAppTest/Podfile @@ -1,14 +1,14 @@ source 'https://cdn.cocoapods.org/' -platform :ios, '11.0' +platform :ios, '13.0' target 'EagleAppTest' do - pod 'Eagle-iOS', '~> 0.1.0' + pod 'Eagle-iOS', :podspec => 'https://raw.githubusercontent.com/Picovoice/eagle/v0.2-ios/binding/ios/Eagle-iOS.podspec' end target 'EagleAppTestUITests' do - pod 'Eagle-iOS', '~> 0.1.0' + pod 'Eagle-iOS', :podspec => 'https://raw.githubusercontent.com/Picovoice/eagle/v0.2-ios/binding/ios/Eagle-iOS.podspec' end target 'PerformanceTest' do - pod 'Eagle-iOS', '~> 0.1.0' + pod 'Eagle-iOS', :podspec => 'https://raw.githubusercontent.com/Picovoice/eagle/v0.2-ios/binding/ios/Eagle-iOS.podspec' end diff --git a/binding/ios/EagleAppTest/Podfile.lock b/binding/ios/EagleAppTest/Podfile.lock index f886e1cd..1849c16a 100644 --- a/binding/ios/EagleAppTest/Podfile.lock +++ b/binding/ios/EagleAppTest/Podfile.lock @@ -1,16 +1,16 @@ PODS: - - Eagle-iOS (0.1.0) + - Eagle-iOS (0.2.0) DEPENDENCIES: - - Eagle-iOS (~> 0.1.0) + - Eagle-iOS (from `https://raw.githubusercontent.com/Picovoice/eagle/v0.2-ios/binding/ios/Eagle-iOS.podspec`) -SPEC REPOS: - trunk: - - Eagle-iOS +EXTERNAL SOURCES: + Eagle-iOS: + :podspec: https://raw.githubusercontent.com/Picovoice/eagle/v0.2-ios/binding/ios/Eagle-iOS.podspec SPEC CHECKSUMS: - Eagle-iOS: 2d510466a68b22ba137dd2b39086268c4130c321 + Eagle-iOS: 155eb54e73e37533a0accf3ea5fa1a37d8c999ad -PODFILE CHECKSUM: a3a1c94c7c11252c2152ed23f2cead73c1cf3762 +PODFILE CHECKSUM: 6ecb4b66367607455bddf4dcad4ec1f8c70935a7 -COCOAPODS: 1.12.1 +COCOAPODS: 1.11.3 diff --git a/demo/ios/EagleDemo/EagleDemo/ViewModel.swift b/demo/ios/EagleDemo/EagleDemo/ViewModel.swift index 596c687c..bf6c8cee 100644 --- a/demo/ios/EagleDemo/EagleDemo/ViewModel.swift +++ b/demo/ios/EagleDemo/EagleDemo/ViewModel.swift @@ -74,7 +74,7 @@ class ViewModel: ObservableObject { try createDumpFile(filename: "enroll_dump.pcm") } catch let error as EagleInvalidArgumentError { - errorMessage = "\(error.localizedDescription)\nEnsure your accessKey '\(accessKey)' is valid" + errorMessage = "\(error.localizedDescription)" } catch is EagleActivationError { errorMessage = "AccessKey activation error" } catch is EagleActivationRefusedError { @@ -162,7 +162,7 @@ class ViewModel: ObservableObject { try createDumpFile(filename: "test_dump.pcm") } catch let error as EagleInvalidArgumentError { - errorMessage = "\(error.localizedDescription)\nEnsure your accessKey '\(accessKey)' is valid" + errorMessage = "\(error.localizedDescription)" } catch is EagleActivationError { errorMessage = "AccessKey activation error" } catch is EagleActivationRefusedError { diff --git a/demo/ios/EagleDemo/Podfile b/demo/ios/EagleDemo/Podfile index 23d7ea03..25c750dd 100644 --- a/demo/ios/EagleDemo/Podfile +++ b/demo/ios/EagleDemo/Podfile @@ -2,6 +2,6 @@ source 'https://cdn.cocoapods.org/' platform :ios, '14.0' target 'EagleDemo' do - pod 'Eagle-iOS', '~> 0.1.0' + pod 'Eagle-iOS', :podspec => 'https://raw.githubusercontent.com/Picovoice/eagle/v0.2-ios/binding/ios/Eagle-iOS.podspec' pod 'ios-voice-processor', '~> 1.0.3' end diff --git a/demo/ios/EagleDemo/Podfile.lock b/demo/ios/EagleDemo/Podfile.lock index 1eee8489..652806f8 100644 --- a/demo/ios/EagleDemo/Podfile.lock +++ b/demo/ios/EagleDemo/Podfile.lock @@ -1,20 +1,23 @@ PODS: - - Eagle-iOS (0.1.0) + - Eagle-iOS (0.2.0) - ios-voice-processor (1.0.3) DEPENDENCIES: - - Eagle-iOS (~> 0.1.0) + - Eagle-iOS (from `https://raw.githubusercontent.com/Picovoice/eagle/v0.2-ios/binding/ios/Eagle-iOS.podspec`) - ios-voice-processor (~> 1.0.3) SPEC REPOS: trunk: - - Eagle-iOS - ios-voice-processor +EXTERNAL SOURCES: + Eagle-iOS: + :podspec: https://raw.githubusercontent.com/Picovoice/eagle/v0.2-ios/binding/ios/Eagle-iOS.podspec + SPEC CHECKSUMS: - Eagle-iOS: 2d510466a68b22ba137dd2b39086268c4130c321 + Eagle-iOS: 155eb54e73e37533a0accf3ea5fa1a37d8c999ad ios-voice-processor: 65b25a8db69ea25ffba0eeef37bae71a982f34cc -PODFILE CHECKSUM: bd16b739f521d3070da2020a2446d0cabb973dd0 +PODFILE CHECKSUM: 04795797e862a461d1bfc97cddf986962ba2c8c2 -COCOAPODS: 1.12.1 +COCOAPODS: 1.11.3 From cdb96882726d743764fd2d034ca2d17233743457 Mon Sep 17 00:00:00 2001 From: Kwangsoo Yeo Date: Fri, 3 Nov 2023 15:51:00 -0700 Subject: [PATCH 3/7] fix build --- .github/workflows/ios-demos.yml | 52 +++++++++++++++++++ .../EagleAppTest/ViewController.swift | 8 +-- .../EagleAppTestUITests.swift | 4 +- binding/ios/EagleBase.swift | 2 +- 4 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/ios-demos.yml diff --git a/.github/workflows/ios-demos.yml b/.github/workflows/ios-demos.yml new file mode 100644 index 00000000..8a111f4f --- /dev/null +++ b/.github/workflows/ios-demos.yml @@ -0,0 +1,52 @@ +name: iOS Demos + +on: + workflow_dispatch: + push: + branches: [ main ] + paths: + - 'demo/ios/EagleDemo/**' + - '.github/workflows/ios-demos.yml' + pull_request: + branches: [ main, 'v[0-9]+.[0-9]+' ] + paths: + - 'demo/ios/EagleDemo/**' + - '.github/workflows/ios-demos.yml' + +defaults: + run: + working-directory: demo/ios/EagleDemo + +jobs: + build: + runs-on: macos-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up Node.js LTS + uses: actions/setup-node@v3 + with: + node-version: lts/* + + - name: Install Cocoapods + run: gem install cocoapods + + - name: Install AppCenter CLI + run: npm install -g appcenter-cli + + - name: Make build dir + run: mkdir ddp + + - name: Run Cocoapods + run: pod install + + - name: Build + run: xcrun xcodebuild build + -configuration Debug + -workspace EagleDemo.xcworkspace + -sdk iphoneos + -scheme EagleDemo + -derivedDataPath ddp + CODE_SIGNING_ALLOWED=NO \ No newline at end of file diff --git a/binding/ios/EagleAppTest/EagleAppTest/ViewController.swift b/binding/ios/EagleAppTest/EagleAppTest/ViewController.swift index e5abedaa..9917f3ba 100644 --- a/binding/ios/EagleAppTest/EagleAppTest/ViewController.swift +++ b/binding/ios/EagleAppTest/EagleAppTest/ViewController.swift @@ -9,10 +9,4 @@ import UIKit -class ViewController: UIViewController { - - override func viewDidLoad() { - super.viewDidLoad() - } - -} +class ViewController: UIViewController { } diff --git a/binding/ios/EagleAppTest/EagleAppTestUITests/EagleAppTestUITests.swift b/binding/ios/EagleAppTest/EagleAppTestUITests/EagleAppTestUITests.swift index 2357a89a..11484686 100644 --- a/binding/ios/EagleAppTest/EagleAppTestUITests/EagleAppTestUITests.swift +++ b/binding/ios/EagleAppTest/EagleAppTestUITests/EagleAppTestUITests.swift @@ -126,7 +126,7 @@ class EagleAppTestUITests: BaseTest { func testMessageStack() throws { let enrollUrls = enrollUrls() - + let eagleProfiler = try EagleProfiler(accessKey: accessKey) for url in enrollUrls { let pcm = try readPcmFromFile(testAudioURL: url) @@ -179,7 +179,7 @@ class EagleAppTestUITests: BaseTest { func testProcessMessageStack() throws { let enrollUrls = enrollUrls() - + let eagleProfiler = try EagleProfiler(accessKey: accessKey) for url in enrollUrls { let pcm = try readPcmFromFile(testAudioURL: url) diff --git a/binding/ios/EagleBase.swift b/binding/ios/EagleBase.swift index 2dca2ad2..3bcc0890 100644 --- a/binding/ios/EagleBase.swift +++ b/binding/ios/EagleBase.swift @@ -100,7 +100,7 @@ public class EagleBase { var messageStackDepth: Int32 = 0 let status = pv_get_error_stack(&messageStackRef, &messageStackDepth) if status != PV_STATUS_SUCCESS { - throw pvStatusToKoalaError(status, "Unable to get Eagle error state") + throw pvStatusToEagleError(status, "Unable to get Eagle error state") } var messageStack: [String] = [] From d1e894f1e5a5c223a0d7f3afb0f23d73e52be70a Mon Sep 17 00:00:00 2001 From: Kwangsoo Yeo Date: Fri, 3 Nov 2023 16:00:32 -0700 Subject: [PATCH 4/7] fix --- .../EagleAppTest.xcodeproj/project.pbxproj | 12 ++++++------ binding/ios/EagleBase.swift | 2 +- .../ios-arm64/PvEagle.framework/Headers/picovoice.h | 2 ++ .../PvEagle.framework/Headers/picovoice.h | 2 ++ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/binding/ios/EagleAppTest/EagleAppTest.xcodeproj/project.pbxproj b/binding/ios/EagleAppTest/EagleAppTest.xcodeproj/project.pbxproj index f6f85f27..2cfa4235 100644 --- a/binding/ios/EagleAppTest/EagleAppTest.xcodeproj/project.pbxproj +++ b/binding/ios/EagleAppTest/EagleAppTest.xcodeproj/project.pbxproj @@ -674,7 +674,7 @@ INFOPLIST_KEY_UIMainStoryboardFile = Main; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -704,7 +704,7 @@ INFOPLIST_KEY_UIMainStoryboardFile = Main; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -726,7 +726,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 65723695GD; GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -751,7 +751,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 65723695GD; GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -776,7 +776,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 65723695GD; GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -803,7 +803,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 65723695GD; GENERATE_INFOPLIST_FILE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/binding/ios/EagleBase.swift b/binding/ios/EagleBase.swift index 3bcc0890..4a4842b5 100644 --- a/binding/ios/EagleBase.swift +++ b/binding/ios/EagleBase.swift @@ -9,7 +9,7 @@ public class EagleBase { /// Eagle/EagleProfiler version public static let version = String(cString: pv_eagle_version()) - private static var sdk = "ios" + internal static var sdk = "ios" public static func setSdk(sdk: String) { self.sdk = sdk diff --git a/lib/ios/PvEagle.xcframework/ios-arm64/PvEagle.framework/Headers/picovoice.h b/lib/ios/PvEagle.xcframework/ios-arm64/PvEagle.framework/Headers/picovoice.h index 886558d1..3f13d705 100644 --- a/lib/ios/PvEagle.xcframework/ios-arm64/PvEagle.framework/Headers/picovoice.h +++ b/lib/ios/PvEagle.xcframework/ios-arm64/PvEagle.framework/Headers/picovoice.h @@ -77,6 +77,8 @@ PV_API pv_status_t pv_get_error_stack( */ PV_API void pv_free_error_stack(char **message_stack); +PV_API void pv_set_sdk(const char *sdk); + #ifdef __cplusplus } diff --git a/lib/ios/PvEagle.xcframework/ios-arm64_x86_64-simulator/PvEagle.framework/Headers/picovoice.h b/lib/ios/PvEagle.xcframework/ios-arm64_x86_64-simulator/PvEagle.framework/Headers/picovoice.h index 886558d1..3f13d705 100644 --- a/lib/ios/PvEagle.xcframework/ios-arm64_x86_64-simulator/PvEagle.framework/Headers/picovoice.h +++ b/lib/ios/PvEagle.xcframework/ios-arm64_x86_64-simulator/PvEagle.framework/Headers/picovoice.h @@ -77,6 +77,8 @@ PV_API pv_status_t pv_get_error_stack( */ PV_API void pv_free_error_stack(char **message_stack); +PV_API void pv_set_sdk(const char *sdk); + #ifdef __cplusplus } From 430c3bfce30ec5abfb766d2b053454b72f014539 Mon Sep 17 00:00:00 2001 From: Kwangsoo Yeo Date: Fri, 3 Nov 2023 16:05:18 -0700 Subject: [PATCH 5/7] fix --- binding/ios/Eagle.swift | 2 +- binding/ios/EagleBase.swift | 2 +- binding/ios/EagleProfiler.swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/binding/ios/Eagle.swift b/binding/ios/Eagle.swift index 165da359..6a6fa94e 100644 --- a/binding/ios/Eagle.swift +++ b/binding/ios/Eagle.swift @@ -57,7 +57,7 @@ public class Eagle: EagleBase { speakerCount = speakerProfiles.count - pv_set_sdk(self.sdk) + pv_set_sdk(Eagle.sdk) let status = pv_eagle_init( accessKey, diff --git a/binding/ios/EagleBase.swift b/binding/ios/EagleBase.swift index 4a4842b5..330659f2 100644 --- a/binding/ios/EagleBase.swift +++ b/binding/ios/EagleBase.swift @@ -95,7 +95,7 @@ public class EagleBase { } } - private func getMessageStack() throws -> [String] { + internal func getMessageStack() throws -> [String] { var messageStackRef: UnsafeMutablePointer?>? var messageStackDepth: Int32 = 0 let status = pv_get_error_stack(&messageStackRef, &messageStackDepth) diff --git a/binding/ios/EagleProfiler.swift b/binding/ios/EagleProfiler.swift index ead37a3d..7b797fce 100644 --- a/binding/ios/EagleProfiler.swift +++ b/binding/ios/EagleProfiler.swift @@ -51,7 +51,7 @@ public class EagleProfiler: EagleBase { modelPathArg = try getResourcePath(modelPathArg!) } - pv_set_sdk(self.sdk) + pv_set_sdk(EagleProfiler.sdk) var status = pv_eagle_profiler_init( accessKey, From 2282df20a8ef9b46c6f389a62e6f1fece9a5e2f0 Mon Sep 17 00:00:00 2001 From: Kwangsoo Yeo Date: Fri, 3 Nov 2023 16:09:16 -0700 Subject: [PATCH 6/7] fix test --- binding/ios/EagleAppTest/EagleAppTestUITests/BaseTest.swift | 2 +- .../EagleAppTestUITests/EagleAppTestUITests.swift | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/binding/ios/EagleAppTest/EagleAppTestUITests/BaseTest.swift b/binding/ios/EagleAppTest/EagleAppTestUITests/BaseTest.swift index 64f44fe0..521be579 100644 --- a/binding/ios/EagleAppTest/EagleAppTestUITests/BaseTest.swift +++ b/binding/ios/EagleAppTest/EagleAppTestUITests/BaseTest.swift @@ -13,7 +13,7 @@ import Eagle class BaseTest: XCTestCase { - let accessKey: String = "{TESTING_ACCESS_KEY_HERE}" + let accessKey: String = "Tw4jothrMMLyRYQ793yD/XF3DeithcbeNVsYlNN0Dc1vY26suWNOkg==" internal func readPcmFromFile(testAudioURL: URL) throws -> [Int16] { var data = try Data(contentsOf: testAudioURL) diff --git a/binding/ios/EagleAppTest/EagleAppTestUITests/EagleAppTestUITests.swift b/binding/ios/EagleAppTest/EagleAppTestUITests/EagleAppTestUITests.swift index 11484686..6a35c8f9 100644 --- a/binding/ios/EagleAppTest/EagleAppTestUITests/EagleAppTestUITests.swift +++ b/binding/ios/EagleAppTest/EagleAppTestUITests/EagleAppTestUITests.swift @@ -165,7 +165,7 @@ class EagleAppTestUITests: BaseTest { XCTAssert(res == -1) } catch { XCTAssert("\(error.localizedDescription)".count > 0) - XCTAssert("\(error.localizedDescription)".count < 8) + XCTAssert("\(error.localizedDescription)".count < 1024) } do { @@ -173,7 +173,7 @@ class EagleAppTestUITests: BaseTest { XCTAssertNil(res) } catch { XCTAssert("\(error.localizedDescription)".count > 0) - XCTAssert("\(error.localizedDescription)".count < 8) + XCTAssert("\(error.localizedDescription)".count < 1024) } } @@ -200,7 +200,7 @@ class EagleAppTestUITests: BaseTest { XCTAssert(res.count == -1) } catch { XCTAssert("\(error.localizedDescription)".count > 0) - XCTAssert("\(error.localizedDescription)".count < 8) + XCTAssert("\(error.localizedDescription)".count < 1024) } } } From af9d9e8e98e07f85f91525e2514b19060d377420 Mon Sep 17 00:00:00 2001 From: Kwangsoo Yeo Date: Fri, 3 Nov 2023 17:00:53 -0700 Subject: [PATCH 7/7] rev --- binding/ios/EagleAppTest/EagleAppTestUITests/BaseTest.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binding/ios/EagleAppTest/EagleAppTestUITests/BaseTest.swift b/binding/ios/EagleAppTest/EagleAppTestUITests/BaseTest.swift index 521be579..64f44fe0 100644 --- a/binding/ios/EagleAppTest/EagleAppTestUITests/BaseTest.swift +++ b/binding/ios/EagleAppTest/EagleAppTestUITests/BaseTest.swift @@ -13,7 +13,7 @@ import Eagle class BaseTest: XCTestCase { - let accessKey: String = "Tw4jothrMMLyRYQ793yD/XF3DeithcbeNVsYlNN0Dc1vY26suWNOkg==" + let accessKey: String = "{TESTING_ACCESS_KEY_HERE}" internal func readPcmFromFile(testAudioURL: URL) throws -> [Int16] { var data = try Data(contentsOf: testAudioURL)