Commit Graph

30 Commits

Author SHA1 Message Date
Saúl Ibarra Corretgé 774c5ecd18 rn: ensure the conference terminated event is always sent
Dear reader, I'm not proud at all of what you are about to read, but sometimes
life just gives you lemons, so enjoy some lemonade!

Joining a conference implies first creating the XMPP connection and then joining
the MUC. It's very possible the XMPP connection was made but there was no chance
for the conference to be created.

This patch fixes this case by artificially genrating a conference terminated
event in such case. In order to have all the necessary knowledge for this event
to be sent the connection now keeps track of the conference that runs it.

In addition, there is an even more obscure corner case: it's not impossible to
try to disconnect when there is not even a connection. This was fixed by
creating a fake disconnect event. Alas the location URL is lost at this point,
but it's better than nothing I guess.
2019-04-25 14:04:26 +02:00
Saúl Ibarra Corretgé 0e92e73789 chore: use strings as action types
Using anything non-serializable for action types is discouraged:
https://redux.js.org/faq/actions#actions

In fact, this is the Flow definition for dispatching actions:

declare export type DispatchAPI<A> = (action: A) => A;
declare export type Dispatch<A: { type: $Subtype<string> }> = DispatchAPI<A>;

Note how the `type` field is defined as a subtype of string, which Symbol isn’t.
2019-03-21 14:47:55 +01:00
Saúl Ibarra Corretgé d39290f9fa rn: refactor conference events
Consolidate all failure cases into a single one: CONFERENCE_TERMINATED. If the
conference ended gracefully no error indicator will be present, otherwise there
will be.
2019-03-12 16:55:28 +01:00
Saúl Ibarra Corretgé 39e236a42c feat(external_api): export sendEvent function
Small reorganization so other features can send events to the native side.
2018-07-18 22:47:18 -05:00
paweldomas 01c2786c95 ref(base/util): move getSymbolDescription to util 2018-07-18 22:47:18 -05:00
Saúl Ibarra Corretgé dc246960df feat(App): refactor App and split it into BaseApp and App
BaseApp does all the heavy-lifting related to creating the redux store,
navigation, and so on.

App currently handles URL props and actually triggering navigation based on
them.
2018-07-12 11:28:19 -05:00
paweldomas b2f76f3ed6 ref(mobile/external-api): skip event if conference exists
The change to mobile/external-api is required to not emit
CONFERENCE_FAILED for CONNECTION_FAILED if the conference has been
started, because base/conference state will still hold conference
instances which are to be ended by other means and result in the
appropriate event (which will adjust the base/conference state).
2018-06-20 15:52:46 +02:00
paweldomas 7186a9c79c fix(base/participants): ensure default local id outside of conference
Makes sure that whenever a conference is left or switched, the local
participant's id will be equal to the default value.

The problem fixed by this commit is a situation where the local
participant may end up sharing the same ID with it's "ghost" when
rejoining a disconnected conference. The most important and easiest to
hit case is when the conference is left after the CONFERENCE_FAILED
event.

Another rare and harder to encounter in the real world issue is
where CONFERENCE_LEFT may come with the delay due to it's asynchronous
nature. The step by step scenario is as follows: trying to leave a
conference, but the network is not doing well, so it takes time,
requests are timing out. After getting back to the welcome page the
the CONFERENCE_LEFT has not arrived yet. The same conference is joined
again and the load config may timeout, but it will be read from the
cache. Now the network gets better and conference is joining which
results in our ghost participant added to the redux state. At this point
there's the root issue: two participants with the same id, because the
local one was neither cleared nor set to the new one yet
(PARTICIPANT_JOINED come, before CONFERENCE_JOINED where we adjust the
id). Then comes CONFERENCE_JOINED and we try to update our local id.
We're updating the ID of both ghost and local participant. It could be
also that the delayed CONFERENCE_LEFT comes for the old conference, but
it's too late and it would update the id for both participants.

The approach here reasons that the ID of the local participant
may be reset as soon as the local participant and, respectively, her ID
is no longer involved in a recoverable JitsiConference of interest to
the user and, consequently, the app.

