mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-03 17:40:43 +00:00
Add the ability to launch app from Crypto QR codes
This commit is contained in:
parent
71f768e6b0
commit
01adf863d0
2 changed files with 46 additions and 0 deletions
|
@ -38,6 +38,15 @@
|
||||||
android:scheme="cakewallet"
|
android:scheme="cakewallet"
|
||||||
android:host="y.at" />
|
android:host="y.at" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<!-- bitcoin qr code scheme -->
|
||||||
|
<intent-filter android:autoVerify="true">
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="bitcoin" />
|
||||||
|
<data android:scheme="monero" />
|
||||||
|
<data android:scheme="litecoin" />
|
||||||
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="flutterEmbedding"
|
android:name="flutterEmbedding"
|
||||||
|
|
|
@ -202,6 +202,8 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
|
||||||
super.initState();
|
super.initState();
|
||||||
//_handleIncomingLinks();
|
//_handleIncomingLinks();
|
||||||
//_handleInitialUri();
|
//_handleInitialUri();
|
||||||
|
|
||||||
|
initUniLinks();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -210,6 +212,41 @@ class AppState extends State<App> with SingleTickerProviderStateMixin {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// handle app links while the app is already started - be it in
|
||||||
|
/// the foreground or in the background.
|
||||||
|
Future<void> initUniLinks() async {
|
||||||
|
try {
|
||||||
|
stream = getLinksStream().listen((String link) {
|
||||||
|
handleDeepLinking(link);
|
||||||
|
});
|
||||||
|
|
||||||
|
final String initialLink = await getInitialLink();
|
||||||
|
|
||||||
|
handleDeepLinking(initialLink);
|
||||||
|
} catch (e) {
|
||||||
|
print(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void handleDeepLinking(String link) async {
|
||||||
|
if (link == null || !mounted) return;
|
||||||
|
|
||||||
|
final List<String> urlComponents = link.split(":");
|
||||||
|
|
||||||
|
switch (urlComponents.first) {
|
||||||
|
case "bitcoin":
|
||||||
|
print("@@@@@@@@@@@@@@@@@@@@@@@@@@");
|
||||||
|
print("Bitcoin QR Code: \n${link}");
|
||||||
|
break;
|
||||||
|
case "litecoin":
|
||||||
|
case "haven":
|
||||||
|
case "monero":
|
||||||
|
default:
|
||||||
|
print("@@@@@@@@@@@@@@@@@@@@@@@@@@");
|
||||||
|
print(link);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _handleInitialUri() async {
|
Future<void> _handleInitialUri() async {
|
||||||
try {
|
try {
|
||||||
final uri = await getInitialUri();
|
final uri = await getInitialUri();
|
||||||
|
|
Loading…
Reference in a new issue