Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push Notifications Feature #823

Closed
wants to merge 55 commits into from
Closed
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
f5ca3a6
Push Notifications Components
pmpurifoy May 13, 2021
c22476e
Fixed AppLifecycle packager build files
pmpurifoy May 14, 2021
f87a4e7
Push Notifications Components
pmpurifoy May 13, 2021
978de5e
Revert AppLifecycle build files
pmpurifoy May 14, 2021
ba38c1b
[Draft] Add PushNotifications unit tests (#821)
pmpurifoy May 14, 2021
22b3ef9
Added PushNotification classes to NuSpecs
pmpurifoy May 14, 2021
d6ea25f
Fix some PR comments surrounding background activation
pmpurifoy May 17, 2021
e2810b5
I spoke with Paul offline and am pushing these changes to help him al…
aeloros May 17, 2021
0b14a9e
Fixed Debug builds build-break. Fixed debug tests so they run and su…
aeloros May 18, 2021
6dab535
Address comments for channel request
sharath2727 May 18, 2021
0ec5bfb
Add experimental tag to the runtimeclasses
sharath2727 May 18, 2021
032b8d5
Fixed a bug in my last change.
aeloros May 18, 2021
8d7b143
Removed static handlers and a fixed a few nits
pmpurifoy May 19, 2021
bb5cee7
Fixed some more nits
pmpurifoy May 19, 2021
0de79cf
Added some nit fixes
pmpurifoy May 20, 2021
0fef22d
Replace Kind -> Option
pmpurifoy May 21, 2021
7dc5a87
Added cleanup to TAEF test
pmpurifoy May 24, 2021
ddac203
Address comments for createchannelasync
sharath2727 May 24, 2021
3010939
Added more coverage with unit tests
pmpurifoy May 24, 2021
4873cdc
Changed global event args var with COM static store approach
May 24, 2021
ca81054
Removed global lock
May 26, 2021
8e42ab4
Support concurrency in channel request API
sharath2727 May 27, 2021
cb6168f
Remove unused unittests
sharath2727 May 27, 2021
3ff400d
Addressed feedback in Background Activation impl code
May 27, 2021
001f3bc
Addressed corner case where we returned nullptr if the task was alrea…
May 28, 2021
f60056e
Removed global events -> parent/child testing with exit code
pmpurifoy Jun 1, 2021
b17b91a
Add package install with version / arch
pmpurifoy Jun 1, 2021
34c14e6
Added multiple background activation test
pmpurifoy Jun 1, 2021
9683ab8
PR feedback
aeloros Jun 2, 2021
162ef68
PR Feedback
aeloros Jun 2, 2021
f05c96a
PR Feedback
aeloros Jun 2, 2021
9c3d977
PR Feedback
aeloros Jun 2, 2021
478b455
Address PR comments
pmpurifoy Jun 2, 2021
8a11f9c
Fixed Debug unit tests
pmpurifoy Jun 3, 2021
d8d8388
Added nuget build files
pmpurifoy Jun 4, 2021
5bf3d51
Removed unnecessary Create functions from IDL
Jun 4, 2021
e90e608
Added multiple channel close test
pmpurifoy Jun 4, 2021
38b9b93
Implement LockServer
pmpurifoy Jun 4, 2021
735ae79
Fixing nits
pmpurifoy Jun 9, 2021
0a89d4d
Added test app changes
pmpurifoy Jun 9, 2021
fa4e2c6
Fix unregister token
pmpurifoy Jun 9, 2021
ab1ac2b
Fix nits in createchannelasync API
sharath2727 Jun 10, 2021
6f55098
Addressed comments mostly on Background Activation and the IDL
Jun 10, 2021
bd4bc2b
Refactored unregistering tokens
pmpurifoy Jun 11, 2021
fd7ba4a
Addressed last comments
Jun 12, 2021
a030fe5
Add .Windows to Application model
pmpurifoy Jun 16, 2021
c20a9ec
Fixed unit test nits
pmpurifoy Jun 17, 2021
f09bce5
fix nits
sharath2727 Jun 17, 2021
3170c37
Fixed appmanifests and nits
pmpurifoy Jun 17, 2021
bcd75e9
Removed Debug_test/ARM from PR.sln
pmpurifoy Jun 17, 2021
7594c26
Replaced global event with global getter and removed a throw macro
Jun 18, 2021
38f10d4
Merge branch 'main' into WNP_Reunion_PR
pmpurifoy Jun 21, 2021
eba1e94
Adding ARM64 support
pmpurifoy Jun 23, 2021
4ba3dbe
Fixed build break - Removed unnecessary dependencies in PR.sln
Jun 24, 2021
dbf9916
Merge branch 'main' into WNP_Reunion_PR
danielayala94 Jun 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
221 changes: 221 additions & 0 deletions ProjectReunion.sln

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ jobs:
Copy-Item -Path "$targetsFilePath\AppxManifest.xml" -Destination "$fullpackagePath\AppxManifest.xml"

Copy-Item -Path "$targetsFilePath\Intellisense\Microsoft.Windows.AppLifecycle.xml" -Destination "$fullpackagePath\lib\uap10.0\Microsoft.Windows.AppLifecycle.xml"
Copy-Item -Path "$targetsFilePath\Intellisense\Microsoft.Windows.ApplicationModel.DynamicDependency.xml" -Destination "$fullpackagePath\lib\uap10.0\Microsoft.Windows.ApplicationModel.DynamicDependency.xml"
Copy-Item -Path "$targetsFilePath\Intellisense\Microsoft.ApplicationModel.DynamicDependency.xml" -Destination "$fullpackagePath\lib\uap10.0\Microsoft.ApplicationModel.DynamicDependency.xml"
pmpurifoy marked this conversation as resolved.
Show resolved Hide resolved
Copy-Item -Path "$targetsFilePath\Intellisense\Microsoft.Windows.PushNotifications.xml" -Destination "$fullpackagePath\lib\uap10.0\Microsoft.Windows.PushNotifications.xml"

# - script: |
# dir /s $(Build.SourcesDirectory)
Expand Down
6 changes: 5 additions & 1 deletion build/CopyFilesToStagingDir.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ PublishFile $OverrideDir\DynamicDependency-Override.json $FullPublishDir\
PublishFile $FullBuildOutput\ProjectReunion_DLL\Microsoft.ProjectReunion.dll $FullPublishDir\Microsoft.ProjectReunion\
PublishFile $FullBuildOutput\ProjectReunion_DLL\Microsoft.ProjectReunion.lib $FullPublishDir\Microsoft.ProjectReunion\
PublishFile $FullBuildOutput\ProjectReunion_DLL\Microsoft.Windows.AppLifecycle.winmd $FullPublishDir\Microsoft.ProjectReunion\
PublishFile $FullBuildOutput\ProjectReunion_DLL\Microsoft.Windows.ApplicationModel.DynamicDependency.winmd $FullPublishDir\Microsoft.ProjectReunion\
PublishFile $FullBuildOutput\ProjectReunion_DLL\Microsoft.Windows.PushNotifications.winmd $FullPublishDir\Microsoft.ProjectReunion\
PublishFile $FullBuildOutput\ProjectReunion_DLL\Microsoft.ApplicationModel.DynamicDependency.winmd $FullPublishDir\Microsoft.ProjectReunion\
PublishFile $FullBuildOutput\ProjectReunion_DLL\MsixDynamicDependency.h $FullPublishDir\Microsoft.ProjectReunion\
PublishFile $FullBuildOutput\ProjectReunion_DLL\wil_msixdynamicdependency.h $FullPublishDir\Microsoft.ProjectReunion\
#
Expand Down Expand Up @@ -114,12 +115,15 @@ PublishFile $FullBuildOutput\DynamicDependencyLifetimeManager.ProxyStub\DynamicD
#
# WinMD for UWP apps
PublishFile $FullBuildOutput\ProjectReunion_DLL\Microsoft.Windows.AppLifecycle.winmd $NugetDir\lib\uap10.0
PublishFile $FullBuildOutput\ProjectReunion_DLL\Microsoft.Windows.PushNotifications.winmd $NugetDir\lib\uap10.0
#
# Native (not managed, no MSIX)
PublishFile $FullBuildOutput\ProjectReunion_BootstrapDLL\Microsoft.ProjectReunion.Bootstrap.dll $NugetDir\runtimes\lib\native\$Platform
PublishFile $FullBuildOutput\ProjectReunion_BootstrapDLL\Microsoft.ProjectReunion.Bootstrap.pdb $NugetDir\runtimes\lib\native\$Platform
PublishFile $FullBuildOutput\ProjectReunion_DLL\Microsoft.Windows.AppLifecycle.winmd $NugetDir\lib\native
PublishFile $FullBuildOutput\ProjectReunion_DLL\Microsoft.Windows.ApplicationModel.DynamicDependency.winmd $NugetDir\lib\native
PublishFile $FullBuildOutput\ProjectReunion_DLL\Microsoft.Windows.PushNotifications.winmd $NugetDir\lib\native

pmpurifoy marked this conversation as resolved.
Show resolved Hide resolved
#
# C#/WinRT Projections
#
Expand Down
8 changes: 8 additions & 0 deletions build/NuSpecs/AppxManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@
<!-- AppLifecycle -->
<ActivatableClass ActivatableClassId="Microsoft.Windows.AppLifecycle.ActivationRegistrationManager" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Windows.AppLifecycle.AppInstance" ThreadingModel="both" />

<!-- PushNotifications -->
<ActivatableClass ActivatableClassId="Microsoft.Windows.PushNotifications.PushNotificationChannel" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Windows.PushNotifications.PushNotificationCreateChannelResult" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Windows.PushNotifications.PushNotificationActivationInfo" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Windows.PushNotifications.PushNotificationReceivedEventArgs" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Windows.PushNotifications.PushNotificationRegistrationToken" ThreadingModel="both" />
<ActivatableClass ActivatableClassId="Microsoft.Windows.PushNotifications.PushNotificationManager" ThreadingModel="both" />
</InProcessServer>
</Extension>
</Extensions>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions build/NuSpecs/ProjectReunion-Nuget-Native.WinRt.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<Implementation Condition="'$(ProjectReunionFrameworkPackage)' != 'true'">$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(_ProjectReunionFoundationPlatform)\native\Microsoft.ProjectReunion.dll</Implementation>
<IsWinMDFile>true</IsWinMDFile>
</Reference>
<Reference Include="Microsoft.Windows.PushNotifications.winmd">
<HintPath>$(MSBuildThisFileDirectory)..\..\lib\uap10.0\Microsoft.Windows.PushNotifications.winmd</HintPath>
<Implementation Condition="'$(ProjectReunionFrameworkPackage)' != 'true'">$(MSBuildThisFileDirectory)..\..\runtimes\win10-$(_ProjectReunionFoundationPlatform)\native\Microsoft.ProjectReunion.dll</Implementation>
<IsWinMDFile>true</IsWinMDFile>
</Reference>
</ItemGroup>

</Project>
7 changes: 7 additions & 0 deletions build/NuSpecs/ProjectReunion-Nuget-Native.targets
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,11 @@
</Reference>
</ItemGroup>

<ItemGroup>
<Reference Include="$(MSBuildThisFileDirectory)..\..\lib\native\Microsoft.Windows.PushNotifications.winmd">
<Private>false</Private>
<Implementation>Microsoft.ProjectReunion.dll</Implementation>
</Reference>
</ItemGroup>

</Project>
104 changes: 64 additions & 40 deletions dev/AppLifecycle/AppInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "FileActivatedEventArgs.h"
#include "Association.h"
#include "ExtensionContract.h"
#include "GetRawNotificationEventArgs.h"

using namespace winrt;
using namespace winrt::Windows::Foundation;
Expand All @@ -33,30 +34,37 @@ namespace winrt::Microsoft::Windows::AppLifecycle::implementation
// Push past the '----' commandline argument prefix.
aeloros marked this conversation as resolved.
Show resolved Hide resolved
argsStart += 4;
danielayala94 marked this conversation as resolved.
Show resolved Hide resolved

// We explicitly use find_first_of here, so that the resulting data may contain : as a valid character.
auto argsEnd = commandLine.find_first_of(L":", argsStart);
auto argsEnd = commandLine.find_first_of(L" ", argsStart);
aeloros marked this conversation as resolved.
Show resolved Hide resolved
danielayala94 marked this conversation as resolved.
Show resolved Hide resolved
pmpurifoy marked this conversation as resolved.
Show resolved Hide resolved

// Separate the argument from any behind it on the command-line.
std::wstring argument;
if (argsEnd == std::wstring::npos)
{
return { L"", L"" };
argument = commandLine.substr(argsStart);
}

if (argsStart > argsEnd)
else
{
throw std::overflow_error("commandLine");
if (argsStart > argsEnd)
danielayala94 marked this conversation as resolved.
Show resolved Hide resolved
{
throw std::invalid_argument("commandLine");
}

argument = commandLine.substr(argsStart, (argsEnd - argsStart));
}

auto argsLength = argsEnd - argsStart;
auto dataStart = argsEnd + 1;
// We explicitly use find_first_of here, so that the resulting data may contain : as a valid character.
auto argsDelim = argument.find_first_of(L":");
danielayala94 marked this conversation as resolved.
Show resolved Hide resolved
pmpurifoy marked this conversation as resolved.
Show resolved Hide resolved
if (argsDelim == std::wstring::npos)
{
return { argument, L"" };
}

return { commandLine.substr(argsStart, argsLength), commandLine.substr(dataStart) };
return { argument.substr(0, argsDelim), argument.substr(argsDelim + 1) };
}
danielayala94 marked this conversation as resolved.
Show resolved Hide resolved

