Bläddra i källkod

rn: add SDK API to set user information

At the moment it includes:

- display name
- email
- avatar URL

This information is used *only* if no token was specified.
master
Saúl Ibarra Corretgé 6 år sedan
förälder
incheckning
e33b334307

+ 1
- 0
android/app/src/main/java/org/jitsi/meet/MainActivity.java Visa fil

28
 import org.jitsi.meet.sdk.JitsiMeet;
28
 import org.jitsi.meet.sdk.JitsiMeet;
29
 import org.jitsi.meet.sdk.JitsiMeetActivity;
29
 import org.jitsi.meet.sdk.JitsiMeetActivity;
30
 import org.jitsi.meet.sdk.JitsiMeetConferenceOptions;
30
 import org.jitsi.meet.sdk.JitsiMeetConferenceOptions;
31
+import org.jitsi.meet.sdk.JitsiMeetUserInfo;
31
 
32
 
32
 import java.lang.reflect.Method;
33
 import java.lang.reflect.Method;
33
 import java.net.MalformedURLException;
34
 import java.net.MalformedURLException;

+ 20
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetConferenceOptions.java Visa fil

67
     private Boolean audioOnly;
67
     private Boolean audioOnly;
68
     private Boolean videoMuted;
68
     private Boolean videoMuted;
69
 
69
 
70
+    /**
71
+     * USer information, to be used when no token is specified.
72
+     */
73
+    private JitsiMeetUserInfo userInfo;
74
+
70
     /**
75
     /**
71
      * Class used to build the immutable {@link JitsiMeetConferenceOptions} object.
76
      * Class used to build the immutable {@link JitsiMeetConferenceOptions} object.
72
      */
77
      */
83
         private Boolean audioOnly;
88
         private Boolean audioOnly;
84
         private Boolean videoMuted;
89
         private Boolean videoMuted;
85
 
90
 
91
+        private JitsiMeetUserInfo userInfo;
92
+
86
         public Builder() {
93
         public Builder() {
87
             featureFlags = new Bundle();
94
             featureFlags = new Bundle();
88
         }
95
         }
208
             return this;
215
             return this;
209
         }
216
         }
210
 
217
 
