Browse Source

dark mode sheeeeeet

marinofaggiana 5 years ago
parent
commit
ce3a95e3f9

+ 8 - 0
Nextcloud.xcodeproj/project.pbxproj

@@ -83,6 +83,9 @@
 		F7169A1C1EE590930086BD69 /* NCShares.m in Sources */ = {isa = PBXBuildFile; fileRef = F7169A181EE590930086BD69 /* NCShares.m */; };
 		F7169A1D1EE590930086BD69 /* NCSharesCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F7169A1A1EE590930086BD69 /* NCSharesCell.m */; };
 		F7169A1E1EE590930086BD69 /* NCSharesCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7169A1B1EE590930086BD69 /* NCSharesCell.xib */; };
+		F718088D2341FEB20039A736 /* NCActionSheetAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = F718088C2341FEB20039A736 /* NCActionSheetAppearance.swift */; };
+		F718088E2342067C0039A736 /* NCActionSheetAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = F718088C2341FEB20039A736 /* NCActionSheetAppearance.swift */; };
+		F718088F2342067C0039A736 /* NCActionSheetAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = F718088C2341FEB20039A736 /* NCActionSheetAppearance.swift */; };
 		F7226EDC1EE4089300EBECB1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7226EDB1EE4089300EBECB1 /* Main.storyboard */; };
 		F72382C02295856A005B8A07 /* FirebaseMLVisionTextModel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F72382BB22958569005B8A07 /* FirebaseMLVisionTextModel.framework */; };
 		F72382C22295856A005B8A07 /* GoogleMVTextDetectorResources.bundle in Resources */ = {isa = PBXBuildFile; fileRef = F72382BE22958569005B8A07 /* GoogleMVTextDetectorResources.bundle */; };
@@ -739,6 +742,7 @@
 		F7169A1B1EE590930086BD69 /* NCSharesCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCSharesCell.xib; sourceTree = "<group>"; };
 		F7169A301EE59BB70086BD69 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Localizable.strings; sourceTree = "<group>"; };
 		F7169A4C1EE59C640086BD69 /* tr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj/Localizable.strings; sourceTree = "<group>"; };
+		F718088C2341FEB20039A736 /* NCActionSheetAppearance.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCActionSheetAppearance.swift; sourceTree = "<group>"; };
 		F7226EDB1EE4089300EBECB1 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
 		F7229B491DF71BB300E8C4E7 /* AUTHORS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AUTHORS; sourceTree = SOURCE_ROOT; };
 		F72382BB22958569005B8A07 /* FirebaseMLVisionTextModel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = FirebaseMLVisionTextModel.framework; sourceTree = "<group>"; };
@@ -2414,6 +2418,7 @@
 			isa = PBXGroup;
 			children = (
 				F70BFC7320E0FA7C00C67599 /* NCUtility.swift */,
+				F718088C2341FEB20039A736 /* NCActionSheetAppearance.swift */,
 				F707C26421A2DC5200F6181E /* NCStoreReview.swift */,
 				F78E7064219F096B006F23E4 /* NCAvatar.swift */,
 				F76C3B871C638A4C00DC4301 /* CCError.h */,
@@ -3337,6 +3342,7 @@
 				F73CC0701E813DFF006E3047 /* BKPasscodeInputView.m in Sources */,
 				F71459BA1D12E3B700CAFEEC /* NSString+TruncateToWidth.m in Sources */,
 				F71459BC1D12E3B700CAFEEC /* Reachability.m in Sources */,
+				F718088E2342067C0039A736 /* NCActionSheetAppearance.swift in Sources */,
 				F71459BD1D12E3B700CAFEEC /* UIImage+animatedGIF.m in Sources */,
 				F73CC06D1E813DFF006E3047 /* BKPasscodeField.m in Sources */,
 				F70022C01EC4C9100080073F /* OCFileDto.m in Sources */,
