diff options
author | marinofaggiana <ios@nextcloud.com> | 2022-08-03 16:47:27 +0300 |
---|---|---|
committer | marinofaggiana <ios@nextcloud.com> | 2022-08-03 16:47:27 +0300 |
commit | 6704d57b6f77ef7c728f7d966c1ac0dfbe48f38c (patch) | |
tree | 3c925858aa374e365e4eeb2eed02b20fe7d16eff | |
parent | 19d33193fd020aff778520515ec6a5a8f3432818 (diff) |
add new tip
Signed-off-by: marinofaggiana <ios@nextcloud.com>
5 files changed, 53 insertions, 6 deletions
diff --git a/iOSClient/Main/Section Header Footer/NCSectionFooter.xib b/iOSClient/Main/Section Header Footer/NCSectionFooter.xib index 86d9bb416..296af0fb7 100644 --- a/iOSClient/Main/Section Header Footer/NCSectionFooter.xib +++ b/iOSClient/Main/Section Header Footer/NCSectionFooter.xib @@ -29,7 +29,7 @@ <action selector="touchUpInsideButton:" destination="Vin-9E-7nW" eventType="touchUpInside" id="XSh-0v-WHJ"/> </connections> </button> - <activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" style="gray" translatesAutoresizingMaskIntoConstraints="NO" id="qWG-SR-Qly"> + <activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" style="medium" translatesAutoresizingMaskIntoConstraints="NO" id="qWG-SR-Qly"> <rect key="frame" x="177.5" y="5" width="20" height="20"/> </activityIndicatorView> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="s2m-yO-4x0" userLabel="separator"> diff --git a/iOSClient/NCGlobal.swift b/iOSClient/NCGlobal.swift index 1aae7d4fb..180a3edb1 100644 --- a/iOSClient/NCGlobal.swift +++ b/iOSClient/NCGlobal.swift @@ -373,4 +373,5 @@ class NCGlobal: NSObject { let tipNCViewerPDFThumbnail = "tipncviewerpdfthumbnail" let tipNCCollectionViewCommonAccountRequest = "tipnccollectionviewcommonaccountrequest" let tipNCScanAddImage = "tipncscanaddimage" + let tipNCViewerMediaDetailView = "tipncviewermediadetailview" } diff --git a/iOSClient/Supporting Files/en.lproj/Localizable.strings b/iOSClient/Supporting Files/en.lproj/Localizable.strings index 96e4aea8c..24f78a4c5 100644 --- a/iOSClient/Supporting Files/en.lproj/Localizable.strings +++ b/iOSClient/Supporting Files/en.lproj/Localizable.strings @@ -903,6 +903,7 @@ "_tip_pdf_thumbnails_" = "Swipe left from the right edge of the screen to show the thumbnails."; "_tip_accountrequest_" = "Touch here to change account or to add a new one"; "_tip_addcopyimage_" = "Long press to paste a copied image"; +"_tip_open_mediadetail_" = "Swipe up to show the details"; // MARK: Accessibility diff --git a/iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift b/iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift index e4a13be55..683a1fab7 100644 --- a/iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift +++ b/iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift @@ -24,6 +24,8 @@ import UIKit import SVGKit import NCCommunication +import EasyTipView +import SwiftUI class NCViewerMedia: UIViewController { @@ -38,6 +40,7 @@ class NCViewerMedia: UIViewController { @IBOutlet weak var detailView: NCViewerMediaDetailView! private var _autoPlay: Bool = false + private var tipView: EasyTipView? let appDelegate = UIApplication.shared.delegate as! AppDelegate weak var viewerMediaPage: NCViewerMediaPage? @@ -111,7 +114,23 @@ class NCViewerMedia: UIViewController { self.ncplayer = NCPlayer.init(url: url, autoPlay: self.autoPlay, isProxy: urlVideo.isProxy, imageVideoContainer: self.imageVideoContainer, playerToolBar: self.playerToolBar, metadata: self.metadata, detailView: self.detailView, viewController: self) } } - + + // TIP + var preferences = EasyTipView.Preferences() + preferences.drawing.foregroundColor = .white + preferences.drawing.backgroundColor = NCBrandColor.shared.nextcloud + preferences.drawing.textAlignment = .left + preferences.drawing.arrowPosition = .top + 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 + + tipView = EasyTipView(text: NSLocalizedString("_tip_open_mediadetail_", comment: ""), preferences: preferences, delegate: self) + detailViewTopConstraint.constant = 0 detailView.hide() @@ -172,16 +191,25 @@ class NCViewerMedia: UIViewController { viewerMediaPage?.clearCommandCenter() } + // TIP + if !NCManageDatabase.shared.tipExists(NCGlobal.shared.tipNCViewerMediaDetailView), let view = self.navigationController?.navigationBar { + self.tipView?.show(forView: view) + } + NotificationCenter.default.addObserver(self, selector: #selector(openDetail(_:)), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterOpenMediaDetail), object: nil) } - override func viewDidDisappear(_ animated: Bool) { - super.viewDidDisappear(animated) + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + + self.tipView?.dismiss() } override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { super.viewWillTransition(to: size, with: coordinator) + self.tipView?.dismiss() + coordinator.animate(alongsideTransition: { context in // back to the original size self.scrollView.zoom(to: CGRect(x: 0, y: 0, width: self.scrollView.bounds.width, height: self.scrollView.bounds.height), animated: false) @@ -423,6 +451,8 @@ extension NCViewerMedia { private func openDetail() { + self.dismissTip() + CCUtility.setExif(metadata) { latitude, longitude, location, date, lensModel in if latitude != -1 && latitude != 0 && longitude != -1 && longitude != 0 { @@ -539,6 +569,21 @@ extension NCViewerMedia: NCViewerMediaDetailViewDelegate { } } +extension NCViewerMedia: EasyTipViewDelegate { + + // TIP + func easyTipViewDidTap(_ tipView: EasyTipView) { + NCManageDatabase.shared.addTip(NCGlobal.shared.tipNCViewerMediaDetailView) + } + + func easyTipViewDidDismiss(_ tipView: EasyTipView) { } + + func dismissTip() { + NCManageDatabase.shared.addTip(NCGlobal.shared.tipNCViewerMediaDetailView) + self.tipView?.dismiss() + } +} + // MARK: - class imageVideoContainerView: UIImageView { diff --git a/iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.storyboard b/iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.storyboard index 329daf6cc..a9377104d 100644 --- a/iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.storyboard +++ b/iOSClient/Viewer/NCViewerMedia/NCViewerMediaPage.storyboard @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="ne8-hS-cp3"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="ne8-hS-cp3"> <device id="retina5_5" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="System colors in document resources" minToolsVersion="11.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |