mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 03:06:37 +00:00
5724e65d8e
Groundwork for loading MapLibre on demand. The map view is about to move into its own framework, and both sides need to agree on the types that cross the boundary, so ShowUserLocationMode and MapLibreError move out of the app into a small framework that the app links.
36 lines
1.2 KiB
Swift
36 lines
1.2 KiB
Swift
//
|
|
// Copyright 2026 Element Creations Ltd.
|
|
// Copyright 2023-2025 New Vector Ltd.
|
|
//
|
|
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
|
// Please see LICENSE files in the repository root for full details.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
/**
|
|
Behavior mode of the current user's location, can be hidden, only shown and shown following the user
|
|
*/
|
|
public enum ShowUserLocationMode: Equatable {
|
|
/// this mode will show the user pin in map
|
|
case show
|
|
/// this mode will show the user pin in map and track him, panning the map automatically
|
|
case showAndFollow
|
|
/// this mode will not show the user pin in map
|
|
case hide
|
|
/// this mode will not show the user pin in map and will follow the marker with the given id,
|
|
/// panning the map automatically.
|
|
case hideAndFollowMarker(id: String)
|
|
|
|
/// The id of the marker the map should follow when in the `hideAndFollowMarker` mode, nil otherwise.
|
|
public var followedMarkerID: String? {
|
|
guard case .hideAndFollowMarker(let id) = self else { return nil }
|
|
return id
|
|
}
|
|
}
|
|
|
|
public enum MapLibreError: Error, Hashable {
|
|
case failedLoadingMap
|
|
case failedLocatingUser
|
|
}
|