@@ -3442,6 +3448,7 @@
 				F771E3F320E239A600AFB62D /* FileProviderData.swift in Sources */,
 				F771E3D720E2392D00AFB62D /* FileProviderEnumerator.swift in Sources */,
 				F7434B4220E2405500417916 /* OCSharedDto.m in Sources */,
+				F718088F2342067C0039A736 /* NCActionSheetAppearance.swift in Sources */,
 				F7434B3F20E2404B00417916 /* OCNotifications.m in Sources */,
 				F7434B6020E2445200417916 /* CCExifGeo.m in Sources */,
 				F7434B5420E240A300417916 /* NSString+Encode.m in Sources */,
@@ -3670,6 +3677,7 @@
 				F70022B31EC4C9100080073F /* OCActivity.m in Sources */,
 				F70022D41EC4C9100080073F /* NSDate+ISO8601.m in Sources */,
 				F762CB151EACB66200B38484 /* XLFormRowNavigationAccessoryView.m in Sources */,
+				F718088D2341FEB20039A736 /* NCActionSheetAppearance.swift in Sources */,
 				F762CB0A1EACB66200B38484 /* XLFormDescriptor.m in Sources */,
 				F7D4238C1F0596C6009C9782 /* UIXToolbarView.m in Sources */,
 				F7020FCE2233D7F700B7297D /* NCCreateFormUploadVoiceNote.swift in Sources */,

+ 1 - 0
iOSClient/Main/Create cloud/NCCreateMenuAdd.swift

