Commit 6eae57a5 authored by Jose Blaya's avatar Jose Blaya
Browse files

Green sticky note for success statuses

parent 85e244a6
......@@ -218,6 +218,40 @@ extension Macros {
}
/**
Shortcut to display a success `EKImageNoteMessageView`.
- Parameter image: The note image
- Parameter message: The note message
- Parameter duration: Optional duration of the note
*/
public static func displaySuccessImageNote(withImage image: UIImage,
message: String,
andDuration duration: Double? = nil) {
var attributes = EKAttributes()
attributes = .topToast
attributes.hapticFeedbackType = .success
attributes.entryBackground = .color(color: UIColor.piaGreenDark20)
attributes.positionConstraints.size = .init(width: EKAttributes.PositionConstraints.Edge.fill,
height: EKAttributes.PositionConstraints.Edge.constant(value: bannerHeight))
if let duration = duration {
attributes.displayDuration = duration
}
let labelContent = EKProperty.LabelContent(text: message,
style: .init(font: TextStyle.textStyle7.font!,
color: .white))
let imageContent = EKProperty.ImageContent(image: image)
let contentView = EKImageNoteMessageView(with: labelContent,
imageContent: imageContent)
SwiftEntryKit.display(entry: contentView,
using: attributes)
}
/**
Shortcut to display an infinite `EKImageNoteMessageView`.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment