-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New properties for
FCMAndroidNotification
(#18)
by @nerzh
- Loading branch information
1 parent
d5962b6
commit 357d93b
Showing
4 changed files
with
207 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
Sources/FCM/FCMAndroidConfig/FCMAndroidNotificationLightSettings.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// | ||
// FCMAndroidNotificationLightSettings.swift | ||
// | ||
// | ||
// Created by Oleh Hudeichuk on 13.12.2019. | ||
// | ||
|
||
public typealias FCMAndroidNotificationLightSettingsColor = FCMAndroidNotificationLightSettings.Color | ||
|
||
public struct FCMAndroidNotificationLightSettings: Codable, Equatable { | ||
/// Required. Set color of the LED with google.type.Color. | ||
public var color: Color | ||
|
||
/// Required. Along with light_off_duration, define the blink rate of LED flashes. | ||
/// Resolution defined by proto.Duration | ||
/// A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s". | ||
public var light_on_duration: String | ||
|
||
/// Required. Along with light_on_duration, define the blink rate of LED flashes. | ||
/// Resolution defined by proto.Duration | ||
/// A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s". | ||
public var light_off_duration: String | ||
|
||
public init (color: Color, | ||
light_on_duration: String, | ||
light_off_duration: String) { | ||
self.color = color | ||
self.light_on_duration = light_on_duration | ||
self.light_off_duration = light_off_duration | ||
} | ||
} | ||
|
||
extension FCMAndroidNotificationLightSettings { | ||
public struct Color: Codable, Equatable { | ||
public var red, green, blue, alpha: Float | ||
|
||
public init (red: Float, green: Float, blue: Float, alpha: Float) { | ||
self.red = red | ||
self.green = green | ||
self.blue = blue | ||
self.alpha = alpha | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
Sources/FCM/FCMAndroidConfig/FCMAndroidNotificationPriority.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// FCMAndroidNotificationPriority.swift | ||
// | ||
// | ||
// Created by Oleh Hudeichuk on 13.12.2019. | ||
// | ||
|
||
public enum FCMAndroidNotificationPriority: String, Codable, Equatable { | ||
/// If priority is unspecified, notification priority is set to PRIORITY_DEFAULT. | ||
case unspecified = "PRIORITY_UNSPECIFIED" | ||
|
||
/// Lowest notification priority. | ||
/// Notifications with this PRIORITY_MIN might not be shown to the user | ||
/// except under special circumstances, such as detailed notification logs. | ||
case min = "PRIORITY_MIN" | ||
|
||
/// Lower notification priority. | ||
/// The UI may choose to show the notifications smaller, | ||
/// or at a different position in the list, compared with notifications with PRIORITY_DEFAULT. | ||
case low = "PRIORITY_LOW" | ||
|
||
/// Default notification priority. | ||
/// If the application does not prioritize its own notifications, use this value for all notifications. | ||
case `default` = "PRIORITY_DEFAULT" | ||
|
||
/// Higher notification priority. | ||
/// Use this for more important notifications or alerts. | ||
/// The UI may choose to show these notifications larger, | ||
/// or at a different position in the notification lists, compared with notifications with PRIORITY_DEFAULT. | ||
case high = "PRIORITY_HIGH" | ||
|
||
/// Highest notification priority. | ||
/// Use this for the application's most important items that require the user's prompt attention or input. | ||
case max = "PRIORITY_MAX" | ||
} |
20 changes: 20 additions & 0 deletions
20
Sources/FCM/FCMAndroidConfig/FCMAndroidNotificationVisibility.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// FCMAndroidNotificationVisibility.swift | ||
// | ||
// | ||
// Created by Oleh Hudeichuk on 13.12.2019. | ||
// | ||
|
||
public enum FCMAndroidNotificationVisibility: String, Codable, Equatable { | ||
/// If unspecified, default to Visibility.PRIVATE. | ||
case unspecified = "VISIBILITY_UNSPECIFIED" | ||
|
||
/// Show this notification on all lockscreens, but conceal sensitive or private information on secure lockscreens. | ||
case `private` = "PRIVATE" | ||
|
||
/// Show this notification in its entirety on all lockscreens. | ||
case `public` = "PUBLIC" | ||
|
||
/// Do not reveal any part of this notification on a secure lockscreen. | ||
case secret = "SECRET" | ||
} |