diff --git a/.package.resolved b/.package.resolved index 6b80c34b2..0d7a43d6b 100644 --- a/.package.resolved +++ b/.package.resolved @@ -95,8 +95,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Infomaniak/ios-core-ui", "state" : { - "revision" : "400b26b6a266bb9206ad4eade1231a9f264e98e7", - "version" : "4.0.0" + "revision" : "d593bdc3d788cadc8856137ff6d2cffbfd707163", + "version" : "4.1.0" } }, { @@ -221,8 +221,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Infomaniak/SnackBar.swift", "state" : { - "revision" : "9a3c0c71796625ec3804df993483aa80266fa1ff", - "version" : "1.1.0" + "revision" : "7d8d20af50c6b744aa9791b597f7efbd0a15add2", + "version" : "1.2.0" } }, { diff --git a/Project.swift b/Project.swift index a7324c565..d597b0584 100644 --- a/Project.swift +++ b/Project.swift @@ -25,7 +25,7 @@ let project = Project(name: "kDrive", .package(url: "https://github.com/apple/swift-algorithms", .upToNextMajor(from: "1.2.0")), .package(url: "https://github.com/Alamofire/Alamofire", .upToNextMajor(from: "5.2.2")), .package(url: "https://github.com/Infomaniak/ios-core", .upToNextMajor(from: "6.2.0")), - .package(url: "https://github.com/Infomaniak/ios-core-ui", .upToNextMajor(from: "4.0.0")), + .package(url: "https://github.com/Infomaniak/ios-core-ui", .upToNextMajor(from: "4.1.0")), .package(url: "https://github.com/Infomaniak/ios-login", .upToNextMajor(from: "6.0.1")), .package(url: "https://github.com/Infomaniak/ios-dependency-injection", .upToNextMajor(from: "2.0.0")), .package(url: "https://github.com/Infomaniak/swift-concurrency", .upToNextMajor(from: "0.0.4")), diff --git a/kDriveCore/UI/UIConstants.swift b/kDriveCore/UI/UIConstants.swift index 260edf705..375c4378f 100644 --- a/kDriveCore/UI/UIConstants.swift +++ b/kDriveCore/UI/UIConstants.swift @@ -24,6 +24,13 @@ import SnackBar import UIKit public enum UIConstants { + private static let style: SnackBarStyle = { + var style = SnackBarStyle.infomaniakStyle + style.anchor = 20.0 + style.maxWidth = 600.0 + return style + }() + public static let inputCornerRadius = 2.0 public static let imageCornerRadius = 3.0 public static let cornerRadius = 6.0 @@ -41,9 +48,12 @@ public enum UIConstants { @discardableResult @MainActor - public static func showSnackBar(message: String, duration: SnackBar.Duration = .lengthLong, + public static func showSnackBar(message: String, + duration: SnackBar.Duration = .lengthLong, action: IKSnackBar.Action? = nil) -> IKSnackBar? { - let snackbar = IKSnackBar.make(message: message, duration: duration) + let snackbar = IKSnackBar.make(message: message, + duration: duration, + style: style) if let action { snackbar?.setAction(action).show() } else { diff --git a/kDriveCore/Utils/NotificationsHelper.swift b/kDriveCore/Utils/NotificationsHelper.swift index c1885639b..a6ebba69a 100644 --- a/kDriveCore/Utils/NotificationsHelper.swift +++ b/kDriveCore/Utils/NotificationsHelper.swift @@ -225,12 +225,7 @@ public struct NotificationsHelper: NotificationsHelpable { let request = UNNotificationRequest(identifier: id, content: notification, trigger: trigger) UNUserNotificationCenter.current().add(request) } else { - let snackbar = IKSnackBar.make(message: notification.body, duration: .lengthLong) - if let action { - snackbar?.setAction(action).show() - } else { - snackbar?.show() - } + UIConstants.showSnackBar(message: notification.body, duration: .lengthLong, action: action) } } }