diff --git a/LightshowManager.xcodeproj/project.pbxproj b/LightshowManager.xcodeproj/project.pbxproj index 815e8c9..1be5f53 100644 --- a/LightshowManager.xcodeproj/project.pbxproj +++ b/LightshowManager.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 663BEC572BEE2DA0000585D9 /* LightshowDownloadOrAddView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 663BEC562BEE2DA0000585D9 /* LightshowDownloadOrAddView.swift */; }; + 66A9B7DE2C0E642200CA1A0A /* LightshowDownloadCellSecond.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66A9B7DD2C0E642200CA1A0A /* LightshowDownloadCellSecond.swift */; }; 66BE20232BD5AA790051989C /* LightshowDownloadCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66BE20222BD5AA790051989C /* LightshowDownloadCell.swift */; }; 66E3889B2BD3371A0004C1F2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66E3889A2BD3371A0004C1F2 /* AppDelegate.swift */; }; 66E3889D2BD3371A0004C1F2 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66E3889C2BD3371A0004C1F2 /* SceneDelegate.swift */; }; @@ -42,6 +43,7 @@ /* Begin PBXFileReference section */ 663BEC562BEE2DA0000585D9 /* LightshowDownloadOrAddView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LightshowDownloadOrAddView.swift; sourceTree = ""; }; 668F709C2BE82632004A9EDD /* LightshowManager.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = LightshowManager.entitlements; sourceTree = ""; }; + 66A9B7DD2C0E642200CA1A0A /* LightshowDownloadCellSecond.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LightshowDownloadCellSecond.swift; sourceTree = ""; }; 66BE20222BD5AA790051989C /* LightshowDownloadCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LightshowDownloadCell.swift; sourceTree = ""; }; 66D401E92BE7EFD1004814D0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Main.strings; sourceTree = ""; }; 66E388972BD3371A0004C1F2 /* LightshowManager.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LightshowManager.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -109,6 +111,7 @@ 66E388992BD3371A0004C1F2 /* LightshowManager */ = { isa = PBXGroup; children = ( + 66A9B7DD2C0E642200CA1A0A /* LightshowDownloadCellSecond.swift */, 668F709C2BE82632004A9EDD /* LightshowManager.entitlements */, 66E3889A2BD3371A0004C1F2 /* AppDelegate.swift */, 66E388A32BD3371C0004C1F2 /* Assets.xcassets */, @@ -279,6 +282,7 @@ 66E3889F2BD3371A0004C1F2 /* ViewController.swift in Sources */, 663BEC572BEE2DA0000585D9 /* LightshowDownloadOrAddView.swift in Sources */, 66BE20232BD5AA790051989C /* LightshowDownloadCell.swift in Sources */, + 66A9B7DE2C0E642200CA1A0A /* LightshowDownloadCellSecond.swift in Sources */, 66E388CB2BD548990004C1F2 /* LightshowModel.swift in Sources */, 66E388CD2BD549B90004C1F2 /* LightshowDownloadView.swift in Sources */, 66E3889B2BD3371A0004C1F2 /* AppDelegate.swift in Sources */, diff --git a/LightshowManager.xcodeproj/xcuserdata/quentin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/LightshowManager.xcodeproj/xcuserdata/quentin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 06e5939..db24aef 100644 --- a/LightshowManager.xcodeproj/xcuserdata/quentin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/LightshowManager.xcodeproj/xcuserdata/quentin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -7,17 +7,17 @@ + startingLineNumber = "30" + endingLineNumber = "30" + landmarkName = "tableView(_:cellForRowAt:)" + landmarkType = "7"> diff --git a/LightshowManager/Base.lproj/Main.storyboard b/LightshowManager/Base.lproj/Main.storyboard index 3e84ec7..83413a7 100644 --- a/LightshowManager/Base.lproj/Main.storyboard +++ b/LightshowManager/Base.lproj/Main.storyboard @@ -139,13 +139,14 @@ + - + @@ -153,14 +154,31 @@ + + + + + + + + + + + @@ -170,7 +188,6 @@ - @@ -213,6 +230,7 @@ + @@ -220,5 +238,8 @@ + + + diff --git a/LightshowManager/LightshowDownloadCell.swift b/LightshowManager/LightshowDownloadCell.swift index 9c16915..8b13789 100644 --- a/LightshowManager/LightshowDownloadCell.swift +++ b/LightshowManager/LightshowDownloadCell.swift @@ -1,16 +1 @@ -// -// LightshowDownloadCell.swift -// LightshowManager -// -// Created by Quentin Millardet on 21/04/2024. -// -import UIKit - -class LightshowDownloadCell : UITableViewCell{ - - @IBOutlet weak var warningMessage: UIImageView! - @IBOutlet weak var LightshowName: UILabel! - - @IBOutlet weak var alertLabel: UILabel! -} diff --git a/LightshowManager/LightshowDownloadCellSecond.swift b/LightshowManager/LightshowDownloadCellSecond.swift new file mode 100644 index 0000000..09bd714 --- /dev/null +++ b/LightshowManager/LightshowDownloadCellSecond.swift @@ -0,0 +1,16 @@ +// +// LightshowDownloadCell.swift +// LightshowManager +// +// Created by Quentin Millardet on 21/04/2024. +// + +import UIKit + +class LightshowDownloadCellSecond : UITableViewCell{ + + @IBOutlet weak var LightshowName: UILabel! + + @IBOutlet weak var warningIcon: UIImageView! + @IBOutlet weak var alertMessage: UILabel! +} diff --git a/LightshowManager/LightshowDownloadView.swift b/LightshowManager/LightshowDownloadView.swift index 49e7777..654bc62 100644 --- a/LightshowManager/LightshowDownloadView.swift +++ b/LightshowManager/LightshowDownloadView.swift @@ -29,16 +29,53 @@ class LightshowDownloadView: UITableViewController{ let isOk : Bool = model?.isOkFiles() ?? false; - //(cell as! LightshowDownloadCell).LightshowName.text = model?.name - //(cell as! LightshowDownloadCell).warningMessage.isHidden = isOk; - //var alertText = "" - //if (!isOk){ -// alertText = "(Le fichcier mp3 ou fseq n'a pas été reconnu)" - //} - //(cell as! LightshowDownloadCell).alertLabel.text = alertText + (cell as! LightshowDownloadCellSecond).LightshowName.text = model?.name + (cell as! LightshowDownloadCellSecond).warningIcon.isHidden = isOk; + var alertText = "" + if (!isOk){ + alertText = "(Le fichcier mp3 ou fseq n'a pas été reconnu)" + } + (cell as! LightshowDownloadCellSecond).alertMessage.text = alertText return cell! } + override func tableView(_ tableView: UITableView, + leadingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { + // Trash action + let trash = UIContextualAction(style: .destructive, + title: "Edit") { [weak self] (action, view, completionHandler) in + self?.handleMarkAsUnread() + completionHandler(true) + } + trash.backgroundColor = .systemGray + + let configuration = UISwipeActionsConfiguration(actions: [trash]) + + return configuration + } + + override func tableView(_ tableView: UITableView, + trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? { + // Trash action + let trash = UIContextualAction(style: .destructive, + title: "Trash") { [weak self] (action, view, completionHandler) in + self?.handleMoveToTrash() + completionHandler(true) + } + trash.backgroundColor = .systemRed + + let configuration = UISwipeActionsConfiguration(actions: [trash]) + + return configuration + } + + private func handleMarkAsUnread() { + print("Marked as unread") + } + + private func handleMoveToTrash() { + print("Moved to trash") + } // Permet de passer des informations à une vue avant que celle-ci ne soit créee override func prepare(for segue: UIStoryboardSegue, sender: Any?) {