-
Notifications
You must be signed in to change notification settings - Fork 144
FCM Implementation (Part 1) #12
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
Merged
Merged
Changes from all commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
055df25
Drafting the FCM API
hiranya911 72236d0
More tests and code cleanup
hiranya911 65e3f12
Added Notification type; Renamed MessagingTest to MessageTest
hiranya911 8e7ee55
Cancellation test
hiranya911 d9b840e
Adjusted line length
hiranya911 e241df0
Added integration test case
hiranya911 43c1195
Added AndroidConfig type; Improved validation logic
hiranya911 91188a0
Making priority nullable
hiranya911 588b658
Renamed Ttl to TimeToLive; Renamed Piority enum constants; Using IEnu…
hiranya911 3f275f5
Using readonly dict when possible
hiranya911 97710dd
Adding newline at eof
hiranya911 e362856
Making getters public as per proposal
hiranya911 61fc77e
Responding to code review comments
hiranya911 8aba063
More docs updates
hiranya911 1b60f48
Implemented AndroidNotification API
hiranya911 d83ec1e
Added more documentation for the internal types/methods
hiranya911 b069220
Merge branch 'hkj-fcm' into hkj-fcm-part2
hiranya911 9f9b0a0
Added documentation to internal types
hiranya911 9e46d4c
Implemented Webpush API for FCM
hiranya911 bceb995
Refactored the FirebaseMessaging types
hiranya911 0803839
Shallow copying list properties
hiranya911 2f5914f
Merge pull request #13 from firebase/hkj-fcm-part2
hiranya911 254c779
Merged with hkj-fcm-cleanup; Updated WebpushNotification for serializ…
hiranya911 08153a7
Fixed CustomData deserialization
hiranya911 0166f5f
Exposing CustomData as IDictionary
hiranya911 7acaaf6
Minor cleanup of internal properties
hiranya911 7cc6f1f
More test cases
hiranya911 86002eb
Handling invalid priority values during deserialization
hiranya911 6e4114b
Merge pull request #14 from firebase/hkj-fcm-cleanup
hiranya911 30471b4
Merge branch 'hkj-fcm' into hkj-fcm-part3
hiranya911 b1de01f
Handling invalid direction values during deserialization
hiranya911 c3b4499
Implementing APNs support
hiranya911 693eac5
Added other APNS types
hiranya911 a4edaf1
Cleaning up the Apns impl
hiranya911 31e317b
More clean up and tests
hiranya911 0eade9c
Using more Linq; More tests
hiranya911 6124d45
Fixed Apns deserialization
hiranya911 f4fe28b
Adding more APNS tests
hiranya911 9b50ff9
Adding Stylecop based linting
hiranya911 ed910d5
Added stylecop to tests
hiranya911 fccf06c
Fixing more lint errors
hiranya911 03607a5
Fixed more lint errors
hiranya911 d16f670
Fixed more lint errors
hiranya911 f991549
Fixed almost everything
hiranya911 6bcc4d6
Linter test commit
hiranya911 9108c26
Fixing lint error
hiranya911 1b9558a
Enabled lint rule for 'this' checks
hiranya911 477ecd0
Enabled all possible rules; Added linting to snippets;
hiranya911 ad58b40
Added missing newlines at eof
hiranya911 70efb05
Merge pull request #16 from firebase/hkj-fcm-part3
hiranya911 fee4c9e
Merge branch 'hkj-fcm' into hkj-fcm-part4
hiranya911 ee8cfd3
Added more unit tests
hiranya911 ae1e80c
Adding newline at eod
hiranya911 2dfb622
Fixing lint errors in user mgt code
hiranya911 e6bb4d2
Adding required constant
hiranya911 b901e62
Merge pull request #19 from firebase/hkj-fcm-part4
hiranya911 65905e7
Merge branch 'master' into hkj-stylecop
hiranya911 af9e80b
Merged with hkj-stylecop
hiranya911 bbbc925
Fixing lint errors
hiranya911 b4041ff
Fixed all lint errors
hiranya911 d7f22ec
Last lint errors
hiranya911 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
FirebaseAdmin/FirebaseAdmin.IntegrationTests/FirebaseMessagingTest.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| // Copyright 2018, Google Inc. All rights reserved. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| using System; | ||
| using System.Text.RegularExpressions; | ||
| using System.Threading.Tasks; | ||
| using FirebaseAdmin.Messaging; | ||
| using Xunit; | ||
|
|
||
| namespace FirebaseAdmin.IntegrationTests | ||
| { | ||
| public class FirebaseMessagingTest | ||
| { | ||
| public FirebaseMessagingTest() | ||
| { | ||
| IntegrationTestUtils.EnsureDefaultApp(); | ||
| } | ||
|
|
||
| [Fact] | ||
| public async Task Send() | ||
| { | ||
| var message = new Message() | ||
| { | ||
| Topic = "foo-bar", | ||
| Notification = new Notification() | ||
| { | ||
| Title = "Title", | ||
| Body = "Body", | ||
| }, | ||
| Android = new AndroidConfig() | ||
| { | ||
| Priority = Priority.Normal, | ||
| TimeToLive = TimeSpan.FromHours(1), | ||
| RestrictedPackageName = "com.google.firebase.testing", | ||
| }, | ||
| }; | ||
| var id = await FirebaseMessaging.DefaultInstance.SendAsync(message, dryRun: true); | ||
| Assert.True(!string.IsNullOrEmpty(id)); | ||
| Assert.Matches(new Regex("^projects/.*/messages/.*$"), id); | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't suppose there's any way to see that the message actually got all the parts it was supposed to?
It just seems kind of odd for an "integration test" to do a
dryRunanyway.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dryRun mode does validate for message content (both locally and at the server). The operation will fail if the message is invalid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I agree with @bklimt this isn't great at the moment. Last time @alexames looked into testing this in the client SDKs end to end there wasn't really a way to do so without spinning up a XMPP server. If the REST request is formatted appropriately, I guess that's good enough for the mo'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do check the message content in our unit tests.