Joining a call was already partially synchronous (it waited until the
media permissions were granted and the local media started), but it did
not wait until the call was joined in the server. However, as the store
is updated with the new call flags when "joinCall" returns the store was
updated before the call was actually joined in the server.
If the call status was fetched again from the server before the call was
finally joined then the received status overwrote the one set locally.
As whether the call view is shown or not is based on the call status
this could cause the call view to be shown, then hidden, and then shown
again once the call was finally joined.
To prevent that now "joinCall" waits until the call was joined in the
server, so the local call status always matches the call status in the
server, and thus the call view is no longer shown, hidden and shown
again.
An alternative approach would have been to prefer the local call status
over the one sent by the server. However, if the call view is shown
before the call is joined in the server the call view is empty (there
will be no other participant); from a user point of view it is clearer
if joining the call shows a loading spinner in the button and takes some
time than if the call view is shown with no other participant and no
sign of joining the call still being in progress.
Also, this makes joining the call behave similar to leaving it, as
leaving the call was already synchronous.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
"Signaling.Standalone.joinCall" should return a promise, like done for
"Signaling.Base.joinCall".
The standalone signaling object is able to defer joining a call if
called before its room has been joined. However, it only takes into
account the last room that a call was tried to be joined in. This is
still the case now when the promise is returned; if "joinCall" is called
on a different room while a previous was pending the previous one is
just rejected (although if it is in the same room the previous promise
is reused).
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The Viewer expects that, if the app has a sidebar, an
"OCA.Files.Sidebar" object exists. This object should contain a
"state.file" property with the name of the file currently shown (or an
empty string if the sidebar is closed), and "open" and "close" functions
to be called by the Viewer when opening and closing the sidebar is
triggered by the Viewer.
The sidebar adjusts its width to the width of the sidebar once the
opening ends. The sidebar comes from nextcloud/vue, and its opening is
animated with a transition, so "OCA.Files.Sidebar.open" needs to wait
until the transition ends to be resolved.
Besides the "OCA.Files.Sidebar" object the Viewer also expects that the
sidebar element in the DOM has an "app-sidebar" id. In nextcloud/vue >=
2.0.0 the id of the sidebar was changed to "app-sidebar-vue", so it
needs to be overridden to be found by the Viewer.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The token passed to "startCall" was set when WebRTC was set up. However,
WebRTC is set up only when the signaling server is changed. Therefore,
when joining a call in a different conversation but in the same
signaling server the token used was the one from the first conversation.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>