chore(grpc): add sound field. (#325)

This commit is contained in:
Bo-Yi Wu
2018-01-04 11:31:03 +08:00
committed by GitHub
parent 651a2b76db
commit df45f85a1c
7 changed files with 71 additions and 28 deletions

View File

@@ -28,6 +28,7 @@ func main() {
Message: "test message",
Badge: 1,
Category: "test",
Sound: "test",
Alert: &proto.Alert{
Title: "Test Title",
Body: "Test Alert Body",

View File

@@ -14,6 +14,7 @@ function main() {
request.setTitle("hello2");
request.setBadge(2);
request.setCategory("mycategory");
request.setSound("sound")
alert.setTitle("title");
request.setAlert(alert);
client.send(request, function (err, response) {

View File

@@ -270,7 +270,8 @@ proto.proto.NotificationRequest.toObject = function(includeInstance, msg) {
key: jspb.Message.getFieldWithDefault(msg, 6, ""),
badge: jspb.Message.getFieldWithDefault(msg, 7, 0),
category: jspb.Message.getFieldWithDefault(msg, 8, ""),
alert: (f = msg.getAlert()) && proto.proto.Alert.toObject(includeInstance, f)
alert: (f = msg.getAlert()) && proto.proto.Alert.toObject(includeInstance, f),
sound: jspb.Message.getFieldWithDefault(msg, 10, "")
};
if (includeInstance) {
@@ -344,6 +345,10 @@ proto.proto.NotificationRequest.deserializeBinaryFromReader = function(msg, read
reader.readMessage(value,proto.proto.Alert.deserializeBinaryFromReader);
msg.setAlert(value);
break;
case 10:
var value = /** @type {string} */ (reader.readString());
msg.setSound(value);
break;
default:
reader.skipField();
break;
@@ -436,6 +441,13 @@ proto.proto.NotificationRequest.serializeBinaryToWriter = function(message, writ
proto.proto.Alert.serializeBinaryToWriter
);
}
f = message.getSound();
if (f.length > 0) {
writer.writeString(
10,
f
);
}
};
@@ -605,6 +617,21 @@ proto.proto.NotificationRequest.prototype.hasAlert = function() {
};
/**
* optional string sound = 10;
* @return {string}
*/
proto.proto.NotificationRequest.prototype.getSound = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 10, ""));
};
/** @param {string} value */
proto.proto.NotificationRequest.prototype.setSound = function(value) {
jspb.Message.setField(this, 10, value);
};
/**
* Generated by JsPbCodeGenerator.