Эх сурвалжийг харах

Merge pull request #1842 from nextcloud/alignment

Alignment version and update Package Dependencies
Marino Faggiana 3 жил өмнө
parent
commit
41c6de5a6c

+ 0 - 2
.gitignore

@@ -37,8 +37,6 @@ DerivedData
 
 ## Package
 Carthage/
-Package.resolved
-Cartfile.resolved
 
 ### SwiftPackageManager ###
 .swiftpm

+ 0 - 9
Cartfile

@@ -1,11 +1,2 @@
-github "tilltue/TLPhotoPicker" "2.1.4"
-github "kishikawakatsumi/UICKeyChainStore"
-github "WenchaoD/FSCalendar" "2.8.0"
-github "FabrizioBrancati/Queuer"
-github "xmartlabs/XLForm" ~> 4.1
-github "AssistoLab/DropDown" "v2.3.13"
-
 github "https://github.com/marinofaggiana/KTVHTTPCache" "2.0.2"
 github "https://github.com/marinofaggiana/TOPasscodeViewController" "master"
-github "https://github.com/marinofaggiana/OpenSSL" "master"
-github "https://github.com/marinofaggiana/ChromaColorPicker" "master"

+ 3 - 0
Cartfile.resolved

@@ -0,0 +1,3 @@
+github "marinofaggiana/ChromaColorPicker" "b1b2c58c3c5617c73863a073cb6393c79195932e"
+github "marinofaggiana/KTVHTTPCache" "2.0.2"
+github "marinofaggiana/TOPasscodeViewController" "7a750031bb86d9dc9f193bf34a38bbd288b3c4fd"

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 340 - 157
Nextcloud.xcodeproj/project.pbxproj


+ 91 - 19
Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

@@ -15,8 +15,8 @@
         "repositoryURL": "https://github.com/Alamofire/Alamofire",
         "state": {
           "branch": null,
-          "revision": "d120af1e8638c7da36c8481fd61a66c0c08dc4fc",
-          "version": "5.4.4"
+          "revision": "f82c23a8a7ef8dc1a49a8bfc6a96883e79121864",
+          "version": "5.5.0"
         }
       },
       {
@@ -28,13 +28,31 @@
           "version": "0.7.2"
         }
       },
+      {
+        "package": "ChromaColorPicker",
+        "repositoryURL": "https://github.com/marinofaggiana/ChromaColorPicker",
+        "state": {
+          "branch": "master",
+          "revision": "b1b2c58c3c5617c73863a073cb6393c79195932e",
+          "version": null
+        }
+      },
       {
         "package": "CocoaLumberjack",
         "repositoryURL": "https://github.com/CocoaLumberjack/CocoaLumberjack.git",
         "state": {
           "branch": null,
-          "revision": "e518eb6e362df327574ba5e04269cd6d29f40aec",
-          "version": "3.7.2"
+          "revision": "80ada1f753b0d53d9b57c465936a7c4169375002",
+          "version": "3.7.4"
+        }
+      },
+      {
+        "package": "DropDown",
+        "repositoryURL": "https://github.com/AssistoLab/DropDown",
+        "state": {
+          "branch": "master",
+          "revision": "2ab6f6ce19f0117d1a76ea043ef8f57722c65d16",
+          "version": null
         }
       },
       {
@@ -55,6 +73,15 @@
           "version": "2.5.1"
         }
       },
+      {
+        "package": "FSCalendar",
+        "repositoryURL": "https://github.com/WenchaoD/FSCalendar",
+        "state": {
+          "branch": null,
+          "revision": "afaf247581eb1f8aea847f2e6c99c665ae900494",
+          "version": "2.8.3"
+        }
+      },
       {
         "package": "GoogleAppMeasurement",
         "repositoryURL": "https://github.com/google/GoogleAppMeasurement.git",
@@ -113,9 +140,9 @@
         "package": "NCCommunication",
         "repositoryURL": "https://github.com/nextcloud/ios-communication-library/",
         "state": {
-          "branch": null,
-          "revision": "c8e3eac61a846775d570b1d252612a8d2d02930d",
-          "version": "0.99.3"
+          "branch": "develop",
+          "revision": "ffbe682e48882a064de692bae82995229c5a88ff",
+          "version": null
         }
       },
       {
@@ -154,13 +181,22 @@
           "version": "2.30908.0"
         }
       },
