|
9 | 9 | var isFirstActivation = true;
|
10 | 10 |
|
11 | 11 | app.onactivated = function (args) {
|
12 |
| - if (args.detail.kind === activation.ActivationKind.voiceCommand) { |
13 |
| - // TODO: Handle relevant ActivationKinds. For example, if your app can be started by voice commands, |
14 |
| - // this is a good place to decide whether to populate an input field or choose a different initial view. |
15 |
| - } |
16 |
| - else if (args.detail.kind === activation.ActivationKind.launch) { |
17 |
| - // A Launch activation happens when the user launches your app via the tile |
18 |
| - // or invokes a toast notification by clicking or tapping on the body. |
19 |
| - if (args.detail.arguments) { |
20 |
| - // TODO: If the app supports toasts, use this value from the toast payload to determine where in the app |
21 |
| - // to take the user in response to them invoking a toast notification. |
22 |
| - } |
23 |
| - else if (args.detail.previousExecutionState === activation.ApplicationExecutionState.terminated) { |
24 |
| - // TODO: This application had been suspended and was then terminated to reclaim memory. |
25 |
| - // To create a smooth user experience, restore application state here so that it looks like the app never stopped running. |
26 |
| - // Note: You may want to record the time when the app was last suspended and only restore state if they've returned after a short period. |
27 |
| - } |
28 |
| - } |
| 12 | + if (args.detail.kind === activation.ActivationKind.voiceCommand) { |
| 13 | + // TODO: Handle relevant ActivationKinds. For example, if your app can be started by voice commands, |
| 14 | + // this is a good place to decide whether to populate an input field or choose a different initial view. |
| 15 | + } |
| 16 | + else if (args.detail.kind === activation.ActivationKind.launch) { |
| 17 | + // A Launch activation happens when the user launches your app via the tile |
| 18 | + // or invokes a toast notification by clicking or tapping on the body. |
| 19 | + if (args.detail.arguments) { |
| 20 | + // TODO: If the app supports toasts, use this value from the toast payload to determine where in the app |
| 21 | + // to take the user in response to them invoking a toast notification. |
| 22 | + } |
| 23 | + else if (args.detail.previousExecutionState === activation.ApplicationExecutionState.terminated) { |
| 24 | + // TODO: This application had been suspended and was then terminated to reclaim memory. |
| 25 | + // To create a smooth user experience, restore application state here so that it looks like the app never stopped running. |
| 26 | + // Note: You may want to record the time when the app was last suspended and only restore state if they've returned after a short period. |
| 27 | + } |
| 28 | + } |
| 29 | + else if (args.detail.kind === activation.ActivationKind.protocol) { |
| 30 | + const originalUri = args.detail.uri.rawUri; |
| 31 | + const token = originalUri.substring(16); |
| 32 | + const newUri = "signalpassback://?" + token; |
| 33 | + const launcherOptions = new Windows.System.LauncherOptions(); |
| 34 | + launcherOptions.targetApplicationPackageFamilyName = "2383BenediktRadtke.SignalPrivateMessenger_teak1p7hcx9ga"; |
| 35 | + const inputData = new Windows.Foundation.Collections.ValueSet(); |
| 36 | + inputData.insert("token", token); |
| 37 | + Windows.System.Launcher.launchUriAsync(new Windows.Foundation.Uri(newUri), launcherOptions, inputData).then(function (value) { |
| 38 | + if (value) { |
| 39 | + Windows.UI.ViewManagement.ApplicationView.getForCurrentView().tryConsolidateAsync(); |
| 40 | + } |
| 41 | + }); |
| 42 | + } |
29 | 43 |
|
30 | 44 | if (!args.detail.prelaunchActivated) {
|
31 | 45 | // TODO: If prelaunchActivated were true, it would mean the app was prelaunched in the background as an optimization.
|
|
0 commit comments