Skip to content

Commit

Permalink
Merge branch 'main' into notifications-assets-full-support
Browse files Browse the repository at this point in the history
  • Loading branch information
sharath2727 committed Mar 25, 2022
2 parents 5fc95e3 + 5131c34 commit 13a45df
Show file tree
Hide file tree
Showing 29 changed files with 319 additions and 105 deletions.
11 changes: 11 additions & 0 deletions dev/AppLifecycle/AppLifecycle.idl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

namespace Microsoft.Windows.AppLifecycle
{
[contractversion(2)]
apicontract AppLifecycleContract {};

[contract(AppLifecycleContract, 1)]
enum ExtendedActivationKind
{
Launch = 0,
Expand Down Expand Up @@ -53,20 +57,26 @@ namespace Microsoft.Windows.AppLifecycle
// Windows.ApplicationModel.Activation.ActivationKind.

Push = 5000,

[contract(AppLifecycleContract, 2)]
AppNotification,
};

[contract(AppLifecycleContract, 1)]
runtimeclass AppActivationArguments
{
ExtendedActivationKind Kind { get; };
IInspectable Data{ get; };
};

[contract(AppLifecycleContract, 1)]
runtimeclass AppInstance
{
static AppInstance GetCurrent();
static Windows.Foundation.Collections.IVector<AppInstance> GetInstances();
static AppInstance FindOrRegisterForKey(String key);

[contract(AppLifecycleContract, 2)]
static Windows.ApplicationModel.Core.AppRestartFailureReason Restart(String arguments);

void UnregisterKey();
Expand All @@ -79,6 +89,7 @@ namespace Microsoft.Windows.AppLifecycle
UInt32 ProcessId{ get; };
}

[contract(AppLifecycleContract, 1)]
static runtimeclass ActivationRegistrationManager
{
static void RegisterForFileTypeActivation(String[] supportedFileTypes, String logo,
Expand Down
3 changes: 0 additions & 3 deletions dev/AppNotifications/AppNotification.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
#include "pch.h"
#include "AppNotification.h"
#include "Microsoft.Windows.AppNotifications.AppNotification.g.cpp"
#include <TerminalVelocityFeatures-AppNotifications.h>

using namespace winrt::Windows::Data::Xml::Dom;

namespace winrt::Microsoft::Windows::AppNotifications::implementation
{
AppNotification::AppNotification(hstring const& payload)
{
THROW_HR_IF(E_NOTIMPL, !::Microsoft::Windows::AppNotifications::Feature_AppNotifications::IsEnabled());

XmlDocument xmlDocument{};

// We call LoadXml to verify the payload is xml
Expand Down
1 change: 0 additions & 1 deletion dev/AppNotifications/AppNotificationManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <winerror.h>
#include <string_view>
#include <winrt/Windows.Foundation.Collections.h>
#include <TerminalVelocityFeatures-AppNotifications.h>
#include <WindowsAppRuntime.SelfContained.h>

using namespace std::literals;
Expand Down
3 changes: 0 additions & 3 deletions dev/AppNotifications/AppNotificationProgressData.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#include "pch.h"
#include "AppNotificationProgressData.h"
#include "Microsoft.Windows.AppNotifications.AppNotificationProgressData.g.cpp"
#include <TerminalVelocityFeatures-AppNotifications.h>

namespace winrt::Microsoft::Windows::AppNotifications::implementation
{
AppNotificationProgressData::AppNotificationProgressData(uint32_t sequenceNumber)
{
THROW_HR_IF(E_NOTIMPL, !::Microsoft::Windows::AppNotifications::Feature_AppNotifications::IsEnabled());

THROW_HR_IF(E_INVALIDARG, sequenceNumber == 0); // The sequence number is always greater than 0
m_sequenceNumber = sequenceNumber;
}
Expand Down
10 changes: 0 additions & 10 deletions dev/AppNotifications/AppNotifications.idl
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#include <TerminalVelocityFeatures-AppNotifications.h>

import "..\AppLifecycle\AppLifecycle.idl";

namespace Microsoft.Windows.AppNotifications
{

[contractversion(1)]
apicontract WindowsAppNotificationsContract {}

// Event args for the Notification Activation
[feature(Feature_AppNotifications)]
[contract(WindowsAppNotificationsContract, 1)]
runtimeclass AppNotificationActivatedEventArgs
{
Expand All @@ -23,7 +19,6 @@ namespace Microsoft.Windows.AppNotifications
}

// Notification Progress Data
[feature(Feature_AppNotifications)]
[contract(WindowsAppNotificationsContract, 1)]
runtimeclass AppNotificationProgressData
{
Expand All @@ -49,7 +44,6 @@ namespace Microsoft.Windows.AppNotifications
}

// The Notification User Setting or Notification Group Policy Setting
[feature(Feature_AppNotifications)]
[contract(WindowsAppNotificationsContract, 1)]
enum AppNotificationSetting
{
Expand All @@ -61,7 +55,6 @@ namespace Microsoft.Windows.AppNotifications
};

// The Result for a Notification Progress related operation
[feature(Feature_AppNotifications)]
[contract(WindowsAppNotificationsContract, 1)]
enum AppNotificationProgressResult
{
Expand All @@ -70,15 +63,13 @@ namespace Microsoft.Windows.AppNotifications
};

// The Priority of the Notification UI associated with it's popup in the Action Centre
[feature(Feature_AppNotifications)]
[contract(WindowsAppNotificationsContract, 1)]
enum AppNotificationPriority
{
Default, // The notification should have default behavior in terms of delivery and display priority during connected standby mode.
High, // The notification should be treated as high priority. For desktop PCs, this means during connected standby mode the incoming notification can turn on the screen for Surface-like devices if it doesn't have a closed lid detected.
};

[feature(Feature_AppNotifications)]
[contract(WindowsAppNotificationsContract, 1)]
runtimeclass AppNotification
{
Expand Down Expand Up @@ -115,7 +106,6 @@ namespace Microsoft.Windows.AppNotifications
}

// The manager class which encompasses all App Notification API Functionality
[feature(Feature_AppNotifications)]
[contract(WindowsAppNotificationsContract, 1)]
runtimeclass AppNotificationManager
{
Expand Down
3 changes: 3 additions & 0 deletions dev/DynamicDependency/API/MsixDynamicDependency.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
/// MSIX Dynamic Dependency: Bootstrap initialization found an applicable DynamicDependencyLifetimeManager (DDLM) best matching the criteria
#define MDD_E_BOOTSTRAP_INITIALIZE_DDLM_FOUND _HRESULT_TYPEDEF_(0x80040013L)

/// MSIX Dynamic Dependency: Bootstrap initialization request is incompatible with current Bootstrap initialization state.
#define MDD_E_BOOTSTRAP_INITIALIZE_INCOMPATIBLE _HRESULT_TYPEDEF_(0x80040014L)

enum class MddCreatePackageDependencyOptions : uint32_t
{
None = 0,
Expand Down
2 changes: 0 additions & 2 deletions dev/PushNotifications/PushNotificationChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ namespace winrt::Microsoft::Windows::PushNotifications::implementation
{
PushNotificationChannel::PushNotificationChannel(struct ChannelDetails channelInfo)
{
THROW_HR_IF(E_NOTIMPL, !::Microsoft::Windows::PushNotifications::Feature_PushNotifications::IsEnabled());

std::swap(m_channelInfo, channelInfo);
}

Expand Down
2 changes: 0 additions & 2 deletions dev/PushNotifications/PushNotificationChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

#pragma once
#include "Microsoft.Windows.PushNotifications.PushNotificationChannel.g.h"

#include "winrt/Windows.Networking.PushNotifications.h"
#include <TerminalVelocityFeatures-PushNotifications.h>
#include "externs.h"

namespace winrt::Microsoft::Windows::PushNotifications::implementation
Expand Down
2 changes: 0 additions & 2 deletions dev/PushNotifications/PushNotificationCreateChannelResult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include "pch.h"
#include "PushNotificationCreateChannelResult.h"
#include <TerminalVelocityFeatures-PushNotifications.h>
#include "Microsoft.Windows.PushNotifications.PushNotificationCreateChannelResult.g.cpp"

namespace winrt::Microsoft::Windows::PushNotifications::implementation
Expand All @@ -13,7 +12,6 @@ namespace winrt::Microsoft::Windows::PushNotifications::implementation
m_extendedError(extendedError),
m_status(status)
{
THROW_HR_IF(E_NOTIMPL, !::Microsoft::Windows::PushNotifications::Feature_PushNotifications::IsEnabled());
}

PushNotificationChannel PushNotificationCreateChannelResult::Channel()
Expand Down
4 changes: 0 additions & 4 deletions dev/PushNotifications/PushNotificationManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ namespace winrt::Microsoft::Windows::PushNotifications::implementation

winrt::Microsoft::Windows::PushNotifications::PushNotificationManager PushNotificationManager::Default()
{
THROW_HR_IF(E_NOTIMPL, !::Microsoft::Windows::PushNotifications::Feature_PushNotifications::IsEnabled());

static wil::srwlock lock;

auto criticalSection{ lock.lock_exclusive() };
Expand Down Expand Up @@ -196,8 +194,6 @@ namespace winrt::Microsoft::Windows::PushNotifications::implementation

winrt::IAsyncOperationWithProgress<winrt::Microsoft::Windows::PushNotifications::PushNotificationCreateChannelResult, winrt::Microsoft::Windows::PushNotifications::PushNotificationCreateChannelStatus> PushNotificationManager::CreateChannelAsync(const winrt::guid remoteId)
{
THROW_HR_IF(E_NOTIMPL, !::Microsoft::Windows::PushNotifications::Feature_PushNotifications::IsEnabled());

if (!IsSupported())
{
co_return winrt::make<PushNotificationCreateChannelResult>(
Expand Down
5 changes: 0 additions & 5 deletions dev/PushNotifications/PushNotificationReceivedEventArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <winrt/Windows.ApplicationModel.background.h>
#include <winrt/Windows.Storage.Streams.h>
#include <winrt/Windows.Networking.PushNotifications.h>
#include <TerminalVelocityFeatures-PushNotifications.h>
#include "PushNotificationReceivedEventArgs.h"
#include "Microsoft.Windows.PushNotifications.PushNotificationReceivedEventArgs.g.cpp"
#include <iostream>
Expand All @@ -31,28 +30,24 @@ namespace winrt::Microsoft::Windows::PushNotifications::implementation
m_rawNotificationPayload(BuildPayload(backgroundTask.TriggerDetails().as<RawNotification>().ContentBytes())),
m_unpackagedAppScenario(false)
{
THROW_HR_IF(E_NOTIMPL, !::Microsoft::Windows::PushNotifications::Feature_PushNotifications::IsEnabled());
}

PushNotificationReceivedEventArgs::PushNotificationReceivedEventArgs(winrt::PushNotificationReceivedEventArgs const& args):
m_rawNotificationPayload(BuildPayload(args.RawNotification().ContentBytes())),
m_unpackagedAppScenario(false)
{
THROW_HR_IF(E_NOTIMPL, !::Microsoft::Windows::PushNotifications::Feature_PushNotifications::IsEnabled());
}

PushNotificationReceivedEventArgs::PushNotificationReceivedEventArgs(byte* const& payload, ULONG const& length) :
m_rawNotificationPayload(BuildPayload(payload, length)),
m_unpackagedAppScenario(true)
{
THROW_HR_IF(E_NOTIMPL, !::Microsoft::Windows::PushNotifications::Feature_PushNotifications::IsEnabled());
}

PushNotificationReceivedEventArgs::PushNotificationReceivedEventArgs(winrt::hstring const& payload) :
m_rawNotificationPayload(BuildPayload(payload)),
m_unpackagedAppScenario(true)
{
THROW_HR_IF(E_NOTIMPL, !::Microsoft::Windows::PushNotifications::Feature_PushNotifications::IsEnabled());
}

std::vector<uint8_t> PushNotificationReceivedEventArgs::BuildPayload(winrt::Windows::Storage::Streams::IBuffer const& buffer)
Expand Down
17 changes: 9 additions & 8 deletions dev/PushNotifications/PushNotifications.idl
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

#include <TerminalVelocityFeatures-PushNotifications.h>

namespace Microsoft.Windows.PushNotifications
{
[feature(Feature_PushNotifications)]
[contractversion(1)]
apicontract PushNotificationsContract {}

// Event args for the Push payload.
[contract(PushNotificationsContract, 1)]
runtimeclass PushNotificationReceivedEventArgs
{
// The Push payload
Expand All @@ -19,7 +20,7 @@ namespace Microsoft.Windows.PushNotifications
event Windows.ApplicationModel.Background.BackgroundTaskCanceledEventHandler Canceled;
};

[feature(Feature_PushNotifications)]
[contract(PushNotificationsContract, 1)]
enum PushNotificationChannelStatus
{
InProgress, // The request is in progress and there is no retry operation
Expand All @@ -29,7 +30,7 @@ namespace Microsoft.Windows.PushNotifications
};

// The PushNotificationChannel Progress result
[feature(Feature_PushNotifications)]
[contract(PushNotificationsContract, 1)]
struct PushNotificationCreateChannelStatus
{
// Either InProgress or InProgressRetry status
Expand All @@ -42,7 +43,7 @@ namespace Microsoft.Windows.PushNotifications
UInt32 retryCount;
};

[feature(Feature_PushNotifications)]
[contract(PushNotificationsContract, 1)]
runtimeclass PushNotificationChannel
{
// The Channel Uri for app to Post a notification to.
Expand All @@ -55,7 +56,7 @@ namespace Microsoft.Windows.PushNotifications
void Close();
}

[feature(Feature_PushNotifications)]
[contract(PushNotificationsContract, 1)]
runtimeclass PushNotificationCreateChannelResult
{
// The Push channel associated with the Result. Valid only if status is CompletedSuccess.
Expand All @@ -68,7 +69,7 @@ namespace Microsoft.Windows.PushNotifications
PushNotificationChannelStatus Status { get; };
};

[feature(Feature_PushNotifications)]
[contract(PushNotificationsContract, 1)]
runtimeclass PushNotificationManager
{
// Checks to see if the APIs are supported for the Desktop app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<TemplateGroupID>WinRT-Managed-UAP</TemplateGroupID>
<AppliesTo>CSharp + SharedAssetsProject</AppliesTo>
<NumberOfParentCategoriesToRollUp>2</NumberOfParentCategoriesToRollUp>
<ShowByDefault>true</ShowByDefault>
<ShowByDefault>false</ShowByDefault>
<TargetPlatformName>Windows</TargetPlatformName>
<AppIdFilter>blend</AppIdFilter>
<LanguageTag>csharp</LanguageTag>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ProjectType>VC</ProjectType>
<TemplateID>WinUI.Desktop.CppWinRT.BlankWindow</TemplateID>
<NumberOfParentCategoriesToRollUp>2</NumberOfParentCategoriesToRollUp>
<ShowByDefault>true</ShowByDefault>
<ShowByDefault>false</ShowByDefault>
<TargetPlatformName>Windows</TargetPlatformName>
<AppIdFilter>blend</AppIdFilter>
<LanguageTag>cpp</LanguageTag>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<TemplateGroupID>WinRT-Managed-UAP</TemplateGroupID>
<AppliesTo>CSharp + SharedAssetsProject</AppliesTo>
<NumberOfParentCategoriesToRollUp>2</NumberOfParentCategoriesToRollUp>
<ShowByDefault>true</ShowByDefault>
<ShowByDefault>false</ShowByDefault>
<TargetPlatformName>Windows</TargetPlatformName>
<AppIdFilter>blend</AppIdFilter>
<LanguageTag>csharp</LanguageTag>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<TemplateGroupID>WinRT-Managed-UAP</TemplateGroupID>
<AppliesTo>CSharp + SharedAssetsProject</AppliesTo>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
<ShowByDefault>true</ShowByDefault>
<ShowByDefault>false</ShowByDefault>
<TargetPlatformName>Windows</TargetPlatformName>
<AppIdFilter>blend</AppIdFilter>
<LanguageTag>csharp</LanguageTag>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ProjectType>CSharp</ProjectType>
<TemplateID>WinUI.Cs.Neutral.Resw</TemplateID>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
<ShowByDefault>true</ShowByDefault>
<ShowByDefault>false</ShowByDefault>
<TargetPlatformName>Windows</TargetPlatformName>
<AppIdFilter>blend</AppIdFilter>
<LanguageTag>csharp</LanguageTag>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<TemplateGroupID>WinRT-Managed-UAP</TemplateGroupID>
<AppliesTo>CSharp + SharedAssetsProject</AppliesTo>
<NumberOfParentCategoriesToRollUp>2</NumberOfParentCategoriesToRollUp>
<ShowByDefault>true</ShowByDefault>
<ShowByDefault>false</ShowByDefault>
<TargetPlatformName>Windows</TargetPlatformName>
<AppIdFilter>blend</AppIdFilter>
<LanguageTag>csharp</LanguageTag>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<TemplateGroupID>WinRT-Managed-UAP</TemplateGroupID>
<AppliesTo>CSharp + SharedAssetsProject</AppliesTo>
<NumberOfParentCategoriesToRollUp>2</NumberOfParentCategoriesToRollUp>
<ShowByDefault>true</ShowByDefault>
<ShowByDefault>false</ShowByDefault>
<TargetPlatformName>Windows</TargetPlatformName>
<AppIdFilter>blend</AppIdFilter>
<LanguageTag>csharp</LanguageTag>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ProjectType>VC</ProjectType>
<TemplateID>WinUI.Neutral.CppWinRT.BlankPage</TemplateID>
<NumberOfParentCategoriesToRollUp>2</NumberOfParentCategoriesToRollUp>
<ShowByDefault>true</ShowByDefault>
<ShowByDefault>false</ShowByDefault>
<TargetPlatformName>Windows</TargetPlatformName>
<AppIdFilter>blend</AppIdFilter>
<LanguageTag>cpp</LanguageTag>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ProjectType>VC</ProjectType>
<TemplateID>WinUI.Neutral.CppWinRT.ResourceDictionary</TemplateID>
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
<ShowByDefault>true</ShowByDefault>
<ShowByDefault>false</ShowByDefault>
<TargetPlatformName>Windows</TargetPlatformName>
<AppIdFilter>blend</AppIdFilter>
<LanguageTag>cpp</LanguageTag>
Expand Down
Loading

0 comments on commit 13a45df

Please sign in to comment.