+      {
+        "package": "OpenSSL",
+        "repositoryURL": "https://github.com/krzyzanowskim/OpenSSL",
+        "state": {
+          "branch": null,
+          "revision": "45545c5729b5597d2d4910a5edd07b1bf42e5839",
+          "version": "1.1.1200"
+        }
+      },
       {
         "package": "Parchment",
-        "repositoryURL": "https://github.com/marinofaggiana/Parchment",
+        "repositoryURL": "https://github.com/rechsteiner/Parchment",
         "state": {
-          "branch": "master",
-          "revision": "f4081dbd1a1793217686a381330e90b6626710c7",
-          "version": null
+          "branch": null,
+          "revision": "2b1a370e71480cb1a95dd56ef8bddc2e0a45e033",
+          "version": "3.1.0"
         }
       },
       {
@@ -182,21 +218,21 @@
         }
       },
       {
-        "package": "QuickLayout",
-        "repositoryURL": "https://github.com/huri000/QuickLayout",
+        "package": "Queuer",
+        "repositoryURL": "https://github.com/FabrizioBrancati/Queuer",
         "state": {
           "branch": null,
-          "revision": "6be62decbe508d8fc8f9dbafc349d05bab03c38b",
-          "version": "3.0.1"
+          "revision": "52515108d0ac4616d9e15ffcc7ad986e300d31ff",
+          "version": "2.1.1"
         }
       },
       {
-        "package": "Realm",
-        "repositoryURL": "https://github.com/realm/realm-cocoa",
+        "package": "QuickLayout",
+        "repositoryURL": "https://github.com/huri000/QuickLayout",
         "state": {
           "branch": null,
-          "revision": "f483fa0a52f6d49897d133a827510a35e21183c1",
-          "version": "10.20.1"
+          "revision": "6be62decbe508d8fc8f9dbafc349d05bab03c38b",
+          "version": "3.0.1"
         }
       },
       {
@@ -208,6 +244,15 @@
           "version": "11.6.1"
         }
       },
+      {
+        "package": "Realm",
+        "repositoryURL": "https://github.com/realm/realm-swift",
+        "state": {
+          "branch": null,
+          "revision": "e83cc9f28e8bccd477b6b81cee521c02239d2773",
+          "version": "10.20.2"
+        }
+      },
       {
         "package": "SVGKit",
         "repositoryURL": "https://github.com/SVGKit/SVGKit.git",
@@ -270,6 +315,33 @@
           "revision": "d7a1d23f04c86c1cd2e8f19247dd15d74e0ea8be",
           "version": "5.6.0"
         }
+      },
+      {
+        "package": "TLPhotoPicker",
+        "repositoryURL": "https://github.com/tilltue/TLPhotoPicker",
+        "state": {
+          "branch": null,
+          "revision": "43cc38e7ed183b3b25867ea3e1f271468ca2756f",
+          "version": "2.1.8"
+        }
+      },
+      {
+        "package": "UICKeyChainStore",
+        "repositoryURL": "https://github.com/kishikawakatsumi/UICKeyChainStore",
+        "state": {
+          "branch": "master",
+          "revision": "db869212bc69b6198a62efe03e2f5fc8e19c6b65",
+          "version": null
+        }
+      },
+      {
+        "package": "XLForm",
+        "repositoryURL": "https://github.com/xmartlabs/XLForm",
+        "state": {
+          "branch": null,
+          "revision": "870afc56602fd518e33d0b271371a2d5acd410ea",
+          "version": "4.3.0"
+        }
       }
     ]
   },

+ 0 - 1
iOSClient/Brand/NCBrand.swift

@@ -92,7 +92,6 @@ import UIKit
 
     @objc public var disable_background_color:          Bool = true
     @objc public var disable_background_image:          Bool = true
