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

v3.0 rn sdk #1127

Merged
merged 6 commits into from
Oct 20, 2023
Merged
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
2 changes: 2 additions & 0 deletions binding/ios/Porcupine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ public class Porcupine {
keywordPathsArgs[i] = try getResourcePath(keywordPathsArgs[i])
}

pv_set_sdk(Porcupine.sdk)

let status = pv_porcupine_init(
accessKey,
modelPathArg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public class PorcupineModule extends ReactContextBaseJavaModule {
public PorcupineModule(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;

Porcupine.setSdk("react-native");
}

@Override
Expand Down
7 changes: 6 additions & 1 deletion binding/react-native/ios/Porcupine.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright 2020-2022 Picovoice Inc.
// Copyright 2020-2023 Picovoice Inc.
//
// You may not use this file except in compliance with the license. A copy of the license is located in the "LICENSE"
// file accompanying this source.
Expand All @@ -15,6 +15,11 @@ import Porcupine
class PvPorcupine: NSObject {
private var porcupinePool: [String: Porcupine] = [:]

override init() {
super.init()
Porcupine.setSdk(sdk: "react-native")
}

@objc(fromBuiltInKeywords:modelPath:keywords:sensitivities:resolver:rejecter:)
func fromBuiltInKeywords(
accessKey: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down