Update notification PR as per feedback
This commit is contained in:
parent
7eb14243eb
commit
3774482859
4 changed files with 9 additions and 9 deletions
|
@ -126,7 +126,7 @@ void Notification::SetHasReply(bool new_has_reply) {
|
|||
}
|
||||
|
||||
void Notification::SetActions(
|
||||
const std::vector<brightray::NotificationAction> actions) {
|
||||
const std::vector<brightray::NotificationAction>& actions) {
|
||||
actions_ = actions;
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ class Notification : public mate::TrackableObject<Notification>,
|
|||
void SetSilent(bool new_silent);
|
||||
void SetReplyPlaceholder(const base::string16& new_reply_placeholder);
|
||||
void SetHasReply(bool new_has_reply);
|
||||
void SetActions(const std::vector<brightray::NotificationAction> actions);
|
||||
void SetActions(const std::vector<brightray::NotificationAction>& actions);
|
||||
|
||||
private:
|
||||
base::string16 title_;
|
||||
|
|
|
@ -33,7 +33,7 @@ class CocoaNotification : public Notification {
|
|||
|
||||
private:
|
||||
base::scoped_nsobject<NSUserNotification> notification_;
|
||||
int actionIndex_;
|
||||
int action_index_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CocoaNotification);
|
||||
};
|
||||
|
|
|
@ -44,14 +44,14 @@ void CocoaNotification::Show(const NotificationOptions& options) {
|
|||
|
||||
[notification_ setHasActionButton:false];
|
||||
|
||||
for (size_t i = 0; i < options.actions.size(); i++) {
|
||||
NotificationAction action = options.actions[i];
|
||||
|
||||
if (action.type == base::UTF8ToUTF16("button")) {
|
||||
int i = 0;
|
||||
for (const auto& action : options.actions) {
|
||||
if (action.type == base::ASCIIToUTF16("button")) {
|
||||
[notification_ setHasActionButton:true];
|
||||
[notification_ setActionButtonTitle:base::SysUTF16ToNSString(action.text)];
|
||||
actionIndex_ = i;
|
||||
action_index_ = i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if (options.has_reply) {
|
||||
|
@ -82,7 +82,7 @@ void CocoaNotification::NotificationReplied(const std::string& reply) {
|
|||
|
||||
void CocoaNotification::NotificationButtonClicked() {
|
||||
if (delegate())
|
||||
delegate()->NotificationAction(actionIndex_);
|
||||
delegate()->NotificationAction(action_index_);
|
||||
}
|
||||
|
||||
} // namespace brightray
|
||||
|
|
Loading…
Add table
Reference in a new issue