-    @objc public var disable_ff:                        Bool = true
 
     override init() {
 

+ 7 - 0
iOSClient/Data/NCDatabase.swift

@@ -526,6 +526,13 @@ class tableVideo: Object {
     @objc dynamic var duration: Int64 = 0
     @objc dynamic var ocId = ""
     @objc dynamic var time: Int64 = 0
+    @objc dynamic var codecNameVideo: String?
+    @objc dynamic var codecNameAudio: String?
+    @objc dynamic var codecAudioChannelLayout: String?
+    @objc dynamic var codecAudioLanguage: String?
+    @objc dynamic var codecSubtitleLanguage: String?
+    @objc dynamic var codecMaxCompatibility: Bool = false
+    @objc dynamic var codecQuality: String?
 
     override static func primaryKey() -> String {
         return "ocId"

+ 45 - 0
iOSClient/Data/NCManageDatabase.swift

@@ -1721,6 +1721,51 @@ class NCManageDatabase: NSObject {
             NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
         }
     }
+    
+    func addVideoCodec(metadata: tableMetadata, codecNameVideo: String?, codecNameAudio: String?, codecAudioChannelLayout: String?, codecAudioLanguage: String?, codecSubtitleLanguage: String?, codecMaxCompatibility: Bool, codecQuality: String?) {
+
+        let realm = try! Realm()
+
+        do {
+            try realm.safeWrite {
+                if let result = realm.objects(tableVideo.self).filter("account == %@ AND ocId == %@", metadata.account, metadata.ocId).first {
+                    if let codecNameVideo = codecNameVideo { result.codecNameVideo = codecNameVideo }
+                    if let codecNameAudio = codecNameAudio { result.codecNameAudio = codecNameAudio }
+                    if let codecAudioChannelLayout = codecAudioChannelLayout { result.codecAudioChannelLayout = codecAudioChannelLayout }
+                    if let codecAudioLanguage = codecAudioLanguage { result.codecAudioLanguage = codecAudioLanguage }
+                    if let codecSubtitleLanguage = codecSubtitleLanguage { result.codecSubtitleLanguage = codecSubtitleLanguage }
+                    result.codecMaxCompatibility = codecMaxCompatibility
+                    if let codecQuality = codecQuality { result.codecQuality = codecQuality }
+                    realm.add(result, update: .all)
+                } else {
+                    let addObject = tableVideo()
+                    addObject.account = metadata.account
+                    addObject.ocId = metadata.ocId
+                    addObject.codecNameVideo = codecNameVideo
+                    addObject.codecNameAudio = codecNameAudio
+                    addObject.codecAudioChannelLayout = codecAudioChannelLayout
+                    addObject.codecAudioLanguage = codecAudioLanguage
+                    addObject.codecSubtitleLanguage = codecSubtitleLanguage
+                    addObject.codecMaxCompatibility = codecMaxCompatibility
+                    addObject.codecQuality = codecQuality
+                    realm.add(addObject, update: .all)
+                }
+            }
+        } catch let error {
+            NCCommunicationCommon.shared.writeLog("Could not write to database: \(error)")
+        }
+    }
+    
+    func getVideo(metadata: tableMetadata?) -> tableVideo? {
+        guard let metadata = metadata else { return nil }
+        
+        let realm = try! Realm()
+        guard let result = realm.objects(tableVideo.self).filter("account == %@ AND ocId == %@", metadata.account, metadata.ocId).first else {
+            return nil
+        }
+        
+        return tableVideo.init(value: result)
+    }
 
     func getVideoDurationTime(metadata: tableMetadata?) -> CMTime? {
         guard let metadata = metadata else { return nil }

+ 21 - 1
iOSClient/Menu/NCViewer+Menu.swift

@@ -133,7 +133,27 @@ extension NCViewer {
                 )
             )
         }
-
+        
+        //
+        // CONVERSION VIDEO TO MPEG4 (MFFF Lib)
+        //
+        #if MFFFLIB
+        if metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue {
+            
+            actions.append(
+                NCMenuAction(
+                    title: NSLocalizedString("_video_conversion_", comment: ""),
+                    icon: NCUtility.shared.loadImage(named: "film"),
+                    action: { menuAction in
+                        if let ncplayer = (viewController as? NCViewerMediaPage)?.currentViewController.ncplayer {
+                            ncplayer.convertVideo()
+                        }
+                    }
+                )
+            )
+        }
+        #endif
+        
         //
         // SAVE IMAGE / VIDEO
         //

+ 1 - 1
iOSClient/NCGlobal.swift

@@ -112,7 +112,7 @@ class NCGlobal: NSObject {
     // Database Realm
     //
     let databaseDefault                             = "nextcloud.realm"
-    let databaseSchemaVersion: UInt64               = 213
+    let databaseSchemaVersion: UInt64               = 215
 
     // Intro selector
     //

+ 1 - 1
iOSClient/Networking/NCNetworkingE2EE.swift

@@ -86,7 +86,7 @@ import Alamofire
                                 object.serverUrl = serverUrl
                                 object.version = 1
 
-                                _ = NCManageDatabase.shared.addE2eEncryption(object)
+                                NCManageDatabase.shared.addE2eEncryption(object)
 
                                 self.sendE2EMetadata(account: account, serverUrl: serverUrl, fileNameRename: nil, fileNameNewRename: nil, deleteE2eEncryption: nil, urlBase: urlBase) { e2eToken, errorCode, errorDescription in
                                     // unlock

+ 14 - 11
iOSClient/Security/NCEndToEndEncryption.m

@@ -78,16 +78,21 @@
 {
     OPENSSL_init();
     
+    int ret;
     EVP_PKEY * pkey;
     pkey = EVP_PKEY_new();
-    
     RSA * rsa;
-    rsa = RSA_generate_key(
-                           2048, /* number of bits for the key - 2048 is a sensible value */
-                           RSA_F4, /* exponent - RSA_F4 is defined as 0x10001L */
-                           NULL, /* callback - can be NULL if we aren't displaying progress */
-                           NULL /* callback argument - not needed in this case */
-                           );
+    BIGNUM *bignum = BN_new();
+    ret = BN_set_word(bignum, RSA_F4);
+    if (ret != 1) {
+        return NO;
+    }
+
+    rsa = RSA_new();
+    ret = RSA_generate_key_ex(rsa, 2048, bignum, NULL);
+    if (ret != 1) {
+        return NO;
+    }
     
     EVP_PKEY_assign_RSA(pkey, rsa);
     
@@ -581,7 +586,6 @@
 
 - (NSData *)encryptAsymmetricString:(NSString *)plain publicKey:(NSString *)publicKey privateKey:(NSString *)privateKey
 {
-    ENGINE *eng = ENGINE_get_default_RSA();
     EVP_PKEY *key = NULL;
     int status = 0;
     
@@ -616,7 +620,7 @@
             return nil;
     }
     
-    EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(key, eng);
+    EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(key, NULL);
     if (!ctx)
         return nil;
     
@@ -658,7 +662,6 @@
 - (NSString *)decryptAsymmetricData:(NSData *)cipherData privateKey:(NSString *)privateKey
 {
     unsigned char *pKey = (unsigned char *)[privateKey UTF8String];
-    ENGINE *eng = ENGINE_get_default_RSA();
     int status = 0;
     
     BIO *bio = BIO_new_mem_buf(pKey, -1);
@@ -669,7 +672,7 @@
     if (!key)
         return nil;
     
-    EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(key, eng);
+    EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(key, NULL);
     if (!ctx)
         return nil;
     

+ 1 - 1
iOSClient/Settings/CCAdvanced.h

@@ -22,7 +22,7 @@
 //
 
 #import <MessageUI/MFMailComposeViewController.h>
-#import <XLForm/XLForm.h>
+#import <XLForm.h>
 
 @interface CCAdvanced : XLFormViewController <MFMailComposeViewControllerDelegate>
 

+ 1 - 1
iOSClient/Settings/CCManageAccount.h

@@ -21,7 +21,7 @@
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
 
-#import <XLForm/XLForm.h>
+#import <XLForm.h>
 
 @interface CCManageAccount : XLFormViewController
 

+ 1 - 1
iOSClient/Settings/CCManageAutoUpload.h

@@ -21,7 +21,7 @@
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
 
-#import <XLForm/XLForm.h>
+#import <XLForm.h>
 
 @interface CCManageAutoUpload : XLFormViewController
 

+ 1 - 1
iOSClient/Settings/NCManageEndToEndEncryption.h

@@ -21,7 +21,7 @@
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 //
 
-#import <XLForm/XLForm.h>
+#import <XLForm.h>
 
 @class NCEndToEndInitialize;
 

+ 1 - 1
iOSClient/Settings/NCSettings.h

@@ -23,7 +23,7 @@
 
 #import <UIKit/UIKit.h>
 #import <MessageUI/MessageUI.h>
-#import <XLForm/XLForm.h>
+#import <XLForm.h>
 #import "CCUtility.h"
 
 @interface NCSettings : XLFormViewController

+ 15 - 4
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -138,7 +138,7 @@
 "_move_or_copy_"            = "Move or copy";
 "_copy_"                    = "Copy";
 "_now_"                     = "Now";
-"_wait_"                    = "Please wait …";
+"_wait_"                    = "Please wait…";
 "_attention_"               = "Attention";
 "_recent_"                  = "Recent";
 "_view_in_folder_"          = "View in folder";
@@ -163,7 +163,7 @@
 "_settings_account_request_" = "Request account at startup";
 "_print_"                   = "Print";
 "_alias_"                   = "Alias";
-"_alias_footer_"            = "Give your account names a descriptive name such as Home, Office, School …";
+"_alias_footer_"            = "Give your account names a descriptive name such as Home, Office, School…";
 "_upload_chunk_"            = "The file you are uploading is large, keep the app in the foreground until complete";
 "_upload_e2ee_"             = "The file you are uploading is encrypted, keep the app in the foreground until complete";
 "_chunk_size_mb_"           = "Chunk size in MB";
@@ -242,7 +242,7 @@
 "_network_not_available_"   = "Network unavailable";
 "_file_too_big_"            = "File too large to be encrypted/decrypted";
 "_file_too_big_max_100_"    = "File too large (max 100 kb.)";
-"_...loading..._"           = "Loading …";
+"_...loading..._"           = "Loading…";
 "_download_plist_"          = " ";
 "_no_reuploadfile_"         = "Could not find nor resend file. Delete the upload and reload the file to upload it.";
 "_file_already_exists_"     = "Unable to complete the operation, a file with the same name exists";
@@ -822,4 +822,15 @@
 "_copy_path_"               = "Copy path";
 "_certificates_"            = "Certificates";
 "_privacy_screen_"          = "Splash screen when app inactive";
-
+// Video
+"_video_conversion_"        = "Video conversion";
+"_preparation_video_"       = "Video preparation in progress…";
+"_downloading_"             = "Downloading";
+"_download_error_"          = "Download error";
+"_subtitle_"                = "Subtitle";
+"_dts_to_ac3_"              = "The DTS is not supported, it requires a conversion to Dolby Digital";
+"_reuired_conversion_"      = "This video takes a long time to convert.";
+"_stay_app_foreground_"     = "Stay with the app in the foreground…";
+"_conversion_available_"    = "The conversion is always available on menu";
+"_video_format_not_recognized_"     = "This video is not compatible, do you want to try to convert it?";
+"_conversion_max_compatibility_"    = "Max compatibility, the conversion can take much longer";

+ 1 - 1
iOSClient/Utility/CCUtility.h

@@ -27,7 +27,7 @@
 #import <sys/sysctl.h>
 #import <AssetsLibrary/AssetsLibrary.h>
 #import <MessageUI/MessageUI.h>
-#import <UICKeyChainStore/UICKeyChainStore.h>
+#import <UICKeyChainStore.h>
 #import <Photos/Photos.h>
 #import <PDFKit/PDFKit.h>
 

+ 16 - 41
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayer.swift

@@ -29,10 +29,10 @@ import MediaPlayer
 
 class NCPlayer: NSObject {
    
-    private let appDelegate = UIApplication.shared.delegate as! AppDelegate
+    internal let appDelegate = UIApplication.shared.delegate as! AppDelegate
+    internal var url: URL
+    internal var playerToolBar: NCPlayerToolBar?
     
-    private var url: URL
-    private var playerToolBar: NCPlayerToolBar?
     private var imageVideoContainer: imageVideoContainerView
     private var detailView: NCViewerMediaDetailView?
     private var viewController: UIViewController
@@ -69,7 +69,7 @@ class NCPlayer: NSObject {
         if CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: NCGlobal.shared.fileNameVideoEncoded) {
             self.url = URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: NCGlobal.shared.fileNameVideoEncoded))
         }
-        
+
         openAVPlayer() { status, error in
             
             switch status {
@@ -79,41 +79,16 @@ class NCPlayer: NSObject {
                 }
                 break
             case .failed:
-                if error?.code == AVError.Code.fileFormatNotRecognized.rawValue && !CCUtility.fileProviderStorageExists(metadata.ocId, fileNameView: NCGlobal.shared.fileNameVideoEncoded) && !NCBrandOptions.shared.disable_ff {
-                    let alertController = UIAlertController(title: NSLocalizedString("_error_", comment: ""), message: NSLocalizedString("_video_format_not_recognized_", comment: ""), preferredStyle: .alert)
-                    alertController.addAction(UIAlertAction(title: NSLocalizedString("_yes_", comment: ""), style: .default, handler: { action in
-                        /*
-                        ncFF.convertVideo { session, url in
-                            let returnCode = session?.getReturnCode()
-                             
-                            if returnCode?.isSuccess() ?? false {
-                                 self.url = url
-                                 self.openAVPlayer() { status, error in
-                                     if let error = error {
-                                         NCContentPresenter.shared.messageNotification(error.localizedDescription, description: error.localizedFailureReason, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorGeneric, priority: .max)
-                                     }
-                                 }
-                             } else if returnCode?.isCancel() ?? false {
-                                // nothing
-                             } else {
-                                 NCContentPresenter.shared.messageNotification("_error_", description: "_error_something_wrong_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorGeneric, priority: .max)
-                            }
-                         }
-                         */
-                    }))
-                    alertController.addAction(UIAlertAction(title: NSLocalizedString("_no_", comment: ""), style: .default, handler: { action in
-                        NCContentPresenter.shared.messageNotification("_info_", description: "_video_conversion_available_after_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.info, errorCode: NCGlobal.shared.errorNoError, priority: .max)
-                    }))
-                    self.appDelegate.window?.rootViewController?.present(alertController, animated: true)
+                #if MFFFLIB
+                self.convertVideo(error: error)
+                #else
+                if let title = error?.localizedDescription, let description = error?.localizedFailureReason {
+                    NCContentPresenter.shared.messageNotification(title, description: description, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorGeneric, priority: .max)
                 } else {
-                    if let title = error?.localizedDescription, let description = error?.localizedFailureReason {
-                        NCContentPresenter.shared.messageNotification(title, description: description, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorGeneric, priority: .max)
-                    } else {
-                        NCContentPresenter.shared.messageNotification("_error_", description: "_error_something_wrong_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorGeneric, priority: .max)
-                    }
+                    NCContentPresenter.shared.messageNotification("_error_", description: "_error_something_wrong_", delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: NCGlobal.shared.errorGeneric, priority: .max)
                 }
+                #endif
                 break
-                
             case .cancelled:
                 break
             default:
@@ -126,6 +101,7 @@ class NCPlayer: NSObject {
         
         print("Play URL: \(self.url)")
         player = AVPlayer(url: self.url)
+        playerToolBar?.setMetadata(self.metadata)
         
         if metadata.livePhoto {
             player?.isMuted = false
@@ -162,7 +138,7 @@ class NCPlayer: NSObject {
                         self.imageVideoContainer.image = self.imageVideoContainer.image?.image(alpha: 0)
                     }
                     
-                    self.playerToolBar?.setBarPlayer(ncplayer: self, metadata: self.metadata)
+                    self.playerToolBar?.setBarPlayer(ncplayer: self)
                     self.generatorImagePreview()
                     if !(self.detailView?.isShow() ?? false) {
                         NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterShowPlayerToolBar, userInfo: ["ocId":self.metadata.ocId, "enableTimerAutoHide": false])
@@ -256,7 +232,7 @@ class NCPlayer: NSObject {
 
         playerToolBar?.updateToolBar()
     }
-
+    
     // MARK: -
 
     func isPlay() -> Bool {
@@ -303,9 +279,7 @@ class NCPlayer: NSObject {
 
     @objc func generatorImagePreview() {
 
-        guard let time = player?.currentTime() else { return }
-        if metadata.livePhoto { return }
-        if metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue { return }
+        guard let time = player?.currentTime(), !metadata.livePhoto, metadata.classFile != NCCommunicationCommon.typeClassFile.audio.rawValue  else { return }
 
         var image: UIImage?
 
@@ -339,3 +313,4 @@ class NCPlayer: NSObject {
         }
     }
 }
+

+ 33 - 13
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCPlayerToolBar.swift

@@ -39,7 +39,7 @@ class NCPlayerToolBar: UIView {
     @IBOutlet weak var playbackSlider: UISlider!
     @IBOutlet weak var labelLeftTime: UILabel!
     @IBOutlet weak var labelCurrentTime: UILabel!
-
+   
     enum sliderEventType {
         case began
         case ended
@@ -51,6 +51,7 @@ class NCPlayerToolBar: UIView {
     private var wasInPlay: Bool = false
     private var playbackSliderEvent: sliderEventType = .ended
     private var timerAutoHide: Timer?
+    private var timerAutoHideMessage: Timer?
 
     var pictureInPictureController: AVPictureInPictureController?
     weak var viewerMediaPage: NCViewerMediaPage?
@@ -121,11 +122,15 @@ class NCPlayerToolBar: UIView {
     }
 
     // MARK: -
-
-    func setBarPlayer(ncplayer: NCPlayer, metadata: tableMetadata) {
+    
+    func setMetadata(_ metadata: tableMetadata) {
+        
+        self.metadata = metadata
+    }
+    
+    func setBarPlayer(ncplayer: NCPlayer) {
 
         self.ncplayer = ncplayer
-        self.metadata = metadata
 
         playbackSlider.value = 0
         playbackSlider.minimumValue = 0
@@ -139,7 +144,7 @@ class NCPlayerToolBar: UIView {
     }
 
     public func updateToolBar() {
-
+        
         guard let ncplayer = self.ncplayer else { return }
 
         // MUTE
@@ -205,6 +210,7 @@ class NCPlayerToolBar: UIView {
     // MARK: Handle Notifications
 
     @objc func handleRouteChange(notification: Notification) {
+        
         guard let userInfo = notification.userInfo, let reasonValue = userInfo[AVAudioSessionRouteChangeReasonKey] as? UInt, let reason = AVAudioSession.RouteChangeReason(rawValue: reasonValue) else { return }
 
         switch reason {
@@ -257,16 +263,22 @@ class NCPlayerToolBar: UIView {
 
     public func show(enableTimerAutoHide: Bool = false) {
 
-        if metadata?.classFile != NCCommunicationCommon.typeClassFile.video.rawValue && metadata?.classFile != NCCommunicationCommon.typeClassFile.audio.rawValue { return }
-        if let metadata = self.metadata, metadata.livePhoto { return }
-
+        guard let metadata = self.metadata, ncplayer != nil, !metadata.livePhoto, (metadata.classFile == NCCommunicationCommon.typeClassFile.video.rawValue || metadata.classFile == NCCommunicationCommon.typeClassFile.audio.rawValue) else
+        { return }
+        
+        #if MFFFLIB
+        if MFFF.shared.existsMFFFSession(url: URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView))) {
+            self.hide()
+            return
+        }
+        #endif
+        
         timerAutoHide?.invalidate()
         if enableTimerAutoHide {
             startTimerAutoHide()
         }
-
         if !self.isHidden { return }
-
+        
         UIView.animate(withDuration: 0.3, animations: {
             self.alpha = 1
             self.playerTopToolBarView.alpha = 1
@@ -316,8 +328,7 @@ class NCPlayerToolBar: UIView {
 
     func skip(seconds: Float64) {
 
-        guard let ncplayer = ncplayer else { return }
-        guard let player = ncplayer.player else { return }
+        guard let ncplayer = ncplayer, let player = ncplayer.player else { return }
 
         let currentTime = player.currentTime()
         var newTime: CMTime = .zero
@@ -359,7 +370,7 @@ class NCPlayerToolBar: UIView {
 
         timerAutoHide?.invalidate()
     }
-
+    
     // MARK: - Event / Gesture
 
     @objc func onSliderValChanged(slider: UISlider, event: UIEvent) {
@@ -487,6 +498,15 @@ class NCPlayerToolBar: UIView {
         }
         */
     }
+    
+    @IBAction func playerMessageButtonTouchInside(_ sender: UIButton) {
+       
+        #if MFFFLIB
+        if let metadata = metadata {
+            MFFF.shared.stopMFFFSession(url: URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)))
+        }
+        #endif
+    }
 
     func forward() {
 

+ 7 - 0
iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift

@@ -162,6 +162,13 @@ class NCViewerMedia: UIViewController {
             if let ncplayer = self.ncplayer {
                 self.viewerMediaPage?.updateCommandCenter(ncplayer: ncplayer, metadata: self.metadata)
             }
+            
+            #if MFFFLIB
+            MFFF.shared.delegate = self.ncplayer
+//            if !MFFF.shared.existsMFFFSession(url: URL(fileURLWithPath: CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView))) {
+//                self.playerToolBar.hideMessage()
+//            }
+            #endif
 
         } else if metadata.classFile == NCCommunicationCommon.typeClassFile.image.rawValue {
 

+ 2 - 2
iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.storyboard

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19162" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="ne8-hS-cp3">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="ne8-hS-cp3">
     <device id="retina5_5" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19144"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
         <capability name="Image references" minToolsVersion="12.0"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="System colors in document resources" minToolsVersion="11.0"/>

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно