Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
806 B
2
Indexable
Never
        //coba coba new
        let id = "60cabcdea3cd0638d6461a00"
        let email = StorageService.shared.getUserEmail()
        var newBadgeDict = StorageService.shared.getNewBadge() == nil ? [:] : StorageService.shared.getNewBadge()
        
        if let newBadge = newBadgeDict?[email] {
            if newBadge.contains(id) == false {
                newBadgeDict?[email]?.append(id)
                if let newBadgeDict = newBadgeDict {
                    StorageService.shared.setNewBadge(badge: newBadgeDict)
                }
            }
        } else {
            newBadgeDict?[email] = ["60cabcdea3cd0638d6461a00", "60cabcdea3cd0638d6461a02"]
            if let newBadgeDict = newBadgeDict {
                StorageService.shared.setNewBadge(badge: newBadgeDict)
            }
        }