std::tuple<ExtendedActivationKind, winrt::Windows::Foundation::IInspectable> GetEncodedLaunchActivatedEventArgs(IProtocolActivatedEventArgs const& args)
{
auto kind = ExtendedActivationKind::Protocol;
winrt::Windows::Foundation::IInspectable data;

std::tie(kind, data) = DecodeActivatedEventArgs(args.Uri());
auto [kind, data] = DecodeActivatedEventArgs(args.Uri());

// Let the caller args pass through if nothing was determined here.
if (data == nullptr)
Expand Down Expand Up @@ -308,51 +316,67 @@ namespace winrt::Microsoft::Windows::AppLifecycle::implementation
{
danielayala94 marked this conversation as resolved.
Show resolved Hide resolved
ExtendedActivationKind kind = ExtendedActivationKind::Launch;
IInspectable data;
bool foundArgs = false;

// For packaged, try to get platform args first.
if (HasIdentity())
{
auto args = winrt::Windows::ApplicationModel::AppInstance::GetActivatedEventArgs();
if (args)
if (auto args = winrt::Windows::ApplicationModel::AppInstance::GetActivatedEventArgs())
{
data = args.as<IInspectable>();
data = args;
kind = static_cast<ExtendedActivationKind>(args.Kind());
foundArgs = true;
}
}
else

// Handle all Reunion types next (both packaged and unpackaged).
std::wstring commandLine = std::wstring(GetCommandLine());
pmpurifoy marked this conversation as resolved.
Show resolved Hide resolved
if (!foundArgs)
{
// Generate IActivatedEventArgs for non-Packaged applications.
std::wstring contractId;
std::wstring contractData;
auto commandLine = std::wstring(GetCommandLine());
std::tie(contractId, contractData) = ParseCommandLine(commandLine);
auto [contractArgument, contractData] = ParseCommandLine(commandLine);

// All specific launch types are encoded as a URI and transported as a
// protocol, except the catch-all LaunchActivatedEventArgs case.
if (!contractId.empty() && (CompareStringOrdinal(contractId.c_str(), -1, c_protocolArgumentString, -1, TRUE) == CSTR_EQUAL))
if (!contractArgument.empty())
{
kind = ExtendedActivationKind::Protocol;
auto args = make<ProtocolActivatedEventArgs>(contractData);
data = args.as<IInspectable>();

// Encoded launch is a protocol launch where the argument data is
// encapsulated in the Uri Query data. We handle that here and
// try to return the correct IActivatedEventArgs type that is
// encoded in the data rather than the IProtocolActivatedEventArgs
// itself.
auto protocolArgs = args.as<IProtocolActivatedEventArgs>();
if (IsEncodedLaunch(protocolArgs.Uri()))
if (contractData.empty())
{
std::tie(kind, data) = GetEncodedLaunchActivatedEventArgs(protocolArgs);
// If the contractData is empty, handle any aliased encoded launches.
if (CompareStringOrdinal(contractArgument.data(), static_cast<int>(contractArgument.size()), L"ReunionPushServer", -1, TRUE) == CSTR_EQUAL)
{
contractData = GenerateEncodedLaunchUri(L"App", c_pushContractId);
contractArgument = c_protocolArgumentString;
}
}
}

// Haven't set the kind yet, and so let's default to Launch.
if (kind == ExtendedActivationKind::Launch)
{
data = make<LaunchActivatedEventArgs>(commandLine).as<IInspectable>();
if (CompareStringOrdinal(contractArgument.c_str(), -1, c_protocolArgumentString, -1, TRUE) == CSTR_EQUAL)
danielayala94 marked this conversation as resolved.
Show resolved Hide resolved
{
kind = ExtendedActivationKind::Protocol;
auto args = make<ProtocolActivatedEventArgs>(contractData);
data = args;

// Encoded launch is a protocol launch where the argument data is
// encapsulated in the Uri Query data. We handle that here and
// try to return the correct IActivatedEventArgs type that is
// encoded in the data rather than the IProtocolActivatedEventArgs
// itself.
if (IsEncodedLaunch(args.Uri()))
{
std::tie(kind, data) = GetEncodedLaunchActivatedEventArgs(args);
}

foundArgs = true;
}
}
}

// All scenarios should just be marked as Launch.
if (!foundArgs)
danielayala94 marked this conversation as resolved.
Show resolved Hide resolved
{
kind = ExtendedActivationKind::Launch;
data = make<LaunchActivatedEventArgs>(commandLine);
}

return make<AppActivationArguments>(kind, data);
}

Expand Down
3 changes: 2 additions & 1 deletion dev/AppLifecycle/AppLifecycle.idl
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ namespace Microsoft.Windows.AppLifecycle
PrintSupportSettingsUI,
PhoneCallActivation,
VpnForeground,

// NOTE: Values below 5000 are designated for the platform. The above list is kept in sync with
// Windows.ApplicationModel.Activation.ActivationKind.

Push = 5000,
};

