Create map to link the networkId to the muteCoreId
In the mute-core project :
We removed the id attribute in the ICollaborator interface. In the EmitUpdate function in the CollaboratorsService class, we removed the id as it is no longer used.
We modified the names of the variable senderId and recipientId as senderNetworkId and recipientNetworkId to clearly states that it is the networkId used in the network part of mute.
The networkId is now only stored as a key in the collaborators map in the CollaboratorsService class. (As opposed to before when it was basically both the id of the ICollaborator and the key to the collaborators map)
In the mute project :
-
network.service.ts
Created anIdMapclass, that stores two maps,networkIdToMuteCoreIdMapandmuteCoreIdToNetworkIdMap. With function to set and unset value to both of the maps, and getters.
TheIdMapis initialized in theNetwork.service.tsclass.
There is also atempNetworkIdcariable in thenetwork.service.tsclass. -
rich-collaborators.service.ts
Replaced theidby anetworkId. In the constructor, added a parameter to get thenetworkId.
Replaced every instance of theidof aRichCollaboratorbynetworkId.
Replaced every instance ofsenderIdandrecipientIdbysenderNetworkIdandrecipientNetworkId(to be on-par with what's used in mute-core)
Added aNetworkServiceclass variable. This way, the IdMap is accessible. The network is set in thedoc.service.tsclass, before setting up the collaborator's subscriptions.
The RichCollaborator, the collaborator used in mute, has a networkId attribute, whereas the ICollaborator, the collaborator used in mute-core has a muteCoreId attribute)
Setting values in the IdMap is done by this process :
In the doc.service class. a subscription is made on the network.onMemberJoin observable. Whenever this observable is updated, we update the network.tempNetworkId by the value updated (this observable is updated everytime a peer joins the webgroup).
In the rich-collaborators.service class, we can get the ICollaborator.muteCoreId. We get it in the subscribeTo functions as these function use muteCore observable.
Fixes #27 (closed)