@stream-io/react-native-callingx 0.1.0-beta.5 → 0.1.0-beta.7
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 +9 -0
- package/android/src/main/java/io/getstream/rn/callingx/CallService.kt +28 -43
- package/android/src/main/java/io/getstream/rn/callingx/CallingxEventEmitterAdapter.kt +7 -0
- package/android/src/main/java/io/getstream/rn/callingx/{CallingxModule.kt → CallingxModuleImpl.kt} +53 -51
- package/android/src/main/java/io/getstream/rn/callingx/notifications/CallNotificationManager.kt +9 -9
- package/android/src/main/java/io/getstream/rn/callingx/notifications/NotificationIntentFactory.kt +8 -8
- package/android/src/main/java/io/getstream/rn/callingx/notifications/NotificationReceiverActivity.kt +7 -7
- package/android/src/main/java/io/getstream/rn/callingx/notifications/NotificationReceiverService.kt +7 -7
- package/android/src/newarch/java/io/getstream/rn/callingx/CallingxModule.kt +148 -0
- package/android/src/oldarch/java/io/getstream/rn/callingx/CallingxModule.kt +177 -0
- package/android/src/oldarch/java/io/getstream/rn/callingx/CallingxPackage.kt +16 -0
- package/dist/module/EventManager.js +11 -4
- package/dist/module/EventManager.js.map +1 -1
- package/dist/module/spec/NativeCallingx.js +4 -2
- package/dist/module/spec/NativeCallingx.js.map +1 -1
- package/dist/module/utils/utils.js +3 -0
- package/dist/module/utils/utils.js.map +1 -1
- package/dist/typescript/src/EventManager.d.ts.map +1 -1
- package/dist/typescript/src/spec/NativeCallingx.d.ts +2 -2
- package/dist/typescript/src/spec/NativeCallingx.d.ts.map +1 -1
- package/dist/typescript/src/utils/utils.d.ts +1 -0
- package/dist/typescript/src/utils/utils.d.ts.map +1 -1
- package/ios/Callingx.mm +312 -18
- package/package.json +1 -1
- package/src/EventManager.ts +18 -5
- package/src/spec/NativeCallingx.ts +11 -2
- package/src/utils/utils.ts +3 -0
- package/android/bin/build/generated/source/buildConfig/debug/io/getstream/rn/callingx/BuildConfig.class +0 -0
- package/android/bin/build/generated/source/codegen/java/io/getstream/rn/callingx/NativeCallingxSpec.class +0 -0
- package/android/bin/build/generated/source/codegen/jni/CMakeLists.txt +0 -28
- package/android/bin/build/generated/source/codegen/jni/CallingxSpec-generated.cpp +0 -167
- package/android/bin/build/generated/source/codegen/jni/CallingxSpec.h +0 -31
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/CallingxSpecJSI-generated.cpp +0 -196
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/CallingxSpecJSI.h +0 -283
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/ComponentDescriptors.cpp +0 -22
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/ComponentDescriptors.h +0 -24
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/EventEmitters.cpp +0 -16
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/EventEmitters.h +0 -17
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/Props.cpp +0 -19
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/Props.h +0 -18
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/ShadowNodes.cpp +0 -17
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/ShadowNodes.h +0 -23
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/States.cpp +0 -16
- package/android/bin/build/generated/source/codegen/jni/react/renderer/components/CallingxSpec/States.h +0 -20
- package/android/bin/build/generated/source/codegen/schema.json +0 -1
- package/android/bin/src/main/AndroidManifest.xml +0 -29
- package/android/bin/src/main/java/io/getstream/rn/callingx/notifications/NotificationChannelsManager.kt +0 -104
- /package/android/src/{main → newarch}/java/io/getstream/rn/callingx/CallingxPackage.kt +0 -0
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
package io.getstream.rn.callingx.notifications
|
|
2
|
-
|
|
3
|
-
import android.content.Context
|
|
4
|
-
import android.os.Build
|
|
5
|
-
import androidx.core.app.NotificationChannelCompat
|
|
6
|
-
import androidx.core.app.NotificationManagerCompat
|
|
7
|
-
import io.getstream.rn.callingx.debugLog
|
|
8
|
-
|
|
9
|
-
class NotificationChannelsManager(
|
|
10
|
-
private val context: Context,
|
|
11
|
-
private val notificationManager: NotificationManagerCompat =
|
|
12
|
-
NotificationManagerCompat.from(context)
|
|
13
|
-
) {
|
|
14
|
-
|
|
15
|
-
private var notificationsConfig: NotificationsConfig.Channels? = null
|
|
16
|
-
|
|
17
|
-
companion object {
|
|
18
|
-
private const val TAG = "[Callingx] NotificationChannelsManager"
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
data class NotificationStatus(
|
|
22
|
-
val canPost: Boolean,
|
|
23
|
-
val hasPermissions: Boolean,
|
|
24
|
-
val areNotificationsEnabled: Boolean,
|
|
25
|
-
val isIncomingChannelEnabled: Boolean,
|
|
26
|
-
val isOngoingChannelEnabled: Boolean,
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
fun setNotificationsConfig(notificationsConfig: NotificationsConfig.Channels) {
|
|
30
|
-
this.notificationsConfig = notificationsConfig
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
fun createNotificationChannels() {
|
|
34
|
-
notificationsConfig?.let {
|
|
35
|
-
val incomingChannel = createNotificationChannel(it.incomingChannel)
|
|
36
|
-
val ongoingChannel = createNotificationChannel(it.ongoingChannel)
|
|
37
|
-
|
|
38
|
-
notificationManager.createNotificationChannelsCompat(
|
|
39
|
-
listOf(
|
|
40
|
-
incomingChannel,
|
|
41
|
-
ongoingChannel,
|
|
42
|
-
),
|
|
43
|
-
)
|
|
44
|
-
debugLog(TAG, "createNotificationChannels: Notification channels registered")
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
fun getNotificationStatus(): NotificationStatus {
|
|
49
|
-
val areNotificationsEnabled = areNotificationsEnabled()
|
|
50
|
-
val hasPermissions = hasNotificationPermissions()
|
|
51
|
-
val isIncomingChannelEnabled = isChannelEnabled(notificationsConfig?.incomingChannel?.id)
|
|
52
|
-
val isOngoingChannelEnabled = isChannelEnabled(notificationsConfig?.ongoingChannel?.id)
|
|
53
|
-
|
|
54
|
-
val canPost =
|
|
55
|
-
areNotificationsEnabled &&
|
|
56
|
-
hasPermissions &&
|
|
57
|
-
isIncomingChannelEnabled &&
|
|
58
|
-
isOngoingChannelEnabled
|
|
59
|
-
|
|
60
|
-
return NotificationStatus(
|
|
61
|
-
canPost,
|
|
62
|
-
hasPermissions,
|
|
63
|
-
areNotificationsEnabled,
|
|
64
|
-
isIncomingChannelEnabled,
|
|
65
|
-
isOngoingChannelEnabled
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
private fun createNotificationChannel(
|
|
70
|
-
config: NotificationsConfig.ChannelParams
|
|
71
|
-
): NotificationChannelCompat {
|
|
72
|
-
return NotificationChannelCompat.Builder(config.id, config.importance)
|
|
73
|
-
.apply {
|
|
74
|
-
setName(config.name)
|
|
75
|
-
setVibrationEnabled(config.vibration)
|
|
76
|
-
setSound(null, null)
|
|
77
|
-
}
|
|
78
|
-
.build()
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
private fun areNotificationsEnabled(): Boolean {
|
|
82
|
-
return notificationManager.areNotificationsEnabled()
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
private fun hasNotificationPermissions(): Boolean {
|
|
86
|
-
// CallStyle notifications are exempt from POST_NOTIFICATIONS on Android 13+
|
|
87
|
-
// when the app self-manages phone calls (MANAGE_OWN_CALLS + ConnectionService).
|
|
88
|
-
// This package uses that path, so we always allow posting call notifications.
|
|
89
|
-
return true
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
private fun isChannelEnabled(channelId: String?): Boolean {
|
|
93
|
-
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
|
94
|
-
return true
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (channelId == null) {
|
|
98
|
-
return false
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
val channel = notificationManager.getNotificationChannel(channelId)
|
|
102
|
-
return channel != null && channel.importance != NotificationManagerCompat.IMPORTANCE_NONE
|
|
103
|
-
}
|
|
104
|
-
}
|
|
File without changes
|