-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Push notification implementation #1997
Conversation
Pull Request Checklist
|
Jenkins BuildsClick to see older builds (201)
|
b2830b9
to
ccd3234
Compare
faa1266
to
757b027
Compare
1b49065
to
619ac01
Compare
b49f0c4
to
45a5fe4
Compare
@Samyoul @jakubgs @andremedeiros I have updated the specs to the latest changes status-im/specs#146 |
5ca2c39
to
08dc687
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing job! 👏
I have a couple of comments around minor things, but super happy to see this shipping!
multiaccounts/accounts/database.go
Outdated
PreviewPrivacy bool `json:"preview-privacy?"` | ||
PublicKey string `json:"public-key"` | ||
// PushNotificationServerEnabled indicates whether we should be running a push notification server | ||
PushNotificationsServerEnabled bool `json:"push-notifications-server-enabled,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not being consistent on how we name boolean fields. See above with notifications-enabled?
. Can we decide on one and stay consistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should rename everything to camelCase, as now there's also desktop and these are all clojurisms, but I will make it consistent for now
ctx context.Context, | ||
recipient *ecdsa.PublicKey, | ||
rawMessage *RawMessage, | ||
) ([]byte, error) { | ||
p.logger.Debug( | ||
"sending a private message", | ||
zap.Binary("public-key", crypto.FromECDSAPub(recipient)), | ||
zap.String("public-key", types.EncodeHex(crypto.FromECDSAPub(recipient))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
// Currently we don't support sending through datasync and setting custom waku fields, | ||
// as the datasync interface is not rich enough to propagate that information, so we | ||
// would have to add some complexity to handle this. | ||
if rawMessage.ResendAutomatically && (rawMessage.Sender != nil || rawMessage.SkipEncryption) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check for p.features.Datasync
here too?
ctx context.Context, | ||
recipient *ecdsa.PublicKey, | ||
rawMessage *RawMessage, | ||
) ([]byte, error) { | ||
p.logger.Debug("sending private message", zap.Binary("recipient", crypto.FromECDSAPub(recipient))) | ||
p.logger.Debug("sending private message", zap.String("recipient", types.EncodeHex(crypto.FromECDSAPub(recipient)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
err := message.HandleEncryption(decryptionKey, publicKey, p.protocol, skipNegotiation) | ||
|
||
// if it's an ephemeral key, we don't have to handle a device not found error | ||
if err == encryption.ErrDeviceNotFound && !skipNegotiation { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm having a hard time seeing where this error comes from. In fact, this method only returns wrapped errors, which leads me to believe that the left condition would never evaluate to true.
cbf6ef8
to
b514b44
Compare
ef9fb43
to
4b8739a
Compare
I will be moving to work on emojii reactions, I will merge this and address the feedback in a separate PR. |
54ce2c0
to
c61bf0c
Compare
Implements push notification server & client.
The way it is implemented is that any client can just act as a push notification server, so you can run this on your android phone if you wish, as it's just a waku/whisper client.
I have heavily commented the code as the functioning is rather complex, the server is pretty straightforward, while the client is quite complicated.
Is not quite finished, there's still some things to handle and improved, but it's at a stage that is ready to be integrated.
There are full e2e tests of the functionalities in
protocol/push_notification_test.go
.I have left the commit split and committed often to ease the review process, it's quite a lot of code unfortunately.
I haven't quite updated the specs with the latest changes, I will do that tomorrow, but most of it is there: https://github.com/status-im/specs/blob/master/docs/raw/push-notification-server.md
UPDATE: specs PR status-im/specs#146
Things that have also changed:
common