sami79031 / LoopholeFunctionsTesting

0 stars 1 forks source link

Deep linking for movie sharing #10

Open katiahristova opened 12 months ago

katiahristova commented 12 months ago

In the movie detail screen there is a share button -- top right over the image, see screenshot below. Currently this share just send a link that opens the GuaranTV app. They would like this to be sending a link that opens the particular movie detail screen on the app. They're asking what they need to on the backend and also how much work on the front end this would be to handle the URL and open the movie details screen.

Image

sami79031 commented 12 months ago

@katiahristova

I need to see if they have worked on that with the navigation. If it hasn't been developed in mind that there would be deep links, then this task could be pretty lengthy as the whole navigation has to be worked on. I will look into the code and do some testings and come back to that. Could we ask for 30min work for the resarch?

sami79031 commented 12 months ago

I've looked into it and there is no mechanism placed to integrate an easy way for the navigation. We can work on only the Movie sharing part and I can build a Navigation for that. I don't think we need anything from the Backend for that. I'd create a custom path passing along the movie ID. That could be about 10-12 hours of work

sami79031 commented 12 months ago

EDIT:

I just looked closely and I see that they are passing downloaded movie object. So, we would need an API that will be used to download the Movie object by passing the ID from our side. This increases the complexity with another 3-4h at least

katiahristova commented 12 months ago

@sami79031 Thanks! I'll let them know and of course we'll note down 30 min for this. So then this is a total of 13 - 16 hours of work?

sami79031 commented 12 months ago

Yes

katiahristova commented 11 months ago

@sami79031 They want this item. They claim that there's currently a push notification, which comes when someone you follow guarantees a movie. When you click on this notification it navigates to the movie detail page for the movie. It works exactly with movie ID. So you should be able to reuse the method which takes a movie id and opens the movie detail screen.

I'm wondering, can any of the navigation be reused as well? Or is navigating from a push notification completely different than navigating from a link?

Anyway, you can go ahead with the deep linking, hours are approved.

sami79031 commented 11 months ago

The deep link works a bit differently. The user will receive a URL which will open the app. There is a different setup for that. I did not see any navigation after opening through a push notification but will look again. I might be able to use it if there is one.

sami79031 commented 11 months ago

@katiahristova I looked through the code and could not see anything that navigates to the Movie from a notification. In fact, the notifications could be not working as I see the code is commented out in the main.dart file ( void registerNotification() async). Moreover, the Movie screen is able to be initialized only by having the movie object.

Movie( movieId: item["id"], movieObj: item, ));

The question to ask Tom: Is there an API that can fetch the Movie object by passing the movie's ID to the API so that after downloading we can navigate to the Movie screen?

Ask them to test the notifications as I don't see any code that suggests they work. It is not our concert at this point, so it's up to you to let them know.

sami79031 commented 11 months ago

EDIT:

I do see on one more place code about notifications. Not sure how well it is working as it looks a bit messy. You can find the code in the 'layout.dart' file. I see that they are navigating to the Movie screen but they receive all the Movie object from the notification as a Dictionary.

This is how the Movie object gets initialized and redirected to the screen.

Image

We can't send the Movie's dictionary through a link. It will look ugly. All we can send is the movie's ID which can be used to fetch the movie. So, Tom needs to create an API that will accept the movie ID and return the movie to us.

katiahristova commented 11 months ago

@sami79031 thanks! I wrote to them on the Trello board. I'll let you know if they reply.

katiahristova commented 11 months ago

@sami79031 Tom says the registration code for push notifications is located in layout.dart. He thinks that's it:

/// Gets permission to /// send notifications _getPermission() async { FirebaseMessaging messaging = FirebaseMessaging.instance;

/// Check permission status
NotificationSettings settings = await messaging.getNotificationSettings();

/// If not authorized
/// Ask for permission
if (settings.authorizationStatus != AuthorizationStatus.authorized) {
  settings = await messaging.requestPermission(
    alert: true,
    announcement: false,
    badge: true,
    carPlay: false,
    criticalAlert: false,
    provisional: false,
    sound: true,
  );

  if (settings.authorizationStatus == AuthorizationStatus.authorized) {
    _getToken();
    print('User granted permission');
  } else if (settings.authorizationStatus ==
      AuthorizationStatus.provisional) {
    print('User granted provisional permission');
  } else {
    print('User declined or has not accepted permission');
  }
}

}

/// Get token _getToken() async { String? token = await FirebaseMessaging.instance.getToken(); //print("Token = $token");

/// You can use this token to send
/// personalized push notifications for a particular device

}

sami79031 commented 11 months ago

@katiahristova I said the same thing just a comment above:

"I do see on one more place code about notifications. Not sure how well it is working as it looks a bit messy. You can find the code in the 'layout.dart' file. I see that they are navigating to the Movie screen but they receive all the Movie object from the notification as a Dictionary."

But this doesn't change the fact that we need to fetch the movie by its ID. So, he needs to give us an API for that.

katiahristova commented 11 months ago

@sami79031 Yes, but I didn't realize that this little code that's in layout.dart is sufficient to register for push notifications. The commented out code is a lot more. They're definitely having issues with push notifications and want help with that. I posted a separate item about this.

I clarified the movie API issue to them. Tom said he'll get back to us.

katiahristova commented 11 months ago

@sami79031 API to use to get movie details: "/staging/search/detail?id=203857&type=tv" Requires ID and whether it’s movie or TV, so you'll need to include these two pieces of info in the URL.

sami79031 commented 10 months ago

@katiahristova so this API actually fetches the movie's details, not the movie itself. I need an API that will fetch the movie itself. I've looked through the project and could not find such API. They fetch a collection of movies that gives them the basic info about the movie and when they navigate to the details screen, they fetch the rest of the movie info and they use the API above.

katiahristova commented 10 months ago

@sami79031 Tom says he finished the API. I attach a screenshot of what he wrote.

Image

sami79031 commented 10 months ago

@katiahristova please test it on both android and ios

katiahristova commented 10 months ago

@sami79031 Tom uploaded the file to their hosting. Here is the link: https://guarantv.com/gtv-deeplink.html?type=tv&movieId=9552