feat(grcp): support MutableContent for ios (#332)

This commit is contained in:
Bo-Yi Wu 2018-01-16 11:26:45 +08:00 committed by GitHub
parent 4c203c9829
commit b0260af17b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 77 additions and 35 deletions

View File

@ -813,6 +813,7 @@ function main() {
request.setAlert(alert); request.setAlert(alert);
request.setThreadid("threadID"); request.setThreadid("threadID");
request.setContentavailable(false); request.setContentavailable(false);
request.setMutablecontent(false);
client.send(request, function (err, response) { client.send(request, function (err, response) {
if(err) { if(err) {
console.log(err); console.log(err);

View File

@ -19,6 +19,7 @@ function main() {
request.setAlert(alert); request.setAlert(alert);
request.setThreadid("threadID"); request.setThreadid("threadID");
request.setContentavailable(false); request.setContentavailable(false);
request.setMutablecontent(false);
client.send(request, function (err, response) { client.send(request, function (err, response) {
if(err) { if(err) {
console.log(err); console.log(err);

View File

@ -501,7 +501,8 @@ proto.proto.NotificationRequest.toObject = function(includeInstance, msg) {
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, ""), sound: jspb.Message.getFieldWithDefault(msg, 10, ""),
contentavailable: jspb.Message.getFieldWithDefault(msg, 11, false), contentavailable: jspb.Message.getFieldWithDefault(msg, 11, false),
threadid: jspb.Message.getFieldWithDefault(msg, 12, "") threadid: jspb.Message.getFieldWithDefault(msg, 12, ""),
mutablecontent: jspb.Message.getFieldWithDefault(msg, 13, false)
}; };
if (includeInstance) { if (includeInstance) {
@ -587,6 +588,10 @@ proto.proto.NotificationRequest.deserializeBinaryFromReader = function(msg, read
var value = /** @type {string} */ (reader.readString()); var value = /** @type {string} */ (reader.readString());
msg.setThreadid(value); msg.setThreadid(value);
break; break;
case 13:
var value = /** @type {boolean} */ (reader.readBool());
msg.setMutablecontent(value);
break;
default: default:
reader.skipField(); reader.skipField();
break; break;
@ -700,6 +705,13 @@ proto.proto.NotificationRequest.serializeBinaryToWriter = function(message, writ
f f
); );
} }
f = message.getMutablecontent();
if (f) {
writer.writeBool(
13,
f
);
}
}; };
@ -916,6 +928,23 @@ proto.proto.NotificationRequest.prototype.setThreadid = function(value) {
}; };
/**
* optional bool mutableContent = 13;
* 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.getMutablecontent = function() {
return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 13, false));
};
/** @param {boolean} value */
proto.proto.NotificationRequest.prototype.setMutablecontent = function(value) {
jspb.Message.setField(this, 13, value);
};
/** /**
* Generated by JsPbCodeGenerator. * Generated by JsPbCodeGenerator.

View File

@ -163,6 +163,7 @@ type NotificationRequest struct {
Sound string `protobuf:"bytes,10,opt,name=sound" json:"sound,omitempty"` Sound string `protobuf:"bytes,10,opt,name=sound" json:"sound,omitempty"`
ContentAvailable bool `protobuf:"varint,11,opt,name=contentAvailable" json:"contentAvailable,omitempty"` ContentAvailable bool `protobuf:"varint,11,opt,name=contentAvailable" json:"contentAvailable,omitempty"`
ThreadID string `protobuf:"bytes,12,opt,name=threadID" json:"threadID,omitempty"` ThreadID string `protobuf:"bytes,12,opt,name=threadID" json:"threadID,omitempty"`
MutableContent bool `protobuf:"varint,13,opt,name=mutableContent" json:"mutableContent,omitempty"`
} }
func (m *NotificationRequest) Reset() { *m = NotificationRequest{} } func (m *NotificationRequest) Reset() { *m = NotificationRequest{} }
@ -254,6 +255,13 @@ func (m *NotificationRequest) GetThreadID() string {
return "" return ""
} }
func (m *NotificationRequest) GetMutableContent() bool {
if m != nil {
return m.MutableContent
}
return false
}
type NotificationReply struct { type NotificationReply struct {
Success bool `protobuf:"varint,1,opt,name=success" json:"success,omitempty"` Success bool `protobuf:"varint,1,opt,name=success" json:"success,omitempty"`
Counts int32 `protobuf:"varint,2,opt,name=counts" json:"counts,omitempty"` Counts int32 `protobuf:"varint,2,opt,name=counts" json:"counts,omitempty"`
@ -458,40 +466,41 @@ var _Health_serviceDesc = grpc.ServiceDesc{
func init() { proto1.RegisterFile("gorush.proto", fileDescriptor0) } func init() { proto1.RegisterFile("gorush.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{ var fileDescriptor0 = []byte{
// 546 bytes of a gzipped FileDescriptorProto // 562 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x53, 0xcb, 0x8e, 0xda, 0x30, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x53, 0xcb, 0x8e, 0xda, 0x30,
0x14, 0x9d, 0x00, 0xe1, 0x71, 0xa1, 0x2d, 0xf5, 0x54, 0x95, 0xcb, 0x0a, 0x65, 0x85, 0xba, 0x60, 0x14, 0x9d, 0x00, 0xe1, 0x71, 0x61, 0xa6, 0xd4, 0x53, 0x55, 0x2e, 0x2b, 0x94, 0x45, 0x85, 0xba,
0x41, 0x77, 0x5d, 0x8c, 0x8a, 0xda, 0xd1, 0x0c, 0x9a, 0x2a, 0x23, 0x85, 0x3e, 0x96, 0x95, 0x31, 0x60, 0x41, 0x77, 0x5d, 0x8c, 0x8a, 0xa6, 0xa3, 0x19, 0x34, 0x55, 0x46, 0x0a, 0x7d, 0x2c, 0x2b,
0x9e, 0x10, 0x61, 0xe2, 0x34, 0x76, 0x46, 0xe2, 0x3b, 0xfa, 0x09, 0xfd, 0xa6, 0xfe, 0x4f, 0xe5, 0x63, 0x3c, 0x21, 0xc2, 0xc4, 0x69, 0xec, 0x8c, 0xc4, 0x77, 0xf4, 0x13, 0xfa, 0x9d, 0x95, 0x2a,
0xeb, 0x98, 0x82, 0xca, 0xac, 0xe2, 0x73, 0xee, 0xc3, 0xc7, 0xe7, 0xde, 0xc0, 0x20, 0x55, 0x65, 0x5f, 0x27, 0x94, 0xb4, 0x74, 0x15, 0x9f,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e, 0xca, 0x26, 0xaf, 0x4e, 0x3d, 0xc5, 0x75, 0x1a, 0xfd, 0xff, 0x95,
0xab, 0x36, 0x86, 0xde, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xc3, 0xb1, 0x58, 0xde, 0x64, 0x04,
0x00, 0x00, 0x00, 0x00,
} }

View File

@ -28,6 +28,7 @@ message NotificationRequest {
string sound = 10; string sound = 10;
bool contentAvailable = 11; bool contentAvailable = 11;
string threadID = 12; string threadID = 12;
bool mutableContent = 13;
} }
message NotificationReply { message NotificationReply {

View File

@ -60,6 +60,7 @@ func (s *Server) Send(ctx context.Context, in *proto.NotificationRequest) (*prot
Sound: in.Sound, Sound: in.Sound,
ContentAvailable: in.ContentAvailable, ContentAvailable: in.ContentAvailable,
ThreadID: in.ThreadID, ThreadID: in.ThreadID,
MutableContent: in.MutableContent,
} }
if badge > 0 { if badge > 0 {