瀏覽代碼

[RN] Add color scheme support - native

j8
Bettenbuk Zoltan 6 年之前
父節點
當前提交
eec7a1b628

+ 18
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetActivity.java 查看文件

@@ -27,6 +27,7 @@ import android.support.v7.app.AppCompatActivity;
27 27
 import android.view.KeyEvent;
28 28
 
29 29
 import com.facebook.react.ReactInstanceManager;
30
+import com.facebook.react.bridge.WritableMap;
30 31
 import com.facebook.react.modules.core.PermissionListener;
31 32
 
32 33
 import java.net.URL;
@@ -52,6 +53,11 @@ public class JitsiMeetActivity
52 53
     private static final int OVERLAY_PERMISSION_REQUEST_CODE
53 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 62
      * The default base {@code URL} used to join a conference when a partial URL
57 63
      * (e.g. a room name only) is specified. The value is used only while
@@ -120,6 +126,7 @@ public class JitsiMeetActivity
120 126
 
121 127
         // XXX Before calling JitsiMeetView#loadURL, make sure to call whatever
122 128
         // is documented to need such an order in order to take effect:
129
+        view.setColorScheme(colorScheme);
123 130
         view.setDefaultURL(defaultURL);
124 131
         if (pictureInPictureEnabled != null) {
125 132
             view.setPictureInPictureEnabled(
@@ -286,6 +293,17 @@ public class JitsiMeetActivity
286 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 309
      * @see JitsiMeetView#setDefaultURL(URL)

+ 30
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetView.java 查看文件

@@ -22,7 +22,9 @@ import android.support.annotation.NonNull;
22 22
 import android.support.annotation.Nullable;
23 23
 import android.util.Log;
24 24
 
25
+import com.facebook.react.bridge.Arguments;
25 26
 import com.facebook.react.bridge.ReadableMap;
27
+import com.facebook.react.bridge.WritableMap;
26 28
 
27 29
 import java.lang.reflect.Method;
28 30
 import java.net.URL;
@@ -69,6 +71,11 @@ public class JitsiMeetView
69 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 80
      * The default base {@code URL} used to join a conference when a partial URL
74 81
      * (e.g. a room name only) is specified to {@link #loadURLString(String)} or
@@ -130,6 +137,15 @@ public class JitsiMeetView
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 150
      * Gets the default base {@code URL} used to join a conference when a
135 151
      * partial URL (e.g. a room name only) is specified to
@@ -208,6 +224,11 @@ public class JitsiMeetView
208 224
     public void loadURLObject(@Nullable Bundle urlObject) {
209 225
         Bundle props = new Bundle();
210 226
 
227
+        // color scheme
228
+        if (colorScheme != null) {
229
+            props.putBundle("colorScheme", Arguments.toBundle(colorScheme));
230
+        }
231
+
211 232
         // defaultURL
212 233
         if (defaultURL != null) {
213 234
             props.putString("defaultURL", defaultURL.toString());
@@ -305,6 +326,15 @@ public class JitsiMeetView
305 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 339
      * Sets the default base {@code URL} used to join a conference when a
310 340
      * partial URL (e.g. a room name only) is specified to

+ 2
- 0
ios/sdk/src/JitsiMeetView.h 查看文件

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

+ 1
- 0
ios/sdk/src/JitsiMeetView.m 查看文件

@@ -231,6 +231,7 @@ static NSMapTable<NSString *, JitsiMeetView *> *views;
231 231
         props[@"defaultURL"] = [self.defaultURL absoluteString];
232 232
     }
233 233
 
234
+    props[@"colorScheme"] = self.colorScheme;
234 235
     props[@"externalAPIScope"] = externalAPIScope;
235 236
     props[@"pictureInPictureEnabled"] = @(self.pictureInPictureEnabled);
236 237
     props[@"welcomePageEnabled"] = @(self.welcomePageEnabled);

Loading…
取消
儲存