element-ios/Riot/Categories/MXLocationService.swift

27 lines
837 B
Swift

//
// Copyright 2022-2024 New Vector Ltd.
//
// SPDX-License-Identifier: AGPL-3.0-only
// Please see LICENSE in the repository root for full details.
//
import Foundation
import MatrixSDK
extension MXLocationService {
public func isSomeoneSharingDisplayableLocation(inRoomWithId roomId: String) -> Bool {
return self.getDisplayableBeaconInfoSummaries(inRoomWithId: roomId).isEmpty == false
}
/// Get beacon info summaries that can be shown on a map
func getDisplayableBeaconInfoSummaries(inRoomWithId roomId: String) -> [MXBeaconInfoSummaryProtocol] {
let liveBeaconInfoSummaries = self.getLiveBeaconInfoSummaries(inRoomWithId: roomId)
return liveBeaconInfoSummaries.filter { beaconInfoSummary in
return beaconInfoSummary.isDisplayable
}
}
}