[go: nahoru, domu]

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

Add latest HTTP v1 options #153

Closed
jwoodwardtfx opened this issue Feb 27, 2020 · 10 comments · Fixed by #317
Closed

Add latest HTTP v1 options #153

jwoodwardtfx opened this issue Feb 27, 2020 · 10 comments · Fixed by #317
Labels
help wanted Extra attention is needed type: feature request A new feature API is requested

Comments

@jwoodwardtfx
Copy link

It seems there are a lot of newer options for FCM not available in the .NET Firebase Admin (see
https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#AndroidNotification).

Specifically the newer options for AndroidNotifications. The current class ends at "channel_id", however the following are now available:

"ticker": string,
"sticky": boolean,
"event_time": string,
"local_only": boolean,
"notification_priority": enum (NotificationPriority),
"default_sound": boolean,
"default_vibrate_timings": boolean,
"default_light_settings": boolean,
"vibrate_timings": [
string
],
"visibility": enum (Visibility),
"notification_count": integer,
"light_settings": {
object (LightSettings)
},
"image": string

Is there any plan to add support for these?

@hiranya911
Copy link
Contributor

They will be added eventually. Feel free to send a PR in the meantime. Following API signatures have been proposed to expose these options in .NET:

public sealed class AndroidNotification
{
    public enum Priority
    {
        MIN,
        LOW,
        DEFAULT,
        HIGH,
        MAX,
    }

    public enum Visibility
    {
        PRIVATE,
        PUBLIC,
        SECRET,
    }

    [JsonProperty("title")]
    public string Title { get; set; }

    [JsonProperty("body")]
    public string Body { get; set; }

    [JsonProperty("icon")]
    public string Icon { get; set; }

    [JsonProperty("color")]
    public string Color { get; set; }

    [JsonProperty("sound")]
    public string Sound { get; set; }

    [JsonProperty("tag")]
    public string Tag { get; set; }

    [JsonProperty("image")]
    public string ImageUrl { get; set; }

    [JsonProperty("click_action")]
    public string ClickAction { get; set; }

    [JsonProperty("title_loc_key")]
    public string TitleLocKey { get; set; }

    [JsonProperty("title_loc_args")]
    public IEnumerable<string> TitleLocArgs { get; set; }

    [JsonProperty("body_loc_key")]
    public string BodyLocKey { get; set; }

    [JsonProperty("body_loc_args")]
    public IEnumerable<string> BodyLocArgs { get; set; }

    [JsonProperty("channel_id")]
    public string ChannelId { get; set; }

    [JsonProperty("ticker")]
    public string Ticker { get; set; }

    [JsonProperty("sticky")]
    public bool Sticky { get; set; }

    [JsonProperty("event_time")]
    public DateTime EventTimestamp { get; set; }

    [JsonProperty("local_only")]
    public bool LocalOnly { get; set; }

    [JsonProperty("priority")]
    public AndroidNotification.Priority? Priority { get; set; }

    [JsonProperty("vibrate_timings")]
    public long[] VibrateTimingsMillis { get; set; }

    [JsonProperty("default_vibrate_timings")]
    public bool DefaultVibrateTimings { get; set; }

    [JsonProperty("default_sound")]
    public bool DefaultSound { get; set; }

    [JsonProperty("light_settings")]
    public LightSettings LightSettings { get; set; }

    [JsonProperty("default_light_settings")]
    public bool DefaultLightSettings { get; set; }

    [JsonProperty("visibility")]
    public AndroidNotification.Visibility? Visibility { get; set; }

    [JsonProperty("notification_count")]
    public int? NotificationCount { get; set; }
}

// Add new class for LightSettings

public sealed class LightSettings
{
    [JsonProperty("color")]
    public string Color { get; set; }

    [JsonProperty("light_on_duration")]
    public long LightOnDurationMillis { get; set; }

    [JsonProperty("light_off_durtaion")]
    public long LightOffDurationMillis { get; set; }
}

@hiranya911 hiranya911 added help wanted Extra attention is needed type: feature request A new feature API is requested labels Feb 27, 2020
@levimatheri
Copy link
Contributor

Is anyone working on this, or can I take a stab at it?

@hiranya911
Copy link
Contributor

@levimatheri nobody's working on it afaik. Feel free to provide a PR :)

@JesperNJessen
Copy link

Is there some way of adding the "title_loc_key" to the base Notification object? It seems to be needed for iOS localization of messages as described here:

https://github.com/CrossGeeks/FirebasePushNotificationPlugin/blob/master/docs/LocalizedFirebasePushNotifications.md

Snippet:

Finally, when sending the payload would look like this:
{
     "notification": {
            "title_loc_key" : "NOTIFICATION_TITLE",
            "body_loc_key" : "NOTIFICATION_MESSAGE"
     },
     "priority": "high",
     "condition": "'general' in topics"
}

It doesn't seem to work when using the AndroidConfig class.

@WillooWisp
Copy link
WillooWisp commented Nov 10, 2021

Is anyone working on this, or can I take a stab at it?

@levimatheri Did you make any progress on a PR for this?

@WillooWisp
Copy link

@hiranya911 seems like even after a year, nothing has happened to making the payload feature complete with v1, why? Is this package deprecated?

@levimatheri
Copy link
Contributor

@WillooWisp I had submitted a PR here a while back.

@WillooWisp
Copy link
WillooWisp commented Nov 11, 2021

@hiranya911 and @lahirumaramba why is the PR above not being merge, when you requested it over a year ago?

Please make a new NuGet release with this included.

lahirumaramba pushed a commit that referenced this issue Nov 11, 2021
* Add additional FCM Android notification options

* Add additional FCM Android notification options
@lahirumaramba
Copy link
Member

@WillooWisp Thank you for pointing this out! Apologies for the delay, we have started the review process. Stay tuned for an update on the release.

lahirumaramba added a commit that referenced this issue Mar 15, 2022
* Closes #153. Add additional FCM options for Android Notification (#203)

* Add additional FCM Android notification options

* Add additional FCM Android notification options

* Update API to match the approved changes

* Trigger CI

* Move enum types out of the nested class

* Fix docs

Co-authored-by: levimatheri <levimatheri@gmail.com>
@lahirumaramba
Copy link
Member

This feature is now available in v2.3.0. Thank you for your patience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed type: feature request A new feature API is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants