@@ -11,6 +11,10 @@ import SwiftUI
1111import osmparser
1212import MapKit
1313
14+ enum ElementSubmittingToPOSM {
15+ case node, way
16+ }
17+
1418protocol Quest {
1519 associatedtype AnswerClass // The class that represents answer
1620 var title : String { get }
@@ -30,6 +34,9 @@ protocol Quest {
3034
3135class QuestBase {
3236 public var internalForm : ( any QuestForm ) ? = nil
37+
38+ private var elementSubmittingToPOSM : ElementSubmittingToPOSM ?
39+
3340 // Add a custom implementation
3441
3542 public func updateTags( id: Int64 , tags: [ String : String ] , type: ElementType ) {
@@ -40,8 +47,10 @@ class QuestBase {
4047 _ = DatabaseConnector . shared. createChangeset ( id: storedId, type: storedElementType, tags: tags)
4148 switch ( storedElementType) {
4249 case . way:
50+ elementSubmittingToPOSM = . way
4351 _ = DatabaseConnector . shared. addWayTags ( id: storedId, tags: tags)
4452 case . node:
53+ elementSubmittingToPOSM = . node
4554 _ = DatabaseConnector . shared. addNodeTags ( id: storedId, tags: tags)
4655 case . unknown:
4756 print ( " Unknown Stored element type received " )
@@ -58,6 +67,16 @@ class QuestBase {
5867 switch success {
5968 case . success( let success) :
6069 if success {
70+ if let elementSubmittingToPOSM = self . elementSubmittingToPOSM {
71+ switch elementSubmittingToPOSM {
72+ case . node:
73+ print ( " Node submitted successfully " )
74+ _ = DatabaseConnector . shared. addNodeTags ( id: storedId, tags: [ " ext:gig_complete " : " yes " ] )
75+ case . way:
76+ print ( " Way submitted successfully " )
77+ _ = DatabaseConnector . shared. addWayTags ( id: storedId, tags: [ " ext:gig_complete " : " yes " ] )
78+ }
79+ }
6180 MapViewPublisher . shared. dismissSheet. send ( . submitted( storedId) )
6281 } else {
6382 print ( " Sync failed. Handle accordingly. " )
0 commit comments