COVIDSafe code from version 1.6 (#6)

This commit is contained in:
COVIDSafe Support 2020-06-19 17:43:33 +10:00 committed by GitHub
parent 149daee2e9
commit 2063cea613
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 1963 additions and 1664 deletions

View file

@ -83,7 +83,13 @@ extension PeripheralController: CBPeripheralManagerDelegate {
DLog("\(["request": request] as AnyObject)")
EncounterMessageManager.shared.getAdvertisementPayload { (payloadToAdvertise) in
if let payload = payloadToAdvertise {
request.value = payload
// check offset
if request.offset > payload.count {
peripheral.respond(to: request, withResult: .invalidOffset)
return;
}
request.value = payload.advanced(by: request.offset)
peripheral.respond(to: request, withResult: .success)
} else {
DLog("Error getting payload to advertise")