218
+        public Builder setUserInfo(JitsiMeetUserInfo userInfo) {
219
+            this.userInfo = userInfo;
220
+
221
+            return this;
222
+        }
223
+
211
         /**
224
         /**
212
          * Builds the immutable {@link JitsiMeetConferenceOptions} object with the configuration
225
          * Builds the immutable {@link JitsiMeetConferenceOptions} object with the configuration
213
          * that this {@link Builder} instance specified.
226
          * that this {@link Builder} instance specified.
225
             options.audioMuted = this.audioMuted;
238
             options.audioMuted = this.audioMuted;
226
             options.audioOnly = this.audioOnly;
239
             options.audioOnly = this.audioOnly;
227
             options.videoMuted = this.videoMuted;
240
             options.videoMuted = this.videoMuted;
241
+            options.userInfo = this.userInfo;
228
 
242
 
229
             return options;
243
             return options;
230
         }
244
         }
239
         token = in.readString();
253
         token = in.readString();
240
         colorScheme = in.readBundle();
254
         colorScheme = in.readBundle();
241
         featureFlags = in.readBundle();
255
         featureFlags = in.readBundle();
256
+        userInfo = new JitsiMeetUserInfo(in.readBundle());
242
         byte tmpAudioMuted = in.readByte();
257
         byte tmpAudioMuted = in.readByte();
243
         audioMuted = tmpAudioMuted == 0 ? null : tmpAudioMuted == 1;
258
         audioMuted = tmpAudioMuted == 0 ? null : tmpAudioMuted == 1;
244
         byte tmpAudioOnly = in.readByte();
259
         byte tmpAudioOnly = in.readByte();
294
             urlProps.putString("jwt", token);
309
             urlProps.putString("jwt", token);
295
         }
310
         }
296
 
311
 
312
+        if (token == null && userInfo != null) {
313
+            props.putBundle("userInfo", userInfo.asBundle());
314
+        }
315
+
297
         urlProps.putBundle("config", config);
316
         urlProps.putBundle("config", config);
298
         props.putBundle("url", urlProps);
317
         props.putBundle("url", urlProps);
299
 
318
 
322
         dest.writeString(token);
341
         dest.writeString(token);
323
         dest.writeBundle(colorScheme);
342
         dest.writeBundle(colorScheme);
324
         dest.writeBundle(featureFlags);
343
         dest.writeBundle(featureFlags);
344
+        dest.writeBundle(userInfo.asBundle());
325
         dest.writeByte((byte) (audioMuted == null ? 0 : audioMuted ? 1 : 2));
345
         dest.writeByte((byte) (audioMuted == null ? 0 : audioMuted ? 1 : 2));
326
         dest.writeByte((byte) (audioOnly == null ? 0 : audioOnly ? 1 : 2));
346
         dest.writeByte((byte) (audioOnly == null ? 0 : audioOnly ? 1 : 2));
327
         dest.writeByte((byte) (videoMuted == null ? 0 : videoMuted ? 1 : 2));
347
         dest.writeByte((byte) (videoMuted == null ? 0 : videoMuted ? 1 : 2));

+ 107
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetUserInfo.java Visa fil

1
+/*
2
+ * Copyright @ 2019-present 8x8, Inc.
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
+
17
+package org.jitsi.meet.sdk;
18
+
19
+import android.os.Bundle;
20
+
21
+import java.net.MalformedURLException;
22
+import java.net.URL;
23
+
24
+/**
25
+ * This class represents user information to be passed to {@link JitsiMeetConferenceOptions} for
26
+ * identifying a user.
27
+ */
28
+public class JitsiMeetUserInfo {
29
+    /**
30
+     * User's display name.
31
+     */
32
+    private String displayName;
33
+
34
+    /**
35
+     * User's email address.
36
+     */
37
+    private String email;
38
+
39
+    /**
40
+     * User's avatar URL.
41
+     */
42
+    private URL avatar;
43
+
44
+    public JitsiMeetUserInfo() {}
45
+
46
+    public JitsiMeetUserInfo(Bundle b) {
47
+        super();
48
+
49
+        if (b.containsKey("displayName")) {
50
+            displayName = b.getString("displayName");
51
+        }
52
+
53
+        if (b.containsKey("email")) {
54
+            email = b.getString("email");
55
+        }
56
+
57
+        if (b.containsKey("avatarURL")) {
58
+            String avatarURL = b.getString("avatarURL");
59
+            try {
60
+                avatar = new URL(avatarURL);
61
+            } catch (MalformedURLException e) {
62
+            }
63
+        }
64
+    }
65
+
66
+    public String getDisplayName() {
67
+        return displayName;
68
+    }
69
+
70
+    public void setDisplayName(String displayName) {
71
+        this.displayName = displayName;
72
+    }
73
+
74
+    public String getEmail() {
75
+        return email;
76
+    }
77
+
78
+    public void setEmail(String email) {
79
+        this.email = email;
80
+    }
81
+
82
+    public URL getAvatar() {
83
+        return avatar;
84
+    }
85
+
86
+    public void setAvatar(URL avatar) {
87
+        this.avatar = avatar;
88
+    }
89
+
90
+    Bundle asBundle() {
91
+        Bundle b = new Bundle();
92
+
93
+        if (displayName != null) {
94
+            b.putString("displayName", displayName);
95
+        }
96
+
97
+        if (email != null) {
98
+            b.putString("email", email);
99
+        }
100
+
101
+        if (avatar != null) {
102
+            b.putString("avatarURL", avatar.toString());
103
+        }
104
+
105
+        return b;
106
+    }
107
+}

+ 10
- 0
ios/sdk/sdk.xcodeproj/project.pbxproj Visa fil

42
 		C69EFA0E209A0F660027712B /* JMCallKitListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = C69EFA0B209A0F660027712B /* JMCallKitListener.swift */; };
42
 		C69EFA0E209A0F660027712B /* JMCallKitListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = C69EFA0B209A0F660027712B /* JMCallKitListener.swift */; };
43
 		C6A34261204EF76800E062DD /* DragGestureController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A3425E204EF76800E062DD /* DragGestureController.swift */; };
43
 		C6A34261204EF76800E062DD /* DragGestureController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A3425E204EF76800E062DD /* DragGestureController.swift */; };
