Skip to content
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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Deeplink #70

wants to merge 4 commits into from

Conversation

Meherdeep
Copy link
Contributor

  • Adds support for Universal Link: iOS and Android
  • Share meeting invite

Copy link
Contributor

@tadaspetra tadaspetra left a 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

@@ -20,6 +20,7 @@ class _MyAppState extends State<MyApp> {
Permission.camera,
Permission.microphone,
],
deepLinkBaseUrl: "",
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

@maxxfrazer maxxfrazer left a 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

lib/src/layout/layout.dart Show resolved Hide resolved
showAVState: widget.showAVState,
showNumberOfUsers: widget.showNumberOfUsers,
videoRenderMode: widget.videoRenderMode,
child: layoutType == "floating"
Copy link
Contributor

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)

Comment on lines +194 to +206
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");
}
Copy link
Contributor

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

Copy link
Contributor

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) {
Copy link
Contributor

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 != '') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!link.isEmpty) {

Copy link
Contributor Author

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

Copy link
Contributor

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);
}

Comment on lines +147 to +160
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);
Copy link
Contributor

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);

Copy link
Contributor

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}';
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants