@iternio/react-native-auto-play 0.4.9 → 0.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -26
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlay.kt +89 -0
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/VoiceInputManager.kt +20 -286
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/utils/ThreadUtil.kt +13 -6
- package/ios/hybrid/HybridAutoPlay.swift +47 -2
- package/ios/utils/VoiceInputManager.swift +40 -144
- package/lib/index.d.ts +1 -3
- package/lib/index.js +1 -2
- package/lib/specs/AutoPlay.nitro.d.ts +29 -0
- package/nitro.json +0 -10
- package/nitrogen/generated/android/ReactNativeAutoPlay+autolinking.cmake +0 -2
- package/nitrogen/generated/android/ReactNativeAutoPlayOnLoad.cpp +0 -18
- package/nitrogen/generated/android/c++/JActiveCarUxRestrictions.hpp +8 -8
- package/nitrogen/generated/android/c++/JGridTemplateConfig.hpp +16 -16
- package/nitrogen/generated/android/c++/JHybridAndroidAutoTelemetrySpec.cpp +4 -4
- package/nitrogen/generated/android/c++/JHybridAutoPlaySpec.cpp +47 -4
- package/nitrogen/generated/android/c++/JHybridAutoPlaySpec.hpp +4 -0
- package/nitrogen/generated/android/c++/JHybridClusterSpec.cpp +4 -4
- package/nitrogen/generated/android/c++/JHybridGridTemplateSpec.cpp +4 -4
- package/nitrogen/generated/android/c++/JHybridListTemplateSpec.cpp +4 -4
- package/nitrogen/generated/android/c++/JHybridMapTemplateSpec.cpp +15 -15
- package/nitrogen/generated/android/c++/JInformationTemplateConfig.hpp +16 -16
- package/nitrogen/generated/android/c++/JLaneGuidance.hpp +16 -16
- package/nitrogen/generated/android/c++/JListTemplateConfig.hpp +16 -16
- package/nitrogen/generated/android/c++/JMapTemplateConfig.hpp +16 -16
- package/nitrogen/generated/android/c++/JMessageTemplateConfig.hpp +16 -16
- package/nitrogen/generated/android/c++/JNitroAttributedString.hpp +8 -8
- package/nitrogen/generated/android/c++/JNitroBaseMapTemplateConfig.hpp +16 -16
- package/nitrogen/generated/android/c++/JNitroManeuver.cpp +4 -4
- package/nitrogen/generated/android/c++/JNitroManeuver.hpp +4 -4
- package/nitrogen/generated/android/c++/JNitroRoutingManeuver.hpp +16 -16
- package/nitrogen/generated/android/c++/JNitroSection.hpp +8 -8
- package/nitrogen/generated/android/c++/JPermissionRequestResult.hpp +16 -16
- package/nitrogen/generated/android/c++/JRouteChoice.hpp +32 -32
- package/nitrogen/generated/android/c++/JSearchTemplateConfig.hpp +8 -8
- package/nitrogen/generated/android/c++/JSignInTemplateConfig.hpp +16 -16
- package/nitrogen/generated/android/c++/JTripsConfig.hpp +8 -8
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/ActiveCarUxRestrictions.kt +19 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/AppFocusState.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/AssetImage.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/AutoText.kt +17 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/BooleanTelemetryItem.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Distance.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/DurationWithTimeZone.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/GlyphImage.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/GoogleSignIn.kt +19 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/GoogleSignInAccount.kt +27 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/GridTemplateConfig.kt +33 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlaySpec.kt +17 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/ImageLane.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/InformationTemplateConfig.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/InputSignIn.kt +27 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/LaneGuidance.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/ListTemplateConfig.kt +33 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Location.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/MapTemplateConfig.kt +51 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/MessageTemplateConfig.kt +37 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NavigationAlertAction.kt +17 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroAction.kt +27 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroAttributedString.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroAttributedStringImage.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroBaseMapTemplateConfig.kt +29 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroColor.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroGridButton.kt +17 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroImage.kt +18 -8
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroLoadingManeuver.kt +17 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroManeuver.kt +18 -8
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroMapButton.kt +17 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroMessageManeuver.kt +19 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroNavigationAlert.kt +31 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroRoutingManeuver.kt +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroRow.kt +27 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroSection.kt +17 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NumericTelemetryItem.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/PermissionRequestResult.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/PinSignIn.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Point.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/PreferredImageLane.kt +19 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/QrSignIn.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/RemoteImage.kt +17 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/RouteChoice.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/SafeAreaInsets.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/SearchTemplateConfig.kt +39 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/SignInTemplateConfig.kt +37 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/StringTelemetryItem.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Telemetry.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/TravelEstimates.kt +19 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/TripConfig.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/TripPoint.kt +19 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/TripPreviewTextConfiguration.kt +19 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/TripSelectorCallback.kt +13 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/TripsConfig.kt +15 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Variant_GlyphImage_AssetImage_RemoteImage.kt +18 -8
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Variant_PreferredImageLane_ImageLane.kt +16 -7
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Variant_QrSignIn_PinSignIn_InputSignIn_GoogleSignIn.kt +20 -9
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/VehicleTelemetryItem.kt +19 -0
- package/nitrogen/generated/ios/ReactNativeAutoPlay+autolinking.rb +2 -0
- package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.cpp +16 -41
- package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.hpp +126 -201
- package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Umbrella.hpp +0 -11
- package/nitrogen/generated/ios/ReactNativeAutoPlayAutolinking.mm +0 -8
- package/nitrogen/generated/ios/ReactNativeAutoPlayAutolinking.swift +0 -12
- package/nitrogen/generated/ios/c++/HybridAutoPlaySpecSwift.hpp +34 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +5 -5
- package/nitrogen/generated/ios/swift/{Func_void_VoiceInputResult.swift → Func_void_std__shared_ptr_ArrayBuffer_.swift} +10 -10
- package/nitrogen/generated/ios/swift/HybridAutoPlaySpec.swift +4 -0
- package/nitrogen/generated/ios/swift/HybridAutoPlaySpec_cxx.swift +82 -0
- package/nitrogen/generated/ios/swift/NitroImage.swift +13 -0
- package/nitrogen/generated/ios/swift/NitroManeuver.swift +13 -0
- package/nitrogen/generated/ios/swift/Variant_GlyphImage_AssetImage_RemoteImage.swift +13 -0
- package/nitrogen/generated/ios/swift/Variant_PreferredImageLane_ImageLane.swift +12 -0
- package/nitrogen/generated/shared/c++/HybridAutoPlaySpec.cpp +4 -0
- package/nitrogen/generated/shared/c++/HybridAutoPlaySpec.hpp +5 -0
- package/package.json +2 -2
- package/src/index.ts +1 -3
- package/src/specs/AutoPlay.nitro.ts +37 -0
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridVoice.kt +0 -97
- package/ios/hybrid/HybridVoice.swift +0 -65
- package/lib/HybridAutoPlay.d.ts +0 -2
- package/lib/HybridAutoPlay.js +0 -2
- package/lib/components/OnAppearedChildRenderer.d.ts +0 -10
- package/lib/components/OnAppearedChildRenderer.js +0 -26
- package/lib/hooks/useIsAutoPlayFocused.d.ts +0 -7
- package/lib/hooks/useIsAutoPlayFocused.js +0 -20
- package/lib/hybrid/HybridVoice.d.ts +0 -52
- package/lib/hybrid/HybridVoice.js +0 -52
- package/lib/hybrid.d.ts +0 -2
- package/lib/hybrid.js +0 -2
- package/lib/specs/AutomotivePermissionRequestTemplate.d.ts +0 -11
- package/lib/specs/AutomotivePermissionRequestTemplate.js +0 -1
- package/lib/specs/AutomotivePermissionRequestTemplate.nitro.d.ts +0 -11
- package/lib/specs/AutomotivePermissionRequestTemplate.nitro.js +0 -1
- package/lib/specs/Voice.nitro.d.ts +0 -11
- package/lib/specs/Voice.nitro.js +0 -1
- package/lib/templates/AutomotivePermissionRequestTemplate.d.ts +0 -23
- package/lib/templates/AutomotivePermissionRequestTemplate.js +0 -18
- package/lib/types/Glyphmap.d.ts +0 -4105
- package/lib/types/Glyphmap.js +0 -4105
- package/lib/types/Voice.d.ts +0 -16
- package/lib/types/Voice.js +0 -1
- package/nitrogen/generated/android/c++/JFunc_void_VoiceInputChunk.hpp +0 -81
- package/nitrogen/generated/android/c++/JHybridVoiceSpec.cpp +0 -104
- package/nitrogen/generated/android/c++/JHybridVoiceSpec.hpp +0 -66
- package/nitrogen/generated/android/c++/JVoiceInputChunk.hpp +0 -64
- package/nitrogen/generated/android/c++/JVoiceInputResult.hpp +0 -64
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_VoiceInputChunk.kt +0 -80
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridVoiceSpec.kt +0 -72
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/VoiceInputChunk.kt +0 -41
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/VoiceInputResult.kt +0 -41
- package/nitrogen/generated/ios/c++/HybridVoiceSpecSwift.cpp +0 -11
- package/nitrogen/generated/ios/c++/HybridVoiceSpecSwift.hpp +0 -116
- package/nitrogen/generated/ios/swift/Func_void_VoiceInputChunk.swift +0 -46
- package/nitrogen/generated/ios/swift/HybridVoiceSpec.swift +0 -58
- package/nitrogen/generated/ios/swift/HybridVoiceSpec_cxx.swift +0 -234
- package/nitrogen/generated/ios/swift/VoiceInputChunk.swift +0 -60
- package/nitrogen/generated/ios/swift/VoiceInputResult.swift +0 -60
- package/nitrogen/generated/shared/c++/HybridVoiceSpec.cpp +0 -24
- package/nitrogen/generated/shared/c++/HybridVoiceSpec.hpp +0 -73
- package/nitrogen/generated/shared/c++/VoiceInputChunk.hpp +0 -89
- package/nitrogen/generated/shared/c++/VoiceInputResult.hpp +0 -89
- package/src/hybrid/HybridVoice.ts +0 -79
- package/src/specs/Voice.nitro.ts +0 -16
- package/src/types/Voice.ts +0 -18
package/lib/types/Voice.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface VoiceInputChunk {
|
|
2
|
-
partial?: string;
|
|
3
|
-
audio?: ArrayBuffer;
|
|
4
|
-
}
|
|
5
|
-
export interface VoiceInputResult {
|
|
6
|
-
transcription?: string;
|
|
7
|
-
audio?: ArrayBuffer;
|
|
8
|
-
}
|
|
9
|
-
export interface VoiceInputOptions {
|
|
10
|
-
silenceThresholdMs?: number;
|
|
11
|
-
maxDurationMs?: number;
|
|
12
|
-
listeningText?: string;
|
|
13
|
-
preferSpeechToText?: boolean;
|
|
14
|
-
onChunk?: (chunk: VoiceInputChunk) => void;
|
|
15
|
-
language?: string;
|
|
16
|
-
}
|
package/lib/types/Voice.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// JFunc_void_VoiceInputChunk.hpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#include <fbjni/fbjni.h>
|
|
11
|
-
#include <functional>
|
|
12
|
-
|
|
13
|
-
#include "VoiceInputChunk.hpp"
|
|
14
|
-
#include <functional>
|
|
15
|
-
#include <NitroModules/JNICallable.hpp>
|
|
16
|
-
#include "JVoiceInputChunk.hpp"
|
|
17
|
-
#include <string>
|
|
18
|
-
#include <optional>
|
|
19
|
-
#include <NitroModules/ArrayBuffer.hpp>
|
|
20
|
-
#include <NitroModules/JArrayBuffer.hpp>
|
|
21
|
-
|
|
22
|
-
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
23
|
-
|
|
24
|
-
using namespace facebook;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Represents the Java/Kotlin callback `(chunk: VoiceInputChunk) -> Unit`.
|
|
28
|
-
* This can be passed around between C++ and Java/Kotlin.
|
|
29
|
-
*/
|
|
30
|
-
struct JFunc_void_VoiceInputChunk: public jni::JavaClass<JFunc_void_VoiceInputChunk> {
|
|
31
|
-
public:
|
|
32
|
-
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_VoiceInputChunk;";
|
|
33
|
-
|
|
34
|
-
public:
|
|
35
|
-
/**
|
|
36
|
-
* Invokes the function this `JFunc_void_VoiceInputChunk` instance holds through JNI.
|
|
37
|
-
*/
|
|
38
|
-
void invoke(const VoiceInputChunk& chunk) const {
|
|
39
|
-
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JVoiceInputChunk> /* chunk */)>("invoke");
|
|
40
|
-
method(self(), JVoiceInputChunk::fromCpp(chunk));
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* An implementation of Func_void_VoiceInputChunk that is backed by a C++ implementation (using `std::function<...>`)
|
|
46
|
-
*/
|
|
47
|
-
class JFunc_void_VoiceInputChunk_cxx final: public jni::HybridClass<JFunc_void_VoiceInputChunk_cxx, JFunc_void_VoiceInputChunk> {
|
|
48
|
-
public:
|
|
49
|
-
static jni::local_ref<JFunc_void_VoiceInputChunk::javaobject> fromCpp(const std::function<void(const VoiceInputChunk& /* chunk */)>& func) {
|
|
50
|
-
return JFunc_void_VoiceInputChunk_cxx::newObjectCxxArgs(func);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public:
|
|
54
|
-
/**
|
|
55
|
-
* Invokes the C++ `std::function<...>` this `JFunc_void_VoiceInputChunk_cxx` instance holds.
|
|
56
|
-
*/
|
|
57
|
-
void invoke_cxx(jni::alias_ref<JVoiceInputChunk> chunk) {
|
|
58
|
-
_func(chunk->toCpp());
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public:
|
|
62
|
-
[[nodiscard]]
|
|
63
|
-
inline const std::function<void(const VoiceInputChunk& /* chunk */)>& getFunction() const {
|
|
64
|
-
return _func;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
public:
|
|
68
|
-
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/swe/iternio/reactnativeautoplay/Func_void_VoiceInputChunk_cxx;";
|
|
69
|
-
static void registerNatives() {
|
|
70
|
-
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_VoiceInputChunk_cxx::invoke_cxx)});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
private:
|
|
74
|
-
explicit JFunc_void_VoiceInputChunk_cxx(const std::function<void(const VoiceInputChunk& /* chunk */)>& func): _func(func) { }
|
|
75
|
-
|
|
76
|
-
private:
|
|
77
|
-
friend HybridBase;
|
|
78
|
-
std::function<void(const VoiceInputChunk& /* chunk */)> _func;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
} // namespace margelo::nitro::swe::iternio::reactnativeautoplay
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// JHybridVoiceSpec.cpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#include "JHybridVoiceSpec.hpp"
|
|
9
|
-
|
|
10
|
-
// Forward declaration of `VoiceInputResult` to properly resolve imports.
|
|
11
|
-
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct VoiceInputResult; }
|
|
12
|
-
// Forward declaration of `VoiceInputChunk` to properly resolve imports.
|
|
13
|
-
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct VoiceInputChunk; }
|
|
14
|
-
|
|
15
|
-
#include <NitroModules/Promise.hpp>
|
|
16
|
-
#include <NitroModules/JPromise.hpp>
|
|
17
|
-
#include "VoiceInputResult.hpp"
|
|
18
|
-
#include "JVoiceInputResult.hpp"
|
|
19
|
-
#include <string>
|
|
20
|
-
#include <optional>
|
|
21
|
-
#include <NitroModules/ArrayBuffer.hpp>
|
|
22
|
-
#include <NitroModules/JArrayBuffer.hpp>
|
|
23
|
-
#include "VoiceInputChunk.hpp"
|
|
24
|
-
#include <functional>
|
|
25
|
-
#include "JFunc_void_VoiceInputChunk.hpp"
|
|
26
|
-
#include <NitroModules/JNICallable.hpp>
|
|
27
|
-
#include "JVoiceInputChunk.hpp"
|
|
28
|
-
|
|
29
|
-
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
30
|
-
|
|
31
|
-
std::shared_ptr<JHybridVoiceSpec> JHybridVoiceSpec::JavaPart::getJHybridVoiceSpec() {
|
|
32
|
-
auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
|
|
33
|
-
auto castHybridObject = std::dynamic_pointer_cast<JHybridVoiceSpec>(hybridObject);
|
|
34
|
-
if (castHybridObject == nullptr) [[unlikely]] {
|
|
35
|
-
throw std::runtime_error("Failed to downcast JHybridObject to JHybridVoiceSpec!");
|
|
36
|
-
}
|
|
37
|
-
return castHybridObject;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
jni::local_ref<JHybridVoiceSpec::CxxPart::jhybriddata> JHybridVoiceSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
41
|
-
return makeCxxInstance(jThis);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
std::shared_ptr<JHybridObject> JHybridVoiceSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
|
|
45
|
-
auto castJavaPart = jni::dynamic_ref_cast<JHybridVoiceSpec::JavaPart>(javaPart);
|
|
46
|
-
if (castJavaPart == nullptr) [[unlikely]] {
|
|
47
|
-
throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridVoiceSpec::JavaPart!");
|
|
48
|
-
}
|
|
49
|
-
return std::make_shared<JHybridVoiceSpec>(castJavaPart);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
void JHybridVoiceSpec::CxxPart::registerNatives() {
|
|
53
|
-
registerHybrid({
|
|
54
|
-
makeNativeMethod("initHybrid", JHybridVoiceSpec::CxxPart::initHybrid),
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Properties
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// Methods
|
|
62
|
-
bool JHybridVoiceSpec::hasVoiceInputPermission() {
|
|
63
|
-
static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("hasVoiceInputPermission");
|
|
64
|
-
auto __result = method(_javaPart);
|
|
65
|
-
return static_cast<bool>(__result);
|
|
66
|
-
}
|
|
67
|
-
std::shared_ptr<Promise<bool>> JHybridVoiceSpec::requestVoiceInputPermission() {
|
|
68
|
-
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("requestVoiceInputPermission");
|
|
69
|
-
auto __result = method(_javaPart);
|
|
70
|
-
return [&]() {
|
|
71
|
-
auto __promise = Promise<bool>::create();
|
|
72
|
-
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
73
|
-
auto __result = jni::static_ref_cast<jni::JBoolean>(__boxedResult);
|
|
74
|
-
__promise->resolve(static_cast<bool>(__result->value()));
|
|
75
|
-
});
|
|
76
|
-
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
77
|
-
jni::JniException __jniError(__throwable);
|
|
78
|
-
__promise->reject(std::make_exception_ptr(__jniError));
|
|
79
|
-
});
|
|
80
|
-
return __promise;
|
|
81
|
-
}();
|
|
82
|
-
}
|
|
83
|
-
std::shared_ptr<Promise<VoiceInputResult>> JHybridVoiceSpec::startVoiceInput(std::optional<double> silenceThresholdMs, std::optional<double> maxDurationMs, const std::optional<std::string>& listeningText, std::optional<bool> preferSpeechToText, const std::optional<std::function<void(const VoiceInputChunk& /* chunk */)>>& onChunk, const std::optional<std::string>& language) {
|
|
84
|
-
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JDouble> /* silenceThresholdMs */, jni::alias_ref<jni::JDouble> /* maxDurationMs */, jni::alias_ref<jni::JString> /* listeningText */, jni::alias_ref<jni::JBoolean> /* preferSpeechToText */, jni::alias_ref<JFunc_void_VoiceInputChunk::javaobject> /* onChunk */, jni::alias_ref<jni::JString> /* language */)>("startVoiceInput_cxx");
|
|
85
|
-
auto __result = method(_javaPart, silenceThresholdMs.has_value() ? jni::JDouble::valueOf(silenceThresholdMs.value()) : nullptr, maxDurationMs.has_value() ? jni::JDouble::valueOf(maxDurationMs.value()) : nullptr, listeningText.has_value() ? jni::make_jstring(listeningText.value()) : nullptr, preferSpeechToText.has_value() ? jni::JBoolean::valueOf(preferSpeechToText.value()) : nullptr, onChunk.has_value() ? JFunc_void_VoiceInputChunk_cxx::fromCpp(onChunk.value()) : nullptr, language.has_value() ? jni::make_jstring(language.value()) : nullptr);
|
|
86
|
-
return [&]() {
|
|
87
|
-
auto __promise = Promise<VoiceInputResult>::create();
|
|
88
|
-
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
89
|
-
auto __result = jni::static_ref_cast<JVoiceInputResult>(__boxedResult);
|
|
90
|
-
__promise->resolve(__result->toCpp());
|
|
91
|
-
});
|
|
92
|
-
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
93
|
-
jni::JniException __jniError(__throwable);
|
|
94
|
-
__promise->reject(std::make_exception_ptr(__jniError));
|
|
95
|
-
});
|
|
96
|
-
return __promise;
|
|
97
|
-
}();
|
|
98
|
-
}
|
|
99
|
-
void JHybridVoiceSpec::stopVoiceInput() {
|
|
100
|
-
static const auto method = _javaPart->javaClassStatic()->getMethod<void()>("stopVoiceInput");
|
|
101
|
-
method(_javaPart);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
} // namespace margelo::nitro::swe::iternio::reactnativeautoplay
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridVoiceSpec.hpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#include <NitroModules/JHybridObject.hpp>
|
|
11
|
-
#include <fbjni/fbjni.h>
|
|
12
|
-
#include "HybridVoiceSpec.hpp"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
18
|
-
|
|
19
|
-
using namespace facebook;
|
|
20
|
-
|
|
21
|
-
class JHybridVoiceSpec: public virtual HybridVoiceSpec, public virtual JHybridObject {
|
|
22
|
-
public:
|
|
23
|
-
struct JavaPart: public jni::JavaClass<JavaPart, JHybridObject::JavaPart> {
|
|
24
|
-
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/swe/iternio/reactnativeautoplay/HybridVoiceSpec;";
|
|
25
|
-
std::shared_ptr<JHybridVoiceSpec> getJHybridVoiceSpec();
|
|
26
|
-
};
|
|
27
|
-
struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
|
|
28
|
-
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/swe/iternio/reactnativeautoplay/HybridVoiceSpec$CxxPart;";
|
|
29
|
-
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
30
|
-
static void registerNatives();
|
|
31
|
-
using HybridBase::HybridBase;
|
|
32
|
-
protected:
|
|
33
|
-
std::shared_ptr<JHybridObject> createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) override;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
public:
|
|
37
|
-
explicit JHybridVoiceSpec(const jni::local_ref<JHybridVoiceSpec::JavaPart>& javaPart):
|
|
38
|
-
HybridObject(HybridVoiceSpec::TAG),
|
|
39
|
-
JHybridObject(javaPart),
|
|
40
|
-
_javaPart(jni::make_global(javaPart)) {}
|
|
41
|
-
~JHybridVoiceSpec() override {
|
|
42
|
-
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
43
|
-
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
public:
|
|
47
|
-
inline const jni::global_ref<JHybridVoiceSpec::JavaPart>& getJavaPart() const noexcept {
|
|
48
|
-
return _javaPart;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public:
|
|
52
|
-
// Properties
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
public:
|
|
56
|
-
// Methods
|
|
57
|
-
bool hasVoiceInputPermission() override;
|
|
58
|
-
std::shared_ptr<Promise<bool>> requestVoiceInputPermission() override;
|
|
59
|
-
std::shared_ptr<Promise<VoiceInputResult>> startVoiceInput(std::optional<double> silenceThresholdMs, std::optional<double> maxDurationMs, const std::optional<std::string>& listeningText, std::optional<bool> preferSpeechToText, const std::optional<std::function<void(const VoiceInputChunk& /* chunk */)>>& onChunk, const std::optional<std::string>& language) override;
|
|
60
|
-
void stopVoiceInput() override;
|
|
61
|
-
|
|
62
|
-
private:
|
|
63
|
-
jni::global_ref<JHybridVoiceSpec::JavaPart> _javaPart;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
} // namespace margelo::nitro::swe::iternio::reactnativeautoplay
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// JVoiceInputChunk.hpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#include <fbjni/fbjni.h>
|
|
11
|
-
#include "VoiceInputChunk.hpp"
|
|
12
|
-
|
|
13
|
-
#include <NitroModules/ArrayBuffer.hpp>
|
|
14
|
-
#include <NitroModules/JArrayBuffer.hpp>
|
|
15
|
-
#include <optional>
|
|
16
|
-
#include <string>
|
|
17
|
-
|
|
18
|
-
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
19
|
-
|
|
20
|
-
using namespace facebook;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* The C++ JNI bridge between the C++ struct "VoiceInputChunk" and the the Kotlin data class "VoiceInputChunk".
|
|
24
|
-
*/
|
|
25
|
-
struct JVoiceInputChunk final: public jni::JavaClass<JVoiceInputChunk> {
|
|
26
|
-
public:
|
|
27
|
-
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/swe/iternio/reactnativeautoplay/VoiceInputChunk;";
|
|
28
|
-
|
|
29
|
-
public:
|
|
30
|
-
/**
|
|
31
|
-
* Convert this Java/Kotlin-based struct to the C++ struct VoiceInputChunk by copying all values to C++.
|
|
32
|
-
*/
|
|
33
|
-
[[maybe_unused]]
|
|
34
|
-
[[nodiscard]]
|
|
35
|
-
VoiceInputChunk toCpp() const {
|
|
36
|
-
static const auto clazz = javaClassStatic();
|
|
37
|
-
static const auto fieldPartial = clazz->getField<jni::JString>("partial");
|
|
38
|
-
jni::local_ref<jni::JString> partial = this->getFieldValue(fieldPartial);
|
|
39
|
-
static const auto fieldAudio = clazz->getField<JArrayBuffer::javaobject>("audio");
|
|
40
|
-
jni::local_ref<JArrayBuffer::javaobject> audio = this->getFieldValue(fieldAudio);
|
|
41
|
-
return VoiceInputChunk(
|
|
42
|
-
partial != nullptr ? std::make_optional(partial->toStdString()) : std::nullopt,
|
|
43
|
-
audio != nullptr ? std::make_optional(audio->cthis()->getArrayBuffer()) : std::nullopt
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public:
|
|
48
|
-
/**
|
|
49
|
-
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
50
|
-
*/
|
|
51
|
-
[[maybe_unused]]
|
|
52
|
-
static jni::local_ref<JVoiceInputChunk::javaobject> fromCpp(const VoiceInputChunk& value) {
|
|
53
|
-
using JSignature = JVoiceInputChunk(jni::alias_ref<jni::JString>, jni::alias_ref<JArrayBuffer::javaobject>);
|
|
54
|
-
static const auto clazz = javaClassStatic();
|
|
55
|
-
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
56
|
-
return create(
|
|
57
|
-
clazz,
|
|
58
|
-
value.partial.has_value() ? jni::make_jstring(value.partial.value()) : nullptr,
|
|
59
|
-
value.audio.has_value() ? JArrayBuffer::wrap(value.audio.value()) : nullptr
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
} // namespace margelo::nitro::swe::iternio::reactnativeautoplay
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// JVoiceInputResult.hpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#include <fbjni/fbjni.h>
|
|
11
|
-
#include "VoiceInputResult.hpp"
|
|
12
|
-
|
|
13
|
-
#include <NitroModules/ArrayBuffer.hpp>
|
|
14
|
-
#include <NitroModules/JArrayBuffer.hpp>
|
|
15
|
-
#include <optional>
|
|
16
|
-
#include <string>
|
|
17
|
-
|
|
18
|
-
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
19
|
-
|
|
20
|
-
using namespace facebook;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* The C++ JNI bridge between the C++ struct "VoiceInputResult" and the the Kotlin data class "VoiceInputResult".
|
|
24
|
-
*/
|
|
25
|
-
struct JVoiceInputResult final: public jni::JavaClass<JVoiceInputResult> {
|
|
26
|
-
public:
|
|
27
|
-
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/swe/iternio/reactnativeautoplay/VoiceInputResult;";
|
|
28
|
-
|
|
29
|
-
public:
|
|
30
|
-
/**
|
|
31
|
-
* Convert this Java/Kotlin-based struct to the C++ struct VoiceInputResult by copying all values to C++.
|
|
32
|
-
*/
|
|
33
|
-
[[maybe_unused]]
|
|
34
|
-
[[nodiscard]]
|
|
35
|
-
VoiceInputResult toCpp() const {
|
|
36
|
-
static const auto clazz = javaClassStatic();
|
|
37
|
-
static const auto fieldTranscription = clazz->getField<jni::JString>("transcription");
|
|
38
|
-
jni::local_ref<jni::JString> transcription = this->getFieldValue(fieldTranscription);
|
|
39
|
-
static const auto fieldAudio = clazz->getField<JArrayBuffer::javaobject>("audio");
|
|
40
|
-
jni::local_ref<JArrayBuffer::javaobject> audio = this->getFieldValue(fieldAudio);
|
|
41
|
-
return VoiceInputResult(
|
|
42
|
-
transcription != nullptr ? std::make_optional(transcription->toStdString()) : std::nullopt,
|
|
43
|
-
audio != nullptr ? std::make_optional(audio->cthis()->getArrayBuffer()) : std::nullopt
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public:
|
|
48
|
-
/**
|
|
49
|
-
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
50
|
-
*/
|
|
51
|
-
[[maybe_unused]]
|
|
52
|
-
static jni::local_ref<JVoiceInputResult::javaobject> fromCpp(const VoiceInputResult& value) {
|
|
53
|
-
using JSignature = JVoiceInputResult(jni::alias_ref<jni::JString>, jni::alias_ref<JArrayBuffer::javaobject>);
|
|
54
|
-
static const auto clazz = javaClassStatic();
|
|
55
|
-
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
56
|
-
return create(
|
|
57
|
-
clazz,
|
|
58
|
-
value.transcription.has_value() ? jni::make_jstring(value.transcription.value()) : nullptr,
|
|
59
|
-
value.audio.has_value() ? JArrayBuffer::wrap(value.audio.value()) : nullptr
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
} // namespace margelo::nitro::swe::iternio::reactnativeautoplay
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// Func_void_VoiceInputChunk.kt
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
package com.margelo.nitro.swe.iternio.reactnativeautoplay
|
|
9
|
-
|
|
10
|
-
import androidx.annotation.Keep
|
|
11
|
-
import com.facebook.jni.HybridData
|
|
12
|
-
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
-
import dalvik.annotation.optimization.FastNative
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Represents the JavaScript callback `(chunk: struct) => void`.
|
|
18
|
-
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
19
|
-
* or in Kotlin/Java (in which case it is a native callback).
|
|
20
|
-
*/
|
|
21
|
-
@DoNotStrip
|
|
22
|
-
@Keep
|
|
23
|
-
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
24
|
-
fun interface Func_void_VoiceInputChunk: (VoiceInputChunk) -> Unit {
|
|
25
|
-
/**
|
|
26
|
-
* Call the given JS callback.
|
|
27
|
-
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
28
|
-
*/
|
|
29
|
-
@DoNotStrip
|
|
30
|
-
@Keep
|
|
31
|
-
override fun invoke(chunk: VoiceInputChunk): Unit
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Represents the JavaScript callback `(chunk: struct) => void`.
|
|
36
|
-
* This is implemented in C++, via a `std::function<...>`.
|
|
37
|
-
* The callback might be coming from JS.
|
|
38
|
-
*/
|
|
39
|
-
@DoNotStrip
|
|
40
|
-
@Keep
|
|
41
|
-
@Suppress(
|
|
42
|
-
"KotlinJniMissingFunction", "unused",
|
|
43
|
-
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
44
|
-
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
45
|
-
)
|
|
46
|
-
class Func_void_VoiceInputChunk_cxx: Func_void_VoiceInputChunk {
|
|
47
|
-
@DoNotStrip
|
|
48
|
-
@Keep
|
|
49
|
-
private val mHybridData: HybridData
|
|
50
|
-
|
|
51
|
-
@DoNotStrip
|
|
52
|
-
@Keep
|
|
53
|
-
private constructor(hybridData: HybridData) {
|
|
54
|
-
mHybridData = hybridData
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
@DoNotStrip
|
|
58
|
-
@Keep
|
|
59
|
-
override fun invoke(chunk: VoiceInputChunk): Unit
|
|
60
|
-
= invoke_cxx(chunk)
|
|
61
|
-
|
|
62
|
-
@FastNative
|
|
63
|
-
private external fun invoke_cxx(chunk: VoiceInputChunk): Unit
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Represents the JavaScript callback `(chunk: struct) => void`.
|
|
68
|
-
* This is implemented in Java/Kotlin, via a `(VoiceInputChunk) -> Unit`.
|
|
69
|
-
* The callback is always coming from native.
|
|
70
|
-
*/
|
|
71
|
-
@DoNotStrip
|
|
72
|
-
@Keep
|
|
73
|
-
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
74
|
-
class Func_void_VoiceInputChunk_java(private val function: (VoiceInputChunk) -> Unit): Func_void_VoiceInputChunk {
|
|
75
|
-
@DoNotStrip
|
|
76
|
-
@Keep
|
|
77
|
-
override fun invoke(chunk: VoiceInputChunk): Unit {
|
|
78
|
-
return this.function(chunk)
|
|
79
|
-
}
|
|
80
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridVoiceSpec.kt
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
package com.margelo.nitro.swe.iternio.reactnativeautoplay
|
|
9
|
-
|
|
10
|
-
import androidx.annotation.Keep
|
|
11
|
-
import com.facebook.jni.HybridData
|
|
12
|
-
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
-
import com.margelo.nitro.core.Promise
|
|
14
|
-
import com.margelo.nitro.core.HybridObject
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* A Kotlin class representing the Voice HybridObject.
|
|
18
|
-
* Implement this abstract class to create Kotlin-based instances of Voice.
|
|
19
|
-
*/
|
|
20
|
-
@DoNotStrip
|
|
21
|
-
@Keep
|
|
22
|
-
@Suppress(
|
|
23
|
-
"KotlinJniMissingFunction", "unused",
|
|
24
|
-
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
25
|
-
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
26
|
-
)
|
|
27
|
-
abstract class HybridVoiceSpec: HybridObject() {
|
|
28
|
-
// Properties
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// Methods
|
|
32
|
-
@DoNotStrip
|
|
33
|
-
@Keep
|
|
34
|
-
abstract fun hasVoiceInputPermission(): Boolean
|
|
35
|
-
|
|
36
|
-
@DoNotStrip
|
|
37
|
-
@Keep
|
|
38
|
-
abstract fun requestVoiceInputPermission(): Promise<Boolean>
|
|
39
|
-
|
|
40
|
-
abstract fun startVoiceInput(silenceThresholdMs: Double?, maxDurationMs: Double?, listeningText: String?, preferSpeechToText: Boolean?, onChunk: ((chunk: VoiceInputChunk) -> Unit)?, language: String?): Promise<VoiceInputResult>
|
|
41
|
-
|
|
42
|
-
@DoNotStrip
|
|
43
|
-
@Keep
|
|
44
|
-
private fun startVoiceInput_cxx(silenceThresholdMs: Double?, maxDurationMs: Double?, listeningText: String?, preferSpeechToText: Boolean?, onChunk: Func_void_VoiceInputChunk?, language: String?): Promise<VoiceInputResult> {
|
|
45
|
-
val __result = startVoiceInput(silenceThresholdMs, maxDurationMs, listeningText, preferSpeechToText, onChunk?.let { it }, language)
|
|
46
|
-
return __result
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@DoNotStrip
|
|
50
|
-
@Keep
|
|
51
|
-
abstract fun stopVoiceInput(): Unit
|
|
52
|
-
|
|
53
|
-
// Default implementation of `HybridObject.toString()`
|
|
54
|
-
override fun toString(): String {
|
|
55
|
-
return "[HybridObject Voice]"
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// C++ backing class
|
|
59
|
-
@DoNotStrip
|
|
60
|
-
@Keep
|
|
61
|
-
protected open class CxxPart(javaPart: HybridVoiceSpec): HybridObject.CxxPart(javaPart) {
|
|
62
|
-
// C++ JHybridVoiceSpec::CxxPart::initHybrid(...)
|
|
63
|
-
external override fun initHybrid(): HybridData
|
|
64
|
-
}
|
|
65
|
-
override fun createCxxPart(): CxxPart {
|
|
66
|
-
return CxxPart(this)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
companion object {
|
|
70
|
-
protected const val TAG = "HybridVoiceSpec"
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// VoiceInputChunk.kt
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
package com.margelo.nitro.swe.iternio.reactnativeautoplay
|
|
9
|
-
|
|
10
|
-
import androidx.annotation.Keep
|
|
11
|
-
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
-
import com.margelo.nitro.core.ArrayBuffer
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Represents the JavaScript object/struct "VoiceInputChunk".
|
|
16
|
-
*/
|
|
17
|
-
@DoNotStrip
|
|
18
|
-
@Keep
|
|
19
|
-
data class VoiceInputChunk(
|
|
20
|
-
@DoNotStrip
|
|
21
|
-
@Keep
|
|
22
|
-
val partial: String?,
|
|
23
|
-
@DoNotStrip
|
|
24
|
-
@Keep
|
|
25
|
-
val audio: ArrayBuffer?
|
|
26
|
-
) {
|
|
27
|
-
/* primary constructor */
|
|
28
|
-
|
|
29
|
-
companion object {
|
|
30
|
-
/**
|
|
31
|
-
* Constructor called from C++
|
|
32
|
-
*/
|
|
33
|
-
@DoNotStrip
|
|
34
|
-
@Keep
|
|
35
|
-
@Suppress("unused")
|
|
36
|
-
@JvmStatic
|
|
37
|
-
private fun fromCpp(partial: String?, audio: ArrayBuffer?): VoiceInputChunk {
|
|
38
|
-
return VoiceInputChunk(partial, audio)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// VoiceInputResult.kt
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
package com.margelo.nitro.swe.iternio.reactnativeautoplay
|
|
9
|
-
|
|
10
|
-
import androidx.annotation.Keep
|
|
11
|
-
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
-
import com.margelo.nitro.core.ArrayBuffer
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Represents the JavaScript object/struct "VoiceInputResult".
|
|
16
|
-
*/
|
|
17
|
-
@DoNotStrip
|
|
18
|
-
@Keep
|
|
19
|
-
data class VoiceInputResult(
|
|
20
|
-
@DoNotStrip
|
|
21
|
-
@Keep
|
|
22
|
-
val transcription: String?,
|
|
23
|
-
@DoNotStrip
|
|
24
|
-
@Keep
|
|
25
|
-
val audio: ArrayBuffer?
|
|
26
|
-
) {
|
|
27
|
-
/* primary constructor */
|
|
28
|
-
|
|
29
|
-
companion object {
|
|
30
|
-
/**
|
|
31
|
-
* Constructor called from C++
|
|
32
|
-
*/
|
|
33
|
-
@DoNotStrip
|
|
34
|
-
@Keep
|
|
35
|
-
@Suppress("unused")
|
|
36
|
-
@JvmStatic
|
|
37
|
-
private fun fromCpp(transcription: String?, audio: ArrayBuffer?): VoiceInputResult {
|
|
38
|
-
return VoiceInputResult(transcription, audio)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridVoiceSpecSwift.cpp
|
|
3
|
-
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
-
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
-
///
|
|
7
|
-
|
|
8
|
-
#include "HybridVoiceSpecSwift.hpp"
|
|
9
|
-
|
|
10
|
-
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
11
|
-
} // namespace margelo::nitro::swe::iternio::reactnativeautoplay
|