@100mslive/react-native-hms 1.9.8 → 1.9.10
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 +5 -4
- package/android/local.properties +8 -1
- package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +2 -0
- package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +98 -4
- package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +14 -7
- package/android/src/main/java/com/reactnativehmssdk/Interactivity/HMSInteractivityDecoder.kt +328 -0
- package/android/src/main/java/com/reactnativehmssdk/Interactivity/HMSInteractivityHelper.kt +352 -0
- package/android/src/main/java/com/reactnativehmssdk/Interactivity/HMSRNInteractivityCenter.kt +184 -0
- package/ios/HMSConstants.swift +1 -0
- package/ios/HMSDecoder.swift +3 -1
- package/ios/HMSInteractivityDecoder.swift +223 -0
- package/ios/HMSInteractivityHelper.swift +169 -0
- package/ios/HMSManager.m +17 -0
- package/ios/HMSManager.swift +30 -1
- package/ios/HMSRNInteractivityCenter.swift +89 -0
- package/ios/HMSRNSDK.swift +10 -4
- package/ios/Hmssdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcuserdata/jatinnagar.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/Hmssdk.xcodeproj/xcuserdata/jatinnagar.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/lib/commonjs/classes/HMSInteractivityCenter.js +93 -0
- package/lib/commonjs/classes/HMSInteractivityCenter.js.map +1 -0
- package/lib/commonjs/classes/HMSInteractivityEncoder.js +33 -0
- package/lib/commonjs/classes/HMSInteractivityEncoder.js.map +1 -0
- package/lib/commonjs/classes/HMSPermissions.js +4 -0
- package/lib/commonjs/classes/HMSPermissions.js.map +1 -1
- package/lib/commonjs/classes/HMSPollsListenerActions.js +11 -0
- package/lib/commonjs/classes/HMSPollsListenerActions.js.map +1 -0
- package/lib/commonjs/classes/HMSSDK.js +8 -0
- package/lib/commonjs/classes/HMSSDK.js.map +1 -1
- package/lib/commonjs/classes/polls/HMSPoll.js +6 -0
- package/lib/commonjs/classes/polls/HMSPoll.js.map +1 -0
- package/lib/commonjs/classes/polls/HMSPollCategory.js +12 -0
- package/lib/commonjs/classes/polls/HMSPollCategory.js.map +1 -0
- package/lib/commonjs/classes/polls/HMSPollCreateParams.js +6 -0
- package/lib/commonjs/classes/polls/HMSPollCreateParams.js.map +1 -0
- package/lib/commonjs/classes/polls/HMSPollQuestion.js +6 -0
- package/lib/commonjs/classes/polls/HMSPollQuestion.js.map +1 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionAnswer.js +2 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionAnswer.js.map +1 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionCreateParams.js +6 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionCreateParams.js.map +1 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionOption.js +2 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionOption.js.map +1 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionOptionCreateParams.js +6 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionOptionCreateParams.js.map +1 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionQuizOptionCreateParams.js +6 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionQuizOptionCreateParams.js.map +1 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionResponse.js +6 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionResponse.js.map +1 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionResponseCreateParams.js +6 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionResponseCreateParams.js.map +1 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionResponseResult.js +2 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionResponseResult.js.map +1 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionResult.js +2 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionResult.js.map +1 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionType.js +14 -0
- package/lib/commonjs/classes/polls/HMSPollQuestionType.js.map +1 -0
- package/lib/commonjs/classes/polls/HMSPollResponsePeerInfo.js +2 -0
- package/lib/commonjs/classes/polls/HMSPollResponsePeerInfo.js.map +1 -0
- package/lib/commonjs/classes/polls/HMSPollResult.js +6 -0
- package/lib/commonjs/classes/polls/HMSPollResult.js.map +1 -0
- package/lib/commonjs/classes/polls/HMSPollState.js +13 -0
- package/lib/commonjs/classes/polls/HMSPollState.js.map +1 -0
- package/lib/commonjs/classes/polls/HMSPollType.js +12 -0
- package/lib/commonjs/classes/polls/HMSPollType.js.map +1 -0
- package/lib/commonjs/classes/polls/HMSPollUpdateType.js +13 -0
- package/lib/commonjs/classes/polls/HMSPollUpdateType.js.map +1 -0
- package/lib/commonjs/classes/polls/HMSPollUserTrackingMode.js +13 -0
- package/lib/commonjs/classes/polls/HMSPollUserTrackingMode.js.map +1 -0
- package/lib/commonjs/hooks/polls.js +17 -0
- package/lib/commonjs/hooks/polls.js.map +1 -0
- package/lib/commonjs/index.js +68 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/stores/hms-interactivity-store.js +21 -0
- package/lib/commonjs/stores/hms-interactivity-store.js.map +1 -0
- package/lib/commonjs/stores/hms-polls-slice.js +19 -0
- package/lib/commonjs/stores/hms-polls-slice.js.map +1 -0
- package/lib/commonjs/stores/types.js.map +1 -1
- package/lib/commonjs/utils/emitter/EventEmitter.js +19 -0
- package/lib/commonjs/utils/emitter/EventEmitter.js.map +1 -1
- package/lib/commonjs/utils/windowController.js +30 -0
- package/lib/commonjs/utils/windowController.js.map +1 -0
- package/lib/module/classes/HMSInteractivityCenter.js +85 -0
- package/lib/module/classes/HMSInteractivityCenter.js.map +1 -0
- package/lib/module/classes/HMSInteractivityEncoder.js +26 -0
- package/lib/module/classes/HMSInteractivityEncoder.js.map +1 -0
- package/lib/module/classes/HMSPermissions.js +4 -0
- package/lib/module/classes/HMSPermissions.js.map +1 -1
- package/lib/module/classes/HMSPollsListenerActions.js +5 -0
- package/lib/module/classes/HMSPollsListenerActions.js.map +1 -0
- package/lib/module/classes/HMSSDK.js +8 -0
- package/lib/module/classes/HMSSDK.js.map +1 -1
- package/lib/module/classes/polls/HMSPoll.js +2 -0
- package/lib/module/classes/polls/HMSPoll.js.map +1 -0
- package/lib/module/classes/polls/HMSPollCategory.js +6 -0
- package/lib/module/classes/polls/HMSPollCategory.js.map +1 -0
- package/lib/module/classes/polls/HMSPollCreateParams.js +2 -0
- package/lib/module/classes/polls/HMSPollCreateParams.js.map +1 -0
- package/lib/module/classes/polls/HMSPollQuestion.js +2 -0
- package/lib/module/classes/polls/HMSPollQuestion.js.map +1 -0
- package/lib/module/classes/polls/HMSPollQuestionAnswer.js +2 -0
- package/lib/module/classes/polls/HMSPollQuestionAnswer.js.map +1 -0
- package/lib/module/classes/polls/HMSPollQuestionCreateParams.js +2 -0
- package/lib/module/classes/polls/HMSPollQuestionCreateParams.js.map +1 -0
- package/lib/module/classes/polls/HMSPollQuestionOption.js +2 -0
- package/lib/module/classes/polls/HMSPollQuestionOption.js.map +1 -0
- package/lib/module/classes/polls/HMSPollQuestionOptionCreateParams.js +2 -0
- package/lib/module/classes/polls/HMSPollQuestionOptionCreateParams.js.map +1 -0
- package/lib/module/classes/polls/HMSPollQuestionQuizOptionCreateParams.js +2 -0
- package/lib/module/classes/polls/HMSPollQuestionQuizOptionCreateParams.js.map +1 -0
- package/lib/module/classes/polls/HMSPollQuestionResponse.js +2 -0
- package/lib/module/classes/polls/HMSPollQuestionResponse.js.map +1 -0
- package/lib/module/classes/polls/HMSPollQuestionResponseCreateParams.js +2 -0
- package/lib/module/classes/polls/HMSPollQuestionResponseCreateParams.js.map +1 -0
- package/lib/module/classes/polls/HMSPollQuestionResponseResult.js +2 -0
- package/lib/module/classes/polls/HMSPollQuestionResponseResult.js.map +1 -0
- package/lib/module/classes/polls/HMSPollQuestionResult.js +2 -0
- package/lib/module/classes/polls/HMSPollQuestionResult.js.map +1 -0
- package/lib/module/classes/polls/HMSPollQuestionType.js +8 -0
- package/lib/module/classes/polls/HMSPollQuestionType.js.map +1 -0
- package/lib/module/classes/polls/HMSPollResponsePeerInfo.js +2 -0
- package/lib/module/classes/polls/HMSPollResponsePeerInfo.js.map +1 -0
- package/lib/module/classes/polls/HMSPollResult.js +2 -0
- package/lib/module/classes/polls/HMSPollResult.js.map +1 -0
- package/lib/module/classes/polls/HMSPollState.js +7 -0
- package/lib/module/classes/polls/HMSPollState.js.map +1 -0
- package/lib/module/classes/polls/HMSPollType.js +6 -0
- package/lib/module/classes/polls/HMSPollType.js.map +1 -0
- package/lib/module/classes/polls/HMSPollUpdateType.js +7 -0
- package/lib/module/classes/polls/HMSPollUpdateType.js.map +1 -0
- package/lib/module/classes/polls/HMSPollUserTrackingMode.js +7 -0
- package/lib/module/classes/polls/HMSPollUserTrackingMode.js.map +1 -0
- package/lib/module/hooks/polls.js +12 -0
- package/lib/module/hooks/polls.js.map +1 -0
- package/lib/module/index.js +8 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/stores/hms-interactivity-store.js +15 -0
- package/lib/module/stores/hms-interactivity-store.js.map +1 -0
- package/lib/module/stores/hms-polls-slice.js +12 -0
- package/lib/module/stores/hms-polls-slice.js.map +1 -0
- package/lib/module/stores/types.js.map +1 -1
- package/lib/module/utils/emitter/EventEmitter.js +19 -0
- package/lib/module/utils/emitter/EventEmitter.js.map +1 -1
- package/lib/module/utils/windowController.js +22 -0
- package/lib/module/utils/windowController.js.map +1 -0
- package/lib/typescript/classes/HMSInteractivityCenter.d.ts +35 -0
- package/lib/typescript/classes/HMSInteractivityEncoder.d.ts +4 -0
- package/lib/typescript/classes/HMSPermissions.d.ts +4 -0
- package/lib/typescript/classes/HMSPollsListenerActions.d.ts +3 -0
- package/lib/typescript/classes/HMSSDK.d.ts +3 -0
- package/lib/typescript/classes/polls/HMSPoll.d.ts +81 -0
- package/lib/typescript/classes/polls/HMSPollCategory.d.ts +10 -0
- package/lib/typescript/classes/polls/HMSPollCreateParams.d.ts +6 -0
- package/lib/typescript/classes/polls/HMSPollQuestion.d.ts +61 -0
- package/lib/typescript/classes/polls/HMSPollQuestionAnswer.d.ts +17 -0
- package/lib/typescript/classes/polls/HMSPollQuestionCreateParams.d.ts +25 -0
- package/lib/typescript/classes/polls/HMSPollQuestionOption.d.ts +21 -0
- package/lib/typescript/classes/polls/HMSPollQuestionOptionCreateParams.d.ts +3 -0
- package/lib/typescript/classes/polls/HMSPollQuestionQuizOptionCreateParams.d.ts +4 -0
- package/lib/typescript/classes/polls/HMSPollQuestionResponse.d.ts +47 -0
- package/lib/typescript/classes/polls/HMSPollQuestionResponseCreateParams.d.ts +2 -0
- package/lib/typescript/classes/polls/HMSPollQuestionResponseResult.d.ts +17 -0
- package/lib/typescript/classes/polls/HMSPollQuestionResult.d.ts +29 -0
- package/lib/typescript/classes/polls/HMSPollQuestionType.d.ts +18 -0
- package/lib/typescript/classes/polls/HMSPollResponsePeerInfo.d.ts +21 -0
- package/lib/typescript/classes/polls/HMSPollResult.d.ts +22 -0
- package/lib/typescript/classes/polls/HMSPollState.d.ts +14 -0
- package/lib/typescript/classes/polls/HMSPollType.d.ts +4 -0
- package/lib/typescript/classes/polls/HMSPollUpdateType.d.ts +5 -0
- package/lib/typescript/classes/polls/HMSPollUserTrackingMode.d.ts +14 -0
- package/lib/typescript/hooks/polls.d.ts +3 -0
- package/lib/typescript/index.d.ts +9 -0
- package/lib/typescript/stores/hms-interactivity-store.d.ts +9 -0
- package/lib/typescript/stores/hms-polls-slice.d.ts +5 -0
- package/lib/typescript/stores/types.d.ts +6 -0
- package/lib/typescript/utils/emitter/EventEmitter.d.ts +7 -0
- package/lib/typescript/utils/windowController.d.ts +10 -0
- package/package.json +1 -1
- package/sdk-versions.json +2 -2
- package/src/classes/HMSInteractivityCenter.ts +126 -0
- package/src/classes/HMSInteractivityEncoder.ts +29 -0
- package/src/classes/HMSPermissions.ts +6 -0
- package/src/classes/HMSPollsListenerActions.ts +3 -0
- package/src/classes/HMSSDK.tsx +10 -0
- package/src/classes/polls/HMSPoll.ts +108 -0
- package/src/classes/polls/HMSPollCategory.ts +11 -0
- package/src/classes/polls/HMSPollCreateParams.ts +19 -0
- package/src/classes/polls/HMSPollQuestion.ts +92 -0
- package/src/classes/polls/HMSPollQuestionAnswer.ts +29 -0
- package/src/classes/polls/HMSPollQuestionCreateParams.ts +36 -0
- package/src/classes/polls/HMSPollQuestionOption.ts +24 -0
- package/src/classes/polls/HMSPollQuestionOptionCreateParams.ts +8 -0
- package/src/classes/polls/HMSPollQuestionQuizOptionCreateParams.ts +6 -0
- package/src/classes/polls/HMSPollQuestionResponse.ts +72 -0
- package/src/classes/polls/HMSPollQuestionResponseCreateParams.ts +6 -0
- package/src/classes/polls/HMSPollQuestionResponseResult.ts +19 -0
- package/src/classes/polls/HMSPollQuestionResult.ts +41 -0
- package/src/classes/polls/HMSPollQuestionType.ts +21 -0
- package/src/classes/polls/HMSPollResponsePeerInfo.ts +24 -0
- package/src/classes/polls/HMSPollResult.ts +26 -0
- package/src/classes/polls/HMSPollState.ts +16 -0
- package/src/classes/polls/HMSPollType.ts +4 -0
- package/src/classes/polls/HMSPollUpdateType.ts +5 -0
- package/src/classes/polls/HMSPollUserTrackingMode.ts +16 -0
- package/src/hooks/polls.ts +14 -0
- package/src/index.ts +10 -0
- package/src/stores/hms-interactivity-store.ts +18 -0
- package/src/stores/hms-polls-slice.ts +20 -0
- package/src/stores/types.ts +20 -3
- package/src/utils/emitter/EventEmitter.ts +26 -0
- package/src/utils/windowController.ts +23 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Represents the result of a poll question within a poll result.
|
|
3
|
+
*/
|
|
4
|
+
export interface HMSPollQuestionResult {
|
|
5
|
+
/**
|
|
6
|
+
The ID of the question associated with the result.
|
|
7
|
+
*/
|
|
8
|
+
question: number;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
The type of the question associated with the result.
|
|
12
|
+
*/
|
|
13
|
+
type: string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
The vote counts for each option of the question.
|
|
17
|
+
*/
|
|
18
|
+
optionVoteCounts: number[];
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
The number of correct votes for the question.
|
|
22
|
+
*/
|
|
23
|
+
correctVotes: number;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
The number of skipped votes for the question.
|
|
27
|
+
*/
|
|
28
|
+
skippedVotes: number;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
The total number of votes received for the question.
|
|
32
|
+
*/
|
|
33
|
+
totalVotes: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Web Interface -
|
|
37
|
+
// export interface HMSPollQuestionResult {
|
|
38
|
+
// correctResponses?: number;
|
|
39
|
+
// skippedCount?: number;
|
|
40
|
+
// totalResponses?: number;
|
|
41
|
+
// }
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export enum HMSPollQuestionType {
|
|
2
|
+
/**
|
|
3
|
+
The question allows for a single choice answer.
|
|
4
|
+
*/
|
|
5
|
+
singleChoice,
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
The question allows for multiple choice answers.
|
|
9
|
+
*/
|
|
10
|
+
multipleChoice,
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
The question expects a short text answer.
|
|
14
|
+
*/
|
|
15
|
+
shortAnswer,
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
The question expects a long text answer.
|
|
19
|
+
*/
|
|
20
|
+
longAnswer,
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Represents the peer information associated with a poll response. The properties are filled according to HMSPollUserTrackingMode selected for the poll.
|
|
3
|
+
*/
|
|
4
|
+
export interface HMSPollResponsePeerInfo {
|
|
5
|
+
/**
|
|
6
|
+
The user hash associated with the peer.
|
|
7
|
+
*/
|
|
8
|
+
userHash?: string;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
The peer ID associated with the response.
|
|
12
|
+
*/
|
|
13
|
+
peerId?: string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
The user ID associated with the peer.
|
|
17
|
+
*/
|
|
18
|
+
customerUserId?: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
The username associated with the peer.
|
|
22
|
+
*/
|
|
23
|
+
userName?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { HMSPollQuestionResult } from './HMSPollQuestionResult';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
Represents the result of a poll.
|
|
5
|
+
*/
|
|
6
|
+
export interface HMSPollResult {
|
|
7
|
+
/**
|
|
8
|
+
The total number of responses received for the poll.
|
|
9
|
+
*/
|
|
10
|
+
totalResponse: number; // totalResponses?: number; (on web)
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
The number of unique users who responded to the poll.
|
|
14
|
+
*/
|
|
15
|
+
userCount: number; // totalUsers?: number; (on web)
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
The maximum number of users in the room during the poll.
|
|
19
|
+
*/
|
|
20
|
+
maxUserCount: number; // maxUsers?: number; (on web)
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
The list of question results for the poll.
|
|
24
|
+
*/
|
|
25
|
+
questions: HMSPollQuestionResult[];
|
|
26
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export enum HMSPollState {
|
|
2
|
+
/**
|
|
3
|
+
The poll is created but not started yet.
|
|
4
|
+
*/
|
|
5
|
+
created,
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
The poll has started and is currently active.
|
|
9
|
+
*/
|
|
10
|
+
started,
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
The poll has been stopped and is no longer active.
|
|
14
|
+
*/
|
|
15
|
+
stopped,
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export enum HMSPollUserTrackingMode {
|
|
2
|
+
/**
|
|
3
|
+
User tracking is based on the peer ID.
|
|
4
|
+
*/
|
|
5
|
+
peerID,
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
User tracking is based on the customer ID.
|
|
9
|
+
*/
|
|
10
|
+
customerUserID,
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
User tracking is based on the username.
|
|
14
|
+
*/
|
|
15
|
+
userName,
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HMSPoll } from '../classes/polls/HMSPoll';
|
|
2
|
+
import { useHMSInteractivityStore } from '../stores/hms-interactivity-store';
|
|
3
|
+
|
|
4
|
+
// use latest state (with component rerender)
|
|
5
|
+
|
|
6
|
+
export const usePollsState = (pollId?: HMSPoll['pollId']) => {
|
|
7
|
+
return useHMSInteractivityStore((state) =>
|
|
8
|
+
pollId ? state.polls[pollId] : state.polls
|
|
9
|
+
);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// state setters
|
|
13
|
+
|
|
14
|
+
export const setPollsState = useHMSInteractivityStore.getState().setPolls;
|
package/src/index.ts
CHANGED
|
@@ -95,6 +95,15 @@ export type {
|
|
|
95
95
|
} from './classes/HmsView';
|
|
96
96
|
export type { HMSPIPConfig } from './classes/HMSPIPConfig';
|
|
97
97
|
export { HMSRecordingState } from './classes/HMSRecordingState';
|
|
98
|
+
export type { HMSPoll } from './classes/polls/HMSPoll';
|
|
99
|
+
|
|
100
|
+
export { HMSPollQuestionType } from './classes/polls/HMSPollQuestionType';
|
|
101
|
+
export { HMSPollType } from './classes/polls/HMSPollType';
|
|
102
|
+
export { HMSPollUserTrackingMode } from './classes/polls/HMSPollUserTrackingMode';
|
|
103
|
+
export { HMSPollUpdateType } from './classes/polls/HMSPollUpdateType';
|
|
104
|
+
export { HMSPollState } from './classes/polls/HMSPollState';
|
|
105
|
+
export { HMSPollQuestion } from './classes/polls/HMSPollQuestion';
|
|
106
|
+
export { HMSPollQuestionOption } from './classes/polls/HMSPollQuestionOption';
|
|
98
107
|
|
|
99
108
|
import { HMSSDK as HmsManager } from './classes/HMSSDK';
|
|
100
109
|
|
|
@@ -112,6 +121,7 @@ export { useHmsViewsResolutionsState } from './hooks/hmsviews';
|
|
|
112
121
|
export type { NotificationResult } from './utils/notification';
|
|
113
122
|
export { checkNotifications } from './utils/notification';
|
|
114
123
|
|
|
124
|
+
export * from './utils/windowController';
|
|
115
125
|
export * from './utils/keyboard';
|
|
116
126
|
|
|
117
127
|
// 100ms types
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
import { subscribeWithSelector } from 'zustand/middleware';
|
|
3
|
+
// import { immer } from 'zustand/middleware/immer';
|
|
4
|
+
|
|
5
|
+
import { createHMSPollsSlice } from './hms-polls-slice';
|
|
6
|
+
import type { HMSInteractivityStore } from './types';
|
|
7
|
+
|
|
8
|
+
export const useHMSInteractivityStore = create<HMSInteractivityStore>()(
|
|
9
|
+
// [['zustand/subscribeWithSelector', never], ['zustand/immer', never]]
|
|
10
|
+
subscribeWithSelector(
|
|
11
|
+
// immer((...a) => ({
|
|
12
|
+
// ...createHMSPollsSlice(...a),
|
|
13
|
+
// }))
|
|
14
|
+
(...a) => ({
|
|
15
|
+
...createHMSPollsSlice(...a),
|
|
16
|
+
})
|
|
17
|
+
)
|
|
18
|
+
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { StateCreator } from 'zustand';
|
|
2
|
+
import type { HMSInteractivityStore, HMSPollsSlice } from './types';
|
|
3
|
+
import type { HMSPoll } from '../classes/polls/HMSPoll';
|
|
4
|
+
|
|
5
|
+
export const createHMSPollsSlice: StateCreator<
|
|
6
|
+
HMSInteractivityStore,
|
|
7
|
+
[],
|
|
8
|
+
[],
|
|
9
|
+
HMSPollsSlice
|
|
10
|
+
> = (set) => ({
|
|
11
|
+
polls: {},
|
|
12
|
+
setPolls: (poll: HMSPoll) => {
|
|
13
|
+
set((state) => {
|
|
14
|
+
state.polls[poll.pollId] = poll;
|
|
15
|
+
return state; // TODO: remove when use immer
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
// cue: undefined,
|
|
19
|
+
// setCue: (cue: HMSHLSPlayerPlaybackCue) => set({ cue }),
|
|
20
|
+
});
|
package/src/stores/types.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Stores
|
|
2
2
|
|
|
3
|
+
import type { HMSPoll } from '../classes/polls/HMSPoll';
|
|
3
4
|
import type {
|
|
4
5
|
HMSHLSPlayerPlaybackState,
|
|
5
6
|
HMSHLSPlayerPlaybackCueEventData,
|
|
@@ -11,8 +12,9 @@ import type {
|
|
|
11
12
|
|
|
12
13
|
export type HMSStore = HMSHLSPlayerPlaybackSlice & HMSViewsSlice;
|
|
13
14
|
export type HMSHLSPlayerStatsStore = HMSHLSPlayerStatsSlice;
|
|
15
|
+
export type HMSInteractivityStore = HMSPollsSlice;
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
//#region HMSViews Slice
|
|
16
18
|
|
|
17
19
|
export type TrackId = string;
|
|
18
20
|
|
|
@@ -26,7 +28,9 @@ export interface HMSViewsSlice {
|
|
|
26
28
|
setHmsviewsResolutions(trackId: TrackId, resolution: Resolution): void;
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
//#endregion HMSViews Slice
|
|
32
|
+
|
|
33
|
+
//#region HLS Player Playback Slice
|
|
30
34
|
|
|
31
35
|
export interface HMSHLSPlayerPlaybackCue
|
|
32
36
|
extends Omit<HMSHLSPlayerPlaybackCueEventData, 'endDate' | 'startDate'> {
|
|
@@ -55,7 +59,9 @@ export interface HMSHLSPlayerPlaybackSlice {
|
|
|
55
59
|
setPlaybackError(error: HMSHLSPlayerPlaybackError): void;
|
|
56
60
|
}
|
|
57
61
|
|
|
58
|
-
|
|
62
|
+
//#endregion HLS Player Playback Slice
|
|
63
|
+
|
|
64
|
+
//#region HLS Player Stats Slice
|
|
59
65
|
|
|
60
66
|
export type HMSHLSPlayerStats = HMSHLSPlayerStatsUpdateEventData;
|
|
61
67
|
export type HMSHLSPlayerStatsError =
|
|
@@ -68,3 +74,14 @@ export interface HMSHLSPlayerStatsSlice {
|
|
|
68
74
|
changeStats(stats: HMSHLSPlayerStats): void;
|
|
69
75
|
setError(error: HMSHLSPlayerStatsError): void;
|
|
70
76
|
}
|
|
77
|
+
|
|
78
|
+
//#endregion HLS Player Stats Slice
|
|
79
|
+
|
|
80
|
+
//#region Polls Slice
|
|
81
|
+
|
|
82
|
+
export type HMSPollsSlice = {
|
|
83
|
+
polls: Record<string, HMSPoll>;
|
|
84
|
+
setPolls(poll: HMSPoll): void;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
//#endregion Polls Slice
|
|
@@ -20,6 +20,10 @@ export { EmitterSubscription } from './_EmitterSubscription';
|
|
|
20
20
|
*/
|
|
21
21
|
export class EventEmitter {
|
|
22
22
|
_subscriber: EventSubscriptionVendor;
|
|
23
|
+
_onAllListenersRemoved:
|
|
24
|
+
| ((eventType: string | 'all') => void)
|
|
25
|
+
| null
|
|
26
|
+
| undefined;
|
|
23
27
|
|
|
24
28
|
/**
|
|
25
29
|
* @constructor
|
|
@@ -31,6 +35,17 @@ export class EventEmitter {
|
|
|
31
35
|
this._subscriber = subscriber || new EventSubscriptionVendor();
|
|
32
36
|
}
|
|
33
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Registers a listener to be invoked when all event listeners have been removed
|
|
40
|
+
* Given listener is invoked with event type or `all` when all listeners are removed
|
|
41
|
+
* @param onAllListenersRemoved
|
|
42
|
+
*/
|
|
43
|
+
registerOnAllListenersRemoved(
|
|
44
|
+
onAllListenersRemoved: (eventType: string | 'all') => void
|
|
45
|
+
) {
|
|
46
|
+
this._onAllListenersRemoved = onAllListenersRemoved;
|
|
47
|
+
}
|
|
48
|
+
|
|
34
49
|
/**
|
|
35
50
|
* Adds a listener to be invoked when events of the specified type are
|
|
36
51
|
* emitted. An optional calling context may be provided. The data arguments
|
|
@@ -65,6 +80,7 @@ export class EventEmitter {
|
|
|
65
80
|
*/
|
|
66
81
|
removeAllListeners(eventType: string | undefined | null) {
|
|
67
82
|
this._subscriber.removeAllSubscriptions(eventType);
|
|
83
|
+
this._onAllListenersRemoved?.(eventType || 'all');
|
|
68
84
|
}
|
|
69
85
|
|
|
70
86
|
/**
|
|
@@ -77,7 +93,17 @@ export class EventEmitter {
|
|
|
77
93
|
return;
|
|
78
94
|
}
|
|
79
95
|
|
|
96
|
+
const eventType = subscription.eventType;
|
|
80
97
|
this._subscriber.removeSubscription(subscription);
|
|
98
|
+
|
|
99
|
+
// check if all subscriptions are removed for the event type
|
|
100
|
+
if (
|
|
101
|
+
typeof this._onAllListenersRemoved === 'function' &&
|
|
102
|
+
this.listenerCount(eventType) === 0
|
|
103
|
+
) {
|
|
104
|
+
// invoke passed cleanup function if any for the event type
|
|
105
|
+
this._onAllListenersRemoved(eventType);
|
|
106
|
+
}
|
|
81
107
|
}
|
|
82
108
|
|
|
83
109
|
/**
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import HMSManager from '../modules/HMSManagerModule';
|
|
4
|
+
|
|
5
|
+
export class WindowController {
|
|
6
|
+
/**
|
|
7
|
+
* [Android Only] Hides the navigation bar.
|
|
8
|
+
*/
|
|
9
|
+
static hideSystemBars() {
|
|
10
|
+
if (Platform.OS === 'android') {
|
|
11
|
+
return HMSManager.hideSystemBars();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* [Android Only] Shows the navigation bar.
|
|
17
|
+
*/
|
|
18
|
+
static showSystemBars() {
|
|
19
|
+
if (Platform.OS === 'android') {
|
|
20
|
+
return HMSManager.showSystemBars();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|