-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deeplink #70
base: main
Are you sure you want to change the base?
Conversation
Meherdeep
commented
Mar 10, 2022
- Adds support for Universal Link: iOS and Android
- Share meeting invite
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a new feature with multiple extra steps that we need to include, we should update documentation so people can follow how to implement deeplinking
example/lib/main.dart
Outdated
@@ -20,6 +20,7 @@ class _MyAppState extends State<MyApp> { | |||
Permission.camera, | |||
Permission.microphone, | |||
], | |||
deepLinkBaseUrl: "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this a default feature or a more advanced feature that won't always be used?
If advanced, maybe we shouldn't include it in the example app to keep it simple, and just document it well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's more like an advanced feature. And I agree with your point, I will make the change to the example code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of small changes, please do a search through the repo to find any similar patterns as in my comments
showAVState: widget.showAVState, | ||
showNumberOfUsers: widget.showNumberOfUsers, | ||
videoRenderMode: widget.videoRenderMode, | ||
child: layoutType == "floating" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an easy way to make this not compare to a string in this way? instead an enum with a raw value (that may just be a swift behaviour, not available in Dart)
if (key == 'channelName') { | ||
channelName = value[0]; | ||
print('Channe Name: $channelName'); | ||
} else if (key == 'tempToken') { | ||
tempToken = value[0]; | ||
print('Temp Token: $tempToken'); | ||
} else if (key == 'tokenUrl') { | ||
tokenUrl = value[0]; | ||
print('Token Url: $tokenUrl'); | ||
} else if (key == "layoutTpype") { | ||
layoutType = value[0]; | ||
print("layoutType: $layoutType"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A switch statement would be better here, + a case to catch and print an unknown key
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if adding a default case to the switch case, you can remove the first two prints (lines 192 + 193)
'$baseUrl/.well-known/assetlinks.json', | ||
), | ||
); | ||
if (response.statusCode == 200) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compare to HttpStatus.ok
instead
builder: (context, streamSnapshot) { | ||
final link = streamSnapshot.data ?? ''; | ||
updateAgoraConnectionDataConfig(link); | ||
if (link != '') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!link.isEmpty) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Link here is of object type, for which isEmpty is not valid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. The method updateAgoraConnectionDataConfig
accepts nil as an input, but it will do nothing if it receives nil or '', and after the if statement it doesn't use the parameter anyway.
Seems like updateAgoraConnectionDataConfig should change to only allow a non-optional Object
, remove the if statement inside that method and update this one to be:
if (streamSnapshot.data != null) {
updateAgoraConnectionDataConfig(streamSnapshot.data);
return userLayout(layoutType, baseUrl);
}
String tempTokenString = widget.client.sessionController.value | ||
.connectionData!.tempToken == | ||
null | ||
? '' | ||
: '&tempToken=${widget.client.sessionController.value.connectionData!.tempToken}'; | ||
String tokenUrlString = widget.client.sessionController.value | ||
.connectionData!.tokenUrl == | ||
null | ||
? '' | ||
: '&tokenUrl=${widget.client.sessionController.value.connectionData!.tokenUrl}'; | ||
Share.share( | ||
'Please join my channel: "${widget.client.sessionController.value.connectionData!.channelName}" using this link: ${widget.client.deepLinkBaseUrl}/channelName=${widget.client.sessionController.value.connectionData!.channelName}' + | ||
tempTokenString + | ||
tokenUrlString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part seems to be so complex that it asks for a function. It would make the intention of the method clearer if we could extract this logic somewhere else, such that the widget does simply:
final message = _messageToShare();
Share.share(message);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, for the implementation of _messageToShare
I propose this:
String tempTokenString =
widget.client.sessionController.value.connectionData!.tempToken ?? '';
if (tempTokenString.isEmpty) {
tempTokenString = '&tempToken=$tempTokenString';
}
String tokenUrlString =
widget.client.sessionController.value.connectionData!.tokenUrl ?? '';
if (tokenUrlString.isEmpty) {
tokenUrlString = '&tokenUrl=$tokenUrlString';
}
final channelName =
widget.client.sessionController.value.connectionData!.channelName;
final message =
'Please join my channel: "$channelName" using this link: ${widget.client.deepLinkBaseUrl}/channelName=$channelName' +
tempTokenString +
tokenUrlString;
Share.share(message);
.connectionData!.tokenUrl == | ||
null | ||
? '' | ||
: '&tokenUrl=${widget.client.sessionController.value.connectionData!.tokenUrl}'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the whole tokenUrl need to be passed within the share URL like this?