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

feat: add fcm_options property to webpush config #64

Merged
merged 9 commits into from Jun 3, 2019
Merged

feat: add fcm_options property to webpush config #64

merged 9 commits into from Jun 3, 2019

Conversation

@Odonno
Copy link
Contributor

@Odonno Odonno commented Jun 3, 2019

No description provided.

@googlebot
Copy link

@googlebot googlebot commented Jun 3, 2019

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

Loading

@Odonno
Copy link
Contributor Author

@Odonno Odonno commented Jun 3, 2019

I signed it!

Loading

@googlebot
Copy link

@googlebot googlebot commented Jun 3, 2019

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

Loading

Copy link
Member

@hiranya911 hiranya911 left a comment

Looks good. Please update the tests, and add an entry to the CHANGELOG file.

Loading

@@ -0,0 +1,32 @@
// Copyright 2018, Google Inc. All rights reserved.
Copy link
Member

@hiranya911 hiranya911 Jun 3, 2019

Choose a reason for hiding this comment

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

2019

Loading

[JsonProperty("link")]
public string Link { get; set; }
}
}
Copy link
Member

@hiranya911 hiranya911 Jun 3, 2019

Choose a reason for hiding this comment

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

Add newline at eof

Loading

Copy link
Member

@hiranya911 hiranya911 left a comment

Thanks @Odonno. Just a couple of updates needed to the validation logic, and rename the property to FcmOptions.

Loading

/// </summary>
internal WebpushFcmOptions CopyAndValidate()
{
if (this.Link != null && !this.Link.StartsWith("https"))
Copy link
Member

@hiranya911 hiranya911 Jun 3, 2019

Choose a reason for hiding this comment

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

Create the copy first and then run validation on that.

var copy = ...;

if (copy.Link != null && !copy.Link.StartsWuth("https://")
{

}

Loading

/// </summary>
internal WebpushFcmOptions CopyAndValidate()
{
if (this.Link != null && !this.Link.StartsWith("https"))
Copy link
Member

@hiranya911 hiranya911 Jun 3, 2019

Choose a reason for hiding this comment

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

Can we also check the well-formedness of the URL by running Uri.IsWellFormedUriString(copy.Link, UriKind.Absolute)?

Loading

/// Gets or sets the Webpush options that will be included in the message.
/// </summary>
[JsonProperty("fcm_options")]
public WebpushFcmOptions Options { get; set; }
Copy link
Member

@hiranya911 hiranya911 Jun 3, 2019

Choose a reason for hiding this comment

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

I missed this in my previous review. Lets rename this property to FcmOptions to be consistent with other languages (namely Node.js and Go).

Loading

@hiranya911 hiranya911 self-assigned this Jun 3, 2019
@Odonno
Copy link
Contributor Author

@Odonno Odonno commented Jun 3, 2019

@hiranya911 Thank you for your help on this.

Loading

Copy link
Member

@hiranya911 hiranya911 left a comment

Found a small bug in the new validation logic. I can merge once that's fixed.

Loading

FirebaseAdmin/FirebaseAdmin/Messaging/WebpushFcmOptions.cs Outdated Show resolved Hide resolved
Loading
Copy link
Member

@hiranya911 hiranya911 left a comment

LGTM 👍

Loading

@hiranya911 hiranya911 merged commit b54e7ea into firebase:master Jun 3, 2019
2 checks passed
Loading
@Odonno Odonno deleted the feat/fcm_options branch Jun 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants