Skip to content

Commit

Permalink
chore: attempt to add auto link
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanYuuki committed Feb 5, 2025
1 parent e84855e commit afc897f
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 5 deletions.
10 changes: 9 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,19 @@
<!-- Add LEANBACK_LAUNCHER for TV -->
<category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
</intent-filter>

<intent-filter android:label="Add Repo">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="anymex" android:host="add-repo" />
</intent-filter>

</activity>

<activity android:name="com.linusu.flutter_web_auth_2.CallbackActivity"
android:exported="true">
<intent-filter android:label="AnymeX">
<intent-filter android:label="Login">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
Expand Down
21 changes: 21 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import 'package:intl/date_symbol_data_local.dart';
import 'package:isar/isar.dart';
import 'package:media_kit/media_kit.dart';
import 'package:provider/provider.dart';
import 'package:uni_links/uni_links.dart';
import 'package:window_manager/window_manager.dart';
import 'package:path_provider/path_provider.dart';
import 'package:path/path.dart' as p;
Expand All @@ -71,6 +72,26 @@ class MyCustomScrollBehavior extends MaterialScrollBehavior {
};
}

void initDeepLinkListener() {
uriLinkStream.listen((Uri? uri) {
if (uri != null && uri.scheme == "anymex" && uri.host == "add-repo") {
String? repoUrl = uri.queryParameters["url"];
String? mangaUrl = uri.queryParameters["manga_url"];

if (repoUrl != null && mangaUrl != null) {
final settings = Get.find<SourceController>();
settings.activeAnimeRepo = repoUrl;
settings.activeMangaRepo = mangaUrl;
print("Received Repo URL: $repoUrl");
print("Received Manga URL: $mangaUrl");
snackBar("Added Repo Links Successfully!");
}
}
}, onError: (err) {
snackBar('Error Opening link: $err');
});
}

void main() async {
WidgetsFlutterBinding.ensureInitialized();
HttpOverrides.global = MyHttpoverrides();
Expand Down
10 changes: 8 additions & 2 deletions lib/screens/anime/details_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,15 @@ class _AnimeDetailsPageState extends State<AnimeDetailsPage> {
}),
const Spacer(),
IconButton(
onPressed: () {}, icon: const Icon(Iconsax.heart)),
onPressed: () {
snackBar("dont know what to do with it WIP");
},
icon: const Icon(Iconsax.heart)),
IconButton(
onPressed: () {}, icon: const Icon(Icons.share)),
onPressed: () {
snackBar("dont know what to do with it WIP");
},
icon: const Icon(Icons.share)),
],
),
],
Expand Down
28 changes: 26 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1591,6 +1591,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
uni_links:
dependency: "direct main"
description:
name: uni_links
sha256: "051098acfc9e26a9fde03b487bef5d3d228ca8f67693480c6f33fd4fbb8e2b6e"
url: "https://pub.dev"
source: hosted
version: "0.5.1"
uni_links_platform_interface:
dependency: transitive
description:
name: uni_links_platform_interface
sha256: "929cf1a71b59e3b7c2d8a2605a9cf7e0b125b13bc858e55083d88c62722d4507"
url: "https://pub.dev"
source: hosted
version: "1.0.0"
uni_links_web:
dependency: transitive
description:
name: uni_links_web
sha256: "7539db908e25f67de2438e33cc1020b30ab94e66720b5677ba6763b25f6394df"
url: "https://pub.dev"
source: hosted
version: "0.1.0"
universal_platform:
dependency: transitive
description:
Expand Down Expand Up @@ -1691,10 +1715,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc
url: "https://pub.dev"
source: hosted
version: "14.2.5"
version: "14.2.4"
volume_controller:
dependency: "direct main"
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ dependencies:
kenburns_nullsafety: ^1.0.1
flutter_markdown: ^0.7.6
device_info_plus: ^11.2.2
uni_links: ^0.5.1

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit afc897f

Please sign in to comment.