Co-authored-by: Pawel Domas <pawel.domas@jitsi.org>
Co-authored-by: Lyubo Marinov <lmarinov@atlassian.com>
2018-05-29 13:44:06 +02:00
Lyubo Marinov 592305df74 [RN] Fix processing outdated loadConfig requests (continued)
Co-authored-by: Lyubo Marinov <lmarinov@atlassian.com>
Co-authored-by: Paweł Domas <pawel.domas@jitsi.org>
2018-05-23 16:48:23 -05:00
Lyubo Marinov bd7c9473e7 [Android] Fix possible TypeError in multi-JitsiMeetView SDK consumers
If multiple JitsiMeetView instances are created (not necessarily
existing at once), it's possible to hit a TypeError when reading the
React Component props of the currently mounted App. Anyway, in certain
places we're already protecting against that out of abundance of caution
so it makes no sense to not protect everywhere.
2018-05-09 23:45:24 -05:00
paweldomas 36ecc99b5b fix(auth/external API): CONFERENCE_FAILED with login dialog
Delay the CONFERENCE_FAILED event until the user cancels the login
dialog using the 'recoverable' event flag.
2018-05-04 13:02:19 +02:00
paweldomas 82f5eb894b ref(external API): emit CONFERENCE_FAILED on CONNECTION_FAILED
It seems that the external API will not send any event to let the sdk
consumer know that the conference has failed if the problem occurs at
the establishing of XMPP connection stage. That's because the config was
loaded successfully, but the conference instance does not exist yet, so
neither base/config nor base/conference will emit any failure.
2018-05-04 13:02:19 +02:00
paweldomas 91a65735f9 ref(external API): emit CONFERENCE_WILL_JOIN on SET_ROOM
Make the external API emit CONFERENCE_WILL_JOIN early on SET_ROOM action
which occurs before the XMPP connection is created. At this point we
know that config has loaded and if there's a valid conference room to
be joined. We were thinking of doing that even on CONFIG_WILL_LOAD,
but that seemed to be to risky at this point.
2018-05-04 13:02:19 +02:00
Lyubo Marinov effd3728b6 [RN] add support for inviting participants during a call on mobile (2) 2018-05-02 12:54:02 +02:00
Lyubo Marinov a30412ba65 [RN] Automatically dispatch CONFERENCE_LEFT 2018-03-04 19:28:44 -06:00
Lyubo Marinov b8de5bbfc3 [RN] Add Picture-in-Picture support (Coding style: naming, consistency) 2018-02-23 11:21:26 -06:00
Saúl Ibarra Corretgé b3683068d4 [RN] Add Picture-in-Picture support
This only works automatically on Android >= 8. On other platforms / versions, it
relies on the SDK user on implementing a "reduced UI" mode and reacting to the
"request PIP" delegate method.
2018-02-23 11:21:25 -06:00
Lyubo Marinov 569b3547c8 Upgrade NPM dependencies/packages: react-native 0.50 2017-12-04 00:45:18 -06:00
paweldomas dc24782a2c fix(external-api/middleware): invalid toString call
The intention was to override 'this' argument of 'Error.toString'.
2017-11-02 10:56:48 +01:00
Lyubo Marinov d4d2cb4aad [RN] No CONFERENCE_FAILED in SDK for recoverable errors 2017-10-05 13:25:17 -05:00
Lyubo Marinov f53c79ab24 Flow, coding style 2017-10-05 13:25:17 -05:00
Lyubo Marinov 4bf19d73fd [RN] Fix documentation comments
* Javadoc introduced @code as a replacement of <code> and <tt> which is
  better aligned with other javadoc tags such as @link. Use it in the
  Java source code. If we switch to Kotlin, then we'll definitely use
  Markdown.

* There are more uses of @code in the JavaScript source code than <tt>
  so use @code for the sake of consistency. Eventually, I'd rather we
  switch to Markdown because it's easier on my eyes.

* Xcode is plain confused by @code and @link. The Internet says that
  Xcode supports the backquote character to denote the beginning and end
  of a string of characters which should be formatted for display as
  code but it doesn't work for me. <tt> is not rendered at all. So use
  the backquote which is rendered itself. Hopefully, if we switch to
  Markdown, then it'll be common between JavaScript and Objective-C
  source code.
2017-10-01 01:35:19 -05:00
Lyubo Marinov fce0e4c22c [RN] Report loadConfigError with locationURL to the SDK consumers 2017-09-06 20:34:46 -05:00
Saúl Ibarra Corretgé 284e4e543e [RN] Detect errors when loading the configuration
The error is stored in the redux store in base/config so other components can
consult it. It is also broadcasted as a new event in the external API for the
SDK.
2017-09-06 16:31:14 -05:00
Saúl Ibarra Corretgé 9833965a27 [RN] Extract a function 2017-09-05 22:49:22 -05:00
Lyubo Marinov 377be4272a [RN] Fix the conference URL delivered to JitsiMeetView's listeners 2017-08-01 06:31:03 -05:00
Lyubo Marinov 4b2add7aa6 [Android] Allow multiple JitsiMeetViews 2017-06-10 03:34:11 -05:00
Lyubo Marinov 10e5e0fdf5 [iOS] Allow multiple JitsiMeetViews 2017-06-09 19:17:01 -05:00
Lyubo Marinov e5cc8cd32b [RN] locationURL instead of inviteURL
The value of inviteURL is derived from locationURL by removing the hash
and query/search params in order to make it fit for display and/or
public purposes. The Jitsi Meet SDK consumers do not fall into that
category and our intention is to provide them with the URL they used
with JitsiMeetView.openURL(URL) anyway.

Also rewrites to remove repetition. I'm not saying the new source code
is better really but at least I got to examine it and comment on some of
its weaknesses.
2017-06-09 00:03:23 -05:00
Saúl Ibarra Corretgé a075f24000 [RN] Add conference events to native SDKs
The current implementation doesn't use the API and Transport modules. This is
due to the fact that they are too tied to APP at the moment, which is web only.

Once API is refactored and moved into the Redux store this will be adjusted,
though it's unlikely that the lowest level React Native module (ExternalAPI)
changes drastically.

This commit also introduces a stopgap limitation of only allowing a single
instance for JitsiMeetView objects on both Android and iOS. React Native doesn't
really play well with having multiple instances of the same modules on the same
bridge, since they behave a bit like singletons. Even if we were to use multiple
bridges, some features depend on system-level global state, such as the
AVAudioSession mode or Android's immersive mode. Further attempts will be made
at lifting this limitation in the future, though.
2017-06-09 00:03:23 -05:00