Skip to content
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

Merged
merged 3 commits into from
May 31, 2022

Conversation

SBiOSoftWhare
Copy link
Contributor

@SBiOSoftWhare SBiOSoftWhare commented May 24, 2022

@github-actions
Copy link

github-actions bot commented May 24, 2022

📱 Scan the QR code below to install the build for this PR.
🔒 This build is for internal testing purpose. Only devices listed in the ad-hoc provisioning profile can install Element Alpha.

QR code

If you can't scan the QR code you can install the build via this link: https://i.diawi.com/duM6Qd

@SBiOSoftWhare SBiOSoftWhare requested review from a team, stefanceriu and Anderas and removed request for a team May 24, 2022 15:21
}

return self.session.locationService.getBeaconInfoSummaries(for: userId).filter { summary in
return self.isDeviceBeaconInfoSummary(summary) && summary.isActive
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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 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.

You're right, I was confused by the similarity of didReceiveBeaconInfoSummary and didReceiveDeviceNewBeaconInfoSummary (or rather not noticing the second method)

Copy link
Contributor Author

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

Copy link
Member

@stefanceriu stefanceriu left a 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
Copy link
Member

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.

Copy link
Contributor Author

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 😅

@SBiOSoftWhare SBiOSoftWhare merged commit 3f2ed75 into develop May 31, 2022
@SBiOSoftWhare SBiOSoftWhare deleted the steve/6199_persist_beacon_summary branch May 31, 2022 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants