react-native-webrtc-nitro 1.1.0 → 1.2.3
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/3rdparty/output/android/libdatachannel/arm64-v8a/include/rtc/configuration.hpp +1 -1
- package/3rdparty/output/android/libdatachannel/arm64-v8a/include/rtc/rtc.h +9 -1
- package/3rdparty/output/android/libdatachannel/arm64-v8a/include/rtc/rtcpreceivingsession.hpp +26 -1
- package/3rdparty/output/android/libdatachannel/arm64-v8a/include/rtc/rtp.hpp +1 -1
- package/3rdparty/output/android/libdatachannel/arm64-v8a/include/rtc/rtppacketizationconfig.hpp +9 -0
- package/3rdparty/output/android/libdatachannel/arm64-v8a/include/rtc/version.h +3 -3
- package/3rdparty/output/android/libdatachannel/arm64-v8a/lib/libdatachannel.so +0 -0
- package/3rdparty/output/android/libdatachannel/armeabi-v7a/include/rtc/configuration.hpp +1 -1
- package/3rdparty/output/android/libdatachannel/armeabi-v7a/include/rtc/rtc.h +9 -1
- package/3rdparty/output/android/libdatachannel/armeabi-v7a/include/rtc/rtcpreceivingsession.hpp +26 -1
- package/3rdparty/output/android/libdatachannel/armeabi-v7a/include/rtc/rtp.hpp +1 -1
- package/3rdparty/output/android/libdatachannel/armeabi-v7a/include/rtc/rtppacketizationconfig.hpp +9 -0
- package/3rdparty/output/android/libdatachannel/armeabi-v7a/include/rtc/version.h +3 -3
- package/3rdparty/output/android/libdatachannel/armeabi-v7a/lib/libdatachannel.so +0 -0
- package/3rdparty/output/android/libdatachannel/x86/include/rtc/configuration.hpp +1 -1
- package/3rdparty/output/android/libdatachannel/x86/include/rtc/rtc.h +9 -1
- package/3rdparty/output/android/libdatachannel/x86/include/rtc/rtcpreceivingsession.hpp +26 -1
- package/3rdparty/output/android/libdatachannel/x86/include/rtc/rtp.hpp +1 -1
- package/3rdparty/output/android/libdatachannel/x86/include/rtc/rtppacketizationconfig.hpp +9 -0
- package/3rdparty/output/android/libdatachannel/x86/include/rtc/version.h +3 -3
- package/3rdparty/output/android/libdatachannel/x86/lib/libdatachannel.so +0 -0
- package/3rdparty/output/android/libdatachannel/x86_64/include/rtc/configuration.hpp +1 -1
- package/3rdparty/output/android/libdatachannel/x86_64/include/rtc/rtc.h +9 -1
- package/3rdparty/output/android/libdatachannel/x86_64/include/rtc/rtcpreceivingsession.hpp +26 -1
- package/3rdparty/output/android/libdatachannel/x86_64/include/rtc/rtp.hpp +1 -1
- package/3rdparty/output/android/libdatachannel/x86_64/include/rtc/rtppacketizationconfig.hpp +9 -0
- package/3rdparty/output/android/libdatachannel/x86_64/include/rtc/version.h +3 -3
- package/3rdparty/output/android/libdatachannel/x86_64/lib/libdatachannel.so +0 -0
- package/3rdparty/output/ios/ffmpeg.xcframework/ios-arm64/libffmpeg.a +0 -0
- package/3rdparty/output/ios/ffmpeg.xcframework/ios-arm64_x86_64-simulator/libffmpeg.a +0 -0
- package/3rdparty/output/ios/libdatachannel.xcframework/Info.plist +5 -5
- package/3rdparty/output/ios/libdatachannel.xcframework/ios-arm64/Headers/rtc/configuration.hpp +1 -1
- package/3rdparty/output/ios/libdatachannel.xcframework/ios-arm64/Headers/rtc/rtc.h +9 -1
- package/3rdparty/output/ios/libdatachannel.xcframework/ios-arm64/Headers/rtc/rtcpreceivingsession.hpp +26 -1
- package/3rdparty/output/ios/libdatachannel.xcframework/ios-arm64/Headers/rtc/rtp.hpp +1 -1
- package/3rdparty/output/ios/libdatachannel.xcframework/ios-arm64/Headers/rtc/rtppacketizationconfig.hpp +9 -0
- package/3rdparty/output/ios/libdatachannel.xcframework/ios-arm64/Headers/rtc/version.h +3 -3
- package/3rdparty/output/ios/libdatachannel.xcframework/ios-arm64/libdatachannel.a +0 -0
- package/3rdparty/output/ios/libdatachannel.xcframework/ios-arm64_x86_64-simulator/Headers/rtc/configuration.hpp +1 -1
- package/3rdparty/output/ios/libdatachannel.xcframework/ios-arm64_x86_64-simulator/Headers/rtc/rtc.h +9 -1
- package/3rdparty/output/ios/libdatachannel.xcframework/ios-arm64_x86_64-simulator/Headers/rtc/rtcpreceivingsession.hpp +26 -1
- package/3rdparty/output/ios/libdatachannel.xcframework/ios-arm64_x86_64-simulator/Headers/rtc/rtp.hpp +1 -1
- package/3rdparty/output/ios/libdatachannel.xcframework/ios-arm64_x86_64-simulator/Headers/rtc/rtppacketizationconfig.hpp +9 -0
- package/3rdparty/output/ios/libdatachannel.xcframework/ios-arm64_x86_64-simulator/Headers/rtc/version.h +3 -3
- package/3rdparty/output/ios/libdatachannel.xcframework/ios-arm64_x86_64-simulator/libdatachannel.a +0 -0
- package/README.md +563 -13
- package/android/src/main/java/com/webrtc/HybridCamera.kt +0 -1
- package/android/src/main/java/com/webrtc/HybridMicrophone.kt +0 -1
- package/android/src/main/java/com/webrtc/HybridPermissions.kt +95 -0
- package/cpp/Hybrid/HybridMediaDevices.cpp +23 -19
- package/ios/HybridCamera.swift +1 -3
- package/ios/HybridMicrophone.swift +1 -3
- package/ios/HybridPermissions.swift +63 -0
- package/lib/commonjs/index.js +11 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/Permissions.nitro.js +9 -0
- package/lib/commonjs/specs/Permissions.nitro.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/Permissions.nitro.js +6 -0
- package/lib/module/specs/Permissions.nitro.js.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/Permissions.nitro.d.ts +17 -0
- package/lib/typescript/src/specs/Permissions.nitro.d.ts.map +1 -0
- package/nitro.json +4 -0
- package/nitrogen/generated/android/Webrtc+autolinking.cmake +2 -0
- package/nitrogen/generated/android/WebrtcOnLoad.cpp +10 -0
- package/nitrogen/generated/android/c++/JHybridPermissionsSpec.cpp +91 -0
- package/nitrogen/generated/android/c++/JHybridPermissionsSpec.hpp +66 -0
- package/nitrogen/generated/android/c++/JPermissionDescriptor.hpp +58 -0
- package/nitrogen/generated/android/c++/JPermissionName.hpp +59 -0
- package/nitrogen/generated/android/c++/JPermissionState.hpp +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/webrtc/HybridPermissionsSpec.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/webrtc/PermissionDescriptor.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/webrtc/PermissionName.kt +21 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/webrtc/PermissionState.kt +22 -0
- package/nitrogen/generated/ios/Webrtc-Swift-Cxx-Bridge.cpp +25 -0
- package/nitrogen/generated/ios/Webrtc-Swift-Cxx-Bridge.hpp +63 -0
- package/nitrogen/generated/ios/Webrtc-Swift-Cxx-Umbrella.hpp +14 -0
- package/nitrogen/generated/ios/WebrtcAutolinking.mm +8 -0
- package/nitrogen/generated/ios/WebrtcAutolinking.swift +15 -0
- package/nitrogen/generated/ios/c++/HybridPermissionsSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridPermissionsSpecSwift.hpp +92 -0
- package/nitrogen/generated/ios/swift/Func_void_PermissionState.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridPermissionsSpec.swift +57 -0
- package/nitrogen/generated/ios/swift/HybridPermissionsSpec_cxx.swift +157 -0
- package/nitrogen/generated/ios/swift/PermissionDescriptor.swift +36 -0
- package/nitrogen/generated/ios/swift/PermissionName.swift +40 -0
- package/nitrogen/generated/ios/swift/PermissionState.swift +44 -0
- package/nitrogen/generated/shared/c++/HybridPermissionsSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridPermissionsSpec.hpp +68 -0
- package/nitrogen/generated/shared/c++/PermissionDescriptor.hpp +76 -0
- package/nitrogen/generated/shared/c++/PermissionName.hpp +76 -0
- package/nitrogen/generated/shared/c++/PermissionState.hpp +80 -0
- package/package.json +4 -5
- package/src/index.ts +1 -0
- package/src/specs/Permissions.nitro.ts +22 -0
- package/android/src/main/java/com/webrtc/Permission.kt +0 -58
- package/ios/Permission.swift +0 -26
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridPermissionsSpec.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.webrtc
|
|
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 Permissions HybridObject.
|
|
18
|
+
* Implement this abstract class to create Kotlin-based instances of Permissions.
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress(
|
|
23
|
+
"KotlinJniMissingFunction", "unused",
|
|
24
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
25
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
26
|
+
)
|
|
27
|
+
abstract class HybridPermissionsSpec: HybridObject() {
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
private var mHybridData: HybridData = initHybrid()
|
|
30
|
+
|
|
31
|
+
init {
|
|
32
|
+
super.updateNative(mHybridData)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
override fun updateNative(hybridData: HybridData) {
|
|
36
|
+
mHybridData = hybridData
|
|
37
|
+
super.updateNative(hybridData)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Default implementation of `HybridObject.toString()`
|
|
41
|
+
override fun toString(): String {
|
|
42
|
+
return "[HybridObject Permissions]"
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Properties
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
// Methods
|
|
49
|
+
@DoNotStrip
|
|
50
|
+
@Keep
|
|
51
|
+
abstract fun query(permissionDesc: PermissionDescriptor): Promise<PermissionState>
|
|
52
|
+
|
|
53
|
+
@DoNotStrip
|
|
54
|
+
@Keep
|
|
55
|
+
abstract fun request(permissionDesc: PermissionDescriptor): Promise<PermissionState>
|
|
56
|
+
|
|
57
|
+
private external fun initHybrid(): HybridData
|
|
58
|
+
|
|
59
|
+
companion object {
|
|
60
|
+
protected const val TAG = "HybridPermissionsSpec"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PermissionDescriptor.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.webrtc
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "PermissionDescriptor".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class PermissionDescriptor(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val name: PermissionName
|
|
23
|
+
) {
|
|
24
|
+
/* primary constructor */
|
|
25
|
+
|
|
26
|
+
private companion object {
|
|
27
|
+
/**
|
|
28
|
+
* Constructor called from C++
|
|
29
|
+
*/
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
32
|
+
@Suppress("unused")
|
|
33
|
+
@JvmStatic
|
|
34
|
+
private fun fromCpp(name: PermissionName): PermissionDescriptor {
|
|
35
|
+
return PermissionDescriptor(name)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PermissionName.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.webrtc
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "PermissionName".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class PermissionName(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
CAMERA(0),
|
|
20
|
+
MICROPHONE(1);
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// PermissionState.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.webrtc
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "PermissionState".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class PermissionState(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
DENIED(0),
|
|
20
|
+
GRANTED(1),
|
|
21
|
+
PROMPT(2);
|
|
22
|
+
}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
// Include C++ implementation defined types
|
|
11
11
|
#include "HybridCameraSpecSwift.hpp"
|
|
12
12
|
#include "HybridMicrophoneSpecSwift.hpp"
|
|
13
|
+
#include "HybridPermissionsSpecSwift.hpp"
|
|
13
14
|
#include "HybridWebrtcViewSpecSwift.hpp"
|
|
14
15
|
#include "Webrtc-Swift-Cxx-Umbrella.hpp"
|
|
15
16
|
#include <NitroModules/NitroDefines.hpp>
|
|
@@ -64,6 +65,30 @@ namespace margelo::nitro::webrtc::bridge::swift {
|
|
|
64
65
|
return swiftPart.toUnsafe();
|
|
65
66
|
}
|
|
66
67
|
|
|
68
|
+
// pragma MARK: std::function<void(PermissionState /* result */)>
|
|
69
|
+
Func_void_PermissionState create_Func_void_PermissionState(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
70
|
+
auto swiftClosure = Webrtc::Func_void_PermissionState::fromUnsafe(swiftClosureWrapper);
|
|
71
|
+
return [swiftClosure = std::move(swiftClosure)](PermissionState result) mutable -> void {
|
|
72
|
+
swiftClosure.call(static_cast<int>(result));
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// pragma MARK: std::shared_ptr<HybridPermissionsSpec>
|
|
77
|
+
std::shared_ptr<HybridPermissionsSpec> create_std__shared_ptr_HybridPermissionsSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
78
|
+
Webrtc::HybridPermissionsSpec_cxx swiftPart = Webrtc::HybridPermissionsSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
79
|
+
return std::make_shared<margelo::nitro::webrtc::HybridPermissionsSpecSwift>(swiftPart);
|
|
80
|
+
}
|
|
81
|
+
void* NON_NULL get_std__shared_ptr_HybridPermissionsSpec_(std__shared_ptr_HybridPermissionsSpec_ cppType) {
|
|
82
|
+
std::shared_ptr<margelo::nitro::webrtc::HybridPermissionsSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::webrtc::HybridPermissionsSpecSwift>(cppType);
|
|
83
|
+
#ifdef NITRO_DEBUG
|
|
84
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
85
|
+
throw std::runtime_error("Class \"HybridPermissionsSpec\" is not implemented in Swift!");
|
|
86
|
+
}
|
|
87
|
+
#endif
|
|
88
|
+
Webrtc::HybridPermissionsSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
89
|
+
return swiftPart.toUnsafe();
|
|
90
|
+
}
|
|
91
|
+
|
|
67
92
|
// pragma MARK: std::shared_ptr<HybridWebrtcViewSpec>
|
|
68
93
|
std::shared_ptr<HybridWebrtcViewSpec> create_std__shared_ptr_HybridWebrtcViewSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
69
94
|
Webrtc::HybridWebrtcViewSpec_cxx swiftPart = Webrtc::HybridWebrtcViewSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
@@ -12,21 +12,29 @@
|
|
|
12
12
|
namespace margelo::nitro::webrtc { class HybridCameraSpec; }
|
|
13
13
|
// Forward declaration of `HybridMicrophoneSpec` to properly resolve imports.
|
|
14
14
|
namespace margelo::nitro::webrtc { class HybridMicrophoneSpec; }
|
|
15
|
+
// Forward declaration of `HybridPermissionsSpec` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::webrtc { class HybridPermissionsSpec; }
|
|
15
17
|
// Forward declaration of `HybridWebrtcViewSpec` to properly resolve imports.
|
|
16
18
|
namespace margelo::nitro::webrtc { class HybridWebrtcViewSpec; }
|
|
19
|
+
// Forward declaration of `PermissionState` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::webrtc { enum class PermissionState; }
|
|
17
21
|
|
|
18
22
|
// Forward declarations of Swift defined types
|
|
19
23
|
// Forward declaration of `HybridCameraSpec_cxx` to properly resolve imports.
|
|
20
24
|
namespace Webrtc { class HybridCameraSpec_cxx; }
|
|
21
25
|
// Forward declaration of `HybridMicrophoneSpec_cxx` to properly resolve imports.
|
|
22
26
|
namespace Webrtc { class HybridMicrophoneSpec_cxx; }
|
|
27
|
+
// Forward declaration of `HybridPermissionsSpec_cxx` to properly resolve imports.
|
|
28
|
+
namespace Webrtc { class HybridPermissionsSpec_cxx; }
|
|
23
29
|
// Forward declaration of `HybridWebrtcViewSpec_cxx` to properly resolve imports.
|
|
24
30
|
namespace Webrtc { class HybridWebrtcViewSpec_cxx; }
|
|
25
31
|
|
|
26
32
|
// Include C++ defined types
|
|
27
33
|
#include "HybridCameraSpec.hpp"
|
|
28
34
|
#include "HybridMicrophoneSpec.hpp"
|
|
35
|
+
#include "HybridPermissionsSpec.hpp"
|
|
29
36
|
#include "HybridWebrtcViewSpec.hpp"
|
|
37
|
+
#include "PermissionState.hpp"
|
|
30
38
|
#include <NitroModules/Promise.hpp>
|
|
31
39
|
#include <NitroModules/PromiseHolder.hpp>
|
|
32
40
|
#include <NitroModules/Result.hpp>
|
|
@@ -131,6 +139,61 @@ namespace margelo::nitro::webrtc::bridge::swift {
|
|
|
131
139
|
using std__weak_ptr_HybridMicrophoneSpec_ = std::weak_ptr<HybridMicrophoneSpec>;
|
|
132
140
|
inline std__weak_ptr_HybridMicrophoneSpec_ weakify_std__shared_ptr_HybridMicrophoneSpec_(const std::shared_ptr<HybridMicrophoneSpec>& strong) noexcept { return strong; }
|
|
133
141
|
|
|
142
|
+
// pragma MARK: std::shared_ptr<Promise<PermissionState>>
|
|
143
|
+
/**
|
|
144
|
+
* Specialized version of `std::shared_ptr<Promise<PermissionState>>`.
|
|
145
|
+
*/
|
|
146
|
+
using std__shared_ptr_Promise_PermissionState__ = std::shared_ptr<Promise<PermissionState>>;
|
|
147
|
+
inline std::shared_ptr<Promise<PermissionState>> create_std__shared_ptr_Promise_PermissionState__() noexcept {
|
|
148
|
+
return Promise<PermissionState>::create();
|
|
149
|
+
}
|
|
150
|
+
inline PromiseHolder<PermissionState> wrap_std__shared_ptr_Promise_PermissionState__(std::shared_ptr<Promise<PermissionState>> promise) noexcept {
|
|
151
|
+
return PromiseHolder<PermissionState>(std::move(promise));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// pragma MARK: std::function<void(PermissionState /* result */)>
|
|
155
|
+
/**
|
|
156
|
+
* Specialized version of `std::function<void(PermissionState)>`.
|
|
157
|
+
*/
|
|
158
|
+
using Func_void_PermissionState = std::function<void(PermissionState /* result */)>;
|
|
159
|
+
/**
|
|
160
|
+
* Wrapper class for a `std::function<void(PermissionState / * result * /)>`, this can be used from Swift.
|
|
161
|
+
*/
|
|
162
|
+
class Func_void_PermissionState_Wrapper final {
|
|
163
|
+
public:
|
|
164
|
+
explicit Func_void_PermissionState_Wrapper(std::function<void(PermissionState /* result */)>&& func): _function(std::make_unique<std::function<void(PermissionState /* result */)>>(std::move(func))) {}
|
|
165
|
+
inline void call(int result) const noexcept {
|
|
166
|
+
_function->operator()(static_cast<PermissionState>(result));
|
|
167
|
+
}
|
|
168
|
+
private:
|
|
169
|
+
std::unique_ptr<std::function<void(PermissionState /* result */)>> _function;
|
|
170
|
+
} SWIFT_NONCOPYABLE;
|
|
171
|
+
Func_void_PermissionState create_Func_void_PermissionState(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
172
|
+
inline Func_void_PermissionState_Wrapper wrap_Func_void_PermissionState(Func_void_PermissionState value) noexcept {
|
|
173
|
+
return Func_void_PermissionState_Wrapper(std::move(value));
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// pragma MARK: std::shared_ptr<HybridPermissionsSpec>
|
|
177
|
+
/**
|
|
178
|
+
* Specialized version of `std::shared_ptr<HybridPermissionsSpec>`.
|
|
179
|
+
*/
|
|
180
|
+
using std__shared_ptr_HybridPermissionsSpec_ = std::shared_ptr<HybridPermissionsSpec>;
|
|
181
|
+
std::shared_ptr<HybridPermissionsSpec> create_std__shared_ptr_HybridPermissionsSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
182
|
+
void* NON_NULL get_std__shared_ptr_HybridPermissionsSpec_(std__shared_ptr_HybridPermissionsSpec_ cppType);
|
|
183
|
+
|
|
184
|
+
// pragma MARK: std::weak_ptr<HybridPermissionsSpec>
|
|
185
|
+
using std__weak_ptr_HybridPermissionsSpec_ = std::weak_ptr<HybridPermissionsSpec>;
|
|
186
|
+
inline std__weak_ptr_HybridPermissionsSpec_ weakify_std__shared_ptr_HybridPermissionsSpec_(const std::shared_ptr<HybridPermissionsSpec>& strong) noexcept { return strong; }
|
|
187
|
+
|
|
188
|
+
// pragma MARK: Result<std::shared_ptr<Promise<PermissionState>>>
|
|
189
|
+
using Result_std__shared_ptr_Promise_PermissionState___ = Result<std::shared_ptr<Promise<PermissionState>>>;
|
|
190
|
+
inline Result_std__shared_ptr_Promise_PermissionState___ create_Result_std__shared_ptr_Promise_PermissionState___(const std::shared_ptr<Promise<PermissionState>>& value) noexcept {
|
|
191
|
+
return Result<std::shared_ptr<Promise<PermissionState>>>::withValue(value);
|
|
192
|
+
}
|
|
193
|
+
inline Result_std__shared_ptr_Promise_PermissionState___ create_Result_std__shared_ptr_Promise_PermissionState___(const std::exception_ptr& error) noexcept {
|
|
194
|
+
return Result<std::shared_ptr<Promise<PermissionState>>>::withError(error);
|
|
195
|
+
}
|
|
196
|
+
|
|
134
197
|
// pragma MARK: std::optional<std::string>
|
|
135
198
|
/**
|
|
136
199
|
* Specialized version of `std::optional<std::string>`.
|
|
@@ -12,13 +12,25 @@
|
|
|
12
12
|
namespace margelo::nitro::webrtc { class HybridCameraSpec; }
|
|
13
13
|
// Forward declaration of `HybridMicrophoneSpec` to properly resolve imports.
|
|
14
14
|
namespace margelo::nitro::webrtc { class HybridMicrophoneSpec; }
|
|
15
|
+
// Forward declaration of `HybridPermissionsSpec` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::webrtc { class HybridPermissionsSpec; }
|
|
15
17
|
// Forward declaration of `HybridWebrtcViewSpec` to properly resolve imports.
|
|
16
18
|
namespace margelo::nitro::webrtc { class HybridWebrtcViewSpec; }
|
|
19
|
+
// Forward declaration of `PermissionDescriptor` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::webrtc { struct PermissionDescriptor; }
|
|
21
|
+
// Forward declaration of `PermissionName` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::webrtc { enum class PermissionName; }
|
|
23
|
+
// Forward declaration of `PermissionState` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::webrtc { enum class PermissionState; }
|
|
17
25
|
|
|
18
26
|
// Include C++ defined types
|
|
19
27
|
#include "HybridCameraSpec.hpp"
|
|
20
28
|
#include "HybridMicrophoneSpec.hpp"
|
|
29
|
+
#include "HybridPermissionsSpec.hpp"
|
|
21
30
|
#include "HybridWebrtcViewSpec.hpp"
|
|
31
|
+
#include "PermissionDescriptor.hpp"
|
|
32
|
+
#include "PermissionName.hpp"
|
|
33
|
+
#include "PermissionState.hpp"
|
|
22
34
|
#include <NitroModules/Promise.hpp>
|
|
23
35
|
#include <NitroModules/Result.hpp>
|
|
24
36
|
#include <exception>
|
|
@@ -40,6 +52,8 @@ namespace margelo::nitro::webrtc { class HybridWebrtcViewSpec; }
|
|
|
40
52
|
namespace Webrtc { class HybridCameraSpec_cxx; }
|
|
41
53
|
// Forward declaration of `HybridMicrophoneSpec_cxx` to properly resolve imports.
|
|
42
54
|
namespace Webrtc { class HybridMicrophoneSpec_cxx; }
|
|
55
|
+
// Forward declaration of `HybridPermissionsSpec_cxx` to properly resolve imports.
|
|
56
|
+
namespace Webrtc { class HybridPermissionsSpec_cxx; }
|
|
43
57
|
// Forward declaration of `HybridWebrtcViewSpec_cxx` to properly resolve imports.
|
|
44
58
|
namespace Webrtc { class HybridWebrtcViewSpec_cxx; }
|
|
45
59
|
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
#import "Webrtc-Swift-Cxx-Umbrella.hpp"
|
|
11
11
|
#import <type_traits>
|
|
12
12
|
|
|
13
|
+
#include "HybridPermissionsSpecSwift.hpp"
|
|
13
14
|
#include "HybridMicrophoneSpecSwift.hpp"
|
|
14
15
|
#include "HybridCameraSpecSwift.hpp"
|
|
15
16
|
#include "HybridMediaStreamTrack.hpp"
|
|
@@ -31,6 +32,13 @@
|
|
|
31
32
|
using namespace margelo::nitro;
|
|
32
33
|
using namespace margelo::nitro::webrtc;
|
|
33
34
|
|
|
35
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
36
|
+
"Permissions",
|
|
37
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
38
|
+
std::shared_ptr<HybridPermissionsSpec> hybridObject = Webrtc::WebrtcAutolinking::createPermissions();
|
|
39
|
+
return hybridObject;
|
|
40
|
+
}
|
|
41
|
+
);
|
|
34
42
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
35
43
|
"Microphone",
|
|
36
44
|
[]() -> std::shared_ptr<HybridObject> {
|
|
@@ -8,6 +8,21 @@
|
|
|
8
8
|
public final class WebrtcAutolinking {
|
|
9
9
|
public typealias bridge = margelo.nitro.webrtc.bridge.swift
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of a Swift class that implements `HybridPermissionsSpec`,
|
|
13
|
+
* and wraps it in a Swift class that can directly interop with C++ (`HybridPermissionsSpec_cxx`)
|
|
14
|
+
*
|
|
15
|
+
* This is generated by Nitrogen and will initialize the class specified
|
|
16
|
+
* in the `"autolinking"` property of `nitro.json` (in this case, `HybridPermissions`).
|
|
17
|
+
*/
|
|
18
|
+
public static func createPermissions() -> bridge.std__shared_ptr_HybridPermissionsSpec_ {
|
|
19
|
+
let hybridObject = HybridPermissions()
|
|
20
|
+
return { () -> bridge.std__shared_ptr_HybridPermissionsSpec_ in
|
|
21
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
22
|
+
return __cxxWrapped.getCxxPart()
|
|
23
|
+
}()
|
|
24
|
+
}
|
|
25
|
+
|
|
11
26
|
/**
|
|
12
27
|
* Creates an instance of a Swift class that implements `HybridMicrophoneSpec`,
|
|
13
28
|
* and wraps it in a Swift class that can directly interop with C++ (`HybridMicrophoneSpec_cxx`)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridPermissionsSpecSwift.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridPermissionsSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::webrtc {
|
|
11
|
+
} // namespace margelo::nitro::webrtc
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridPermissionsSpecSwift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridPermissionsSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridPermissionsSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace Webrtc { class HybridPermissionsSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `PermissionState` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::webrtc { enum class PermissionState; }
|
|
17
|
+
// Forward declaration of `PermissionDescriptor` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::webrtc { struct PermissionDescriptor; }
|
|
19
|
+
// Forward declaration of `PermissionName` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::webrtc { enum class PermissionName; }
|
|
21
|
+
|
|
22
|
+
#include "PermissionState.hpp"
|
|
23
|
+
#include <NitroModules/Promise.hpp>
|
|
24
|
+
#include "PermissionDescriptor.hpp"
|
|
25
|
+
#include "PermissionName.hpp"
|
|
26
|
+
|
|
27
|
+
#include "Webrtc-Swift-Cxx-Umbrella.hpp"
|
|
28
|
+
|
|
29
|
+
namespace margelo::nitro::webrtc {
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The C++ part of HybridPermissionsSpec_cxx.swift.
|
|
33
|
+
*
|
|
34
|
+
* HybridPermissionsSpecSwift (C++) accesses HybridPermissionsSpec_cxx (Swift), and might
|
|
35
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
36
|
+
*
|
|
37
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
38
|
+
* the future, HybridPermissionsSpec_cxx can directly inherit from the C++ class HybridPermissionsSpec
|
|
39
|
+
* to simplify the whole structure and memory management.
|
|
40
|
+
*/
|
|
41
|
+
class HybridPermissionsSpecSwift: public virtual HybridPermissionsSpec {
|
|
42
|
+
public:
|
|
43
|
+
// Constructor from a Swift instance
|
|
44
|
+
explicit HybridPermissionsSpecSwift(const Webrtc::HybridPermissionsSpec_cxx& swiftPart):
|
|
45
|
+
HybridObject(HybridPermissionsSpec::TAG),
|
|
46
|
+
_swiftPart(swiftPart) { }
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
// Get the Swift part
|
|
50
|
+
inline Webrtc::HybridPermissionsSpec_cxx& getSwiftPart() noexcept {
|
|
51
|
+
return _swiftPart;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
56
|
+
return _swiftPart.getMemorySize();
|
|
57
|
+
}
|
|
58
|
+
void dispose() noexcept override {
|
|
59
|
+
_swiftPart.dispose();
|
|
60
|
+
}
|
|
61
|
+
std::string toString() override {
|
|
62
|
+
return _swiftPart.toString();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public:
|
|
66
|
+
// Properties
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
public:
|
|
70
|
+
// Methods
|
|
71
|
+
inline std::shared_ptr<Promise<PermissionState>> query(const PermissionDescriptor& permissionDesc) override {
|
|
72
|
+
auto __result = _swiftPart.query(std::forward<decltype(permissionDesc)>(permissionDesc));
|
|
73
|
+
if (__result.hasError()) [[unlikely]] {
|
|
74
|
+
std::rethrow_exception(__result.error());
|
|
75
|
+
}
|
|
76
|
+
auto __value = std::move(__result.value());
|
|
77
|
+
return __value;
|
|
78
|
+
}
|
|
79
|
+
inline std::shared_ptr<Promise<PermissionState>> request(const PermissionDescriptor& permissionDesc) override {
|
|
80
|
+
auto __result = _swiftPart.request(std::forward<decltype(permissionDesc)>(permissionDesc));
|
|
81
|
+
if (__result.hasError()) [[unlikely]] {
|
|
82
|
+
std::rethrow_exception(__result.error());
|
|
83
|
+
}
|
|
84
|
+
auto __value = std::move(__result.value());
|
|
85
|
+
return __value;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private:
|
|
89
|
+
Webrtc::HybridPermissionsSpec_cxx _swiftPart;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
} // namespace margelo::nitro::webrtc
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_PermissionState.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a Swift `(_ value: PermissionState) -> Void` as a class.
|
|
13
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
+
*/
|
|
15
|
+
public final class Func_void_PermissionState {
|
|
16
|
+
public typealias bridge = margelo.nitro.webrtc.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ value: PermissionState) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ value: PermissionState) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(value: Int32) -> Void {
|
|
26
|
+
self.closure(margelo.nitro.webrtc.PermissionState(rawValue: value)!)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_PermissionState`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_PermissionState>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_PermissionState {
|
|
45
|
+
return Unmanaged<Func_void_PermissionState>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridPermissionsSpec.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/// See ``HybridPermissionsSpec``
|
|
12
|
+
public protocol HybridPermissionsSpec_protocol: HybridObject {
|
|
13
|
+
// Properties
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// Methods
|
|
17
|
+
func query(permissionDesc: PermissionDescriptor) throws -> Promise<PermissionState>
|
|
18
|
+
func request(permissionDesc: PermissionDescriptor) throws -> Promise<PermissionState>
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public extension HybridPermissionsSpec_protocol {
|
|
22
|
+
/// Default implementation of ``HybridObject.toString``
|
|
23
|
+
func toString() -> String {
|
|
24
|
+
return "[HybridObject Permissions]"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/// See ``HybridPermissionsSpec``
|
|
29
|
+
open class HybridPermissionsSpec_base {
|
|
30
|
+
private weak var cxxWrapper: HybridPermissionsSpec_cxx? = nil
|
|
31
|
+
public init() { }
|
|
32
|
+
public func getCxxWrapper() -> HybridPermissionsSpec_cxx {
|
|
33
|
+
#if DEBUG
|
|
34
|
+
guard self is HybridPermissionsSpec else {
|
|
35
|
+
fatalError("`self` is not a `HybridPermissionsSpec`! Did you accidentally inherit from `HybridPermissionsSpec_base` instead of `HybridPermissionsSpec`?")
|
|
36
|
+
}
|
|
37
|
+
#endif
|
|
38
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
39
|
+
return cxxWrapper
|
|
40
|
+
} else {
|
|
41
|
+
let cxxWrapper = HybridPermissionsSpec_cxx(self as! HybridPermissionsSpec)
|
|
42
|
+
self.cxxWrapper = cxxWrapper
|
|
43
|
+
return cxxWrapper
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* A Swift base-protocol representing the Permissions HybridObject.
|
|
50
|
+
* Implement this protocol to create Swift-based instances of Permissions.
|
|
51
|
+
* ```swift
|
|
52
|
+
* class HybridPermissions : HybridPermissionsSpec {
|
|
53
|
+
* // ...
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
public typealias HybridPermissionsSpec = HybridPermissionsSpec_protocol & HybridPermissionsSpec_base
|