-
Notifications
You must be signed in to change notification settings - Fork 500
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
Location sharing: Support restarting location sending after app kill (PSF-1036) #6200
Conversation
📱 Scan the QR code below to install the build for this PR. If you can't scan the QR code you can install the build via this link: https://i.diawi.com/duM6Qd |
} | ||
|
||
return self.session.locationService.getBeaconInfoSummaries(for: userId).filter { summary in | ||
return self.isDeviceBeaconInfoSummary(summary) && summary.isActive |
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.
Does this need to be weak? Also if I am reading this correctly we are calling isDeviceBeaconInfoSummary
twice when restoring, once when getExistingDeviceBeaconSummaries
and second time when didReceiveDeviceNewBeaconInfoSummary
is called for the same session. Should both methods be responsible for making this check?
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.
Does this need to be weak?
You mean: private let session: MXSession
needs to be weak?
if I am reading this correctly we are calling isDeviceBeaconInfoSummary twice when restoring
In fact in didReceiveBeaconInfoSummary
where we are listenning to every beacon info summaries we are checking isDeviceBeaconInfoSummary
and then call didReceiveDeviceNewBeaconInfoSummary
when we have a new BeaconInfoSummary that belongs to the device . But there is no further call to isDeviceBeaconInfoSummary
inside didReceiveDeviceNewBeaconInfoSummary
.
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.
You mean:
private let session: MXSession
needs to be weak?
Ah its a filter
, not an escaping callback, so ignore this.
In fact in
didReceiveBeaconInfoSummary
where we are listenning to every beacon info summaries we are checkingisDeviceBeaconInfoSummary
and then calldidReceiveDeviceNewBeaconInfoSummary
when we have a new BeaconInfoSummary that belongs to the device . But there is no further call toisDeviceBeaconInfoSummary
insidedidReceiveDeviceNewBeaconInfoSummary
.
You're right, I was confused by the similarity of didReceiveBeaconInfoSummary
and didReceiveDeviceNewBeaconInfoSummary
(or rather not noticing the second method)
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.
No problem I admit the that the two function names are closed
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.
This whole thing looks awesome! 👏
private func setupDeviceBeaconSummaries() { | ||
let existingDeviceBeaconInfoSummaries = self.getExistingDeviceBeaconSummaries() | ||
|
||
self.deviceBeaconInfoSummaries = existingDeviceBeaconInfoSummaries |
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 you can get rid of the local existingDeviceBeaconInfoSummaries
. The self.
s too, here and in a lot of other places.
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 we should probably define some SwiftLint
rules to decide or not to get rid of self.
and all use the same convention. I have 50 self.
in this file 😅
Part of #6199
Requires matrix-org/matrix-ios-sdk#1474