[experimental]
Expand Down
15 changes: 9 additions & 6 deletions dev/AppLifecycle/ExtensionContract.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,25 @@
#include "ProtocolActivatedEventArgs.h"
#include "FileActivatedEventArgs.h"
#include "StartupActivatedEventArgs.h"
#include "GetRawNotificationEventArgs.h"

namespace winrt::Microsoft::Windows::AppLifecycle::implementation
{
// This array holds the mapping between a class factory and it's extension contract Id.
static const struct ExtensionMap
struct ExtensionMap
{
aeloros marked this conversation as resolved.
Show resolved Hide resolved
ExtendedActivationKind kind;
std::wstring contractId;
winrt::Windows::ApplicationModel::Activation::IActivatedEventArgs(*factory)(winrt::Windows::Foundation::Uri const& uri);
}
c_extensionMap[] =
PCWSTR contractId;
winrt::Windows::Foundation::IInspectable(*factory)(winrt::Windows::Foundation::Uri const& uri);
};

constexpr ExtensionMap c_extensionMap[] =
{
{ ExtendedActivationKind::Launch, c_launchContractId, &LaunchActivatedEventArgs::Deserialize },
{ ExtendedActivationKind::File, c_fileContractId, &FileActivatedEventArgs::Deserialize },
{ ExtendedActivationKind::Protocol, c_protocolContractId, &ProtocolActivatedEventArgs::Deserialize },
{ ExtendedActivationKind::StartupTask, c_startupTaskContractId, &StartupActivatedEventArgs::Deserialize },
{ ExtendedActivationKind::Push, c_pushContractId, &winrt::Microsoft::Windows::PushNotifications::Deserialize },
};

