added prefinal version#2
Conversation
darya-gurinovich
left a comment
There was a problem hiding this comment.
Please, fix your delegate because new elements are shown only after the app reopen.
You can improve your MVC by moving displayMode and appMode from FilesViewController to ElementsManager
|
|
||
| import Foundation | ||
|
|
||
| protocol ElementsManageDelegate { |
There was a problem hiding this comment.
You've misspelled ElementsManagerDelegate
|
|
||
| try? FileManager.default.createDirectory(at: newFolderPath, | ||
| withIntermediateDirectories: false, | ||
| attributes: nil) |
There was a problem hiding this comment.
Shouldn't you call reloadFolderContent here as well?
| var label: UILabel! | ||
| var elementImageView: UIImageView! | ||
|
|
||
| var addMode: AppMode! = .view |
There was a problem hiding this comment.
Why do you need this property? You don't use it anywhere
| self.elementImageView.image = image | ||
| } | ||
|
|
||
| func editModeImageSettings(element: Element) { |
There was a problem hiding this comment.
Where do you use this function?
|
|
||
| import UIKit | ||
|
|
||
| class Notifications: UIViewController { |
There was a problem hiding this comment.
It's better to call it NotificationsManager or NotificationsService
| func sendLocalNotification() { | ||
| let content = UNMutableNotificationContent() | ||
| content.body = "Hey, don't you want to create some folders? :D" | ||
|
|
||
| let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 10, repeats: false) // shows notification in 10 mins after quit | ||
|
|
||
| let request = UNNotificationRequest(identifier: "10 mins after quit", | ||
| content: content, | ||
| trigger: trigger) | ||
|
|
||
| UNUserNotificationCenter.current().add(request) | ||
| } | ||
|
|
||
| func sendAnotherLocalNotification() { |
There was a problem hiding this comment.
You call both sendLocalNotification() and sendAnotherLocalNotification() on the app launch. You need to call it when you close the app
| var elements = [Element]() | ||
| var selectedElements = [Element]() | ||
|
|
||
| var delegate: ElementsManageDelegate? |
There was a problem hiding this comment.
You haven't set your delegate for manager in FilesViewController
|
|
||
| class AppModeManager { | ||
| var appMode: AppMode = .view | ||
| var manager = ElementsManager() |
There was a problem hiding this comment.
You're creating a new ElementsManager object. It will be different from the one that you have in your view controller. You can make your ElementsManager a singleton then you won't have this problem. Or you can move this code to ElementsManager
chosen this branch by mistake but hope it's okay