@@ -32,6 +32,7 @@ class NCCreateMenuAdd: NSObject {
         super.init()
    
         var items = [ActionSheetItem]()
+        ActionSheet.applyAppearance(NCAppearance())
         
         items.append(ActionSheetItem(title: NSLocalizedString("_upload_photos_videos_", comment: ""), value: 1, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "file_photo"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
         

+ 2 - 0
iOSClient/Offline/NCOffline.swift

@@ -338,6 +338,7 @@ class NCOffline: UIViewController, UIGestureRecognizerDelegate, NCListCellDelega
             
             var items = [ActionSheetItem]()
             ActionSheetDeleteItemCell.appearance().titleColor = .red
+            ActionSheet.applyAppearance(NCAppearance())
 
             // 0 == CCMore, 1 = first NCOffline ....
             if (self == self.navigationController?.viewControllers[1]) {
@@ -751,6 +752,7 @@ extension NCOffline {
     func deleteItem(with metadata: tableMetadata, sender: Any) {
         
         var items = [ActionSheetItem]()
+        ActionSheet.applyAppearance(NCAppearance())
         
         guard let tableDirectory = NCManageDatabase.sharedInstance.getTableDirectory(predicate: NSPredicate(format: "account == %@ AND serverUrl == serverUrl", appDelegate.activeAccount, metadata.serverUrl)) else {
             return

+ 2 - 1
iOSClient/Share/NCShareComments.swift

@@ -140,7 +140,8 @@ class NCShareComments: UIViewController, NCShareCommentsCellDelegate {
      
         var items = [ActionSheetItem]()
         ActionSheetDeleteItemCell.appearance().titleColor = .red
-
+        ActionSheet.applyAppearance(NCAppearance())
+        
         items.append(ActionSheetItem(title: NSLocalizedString("_edit_comment_", comment: ""), value: 0, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "edit"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
         items.append(ActionSheetDeleteItem(title: NSLocalizedString("_delete_comment_", comment: ""), value: 1, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "trash"), width: 50, height: 50, color: .red)))
         items.append(ActionSheetCancelButton(title: NSLocalizedString("_cancel_", comment: "")))

+ 4 - 0
iOSClient/Trash/NCTrash.swift

@@ -282,6 +282,7 @@ class NCTrash: UIViewController, UIGestureRecognizerDelegate, NCTrashListCellDel
 
         if !isEditMode {
             var items = [ActionSheetItem]()
+            ActionSheet.applyAppearance(NCAppearance())
             
             items.append(ActionSheetDangerButton(title: NSLocalizedString("_delete_", comment: "")))
             items.append(ActionSheetCancelButton(title: NSLocalizedString("_cancel_", comment: "")))
@@ -312,6 +313,7 @@ class NCTrash: UIViewController, UIGestureRecognizerDelegate, NCTrashListCellDel
         if !isEditMode {
             var items = [ActionSheetItem]()
             ActionSheetDeleteItemCell.appearance().titleColor = .red
+            ActionSheet.applyAppearance(NCAppearance())
             
             items.append(ActionSheetItem(title: NSLocalizedString("_restore_", comment: ""), value: 0, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "restore"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
             items.append(ActionSheetDeleteItem(title: NSLocalizedString("_delete_", comment: ""), value: 1, image: CCGraphics.changeThemingColorImage(UIImage.init(named: "trash"), width: 50, height: 50, color: UIColor.red)))
@@ -385,6 +387,7 @@ class NCTrash: UIViewController, UIGestureRecognizerDelegate, NCTrashListCellDel
             if indexPath.row == 0 {
                 
                 var items = [ActionSheetItem]()
+                ActionSheet.applyAppearance(NCAppearance())
                 
                 items.append(ActionSheetTitle(title: NSLocalizedString("_trash_delete_all_", comment: "")))
                 items.append(ActionSheetDangerButton(title: NSLocalizedString("_ok_", comment: "")))
@@ -427,6 +430,7 @@ class NCTrash: UIViewController, UIGestureRecognizerDelegate, NCTrashListCellDel
             if indexPath.row == 2 {
                 
                 var items = [ActionSheetItem]()
+                ActionSheet.applyAppearance(NCAppearance())
                 
                 items.append(ActionSheetTitle(title: NSLocalizedString("_trash_delete_selected_", comment: "")))
                 items.append(ActionSheetDangerButton(title: NSLocalizedString("_delete_", comment: "")))

+ 53 - 0
iOSClient/Utility/NCActionSheetAppearance.swift

@@ -0,0 +1,53 @@
+//
+//  NCActionSheetAppearance.swift
+//  Nextcloud
+//
+//  Created by Marino Faggiana on 30/09/19.
+//  Copyright © 2018 Marino Faggiana. All rights reserved.
+//
+//  Author Marino Faggiana <marino.faggiana@nextcloud.com>
+//
+//  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 <http://www.gnu.org/licenses/>.
+//
+
+import UIKit
+import Sheeeeeeeeet
+
+extension ActionSheetAppearance {
+    
+    static var demoColorful: ActionSheetAppearance {
+        NCAppearance()
+    }
+}
+
+class NCAppearance: ActionSheetAppearance {
+
+    override func applyColors() {
+      
+        ActionSheetTableView.appearance().backgroundColor = NCBrandColor.sharedInstance.backgroundForm
+        ActionSheetTableView.appearance().separatorColor = NCBrandColor.sharedInstance.separator
+        ActionSheetItemCell.appearance().backgroundColor = NCBrandColor.sharedInstance.backgroundForm
+        ActionSheetItemCell.appearance().titleColor = NCBrandColor.sharedInstance.textView
+    }
+}
+
+// MARK: - Delete Cell
+
+class ActionSheetDeleteItem: ActionSheetItem {
+    override open func cell(for tableView: UITableView) -> ActionSheetItemCell {
+        return ActionSheetDeleteItemCell(style: cellStyle, reuseIdentifier: cellReuseIdentifier)
+    }
+}
+
+class ActionSheetDeleteItemCell: ActionSheetItemCell {}

+ 0 - 10
iOSClient/Utility/NCUtility.swift

@@ -458,13 +458,3 @@ class NCUtility: NSObject {
         return(error, bundleDirectory, immPath)
     }
 }
-
-// MARK: - Sheeeeeeeeet
-
-class ActionSheetDeleteItem: ActionSheetItem {
-    override open func cell(for tableView: UITableView) -> ActionSheetItemCell {
-        return ActionSheetDeleteItemCell(style: cellStyle, reuseIdentifier: cellReuseIdentifier)
-    }
-}
-
-class ActionSheetDeleteItemCell: ActionSheetItemCell {}