44
 		C6CC49AF207412CF000DFA42 /* PiPViewCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6CC49AE207412CF000DFA42 /* PiPViewCoordinator.swift */; };
44
 		C6CC49AF207412CF000DFA42 /* PiPViewCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6CC49AE207412CF000DFA42 /* PiPViewCoordinator.swift */; };
45
+		DE762DB422AFDE76000DEBD6 /* JitsiMeetUserInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = DE762DB322AFDE76000DEBD6 /* JitsiMeetUserInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
46
+		DE762DB622AFDE8D000DEBD6 /* JitsiMeetUserInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = DE762DB522AFDE8D000DEBD6 /* JitsiMeetUserInfo.m */; };
45
 		DEAD3226220C497000E93636 /* JitsiMeetConferenceOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = DEAD3224220C497000E93636 /* JitsiMeetConferenceOptions.h */; settings = {ATTRIBUTES = (Public, ); }; };
47
 		DEAD3226220C497000E93636 /* JitsiMeetConferenceOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = DEAD3224220C497000E93636 /* JitsiMeetConferenceOptions.h */; settings = {ATTRIBUTES = (Public, ); }; };
46
 		DEAD3227220C497000E93636 /* JitsiMeetConferenceOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = DEAD3225220C497000E93636 /* JitsiMeetConferenceOptions.m */; };
48
 		DEAD3227220C497000E93636 /* JitsiMeetConferenceOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = DEAD3225220C497000E93636 /* JitsiMeetConferenceOptions.m */; };
47
 		DEAFA779229EAD520033A7FA /* RNRootView.m in Sources */ = {isa = PBXBuildFile; fileRef = DEAFA778229EAD520033A7FA /* RNRootView.m */; };
49
 		DEAFA779229EAD520033A7FA /* RNRootView.m in Sources */ = {isa = PBXBuildFile; fileRef = DEAFA778229EAD520033A7FA /* RNRootView.m */; };
94
 		C6A3425E204EF76800E062DD /* DragGestureController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DragGestureController.swift; sourceTree = "<group>"; };
96
 		C6A3425E204EF76800E062DD /* DragGestureController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DragGestureController.swift; sourceTree = "<group>"; };
95
 		C6CC49AE207412CF000DFA42 /* PiPViewCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PiPViewCoordinator.swift; sourceTree = "<group>"; };
97
 		C6CC49AE207412CF000DFA42 /* PiPViewCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PiPViewCoordinator.swift; sourceTree = "<group>"; };
96
 		C6F99C13204DB63D0001F710 /* JitsiMeetView+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JitsiMeetView+Private.h"; sourceTree = "<group>"; };
98
 		C6F99C13204DB63D0001F710 /* JitsiMeetView+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JitsiMeetView+Private.h"; sourceTree = "<group>"; };
99
+		DE762DB322AFDE76000DEBD6 /* JitsiMeetUserInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JitsiMeetUserInfo.h; sourceTree = "<group>"; };
100
+		DE762DB522AFDE8D000DEBD6 /* JitsiMeetUserInfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JitsiMeetUserInfo.m; sourceTree = "<group>"; };
101
+		DE762DB722AFE166000DEBD6 /* JitsiMeetUserInfo+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JitsiMeetUserInfo+Private.h"; sourceTree = "<group>"; };
97
 		DEAD3224220C497000E93636 /* JitsiMeetConferenceOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JitsiMeetConferenceOptions.h; sourceTree = "<group>"; };
102
 		DEAD3224220C497000E93636 /* JitsiMeetConferenceOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JitsiMeetConferenceOptions.h; sourceTree = "<group>"; };
98
 		DEAD3225220C497000E93636 /* JitsiMeetConferenceOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JitsiMeetConferenceOptions.m; sourceTree = "<group>"; };
103
 		DEAD3225220C497000E93636 /* JitsiMeetConferenceOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JitsiMeetConferenceOptions.m; sourceTree = "<group>"; };
99
 		DEAD3228220C734300E93636 /* JitsiMeetConferenceOptions+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JitsiMeetConferenceOptions+Private.h"; sourceTree = "<group>"; };
104
 		DEAD3228220C734300E93636 /* JitsiMeetConferenceOptions+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JitsiMeetConferenceOptions+Private.h"; sourceTree = "<group>"; };
174
 				DEAD3224220C497000E93636 /* JitsiMeetConferenceOptions.h */,
