Bladeren bron

[RN] Add color scheme support - native

j8
Bettenbuk Zoltan 6 jaren geleden
bovenliggende
commit
eec7a1b628

+ 18
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java Bestand weergeven

27
 import android.view.KeyEvent;
27
 import android.view.KeyEvent;
28
 
28
 
29
 import com.facebook.react.ReactInstanceManager;
29
 import com.facebook.react.ReactInstanceManager;
30
+import com.facebook.react.bridge.WritableMap;
30
 import com.facebook.react.modules.core.PermissionListener;
31
 import com.facebook.react.modules.core.PermissionListener;
31
 
32
 
32
 import java.net.URL;
33
 import java.net.URL;
52
     private static final int OVERLAY_PERMISSION_REQUEST_CODE
53
     private static final int OVERLAY_PERMISSION_REQUEST_CODE
53
         = (int) (Math.random() * Short.MAX_VALUE);
54
         = (int) (Math.random() * Short.MAX_VALUE);
54
 
55
 
56
+    /**
57
+     * A color scheme object to override the default color is the SDK.
58
+     */
59
+    private WritableMap colorScheme;
60
+
55
     /**
61
     /**
56
      * The default base {@code URL} used to join a conference when a partial URL
62
      * The default base {@code URL} used to join a conference when a partial URL
57
      * (e.g. a room name only) is specified. The value is used only while
63
      * (e.g. a room name only) is specified. The value is used only while
120
 
126
 
121
         // XXX Before calling JitsiMeetView#loadURL, make sure to call whatever
127
         // XXX Before calling JitsiMeetView#loadURL, make sure to call whatever
122
         // is documented to need such an order in order to take effect:
128
         // is documented to need such an order in order to take effect:
129
+        view.setColorScheme(colorScheme);
123
         view.setDefaultURL(defaultURL);
130
         view.setDefaultURL(defaultURL);
124
         if (pictureInPictureEnabled != null) {
131
         if (pictureInPictureEnabled != null) {
125
             view.setPictureInPictureEnabled(
132
             view.setPictureInPictureEnabled(
286
         ReactActivityLifecycleCallbacks.requestPermissions(this, permissions, requestCode, listener);
293
         ReactActivityLifecycleCallbacks.requestPermissions(this, permissions, requestCode, listener);
287
     }
294
     }
288
 
295
 
296
+    /**
297
+     * @see JitsiMeetView#setColorScheme(WritableMap)
298
+     */
299
+    public void setColorScheme(WritableMap colorScheme) {
300
+        if (view == null) {
301
+            this.colorScheme = colorScheme;
302
+        } else {
303
+            view.setColorScheme(colorScheme);
304
+        }
305
+    }
306
+
289
     /**
307
     /**
290
      *
308
      *
291
      * @see JitsiMeetView#setDefaultURL(URL)
309
      * @see JitsiMeetView#setDefaultURL(URL)

+ 30
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java Bestand weergeven

22
 import android.support.annotation.Nullable;
22
 import android.support.annotation.Nullable;
23
 import android.util.Log;
23
 import android.util.Log;
24
 
24
 
25
+import com.facebook.react.bridge.Arguments;
25
 import com.facebook.react.bridge.ReadableMap;
26
 import com.facebook.react.bridge.ReadableMap;
27
+import com.facebook.react.bridge.WritableMap;
26
 
28
 
27
 import java.lang.reflect.Method;
29
 import java.lang.reflect.Method;
28
 import java.net.URL;
30
 import java.net.URL;
69
         return loaded;
71
         return loaded;
70
     }
72
     }
71
 
73
 
74
+    /**
75
+     * A color scheme object to override the default color is the SDK.
76
+     */
77
+    private WritableMap colorScheme;
78
+
72
     /**
79
     /**
73
      * The default base {@code URL} used to join a conference when a partial URL
80
      * The default base {@code URL} used to join a conference when a partial URL
74
      * (e.g. a room name only) is specified to {@link #loadURLString(String)} or
81
      * (e.g. a room name only) is specified to {@link #loadURLString(String)} or
130
         }
137
         }
131
     }
138
     }
132
 
139
 
140
+    /**
141
+     * Gets the color scheme used in the SDK.
142
+     *
143
+     * @return The color scheme map.
144
+     */
145
+    public WritableMap getColorScheme() {
146
+        return colorScheme;
147
+    }
148
+
133
     /**
149
     /**
134
      * Gets the default base {@code URL} used to join a conference when a
150
      * Gets the default base {@code URL} used to join a conference when a
135
      * partial URL (e.g. a room name only) is specified to
151
      * partial URL (e.g. a room name only) is specified to
208
     public void loadURLObject(@Nullable Bundle urlObject) {
224
     public void loadURLObject(@Nullable Bundle urlObject) {
209
         Bundle props = new Bundle();
225
         Bundle props = new Bundle();
210
 
226
 
227
+        // color scheme
228
+        if (colorScheme != null) {
229
+            props.putBundle("colorScheme", Arguments.toBundle(colorScheme));
230
+        }
231
+
211
         // defaultURL
232
         // defaultURL
212
         if (defaultURL != null) {
233
         if (defaultURL != null) {
213
             props.putString("defaultURL", defaultURL.toString());
234
             props.putString("defaultURL", defaultURL.toString());
305
         onExternalAPIEvent(LISTENER_METHODS, name, data);
326
         onExternalAPIEvent(LISTENER_METHODS, name, data);
306
     }
327
     }
307
 
328
 
329
+    /**
330
+     * Sets the color scheme to override the default colors of the SDK.
331
+     *
332
+     * @param colorScheme The color scheme map.
333
+     */
334
+    public void setColorScheme(WritableMap colorScheme) {
335
+        this.colorScheme = colorScheme;
336
+    }
337
+
308
     /**
338
     /**
309
      * Sets the default base {@code URL} used to join a conference when a
339
      * Sets the default base {@code URL} used to join a conference when a
310
      * partial URL (e.g. a room name only) is specified to
340
      * partial URL (e.g. a room name only) is specified to

+ 2
- 0
ios/sdk/src/JitsiMeetView.h Bestand weergeven

23
 
23
 
24
 @property (class, copy, nonatomic, nullable) NSString *conferenceActivityType;
24
 @property (class, copy, nonatomic, nullable) NSString *conferenceActivityType;
25
 
25
 
26
+@property (nonatomic) NSDictionary *colorScheme;
27
+
26
 @property (copy, nonatomic, nullable) NSURL *defaultURL;
28
 @property (copy, nonatomic, nullable) NSURL *defaultURL;
27
 
29
 
28
 @property (nonatomic, nullable, weak) id<JitsiMeetViewDelegate> delegate;
30
 @property (nonatomic, nullable, weak) id<JitsiMeetViewDelegate> delegate;

+ 1
- 0
ios/sdk/src/JitsiMeetView.m Bestand weergeven

231
         props[@"defaultURL"] = [self.defaultURL absoluteString];
231
         props[@"defaultURL"] = [self.defaultURL absoluteString];
232
     }
232
     }
233
 
233
 
234
+    props[@"colorScheme"] = self.colorScheme;
234
     props[@"externalAPIScope"] = externalAPIScope;
235
     props[@"externalAPIScope"] = externalAPIScope;
235
     props[@"pictureInPictureEnabled"] = @(self.pictureInPictureEnabled);
236
     props[@"pictureInPictureEnabled"] = @(self.pictureInPictureEnabled);
236
     props[@"welcomePageEnabled"] = @(self.welcomePageEnabled);
237
     props[@"welcomePageEnabled"] = @(self.welcomePageEnabled);

Laden…
Annuleren
Opslaan