Sfoglia il codice sorgente

[Android] Introduce IncomingCallView (continued)

j8
Lyubo Marinov 6 anni fa
parent
commit
8ff3ae0ab2
33 ha cambiato i file con 401 aggiunte e 301 eliminazioni
  1. 7
    7
      android/README.md
  2. 3
    1
      android/sdk/src/main/java/org/jitsi/meet/sdk/AndroidSettingsModule.java
  3. 19
    1
      android/sdk/src/main/java/org/jitsi/meet/sdk/AppInfoModule.java
  4. 4
    1
      android/sdk/src/main/java/org/jitsi/meet/sdk/AudioModeModule.java
  5. 89
    29
      android/sdk/src/main/java/org/jitsi/meet/sdk/BaseReactView.java
  6. 11
    14
      android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java
  7. 27
    25
      android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java
  8. 20
    48
      android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java
  9. 3
    1
      android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetViewAdapter.java
  10. 18
    2
      android/sdk/src/main/java/org/jitsi/meet/sdk/ListenerUtils.java
  11. 19
    1
      android/sdk/src/main/java/org/jitsi/meet/sdk/PictureInPictureModule.java
  12. 3
    1
      android/sdk/src/main/java/org/jitsi/meet/sdk/ProximityModule.java
  13. 38
    22
      android/sdk/src/main/java/org/jitsi/meet/sdk/ReactActivityLifecycleCallbacks.java
  14. 1
    1
      android/sdk/src/main/java/org/jitsi/meet/sdk/ReactInstanceManagerHolder.java
  15. 3
    1
      android/sdk/src/main/java/org/jitsi/meet/sdk/ReactPackageAdapter.java
  16. 8
    8
      android/sdk/src/main/java/org/jitsi/meet/sdk/WiFiStatsModule.java
  17. 9
    6
      android/sdk/src/main/java/org/jitsi/meet/sdk/incoming_call/IncomingCallInfo.java
  18. 9
    40
      android/sdk/src/main/java/org/jitsi/meet/sdk/incoming_call/IncomingCallView.java
  19. 3
    3
      android/sdk/src/main/java/org/jitsi/meet/sdk/incoming_call/IncomingCallViewListener.java
  20. 18
    11
      android/sdk/src/main/java/org/jitsi/meet/sdk/invite/AddPeopleController.java
  21. 3
    3
      android/sdk/src/main/java/org/jitsi/meet/sdk/invite/InviteController.java
  22. 4
    4
      android/sdk/src/main/java/org/jitsi/meet/sdk/invite/InviteControllerListener.java
  23. 9
    4
      android/sdk/src/main/java/org/jitsi/meet/sdk/invite/InviteModule.java
  24. 3
    1
      android/sdk/src/main/java/org/jitsi/meet/sdk/net/NAT64AddrInfoModule.java
  25. 2
    2
      react/features/mobile/incoming-call/actionTypes.js
  26. 5
    3
      react/features/mobile/incoming-call/components/AnswerButton.js
  27. 5
    3
      react/features/mobile/incoming-call/components/DeclineButton.js
  28. 10
    7
      react/features/mobile/incoming-call/components/IncomingCallApp.js
  29. 25
    25
      react/features/mobile/incoming-call/components/IncomingCallPage.js
  30. 7
    10
      react/features/mobile/incoming-call/components/styles.js
  31. 3
    6
      react/features/mobile/incoming-call/middleware.js
  32. 5
    8
      react/features/mobile/incoming-call/reducer.js
  33. 8
    2
      react/index.native.js

+ 7
- 7
android/README.md Vedi File

@@ -205,13 +205,13 @@ which displays a single `JitsiMeetView`.
205 205
 
206 206
 See JitsiMeetView.getDefaultURL.
207 207
 
208
-#### getPictureInPictureEnabled()
208
+#### isPictureInPictureEnabled()
209 209
 
210
-See JitsiMeetView.getPictureInPictureEnabled.
210
+See JitsiMeetView.isPictureInPictureEnabled.
211 211
 
212
-#### getWelcomePageEnabled()
212
+#### isWelcomePageEnabled()
213 213
 
214
-See JitsiMeetView.getWelcomePageEnabled.
214
+See JitsiMeetView.isWelcomePageEnabled.
215 215
 
216 216
 #### loadURL(URL)
217 217
 
@@ -250,13 +250,13 @@ if set to `null`, the default built in JavaScript is used: https://meet.jit.si.
250 250
 
251 251
 Returns the `JitsiMeetViewListener` instance attached to the view.
252 252
 
253
-#### getPictureInPictureEnabled()
253
+#### isPictureInPictureEnabled()
254 254
 
255 255
 Returns `true` if Picture-in-Picture is enabled; `false`, otherwise. If not
256 256
 explicitly set (by a preceding `setPictureInPictureEnabled` call), defaults to
257 257
 `true` if the platform supports Picture-in-Picture natively; `false`, otherwise.
258 258
 
259
-#### getWelcomePageEnabled()
259
+#### isWelcomePageEnabled()
260 260
 
261 261
 Returns true if the Welcome page is enabled; otherwise, false. If false, a black
262 262
 empty view will be rendered when not in a conference. Defaults to false.
@@ -316,7 +316,7 @@ effect.
316 316
 
317 317
 #### setWelcomePageEnabled(boolean)
318 318
 
319
-Sets whether the Welcome page is enabled. See `getWelcomePageEnabled` for more
319
+Sets whether the Welcome page is enabled. See `isWelcomePageEnabled` for more
320 320
 information.
321 321
 
322 322
 NOTE: Must be called (if at all) before `loadURL`/`loadURLString` for it to take

+ 3
- 1
android/sdk/src/main/java/org/jitsi/meet/sdk/AndroidSettingsModule.java Vedi File

@@ -16,7 +16,9 @@ import com.facebook.react.bridge.ReactApplicationContext;
16 16
 import com.facebook.react.bridge.ReactContextBaseJavaModule;
17 17
 import com.facebook.react.bridge.ReactMethod;
18 18
 
