diff --git a/router/server_lambda.go b/router/server_lambda.go index 0a186da..2251546 100644 --- a/router/server_lambda.go +++ b/router/server_lambda.go @@ -1,3 +1,4 @@ +//go:build lambda // +build lambda package router diff --git a/router/server_normal.go b/router/server_normal.go index 3f52e89..a7dbe9b 100644 --- a/router/server_normal.go +++ b/router/server_normal.go @@ -1,3 +1,4 @@ +//go:build !lambda // +build !lambda package router diff --git a/rpc/proto/gorush.pb.go b/rpc/proto/gorush.pb.go index e22570f..bf1cfac 100644 --- a/rpc/proto/gorush.pb.go +++ b/rpc/proto/gorush.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.25.0-devel -// protoc v3.14.0 +// protoc-gen-go v1.27.1 +// protoc v3.17.3 // source: gorush.proto package proto @@ -257,6 +257,7 @@ type NotificationRequest struct { Data *structpb.Struct `protobuf:"bytes,14,opt,name=data,proto3" json:"data,omitempty"` Image string `protobuf:"bytes,15,opt,name=image,proto3" json:"image,omitempty"` Priority NotificationRequest_Priority `protobuf:"varint,16,opt,name=priority,proto3,enum=proto.NotificationRequest_Priority" json:"priority,omitempty"` + ID string `protobuf:"bytes,17,opt,name=ID,proto3" json:"ID,omitempty"` } func (x *NotificationRequest) Reset() { @@ -403,6 +404,13 @@ func (x *NotificationRequest) GetPriority() NotificationRequest_Priority { return NotificationRequest_NORMAL } +func (x *NotificationRequest) GetID() string { + if x != nil { + return x.ID + } + return "" +} + type NotificationReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -576,7 +584,7 @@ var file_gorush_proto_rawDesc = []byte{ 0x6f, 0x63, 0x41, 0x72, 0x67, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6c, 0x6f, 0x63, 0x41, 0x72, 0x67, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x41, 0x72, 0x67, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x69, 0x74, - 0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x41, 0x72, 0x67, 0x73, 0x22, 0xa3, 0x04, 0x0a, 0x13, 0x4e, 0x6f, + 0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x41, 0x72, 0x67, 0x73, 0x22, 0xb3, 0x04, 0x0a, 0x13, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, @@ -608,7 +616,8 @@ var file_gorush_proto_rawDesc = []byte{ 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x69, 0x6f, 0x72, - 0x69, 0x74, 0x79, 0x52, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x20, 0x0a, + 0x69, 0x74, 0x79, 0x52, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x0e, 0x0a, + 0x02, 0x49, 0x44, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x22, 0x20, 0x0a, 0x08, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x49, 0x47, 0x48, 0x10, 0x01, 0x22, 0x45, 0x0a, 0x11, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, @@ -637,7 +646,8 @@ var file_gorush_proto_rawDesc = []byte{ 0x6f, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/rpc/proto/gorush.proto b/rpc/proto/gorush.proto index 7181c66..b868155 100644 --- a/rpc/proto/gorush.proto +++ b/rpc/proto/gorush.proto @@ -3,6 +3,8 @@ import "google/protobuf/struct.proto"; package proto; +// option go_package = "./;proto"; + message Alert { string title = 1; string body = 2; @@ -37,6 +39,7 @@ message NotificationRequest { HIGH = 1; } Priority priority = 16; + string ID = 17; } message NotificationReply { diff --git a/rpc/server.go b/rpc/server.go index d688315..421ebab 100644 --- a/rpc/server.go +++ b/rpc/server.go @@ -56,6 +56,7 @@ func (s *Server) Check(ctx context.Context, in *proto.HealthCheckRequest) (*prot func (s *Server) Send(ctx context.Context, in *proto.NotificationRequest) (*proto.NotificationReply, error) { badge := int(in.Badge) notification := notify.PushNotification{ + ID: in.ID, Platform: int(in.Platform), Tokens: in.Tokens, Message: in.Message,