diff --git a/README.md b/README.md index a1936f5..344a4dc 100644 --- a/README.md +++ b/README.md @@ -771,6 +771,7 @@ func main() { Message: "test message", Badge: 1, Category: "test", + Sound: "test", Alert: &proto.Alert{ Title: "Test Title", Body: "Test Alert Body", @@ -805,6 +806,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) { @@ -854,6 +856,7 @@ func main() { Message: "test message", Badge: 1, Category: "test", + Sound: "test", Alert: &proto.Alert{ Title: "Test Title", Body: "Test Alert Body", diff --git a/rpc/example/go/send/main.go b/rpc/example/go/send/main.go index d72d9a6..8e338e7 100644 --- a/rpc/example/go/send/main.go +++ b/rpc/example/go/send/main.go @@ -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", diff --git a/rpc/example/node/client.js b/rpc/example/node/client.js index 6243c2f..3e1889d 100644 --- a/rpc/example/node/client.js +++ b/rpc/example/node/client.js @@ -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) { diff --git a/rpc/example/node/gorush_pb.js b/rpc/example/node/gorush_pb.js index 1d543d0..4003ee5 100644 --- a/rpc/example/node/gorush_pb.js +++ b/rpc/example/node/gorush_pb.js @@ -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. diff --git a/rpc/proto/gorush.pb.go b/rpc/proto/gorush.pb.go index 20f4ffd..38900b1 100644 --- a/rpc/proto/gorush.pb.go +++ b/rpc/proto/gorush.pb.go @@ -104,6 +104,7 @@ type NotificationRequest struct { Badge int32 `protobuf:"varint,7,opt,name=badge" json:"badge,omitempty"` Category string `protobuf:"bytes,8,opt,name=category" json:"category,omitempty"` Alert *Alert `protobuf:"bytes,9,opt,name=alert" json:"alert,omitempty"` + Sound string `protobuf:"bytes,10,opt,name=sound" json:"sound,omitempty"` } func (m *NotificationRequest) Reset() { *m = NotificationRequest{} } @@ -174,6 +175,13 @@ func (m *NotificationRequest) GetAlert() *Alert { return nil } +func (m *NotificationRequest) GetSound() string { + if m != nil { + return m.Sound + } + return "" +} + type NotificationReply struct { Success bool `protobuf:"varint,1,opt,name=success" json:"success,omitempty"` Counts int32 `protobuf:"varint,2,opt,name=counts" json:"counts,omitempty"` @@ -378,32 +386,33 @@ var _Health_serviceDesc = grpc.ServiceDesc{ func init() { proto1.RegisterFile("gorush.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 424 bytes of a gzipped FileDescriptorProto + // 433 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xcf, 0x8e, 0xd3, 0x30, - 0x10, 0xc6, 0x37, 0xdb, 0x26, 0x6d, 0xa7, 0x0b, 0x94, 0x59, 0x84, 0x4c, 0x4f, 0x95, 0x4f, 0x3d, - 0xf5, 0x50, 0x6e, 0x1c, 0x56, 0x20, 0xb4, 0xda, 0x45, 0x88, 0xac, 0xe4, 0xf2, 0xe7, 0x88, 0x1c, - 0xd7, 0x9b, 0x46, 0xcd, 0xc6, 0x21, 0x76, 0x90, 0xf2, 0x1c, 0x3c, 0x2c, 0x57, 0x64, 0x3b, 0x5e, - 0xa8, 0x14, 0x4e, 0xf1, 0x6f, 0x66, 0x3c, 0x33, 0xdf, 0x17, 0xc3, 0x45, 0xae, 0x9a, 0x56, 0x1f, - 0x36, 0x75, 0xa3, 0x8c, 0xc2, 0xd8, 0x7d, 0xe8, 0x27, 0x88, 0xdf, 0x95, 0xb2, 0x31, 0xf8, 0x02, - 0x62, 0x53, 0x98, 0x52, 0x92, 0x68, 0x15, 0xad, 0x67, 0xcc, 0x03, 0x22, 0x8c, 0x33, 0xb5, 0xef, - 0xc8, 0xb9, 0x0b, 0xba, 0x33, 0x2e, 0x61, 0xaa, 0xdb, 0xcc, 0x17, 0x8f, 0x5c, 0xfc, 0x91, 0xe9, - 0xef, 0x08, 0x2e, 0x53, 0x65, 0x8a, 0xfb, 0x42, 0x70, 0x53, 0xa8, 0x8a, 0xc9, 0x1f, 0xad, 0xd4, - 0x06, 0x5f, 0x42, 0x62, 0xd4, 0x51, 0x56, 0x9a, 0x44, 0xab, 0xd1, 0x7a, 0xc6, 0x7a, 0xb2, 0xbd, - 0xea, 0x92, 0x9b, 0x7b, 0xd5, 0x3c, 0xb8, 0x19, 0x31, 0x7b, 0x64, 0x24, 0x30, 0x79, 0x90, 0x5a, - 0xf3, 0x3c, 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xc3, 0x4d, 0xe3, 0x85, + 0x9f, 0x6e, 0x56, 0xdd, 0x26, 0x3d, 0xb5, 0xeb, 0xad, 0xed, 0x55, 0x66, 0x5b, 0x57, 0xcf, 0xba, + 0x7b, 0xf4, 0x0d, 0x3c, 0x39, 0x4b, 0xe0, 0x0c, 0xc6, 0x5f, 0xd2, 0x8f, 0xe9, 0xfd, 0xb7, 0x74, + 0x7e, 0x61, 0x61, 0x7b, 0xc3, 0xbe, 0x7e, 0x48, 0x6f, 0xe7, 0x11, 0x3e, 0x83, 0x59, 0x7a, 0xff, + 0xf9, 0x7b, 0x08, 0x0c, 0x36, 0x77, 0x90, 0xdc, 0xba, 0x27, 0x88, 0xd7, 0x30, 0xda, 0xca, 0x72, + 0x8f, 0x8b, 0x4e, 0xbf, 0xe7, 0xc9, 0x2c, 0x48, 0x6f, 0xae, 0x2a, 0x5a, 0x7a, 0x61, 0x3b, 0xf9, + 0x91, 0xf1, 0x1a, 0x62, 0x37, 0x36, 0xbe, 0xea, 0x5b, 0xc5, 0x77, 0x5a, 0xfc, 0x7f, 0xcb, 0x5d, + 0xe2, 0x52, 0xaf, 0xff, 0x04, 0x00, 0x00, 0xff, 0xff, 0xa8, 0xf6, 0xa7, 0x4d, 0x1d, 0x03, 0x00, + 0x00, } diff --git a/rpc/proto/gorush.proto b/rpc/proto/gorush.proto index bbdaacc..46671c9 100644 --- a/rpc/proto/gorush.proto +++ b/rpc/proto/gorush.proto @@ -18,6 +18,7 @@ message NotificationRequest { int32 badge = 7; string category = 8; Alert alert = 9; + string sound = 10; } message NotificationReply { diff --git a/rpc/server.go b/rpc/server.go index 0f0d423..a2eb6c2 100644 --- a/rpc/server.go +++ b/rpc/server.go @@ -57,6 +57,7 @@ func (s *Server) Send(ctx context.Context, in *proto.NotificationRequest) (*prot Topic: in.Topic, APIKey: in.Key, Category: in.Category, + Sound: in.Sound, } if badge > 0 {