Skip to content

Commit b94172d

Browse files
authored
Merge pull request #277 from TaskarCenterAtUW/Bug-2149-Hexagon-imagery-issues-on-GiGv1.0(38)
iOS build 1.0(38) review comments
2 parents e09ad46 + 91d9774 commit b94172d

File tree

26 files changed

+321
-230
lines changed

26 files changed

+321
-230
lines changed

GoInfoGame/GoInfoGame.xcodeproj/project.pbxproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
971342772BBD415600174EBF /* InitialViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971342762BBD415600174EBF /* InitialViewController.swift */; };
3434
971342792BBD691500174EBF /* MapViewControllerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971342782BBD691500174EBF /* MapViewControllerView.swift */; };
3535
971575172B5FFD6F0044797C /* MapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971575162B5FFD6F0044797C /* MapView.swift */; };
36-
971575192B5FFE910044797C /* LocationManagerCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971575182B5FFE910044797C /* LocationManagerCoordinator.swift */; };
3736
971902112B983EFC009B3270 /* CustomMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 971902102B983EFC009B3270 /* CustomMap.swift */; };
3837
972454152B14A49A0036B91A /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 972454142B14A49A0036B91A /* Extensions.swift */; };
3938
973FBFFE2B46BB3800878269 /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 973FBFFD2B46BB3800878269 /* Utils.swift */; };
@@ -162,6 +161,7 @@
162161
C76DA1A12DF0679F00451E63 /* LongFormModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8C74C32C4FDE1000D28220 /* LongFormModel.swift */; };
163162
C77A4A262DF2AF3100DED8B0 /* SecureInputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C77A4A252DF2AF3100DED8B0 /* SecureInputView.swift */; };
164163
C77EEBCF2DE59D3200494CB4 /* UndoMerge.swift in Sources */ = {isa = PBXBuildFile; fileRef = C77EEBCE2DE59D3200494CB4 /* UndoMerge.swift */; };
164+
C7BA83542E3C9C3600755BA7 /* QuestSyncButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7BA83532E3C9C3600755BA7 /* QuestSyncButton.swift */; };
165165
C7ED070F2D70E2EC001FFFE2 /* TokenRefresher.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7ED070E2D70E2EC001FFFE2 /* TokenRefresher.swift */; };
166166
CFECB318461BB876B1621890 /* Pods_osmapi.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C4F37DA661B22FA87DF8282F /* Pods_osmapi.framework */; };
167167
FA18CAE22CC7CD89008247F2 /* KartaviewViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA18CAE12CC7CD89008247F2 /* KartaviewViewModel.swift */; };
@@ -500,6 +500,7 @@
500500
C75E47732E151058006D903A /* Kondapur.gpx */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Kondapur.gpx; sourceTree = "<group>"; };
501501
C77A4A252DF2AF3100DED8B0 /* SecureInputView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureInputView.swift; sourceTree = "<group>"; };
502502
C77EEBCE2DE59D3200494CB4 /* UndoMerge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UndoMerge.swift; sourceTree = "<group>"; };
503+
C7BA83532E3C9C3600755BA7 /* QuestSyncButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = QuestSyncButton.swift; path = GoInfoGame/UI/Map/QuestSyncButton.swift; sourceTree = SOURCE_ROOT; };
503504
C7ED070E2D70E2EC001FFFE2 /* TokenRefresher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TokenRefresher.swift; sourceTree = "<group>"; };
504505
C96303080D26026265099E0E /* Pods-GoInfoGame.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GoInfoGame.release.xcconfig"; path = "Target Support Files/Pods-GoInfoGame/Pods-GoInfoGame.release.xcconfig"; sourceTree = "<group>"; };
505506
D76D8E22AC705A38AFEA78B1 /* Pods-GoInfoGame-GoInfoGameUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GoInfoGame-GoInfoGameUITests.debug.xcconfig"; path = "Target Support Files/Pods-GoInfoGame-GoInfoGameUITests/Pods-GoInfoGame-GoInfoGameUITests.debug.xcconfig"; sourceTree = "<group>"; };
@@ -1288,6 +1289,7 @@
12881289
C71EB5A82E2100510009E610 /* SatellitePickerSheet.swift */,
12891290
C71EB5A92E2100510009E610 /* SatelliteServerResponse.swift */,
12901291
C71EB5AA2E2100510009E610 /* WMTSServer.swift */,
1292+
C7BA83532E3C9C3600755BA7 /* QuestSyncButton.swift */,
12911293
);
12921294
path = "Satellite Server";
12931295
sourceTree = "<group>";
@@ -2159,7 +2161,6 @@
21592161
FA8C74D62C5C0DBA00D28220 /* LongFormViewModel.swift in Sources */,
21602162
0536DD852B0BD11A00B04C4B /* LoginViewController.swift in Sources */,
21612163
A4E711A42B57B13100C9DE08 /* QuestionHeader.swift in Sources */,
2162-
971575192B5FFE910044797C /* LocationManagerCoordinator.swift in Sources */,
21632164
FABF3CF42B7419BB0080EAC9 /* LocationManagerDelegate.swift in Sources */,
21642165
973FC0192B4FB17000878269 /* LocalizedStrings.swift in Sources */,
21652166
A48037312BBA8C25007EE7E4 /* ApiManager.swift in Sources */,
@@ -2183,6 +2184,7 @@
21832184
973FC0012B46CD5D00878269 /* QuestsListUIView.swift in Sources */,
21842185
973FC01F2B50DE7E00878269 /* ImageGridItemView.swift in Sources */,
21852186
FA633CB42DD4843B00324404 /* BiometricAuthManager.swift in Sources */,
2187+
C7BA83542E3C9C3600755BA7 /* QuestSyncButton.swift in Sources */,
21862188
05CB71E02B0FAFD200DED821 /* GenericUIViewControllerRepresentable.swift in Sources */,
21872189
FAD5C4F32AFCBE700040C61A /* AppDelegate.swift in Sources */,
21882190
05DBBB622B164D9A00B6F110 /* RealOPElement.swift in Sources */,
@@ -2747,7 +2749,7 @@
27472749
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
27482750
CODE_SIGN_IDENTITY = "Apple Development";
27492751
CODE_SIGN_STYLE = Automatic;
2750-
CURRENT_PROJECT_VERSION = 38;
2752+
CURRENT_PROJECT_VERSION = 39;
27512753
DEVELOPMENT_TEAM = G8MQVE5WWW;
27522754
GENERATE_INFOPLIST_FILE = YES;
27532755
INFOPLIST_FILE = GoInfoGame/Info.plist;
@@ -2785,7 +2787,7 @@
27852787
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
27862788
CODE_SIGN_IDENTITY = "Apple Development";
27872789
CODE_SIGN_STYLE = Automatic;
2788-
CURRENT_PROJECT_VERSION = 38;
2790+
CURRENT_PROJECT_VERSION = 39;
27892791
DEVELOPMENT_TEAM = G8MQVE5WWW;
27902792
GENERATE_INFOPLIST_FILE = YES;
27912793
INFOPLIST_FILE = GoInfoGame/Info.plist;