179
 				DEAD3224220C497000E93636 /* JitsiMeetConferenceOptions.h */,
175
 				DEAD3228220C734300E93636 /* JitsiMeetConferenceOptions+Private.h */,
180
 				DEAD3228220C734300E93636 /* JitsiMeetConferenceOptions+Private.h */,
176
 				DEAD3225220C497000E93636 /* JitsiMeetConferenceOptions.m */,
181
 				DEAD3225220C497000E93636 /* JitsiMeetConferenceOptions.m */,
182
+				DE762DB322AFDE76000DEBD6 /* JitsiMeetUserInfo.h */,
183
+				DE762DB722AFE166000DEBD6 /* JitsiMeetUserInfo+Private.h */,
184
+				DE762DB522AFDE8D000DEBD6 /* JitsiMeetUserInfo.m */,
177
 				0B412F161EDEC65D00B1A0A6 /* JitsiMeetView.h */,
185
 				0B412F161EDEC65D00B1A0A6 /* JitsiMeetView.h */,
178
 				0B412F171EDEC65D00B1A0A6 /* JitsiMeetView.m */,
186
 				0B412F171EDEC65D00B1A0A6 /* JitsiMeetView.m */,
179
 				DEAFA777229EAD3B0033A7FA /* RNRootView.h */,
187
 				DEAFA777229EAD3B0033A7FA /* RNRootView.h */,
259
 			isa = PBXHeadersBuildPhase;
267
 			isa = PBXHeadersBuildPhase;
260
 			buildActionMask = 2147483647;
268
 			buildActionMask = 2147483647;
