Conversation
* Moved listeners to a separate file * Changed listener event names * Send what the event receives to RN * Implemented new listeners Removed comment
mieszko4
left a comment
There was a problem hiding this comment.
I got few notes inline
Also some general problems:
- it is very hard to track the changes since the entire pr is in one commit - use multiple commit, especially a single commit should be just for moving out events into the new file.
- all of these changes are breaking changes and I still think we should first agree on the event names and then do the new implementation, especially:
- what
event name patternwe will apply - if we will always use minimum event data with an idea of fetching the details by the user with helper functions (e.g. just send id of user and use
getUserInfoin js callback) - what names we will use for the even data (
userIdis not clear what it means)
In the next comment I will write about my proposal of how to push this forward.
| // TODO: We should return the promise resolve | ||
| } else { | ||
| sendEvent("MeetingEvent", "screenShareError", result); | ||
| // TODO: We should return the promise rejection |
| */ | ||
| @Override | ||
| public void onHostAskUnMute(long userId) { | ||
| sendEvent("audio.host.unmute", userId); |
There was a problem hiding this comment.
Some suggestions since we do it from scratch:
| sendEvent("audio.host.unmute", userId); | |
| // 1. always put it in object | |
| WritableMap data = Arguments.createMap(); | |
| // 2. this allows to name the params intuitively | |
| data.putDouble("requestorId", userId); | |
| // or | |
| data.putDouble("requesteeId", userId); | |
| // (userId does not tell us if it is a requestor or requestee) | |
| // 3. name event more specefically (unmute could mean that host unmuted itself | |
| sendEvent("audio.host.unmuteRequested", data); |
| WritableMap data = Arguments.createMap(); | ||
| data.putInt("type", type); | ||
|
|
||
| sendEvent("audio.self.type.changed", data); |
There was a problem hiding this comment.
I like how you use host and self as the origin of the event triggering
Also I like the grouping, i.e. the first part of the event name.
I see the following event name pattern here:
[eventGroup].[originOfEventTrigger].[eventName]
Where:
eventGroup = audio, video, chat, ...originOfEventTrigger = self, host, any, ...eventName = noun with verb, e.g. typeChanged, unmuteRequested(if we agree that "unmute" is a noun)
We should always stick to the same agreed event name pattern (not necessarily this one)
🤔 I am just still not sure if it makes sense to name the events with such pattern...
|
|
||
| @Override | ||
| public void onUserAudioStatusChanged(long userId, AudioStatus audioStatus) { | ||
| sendEvent("audio.status.changed", userId, audioStatus); |
There was a problem hiding this comment.
here status in the name is not the origin - so it is confusing.
I would do audio.self.statusChanged if we follow [eventGroup].[originOfEventTrigger].[eventName]
audio.status.changed follows another event name pattern of [eventGroup].[subject].[pastVerb].
The question is is it feasable to apply such pattern to all the events?
|
|
||
| @Override | ||
| public void onMicrophoneStatusError(InMeetingAudioController.MobileRTCMicrophoneError error) { | ||
| sendEvent("audio.status.error", error); |
There was a problem hiding this comment.
🤔 not sure how to fit "error" into the event name pattern.
There is a verb "to err" but that would look weird, i.e. "audio.status.erred" or "audio.self.statusErred"
| @Override | ||
| public void onMyAudioSourceTypeChanged(int type) { | ||
| WritableMap data = Arguments.createMap(); | ||
| data.putInt("type", type); |
There was a problem hiding this comment.
-
I agree to remove
final InMeetingUserInfo userInfo, i.e. to keep the minimum number of params and then to expose helper methods (here we should exposegetMyUserInfo) -
I think int that are used and are enum-like should be converted to enums, so it is easy to write code with typescript.
typeis an example here.
| public void onShareActiveUser(long userId) { | ||
| final InMeetingService inMeetingService = ZoomSDK.getInstance().getInMeetingService(); | ||
|
|
||
| updateVideoView(); | ||
|
|
||
| if (inMeetingService.isMyself(userId)) { | ||
| sendEvent("MeetingEvent", "screenShareStarted"); | ||
|
|
||
| final InMeetingShareController shareController = inMeetingService.getInMeetingShareController(); | ||
|
|
||
| if (shareController.isSharingOut()) { | ||
| if (shareController.isSharingScreen()) { | ||
| shareController.startShareScreenContent(); | ||
| } | ||
| } | ||
| } else if (userId == 0) { | ||
| sendEvent("MeetingEvent", "screenShareStopped"); | ||
| } else { | ||
| sendEvent("MeetingEvent", "screenShareStartedByUser", userId); | ||
| } | ||
| } |
There was a problem hiding this comment.
I see that onShareActiveUser was removed but not copied. Why?
| private void sendEvent(String event, long userId, AudioStatus audioStatus) { | ||
| WritableMap data = Arguments.createMap(); | ||
| data.putDouble("userId", userId); | ||
| data.putInt("audioStatus", AudioStatus.valueOf(audioStatus)); | ||
|
|
||
| sendEvent(event, data); | ||
| } | ||
|
|
||
| private void sendEvent(String event, long userId, VideoStatus videoStatus) { | ||
| WritableMap data = Arguments.createMap(); | ||
| data.putDouble("userId", userId); | ||
| data.putInt("videoStatus", VideoStatus.valueOf(videoStatus)); | ||
|
|
||
| sendEvent(event, data); | ||
| } | ||
|
|
||
| private void sendEvent(String event, long userId, SharingStatus sharingStatus) { | ||
| WritableMap data = Arguments.createMap(); | ||
| // https://marketplacefront.zoom.us/sdk/meeting/android/us/zoom/sdk/SharingStatus.html | ||
| data.putInt("sharingStatus", SharingStatus.valueOf(sharingStatus)); | ||
|
|
||
| sendEvent(event, data); | ||
| } |
There was a problem hiding this comment.
🤔 not sure if we need this. If we can have helper functions to access this info from code I think that userId should be enough... That would simplify the events
I am for sending just userId and getting the actual user info in RN. I am just wondering if that will be possible for non-self user.
Not sure, but it should probably not be the focus of this refactoring
🤔 I agree - one event name should be enough. But there cannot be event name collisions with other libs, no? Each lib has its own app id. So event like
I think it does not matter as long as from typescript we can access them with enums.
The same as above - it should be an enum in the end. Since there are a lot of moving parts here, let's try keep it minimalistic/simple as much as possible - my proposal how to push things forwards:
As for choosing the naming I would first start with finding a consistent |
This PR is just a draft to start working on the new events, there are still some questions and things to be discussed like: