diff --git a/.package.resolved b/.package.resolved index f48c8aa7e..f848d3e41 100644 --- a/.package.resolved +++ b/.package.resolved @@ -58,8 +58,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Infomaniak/ios-core-ui", "state" : { - "revision" : "93051b3183db87262a7c53ead3b479e01f888edf", - "version" : "2.2.0" + "revision" : "0277a957e2342c21c69f3978b422ad0828fa46b6", + "version" : "2.3.0" } }, { @@ -148,8 +148,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/realm/realm-core.git", "state" : { - "revision" : "dd91f5f967c4ae89c37e24ab2a0315c31106648f", - "version" : "13.6.0" + "revision" : "3c950f43bafc4fe39ce605e913cc7f30426e1747", + "version" : "13.8.0" } }, { @@ -157,8 +157,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/realm/realm-swift", "state" : { - "revision" : "8ac6fe1aa5d0fb0100062d80863416a4d70de8ca", - "version" : "10.37.0" + "revision" : "21b1c2844965ba5e3a0d80c43358d5ea08d934c6", + "version" : "10.37.1" } }, { @@ -166,8 +166,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/getsentry/sentry-cocoa", "state" : { - "revision" : "2e7899aff930ed3b8d81be1909492f7684bbd481", - "version" : "8.3.1" + "revision" : "ac224c437a3070ffe34460137ac8761eddaf2852", + "version" : "8.3.3" } }, { diff --git a/Mail/Components/ThreadCellDetailsView.swift b/Mail/Components/ThreadCellDetailsView.swift index 5862136b7..080c4c8b2 100644 --- a/Mail/Components/ThreadCellDetailsView.swift +++ b/Mail/Components/ThreadCellDetailsView.swift @@ -33,7 +33,7 @@ struct ThreadCellDetailsView: View { if thread.flagged { MailResourcesAsset.starFull.swiftUIImage .resizable() - .foregroundColor(MailResourcesAsset.yellowActionColor) + .foregroundColor(MailResourcesAsset.yellowColor) .scaledToFit() .frame(width: 16, height: 16) } diff --git a/Mail/Views/Alerts/CreateFolderView.swift b/Mail/Views/Alerts/CreateFolderView.swift index 1f9282700..99a219d61 100644 --- a/Mail/Views/Alerts/CreateFolderView.swift +++ b/Mail/Views/Alerts/CreateFolderView.swift @@ -81,7 +81,7 @@ struct CreateFolderView: View { .padding(12) .overlay( RoundedRectangle(cornerRadius: 4) - .stroke(error == nil ? MailResourcesAsset.textFieldBorder.swiftUIColor : MailResourcesAsset.redActionColor.swiftUIColor) + .stroke(error == nil ? MailResourcesAsset.textFieldBorder.swiftUIColor : MailResourcesAsset.redColor.swiftUIColor) .animation(.easeInOut, value: error) ) .textStyle(.body) diff --git a/Mail/Views/Bottom sheets/Actions/ActionsView.swift b/Mail/Views/Bottom sheets/Actions/ActionsView.swift index b08f1c484..b6c65fce7 100644 --- a/Mail/Views/Bottom sheets/Actions/ActionsView.swift +++ b/Mail/Views/Bottom sheets/Actions/ActionsView.swift @@ -140,9 +140,9 @@ struct ActionView: View { .resizable() .scaledToFit() .frame(width: 21, height: 21) - .foregroundColor(action == .report ? MailResourcesAsset.princeActionColor : accentColor.primary) + .foregroundColor(action == .report ? MailResourcesAsset.princeColor : accentColor.primary) Text(action.title) - .foregroundColor(action == .report ? MailResourcesAsset.princeActionColor : MailResourcesAsset.textPrimaryColor) + .foregroundColor(action == .report ? MailResourcesAsset.princeColor : MailResourcesAsset.textPrimaryColor) .textStyle(.body) .frame(maxWidth: .infinity, alignment: .leading) } diff --git a/Mail/Views/Thread List/NoNetworkView.swift b/Mail/Views/Thread List/NoNetworkView.swift index 8422fd63b..a6f11607b 100644 --- a/Mail/Views/Thread List/NoNetworkView.swift +++ b/Mail/Views/Thread List/NoNetworkView.swift @@ -30,7 +30,7 @@ struct NoNetworkView: View { Text(MailResourcesStrings.Localizable.noNetwork) .textStyle(.bodySmallWarning) } - .foregroundColor(MailResourcesAsset.orangeActionColor) + .foregroundColor(MailResourcesAsset.orangeColor) } } diff --git a/Mail/Views/Thread/MessageHeaderSummaryView.swift b/Mail/Views/Thread/MessageHeaderSummaryView.swift index 68b50d77d..80df5a55b 100644 --- a/Mail/Views/Thread/MessageHeaderSummaryView.swift +++ b/Mail/Views/Thread/MessageHeaderSummaryView.swift @@ -92,7 +92,7 @@ struct MessageHeaderSummaryView: View { .scaledToFit() .frame(width: 22, height: 22) } - .tint(MailResourcesAsset.redActionColor) + .tint(MailResourcesAsset.redColor) } } diff --git a/Mail/Views/Thread/ThreadView.swift b/Mail/Views/Thread/ThreadView.swift index 31ecbca2e..93ed8a3d5 100644 --- a/Mail/Views/Thread/ThreadView.swift +++ b/Mail/Views/Thread/ThreadView.swift @@ -112,7 +112,7 @@ struct ThreadView: View { } } label: { (thread.flagged ? MailResourcesAsset.starFull : MailResourcesAsset.star).swiftUIImage - .foregroundColor(thread.flagged ? MailResourcesAsset.yellowActionColor.swiftUIColor : .accentColor) + .foregroundColor(thread.flagged ? MailResourcesAsset.yellowColor.swiftUIColor : .accentColor) } } ToolbarItemGroup(placement: .bottomBar) { diff --git a/MailCore/Cache/AccountManager.swift b/MailCore/Cache/AccountManager.swift index 272d26398..f1827739a 100644 --- a/MailCore/Cache/AccountManager.swift +++ b/MailCore/Cache/AccountManager.swift @@ -75,7 +75,7 @@ public extension InfomaniakUser { let avatarImage = try? await ImagePipeline.shared.image(for: avatarURL).image { return Image(uiImage: avatarImage) } else { - let backgroundColor = UIColor.backgroundColor(from: id) + let backgroundColor = UIColor.backgroundColor(from: id, with: UIConstants.avatarColors) let initialsImage = UIImage.getInitialsPlaceholder( with: displayName, size: CGSize(width: 40, height: 40), diff --git a/MailCore/Models/MergedContact.swift b/MailCore/Models/MergedContact.swift index 072eb3b2e..e61f8e71a 100644 --- a/MailCore/Models/MergedContact.swift +++ b/MailCore/Models/MergedContact.swift @@ -44,7 +44,7 @@ public class MergedContact { let colorFromHex = UIColor(hex: remoteColorHex) { return colorFromHex } else { - return UIColor.backgroundColor(from: email.hash) + return UIColor.backgroundColor(from: email.hash, with: UIConstants.avatarColors) } }() diff --git a/MailCore/Models/Recipient.swift b/MailCore/Models/Recipient.swift index 1e9b74b7b..f4f376813 100644 --- a/MailCore/Models/Recipient.swift +++ b/MailCore/Models/Recipient.swift @@ -86,7 +86,7 @@ public class Recipient: EmbeddedObject, Codable { }() public var color: UIColor { - return contact?.color ?? UIColor.backgroundColor(from: email.hash) + return contact?.color ?? UIColor.backgroundColor(from: email.hash, with: UIConstants.avatarColors) } public lazy var initials: String = { diff --git a/MailCore/UI/UIConstants.swift b/MailCore/UI/UIConstants.swift new file mode 100644 index 000000000..73e0d349c --- /dev/null +++ b/MailCore/UI/UIConstants.swift @@ -0,0 +1,37 @@ +/* + Infomaniak Mail - iOS App + Copyright (C) 2022 Infomaniak Network SA + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +import Foundation +import MailResources +import UIKit + +public enum UIConstants { + public static let avatarColors = [ + MailResourcesAsset.yellowColor, + MailResourcesAsset.coralColor, + MailResourcesAsset.grassColor, + MailResourcesAsset.fougereColor, + MailResourcesAsset.cobaltColor, + MailResourcesAsset.jeanColor, + MailResourcesAsset.tropicalColor, + MailResourcesAsset.mauveColor, + MailResourcesAsset.princeColor + ].map(\.color) + + // TODO: Move the UI constants to this file +} diff --git a/MailCore/Utils/MailTextStyle.swift b/MailCore/Utils/MailTextStyle.swift index fbfe1ae70..51f886cc5 100644 --- a/MailCore/Utils/MailTextStyle.swift +++ b/MailCore/Utils/MailTextStyle.swift @@ -67,7 +67,7 @@ public struct MailTextStyle { public static let header2Error = MailTextStyle( font: .system(size: 18, weight: .semibold), - color: MailResourcesAsset.redActionColor + color: MailResourcesAsset.redColor ) public static let bodyMedium = MailTextStyle( @@ -92,7 +92,7 @@ public struct MailTextStyle { public static let bodyMediumError = MailTextStyle( font: .system(size: 16, weight: .medium), - color: MailResourcesAsset.redActionColor + color: MailResourcesAsset.redColor ) public static let body = MailTextStyle( @@ -112,7 +112,7 @@ public struct MailTextStyle { public static let bodyError = MailTextStyle( font: .system(size: 16), - color: MailResourcesAsset.redActionColor + color: MailResourcesAsset.redColor ) public static let bodySmallMedium = MailTextStyle( @@ -152,7 +152,7 @@ public struct MailTextStyle { public static let bodySmallWarning = MailTextStyle( font: .system(size: 14), - color: MailResourcesAsset.orangeActionColor + color: MailResourcesAsset.orangeColor ) public static let labelMediumAccent = MailTextStyle( @@ -172,6 +172,6 @@ public struct MailTextStyle { public static let labelError = MailTextStyle( font: .system(size: 12), - color: MailResourcesAsset.redActionColor + color: MailResourcesAsset.redColor ) } diff --git a/MailResources/Assets.xcassets/Colors/cobaltActionColor.colorset/Contents.json b/MailResources/Assets.xcassets/Colors/cobaltColor.colorset/Contents.json similarity index 100% rename from MailResources/Assets.xcassets/Colors/cobaltActionColor.colorset/Contents.json rename to MailResources/Assets.xcassets/Colors/cobaltColor.colorset/Contents.json diff --git a/MailResources/Assets.xcassets/Colors/azurActionColor.colorset/Contents.json b/MailResources/Assets.xcassets/Colors/coralColor.colorset/Contents.json similarity index 76% rename from MailResources/Assets.xcassets/Colors/azurActionColor.colorset/Contents.json rename to MailResources/Assets.xcassets/Colors/coralColor.colorset/Contents.json index 47c862b5a..c106e4718 100644 --- a/MailResources/Assets.xcassets/Colors/azurActionColor.colorset/Contents.json +++ b/MailResources/Assets.xcassets/Colors/coralColor.colorset/Contents.json @@ -5,9 +5,9 @@ "color-space" : "srgb", "components" : { "alpha" : "1.000", - "blue" : "0xFF", - "green" : "0xB7", - "red" : "0x4C" + "blue" : "0x0B", + "green" : "0x54", + "red" : "0xFF" } }, "idiom" : "universal" @@ -23,9 +23,9 @@ "color-space" : "srgb", "components" : { "alpha" : "1.000", - "blue" : "0xFF", - "green" : "0xDA", - "red" : "0xA3" + "blue" : "0x59", + "green" : "0x94", + "red" : "0xFD" } }, "idiom" : "universal" diff --git a/MailResources/Assets.xcassets/Colors/fougereActionColor.colorset/Contents.json b/MailResources/Assets.xcassets/Colors/fougereColor.colorset/Contents.json similarity index 100% rename from MailResources/Assets.xcassets/Colors/fougereActionColor.colorset/Contents.json rename to MailResources/Assets.xcassets/Colors/fougereColor.colorset/Contents.json diff --git a/MailResources/Assets.xcassets/Colors/grassColor.colorset/Contents.json b/MailResources/Assets.xcassets/Colors/grassColor.colorset/Contents.json new file mode 100644 index 000000000..635f3c145 --- /dev/null +++ b/MailResources/Assets.xcassets/Colors/grassColor.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x50", + "green" : "0xAF", + "red" : "0x4B" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0x93", + "green" : "0xD0", + "red" : "0x90" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/MailResources/Assets.xcassets/Colors/jeanColor.colorset/Contents.json b/MailResources/Assets.xcassets/Colors/jeanColor.colorset/Contents.json new file mode 100644 index 000000000..42f844f18 --- /dev/null +++ b/MailResources/Assets.xcassets/Colors/jeanColor.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xF3", + "green" : "0x96", + "red" : "0x21" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xF8", + "green" : "0xC4", + "red" : "0x81" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/MailResources/Assets.xcassets/Colors/mauveActionColor.colorset/Contents.json b/MailResources/Assets.xcassets/Colors/mauveColor.colorset/Contents.json similarity index 100% rename from MailResources/Assets.xcassets/Colors/mauveActionColor.colorset/Contents.json rename to MailResources/Assets.xcassets/Colors/mauveColor.colorset/Contents.json diff --git a/MailResources/Assets.xcassets/Colors/orangeActionColor.colorset/Contents.json b/MailResources/Assets.xcassets/Colors/orangeColor.colorset/Contents.json similarity index 100% rename from MailResources/Assets.xcassets/Colors/orangeActionColor.colorset/Contents.json rename to MailResources/Assets.xcassets/Colors/orangeColor.colorset/Contents.json diff --git a/MailResources/Assets.xcassets/Colors/princeActionColor.colorset/Contents.json b/MailResources/Assets.xcassets/Colors/princeColor.colorset/Contents.json similarity index 100% rename from MailResources/Assets.xcassets/Colors/princeActionColor.colorset/Contents.json rename to MailResources/Assets.xcassets/Colors/princeColor.colorset/Contents.json diff --git a/MailResources/Assets.xcassets/Colors/redActionColor.colorset/Contents.json b/MailResources/Assets.xcassets/Colors/redColor.colorset/Contents.json similarity index 100% rename from MailResources/Assets.xcassets/Colors/redActionColor.colorset/Contents.json rename to MailResources/Assets.xcassets/Colors/redColor.colorset/Contents.json diff --git a/MailResources/Assets.xcassets/Colors/tropicalColor.colorset/Contents.json b/MailResources/Assets.xcassets/Colors/tropicalColor.colorset/Contents.json new file mode 100644 index 000000000..099faf6e5 --- /dev/null +++ b/MailResources/Assets.xcassets/Colors/tropicalColor.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xD4", + "green" : "0xBC", + "red" : "0x00" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xEA", + "green" : "0xDE", + "red" : "0x86" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/MailResources/Assets.xcassets/Colors/yellowActionColor.colorset/Contents.json b/MailResources/Assets.xcassets/Colors/yellowColor.colorset/Contents.json similarity index 100% rename from MailResources/Assets.xcassets/Colors/yellowActionColor.colorset/Contents.json rename to MailResources/Assets.xcassets/Colors/yellowColor.colorset/Contents.json diff --git a/Project.swift b/Project.swift index 679d0ad54..9327e30a3 100644 --- a/Project.swift +++ b/Project.swift @@ -30,7 +30,7 @@ let project = Project(name: "Mail", .package(url: "https://github.com/Infomaniak/ios-login", .upToNextMajor(from: "4.0.0")), .package(url: "https://github.com/Infomaniak/ios-dependency-injection", .upToNextMajor(from: "1.1.6")), .package(url: "https://github.com/Infomaniak/ios-core", .revision("1e462dc93f8fba7fb3fb9d7b6106e23fab7b62c5")), - .package(url: "https://github.com/Infomaniak/ios-core-ui", .upToNextMajor(from: "2.0.2")), + .package(url: "https://github.com/Infomaniak/ios-core-ui", .upToNextMajor(from: "2.3.0")), .package(url: "https://github.com/Infomaniak/ios-notifications", .upToNextMajor(from: "2.0.1")), .package(url: "https://github.com/Infomaniak/ios-create-account", .upToNextMajor(from: "1.1.0")), .package(url: "https://github.com/Infomaniak/ios-bug-tracker", .upToNextMajor(from: "2.0.0")),