Skip to content

Support foregroundtask registration for packaged applications#1451

Merged
loneursid merged 7 commits intoWNP_LRPfrom
user/vemancha/foregroundtaskforpackagedapplications
Oct 1, 2021
Merged

Support foregroundtask registration for packaged applications#1451
loneursid merged 7 commits intoWNP_LRPfrom
user/vemancha/foregroundtaskforpackagedapplications

Conversation

@sharath2727
Copy link
Copy Markdown
Contributor

No description provided.

@ghost ghost added the needs-triage label Sep 20, 2021
Comment thread test/TestApps/PushNotificationsDemoPackage/Package.appxmanifest
Comment thread test/TestApps/PushNotificationsDemoApp/main.cpp
@loneursid loneursid added the area-Notifications Toast notification, badges, Live Tiles, push notifications label Sep 20, 2021
@sharath2727 sharath2727 force-pushed the user/vemancha/foregroundtaskforpackagedapplications branch from 4a6e6bc to d47e323 Compare September 20, 2021 16:00
Comment thread test/TestApps/PushNotificationsDemoPackage/PushNotificationsDemoPackage.wapproj Outdated
Comment thread dev/PushNotifications/PushNotificationChannel.h Outdated
Comment thread dev/PushNotifications/PushNotificationChannel.h Outdated
Comment thread dev/PushNotifications/PushNotificationChannel.cpp Outdated
Comment thread dev/PushNotifications/PushNotificationChannel.cpp Outdated
Comment thread dev/PushNotifications/PushNotificationChannel.cpp Outdated
Comment thread dev/PushNotifications/PushNotificationChannel.cpp Outdated
Comment thread dev/PushNotifications/PushNotificationChannel.cpp Outdated
Comment thread dev/PushNotifications/PushNotificationChannel.cpp Outdated
Comment thread dev/PushNotifications/PushNotificationChannel.cpp Outdated
Comment thread dev/PushNotifications/PushNotificationChannel.cpp Outdated
Comment thread dev/PushNotifications/PushNotificationChannel.cpp Outdated
Comment thread dev/PushNotifications/PushNotificationChannel.cpp Outdated
Comment thread dev/PushNotifications/PushNotificationChannel.cpp Outdated
Comment thread dev/PushNotifications/externs.h Outdated
Comment thread dev/PushNotifications/PushNotificationChannel.cpp Outdated
@sharath2727 sharath2727 force-pushed the user/vemancha/foregroundtaskforpackagedapplications branch from 5e4110d to c951092 Compare September 23, 2021 16:33
@sharath2727 sharath2727 changed the title [Draft] Support foregroundtask registration for packaged applications Support foregroundtask registration for packaged applications Sep 27, 2021
Comment thread dev/PushNotifications/PushNotificationUtility.cpp
Comment thread dev/PushNotifications/PushNotificationUtility.h Outdated
Comment thread dev/PushNotifications/PushNotificationUtility.cpp Outdated
Comment thread dev/PushNotifications/PushNotificationUtility.cpp
Copy link
Copy Markdown
Member

@jonwis jonwis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things to change, the rest are optional - use of that "count" thing to track number of registered handlers, and the missing function-level try/catch on the noexcept method. Otherwise looks pretty good, glad to see this coming together.

Comment thread dev/PushNotifications/PushNotificationChannel.cpp Outdated
Comment thread dev/PushNotifications/PushNotificationChannel.cpp
Comment thread dev/PushNotifications/PushNotificationUtility.cpp Outdated
Comment thread dev/PushNotifications/PushNotificationUtility.cpp Outdated

// Escape special characters to follow command line standards for any app activation type in AppLifecycle
// (See AppInstance.cpp and Serialize() from other activation types)
std::wstring payloadAsWideString = ConvertByteArrayToWideString(payloadLength, payload);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aeloros can you check this? You were working on similar "command line sanitization" issues as well.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't remember if we talked about this before or not, but I believe we would be better served not creating some new payload model. Instead we should create a contractId for the push server, and use the already existing infrastructure to pass properties through the query string. This might be an example of a fragile design since it requires continued upkeep to make it special.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonwis /@aeloros - I see howard introducing a lot of string conversion APIs in dev/common: #1513. Once the PR merges some of these conversion APIs in my .h/.cpp will be removed.

@aeloros - "Instead we should create a contractId for the push server, and use the already existing infrastructure to pass properties through the query string. This might be an example of a fragile design since it requires continued upkeep to make it special" - can you please help me understand this further? Maybe I could work on this going ahead to simplify things here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, the command-line on the receiving end (when GetActivatedEventArgs() parses it) already has a format that supports passing payload information. Specifically I'm talking about the ability to pass a Uri that contains a key/value pair (the query string).

There are problems with the current implementation of GetActivatedEventArgs() in that it doesn't tolerate malformed command-lines well. I have a change out to fix that, but it changes the expectations of the format as well.

I'm mostly suggesting here that we should try to find a better way to utilize the command-line. One that doesn't have the calling developer designing custom formats to support payloads. We should instead find a way to utilize the Uri format and serialize + encode data into that format.

This also lends itself to creating shared functions in the code base that generate that command-line. I've started to do that in a super simple way with GenerateCommandLine() inside of ActivationRegistrationManager.cpp. It could be moved and enhanced or accompanied with other helper functions to make a useful reusable toolset for callers to create command-lines in a consistent way.

I don't think any of this is the end of the world if not done. At this point in the conversation though, it probably would be intentional technical debt. Obviously we should avoid that when possible, but dealing with technical debt isn't the only factor in our lives. :)

Comment thread dev/PushNotifications/PushNotificationUtility.h
Comment thread dev/PushNotifications/PushNotificationUtility.h
Comment thread dev/PushNotifications/PushNotificationUtility.h Outdated
Comment thread dev/PushNotifications/PushNotificationChannel.cpp Outdated
Comment thread dev/PushNotifications/PushNotificationUtility.h
Comment thread dev/PushNotifications/PushNotificationUtility.h Outdated
Comment thread dev/PushNotifications/PushNotificationChannel.cpp
Comment thread dev/PushNotifications/PushNotificationChannel.cpp
Comment thread dev/PushNotifications/PushNotificationChannel.h Outdated
@loneursid loneursid merged commit ffcc485 into WNP_LRP Oct 1, 2021
@loneursid loneursid deleted the user/vemancha/foregroundtaskforpackagedapplications branch October 1, 2021 13:29
@loneursid loneursid restored the user/vemancha/foregroundtaskforpackagedapplications branch October 1, 2021 14:01
@loneursid
Copy link
Copy Markdown
Contributor

So, I've messed up. I've acidentaly merged this branch into WNP_LRP. As a result GIT closed this PR and the branch was deleted. I've reverted the merge from WNP_LRP and restored the branch. Still trying to figure out how to re-open this PR.

Copy link
Copy Markdown
Member

@jonwis jonwis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Notifications Toast notification, badges, Live Tiles, push notifications needs-triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants