5982: Clean code and add tests

This commit is contained in:
MaximeE
2022-04-11 10:55:23 +02:00
parent 29bb3a4a68
commit a3758731b9
10 changed files with 93 additions and 134 deletions
@@ -21,7 +21,6 @@ import CoreLocation
@available(iOS 14.0, *)
enum MockLocationSharingScreenState: MockScreenState, CaseIterable {
case shareUserLocation
case displayExistingLocation
var screenType: Any.Type {
LocationSharingView.self
@@ -29,16 +28,9 @@ enum MockLocationSharingScreenState: MockScreenState, CaseIterable {
var screenView: ([Any], AnyView) {
var location: CLLocationCoordinate2D?
if self == .displayExistingLocation {
location = CLLocationCoordinate2D(latitude: 51.4932641, longitude: -0.257096)
}
let mapStyleURL = URL(string: "https://api.maptiler.com/maps/streets/style.json?key=fU3vlMsMn4Jb6dnEIFsx")!
let viewModel = LocationSharingViewModel(mapStyleURL: mapStyleURL,
avatarData: AvatarInput(mxContentUri: "", matrixItemId: "alice:matrix.org", displayName: "Alice"),
location: location,
coordinateType: .user,
isLiveLocationSharingEnabled: true)
return ([viewModel],
AnyView(LocationSharingView(context: viewModel.context)