diff --git a/iOSClient/Settings/AutoUpload/NCAutoUploadModel.swift b/iOSClient/Settings/AutoUpload/NCAutoUploadModel.swift index 4503fd0349..d72ad6fa5d 100644 --- a/iOSClient/Settings/AutoUpload/NCAutoUploadModel.swift +++ b/iOSClient/Settings/AutoUpload/NCAutoUploadModel.swift @@ -7,7 +7,6 @@ import Foundation import UIKit import Photos import NextcloudKit -import EasyTipView import SwiftUI enum AutoUploadTimespan: String, CaseIterable, Identifiable { @@ -49,10 +48,6 @@ class NCAutoUploadModel: ObservableObject, ViewOnAppearHandling { @Published var error: String = "" let database = NCManageDatabase.shared - private var observerToken: NSObjectProtocol? - - // Tip - var tip: EasyTipView? // Root View Controller var controller: NCMainTabBarController? // A variable user for change the auto upload directory @@ -65,19 +60,6 @@ class NCAutoUploadModel: ObservableObject, ViewOnAppearHandling { /// Initialization code to set up the ViewModel with the active account init(controller: NCMainTabBarController?) { self.controller = controller - - observerToken = NotificationCenter.default.addObserver(forName: UIDevice.orientationDidChangeNotification, - object: nil, - queue: .main) { _ in - self.tip?.dismiss() - self.tip = nil - } - } - - deinit { - if let token = observerToken { - NotificationCenter.default.removeObserver(token) - } } /// Triggered when the view appears. @@ -99,13 +81,6 @@ class NCAutoUploadModel: ObservableObject, ViewOnAppearHandling { requestAuthorization() if !autoUploadImage && !autoUploadVideo { autoUploadImage = true } - - showTip() - } - - func onViewDisappear() { - tip?.dismiss() - tip = nil } // MARK: - All functions @@ -271,47 +246,6 @@ class NCAutoUploadModel: ObservableObject, ViewOnAppearHandling { } } -extension NCAutoUploadModel: EasyTipViewDelegate { - func showTip() { - guard !session.account.isEmpty, - !database.tipExists(NCGlobal.shared.tipAutoUploadButton) - else { - return - } - - var preferences = EasyTipView.Preferences() - - preferences.drawing.foregroundColor = .white - preferences.drawing.backgroundColor = .lightGray - preferences.drawing.textAlignment = .left - preferences.drawing.arrowPosition = .any - preferences.drawing.cornerRadius = 10 - - preferences.animating.dismissTransform = CGAffineTransform(translationX: 0, y: 100) - preferences.animating.showInitialTransform = CGAffineTransform(translationX: 0, y: -100) - preferences.animating.showInitialAlpha = 0 - preferences.animating.showDuration = 0.5 - preferences.animating.dismissDuration = 0.5 - - if tip == nil { - tip = EasyTipView(text: NSLocalizedString("_tip_autoupload_button_", comment: ""), preferences: preferences, delegate: self, tip: NCGlobal.shared.tipAutoUploadButton) - DispatchQueue.main.asyncAfter(deadline: .now() + 1) { - if let view = self.controller?.tabBar { - self.tip?.show(forView: view) - } - } - } - } - - func easyTipViewDidTap(_ tipView: EasyTipView) { - database.addTip(NCGlobal.shared.tipAutoUploadButton) - } - - func easyTipViewDidDismiss(_ tipView: EasyTipView) { - tip = nil - } -} - /// An enum that represents the granularity of the subfolders for auto upload enum Granularity: Int { /// Daily granularity, meaning the subfolders are named by day diff --git a/iOSClient/Settings/AutoUpload/NCAutoUploadView.swift b/iOSClient/Settings/AutoUpload/NCAutoUploadView.swift index 727e1ff615..e652a724c0 100644 --- a/iOSClient/Settings/AutoUpload/NCAutoUploadView.swift +++ b/iOSClient/Settings/AutoUpload/NCAutoUploadView.swift @@ -30,9 +30,6 @@ struct NCAutoUploadView: View { .onAppear { model.onViewAppear() } - .onDisappear { - model.onViewDisappear() - } .onReceive(NotificationCenter.default.publisher(for: UIApplication.didBecomeActiveNotification)) { _ in model.checkPermission() }