@@ -20,14 +20,14 @@ class DatasyncManager {
2020 private let dbInstance = DatabaseConnector . shared
2121 private let barrierQueue : DispatchQueue = DispatchQueue ( label: " com.goinfogame.DatasyncManager.barrierQueue " , attributes: . concurrent)
2222
23- func syncDataToOSM( completionHandler: @escaping ( Result < Bool , APIError > ) -> Void ) {
23+ func syncDataToOSM( exclude_gig_tags : Bool , completionHandler: @escaping ( Result < Bool , APIError > ) -> Void ) {
2424 barrierQueue. async ( flags: . barrier) { [ weak self] in
2525 guard let self = self else { return }
2626 let semaphore = DispatchSemaphore ( value: 0 )
2727
2828 Task . detached ( priority: . userInitiated) {
2929 do {
30- let isSynced = try await self . syncData ( )
30+ let isSynced = try await self . syncData ( exclude_gig_tags : exclude_gig_tags )
3131
3232 print ( " Sync finished " )
3333 if isSynced {
@@ -57,7 +57,7 @@ class DatasyncManager {
5757 /// *** Terminating app due to uncaught exception 'RLMException', reason: 'Realm accessed from incorrect thread.'
5858 /// To fix the above error added @mainActor
5959 @MainActor
60- func syncData( ) async throws -> Bool {
60+ func syncData( exclude_gig_tags : Bool = false ) async throws -> Bool {
6161 print ( " 🔄 Starting sync... " )
6262
6363 let changesets = dbInstance. getChangesets ( )
@@ -132,7 +132,7 @@ class DatasyncManager {
132132 print ( " 📤 Syncing way ID: \( way. id) " )
133133 let payload = way. asOSMWay ( )
134134 do {
135- let isFinished = try await syncWay ( way: payload)
135+ let isFinished = try await syncWay ( way: payload, exclude_gig_tags : exclude_gig_tags )
136136 if isFinished {
137137 DispatchQueue . main. async {
138138 self . dbInstance. assignChangesetId ( obj: key, changesetId: 0 )
@@ -195,7 +195,7 @@ class DatasyncManager {
195195 }
196196 }
197197
198- func openChangeset( ) async throws -> Int {
198+ func openChangeset( exclude_gig_tags : Bool = false ) async throws -> Int {
199199 var versionNumber = " "
200200 var buildNumber = " "
201201
@@ -206,7 +206,7 @@ class DatasyncManager {
206206 }
207207
208208 let createdBy = " \( versionNumber) ( \( buildNumber) ) "
209- let osmPayloadString = OSMChangesetPayload ( createdByTag: createdBy) . toPayload ( )
209+ let osmPayloadString = OSMChangesetPayload ( createdByTag: createdBy) . toPayload ( exclude_gig_tags : exclude_gig_tags )
210210 let osmPayload = osmPayloadString. data ( using: . utf8)
211211 let workspaceId = KeychainManager . load ( key: " workspaceID " )
212212
@@ -252,9 +252,9 @@ class DatasyncManager {
252252 }
253253
254254 // utility function to act as substitute for osmConnection functions
255- func updateWay( way: OSMWay ) async throws -> Int {
255+ func updateWay( way: OSMWay , exclude_gig_tags : Bool = false ) async throws -> Int {
256256 var localWay = way
257- let wayBodyString = localWay. toPayload ( )
257+ let wayBodyString = localWay. toPayload ( exclude_gig_tags : exclude_gig_tags )
258258 let changesetUploadBody = " <osmChange version= \" 0.6 \" generator= \" GIG Change generator \" > " + wayBodyString + " </osmChange> "
259259 let workspaceId = KeychainManager . load ( key: " workspaceID " )
260260 let wayBody = changesetUploadBody. data ( using: . utf8)
@@ -288,9 +288,9 @@ class DatasyncManager {
288288 }
289289
290290 // utility function to act as substitute for osmConnection functions
291- func updateNode( node: OSMNode ) async throws -> Int {
291+ func updateNode( node: OSMNode , exclude_gig_tags : Bool = false ) async throws -> Int {
292292 var localNode = node
293- let nodeBodyString = localNode. toPayload ( )
293+ let nodeBodyString = localNode. toPayload ( exclude_gig_tags : exclude_gig_tags )
294294 let changesetUploadBody = " <osmChange version= \" 0.6 \" generator= \" GIG Change generator \" > " + nodeBodyString + " </osmChange> "
295295 let workspaceId = KeychainManager . load ( key: " workspaceID " )
296296
@@ -330,9 +330,9 @@ class DatasyncManager {
330330 }
331331 }
332332
333- func uploadNode( node: OSMNode ) async throws -> Bool {
333+ func uploadNode( node: OSMNode , exclude_gig_tags : Bool = false ) async throws -> Bool {
334334 var localNode = node
335- let nodeBodyString = localNode. toCreatePayload ( )
335+ let nodeBodyString = localNode. toCreatePayload ( exclude_gig_tags : exclude_gig_tags )
336336 let changesetUploadBody = " <osmChange version= \" 0.6 \" generator= \" GIG Change generator \" > " + nodeBodyString + " </osmChange> "
337337 let workspaceId = KeychainManager . load ( key: " workspaceID " )
338338
@@ -356,12 +356,12 @@ class DatasyncManager {
356356 }
357357 }
358358
359- func updateWay2( way: OSMWay ) async throws -> Int {
359+ func updateWay2( way: OSMWay , exclude_gig_tags : Bool = false ) async throws -> Int {
360360 var localWay = way
361361 let wayId = " \( localWay. id) "
362362 var updatedResult : Int = - 1
363363 do {
364- updatedResult = try await updateWay ( way: localWay)
364+ updatedResult = try await updateWay ( way: localWay, exclude_gig_tags : exclude_gig_tags )
365365 return updatedResult
366366 } catch let error as APIError {
367367 switch error {
@@ -551,7 +551,7 @@ class DatasyncManager {
551551 }
552552
553553 @MainActor
554- func syncWay( way: OSMWay ) async throws -> Bool {
554+ func syncWay( way: OSMWay , exclude_gig_tags : Bool = false ) async throws -> Bool {
555555 var localWay = way
556556
557557 do {
@@ -560,7 +560,7 @@ class DatasyncManager {
560560
561561 localWay. changeset = changesetID
562562
563- let newVersion = try await updateWay2 ( way: localWay)
563+ let newVersion = try await updateWay2 ( way: localWay, exclude_gig_tags : exclude_gig_tags )
564564
565565 localWay. version = newVersion
566566
0 commit comments