Skip to content

Commit

Permalink
Added support for direct opening of YTM links #242
Browse files Browse the repository at this point in the history
  • Loading branch information
anandnet committed Jul 9, 2024
1 parent 3419842 commit 37f9dcc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 17 deletions.
29 changes: 14 additions & 15 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,32 @@
</intent-filter>

<!-- App Link plugin intent-filter -->
<intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />

<!-- <category android:name="android.intent.category.BROWSABLE" /> -->
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />

<data android:scheme="http" />
<data android:scheme="https" />

<data android:scheme="https" android:host="music.youtube.com" />
<data android:scheme="https" android:host="m.youtube.com"/>
<data android:scheme="https" android:host="www.youtube.com"/>
<data android:scheme="https" android:host="youtu.be" />
<data android:scheme="https" android:host="youtube.com"/>
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.SEND" />

<category android:name="android.intent.category.DEFAULT" />

<data android:mimeType="text/plain" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.VIEW" />

<!-- <category android:name="android.intent.category.BROWSABLE" /> -->
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />

<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="*"/>
<data android:scheme="https" android:host="music.youtube.com" />
<data android:scheme="https" android:host="m.youtube.com"/>
<data android:scheme="https" android:host="www.youtube.com"/>
<data android:scheme="https" android:host="youtu.be" />
<data android:scheme="https" android:host="youtube.com"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
Expand Down
11 changes: 9 additions & 2 deletions lib/utils/app_link_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:app_links/app_links.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '/ui/widgets/songinfo_bottom_sheet.dart';
import '/utils/helper.dart';
import '../ui/widgets/loader.dart';
import '/services/music_service.dart';
Expand Down Expand Up @@ -42,11 +43,17 @@ class AppLinksController extends GetxController {
playerController.playerPanelController.close();
}

if(Get.isRegistered<SongInfoController>()){
Navigator.of(Get.context!).pop();
}

if (uri.host == "youtube.com" ||
uri.host == "music.youtube.com" ||
uri.host == "youtu.be" ||
uri.host == "www.youtube.com") {
printINFO("pathsegmet: ${uri.pathSegments} params:${uri.queryParameters}");
uri.host == "www.youtube.com" ||
uri.host == "m.youtube.com") {
printINFO(
"pathsegmet: ${uri.pathSegments} params:${uri.queryParameters}");
if (uri.pathSegments[0] == "playlist" &&
uri.queryParameters.containsKey("list")) {
final browseId = uri.queryParameters['list'];
Expand Down

0 comments on commit 37f9dcc

Please sign in to comment.