Skip to content

added prefinal version#2

Open
yahor-bialotski wants to merge 2 commits into
mainfrom
feature/collection-view
Open

added prefinal version#2
yahor-bialotski wants to merge 2 commits into
mainfrom
feature/collection-view

Conversation

@yahor-bialotski
Copy link
Copy Markdown
Owner

chosen this branch by mistake but hope it's okay

Copy link
Copy Markdown
Collaborator

@darya-gurinovich darya-gurinovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've misspelled ElementsManagerDelegate


try? FileManager.default.createDirectory(at: newFolderPath,
withIntermediateDirectories: false,
attributes: nil)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't you call reloadFolderContent here as well?

var label: UILabel!
var elementImageView: UIImageView!

var addMode: AppMode! = .view
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this property? You don't use it anywhere

self.elementImageView.image = image
}

func editModeImageSettings(element: Element) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do you use this function?


import UIKit

class Notifications: UIViewController {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to call it NotificationsManager or NotificationsService

Comment on lines +21 to +34
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() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You haven't set your delegate for manager in FilesViewController


class AppModeManager {
var appMode: AppMode = .view
var manager = ElementsManager()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants