Kaynağa Gözat

feat(rn,sdk) add setConfigOverride to JitsiMeetConferenceOptions

Allows for overriding any (overridable, of course) config option.
master
tmoldovan8x8 3 yıl önce
ebeveyn
işleme
ae33755913
No account linked to committer's email address

+ 45
- 67
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetConferenceOptions.java Dosyayı Görüntüle

@@ -40,10 +40,6 @@ public class JitsiMeetConferenceOptions implements Parcelable {
40 40
      * Room name.
41 41
      */
42 42
     private String room;
43
-    /**
44
-     * Conference subject.
45
-     */
46
-    private String subject;
47 43
     /**
48 44
      * JWT token used for authentication.
49 45
      */
@@ -55,17 +51,14 @@ public class JitsiMeetConferenceOptions implements Parcelable {
55 51
     private Bundle colorScheme;
56 52
 
57 53
     /**
58
-     * Feature flags. See: https://github.com/jitsi/jitsi-meet/blob/master/react/features/base/flags/constants.js
54
+     * Config. See: https://github.com/jitsi/jitsi-meet/blob/master/config.js
59 55
      */
60
-    private Bundle featureFlags;
56
+    private Bundle config;
61 57
 
62 58
     /**
63
-     * Set to {@code true} to join the conference with audio / video muted or to start in audio
64
-     * only mode respectively.
59
+     * Feature flags. See: https://github.com/jitsi/jitsi-meet/blob/master/react/features/base/flags/constants.js
65 60
      */
66
-    private Boolean audioMuted;
67
-    private Boolean audioOnly;
68
-    private Boolean videoMuted;
61
+    private Bundle featureFlags;
69 62
 
70 63
     /**
71 64
      * USer information, to be used when no token is specified.
@@ -80,10 +73,6 @@ public class JitsiMeetConferenceOptions implements Parcelable {
80 73
         return room;
81 74
     }
82 75
 
83
-    public String getSubject() {
84
-        return subject;
85
-    }
86
-
87 76
     public String getToken() {
88 77
         return token;
89 78
     }
@@ -96,18 +85,6 @@ public class JitsiMeetConferenceOptions implements Parcelable {
96 85
         return featureFlags;
97 86
     }
98 87
 
99
-    public boolean getAudioMuted() {
100
-        return audioMuted;
101
-    }
102
-
103
-    public boolean getAudioOnly() {
104
-        return audioOnly;
105
-    }
106
-
107
-    public boolean getVideoMuted() {
108
-        return videoMuted;
109
-    }
110
-
111 88
     public JitsiMeetUserInfo getUserInfo() {
112 89
         return userInfo;
113 90
     }
@@ -118,19 +95,16 @@ public class JitsiMeetConferenceOptions implements Parcelable {
118 95
     public static class Builder {
119 96
         private URL serverURL;
120 97
         private String room;
121
-        private String subject;
122 98
         private String token;
123 99
 
124 100
         private Bundle colorScheme;
101
+        private Bundle config;
125 102
         private Bundle featureFlags;
126 103
 
127
-        private Boolean audioMuted;
128
-        private Boolean audioOnly;
129
-        private Boolean videoMuted;
130
-
131 104
         private JitsiMeetUserInfo userInfo;
132 105
 
133 106
         public Builder() {
107
+            config = new Bundle();
134 108
             featureFlags = new Bundle();
135 109
         }
136 110
 
@@ -162,7 +136,7 @@ public class JitsiMeetConferenceOptions implements Parcelable {
162 136
          * @return - The {@link Builder} object itself so the method calls can be chained.
163 137
          */
164 138
         public Builder setSubject(String subject) {
165
-            this.subject = subject;
139
+            setConfigOverride("subject", subject);
166 140
 
167 141
             return this;
168 142
         }
@@ -193,11 +167,11 @@ public class JitsiMeetConferenceOptions implements Parcelable {
193 167
 
194 168
         /**
195 169
          * Indicates the conference will be joined with the microphone muted.
196
-         * @param muted - Muted indication.
170
+         * @param audioMuted - Muted indication.
197 171
          * @return - The {@link Builder} object itself so the method calls can be chained.
198 172
          */
199
-        public Builder setAudioMuted(boolean muted) {
200
-            this.audioMuted = muted;
173
+        public Builder setAudioMuted(boolean audioMuted) {
174
+            setConfigOverride("startWithAudioMuted", audioMuted);
201 175
 
202 176
             return this;
203 177
         }
@@ -209,7 +183,7 @@ public class JitsiMeetConferenceOptions implements Parcelable {
209 183
          * @return - The {@link Builder} object itself so the method calls can be chained.
210 184
          */
211 185
         public Builder setAudioOnly(boolean audioOnly) {
212
-            this.audioOnly = audioOnly;
186
+            setConfigOverride("startAudioOnly", audioOnly);
213 187
 
214 188
             return this;
215 189
         }
@@ -219,7 +193,7 @@ public class JitsiMeetConferenceOptions implements Parcelable {
219 193
          * @return - The {@link Builder} object itself so the method calls can be chained.
220 194
          */
221 195
         public Builder setVideoMuted(boolean videoMuted) {
222
-            this.videoMuted = videoMuted;
196
+            setConfigOverride("startWithVideoMuted", videoMuted);
223 197
 
224 198
             return this;
225 199
         }
@@ -261,6 +235,36 @@ public class JitsiMeetConferenceOptions implements Parcelable {
261 235
             return this;
262 236
         }
263 237
 
238
+        public Builder setConfigOverride(String config, String value) {
239
+            this.config.putString(config, value);
240
+
241
+            return this;
242
+        }
243
+
244
+        public Builder setConfigOverride(String config, int value) {
245
+            this.config.putInt(config, value);
246
+
247
+            return this;
248
+        }
249
+
250
+        public Builder setConfigOverride(String config, boolean value) {
251
+            this.config.putBoolean(config, value);
252
+
253
+            return this;
254
+        }
255
+
256
+        public Builder setConfigOverride(String config, Bundle bundle) {
257
+            this.config.putBundle(config, bundle);
258
+
259
+            return this;
260
+        }
261
+
262
+        public Builder setConfigOverride(String config, String[] list) {
263
+            this.config.putStringArray(config, list);
264
+
265
+            return this;
266
+        }
267
+
264 268
         /**
265 269
          * Builds the immutable {@link JitsiMeetConferenceOptions} object with the configuration
266 270
          * that this {@link Builder} instance specified.
@@ -271,13 +275,10 @@ public class JitsiMeetConferenceOptions implements Parcelable {
271 275
 
272 276
             options.serverURL = this.serverURL;
273 277
             options.room = this.room;
274
-            options.subject = this.subject;
275 278
             options.token = this.token;
276 279
             options.colorScheme = this.colorScheme;
280
+            options.config = this.config;
277 281
             options.featureFlags = this.featureFlags;
278
-            options.audioMuted = this.audioMuted;
279
-            options.audioOnly = this.audioOnly;
280
-            options.videoMuted = this.videoMuted;
281 282
             options.userInfo = this.userInfo;
282 283
 
283 284
             return options;
@@ -290,17 +291,12 @@ public class JitsiMeetConferenceOptions implements Parcelable {
290 291
     private JitsiMeetConferenceOptions(Parcel in) {
291 292
         serverURL = (URL) in.readSerializable();
292 293
         room = in.readString();
293
-        subject = in.readString();
294 294
         token = in.readString();
295 295
         colorScheme = in.readBundle();
296
+        config = in.readBundle();
296 297
         featureFlags = in.readBundle();
297 298
         userInfo = new JitsiMeetUserInfo(in.readBundle());
298 299
         byte tmpAudioMuted = in.readByte();
299
-        audioMuted = tmpAudioMuted == 0 ? null : tmpAudioMuted == 1;
300
-        byte tmpAudioOnly = in.readByte();
301
-        audioOnly = tmpAudioOnly == 0 ? null : tmpAudioOnly == 1;
302
-        byte tmpVideoMuted = in.readByte();
303
-        videoMuted = tmpVideoMuted == 0 ? null : tmpVideoMuted == 1;
304 300
     }
305 301
 
306 302
     Bundle asProps() {
@@ -317,21 +313,6 @@ public class JitsiMeetConferenceOptions implements Parcelable {
317 313
             props.putBundle("colorScheme", colorScheme);
318 314
         }
319 315
 
320
-        Bundle config = new Bundle();
321
-
322
-        if (audioMuted != null) {
323
-            config.putBoolean("startWithAudioMuted", audioMuted);
324
-        }
325
-        if (audioOnly != null) {
326
-            config.putBoolean("startAudioOnly", audioOnly);
327
-        }
328
-        if (videoMuted != null) {
329
-            config.putBoolean("startWithVideoMuted", videoMuted);
330
-        }
331
-        if (subject != null) {
332
-            config.putString("subject", subject);
333
-        }
334
-
335 316
         Bundle urlProps = new Bundle();
336 317
 
337 318
         // The room is fully qualified
@@ -379,14 +360,11 @@ public class JitsiMeetConferenceOptions implements Parcelable {
379 360
     public void writeToParcel(Parcel dest, int flags) {
380 361
         dest.writeSerializable(serverURL);
381 362
         dest.writeString(room);
382
-        dest.writeString(subject);
383 363
         dest.writeString(token);
384 364
         dest.writeBundle(colorScheme);
365
+        dest.writeBundle(config);
385 366
         dest.writeBundle(featureFlags);
386 367
         dest.writeBundle(userInfo != null ? userInfo.asBundle() : new Bundle());
387
-        dest.writeByte((byte) (audioMuted == null ? 0 : audioMuted ? 1 : 2));
388
-        dest.writeByte((byte) (audioOnly == null ? 0 : audioOnly ? 1 : 2));
389
-        dest.writeByte((byte) (videoMuted == null ? 0 : videoMuted ? 1 : 2));
390 368
     }
391 369
 
392 370
     @Override

+ 3
- 0
config.js Dosyayı Görüntüle

@@ -594,6 +594,9 @@ var config = {
594 594
     },
595 595
 
596 596
     analytics: {
597
+        // True if the analytics should be disabled
598
+        // disabled: false,
599
+
597 600
         // The Google Analytics Tracking ID:
598 601
         // googleAnalyticsTrackingId: 'your-tracking-id-UA-123456-1'
599 602
 

+ 11
- 27
ios/sdk/src/JitsiMeetConferenceOptions.h Dosyayı Görüntüle

@@ -29,10 +29,6 @@
29 29
  * Room name.
30 30
  */
31 31
 @property (nonatomic, copy, nullable) NSString *room;
32
-/**
33
- * Conference subject.
34
- */
35
-@property (nonatomic, copy, nullable) NSString *subject;
36 32
 /**
37 33
  * JWT token used for authentication.
38 34
  */
@@ -49,13 +45,7 @@
49 45
  */
50 46
 @property (nonatomic, readonly, nonnull) NSDictionary *featureFlags;
51 47
 
52
-/**
53
- * Set to YES to join the conference with audio / video muted or to start in audio
54
- * only mode respectively.
55
- */
56
-@property (nonatomic) BOOL audioOnly;
57
-@property (nonatomic) BOOL audioMuted;
58
-@property (nonatomic) BOOL videoMuted;
48
+@property (nonatomic, readonly, nonnull) NSDictionary *config;
59 49
 
60 50
 /**
61 51
  * Set to YES to enable the welcome page. Typically SDK users won't need this enabled
@@ -71,15 +61,17 @@
71 61
 - (void)setFeatureFlag:(NSString *_Nonnull)flag withBoolean:(BOOL)value;
72 62
 - (void)setFeatureFlag:(NSString *_Nonnull)flag withValue:(id _Nonnull)value;
73 63
 
74
-/**
75
- * CallKit call handle, to be used when implementing incoming calls.
76
- */
77
-@property (nonatomic, copy, nullable) NSString *callHandle;
64
+- (void)setConfigOverride:(NSString *_Nonnull)config withBoolean:(BOOL)value;
65
+- (void)setConfigOverride:(NSString *_Nonnull)config withValue:(id _Nonnull)value;
66
+- (void)setConfigOverride:(NSString *_Nonnull)config withDictionary:(NSDictionary * _Nonnull)dictionary;
67
+- (void)setConfigOverride:(NSString *_Nonnull)config withArray:( NSArray * _Nonnull)array;
78 68
 
79
-/**
80
- * CallKit call UUID, to be used when implementing incoming calls.
81
- */
82
-@property (nonatomic, copy, nullable) NSUUID *callUUID;
69
+- (void)setAudioOnly:(BOOL)audioOnly;
70
+- (void)setAudioMuted:(BOOL)audioMuted;
71
+- (void)setVideoMuted:(BOOL)videoMuted;
72
+- (void)setCallHandle:(NSString *_Nonnull)callHandle;
73
+- (void)setCallUUID:(NSUUID *_Nonnull)callUUID;
74
+- (void)setSubject:(NSString *_Nonnull)subject;
83 75
 
84 76
 @end
85 77
 
@@ -88,23 +80,15 @@
88 80
 @property (nonatomic, copy, nullable, readonly) NSURL *serverURL;
89 81
 
90 82
 @property (nonatomic, copy, nullable, readonly) NSString *room;
91
-@property (nonatomic, copy, nullable, readonly) NSString *subject;
92 83
 @property (nonatomic, copy, nullable, readonly) NSString *token;
93 84
 
94 85
 @property (nonatomic, copy, nullable) NSDictionary *colorScheme;
95 86
 @property (nonatomic, readonly, nonnull) NSDictionary *featureFlags;
96 87
 
97
-@property (nonatomic, readonly) BOOL audioOnly;
98
-@property (nonatomic, readonly) BOOL audioMuted;
99
-@property (nonatomic, readonly) BOOL videoMuted;
100
-
101 88
 @property (nonatomic, readonly) BOOL welcomePageEnabled;
102 89
 
103 90
 @property (nonatomic, nullable) JitsiMeetUserInfo *userInfo;
104 91
 
105
-@property (nonatomic, copy, nullable, readonly) NSString *callHandle;
106
-@property (nonatomic, copy, nullable, readonly) NSUUID *callUUID;
107
-
108 92
 + (instancetype _Nonnull)fromBuilder:(void (^_Nonnull)(JitsiMeetConferenceOptionsBuilder *_Nonnull))initBlock;
109 93
 - (instancetype _Nonnull)init NS_UNAVAILABLE;
110 94
 

+ 34
- 87
ios/sdk/src/JitsiMeetConferenceOptions.m Dosyayı Görüntüle

@@ -26,35 +26,23 @@ static NSString *const WelcomePageEnabledFeatureFlag = @"welcomepage.enabled";
26 26
 
27 27
 
28 28
 @implementation JitsiMeetConferenceOptionsBuilder {
29
-    NSNumber *_audioOnly;
30
-    NSNumber *_audioMuted;
31
-    NSNumber *_videoMuted;
32 29
     NSMutableDictionary *_featureFlags;
30
+    NSMutableDictionary *_config;
33 31
 }
34 32
 
35
-@dynamic audioOnly;
36
-@dynamic audioMuted;
37
-@dynamic videoMuted;
38 33
 @dynamic welcomePageEnabled;
39 34
 
40 35
 - (instancetype)init {
41 36
     if (self = [super init]) {
42 37
         _serverURL = nil;
43 38
         _room = nil;
44
-        _subject = nil;
45 39
         _token = nil;
46 40
 
47 41
         _colorScheme = nil;
42
+        _config = [[NSMutableDictionary alloc] init];
48 43
         _featureFlags = [[NSMutableDictionary alloc] init];
49 44
 
50
-        _audioOnly = nil;
51
-        _audioMuted = nil;
52
-        _videoMuted = nil;
53
-
54 45
         _userInfo = nil;
55
-
56
-        _callHandle = nil;
57
-        _callUUID = nil;
58 46
     }
59 47
     
60 48
     return self;
@@ -68,85 +56,70 @@ static NSString *const WelcomePageEnabledFeatureFlag = @"welcomepage.enabled";
68 56
     _featureFlags[flag] = value;
69 57
 }
70 58
 
71
-#pragma mark - Dynamic properties
72
-
73 59
 - (void)setAudioOnly:(BOOL)audioOnly {
74
-    _audioOnly = [NSNumber numberWithBool:audioOnly];
75
-}
76
-
77
-- (BOOL)audioOnly {
78
-    return _audioOnly && [_audioOnly boolValue];
60
+    [self setConfigOverride:@"startAudioOnly" withBoolean:audioOnly];
79 61
 }
80 62
 
81 63
 - (void)setAudioMuted:(BOOL)audioMuted {
82
-    _audioMuted = [NSNumber numberWithBool:audioMuted];
64
+    [self setConfigOverride:@"startWithAudioMuted" withBoolean:audioMuted];
83 65
 }
84 66
 
85
-- (BOOL)audioMuted {
86
-    return _audioMuted && [_audioMuted boolValue];
67
+- (void)setVideoMuted:(BOOL)videoMuted {
68
+    [self setConfigOverride:@"startWithVideoMuted" withBoolean:videoMuted];
87 69
 }
88 70
 
89
-- (void)setVideoMuted:(BOOL)videoMuted {
90
-    _videoMuted = [NSNumber numberWithBool:videoMuted];
71
+- (void)setCallHandle:(NSString *_Nonnull)callHandle {
72
+    [self setConfigOverride:@"callHandle" withValue:callHandle];
91 73
 }
92 74
 
93
-- (BOOL)videoMuted {
94
-    return _videoMuted && [_videoMuted boolValue];
75
+- (void)setCallUUID:(NSUUID *_Nonnull)callUUID {
76
+    [self setConfigOverride:@"callUUID" withValue:[callUUID UUIDString]];
95 77
 }
96 78
 
97
-- (void)setWelcomePageEnabled:(BOOL)welcomePageEnabled {
98
-    [self setFeatureFlag:WelcomePageEnabledFeatureFlag
99
-               withBoolean:welcomePageEnabled];
79
+- (void)setSubject:(NSString *_Nonnull)subject {
80
+    [self setConfigOverride:@"subject" withValue:subject];
100 81
 }
101 82
 
102
-- (BOOL)welcomePageEnabled {
103
-    NSNumber *n = _featureFlags[WelcomePageEnabledFeatureFlag];
83
+- (void)setConfigOverride:(NSString *_Nonnull)config withBoolean:(BOOL)value {
84
+    [self setConfigOverride:config withValue:[NSNumber numberWithBool:value]];
85
+}
104 86
 
105
-    return n != nil ? [n boolValue] : NO;
87
+- (void)setConfigOverride:(NSString *_Nonnull)config withDictionary:(NSDictionary*)dictionary {
88
+    _config[config] = dictionary;
106 89
 }
107 90
 
108
-#pragma mark - Private API
91
+- (void)setConfigOverride:(NSString *_Nonnull)config withArray:( NSArray * _Nonnull)array {
92
+    _config[config] = array;
93
+}
109 94
 
110
-- (NSNumber *)getAudioOnly {
111
-    return _audioOnly;
95
+- (void)setConfigOverride:(NSString *_Nonnull)config withValue:(id _Nonnull)value {
96
+    _config[config] = value;
112 97
 }
113 98
 
114
-- (NSNumber *)getAudioMuted {
115
-    return _audioMuted;
99
+#pragma mark - Dynamic properties
100
+
101
+- (void)setWelcomePageEnabled:(BOOL)welcomePageEnabled {
102
+    [self setFeatureFlag:WelcomePageEnabledFeatureFlag
103
+               withBoolean:welcomePageEnabled];
116 104
 }
117 105
 
118
-- (NSNumber *)getVideoMuted {
119
-    return _videoMuted;
106
+- (BOOL)welcomePageEnabled {
107
+    NSNumber *n = _featureFlags[WelcomePageEnabledFeatureFlag];
108
+
109
+    return n != nil ? [n boolValue] : NO;
120 110
 }
121 111
 
122 112
 @end
123 113
 
124 114
 @implementation JitsiMeetConferenceOptions {
125
-    NSNumber *_audioOnly;
126
-    NSNumber *_audioMuted;
127
-    NSNumber *_videoMuted;
128 115
     NSDictionary *_featureFlags;
116
+    NSDictionary *_config;
129 117
 }
130 118
 
131
-@dynamic audioOnly;
132
-@dynamic audioMuted;
133
-@dynamic videoMuted;
134 119
 @dynamic welcomePageEnabled;
135 120
 
136 121
 #pragma mark - Dynamic properties
137 122
 
138
-- (BOOL)audioOnly {
139
-    return _audioOnly && [_audioOnly boolValue];
140
-}
141
-
142
-- (BOOL)audioMuted {
143
-    return _audioMuted && [_audioMuted boolValue];
144
-}
145
-
146
-- (BOOL)videoMuted {
147
-    return _videoMuted && [_videoMuted boolValue];
148
-}
149
-
150 123
 - (BOOL)welcomePageEnabled {
151 124
     NSNumber *n = _featureFlags[WelcomePageEnabledFeatureFlag];
152 125
 
@@ -159,21 +132,15 @@ static NSString *const WelcomePageEnabledFeatureFlag = @"welcomepage.enabled";
159 132
     if (self = [super init]) {
160 133
         _serverURL = builder.serverURL;
161 134
         _room = builder.room;
162
-        _subject = builder.subject;
163 135
         _token = builder.token;
164 136
 
165 137
         _colorScheme = builder.colorScheme;
166 138
 
167
-        _audioOnly = [builder getAudioOnly];
168
-        _audioMuted = [builder getAudioMuted];
169
-        _videoMuted = [builder getVideoMuted];
139
+        _config = builder.config;
170 140
 
171 141
         _featureFlags = [NSDictionary dictionaryWithDictionary:builder.featureFlags];
172 142
 
173 143
         _userInfo = builder.userInfo;
174
-
175
-        _callHandle = builder.callHandle;
176
-        _callUUID = builder.callUUID;
177 144
     }
178 145
 
179 146
     return self;
@@ -198,26 +165,6 @@ static NSString *const WelcomePageEnabledFeatureFlag = @"welcomepage.enabled";
198 165
         props[@"colorScheme"] = self.colorScheme;
199 166
     }
200 167
 
201
-    NSMutableDictionary *config = [[NSMutableDictionary alloc] init];
202
-    if (_audioOnly != nil) {
203
-        config[@"startAudioOnly"] = @(self.audioOnly);
204
-    }
205
-    if (_audioMuted != nil) {
206
-        config[@"startWithAudioMuted"] = @(self.audioMuted);
207
-    }
208
-    if (_videoMuted != nil) {
209
-        config[@"startWithVideoMuted"] = @(self.videoMuted);
210
-    }
211
-    if (_subject != nil) {
212
-        config[@"subject"] = self.subject;
213
-    }
214
-    if (_callHandle != nil) {
215
-        config[@"callHandle"] = self.callHandle;
216
-    }
217
-    if (_callUUID != nil) {
218
-        config[@"callUUID"] = [self.callUUID UUIDString];
219
-    }
220
-
221 168
     NSMutableDictionary *urlProps = [[NSMutableDictionary alloc] init];
222 169
 
223 170
     // The room is fully qualified.
@@ -241,7 +188,7 @@ static NSString *const WelcomePageEnabledFeatureFlag = @"welcomepage.enabled";
241 188
         props[@"userInfo"] = [self.userInfo asDict];
242 189
     }
243 190
 
244
-    urlProps[@"config"] = config;
191
+    urlProps[@"config"] = _config;
245 192
     props[@"url"] = urlProps;
246 193
 
247 194
     return props;

Loading…
İptal
Kaydet