Skip to content

Commit 7ca1603

Browse files
default notification handlers
1 parent 5798821 commit 7ca1603

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

Source/Notification/Models/InPlayerNotification.swift

+4-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public enum NotificationType {
1717
case accountLogout
1818
case accountErased
1919
case accountDeactivated
20-
case unknown
20+
case defaultNotification(type: String)
2121
}
2222

2323
/// InPlayer Notification
@@ -37,7 +37,7 @@ public struct InPlayerNotification: Codable {
3737
static let accountLogout = "account.logout"
3838
static let accountErased = "account.erased"
3939
static let accountDeactivated = "account.deactivated"
40-
static let unknown = "unknown"
40+
static let defaultNotification = "default"
4141
}
4242

4343
/// Decoder method
@@ -60,11 +60,7 @@ public struct InPlayerNotification: Codable {
6060
case NotificationTypeStrings.accountDeactivated:
6161
type = .accountDeactivated
6262
default:
63-
type = .unknown
64-
let error = NSError(domain: "Error",
65-
code: 0,
66-
userInfo: [NSLocalizedDescriptionKey: "Unsupported notification type"])
67-
throw error
63+
type = .defaultNotification(type: typeString)
6864
}
6965
}
7066

@@ -86,7 +82,7 @@ public struct InPlayerNotification: Codable {
8682
case .accountDeactivated:
8783
try values.encode(NotificationTypeStrings.accountDeactivated, forKey: .typeString)
8884
default:
89-
try values.encode(NotificationTypeStrings.unknown, forKey: .typeString)
85+
try values.encode(NotificationTypeStrings.defaultNotification, forKey: .typeString)
9086
}
9187
}
9288
}

0 commit comments

Comments
 (0)