Handle existing apps for deep links#2683
Conversation
|
The current functionality seems more useful to me since the user might want to replace their existing config with the new one (I know I've done this before). But I can see how that would be confusing if it wasn't their intention. Maybe we should have a confirmation box to let the user either overwrite their current config or not. |
Ok fair enough, I hadn't considered that work flow! How about we still navigate to "add" by default, but if the same app URL is already installed, we show a snackbar that tells the user and lets them navigate to the app page. If you think that approach would work I can try it out. |
|
Oh hold on, this is about |
Here's what this approach would look like, if you want to consider this instead. main...micahmo:feature/improve-deep-links-2 qemu-system-x86_64_lSD0PpypbG.mp4 |
| AppsProvider appsProvider = context.read<AppsProvider>(); | ||
|
|
||
| AppInMemory? match; | ||
| for (AppInMemory a in appsProvider.apps.values) { |
There was a problem hiding this comment.
This would be more performant if we could reference the app ID instead of URL, then we could do so directly and not have to loop. Which is doable since we already search through these apps in home.dart:202.
| .getSource(data) | ||
| .standardizeUrl(data); | ||
|
|
||
| bool alreadyInstalled = appsProvider.apps.values.any( |
There was a problem hiding this comment.
Instead of bool alreadyInstalled, let's save the appId of the found app (if any) so that we can use it (instead of URL) to open the app page and avoid searching AppsProvider.apps twice.
|
@micahmo just need a couple of minor changes before I merge this. |
|
Hey @ImranR98, thanks for the review! I believe I addressed your comments in the way you were asking. Let me know! |
|
Thanks, works well! Merged. |
This PR enhances the
obtainium://add...deep linking functionality. I found that if I followed a link for an app that I already had installed, it still prompted me to add it again. This PR improves that functionality so that, if the app that the user is trying to "add" is already installed, we navigate to the existing app page instead of the add app page.Before
qemu-system-x86_64_rMOD8QS6Vv.mp4
After
qemu-system-x86_64_SkvLsRPh7y.mp4