-
Notifications
You must be signed in to change notification settings - Fork 26
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
Reset local device #1253
Reset local device #1253
Changes from 1 commit
a240961
c863d01
2fd8007
1294191
3db8d95
a414baa
ae91af8
a88c282
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -788,5 +788,12 @@ - (void)setAndPersistAPNSDeviceToken:(NSString *)deviceToken { | |
}); | ||
} | ||
|
||
- (void)resetDevice { | ||
dispatch_sync(ARTRestInternal.storageQueue, ^{ | ||
ARTLocalDevice *device = [self device_nosync]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My understanding of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Originally the caller in
So I thought that
Would be too much. I'm still not sure about this though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The difference is that the original There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
[device reset]; | ||
}); | ||
} | ||
|
||
@end | ||
#endif |
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 not 100% sure what the purpose of this new, synchronised storage is. But, just going by symmetry, would it not need to also include
setAndPersistIdentityTokenDetails:
?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.
It was discussed in slack here https://ably-real-time.slack.com/archives/CSQEKCE81/p1638465303293500?thread_ts=1638354865.280100&cid=CSQEKCE81
Agreed, but it wasn't used anywhere, so I decided to implement only the bare minimum.
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.
Sorry, perhaps I'm not understanding - what do you mean by "it wasn't used anywhere"?
setAndPersistIdentityTokenDetails
is still called inARTPushActivationState.m
.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.
OK, thanks for the link. I think I understand the motivation for the new queue a bit better now, but is it directly relevant to this PR, which is about resetting device details? It seems to me like it might be a separate change.
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.
Please see this comment #1253 (comment)
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.
Yes, I should inspect more places where storage queue access should be implemented, thanks.
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've spent a while trying to understand this storage queue better, but it might be best if we have a call to talk about it, to prevent this becoming a long back-and-forth. What do you think?
But, here's where my current thinking is at. I still don't understand why it's necessary to introduce a new queue in order to achieve the overall objective of this pull request. (Whether it's necessary for other reasons is a different matter.)
Looking at what's contained in the
ARTRestInternal (Storage)
category:apnsDeviceToken
/setAndPersistAPNSDeviceToken
– access to the APNS device token was not synchronised in the past, why does the fact that we might now reset the device introduce a need to synchronise it?resetDevice
– this method is already being called on a serial queue because it's only called inside a push activation state machine transition method, so why do we need an extra serial queue?It might be that, if you agree with my analysis that we don't need to put the device into an intermediate "reset" state, then some of this might simplify when you make that change, too.
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.
Sure, upon splitting this PR into two, this one is going to contain only the very first commit or so.
I agreed with the splitting this PR, we still need something that marks the device as "reset", no? Lets discuss it in a call.