Review CommentZ.

This commit is contained in:
Charlie Hess 2017-08-21 13:53:50 -07:00
parent 2b9b186fd1
commit db081d95d5
No known key found for this signature in database
GPG key ID: 12C6D6B5324956AB
3 changed files with 21 additions and 6 deletions

View file

@ -114,7 +114,7 @@ std::vector<brightray::NotificationAction> Notification::GetActions() const {
return actions_; return actions_;
} }
base::string16 Notification::GetSoundName() const { base::string16 Notification::GetSound() const {
return sound_; return sound_;
} }
@ -148,7 +148,7 @@ void Notification::SetActions(
actions_ = actions; actions_ = actions;
} }
void Notification::SetSoundName(const base::string16& new_sound) { void Notification::SetSound(const base::string16& new_sound) {
sound_ = new_sound; sound_ = new_sound;
} }
@ -218,8 +218,8 @@ void Notification::BuildPrototype(v8::Isolate* isolate,
&Notification::SetHasReply) &Notification::SetHasReply)
.SetProperty("actions", &Notification::GetActions, .SetProperty("actions", &Notification::GetActions,
&Notification::SetActions) &Notification::SetActions)
.SetProperty("soundName", &Notification::GetSoundName, .SetProperty("sound", &Notification::GetSound,
&Notification::SetSoundName); &Notification::SetSound);
} }
} // namespace api } // namespace api

View file

@ -54,7 +54,7 @@ class Notification : public mate::TrackableObject<Notification>,
base::string16 GetReplyPlaceholder() const; base::string16 GetReplyPlaceholder() const;
bool GetHasReply() const; bool GetHasReply() const;
std::vector<brightray::NotificationAction> GetActions() const; std::vector<brightray::NotificationAction> GetActions() const;
base::string16 GetSoundName() const; base::string16 GetSound() const;
// Prop Setters // Prop Setters
void SetTitle(const base::string16& new_title); void SetTitle(const base::string16& new_title);
@ -64,7 +64,7 @@ class Notification : public mate::TrackableObject<Notification>,
void SetReplyPlaceholder(const base::string16& new_reply_placeholder); void SetReplyPlaceholder(const base::string16& new_reply_placeholder);
void SetHasReply(bool new_has_reply); void SetHasReply(bool new_has_reply);
void SetActions(const std::vector<brightray::NotificationAction>& actions); void SetActions(const std::vector<brightray::NotificationAction>& actions);
void SetSoundName(const base::string16& sound); void SetSound(const base::string16& sound);
private: private:
base::string16 title_; base::string16 title_;

View file

@ -103,3 +103,18 @@ Immediately shows the notification to the user, please note this means unlike th
HTML5 Notification implementation, simply instantiating a `new Notification` does HTML5 Notification implementation, simply instantiating a `new Notification` does
not immediately show it to the user, you need to call this method before the OS not immediately show it to the user, you need to call this method before the OS
will display it. will display it.
### Playing Sounds _macOS_
On macOS, you can specify the name of the sound you'd like to play when the
notification is shown. Any of the default sounds (under System Preferences >
Sound) can be used, in addition to custom sound files. Be sure that the sound
file is included with the app bundle (e.g., `YourApp.app/Contents/Resources`),
or copied into one of the following locations:
* `~/Library/Sounds`
* `/Library/Sounds`
* `/Network/Library/Sounds`
* `/System/Library/Sounds`
See the [`NSSound`](https://developer.apple.com/documentation/appkit/nssound) docs for more information.