261
 			files = (
269
 			files = (
270
+				DE762DB422AFDE76000DEBD6 /* JitsiMeetUserInfo.h in Headers */,
262
 				0B412F181EDEC65D00B1A0A6 /* JitsiMeetView.h in Headers */,
271
 				0B412F181EDEC65D00B1A0A6 /* JitsiMeetView.h in Headers */,
263
 				0B93EF7E1EC9DDCD0030D24D /* RCTBridgeWrapper.h in Headers */,
272
 				0B93EF7E1EC9DDCD0030D24D /* RCTBridgeWrapper.h in Headers */,
264
 				0B412F221EDEF6EA00B1A0A6 /* JitsiMeetViewDelegate.h in Headers */,
273
 				0B412F221EDEF6EA00B1A0A6 /* JitsiMeetViewDelegate.h in Headers */,
484
 				0BB9AD7B1F5EC8F4001C08DB /* CallKit.m in Sources */,
493
 				0BB9AD7B1F5EC8F4001C08DB /* CallKit.m in Sources */,
485
 				0BB9AD7D1F60356D001C08DB /* AppInfo.m in Sources */,
494
 				0BB9AD7D1F60356D001C08DB /* AppInfo.m in Sources */,
486
 				DEAFA779229EAD520033A7FA /* RNRootView.m in Sources */,
495
 				DEAFA779229EAD520033A7FA /* RNRootView.m in Sources */,
496
+				DE762DB622AFDE8D000DEBD6 /* JitsiMeetUserInfo.m in Sources */,
487
 				DEAD3227220C497000E93636 /* JitsiMeetConferenceOptions.m in Sources */,
497
 				DEAD3227220C497000E93636 /* JitsiMeetConferenceOptions.m in Sources */,
488
 				0B93EF7F1EC9DDCD0030D24D /* RCTBridgeWrapper.m in Sources */,
498
 				0B93EF7F1EC9DDCD0030D24D /* RCTBridgeWrapper.m in Sources */,
489
 				0BA13D311EE83FF8007BEF7F /* ExternalAPI.m in Sources */,
499
 				0BA13D311EE83FF8007BEF7F /* ExternalAPI.m in Sources */,

+ 10
- 0
ios/sdk/src/JitsiMeetConferenceOptions.h Visa fil

16
 
16
 
17
 #import <Foundation/Foundation.h>
17
 #import <Foundation/Foundation.h>
18
 
18
 
19
+#import "JitsiMeetUserInfo.h"
20
+
21
+
19
 @interface JitsiMeetConferenceOptionsBuilder : NSObject
22
 @interface JitsiMeetConferenceOptionsBuilder : NSObject
20
 
23
 
21
 /**
24
 /**
60
  */
63
  */
61
 @property (nonatomic) BOOL welcomePageEnabled;
64
 @property (nonatomic) BOOL welcomePageEnabled;
62
 
65
 
66
+/**
67
+ * Information about the local user. It will be used in absence of a token.
68
+ */
69
+@property (nonatomic, nullable) JitsiMeetUserInfo *userInfo;
70
+
63
 - (void)setFeatureFlag:(NSString *_Nonnull)flag withBoolean:(BOOL)value;
71
 - (void)setFeatureFlag:(NSString *_Nonnull)flag withBoolean:(BOOL)value;
64
 - (void)setFeatureFlag:(NSString *_Nonnull)flag withValue:(id _Nonnull)value;
72
 - (void)setFeatureFlag:(NSString *_Nonnull)flag withValue:(id _Nonnull)value;
65
 
73
 
82
 
90
 
83
 @property (nonatomic, readonly) BOOL welcomePageEnabled;
91
 @property (nonatomic, readonly) BOOL welcomePageEnabled;
84
 
92
 
93
+@property (nonatomic, nullable) JitsiMeetUserInfo *userInfo;
94
+
85
 + (instancetype _Nonnull)fromBuilder:(void (^_Nonnull)(JitsiMeetConferenceOptionsBuilder *_Nonnull))initBlock;
95
 + (instancetype _Nonnull)fromBuilder:(void (^_Nonnull)(JitsiMeetConferenceOptionsBuilder *_Nonnull))initBlock;
86
 - (instancetype _Nonnull)init NS_UNAVAILABLE;
96
 - (instancetype _Nonnull)init NS_UNAVAILABLE;
87
 
97
 

+ 9
- 0
ios/sdk/src/JitsiMeetConferenceOptions.m Visa fil

17
 #import <React/RCTUtils.h>
17
 #import <React/RCTUtils.h>
18
 
18
 
19
 #import "JitsiMeetConferenceOptions+Private.h"
19
 #import "JitsiMeetConferenceOptions+Private.h"
20
+#import "JitsiMeetUserInfo+Private.h"
20
 
21
 
21
 /**
22
 /**
22
  * Backwards compatibility: turn the boolean property into a feature flag.
23
  * Backwards compatibility: turn the boolean property into a feature flag.
49
         _audioOnly = nil;
50
         _audioOnly = nil;
50
         _audioMuted = nil;
51
         _audioMuted = nil;
51
         _videoMuted = nil;
52
         _videoMuted = nil;
53
+
54
+        _userInfo = nil;
52
     }
55
     }
53
     
56
     
54
     return self;
57
     return self;
163
         _videoMuted = [builder getVideoMuted];
166
         _videoMuted = [builder getVideoMuted];
164
 
167
 
165
         _featureFlags = [NSDictionary dictionaryWithDictionary:builder.featureFlags];
168
         _featureFlags = [NSDictionary dictionaryWithDictionary:builder.featureFlags];
169
+
170
+        _userInfo = builder.userInfo;
166
     }
171
     }
167
 
172
 
168
     return self;
173
     return self;
220
         urlProps[@"jwt"] = _token;
225
         urlProps[@"jwt"] = _token;
221
     }
226
     }
222
 
227
 
228
+    if (_token == nil && _userInfo != nil) {
229
+        props[@"userInfo"] = [self.userInfo asDict];
230
+    }
231
+
223
     urlProps[@"config"] = config;
232
     urlProps[@"config"] = config;
224
     props[@"url"] = urlProps;
233
     props[@"url"] = urlProps;
225
 
234
 

+ 23
- 0
ios/sdk/src/JitsiMeetUserInfo+Private.h Visa fil

1
+/*
2
+ * Copyright @ 2019-present 8x8, Inc.
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
+
17
+#import "JitsiMeetUserInfo.h"
18
+
19
+@interface JitsiMeetUserInfo ()
20
+
21
+- (NSMutableDictionary *)asDict;
22
+
23
+@end

+ 38
- 0
ios/sdk/src/JitsiMeetUserInfo.h Visa fil

1
+/*
2
+ * Copyright @ 2019-present 8x8, Inc.
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
+
17
+#import <Foundation/Foundation.h>
18
+
19
+@interface JitsiMeetUserInfo : NSObject
20
+
21
+/**
22
+ * User display name.
23
+ */
24
+@property (nonatomic, copy, nullable) NSString *displayName;
25
+/**
26
+ * User e-mail.
27
+ */
28
+@property (nonatomic, copy, nullable) NSString *email;
29
+/**
30
+ * URL for the user avatar.
31
+ */
32
+@property (nonatomic, copy, nullable) NSURL *avatar;
33
+
34
+- (instancetype _Nullable)initWithDisplayName:(NSString *_Nullable)displayName
35
+                                     andEmail:(NSString *_Nullable)email
36
+                                    andAvatar:(NSURL *_Nullable) avatar;
37
+
38
+@end

+ 55
- 0
ios/sdk/src/JitsiMeetUserInfo.m Visa fil

1
+/*
2
+ * Copyright @ 2019-present 8x8, Inc.
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
+
17
+#import "JitsiMeetUserInfo+Private.h"
18
+
19
+@implementation JitsiMeetUserInfo
20
+
21
+- (instancetype)initWithDisplayName:(NSString *)displayName
22
+                           andEmail:(NSString *)email
23
+                          andAvatar:(NSURL *_Nullable) avatar {
24
+    self = [super init];
25
+    if (self) {
26
+        self.displayName = displayName;
27
+        self.email = email;
28
+        self.avatar = avatar;
29
+    }
30
+
31
+    return self;
32
+}
33
+
34
+- (NSDictionary *)asDict {
35
+    NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
36
+
37
+    if (self.displayName != nil) {
38
+        dict[@"displayName"] = self.displayName;
39
+    }
40
+
41
+    if (self.email != nil) {
42
+        dict[@"email"] = self.email;
43
+    }
44
+
45
+    if (self.avatar != nil) {
46
+        NSString *avatarURL = [self.avatar absoluteString];
47
+        if (avatarURL != nil) {
48
+            dict[@"avatarURL"] = avatarURL;
49
+        }
50
+    }
51
+
52
+    return dict;
53
+}
54
+
55
+@end

+ 12
- 6
react/features/app/components/App.native.js Visa fil

13
     AspectRatioDetector,
13
     AspectRatioDetector,
14
     ReducedUIDetector
14
     ReducedUIDetector
15
 } from '../../base/responsive-ui';
15
 } from '../../base/responsive-ui';
16
+import { updateSettings } from '../../base/settings';
16
 import '../../google-api';
17
 import '../../google-api';
17
 import '../../mobile/audio-mode';
18
 import '../../mobile/audio-mode';
18
 import '../../mobile/background';
19
 import '../../mobile/background';
50
     /**
51
     /**
51
      * An object with the feature flags.
52
      * An object with the feature flags.
52
      */
53
      */
53
-    flags: Object
54
+    flags: Object,
55
+
56
+    /**
57
+     * An object with user information (display name, email, avatar URL).
58
+     */
59
+    userInfo: ?Object
54
 };
60
 };
55
 
61
 
56
 /**
62
 /**
88
         super.componentDidMount();
94
         super.componentDidMount();
89
 
95
 
90
         this._init.then(() => {
96
         this._init.then(() => {
91
-            // We set the color scheme early enough so then we avoid any
92
-            // unnecessary re-renders.
93
-            this.state.store.dispatch(setColorScheme(this.props.colorScheme));
97
+            // We set these early enough so then we avoid any unnecessary re-renders.
98
+            const { dispatch } = this.state.store;
94
 
99
 
95
-            // Ditto for feature flags.
96
-            this.state.store.dispatch(updateFlags(this.props.flags));
100
+            dispatch(setColorScheme(this.props.colorScheme));
101
+            dispatch(updateFlags(this.props.flags));
102
+            dispatch(updateSettings(this.props.userInfo || {}));
97
         });
103
         });
98
     }
104
     }
99
 
105
 

Laddar…
Avbryt
Spara