-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.xaml.cs
50 lines (39 loc) · 1.37 KB
/
App.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using AirshipDotNet;
namespace MauiSample;
public partial class App : Application
{
public App()
{
InitializeComponent();
MainPage = new AppShell();
// Register deep link event handler
Airship.Instance.OnDeepLinkReceived += OnDeepLinkReceived;
}
private void OnDeepLinkReceived(object sender, DeepLinkEventArgs e)
{
Uri uri = new Uri(e.DeepLink);
Console.WriteLine("Deeplink Received! uri = " + uri);
if (uri.Host.ToLower() == "deeplink")
{
var components = uri.AbsolutePath.ToLower().Split(separator:"/", StringSplitOptions.RemoveEmptyEntries);
if (components.First() != null) {
switch (components.First())
{
case "home":
((AppShell)App.Current.MainPage).SwitchtoTab(Tabs.homeTab);
return;
case "inbox":
((AppShell)App.Current.MainPage).SwitchtoTab(Tabs.inboxTab);
return;
case "settings":
((AppShell)App.Current.MainPage).SwitchtoTab(Tabs.settingsTab);
return;
default:
break;
}
}
}
Console.WriteLine("App does not know how to handle deepLink" + uri);
}
}