Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Commit

Permalink
Registered UWPX as default app for "xmpp:" URIs for #42
Browse files Browse the repository at this point in the history
  • Loading branch information
COM8 committed Oct 19, 2018
1 parent e4e143f commit d146a50
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
24 changes: 19 additions & 5 deletions UWP XMPP Client/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,25 @@ private async Task onActivatedOrLaunchedAsync(IActivatedEventArgs args)
Window.Current.Content = rootFrame;
}

if (args is ToastNotificationActivatedEventArgs)
if(args is ProtocolActivatedEventArgs protocolActivationArgs)
{
Logger.Info("App activated by protocol activation with: " + protocolActivationArgs.Uri.ToString());

// If we're currently not on a page, navigate to the main page
if (rootFrame.Content == null)
{
if (!Settings.getSettingBoolean(SettingsConsts.INITIALLY_STARTED))
{
rootFrame.Navigate(typeof(AddAccountPage), "App.xaml.cs"); // ToDo add arguments
}
else
{
rootFrame.Navigate(typeof(ChatPage), "App.xaml.cs"); // ToDo add arguments
}
}
}
else if (args is ToastNotificationActivatedEventArgs toastActivationArgs)
{
var toastActivationArgs = args as ToastNotificationActivatedEventArgs;
Logger.Info("App activated by toast with: " + toastActivationArgs.Argument);
// If empty args, no specific action (just launch the app)
if (string.IsNullOrEmpty(toastActivationArgs.Argument))
Expand All @@ -225,10 +241,8 @@ private async Task onActivatedOrLaunchedAsync(IActivatedEventArgs args)
rootFrame.BackStack.Add(new PageStackEntry(typeof(ChatPage), null, null));
}
}
else if (args is LaunchActivatedEventArgs)
else if (args is LaunchActivatedEventArgs launchActivationArgs)
{
var launchActivationArgs = args as LaunchActivatedEventArgs;

Push.CheckLaunchedFromNotification(launchActivationArgs);

// If launched with arguments (not a normal primary tile/applist launch)
Expand Down
Binary file added UWP XMPP Client/Assets/uri_activation_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions UWP XMPP Client/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
<Task Type="systemEvent" />
</BackgroundTasks>
</Extension>
<uap:Extension Category="windows.protocol">
<uap:Protocol Name="xmpp">
<uap:Logo>Assets\uri_activation_icon.png</uap:Logo>
<uap:DisplayName>UWPX</uap:DisplayName>
</uap:Protocol>
</uap:Extension>
</Extensions>
</Application>
</Applications>
Expand Down
1 change: 1 addition & 0 deletions UWP XMPP Client/UWP XMPP Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@
<Content Include="Assets\StoreLogo.scale-150.png" />
<Content Include="Assets\StoreLogo.scale-200.png" />
<Content Include="Assets\StoreLogo.scale-400.png" />
<Content Include="Assets\uri_activation_icon.png" />
<Content Include="Assets\Wide310x150Logo.scale-100.png" />
<Content Include="Assets\Wide310x150Logo.scale-125.png" />
<Content Include="Assets\Wide310x150Logo.scale-150.png" />
Expand Down

0 comments on commit d146a50

Please sign in to comment.