File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
GoInfoGame/GoInfoGame/UI/Map Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -102,11 +102,13 @@ class MapViewModel: ObservableObject {
102102 if let toBeHidden = self . items. first ( where: { $0. id == Int ( questId) !} ) {
103103 let index = self . items. firstIndex ( where: { $0. id == Int ( questId) !} )
104104 items [ index!] . isHidden = true
105-
106- var hiddenElements = [ Int64] ( )
107-
108- hiddenElements. append ( toBeHidden. id)
109- UserDefaults . standard. set ( hiddenElements, forKey: " hiddenElements " )
105+
106+ var hiddenElementIds = UserDefaults . standard. array ( forKey: " hiddenElements " ) as? [ Int64 ] ?? [ ]
107+
108+ if !hiddenElementIds. contains ( toBeHidden. id) {
109+ hiddenElementIds. append ( toBeHidden. id)
110+ UserDefaults . standard. set ( hiddenElementIds, forKey: " hiddenElements " )
111+ }
110112
111113 }
112114
You can’t perform that action at this time.
0 commit comments