GoInfoGame/GoInfoGame/AppQuestManager.swift

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,26 +71,31 @@ class AppQuestManager {
7171
tags.@count != 0 AND
7272
tags['ext:gig_complete'] != 'yes'
7373
"""))
74+
let yetToSyncNodeIDs = Set(dbInstance.getChangesets(synced: false, element: .node).compactMap{ Int64($0.elementId) })
7475

7576
let waysFromStorage = dbInstance.getWays(NSPredicate(format: """
7677
tags.@count != 0 AND
7778
polyline.@count > 0 AND
7879
tags['ext:gig_complete'] != 'yes'
7980
""" ))
81+
let yetToSyncWayIDs = Set(dbInstance.getChangesets(synced: false, element: .way).compactMap{ Int64($0.elementId) })
82+
8083
debugPrint("converting to nods: start \(Date())")
81-
let nodeElements = nodesFromStorage.map({ node in
82-
autoreleasepool {
83-
node.asNode()
84+
let nodeElements: [Node] = nodesFromStorage.compactMap { node in
85+
if yetToSyncNodeIDs.contains(node.id) {
86+
return nil
8487
}
85-
})
88+
return node.asNode()
89+
}
90+
8691
debugPrint("converting to nods: end \(Date())")
8792
debugPrint("converting to way: start \(Date())")
88-
let wayElements = waysFromStorage.map({ way in
89-
autoreleasepool {
90-
way.asWay()
93+
let wayElements: [Way] = waysFromStorage.compactMap{ way in
94+
if yetToSyncWayIDs.contains(way.id) {
95+
return nil
9196
}
92-
93-
})
97+
return way.asWay()
98+
}
9499

95100
debugPrint("converting to way: end \(Date())")
96101
// Get the quests for nodes
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
}
6+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"colors" : [
3+
{
4+
"color" : {
5+
"color-space" : "srgb",
6+
"components" : {
7+
"alpha" : "1.000",
8+
"blue" : "242",
9+
"green" : "62",
10+
"red" : "135"
11+
}
12+
},
13+
"idiom" : "universal"
14+
}
15+
],
16+
"info" : {
17+
"author" : "xcode",
18+
"version" : 1
19+
}
20+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "sync.pdf",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
},
12+
"properties" : {
13+
"template-rendering-intent" : "template"
14+
}
15+
}
1.75 KB
Binary file not shown.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "upload.pdf",
5+
"idiom" : "universal"
6+
}
7+
],
8+
"info" : {
9+
"author" : "xcode",
10+
"version" : 1
11+
},
12+
"properties" : {
13+
"template-rendering-intent" : "template"
14+
}
15+
}
Binary file not shown.

GoInfoGame/GoInfoGame/DataBase/DatabaseConnector.swift

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -326,15 +326,16 @@ class DatabaseConnector {
326326
/// - parameter synced: Optional variable of whether synced or non synced
327327
/// - Returns: an instance of `Results<StoredChangeset>`
328328
func getChangesets(synced: Bool = false) -> Results<StoredChangeset> {
329-
let results: Results<StoredChangeset>
330329
let realm = try! Realm(configuration: RealmConfig.configuration)
331-
if synced {
332-
results = realm.objects(StoredChangeset.self).where { $0.changesetId != -1 }
333-
} else {
334-
results = realm.objects(StoredChangeset.self).where { $0.changesetId == -1 }
335-
}
336-
print("Found \(results.count) changesets for synced=\(synced)")
337-
return results
330+
let predicateString = synced ? "updatedVersion != -1" : "updatedVersion == -1"
331+
return realm.objects(StoredChangeset.self).filter(NSPredicate(format: predicateString))
332+
}
333+
334+
func getChangesets(synced: Bool, element: ElementType) -> Results<StoredChangeset> {
335+
let realm = try! Realm(configuration: RealmConfig.configuration)
336+
let syncString = synced ? "updatedVersion != -1" : "updatedVersion == -1"
337+
let predicateString = "\(syncString) AND elementType == \"\(element)\""
338+
return realm.objects(StoredChangeset.self).filter(NSPredicate(format: predicateString))
338339
}
339340

340341
func getChangeset(for id: String) -> StoredChangeset? {

GoInfoGame/GoInfoGame/Helpers/Extensions.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,21 @@ extension MKMapView {
6262
func isZoomedIn(maxLatitudeDelta: CLLocationDegrees = 0.005) -> Bool {
6363
return self.region.span.latitudeDelta <= maxLatitudeDelta
6464
}
65+
66+
func distanceForZoom(zoomLevel: Int) -> CLLocationDistance {
67+
// Earth's circumference in meters
68+
let earthCircumference: Double = 40075016.686
69+
// Standard tile size (pixels)
70+
let tileSize: Double = 256
71+
// Get the width of the map in points and scale by screen
72+
let scale = UIScreen.main.scale
73+
let mapWidthInPixels = Double(self.frame.size.width) * scale
74+
// Calculate meters per pixel at equator for the given zoom
75+
let metersPerPixel = earthCircumference / (tileSize * pow(2.0, Double(zoomLevel)))
76+
// The distance (in meters) visible in the current map width
77+
return metersPerPixel * mapWidthInPixels
78+
}
79+
6580
}
6681

6782
extension CLLocationCoordinate2D: CustomPersistable {

0 commit comments

Comments
 (0)