@fishjam-cloud/react-native-client 0.4.0 → 0.4.1
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/android/build.gradle
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import AVFoundation
|
|
2
|
+
|
|
3
|
+
class PermissionUtils {
|
|
4
|
+
static func requestCameraPermission() async -> Bool { await requestAccessIfNeeded(for: .video) }
|
|
5
|
+
static func requestMicrophonePermission() async -> Bool { await requestAccessIfNeeded(for: .audio) }
|
|
6
|
+
|
|
7
|
+
private static func requestAccessIfNeeded(for mediaType: AVMediaType) async -> Bool {
|
|
8
|
+
let status = AVCaptureDevice.authorizationStatus(for: mediaType)
|
|
9
|
+
|
|
10
|
+
return if status == .notDetermined {
|
|
11
|
+
await AVCaptureDevice.requestAccess(for: mediaType)
|
|
12
|
+
} else {
|
|
13
|
+
status == .authorized
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
protocol LocalCameraTrackChangedListener: AnyObject {
|
|
4
|
+
func onLocalCameraTrackChanged()
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
class LocalCameraTracksChangedListenersManager {
|
|
8
|
+
private var listeners: [LocalCameraTrackChangedListener] = []
|
|
9
|
+
|
|
10
|
+
func add(_ listener: LocalCameraTrackChangedListener) {
|
|
11
|
+
listeners.append(listener)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
func remove(_ listener: LocalCameraTrackChangedListener) {
|
|
15
|
+
listeners.removeAll { $0 === listener }
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
func notifyListeners() {
|
|
19
|
+
for listener in listeners {
|
|
20
|
+
listener.onLocalCameraTrackChanged()
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
protocol TrackUpdateListener: AnyObject {
|
|
2
|
+
func onTracksUpdate()
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
class TracksUpdateListenersManager {
|
|
6
|
+
private var listeners: [TrackUpdateListener] = []
|
|
7
|
+
|
|
8
|
+
func add(_ listener: TrackUpdateListener) {
|
|
9
|
+
listeners.append(listener)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
func remove(_ listener: TrackUpdateListener) {
|
|
13
|
+
listeners.removeAll { $0 === listener }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
func notifyListeners() {
|
|
17
|
+
for listener in listeners {
|
|
18
|
+
listener.onTracksUpdate()
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fishjam-cloud/react-native-client",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "A React Native client for Fishjam Cloud",
|
|
5
5
|
"author": "Fishjam Cloud Team",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"debug",
|
|
85
85
|
"android/build.gradle",
|
|
86
86
|
"android/src/**",
|
|
87
|
-
"ios
|
|
87
|
+
"ios/**/*.swift",
|
|
88
88
|
"ios/RNFishjamClient.podspec",
|
|
89
89
|
"plugin/build/**",
|
|
90
90
|
"plugin/broadcastExtensionFiles/**",
|