19
-class AndroidSettingsModule extends ReactContextBaseJavaModule {
19
+class AndroidSettingsModule
20
+    extends ReactContextBaseJavaModule {
21
+
20 22
     public AndroidSettingsModule(ReactApplicationContext reactContext) {
21 23
         super(reactContext);
22 24
     }

+ 19
- 1
android/sdk/src/main/java/org/jitsi/meet/sdk/AppInfoModule.java Vedi File

@@ -1,3 +1,19 @@
1
+/*
2
+ * Copyright @ 2017-present Atlassian Pty Ltd
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
1 17
 package org.jitsi.meet.sdk;
2 18
 
3 19
 import android.content.Context;
@@ -11,7 +27,9 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
11 27
 import java.util.HashMap;
12 28
 import java.util.Map;
13 29
 
14
-class AppInfoModule extends ReactContextBaseJavaModule {
30
+class AppInfoModule
31
+    extends ReactContextBaseJavaModule {
32
+
15 33
     public AppInfoModule(ReactApplicationContext reactContext) {
16 34
         super(reactContext);
17 35
     }

+ 4
- 1
android/sdk/src/main/java/org/jitsi/meet/sdk/AudioModeModule.java Vedi File

@@ -57,7 +57,10 @@ import java.util.Set;
57 57
  * Before a call has started and after it has ended the
58 58
  * {@code AudioModeModule.DEFAULT} mode should be used.
59 59
  */
60
-class AudioModeModule extends ReactContextBaseJavaModule implements AudioManager.OnAudioFocusChangeListener {
60
+class AudioModeModule
61
+    extends ReactContextBaseJavaModule
62
+    implements AudioManager.OnAudioFocusChangeListener {
63
+
61 64
     /**
62 65
      * Constants representing the audio mode.
63 66
      * - DEFAULT: Used before and after every call. It represents the default

+ 89
- 29
android/sdk/src/main/java/org/jitsi/meet/sdk/BaseReactView.java Vedi File

@@ -1,3 +1,19 @@
1
+/*
2
+ * Copyright @ 2018-present Atlassian Pty Ltd
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
1 17
 package org.jitsi.meet.sdk;
2 18
 
3 19
 import android.app.Activity;
@@ -12,7 +28,9 @@ import com.facebook.react.ReactRootView;
12 28
 import com.facebook.react.bridge.ReadableMap;
13 29
 import com.rnimmersive.RNImmersiveModule;
14 30
 
31
+import java.lang.reflect.Method;
15 32
 import java.util.Collections;
33
+import java.util.Map;
16 34
 import java.util.Set;
17 35
 import java.util.UUID;
18 36
 import java.util.WeakHashMap;
@@ -20,7 +38,9 @@ import java.util.WeakHashMap;
20 38
 /**
21 39
  * Base class for all views which are backed by a React Native view.
22 40
  */
23
-public abstract class BaseReactView extends FrameLayout {
41
+public abstract class BaseReactView<ListenerT>
42
+    extends FrameLayout {
43
+
24 44
     /**
25 45
      * Background color used by {@code BaseReactView} and the React Native root
26 46
      * view.
@@ -28,30 +48,21 @@ public abstract class BaseReactView extends FrameLayout {
28 48
     protected static int BACKGROUND_COLOR = 0xFF111111;
29 49
 
30 50
     /**
31
-     * The unique identifier of this {@code BaseReactView} within the process
32
-     * for the purposes of {@link ExternalAPIModule}. The name scope was
33
-     * inspired by postis which we use on Web for the similar purposes of the
34
-     * iframe-based external API.
35
-     */
36
-    protected final String externalAPIScope;
37
-
38
-    /**
39
-     * React Native root view.
40
-     */
41
-    private ReactRootView reactRootView;
42
-
43
-    /**
44
-     * Collection with all created views. This is used for finding the right
45
-     * view when delivering events coming from the {@link ExternalAPIModule};
51
+     * The collection of all existing {@code BaseReactView}s. Used to find the
52
+     * {@code BaseReactView} when delivering events coming from
53
+     * {@link ExternalAPIModule}.
46 54
      */
47 55
     static final Set<BaseReactView> views
48 56
         = Collections.newSetFromMap(new WeakHashMap<BaseReactView, Boolean>());
49 57
 
50 58
     /**
51
-     * Find a view which matches the given external API scope.
59
+     * Finds a {@code BaseReactView} which matches a specific external API
60
+     * scope.
52 61
      *
53
-     * @param externalAPIScope - Scope for the view we want to find.
54
-     * @return The found {@code BaseReactView}, or {@code null}.
62
+     * @param externalAPIScope - The external API scope associated with the
63
+     * {@code BaseReactView} to find.
64
+     * @return The {@code BaseReactView}, if any, associated with the specified
65
+     * {@code externalAPIScope}; otherwise, {@code null}.
55 66
      */
56 67
     public static BaseReactView findViewByExternalAPIScope(
57 68
             String externalAPIScope) {
@@ -66,6 +77,25 @@ public abstract class BaseReactView extends FrameLayout {
66 77
         return null;
67 78
     }
68 79
 
80
+    /**
81
+     * The unique identifier of this {@code BaseReactView} within the process
82
+     * for the purposes of {@link ExternalAPIModule}. The name scope was
83
+     * inspired by postis which we use on Web for the similar purposes of the
84
+     * iframe-based external API.
85
+     */
86
+    protected final String externalAPIScope;
87
+
88
+    /**
89
+     * The listener (e.g. {@link JitsiMeetViewListener}) instance for reporting
90
+     * events occurring in Jitsi Meet.
91
+     */
92
+    private ListenerT listener;
93
+
94
+    /**
95
+     * React Native root view.
96
+     */
97
+    private ReactRootView reactRootView;
98
+
69 99
     public BaseReactView(@NonNull Context context) {
70 100
         super(context);
71 101
 
@@ -85,16 +115,14 @@ public abstract class BaseReactView extends FrameLayout {
85 115
      * Creates the {@code ReactRootView} for the given app name with the given
86 116
      * props. Once created it's set as the view of this {@code FrameLayout}.
87 117
      *
88
-     * @param appName - Name of the "app" (in React Native terms) which we want
89
-     *                to load.
90
-     * @param props - Props (in React terms) to be passed to the app.
118
+     * @param appName - The name of the "app" (in React Native terms) to load.
119
+     * @param props - The React Component props to pass to the app.
91 120
      */
92 121
     public void createReactRootView(String appName, @Nullable Bundle props) {
93 122
         if (props == null) {
94 123
             props = new Bundle();
95 124
         }
96 125
 
97
-        // Set externalAPIScope
98 126
         props.putString("externalAPIScope", externalAPIScope);
99 127
 
100 128
         if (reactRootView == null) {
@@ -114,8 +142,8 @@ public abstract class BaseReactView extends FrameLayout {
114 142
      * Releases the React resources (specifically the {@link ReactRootView})
115 143
      * associated with this view.
116 144
      *
117
-     * This method MUST be called when the Activity holding this view is
118
-     * destroyed, typically in the {@code onDestroy} method.
145
+     * MUST be called when the {@link Activity} holding this view is destroyed,
146
+     * typically in the {@code onDestroy} method.
119 147
      */
120 148
     public void dispose() {
121 149
         if (reactRootView != null) {
@@ -125,15 +153,36 @@ public abstract class BaseReactView extends FrameLayout {
125 153
         }
126 154
     }
127 155
 
156
+    /**
157
+     * Gets the listener set on this {@code BaseReactView}.
158
+     *
159
+     * @return The listener set on this {@code BaseReactView}.
160
+     */
161
+    public ListenerT getListener() {
162
+        return listener;
163
+    }
164
+
128 165
     /**
129 166
      * Abstract method called by {@link ExternalAPIModule} when an event is
130 167
      * received for this view.
131 168
      *
132
-     * @param name - Name of the event.
133
-     * @param data - Event data.
169
+     * @param name - The name of the event.
170
+     * @param data - The details of the event associated with/specific to the
171
+     * specified {@code name}.
134 172
      */
135 173
     public abstract void onExternalAPIEvent(String name, ReadableMap data);
136 174
 
175
+    protected void onExternalAPIEvent(
176
+            Map<String, Method> listenerMethods,
177
+            String name, ReadableMap data) {
178
+        ListenerT listener = getListener();
179
+
180
+        if (listener != null) {
181
+            ListenerUtils.runListenerMethod(
182
+                listener, listenerMethods, name, data);
183
+        }
184
+    }
185
+
137 186
     /**
138 187
      * Called when the window containing this view gains or loses focus.
139 188
      *
@@ -163,9 +212,20 @@ public abstract class BaseReactView extends FrameLayout {
163 212
                 // functionality is brittle anyway, akin to the icing on the
164 213
                 // cake, and has been working without onWindowFocusChanged for a
165 214
                 // very long time.
166
-                Log.e("RNImmersiveModule",
167
-                    "emitImmersiveStateChangeEvent() failed!", re);
215
+                Log.e(
216
+                    "RNImmersiveModule",
217
+                    "emitImmersiveStateChangeEvent() failed!",
218
+                    re);
168 219
             }
169 220
         }
170 221
     }
222
+
223
+    /**
224
+     * Sets a specific listener on this {@code BaseReactView}.
225
+     *
226
+     * @param listener The listener to set on this {@code BaseReactView}.
227
+     */
228
+    public void setListener(ListenerT listener) {
229
+        this.listener = listener;
230
+    }
171 231
 }

+ 11
- 14
android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java Vedi File

@@ -26,12 +26,14 @@ import com.facebook.react.bridge.ReadableMap;
26 26
 /**
27 27
  * Module implementing an API for sending events from JavaScript to native code.
28 28
  */
29
-class ExternalAPIModule extends ReactContextBaseJavaModule {
29
+class ExternalAPIModule
30
+    extends ReactContextBaseJavaModule {
31
+
30 32
     private static final String TAG = ExternalAPIModule.class.getSimpleName();
31 33
 
32 34
     /**
33 35
      * Initializes a new module instance. There shall be a single instance of
34
-     * this module throughout the lifetime of the application.
36
+     * this module throughout the lifetime of the app.
35 37
      *
36 38
      * @param reactContext the {@link ReactApplicationContext} where this module
37 39
      * is created.
@@ -60,23 +62,18 @@ class ExternalAPIModule extends ReactContextBaseJavaModule {
60 62
      * @param scope
61 63
      */
62 64
     @ReactMethod
63
-    public void sendEvent(final String name,
64
-                          final ReadableMap data,
65
-                          final String scope) {
65
+    public void sendEvent(String name, ReadableMap data, String scope) {
66 66
         // The JavaScript App needs to provide uniquely identifying information
67 67
         // to the native ExternalAPI module so that the latter may match the
68 68
         // former to the native BaseReactView which hosts it.
69 69
         BaseReactView view = BaseReactView.findViewByExternalAPIScope(scope);
70 70
 
71
-        if (view == null) {
72
-            return;
73
-        }
74
-
75
-        try {
76
-            view.onExternalAPIEvent(name, data);
77
-        } catch(Exception e) {
78
-            Log.e(TAG, "onExternalAPIEvent: error sending event", e);
71
+        if (view != null) {
72
+            try {
73
+                view.onExternalAPIEvent(name, data);
74
+            } catch(Exception e) {
75
+                Log.e(TAG, "onExternalAPIEvent: error sending event", e);
76
+            }
79 77
         }
80 78
     }
81
-
82 79
 }

+ 27
- 25
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java Vedi File

@@ -41,7 +41,9 @@ import java.net.URL;
41 41
  * hooked to the React Native subsystem via proxy calls through the
42 42
  * {@code JitsiMeetView} static methods.
43 43
  */
44
-public class JitsiMeetActivity extends AppCompatActivity {
44
+public class JitsiMeetActivity
45
+    extends AppCompatActivity {
46
+
45 47
     /**
46 48
      * The request code identifying requests for the permission to draw on top
47 49
      * of other apps. The value must be 16-bit and is arbitrarily chosen here.
@@ -95,25 +97,6 @@ public class JitsiMeetActivity extends AppCompatActivity {
95 97
         return view == null ? defaultURL : view.getDefaultURL();
96 98
     }
97 99
 
98
-    /**
99
-     *
100
-     * @see JitsiMeetView#getPictureInPictureEnabled()
101
-     */
102
-    public boolean getPictureInPictureEnabled() {
103
-        return
104
-            view == null
105
-                ? pictureInPictureEnabled
106
-                : view.getPictureInPictureEnabled();
107
-    }
108
-
109
-    /**
110
-     *
111
-     * @see JitsiMeetView#getWelcomePageEnabled()
112
-     */
113
-    public boolean getWelcomePageEnabled() {
114
-        return view == null ? welcomePageEnabled : view.getWelcomePageEnabled();
115
-    }
116
-
117 100
     /**
118 101
      * Initializes the {@link #view} of this {@code JitsiMeetActivity} with a
119 102
      * new {@link JitsiMeetView} instance.
@@ -152,6 +135,25 @@ public class JitsiMeetActivity extends AppCompatActivity {
152 135
         return view;
153 136
     }
154 137
 
138
+    /**
139
+     *
140
+     * @see JitsiMeetView#isPictureInPictureEnabled()
141
+     */
142
+    public boolean isPictureInPictureEnabled() {
143
+        return
144
+            view == null
145
+                ? pictureInPictureEnabled
146
+                : view.isPictureInPictureEnabled();
147
+    }
148
+
149
+    /**
150
+     *
151
+     * @see JitsiMeetView#isWelcomePageEnabled()
152
+     */
153
+    public boolean isWelcomePageEnabled() {
154
+        return view == null ? welcomePageEnabled : view.isWelcomePageEnabled();
155
+    }
156
+
155 157
     /**
156 158
      * Loads the given URL and displays the conference. If the specified URL is
157 159
      * null, the welcome page is displayed instead.
@@ -177,7 +179,7 @@ public class JitsiMeetActivity extends AppCompatActivity {
177 179
 
178 180
     @Override
179 181
     public void onBackPressed() {
180
-        if (!ReactActivityLifecycleAdapter.onBackPressed()) {
182
+        if (!ReactActivityLifecycleCallbacks.onBackPressed()) {
181 183
             // JitsiMeetView didn't handle the invocation of the back button.
182 184
             // Generally, an Activity extender would very likely want to invoke
183 185
             // Activity#onBackPressed(). For the sake of consistency with
@@ -220,7 +222,7 @@ public class JitsiMeetActivity extends AppCompatActivity {
220 222
             view = null;
221 223
         }
222 224
 
223
-        ReactActivityLifecycleAdapter.onHostDestroy(this);
225
+        ReactActivityLifecycleCallbacks.onHostDestroy(this);
224 226
     }
225 227
 
226 228
     // ReactAndroid/src/main/java/com/facebook/react/ReactActivity.java
@@ -255,7 +257,7 @@ public class JitsiMeetActivity extends AppCompatActivity {
255 257
             return;
256 258
         }
257 259
 
258
-        ReactActivityLifecycleAdapter.onNewIntent(intent);
260
+        ReactActivityLifecycleCallbacks.onNewIntent(intent);
259 261
     }
260 262
 
261 263
     @Override
@@ -263,14 +265,14 @@ public class JitsiMeetActivity extends AppCompatActivity {
263 265
         super.onResume();
264 266
 
265 267
         defaultBackButtonImpl = new DefaultHardwareBackBtnHandlerImpl(this);
266
-        ReactActivityLifecycleAdapter.onHostResume(this, defaultBackButtonImpl);
268
+        ReactActivityLifecycleCallbacks.onHostResume(this, defaultBackButtonImpl);
267 269
     }
268 270
 
269 271
     @Override
270 272
     public void onStop() {
271 273
         super.onStop();
272 274
 
273
-        ReactActivityLifecycleAdapter.onHostPause(this);
275
+        ReactActivityLifecycleCallbacks.onHostPause(this);
274 276
         defaultBackButtonImpl = null;
275 277
     }
276 278
 

+ 20
- 48
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java Vedi File

@@ -30,13 +30,15 @@ import java.lang.reflect.Method;
30 30
 import java.net.URL;
31 31
 import java.util.Map;
32 32
 
33
-public class JitsiMeetView extends BaseReactView {
33
+public class JitsiMeetView
34
+    extends BaseReactView<JitsiMeetViewListener> {
35
+
34 36
     /**
35 37
      * The {@code Method}s of {@code JitsiMeetViewListener} by event name i.e.
36 38
      * redux action types.
37 39
      */
38 40
     private static final Map<String, Method> LISTENER_METHODS
39
-        = ListenerUtils.slurpListenerMethods(JitsiMeetViewListener.class);
41
+        = ListenerUtils.mapListenerMethods(JitsiMeetViewListener.class);
40 42
 
41 43
     /**
42 44
      * The {@link Log} tag which identifies the source of the log messages of
@@ -82,12 +84,6 @@ public class JitsiMeetView extends BaseReactView {
82 84
      */
83 85
     private final InviteController inviteController;
84 86
 
85
-    /**
86
-     * {@link JitsiMeetViewListener} instance for reporting events occurring in
87
-     * Jitsi Meet.
88
-     */
89
-    private JitsiMeetViewListener listener;
90
-
91 87
     /**
92 88
      * Whether Picture-in-Picture is enabled. If {@code null}, defaults to
93 89
      * {@code true} iff the Android platform supports Picture-in-Picture
@@ -125,7 +121,7 @@ public class JitsiMeetView extends BaseReactView {
125 121
      * page.
126 122
      */
127 123
     public void enterPictureInPicture() {
128
-        if (getPictureInPictureEnabled() && getURL() != null) {
124
+        if (isPictureInPictureEnabled() && getURL() != null) {
129 125
             PictureInPictureModule pipModule
130 126
                 = ReactInstanceManagerHolder.getNativeModule(
131 127
                 PictureInPictureModule.class);
@@ -167,13 +163,16 @@ public class JitsiMeetView extends BaseReactView {
167 163
     }
168 164
 
169 165
     /**
170
-     * Gets the {@link JitsiMeetViewListener} set on this {@code JitsiMeetView}.
166
+     * Gets the URL of the current conference.
171 167
      *
172
-     * @return The {@code JitsiMeetViewListener} set on this
173
-     * {@code JitsiMeetView}.
168
+     * XXX The method is meant for internal purposes only at the time of this
169
+     * writing because there is no equivalent API on iOS.
170
+     *
171
+     * @return the URL {@code String} of the current conference if any;
172
+     * otherwise, {@code null}.
174 173
      */
175
-    public JitsiMeetViewListener getListener() {
176
-        return listener;
174
+    String getURL() {
175
+        return url;
177 176
     }
178 177
 
179 178
     /**
@@ -184,26 +183,13 @@ public class JitsiMeetView extends BaseReactView {
184 183
      * @return If Picture-in-Picture is enabled, {@code true}; {@code false},
185 184
      * otherwise.
186 185
      */
187
-    public boolean getPictureInPictureEnabled() {
186
+    public boolean isPictureInPictureEnabled() {
188 187
         return
189 188
             PictureInPictureModule.isPictureInPictureSupported()
190 189
                 && (pictureInPictureEnabled == null
191 190
                     || pictureInPictureEnabled);
192 191
     }
193 192
 
194
-    /**
195
-     * Gets the URL of the current conference.
196
-     *
197
-     * XXX The method is meant for internal purposes only at the time of this
198
-     * writing because there is no equivalent API on iOS.
199
-     *
200
-     * @return the URL {@code String} of the current conference if any;
201
-     * otherwise, {@code null}.
202
-     */
203
-    String getURL() {
204
-        return url;
205
-    }
206
-
207 193
     /**
208 194
      * Gets whether the Welcome page is enabled. If {@code true}, the Welcome
209 195
      * page is rendered when this {@code JitsiMeetView} is not at a URL
@@ -212,7 +198,7 @@ public class JitsiMeetView extends BaseReactView {
212 198
      * @return {@code true} if the Welcome page is enabled; otherwise,
213 199
      * {@code false}.
214 200
      */
215
-    public boolean getWelcomePageEnabled() {
201
+    public boolean isWelcomePageEnabled() {
216 202
         return welcomePageEnabled;
217 203
     }
218 204
 
@@ -261,7 +247,7 @@ public class JitsiMeetView extends BaseReactView {
261 247
         // pictureInPictureEnabled
262 248
         props.putBoolean(
263 249
             "pictureInPictureEnabled",
264
-            getPictureInPictureEnabled());
250
+            isPictureInPictureEnabled());
265 251
 
266 252
         // url
267 253
         if (urlObject != null) {
@@ -334,8 +320,9 @@ public class JitsiMeetView extends BaseReactView {
334 320
     /**
335 321
      * Handler for {@link ExternalAPIModule} events.
336 322
      *
337
-     * @param name - Name of the event.
338
-     * @param data - Event data.
323
+     * @param name The name of the event.
324
+     * @param data The details/specifics of the event to send determined
325
+     * by/associated with the specified {@code name}.
339 326
      */
340 327
     @Override
341 328
     public void onExternalAPIEvent(String name, ReadableMap data) {
@@ -346,11 +333,7 @@ public class JitsiMeetView extends BaseReactView {
346 333
         // UI thread.
347 334
         maybeSetViewURL(name, data);
348 335
 
349
-        JitsiMeetViewListener listener = getListener();
350
-        if (listener != null) {
351
-            ListenerUtils.runListenerMethod(
352
-                listener, LISTENER_METHODS, name, data);
353
-        }
336
+        onExternalAPIEvent(LISTENER_METHODS, name, data);
354 337
     }
355 338
 
356 339
     /**
@@ -366,17 +349,6 @@ public class JitsiMeetView extends BaseReactView {
366 349
         this.defaultURL = defaultURL;
367 350
     }
368 351
 
369
-    /**
370
-     * Sets a specific {@link JitsiMeetViewListener} on this
371
-     * {@code JitsiMeetView}.
372
-     *
373
-     * @param listener The {@code JitsiMeetViewListener} to set on this
374
-     * {@code JitsiMeetView}.
375
-     */
376
-    public void setListener(JitsiMeetViewListener listener) {
377
-        this.listener = listener;
378
-    }
379
-
380 352
     /**
381 353
      * Sets whether Picture-in-Picture is enabled. Because Picture-in-Picture is
382 354
      * natively supported only since certain platform versions, specifying

+ 3
- 1
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetViewAdapter.java Vedi File

@@ -22,7 +22,9 @@ import java.util.Map;
22 22
  * Implements {@link JitsiMeetViewListener} so apps don't have to add stubs for
23 23
  * all methods in the interface if they are only interested in some.
24 24
  */
25
-public abstract class JitsiMeetViewAdapter implements JitsiMeetViewListener {
25
+public abstract class JitsiMeetViewAdapter
26
+    implements JitsiMeetViewListener {
27
+
26 28
     @Override
27 29
     public void onConferenceFailed(Map<String, Object> data) {
28 30
     }

+ 18
- 2
android/sdk/src/main/java/org/jitsi/meet/sdk/ListenerUtils.java Vedi File

@@ -1,3 +1,19 @@
1
+/*
2
+ * Copyright @ 2018-present Atlassian Pty Ltd
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
1 17
 package org.jitsi.meet.sdk;
2 18
 
3 19
 import com.facebook.react.bridge.ReadableMap;
@@ -24,8 +40,8 @@ public final class ListenerUtils {
24 40
      * @param listener - The listener whose methods we want to slurp.
25 41
      * @return A mapping with event names - methods.
26 42
      */
27
-    public static Map<String, Method> slurpListenerMethods(Class listener) {
28
-        final Map<String, Method> methods = new HashMap<>();
43
+    public static Map<String, Method> mapListenerMethods(Class listener) {
44
+        Map<String, Method> methods = new HashMap<>();
29 45
 
30 46
         // Figure out the mapping between the listener methods
31 47
         // and the events i.e. redux action types.

+ 19
- 1
android/sdk/src/main/java/org/jitsi/meet/sdk/PictureInPictureModule.java Vedi File

@@ -1,3 +1,19 @@
1
+/*
2
+ * Copyright @ 2017-present Atlassian Pty Ltd
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
1 17
 package org.jitsi.meet.sdk;
2 18
 
3 19
 import android.app.Activity;
@@ -11,7 +27,9 @@ import com.facebook.react.bridge.ReactApplicationContext;
11 27
 import com.facebook.react.bridge.ReactContextBaseJavaModule;
12 28
 import com.facebook.react.bridge.ReactMethod;
13 29
 
14
-public class PictureInPictureModule extends ReactContextBaseJavaModule {
30
+class PictureInPictureModule
31
+    extends ReactContextBaseJavaModule {
32
+
15 33
     private final static String TAG = "PictureInPicture";
16 34
 
17 35
     static boolean isPictureInPictureSupported() {

+ 3
- 1
android/sdk/src/main/java/org/jitsi/meet/sdk/ProximityModule.java Vedi File

@@ -31,7 +31,9 @@ import com.facebook.react.bridge.UiThreadUtil;
31 31
  * object it will dim the screen and disable touch controls. The functionality
32 32
  * is used with the conference audio-only mode.
33 33
  */
34
-class ProximityModule extends ReactContextBaseJavaModule {
34
+class ProximityModule
35
+    extends ReactContextBaseJavaModule {
36
+
35 37
     /**
36 38
      * The name of {@code ProximityModule} to be used in the React Native
37 39
      * bridge.

android/sdk/src/main/java/org/jitsi/meet/sdk/ReactActivityLifecycleAdapter.java → android/sdk/src/main/java/org/jitsi/meet/sdk/ReactActivityLifecycleCallbacks.java Vedi File

@@ -1,3 +1,19 @@
1
+/*
2
+ * Copyright @ 2018-present Atlassian Pty Ltd
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
1 17
 package org.jitsi.meet.sdk;
2 18
 
3 19
 import android.app.Activity;
@@ -7,18 +23,19 @@ import com.facebook.react.ReactInstanceManager;
7 23
 import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
8 24
 
9 25
 /**
10
- * Helper class to encapsulate the work which needs to be done on Activity
11
- * lifecycle methods in order for the React side to be aware of it.
26
+ * Helper class to encapsulate the work which needs to be done on
27
+ * {@link Activity} lifecycle methods in order for the React side to be aware of
28
+ * it.
12 29
  */
13
-class ReactActivityLifecycleAdapter {
30
+public class ReactActivityLifecycleCallbacks {
14 31
     /**
15
-     * Activity lifecycle method which should be called from
16
-     * {@code Activity.onBackPressed} so we can do the required internal
32
+     * {@link Activity} lifecycle method which should be called from
33
+     * {@link Activity#onBackPressed} so we can do the required internal
17 34
      * processing.
18 35
      *
19 36
      * @return {@code true} if the back-press was processed; {@code false},
20
-     * otherwise. If {@code false}, the application should call the parent's
21
-     * implementation.
37
+     * otherwise. If {@code false}, the application should call the
38
+     * {@code super}'s implementation.
22 39
      */
23 40
     public static boolean onBackPressed() {
24 41
         ReactInstanceManager reactInstanceManager
@@ -33,8 +50,8 @@ class ReactActivityLifecycleAdapter {
33 50
     }
34 51
 
35 52
     /**
36
-     * Activity lifecycle method which should be called from
37
-     * {@code Activity.onDestroy} so we can do the required internal
53
+     * {@link Activity} lifecycle method which should be called from
54
+     * {@code Activity#onDestroy} so we can do the required internal
38 55
      * processing.
39 56
      *
40 57
      * @param activity {@code Activity} being destroyed.
@@ -49,8 +66,8 @@ class ReactActivityLifecycleAdapter {
49 66
     }
50 67
 
51 68
     /**
52
-     * Activity lifecycle method which should be called from
53
-     * {@code Activity.onPause} so we can do the required internal processing.
69
+     * {@link Activity} lifecycle method which should be called from
70
+     * {@code Activity#onPause} so we can do the required internal processing.
54 71
      *
55 72
      * @param activity {@code Activity} being paused.
56 73
      */
@@ -64,8 +81,8 @@ class ReactActivityLifecycleAdapter {
64 81
     }
65 82
 
66 83
     /**
67
-     * Activity lifecycle method which should be called from
68
-     * {@code Activity.onResume} so we can do the required internal processing.
84
+     * {@link Activity} lifecycle method which should be called from
85
+     * {@code Activity#onResume} so we can do the required internal processing.
69 86
      *
70 87
      * @param activity {@code Activity} being resumed.
71 88
      */
@@ -74,16 +91,16 @@ class ReactActivityLifecycleAdapter {
74 91
     }
75 92
 
76 93
     /**
77
-     * Activity lifecycle method which should be called from
78
-     * {@code Activity.onResume} so we can do the required internal processing.
94
+     * {@link Activity} lifecycle method which should be called from
95
+     * {@code Activity#onResume} so we can do the required internal processing.
79 96
      *
80 97
      * @param activity {@code Activity} being resumed.
81
-     * @param defaultBackButtonImpl a {@code DefaultHardwareBackBtnHandler} to
82
-     * handle invoking the back button if no {@code JitsiMeetView} handles it.
98
+     * @param defaultBackButtonImpl a {@link DefaultHardwareBackBtnHandler} to
99
+     * handle invoking the back button if no {@link BaseReactView} handles it.
83 100
      */
84 101
     public static void onHostResume(
85
-        Activity activity,
86
-        DefaultHardwareBackBtnHandler defaultBackButtonImpl) {
102
+            Activity activity,
103
+            DefaultHardwareBackBtnHandler defaultBackButtonImpl) {
87 104
         ReactInstanceManager reactInstanceManager
88 105
             = ReactInstanceManagerHolder.getReactInstanceManager();
89 106
 
@@ -93,8 +110,8 @@ class ReactActivityLifecycleAdapter {
93 110
     }
94 111
 
95 112
     /**
96
-     * Activity lifecycle method which should be called from
97
-     * {@code Activity.onNewIntent} so we can do the required internal
113
+     * {@link Activity} lifecycle method which should be called from
114
+     * {@code Activity#onNewIntent} so we can do the required internal
98 115
      * processing. Note that this is only needed if the activity's "launchMode"
99 116
      * was set to "singleTask". This is required for deep linking to work once
100 117
      * the application is already running.
@@ -109,5 +126,4 @@ class ReactActivityLifecycleAdapter {
109 126
             reactInstanceManager.onNewIntent(intent);
110 127
         }
111 128
     }
112
-
113 129
 }

+ 1
- 1
android/sdk/src/main/java/org/jitsi/meet/sdk/ReactInstanceManagerHolder.java Vedi File

@@ -28,7 +28,7 @@ import com.facebook.react.common.LifecycleState;
28 28
 import java.util.Arrays;
29 29
 import java.util.List;
30 30
 
31
-public class ReactInstanceManagerHolder {
31
+class ReactInstanceManagerHolder {
32 32
     /**
33 33
      * React Native bridge. The instance manager allows embedding applications
34 34
      * to create multiple root views off the same JavaScript bundle.

+ 3
- 1
android/sdk/src/main/java/org/jitsi/meet/sdk/ReactPackageAdapter.java Vedi File

@@ -25,7 +25,9 @@ import com.facebook.react.uimanager.ViewManager;
25 25
 import java.util.Collections;
26 26
 import java.util.List;
27 27
 
28
-public class ReactPackageAdapter implements ReactPackage {
28
+class ReactPackageAdapter
29
+    implements ReactPackage {
30
+
29 31
     @Override
30 32
     public List<NativeModule> createNativeModules(
31 33
             ReactApplicationContext reactContext) {

+ 8
- 8
android/sdk/src/main/java/org/jitsi/meet/sdk/WiFiStatsModule.java Vedi File

@@ -40,10 +40,12 @@ import java.util.Enumeration;
40 40
 /**
41 41
  * Module exposing WiFi statistics.
42 42
  *
43
- * Gathers rssi, signal in percentage, timestamp and the addresses
44
- * of the wifi device.
43
+ * Gathers rssi, signal in percentage, timestamp and the addresses of the wifi
44
+ * device.
45 45
  */
46
-class WiFiStatsModule extends ReactContextBaseJavaModule {
46
+class WiFiStatsModule
47
+    extends ReactContextBaseJavaModule {
48
+
47 49
     /**
48 50
      * The name of {@code WiFiStatsModule} to be used in the React Native
49 51
      * bridge.
@@ -56,9 +58,8 @@ class WiFiStatsModule extends ReactContextBaseJavaModule {
56 58
     static final String TAG = MODULE_NAME;
57 59
 
58 60
     /**
59
-     * The scale used for the signal value.
60
-     * A level of the signal, given in the range
61
-     * of 0 to SIGNAL_LEVEL_SCALE-1 (both inclusive).
61
+     * The scale used for the signal value. A level of the signal, given in the
62
+     * range of 0 to SIGNAL_LEVEL_SCALE-1 (both inclusive).
62 63
      */
63 64
     public final static int SIGNAL_LEVEL_SCALE = 101;
64 65
 
@@ -66,7 +67,7 @@ class WiFiStatsModule extends ReactContextBaseJavaModule {
66 67
      * {@link Handler} for running all operations on the main thread.
67 68
      */
68 69
     private final Handler mainThreadHandler
69
-            = new Handler(Looper.getMainLooper());
70
+        = new Handler(Looper.getMainLooper());
70 71
 
71 72
     /**
72 73
      * Initializes a new module instance. There shall be a single instance of
@@ -119,7 +120,6 @@ class WiFiStatsModule extends ReactContextBaseJavaModule {
119 120
             @Override
120 121
             public void run() {
121 122
                 try {
122
-
123 123
                     Context context
124 124
                         = getReactApplicationContext().getApplicationContext();
125 125
                     WifiManager wifiManager

+ 9
- 6
android/sdk/src/main/java/org/jitsi/meet/sdk/incoming_call/IncomingCallInfo.java Vedi File

@@ -22,7 +22,7 @@ public class IncomingCallInfo {
22 22
     /**
23 23
      * URL for the caller avatar.
24 24
      */
25
-    private final String callerAvatarUrl;
25
+    private final String callerAvatarURL;
26 26
 
27 27
     /**
28 28
      * Caller's name.
@@ -36,23 +36,25 @@ public class IncomingCallInfo {
36 36
 
37 37
     public IncomingCallInfo(
38 38
             @NonNull String callerName,
39
-            @NonNull String callerAvatarUrl,
39
+            @NonNull String callerAvatarURL,
40 40
             boolean hasVideo) {
41 41
         this.callerName = callerName;
42
-        this.callerAvatarUrl = callerAvatarUrl;
42
+        this.callerAvatarURL = callerAvatarURL;
43 43
         this.hasVideo = hasVideo;
44 44
     }
45 45
 
46 46
     /**
47 47
      * Gets the caller's avatar URL.
48
+     * 
48 49
      * @return - The URL as a string.
49 50
      */
50
-    public String getCallerAvatarUrl() {
51
-        return callerAvatarUrl;
51
+    public String getCallerAvatarURL() {
52
+        return callerAvatarURL;
52 53
     }
53 54
 
54 55
     /**
55 56
      * Gets the caller's name.
57
+     *
56 58
      * @return - The caller's name.
57 59
      */
58 60
     public String getCallerName() {
@@ -61,7 +63,8 @@ public class IncomingCallInfo {
61 63
 
62 64
     /**
63 65
      * Gets whether the call is a video call or not.
64
-     * @return - True if this call has video, false otherwise.
66
+     *
67
+     * @return - {@code true} if this call has video; {@code false}, otherwise.
65 68
      */
66 69
     public boolean hasVideo() {
67 70
         return hasVideo;

+ 9
- 40
android/sdk/src/main/java/org/jitsi/meet/sdk/incoming_call/IncomingCallView.java Vedi File

@@ -28,20 +28,15 @@ import org.jitsi.meet.sdk.ListenerUtils;
28 28
 import java.lang.reflect.Method;
29 29
 import java.util.Map;
30 30
 
31
+public class IncomingCallView
32
+    extends BaseReactView<IncomingCallViewListener> {
31 33
 
32
-public class IncomingCallView extends BaseReactView {
33 34
     /**
34 35
      * The {@code Method}s of {@code JitsiMeetViewListener} by event name i.e.
35 36
      * redux action types.
36 37
      */
37 38
     private static final Map<String, Method> LISTENER_METHODS
38
-        = ListenerUtils.slurpListenerMethods(IncomingCallViewListener.class);
39
-
40
-    /**
41
-     * {@link IncomingCallViewListener} instance for reporting events occurring
42
-     * in Jitsi Meet.
43
-     */
44
-    private IncomingCallViewListener listener;
39
+        = ListenerUtils.mapListenerMethods(IncomingCallViewListener.class);
45 40
 
46 41
     public IncomingCallView(@NonNull Context context) {
47 42
         super(context);
@@ -50,27 +45,13 @@ public class IncomingCallView extends BaseReactView {
50 45
     /**
51 46
      * Handler for {@link ExternalAPIModule} events.
52 47
      *
53
-     * @param name - Name of the event.
54
-     * @param data - Event data.
48
+     * @param name The name of the event.
49
+     * @param data The details/specifics of the event to send determined
50
+     * by/associated with the specified {@code name}.
55 51
      */
56 52
     @Override
57 53
     public void onExternalAPIEvent(String name, ReadableMap data) {
58
-        IncomingCallViewListener listener = getListener();
59
-        if (listener != null) {
60
-            ListenerUtils.runListenerMethod(
61
-                listener, LISTENER_METHODS, name, data);
62
-        }
63
-    }
64
-
65
-    /**
66
-     * Gets the {@link IncomingCallViewListener} set on this
67
-     * {@code IncomingCallView}.
68
-     *
69
-     * @return The {@code IncomingCallViewListener} set on this
70
-     * {@code IncomingCallView}.
71
-     */
72
-    public IncomingCallViewListener getListener() {
73
-        return listener;
54
+        onExternalAPIEvent(LISTENER_METHODS, name, data);
74 55
     }
75 56
 
76 57
     /**
@@ -78,27 +59,15 @@ public class IncomingCallView extends BaseReactView {
78 59
      * represents.
79 60
      *
80 61
      * @param callInfo - {@link IncomingCallInfo} object representing the caller
81
-     *                 information.
62
+     * information.
82 63
      */
83 64
     public void setIncomingCallInfo(IncomingCallInfo callInfo) {
84 65
         Bundle props = new Bundle();
85 66
 
86
-        props.putString("callerAvatarUrl", callInfo.getCallerAvatarUrl());
67
+        props.putString("callerAvatarURL", callInfo.getCallerAvatarURL());
87 68
         props.putString("callerName", callInfo.getCallerName());
88 69
         props.putBoolean("hasVideo", callInfo.hasVideo());
89 70
 
90 71
         createReactRootView("IncomingCallApp", props);
91 72
     }
92
-
93
-    /**
94
-     * Sets a specific {@link IncomingCallViewListener} on this
95
-     * {@code IncomingCallView}.
96
-     *
97
-     * @param listener The {@code IncomingCallViewListener} to set on this
98
-     * {@code IncomingCallView}.
99
-     */
100
-    public void setListener(IncomingCallViewListener listener) {
101
-        this.listener = listener;
102
-    }
103
-
104 73
 }

+ 3
- 3
android/sdk/src/main/java/org/jitsi/meet/sdk/incoming_call/IncomingCallViewListener.java Vedi File

@@ -20,11 +20,11 @@ import java.util.Map;
20 20
 
21 21
 /**
22 22
  * Interface for listening to events coming from Jitsi Meet, related to
23
- * {@link IncomingCallView};
23
+ * {@link IncomingCallView}.
24 24
  */
25 25
 public interface IncomingCallViewListener {
26 26
     /**
27
-     * Called when the user presses the "answer" button on the
27
+     * Called when the user presses the "Answer" button on the
28 28
      * {@link IncomingCallView}.
29 29
      *
30 30
      * @param data - Unused at the moment.
@@ -32,7 +32,7 @@ public interface IncomingCallViewListener {
32 32
     void onIncomingCallAnswered(Map<String, Object> data);
33 33
 
34 34
     /**
35
-     * Called when the user presses the "decline" button on the
35
+     * Called when the user presses the "Decline" button on the
36 36
      * {@link IncomingCallView}.
37 37
      *
38 38
      * @param data - Unused at the moment.

+ 18
- 11
android/sdk/src/main/java/org/jitsi/meet/sdk/invite/AddPeopleController.java Vedi File

@@ -33,7 +33,8 @@ import java.util.Map;
33 33
 import java.util.UUID;
34 34
 
35 35
 /**
36
- * Controller object used by native code to query and submit user selections for the user invitation flow.
36
+ * Controller object used by native code to query and submit user selections for
37
+ * the user invitation flow.
37 38
  */
38 39
 public class AddPeopleController {
39 40
 
@@ -44,17 +45,18 @@ public class AddPeopleController {
44 45
     private AddPeopleControllerListener listener;
45 46
 
46 47
     /**
47
-     * Local cache of search query results.  Used to re-hydrate the list
48
-     * of selected items based on their ids passed to inviteById
49
-     * in order to pass the full item maps back to the JitsiMeetView during submission.
48
+     * Local cache of search query results. Used to re-hydrate the list of
49
+     * selected items based on their ids passed to inviteById in order to pass
50
+     * the full item maps back to the JitsiMeetView during submission.
50 51
      */
51 52
     private final Map<String, ReadableMap> items = new HashMap<>();
52 53
 
53 54
     private final WeakReference<InviteController> owner;
54 55
 
55 56
     private final WeakReference<ReactApplicationContext> reactContext;
57
+
56 58
     /**
57
-     * Randomly generated UUID, used for identification in the InviteModule
59
+     * Randomly generated UUID, used for identification in the InviteModule.
58 60
      */
59 61
     private final String uuid = UUID.randomUUID().toString();
60 62
 
@@ -158,10 +160,10 @@ public class AddPeopleController {
158 160
     }
159 161
 
160 162
     /**
161
-     * Caches results received by the search into a local map for use
162
-     * later when the items are submitted.  Submission requires the full
163
-     * map of information, but only the IDs are returned back to the delegate.
164
-     * Using this map means we don't have to send the whole map back to the delegate.
163
+     * Caches results received by the search into a local map for use later when
164
+     * the items are submitted.  Submission requires the full map of
165
+     * information, but only the IDs are returned back to the delegate. Using
166
+     * this map means we don't have to send the whole map back to the delegate.
165 167
      *
166 168
      * @param results
167 169
      * @param query
@@ -179,10 +181,15 @@ public class AddPeopleController {
179 181
 
180 182
                 if(map.hasKey("id")) {
181 183
                     items.put(map.getString("id"), map);
182
-                } else if(map.hasKey("type") && map.getString("type").equals("phone") && map.hasKey("number")) {
184
+                } else if(map.hasKey("type")
185
+                        && map.getString("type").equals("phone")
186
+                        && map.hasKey("number")) {
183 187
                     items.put(map.getString("number"), map);
184 188
                 } else {
185
-                    Log.w("AddPeopleController", "Received result without id and that was not a phone number, so not adding it to suggestions: " + map);
189
+                    Log.w(
190
+                        "AddPeopleController",
191
+                        "Received result without id and that was not a phone number, so not adding it to suggestions: "
192
+                            + map);
186 193
                 }
187 194
 
188 195
                 jvmResults.add(map.toHashMap());

+ 3
- 3
android/sdk/src/main/java/org/jitsi/meet/sdk/invite/InviteController.java Vedi File

@@ -202,9 +202,9 @@ public class InviteController {
202 202
     }
203 203
 
204 204
     /**
205
-     * Starts a query for users to invite to the conference.  Results will be
206
-     * returned through the {@link AddPeopleControllerListener#onReceivedResults(AddPeopleController, List, String)}
207
-     * method.
205
+     * Starts a query for users to invite to the conference. Results will be
206
+     * returned through
207
+     * {@link AddPeopleControllerListener#onReceivedResults(AddPeopleController, List, String)}.
208 208
      *
209 209
      * @param query {@code String} to use for the query
210 210
      */

+ 4
- 4
android/sdk/src/main/java/org/jitsi/meet/sdk/invite/InviteControllerListener.java Vedi File

@@ -20,10 +20,10 @@ public interface InviteControllerListener {
20 20
     /**
21 21
      * Called when the add user button is tapped.
22 22
      *
23
-     * @param addPeopleController {@code AddPeopleController} scoped
24
-     * for this user invite flow. The {@code AddPeopleController} is used
25
-     * to start user queries and accepts an {@code AddPeopleControllerListener}
26
-     * for receiving user query responses.
23
+     * @param addPeopleController {@code AddPeopleController} scoped for this
24
+     * user invite flow. The {@code AddPeopleController} is used to start user
25
+     * queries and accepts an {@code AddPeopleControllerListener} for receiving
26
+     * user query responses.
27 27
      */
28 28
     void beginAddPeople(AddPeopleController addPeopleController);
29 29
 }

+ 9
- 4
android/sdk/src/main/java/org/jitsi/meet/sdk/invite/InviteModule.java Vedi File

@@ -30,7 +30,9 @@ import org.jitsi.meet.sdk.JitsiMeetView;
30 30
 /**
31 31
  * Implements the react-native module of the feature invite.
32 32
  */
33
-public class InviteModule extends ReactContextBaseJavaModule {
33
+public class InviteModule
34
+    extends ReactContextBaseJavaModule {
35
+
34 36
     public InviteModule(ReactApplicationContext reactContext) {
35 37
         super(reactContext);
36 38
     }
@@ -68,7 +70,8 @@ public class InviteModule extends ReactContextBaseJavaModule {
68 70
     private InviteController findInviteControllerByExternalAPIScope(
69 71
             String externalAPIScope) {
70 72
         JitsiMeetView view
71
-            = (JitsiMeetView)BaseReactView.findViewByExternalAPIScope(externalAPIScope);
73
+            = (JitsiMeetView)
74
+                BaseReactView.findViewByExternalAPIScope(externalAPIScope);
72 75
 
73 76
         return view == null ? null : view.getInviteController();
74 77
     }
@@ -82,7 +85,8 @@ public class InviteModule extends ReactContextBaseJavaModule {
82 85
      * Callback for invitation failures
83 86
      *
84 87
      * @param failedInvitees the items for which the invitation failed
85
-     * @param addPeopleControllerScope a string that represents a connection to a specific AddPeopleController
88
+     * @param addPeopleControllerScope a string that represents a connection to
89
+     * a specific AddPeopleController
86 90
      */
87 91
     @ReactMethod
88 92
     public void inviteSettled(
@@ -124,7 +128,8 @@ public class InviteModule extends ReactContextBaseJavaModule {
124 128
      *
125 129
      * @param results the results in a ReadableArray of ReadableMap objects
126 130
      * @param query the query associated with the search
127
-     * @param addPeopleControllerScope a string that represents a connection to a specific AddPeopleController
131
+     * @param addPeopleControllerScope a string that represents a connection to
132
+     * a specific AddPeopleController
128 133
      */
129 134
     @ReactMethod
130 135
     public void receivedResults(

+ 3
- 1
android/sdk/src/main/java/org/jitsi/meet/sdk/net/NAT64AddrInfoModule.java Vedi File

@@ -32,7 +32,9 @@ import java.net.UnknownHostException;
32 32
  * [1]: https://tools.ietf.org/html/rfc6146
33 33
  * [2]: https://tools.ietf.org/html/rfc6052
34 34
  */
35
-public class NAT64AddrInfoModule extends ReactContextBaseJavaModule {
35
+public class NAT64AddrInfoModule
36
+    extends ReactContextBaseJavaModule {
37
+
36 38
     /**
37 39
      * The host for which the module wil try to resolve both IPv4 and IPv6
38 40
      * addresses in order to figure out the NAT64 prefix.

+ 2
- 2
react/features/mobile/incoming-call/actionTypes.js Vedi File

@@ -2,7 +2,7 @@
2 2
  * The type of redux action to answer an incoming call.
3 3
  *
4 4
  * {
5
- *     type: INCOMING_CALL_ANSWERED,
5
+ *     type: INCOMING_CALL_ANSWERED
6 6
  * }
7 7
  */
8 8
 export const INCOMING_CALL_ANSWERED = Symbol('INCOMING_CALL_ANSWERED');
@@ -11,7 +11,7 @@ export const INCOMING_CALL_ANSWERED = Symbol('INCOMING_CALL_ANSWERED');
11 11
  * The type of redux action to decline an incoming call.
12 12
  *
13 13
  * {
14
- *     type: INCOMING_CALL_DECLINED,
14
+ *     type: INCOMING_CALL_DECLINED
15 15
  * }
16 16
  */
17 17
 export const INCOMING_CALL_DECLINED = Symbol('INCOMING_CALL_DECLINED');

+ 5
- 3
react/features/mobile/incoming-call/components/AnswerButton.js Vedi File

@@ -2,12 +2,15 @@
2 2
 
3 3
 import { connect } from 'react-redux';
4 4
 
5
-import { AbstractButton } from '../../../base/toolbox';
6 5
 import { translate } from '../../../base/i18n';
6
+import { AbstractButton } from '../../../base/toolbox';
7 7
 import type { AbstractButtonProps } from '../../../base/toolbox';
8 8
 
9 9
 import { incomingCallAnswered } from '../actions';
10 10
 
11
+/**
12
+ * The type of the React {@code Component} props of {@link AnswerButton}.
13
+ */
11 14
 type Props = AbstractButtonProps & {
12 15
 
13 16
     /**
@@ -17,7 +20,7 @@ type Props = AbstractButtonProps & {
17 20
 };
18 21
 
19 22
 /**
20
- * An implementation of a button which accepts an incoming call.
23
+ * An implementation of a button which accepts/answers an incoming call.
21 24
  */
22 25
 class AnswerButton extends AbstractButton<Props, *> {
23 26
     accessibilityLabel = 'incomingCall.answer';
@@ -33,7 +36,6 @@ class AnswerButton extends AbstractButton<Props, *> {
33 36
     _handleClick() {
34 37
         this.props.dispatch(incomingCallAnswered());
35 38
     }
36
-
37 39
 }
38 40
 
39 41
 export default translate(connect()(AnswerButton));

+ 5
- 3
react/features/mobile/incoming-call/components/DeclineButton.js Vedi File

@@ -2,12 +2,15 @@
2 2
 
3 3
 import { connect } from 'react-redux';
4 4
 
5
-import { AbstractButton } from '../../../base/toolbox';
6 5
 import { translate } from '../../../base/i18n';
6
+import { AbstractButton } from '../../../base/toolbox';
7 7
 import type { AbstractButtonProps } from '../../../base/toolbox';
8 8
 
9 9
 import { incomingCallDeclined } from '../actions';
10 10
 
11
+/**
12
+ * The type of the React {@code Component} props of {@link DeclineButton}.
13
+ */
11 14
 type Props = AbstractButtonProps & {
12 15
 
13 16
     /**
@@ -17,7 +20,7 @@ type Props = AbstractButtonProps & {
17 20
 };
18 21
 
19 22
 /**
20
- * An implementation of a button which rejects an incoming call.
23
+ * An implementation of a button which declines/rejects an incoming call.
21 24
  */
22 25
 class DeclineButton extends AbstractButton<Props, *> {
23 26
     accessibilityLabel = 'incomingCall.decline';
@@ -33,7 +36,6 @@ class DeclineButton extends AbstractButton<Props, *> {
33 36
     _handleClick() {
34 37
         this.props.dispatch(incomingCallDeclined());
35 38
     }
36
-
37 39
 }
38 40
 
39 41
 export default translate(connect()(DeclineButton));

+ 10
- 7
react/features/mobile/incoming-call/components/IncomingCallApp.js Vedi File

@@ -3,15 +3,17 @@
3 3
 import { BaseApp } from '../../../base/app';
4 4
 
5 5
 import { incomingCallReceived } from '../actions';
6
-
7 6
 import IncomingCallPage from './IncomingCallPage';
8 7
 
8
+/**
9
+ * The type of the React {@code Component} props of {@link IncomingCallApp}.
10
+ */
9 11
 type Props = {
10 12
 
11 13
     /**
12 14
      * URL of the avatar for the caller.
13 15
      */
14
-    callerAvatarUrl: string,
16
+    callerAvatarURL: string,
15 17
 
16 18
     /**
17 19
      * Name of the caller.
@@ -35,8 +37,9 @@ export default class IncomingCallApp extends BaseApp<Props> {
35 37
     /**
36 38
      * Navigates to {@link IncomingCallPage} upon mount.
37 39
      *
38
-     * NOTE: This was implmented here instead of in a middleware for
39
-     * the APP_WILL_MOUNT action because that would run also for {@link App}.
40
+     * NOTE: This was implmented here instead of in a middleware for the
41
+     * {@link APP_WILL_MOUNT} action because that would run also for
42
+     * {@link App}.
40 43
      *
41 44
      * @returns {void}
42 45
      */
@@ -46,15 +49,15 @@ export default class IncomingCallApp extends BaseApp<Props> {
46 49
         this._init.then(() => {
47 50
             const { dispatch } = this.state.store;
48 51
             const {
49
-                callerAvatarUrl: avatarUrl,
52
+                callerAvatarURL: avatarUrl,
50 53
                 callerName: name,
51 54
                 hasVideo
52 55
             } = this.props;
53 56
 
54 57
             dispatch(incomingCallReceived({
55 58
                 avatarUrl,
56
-                name,
57
-                hasVideo
59
+                hasVideo,
60
+                name
58 61
             }));
59 62
 
60 63
             super._navigate({ component: IncomingCallPage });

+ 25
- 25
react/features/mobile/incoming-call/components/IncomingCallPage.js Vedi File

@@ -24,7 +24,7 @@ type Props = {
24 24
     /**
25 25
      * Caller's avatar URL.
26 26
      */
27
-    _callerAvatarUrl: string,
27
+    _callerAvatarURL: string,
28 28
 
29 29
     /**
30 30
      * Caller's name.
@@ -63,7 +63,7 @@ class IncomingCallPage extends Component<Props> {
63 63
             <View style = { styles.pageContainer }>
64 64
                 <View style = { styles.backgroundAvatar }>
65 65
                     <Image
66
-                        source = {{ uri: this.props._callerAvatarUrl }}
66
+                        source = {{ uri: this.props._callerAvatarURL }}
67 67
                         style = { styles.backgroundAvatarImage } />
68 68
                 </View>
69 69
                 <LinearGradient
@@ -86,27 +86,6 @@ class IncomingCallPage extends Component<Props> {
86 86
         );
87 87
     }
88 88
 
89
-    /**
90
-     * Renders caller avatar.
91
-     *
92
-     * @private
93
-     * @returns {React$Node}
94
-     */
95
-    _renderCallerAvatar() {
96
-        return (
97
-            <View style = { styles.avatarContainer }>
98
-                <LinearGradient
99
-                    colors = { AVATAR_BORDER_GRADIENT }
100
-                    style = { styles.avatarBorder } />
101
-                <View style = { styles.avatar }>
102
-                    <Avatar
103
-                        size = { CALLER_AVATAR_SIZE }
104
-                        uri = { this.props._callerAvatarUrl } />
105
-                </View>
106
-            </View>
107
-        );
108
-    }
109
-
110 89
     /**
111 90
      * Renders buttons.
112 91
      *
@@ -135,6 +114,27 @@ class IncomingCallPage extends Component<Props> {
135 114
             </View>
136 115
         );
137 116
     }
117
+
118
+    /**
119
+     * Renders caller avatar.
120
+     *
121
+     * @private
122
+     * @returns {React$Node}
123
+     */
124
+    _renderCallerAvatar() {
125
+        return (
126
+            <View style = { styles.avatarContainer }>
127
+                <LinearGradient
128
+                    colors = { AVATAR_BORDER_GRADIENT }
129
+                    style = { styles.avatarBorder } />
130
+                <View style = { styles.avatar }>
131
+                    <Avatar
132
+                        size = { CALLER_AVATAR_SIZE }
133
+                        uri = { this.props._callerAvatarURL } />
134
+                </View>
135
+            </View>
136
+        );
137
+    }
138 138
 }
139 139
 
140 140
 /**
@@ -144,8 +144,8 @@ class IncomingCallPage extends Component<Props> {
144 144
  * @param {Object} ownProps - The component's own props.
145 145
  * @private
146 146
  * @returns {{
147
+ *     _callerAvatarURL: string,
147 148
  *     _callerName: string,
148
- *     _callerAvatarUrl: string,
149 149
  *     _hasVideo: boolean
150 150
  * }}
151 151
  */
@@ -159,7 +159,7 @@ function _mapStateToProps(state) {
159 159
          * @private
160 160
          * @type {string}
161 161
          */
162
-        _callerAvatarUrl: caller.avatarUrl,
162
+        _callerAvatarURL: caller.avatarUrl,
163 163
 
164 164
         /**
165 165
          * The caller's name.

+ 7
- 10
react/features/mobile/incoming-call/components/styles.js Vedi File

@@ -1,7 +1,4 @@
1
-import {
2
-    ColorPalette,
3
-    createStyleSheet
4
-} from '../../../base/styles';
1
+import { ColorPalette, createStyleSheet } from '../../../base/styles';
5 2
 
6 3
 export const AVATAR_BORDER_GRADIENT = [ '#4C9AFF', '#0052CC' ];
7 4
 
@@ -9,17 +6,17 @@ export const BACKGROUND_OVERLAY_GRADIENT = [ '#0052CC', '#4C9AFF' ];
9 6
 
10 7
 const BUTTON_SIZE = 56;
11 8
 
12
-export const CALLER_AVATAR_SIZE = 128;
13
-
14 9
 const CALLER_AVATAR_BORDER_WIDTH = 3;
15 10
 
11
+export const CALLER_AVATAR_SIZE = 128;
12
+
16 13
 const CALLER_AVATAR_CIRCLE_SIZE
17 14
     = CALLER_AVATAR_SIZE + (2 * CALLER_AVATAR_BORDER_WIDTH);
18 15
 
19
-const PAGE_PADDING = 48;
20
-
21 16
 const LINE_SPACING = 8;
22 17
 
18
+const PAGE_PADDING = 48;
19
+
23 20
 const _icon = {
24 21
     alignSelf: 'center',
25 22
     color: ColorPalette.white,
@@ -58,9 +55,9 @@ export default createStyleSheet({
58 55
     },
59 56
 
60 57
     avatar: {
61
-        position: 'absolute',
62 58
         marginLeft: CALLER_AVATAR_BORDER_WIDTH,
63
-        marginTop: CALLER_AVATAR_BORDER_WIDTH
59
+        marginTop: CALLER_AVATAR_BORDER_WIDTH,
60
+        position: 'absolute'
64 61
     },
65 62
 
66 63
     avatarBorder: {

+ 3
- 6
react/features/mobile/incoming-call/middleware.js Vedi File

@@ -5,14 +5,11 @@ import { getSymbolDescription } from '../../base/util';
5 5
 
6 6
 import { sendEvent } from '../external-api';
7 7
 
8
-import {
9
-    INCOMING_CALL_ANSWERED,
10
-    INCOMING_CALL_DECLINED
11
-} from './actionTypes';
8
+import { INCOMING_CALL_ANSWERED, INCOMING_CALL_DECLINED } from './actionTypes';
12 9
 
13 10
 /**
14
- * Middleware that captures Redux actions and uses the IncomingCallExternalAPI
15
- * module to turn them into native events so the application knows about them.
11
+ * Middleware that captures redux actions and uses the ExternalAPI module to
12
+ * turn them into native events so the app knows about them.
16 13
  *
17 14
  * @param {Store} store - The redux store.
18 15
  * @returns {Function}

+ 5
- 8
react/features/mobile/incoming-call/reducer.js Vedi File

@@ -1,6 +1,6 @@
1
-/* @flow */
1
+// @flow
2 2
 
3
-import { assign, ReducerRegistry } from '../../base/redux';
3
+import { ReducerRegistry, set } from '../../base/redux';
4 4
 
5 5
 import {
6 6
     INCOMING_CALL_ANSWERED,
@@ -13,13 +13,10 @@ ReducerRegistry.register(
13 13
         switch (action.type) {
14 14
         case INCOMING_CALL_ANSWERED:
15 15
         case INCOMING_CALL_DECLINED:
16
-            return assign(state, {
17
-                caller: undefined
18
-            });
16
+            return set(state, 'caller', undefined);
17
+
19 18
         case INCOMING_CALL_RECEIVED:
20
-            return assign(state, {
21
-                caller: action.caller
22
-            });
19
+            return set(state, 'caller', action.caller);
23 20
         }
24 21
 
25 22
         return state;

+ 8
- 2
react/index.native.js Vedi File

@@ -21,6 +21,9 @@ import { App } from './features/app';
21 21
 import { equals } from './features/base/redux';
22 22
 import { IncomingCallApp } from './features/mobile/incoming-call';
23 23
 
24
+/**
25
+ * The type of the React {@code Component} props of {@link Root}.
26
+ */
24 27
 type Props = {
25 28
 
26 29
     /**
@@ -29,6 +32,9 @@ type Props = {
29 32
     url: Object | string
30 33
 };
31 34
 
35
+/**
36
+ * The type of the React {@code Component} state of {@link Root}.
37
+ */
32 38
 type State = {
33 39
 
34 40
     /**
@@ -141,8 +147,8 @@ class Root extends Component<Props, State> {
141 147
     }
142 148
 }
143 149
 
144
-// Register the main/root Component.
150
+// Register the main/root Component of JitsiMeetView.
145 151
 AppRegistry.registerComponent('App', () => Root);
146 152
 
147
-// Register the incoming call Component.
153
+// Register the main/root Component of IncomingCallView.
148 154
 AppRegistry.registerComponent('IncomingCallApp', () => IncomingCallApp);

Loading…
Annulla
Salva