Browse Source

Merge pull request #2346 from nextcloud/shareAccounts

Share accounts
Marino Faggiana 2 years ago
parent
commit
22f4285638

+ 8 - 8
Nextcloud.xcodeproj/project.pbxproj

@@ -460,8 +460,8 @@
 		F7A321AD1E9E6AD50069AD1B /* CCAdvanced.m in Sources */ = {isa = PBXBuildFile; fileRef = F7A321AC1E9E6AD50069AD1B /* CCAdvanced.m */; };
 		F7A48413297022E000BD1B49 /* ViewerQuickLook.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7A48412297022E000BD1B49 /* ViewerQuickLook.swift */; };
 		F7A48415297028FC00BD1B49 /* Nextcloud Hub.png in Resources */ = {isa = PBXBuildFile; fileRef = F7A48414297028FC00BD1B49 /* Nextcloud Hub.png */; };
-		F7A60F86292D215000FCE1F2 /* NCTalkAccounts.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7A60F84292D215000FCE1F2 /* NCTalkAccounts.swift */; };
-		F7A60F87292D215000FCE1F2 /* NCTalkAccounts.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7A60F85292D215000FCE1F2 /* NCTalkAccounts.storyboard */; };
+		F7A60F86292D215000FCE1F2 /* NCShareAccounts.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7A60F84292D215000FCE1F2 /* NCShareAccounts.swift */; };
+		F7A60F87292D215000FCE1F2 /* NCShareAccounts.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7A60F85292D215000FCE1F2 /* NCShareAccounts.storyboard */; };
 		F7A76DC8256A71CD00119AB3 /* UIImage+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7B7504A2397D38E004E13EC /* UIImage+Extension.swift */; };
 		F7A76DCD256A71CE00119AB3 /* UIImage+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7B7504A2397D38E004E13EC /* UIImage+Extension.swift */; };
 		F7A7FA6329265CF4000603EF /* NCManageE2EE.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7A7FA6229265CF4000603EF /* NCManageE2EE.swift */; };
@@ -1051,8 +1051,8 @@
 		F7A321AC1E9E6AD50069AD1B /* CCAdvanced.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCAdvanced.m; sourceTree = "<group>"; };
 		F7A48412297022E000BD1B49 /* ViewerQuickLook.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewerQuickLook.swift; sourceTree = "<group>"; };
 		F7A48414297028FC00BD1B49 /* Nextcloud Hub.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Nextcloud Hub.png"; sourceTree = SOURCE_ROOT; };
-		F7A60F84292D215000FCE1F2 /* NCTalkAccounts.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCTalkAccounts.swift; sourceTree = "<group>"; };
-		F7A60F85292D215000FCE1F2 /* NCTalkAccounts.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NCTalkAccounts.storyboard; sourceTree = "<group>"; };
+		F7A60F84292D215000FCE1F2 /* NCShareAccounts.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCShareAccounts.swift; sourceTree = "<group>"; };
+		F7A60F85292D215000FCE1F2 /* NCShareAccounts.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NCShareAccounts.storyboard; sourceTree = "<group>"; };
 		F7A7FA6229265CF4000603EF /* NCManageE2EE.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCManageE2EE.swift; sourceTree = "<group>"; };
 		F7A8D72228F176B6008BBE1C /* WidgetDashboardIntentHandler-Brinding-header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "WidgetDashboardIntentHandler-Brinding-header.h"; sourceTree = "<group>"; };
 		F7A8D73028F17C44008BBE1C /* WidgetDashboardIntentHandler.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = WidgetDashboardIntentHandler.entitlements; sourceTree = "<group>"; };
@@ -2096,8 +2096,8 @@
 			children = (
 				F7CA212C25F1333200826ABB /* NCAccountRequest.storyboard */,
 				F7CA212B25F1333200826ABB /* NCAccountRequest.swift */,
