Skip to content

Commit 7b73833

Browse files
authored
Merge pull request #247 from lennet/FixedIdentifiableAnnotation
Fixed delay for displaying Annotations on Map
2 parents 9b6ca37 + 2b08e87 commit 7b73833

File tree

5 files changed

+39
-2
lines changed

5 files changed

+39
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Changelog for Critical Maps iOS
44

55
## [Unreleased]
66

7+
### Fixed
8+
9+
- Fixed a Bug that caused a 12 second delay to display Riders on the Map after launching the App
10+
711
### Updated
812

913
- Cleaner BikeAnnotation appearance

CriticalMaps.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@
185185
98C1327B227B8FE600291FCA /* IdentifiableAnnnotation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98C1327A227B8FE600291FCA /* IdentifiableAnnnotation.swift */; };
186186
98C1328A227F05E700291FCA /* IDStoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98C13289227F05E700291FCA /* IDStoreTests.swift */; };
187187
98C4BEA12218518B0060E701 /* UserTrackingButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98C4BEA02218518B0060E701 /* UserTrackingButton.swift */; };
188+
98CE731924085E4A0088F7B4 /* IdentifiableAnnotationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98CE731824085E4A0088F7B4 /* IdentifiableAnnotationTests.swift */; };
188189
98DDF9E823D4F8E800E55BE7 /* MapOverlayErrorHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98DDF9E723D4F8E800E55BE7 /* MapOverlayErrorHandler.swift */; };
189190
98E7338A220394E7005F311F /* SettingsSwitchTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98E73388220394E7005F311F /* SettingsSwitchTableViewCell.swift */; };
190191
98E7338B220394E7005F311F /* SettingsSwitchTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 98E73389220394E7005F311F /* SettingsSwitchTableViewCell.xib */; };
@@ -415,6 +416,7 @@
415416
98C13288227F014000291FCA /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/InfoPlist.strings; sourceTree = "<group>"; };
416417
98C13289227F05E700291FCA /* IDStoreTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IDStoreTests.swift; sourceTree = "<group>"; };
417418
98C4BEA02218518B0060E701 /* UserTrackingButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserTrackingButton.swift; sourceTree = "<group>"; };
419+
98CE731824085E4A0088F7B4 /* IdentifiableAnnotationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IdentifiableAnnotationTests.swift; sourceTree = "<group>"; };
418420
98DDF9E723D4F8E800E55BE7 /* MapOverlayErrorHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapOverlayErrorHandler.swift; sourceTree = "<group>"; };
419421
98E73388220394E7005F311F /* SettingsSwitchTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsSwitchTableViewCell.swift; sourceTree = "<group>"; };
420422
98E73389220394E7005F311F /* SettingsSwitchTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SettingsSwitchTableViewCell.xib; sourceTree = "<group>"; };
@@ -802,6 +804,7 @@
802804
943ABD9322781F0200B7F07C /* ThemeStoreTests.swift */,
803805
982DA8D521FFAC0D00E2A51B /* TwitterManagerTests.swift */,
804806
988BF2F823F35C7100594C3F /* TwitterRequestTests.swift */,
807+
98CE731824085E4A0088F7B4 /* IdentifiableAnnotationTests.swift */,
805808
);
806809
path = CriticalMassTests;
807810
sourceTree = "<group>";
@@ -1349,6 +1352,7 @@
13491352
9804179021FCA2B40077D419 /* ChatManagerTests.swift in Sources */,
13501353
98ED2FDD22919BDD007F8A92 /* FriendsVerificationControllerTests.swift in Sources */,
13511354
982DA8D621FFAC0D00E2A51B /* TwitterManagerTests.swift in Sources */,
1355+
98CE731924085E4A0088F7B4 /* IdentifiableAnnotationTests.swift in Sources */,
13521356
981C920A2288B49D00391FA9 /* TestHelper.swift in Sources */,
13531357
943ABD9522781F0200B7F07C /* ThemeStoreTests.swift in Sources */,
13541358
943ABD9622781F0200B7F07C /* ThemeControllerTests.swift in Sources */,

CriticalMass/IdentifiableAnnnotation.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ class IdentifiableAnnnotation: MKPointAnnotation {
1919

2020
var location: Location {
2121
didSet {
22-
coordinate = CLLocationCoordinate2D(latitude: location.latitude, longitude: location.longitude)
22+
coordinate = CLLocationCoordinate2D(location)
2323
}
2424
}
2525

2626
init(location: Location, identifier: String) {
2727
self.identifier = identifier
2828
self.location = location
2929
super.init()
30+
coordinate = CLLocationCoordinate2D(location)
3031
}
3132
}

CriticalMass/SimulationNetworkDataProvider.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ class SimulationNetworkDataProvider: NetworkDataProvider {
1818

1919
func dataTask(with request: URLRequest, completionHandler: @escaping (Data?, URLResponse?, Error?) -> Void) {
2020
guard let url = request.url,
21-
url.absoluteString == Constants.apiEndpoint else {
21+
url.host == Constants.apiEndpoint,
22+
url.path.isEmpty else {
2223
// only the base API is supported
2324
// We are falling back to the real NetworkDataProvider
2425
realNetworkDataProvider.dataTask(with: request, completionHandler: completionHandler)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//
2+
// IdentifiableAnnotationTests.swift
3+
// CriticalMapsTests
4+
//
5+
// Created by Leonard Thomas on 27.02.20.
6+
// Copyright © 2020 Pokus Labs. All rights reserved.
7+
//
8+
9+
@testable import CriticalMaps
10+
import MapKit
11+
import XCTest
12+
13+
extension CLLocationCoordinate2D: Equatable {
14+
public static func == (lhs: CLLocationCoordinate2D, rhs: CLLocationCoordinate2D) -> Bool {
15+
lhs.latitude == rhs.latitude && lhs.longitude == rhs.longitude
16+
}
17+
}
18+
19+
class IdentifiableAnnotationTests: XCTestCase {
20+
func testSetCoordianteOnInit() {
21+
let location = Location(longitude: 42, latitude: 42, timestamp: 0, name: nil, color: nil)
22+
23+
let annotation = IdentifiableAnnnotation(location: location, identifier: "foo")
24+
25+
XCTAssertEqual(annotation.coordinate, CLLocationCoordinate2D(latitude: 42, longitude: 42))
26+
}
27+
}

0 commit comments

Comments
 (0)