feat(grpc): support ThreadID and ContentAvailable (#328)

This commit is contained in:
Bo-Yi Wu
2018-01-10 09:36:27 +08:00
committed by GitHub
parent ffd78ffaec
commit 4c203c9829
6 changed files with 135 additions and 52 deletions

View File

@@ -17,6 +17,8 @@ function main() {
request.setSound("sound")
alert.setTitle("title");
request.setAlert(alert);
request.setThreadid("threadID");
request.setContentavailable(false);
client.send(request, function (err, response) {
if(err) {
console.log(err);

View File

@@ -499,7 +499,9 @@ proto.proto.NotificationRequest.toObject = function(includeInstance, msg) {
badge: jspb.Message.getFieldWithDefault(msg, 7, 0),
category: jspb.Message.getFieldWithDefault(msg, 8, ""),
alert: (f = msg.getAlert()) && proto.proto.Alert.toObject(includeInstance, f),
sound: jspb.Message.getFieldWithDefault(msg, 10, "")
sound: jspb.Message.getFieldWithDefault(msg, 10, ""),
contentavailable: jspb.Message.getFieldWithDefault(msg, 11, false),
threadid: jspb.Message.getFieldWithDefault(msg, 12, "")
};
if (includeInstance) {
@@ -577,6 +579,14 @@ proto.proto.NotificationRequest.deserializeBinaryFromReader = function(msg, read
var value = /** @type {string} */ (reader.readString());
msg.setSound(value);
break;
case 11:
var value = /** @type {boolean} */ (reader.readBool());
msg.setContentavailable(value);
break;
case 12:
var value = /** @type {string} */ (reader.readString());
msg.setThreadid(value);
break;
default:
reader.skipField();
break;
@@ -676,6 +686,20 @@ proto.proto.NotificationRequest.serializeBinaryToWriter = function(message, writ
f
);
}
f = message.getContentavailable();
if (f) {
writer.writeBool(
11,
f
);
}
f = message.getThreadid();
if (f.length > 0) {
writer.writeString(
12,
f
);
}
};
@@ -860,6 +884,38 @@ proto.proto.NotificationRequest.prototype.setSound = function(value) {
};
/**
* optional bool contentAvailable = 11;
* Note that Boolean fields may be set to 0/1 when serialized from a Java server.
* You should avoid comparisons like {@code val === true/false} in those cases.
* @return {boolean}
*/
proto.proto.NotificationRequest.prototype.getContentavailable = function() {
return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 11, false));
};
/** @param {boolean} value */
proto.proto.NotificationRequest.prototype.setContentavailable = function(value) {
jspb.Message.setField(this, 11, value);
};
/**
* optional string threadID = 12;
* @return {string}
*/
proto.proto.NotificationRequest.prototype.getThreadid = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 12, ""));
};
/** @param {string} value */
proto.proto.NotificationRequest.prototype.setThreadid = function(value) {
jspb.Message.setField(this, 12, value);
};
/**
* Generated by JsPbCodeGenerator.