-				F7A60F85292D215000FCE1F2 /* NCTalkAccounts.storyboard */,
-				F7A60F84292D215000FCE1F2 /* NCTalkAccounts.swift */,
+				F7A60F85292D215000FCE1F2 /* NCShareAccounts.storyboard */,
+				F7A60F84292D215000FCE1F2 /* NCShareAccounts.swift */,
 			);
 			path = "Account Request";
 			sourceTree = "<group>";
@@ -2875,7 +2875,7 @@
 				F7F4F10627ECDBDB008676F9 /* Inconsolata-Medium.ttf in Resources */,
 				F7AC934A296193050002BC0F /* Reasons to use Nextcloud.pdf in Resources */,
 				F749C10D23C4A5340027D966 /* NCIntro.storyboard in Resources */,
-				F7A60F87292D215000FCE1F2 /* NCTalkAccounts.storyboard in Resources */,
+				F7A60F87292D215000FCE1F2 /* NCShareAccounts.storyboard in Resources */,
 				F7239877253D86D300257F49 /* NCEmptyView.xib in Resources */,
 				F747BA1F22354D2000971601 /* NCCreateFormUploadVoiceNote.storyboard in Resources */,
 				F719D9E0288D37A300762E33 /* NCColorPicker.storyboard in Resources */,
@@ -3222,7 +3222,7 @@
 				F769454622E9F1B0000A798A /* NCShareCommon.swift in Sources */,
 				F70753F12542A9A200972D44 /* NCViewerMedia.swift in Sources */,
 				F78A18B823CDE2B300F681F3 /* NCViewerRichWorkspace.swift in Sources */,
-				F7A60F86292D215000FCE1F2 /* NCTalkAccounts.swift in Sources */,
+				F7A60F86292D215000FCE1F2 /* NCShareAccounts.swift in Sources */,
 				F77910AB25DD53C700CEDB9E /* NCSettingsBundleHelper.swift in Sources */,
 				AF4BF61927562A4B0081CEEF /* NCManageDatabase+Metadata.swift in Sources */,
 				F78A18B623CDD07D00F681F3 /* NCViewerRichWorkspaceWebView.swift in Sources */,

+ 2 - 2
iOSClient/Account Request/NCTalkAccounts.storyboard → iOSClient/Account Request/NCShareAccounts.storyboard

@@ -9,10 +9,10 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <scenes>
-        <!--Talk Accounts-->
+        <!--Share Accounts-->
         <scene sceneID="L90-uG-f4z">
             <objects>
-                <viewController id="V0q-CP-xMJ" customClass="NCTalkAccounts" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
+                <viewController id="V0q-CP-xMJ" customClass="NCShareAccounts" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
                     <layoutGuides>
                         <viewControllerLayoutGuide type="top" id="4vK-ua-S0e"/>
                         <viewControllerLayoutGuide type="bottom" id="hTI-Bw-Fws"/>

+ 12 - 17
iOSClient/Account Request/NCTalkAccounts.swift → iOSClient/Account Request/NCShareAccounts.swift

@@ -1,5 +1,5 @@
 //
-//  NCTalkAccounts.swift
+//  NCShareAccounts.swift
 //  Nextcloud
 //
 //  Created by Marino Faggiana on 22/11/22.
@@ -24,26 +24,26 @@
 import UIKit
 import NextcloudKit
 