inline bool IsEncodedLaunch(winrt::Windows::Foundation::Uri const& uri)
Expand All @@ -39,7 +42,7 @@ namespace winrt::Microsoft::Windows::AppLifecycle::implementation
for (const auto& extension : c_extensionMap)
{
std::wstring contractId = pair.Value().c_str();
danielayala94 marked this conversation as resolved.
Show resolved Hide resolved
if (CompareStringOrdinal(contractId.c_str(), -1, extension.contractId.c_str(), -1, TRUE) == CSTR_EQUAL)
if (CompareStringOrdinal(contractId.c_str(), -1, extension.contractId, -1, TRUE) == CSTR_EQUAL)
danielayala94 marked this conversation as resolved.
Show resolved Hide resolved
{
return { extension.kind, extension.factory(uri).as<winrt::Windows::Foundation::IInspectable>() };
}
Expand Down
14 changes: 7 additions & 7 deletions dev/AppLifecycle/FileActivatedEventArgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ namespace winrt::Microsoft::Windows::AppLifecycle::implementation
using namespace winrt::Windows::ApplicationModel::Activation;
using namespace winrt::Windows::Storage;

static PCWSTR c_fileContractId = L"Windows.File";
constexpr PCWSTR c_fileContractId = L"Windows.File";

danielayala94 marked this conversation as resolved.
Show resolved Hide resolved
class FileActivatedEventArgs : public winrt::implements<FileActivatedEventArgs, ActivatedEventArgsBase, IFileActivatedEventArgs,
class FileActivatedEventArgs : public winrt::implements<FileActivatedEventArgs, IFileActivatedEventArgs, ActivatedEventArgsBase,
IInternalValueMarshalable>
{
public:
Expand All @@ -29,8 +29,8 @@ namespace winrt::Microsoft::Windows::AppLifecycle::implementation
}

m_kind = ActivationKind::File;
m_verb = verb;
m_path = file;
m_verb = std::move(verb);
m_path = std::move(file);
m_files = winrt::single_threaded_vector<IStorageItem>();

// There is a scenario where we just want to create an object to serialize it. In that situation
Expand All @@ -44,11 +44,11 @@ namespace winrt::Microsoft::Windows::AppLifecycle::implementation
}
}

static IActivatedEventArgs Deserialize(winrt::Windows::Foundation::Uri const& uri)
static winrt::Windows::Foundation::IInspectable Deserialize(winrt::Windows::Foundation::Uri const& uri)
{
auto query = uri.QueryParsed();
std::wstring verb = query.GetFirstValueByName(L"Verb").c_str();
std::wstring file = query.GetFirstValueByName(L"File").c_str();
auto verb = std::wstring(query.GetFirstValueByName(L"Verb"));
auto file = std::wstring(query.GetFirstValueByName(L"File"));
danielayala94 marked this conversation as resolved.
Show resolved Hide resolved
danielayala94 marked this conversation as resolved.
Show resolved Hide resolved
danielayala94 marked this conversation as resolved.
Show resolved Hide resolved
return make<FileActivatedEventArgs>(verb, file);
}

Expand Down
12 changes: 6 additions & 6 deletions dev/AppLifecycle/LaunchActivatedEventArgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ namespace winrt::Microsoft::Windows::AppLifecycle::implementation
{
using namespace winrt::Windows::ApplicationModel::Activation;

static PCWSTR c_launchContractId = L"Windows.Launch";
constexpr PCWSTR c_launchContractId = L"Windows.Launch";

class LaunchActivatedEventArgs : public winrt::implements<LaunchActivatedEventArgs,
ActivatedEventArgsBase, ILaunchActivatedEventArgs, IInternalValueMarshalable>
class LaunchActivatedEventArgs : public winrt::implements<LaunchActivatedEventArgs, ILaunchActivatedEventArgs,
ActivatedEventArgsBase, IInternalValueMarshalable>
{
public:
LaunchActivatedEventArgs(const std::wstring& args) : m_args(args)
LaunchActivatedEventArgs(const std::wstring& args) : m_args(std::move(args))
danielayala94 marked this conversation as resolved.
Show resolved Hide resolved
{
m_kind = ActivationKind::Launch;
}

static IActivatedEventArgs Deserialize(winrt::Windows::Foundation::Uri const& uri)
static winrt::Windows::Foundation::IInspectable Deserialize(winrt::Windows::Foundation::Uri const& uri)
{
auto query = uri.QueryParsed();
auto args = query.GetFirstValueByName(L"Arguments").c_str();
auto args = std::wstring(query.GetFirstValueByName(L"Arguments"));
return make<LaunchActivatedEventArgs>(args);
}

Expand Down
10 changes: 5 additions & 5 deletions dev/AppLifecycle/ProtocolActivatedEventArgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ namespace winrt::Microsoft::Windows::AppLifecycle::implementation
using namespace winrt::Windows::Foundation::Collections;
using namespace winrt::Windows::ApplicationModel::Activation;

static PCWSTR c_protocolContractId = L"Windows.Protocol";
constexpr PCWSTR c_protocolContractId = L"Windows.Protocol";

class ProtocolActivatedEventArgs : public winrt::implements<ProtocolActivatedEventArgs, ActivatedEventArgsBase, IProtocolActivatedEventArgs,
class ProtocolActivatedEventArgs : public winrt::implements<ProtocolActivatedEventArgs, IProtocolActivatedEventArgs, ActivatedEventArgsBase,
IInternalValueMarshalable>
{
public:
ProtocolActivatedEventArgs(const std::wstring& uri) : m_uri(winrt::Windows::Foundation::Uri(uri))
ProtocolActivatedEventArgs(const std::wstring& uri) : m_uri(winrt::Windows::Foundation::Uri(std::move(uri)))
danielayala94 marked this conversation as resolved.
Show resolved Hide resolved
pmpurifoy marked this conversation as resolved.
Show resolved Hide resolved
{
m_kind = ActivationKind::Protocol;
}

static IActivatedEventArgs Deserialize(winrt::Windows::Foundation::Uri const& uri)
static winrt::Windows::Foundation::IInspectable Deserialize(winrt::Windows::Foundation::Uri const& uri)
{
auto query = uri.QueryParsed();
danielayala94 marked this conversation as resolved.
Show resolved Hide resolved
auto args = query.GetFirstValueByName(L"Uri").c_str();
auto args = std::wstring(query.GetFirstValueByName(L"Uri"));
return make<ProtocolActivatedEventArgs>(args);
}

Expand Down
Loading