-public protocol NCTalkAccountsDelegate: AnyObject {
+public protocol NCShareAccountsDelegate: AnyObject {
     func selected(url: String, user: String)
 }
 
 // optional func
-public extension NCTalkAccountsDelegate {
+public extension NCShareAccountsDelegate {
     func selected(url: String, user: String) {}
 }
 
-class NCTalkAccounts: UIViewController {
+class NCShareAccounts: UIViewController {
 
     @IBOutlet weak var titleLabel: UILabel!
     @IBOutlet weak var tableView: UITableView!
     @IBOutlet weak var progressView: UIProgressView!
 
-    public var accounts: [NKDataAccountFile] = []
+    public var accounts: [NKShareAccounts.DataAccounts] = []
     public let heightCell: CGFloat = 60
     public var enableTimerProgress: Bool = true
     public var dismissDidEnterBackground: Bool = true
-    public weak var delegate: NCTalkAccountsDelegate?
+    public weak var delegate: NCShareAccountsDelegate?
 
     private var timer: Timer?
     private var time: Float = 0
@@ -128,7 +128,7 @@ class NCTalkAccounts: UIViewController {
     }
 }
 
-extension NCTalkAccounts: UITableViewDelegate {
+extension NCShareAccounts: UITableViewDelegate {
 
     func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
 
@@ -149,7 +149,7 @@ extension NCTalkAccounts: UITableViewDelegate {
     }
 }
 
-extension NCTalkAccounts: UITableViewDataSource {
+extension NCShareAccounts: UITableViewDataSource {
 
     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
         return accounts.count
@@ -169,17 +169,12 @@ extension NCTalkAccounts: UITableViewDataSource {
 
         let account = accounts[indexPath.row]
 
-        if let avatarPath = account.avatar, !avatarPath.isEmpty, let avatarImage = avatarImage {
-            do {
-                let data = try Data(contentsOf: URL(fileURLWithPath: avatarPath))
-                if let image = UIImage(data: data) {
-                    avatarImage.image = image
-                }
-            } catch { print("Error: \(error)") }
+        if let image = account.image {
+            avatarImage?.image = image
         }
 
-        if let alias = account.alias, !alias.isEmpty {
-            userLabel?.text = alias.uppercased() + " (\(account.user))"
+        if let name = account.name, !name.isEmpty {
+            userLabel?.text = name.uppercased() + " (\(account.user))"
         } else {
             userLabel?.text = account.user.uppercased()
         }

+ 7 - 14
iOSClient/AppDelegate.swift

@@ -629,24 +629,17 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     func createDataAccountFile() -> Error? {
         guard !account.isEmpty, let dirGroupApps = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroupApps) else { return nil }
 
-        try? FileManager.default.createDirectory(at: dirGroupApps.appendingPathComponent(NCGlobal.shared.appDataShareNextcloud), withIntermediateDirectories: true)
-        let url = dirGroupApps.appendingPathComponent(NCGlobal.shared.appDataShareNextcloud + "/" + NCGlobal.shared.fileAccounts)
         let tableAccount = NCManageDatabase.shared.getAllAccount()
-        var accounts = [NKDataAccountFile]()
+        var accounts = [NKShareAccounts.DataAccounts]()
         for account in tableAccount {
             let alias = account.alias.isEmpty ? account.displayName : account.alias
             let userBaseUrl = account.user + "-" + (URL(string: account.urlBase)?.host ?? "")
             let avatarFileName = userBaseUrl + "-\(account.user).png"
-            let atPathAvatar = String(CCUtility.getDirectoryUserData()) + "/" + avatarFileName
-            let toPathAvatar = (dirGroupApps.appendingPathComponent(NCGlobal.shared.appDataShareNextcloud + "/" + avatarFileName)).path
-            if FileManager.default.fileExists(atPath: atPathAvatar) {
-                NCUtilityFileSystem.shared.copyFile(atPath: atPathAvatar, toPath: toPathAvatar)
-                accounts.append(NKDataAccountFile(withUrl: account.urlBase, user: account.user, alias: alias, avatar: toPathAvatar))
-            } else {
-                accounts.append(NKDataAccountFile(withUrl: account.urlBase, user: account.user, alias: alias))
-            }
+            let pathAvatarFileName = String(CCUtility.getDirectoryUserData()) + "/" + avatarFileName
+            let image = UIImage(contentsOfFile: pathAvatarFileName)
+            accounts.append(NKShareAccounts.DataAccounts(withUrl: account.urlBase, user: account.user, name: alias, image: image))
         }
-        return NKCommon.shared.createDataAccountFile(at: url, accounts: accounts)
+        return NKShareAccounts().putShareAccounts(at: dirGroupApps, app: NCGlobal.shared.appScheme, dataAccounts: accounts)
     }
 
     // MARK: - Account Request
@@ -808,7 +801,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
          nextcloud://open-action?action=create-voice-memo&&user=marinofaggiana&url=https://cloud.nextcloud.com
          */
 
-        if !account.isEmpty && scheme == "nextcloud" && action == "open-action" {
+        if !account.isEmpty && scheme == NCGlobal.shared.appScheme && action == "open-action" {
 
             if let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) {
 
@@ -884,7 +877,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
          nextcloud://open-file?path=Talk/IMG_0000123.jpg&user=marinofaggiana&link=https://cloud.nextcloud.com/f/123
          */
 
-        else if !account.isEmpty && scheme == "nextcloud" && action == "open-file" {
+        else if !account.isEmpty && scheme == NCGlobal.shared.appScheme && action == "open-file" {
 
             if let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) {
 

+ 18 - 18
iOSClient/Login/NCLogin.swift

@@ -42,7 +42,7 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate {
     private var activeTextfieldDiff: CGFloat = 0
     private var activeTextField = UITextField()
 
-    private var talkAccounts: [NKDataAccountFile]?
+    private var shareAccounts: [NKShareAccounts.DataAccounts]?
 
     // MARK: - View Life Cycle
 
@@ -115,18 +115,18 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate {
             navigationItem.leftBarButtonItem = navigationItemCancel
         }
 
-        if NCBrandOptions.shared.use_GroupApps, let dirGroupApps = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroupApps), let url = URL(string: "nextcloudtalk://"), UIApplication.shared.canOpenURL(url) {
-            let url = dirGroupApps.appendingPathComponent(NCGlobal.shared.appDataShareTalk + "/" + NCGlobal.shared.fileAccounts)
-            if FileManager.default.fileExists(atPath: url.path), let talkAccounts = NKCommon.shared.readDataAccountFile(at: url) {
-                var accountTemp = [NKDataAccountFile]()
-                for talkAccount in talkAccounts {
-                    if NCManageDatabase.shared.getAccount(predicate: NSPredicate(format: "urlBase == %@ AND user == %@", talkAccount.url, talkAccount.user)) == nil {
-                        accountTemp.append(talkAccount)
+        if NCBrandOptions.shared.use_GroupApps, let dirGroupApps = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroupApps) {
+            if let shareAccounts = NKShareAccounts().getShareAccount(at: dirGroupApps, application: UIApplication.shared) {
+                var accountTemp = [NKShareAccounts.DataAccounts]()
+                for shareAccount in shareAccounts {
+                    if NCManageDatabase.shared.getAccount(predicate: NSPredicate(format: "urlBase == %@ AND user == %@", shareAccount.url, shareAccount.user)) == nil {
+                        accountTemp.append(shareAccount)
                     }
                 }
                 if !accountTemp.isEmpty {
-                    self.talkAccounts = accountTemp
-                    let navigationItemTalk = UIBarButtonItem(image: UIImage(named: "talk_bar"), style: .plain, target: self, action: #selector(openTalkAccountsViewController))
+                    self.shareAccounts = accountTemp
+                    let image = UIImage(systemName: "person.line.dotted.person")
+                    let navigationItemTalk = UIBarButtonItem(image: image, style: .plain, target: self, action: #selector(openShareAccountsViewController))
                     navigationItemTalk.tintColor = textColor
                     self.navigationItem.rightBarButtonItem = navigationItemTalk
                 }
@@ -145,10 +145,10 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate {
 
         appDelegate.timerErrorNetworking?.invalidate()
 
-        if self.talkAccounts != nil, let image = UIImage(named: "talk"), let backgroundColor =  NCBrandColor.shared.brandElement.lighter(by: 10) {
-            NCContentPresenter.shared.alertAction(image: image, backgroundColor: backgroundColor, textColor: textColor, title: "_talk_detect_", description: "_talk_add_account_", textCancelButton: "_cancel_", textOkButton: "_ok_", attributes: EKAttributes.topFloat) { identifier in
+        if self.shareAccounts != nil, let image = UIImage(systemName: "person.line.dotted.person")?.withTintColor(.white, renderingMode: .alwaysOriginal), let backgroundColor = NCBrandColor.shared.brandElement.lighter(by: 10) {
+            NCContentPresenter.shared.alertAction(image: image, contentModeImage: .scaleAspectFit, sizeImage: CGSize(width: 45, height: 45),backgroundColor: backgroundColor, textColor: textColor, title: "_apps_nextcloud_detect_", description: "_add_existing_account_", textCancelButton: "_cancel_", textOkButton: "_ok_", attributes: EKAttributes.topFloat) { identifier in
                 if identifier == "ok" {
-                    self.openTalkAccountsViewController()
+                    self.openShareAccountsViewController()
                 }
             }
         }
@@ -228,17 +228,17 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate {
 
     // MARK: - Talk accounts View Controller
 
-    @objc func openTalkAccountsViewController() {
+    @objc func openShareAccountsViewController() {
 
-        if let talkAccounts = self.talkAccounts, let vc = UIStoryboard(name: "NCTalkAccounts", bundle: nil).instantiateInitialViewController() as? NCTalkAccounts {
+        if let shareAccounts = self.shareAccounts, let vc = UIStoryboard(name: "NCShareAccounts", bundle: nil).instantiateInitialViewController() as? NCShareAccounts {
 
-            vc.accounts = talkAccounts
+            vc.accounts = shareAccounts
             vc.enableTimerProgress = false
             vc.dismissDidEnterBackground = false
             vc.delegate = self
 
             let screenHeighMax = UIScreen.main.bounds.height - (UIScreen.main.bounds.height/5)
-            let numberCell = talkAccounts.count
+            let numberCell = shareAccounts.count
             let height = min(CGFloat(numberCell * Int(vc.heightCell) + 45), screenHeighMax)
 
             let popup = NCPopupViewController(contentController: vc, popupWidth: 300, popupHeight: height+20)
@@ -439,7 +439,7 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate {
     }
 }
 
-extension NCLogin: NCTalkAccountsDelegate {
+extension NCLogin: NCShareAccountsDelegate {
 
     func selected(url: String, user: String) {
         isUrlValid(url: url, user: user)

+ 1 - 6
iOSClient/NCGlobal.swift

@@ -78,11 +78,6 @@ class NCGlobal: NSObject {
     @objc let appScan                               = "Library/Application Support/Scan"
     @objc let appUserData                           = "Library/Application Support/UserData"
 
-    // Directory on Group data share Nextcloud apps
-    //
-    @objc let appDataShareTalk                      = "Library/Application Support/Talk"
-    @objc let appDataShareNextcloud                 = "Library/Application Support/Nextcloud"
-
     // Service
     //
     @objc let serviceShareKeyChain                  = "Crypto Cloud"
@@ -94,6 +89,7 @@ class NCGlobal: NSObject {
     //
     @objc let appName                               = "files"
     @objc let talkName                              = "talk-message"
+    @objc let appScheme                             = "nextcloud"
 
     // Nextcloud version
     //
@@ -115,7 +111,6 @@ class NCGlobal: NSObject {
     //
     let databaseDefault                             = "nextcloud.realm"
     let databaseSchemaVersion: UInt64               = 266
-    let fileAccounts: String                        = "accounts.json"
 
     // Intro selector
     //

+ 0 - 1
iOSClient/Settings/CCAdvanced.m

@@ -461,7 +461,6 @@
 
         [CCUtility removeGroupDirectoryProviderStorage];
         [CCUtility removeGroupApplicationSupport];
-        [CCUtility removeGroupDataShareAppsNextcloud];
         
         [CCUtility removeDocumentsDirectory];
         [CCUtility removeTemporaryDirectory];

+ 2 - 2
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -905,8 +905,8 @@
 "_no_items_"                = "No items";
 "_check_back_later_"        = "Check back later";
 "_exporting_video_"         = "Exporting video … Tap to cancel.";
-"_talk_detect_"             = "Detected Nextcloud Talk";
-"_talk_add_account_"        = "Nextcloud Talk has been detected, do you want to add an existing account?";
+"_apps_nextcloud_detect_"   = "Detected Nextcloud apps";
+"_add_existing_account_"    = "Other Nextcloud Apps has been detected, do you want to add an existing account?";
 "_status_in_progress_"      = "Status reading in progress …";
 "_status_e2ee_on_server_"   = "The end-to-end encryption is already configured in the server but not yet enabled on this device";
 "_status_e2ee_not_setup_"   = "The end-to-end encryption is not yet configured on the server";

+ 0 - 1
iOSClient/Utility/CCUtility.h

@@ -227,7 +227,6 @@
 + (void)removeDocumentsDirectory;
 + (void)removeTemporaryDirectory;
 + (void)emptyTemporaryDirectory;
-+ (void)removeGroupDataShareAppsNextcloud;
 
 + (NSString *)getTitleSectionDate:(NSDate *)date;
 

+ 0 - 7
iOSClient/Utility/CCUtility.m

@@ -1208,13 +1208,6 @@
     }
 }
 
-+ (void)removeGroupDataShareAppsNextcloud
-{
-    NSURL *dirGroup = [[NSFileManager defaultManager] containerURLForSecurityApplicationGroupIdentifier:[NCBrandOptions shared].capabilitiesGroupApps];
-    NSString *path = [[dirGroup URLByAppendingPathComponent:NCGlobal.shared.appDataShareNextcloud] path];
-    [[NSFileManager defaultManager] removeItemAtPath:path error:nil];
-}
-
 + (NSString *)getTitleSectionDate:(NSDate *)date
 {
     NSString *title;

+ 2 - 2
iOSClient/Utility/NCContentPresenter.swift

@@ -150,7 +150,7 @@ class NCContentPresenter: NSObject {
 
     // MARK: -
 
-    func alertAction(image: UIImage, backgroundColor: UIColor, textColor: UIColor, title: String, description: String, textCancelButton: String, textOkButton: String, attributes: EKAttributes, completion: @escaping (_ identifier: String) -> Void) {
+    func alertAction(image: UIImage, contentModeImage: UIView.ContentMode = .scaleToFill, sizeImage: CGSize = CGSize(width: 34, height: 34), backgroundColor: UIColor, textColor: UIColor, title: String, description: String, textCancelButton: String, textOkButton: String, attributes: EKAttributes, completion: @escaping (_ identifier: String) -> Void) {
 
         var buttonAttributes: EKAttributes {
             var attributes = attributes
@@ -172,7 +172,7 @@ class NCContentPresenter: NSObject {
             return attributes
         }
 
-        let simpleMessage = EKSimpleMessage(image: EKProperty.ImageContent(image: image, size: CGSize(width: 34, height: 34)),
+        let simpleMessage = EKSimpleMessage(image: EKProperty.ImageContent(image: image, size: sizeImage, contentMode: contentModeImage),
                                             title: EKProperty.LabelContent(text: NSLocalizedString(title, comment: ""), style: .init(font: MainFont.medium.with(size: 15), color: EKColor(textColor)), accessibilityIdentifier: "title"),
                                             description: EKProperty.LabelContent(text: NSLocalizedString(description, comment: ""), style: .init( font: MainFont.light.with(size: 13), color: EKColor(textColor)), accessibilityIdentifier: "description"))