Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 60 additions & 74 deletions Brand/Intro/NCIntro.storyboard

Large diffs are not rendered by default.

43 changes: 22 additions & 21 deletions Brand/Intro/NCIntroCollectionViewCell.xib
Original file line number Diff line number Diff line change
@@ -1,56 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22154" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22130"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="introCell" id="gTV-IL-0wX" customClass="NCIntroCollectionViewCell" customModule="Nextcloud" customModuleProvider="target">
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="introCell" id="W7v-l7-ZRn" customClass="NCIntroCollectionViewCell" customModule="Nextcloud" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="337" height="462"/>
<autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="337" height="462"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bZc-Ai-h3y">
<rect key="frame" x="8" y="426.5" width="321" height="27.5"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Hg2-1f-a5q">
<rect key="frame" x="8" y="426" width="321" height="28"/>
<constraints>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="28" id="gRQ-4D-JAn"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="23"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" image="intro1" translatesAutoresizingMaskIntoConstraints="NO" id="f3T-nC-cwA">
<rect key="frame" x="93.5" y="156" width="150" height="150"/>
<constraints>
<constraint firstAttribute="width" relation="lessThanOrEqual" constant="150" id="jne-Xj-IAh"/>
<constraint firstAttribute="width" secondItem="f3T-nC-cwA" secondAttribute="height" multiplier="1:1" id="mhZ-Cn-42Q"/>
</constraints>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" image="introSlide1" translatesAutoresizingMaskIntoConstraints="NO" id="0Rr-r4-4Vb">
<rect key="frame" x="0.0" y="0.0" width="337" height="462"/>
</imageView>
</subviews>
</view>
<viewLayoutGuide key="safeArea" id="ZTg-uK-7eu"/>
<viewLayoutGuide key="safeArea" id="gxu-Sr-0Za"/>
<color key="backgroundColor" red="1" green="0.57637232540000005" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="f3T-nC-cwA" firstAttribute="centerX" secondItem="gTV-IL-0wX" secondAttribute="centerX" id="4le-ih-K34"/>
<constraint firstAttribute="bottom" secondItem="bZc-Ai-h3y" secondAttribute="bottom" constant="8" id="YBJ-eg-EmZ"/>
<constraint firstItem="bZc-Ai-h3y" firstAttribute="top" relation="greaterThanOrEqual" secondItem="f3T-nC-cwA" secondAttribute="bottom" constant="16" id="av5-zS-GLQ"/>
<constraint firstItem="bZc-Ai-h3y" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" constant="8" id="eNj-fx-een"/>
<constraint firstItem="f3T-nC-cwA" firstAttribute="centerY" secondItem="gTV-IL-0wX" secondAttribute="centerY" priority="250" id="haX-eS-EOe"/>
<constraint firstAttribute="trailing" secondItem="bZc-Ai-h3y" secondAttribute="trailing" constant="8" id="uif-cW-sAI"/>
<constraint firstItem="0Rr-r4-4Vb" firstAttribute="top" secondItem="W7v-l7-ZRn" secondAttribute="top" id="6WN-hZ-AN9"/>
<constraint firstAttribute="trailing" secondItem="0Rr-r4-4Vb" secondAttribute="trailing" id="QXs-dx-A3z"/>
<constraint firstAttribute="trailing" secondItem="Hg2-1f-a5q" secondAttribute="trailing" constant="8" id="aAC-jn-k9B"/>
<constraint firstItem="0Rr-r4-4Vb" firstAttribute="centerX" secondItem="W7v-l7-ZRn" secondAttribute="centerX" id="aII-UM-z5q"/>
<constraint firstAttribute="bottom" secondItem="Hg2-1f-a5q" secondAttribute="bottom" constant="8" id="eji-6u-PTG"/>
<constraint firstAttribute="bottom" secondItem="0Rr-r4-4Vb" secondAttribute="bottom" id="rt9-yh-5MB"/>
<constraint firstItem="0Rr-r4-4Vb" firstAttribute="leading" secondItem="W7v-l7-ZRn" secondAttribute="leading" id="tge-XP-XUp"/>
<constraint firstItem="Hg2-1f-a5q" firstAttribute="leading" secondItem="W7v-l7-ZRn" secondAttribute="leading" constant="8" id="trc-Dm-XnV"/>
</constraints>
<size key="customSize" width="337" height="428"/>
<connections>
<outlet property="imageView" destination="f3T-nC-cwA" id="aRR-4x-Dwk"/>
<outlet property="titleLabel" destination="bZc-Ai-h3y" id="WAd-FO-VtY"/>
<outlet property="imageView" destination="0Rr-r4-4Vb" id="1bz-Zu-mk7"/>
<outlet property="titleLabel" destination="Hg2-1f-a5q" id="K6V-hD-bwj"/>
</connections>
<point key="canvasLocation" x="339.85507246376812" y="223.66071428571428"/>
</collectionViewCell>
</objects>
<resources>
<image name="intro1" width="256" height="128"/>
<image name="introSlide1" width="375" height="667"/>
</resources>
</document>
51 changes: 46 additions & 5 deletions Brand/Intro/NCIntroViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,38 @@
// SPDX-License-Identifier: GPL-3.0-or-later

import UIKit
import NextcloudKit

class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
@IBOutlet weak var buttonLogin: UIButton!
@IBOutlet weak var buttonSignUp: UIButton!
@IBOutlet weak var buttonHost: UIButton!
@IBOutlet weak var introCollectionView: UICollectionView!
@IBOutlet weak var pageControl: UIPageControl!
@IBOutlet weak var contstraintBottomLoginButton: NSLayoutConstraint!

weak var delegate: NCIntroViewController?
// Controller
var controller: NCMainTabBarController?

private let appDelegate = (UIApplication.shared.delegate as? AppDelegate)!
private let titles = [NSLocalizedString("_intro_1_title_", comment: ""), NSLocalizedString("_intro_2_title_", comment: ""), NSLocalizedString("_intro_3_title_", comment: ""), NSLocalizedString("_intro_4_title_", comment: "")]
private let images = [UIImage(named: "intro1"), UIImage(named: "intro2"), UIImage(named: "intro3"), UIImage(named: "intro4")]
private let titles = [NSLocalizedString("", comment: ""), NSLocalizedString("", comment: ""), NSLocalizedString("", comment: "")]
private var images: [UIImage?] = []
private var timer: Timer?
private var textColor: UIColor = .white
private var textColorOpponent: UIColor = .black
private let imagesLandscape = [UIImage(named: "introSlideLand1"), UIImage(named: "introSlideLand2"), UIImage(named: "introSlideLand3")]
private let imagesPortrait = [UIImage(named: "introSlide1"), UIImage(named: "introSlide2"), UIImage(named: "introSlide3")]
private let imagesEightPortrait = [UIImage(named: "introSlideEight1"), UIImage(named: "introSlideEight2"), UIImage(named: "introSlideEight3")]

// MARK: - View Life Cycle

override func viewDidLoad() {
super.viewDidLoad()

let isEightPlusDevice = UIScreen.main.bounds.height == 736
images = UIDevice.current.orientation.isLandscape ? imagesLandscape : (isEightPlusDevice ? imagesEightPortrait : imagesPortrait)

let isTooLight = NCBrandColor.shared.customer.isTooLight()
let isTooDark = NCBrandColor.shared.customer.isTooDark()

Expand Down Expand Up @@ -93,17 +101,35 @@ class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICol
}
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if UIDevice.current.userInterfaceIdiom != .pad{
AppUtility.lockOrientation(UIInterfaceOrientationMask.portrait, andRotateTo: UIInterfaceOrientation.portrait)
}
navigationController?.setNavigationBarHidden(true, animated: animated)
}

override func viewDidLayoutSubviews() {
if UIScreen.main.bounds.width < 350 || UIScreen.main.bounds.height > 800 {
contstraintBottomLoginButton.constant = 15
}
}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)

timer?.invalidate()
timer = nil
AppUtility.lockOrientation(UIInterfaceOrientationMask.all)
navigationController?.setNavigationBarHidden(false, animated: animated)
}

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)

coordinator.animate(alongsideTransition: nil) { _ in
let isEightPlusDevice = UIScreen.main.bounds.height == 736
self.images = UIDevice.current.orientation.isLandscape ? self.imagesLandscape : (isEightPlusDevice ? self.imagesEightPortrait : self.imagesPortrait)
self.pageControl?.currentPage = 0
self.introCollectionView?.collectionViewLayout.invalidateLayout()
}
Expand Down Expand Up @@ -133,6 +159,7 @@ class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICol
cell.titleLabel.textColor = textColor
cell.titleLabel.text = titles[indexPath.row]
cell.imageView.image = images[indexPath.row]
cell.imageView.contentMode = .scaleAspectFill
return cell
}

Expand All @@ -157,9 +184,17 @@ class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICol
}

@IBAction func login(_ sender: Any) {
if let viewController = UIStoryboard(name: "NCLogin", bundle: nil).instantiateViewController(withIdentifier: "NCLogin") as? NCLogin {
viewController.controller = self.controller
self.navigationController?.pushViewController(viewController, animated: true)
if NCBrandOptions.shared.use_AppConfig {
if let viewController = UIStoryboard(name: "NCLogin", bundle: nil).instantiateViewController(withIdentifier: "NCLogin") as? NCLogin {
viewController.controller = self.controller
self.navigationController?.pushViewController(viewController, animated: true)
}
} else {
if NextcloudKit.shared.isNetworkReachable() {
appDelegate.openLogin(viewController: navigationController, selector: NCGlobal.shared.introLogin, openLoginWeb: false)
} else {
showNoInternetAlert()
}
}
}

Expand All @@ -175,6 +210,12 @@ class NCIntroViewController: UIViewController, UICollectionViewDataSource, UICol
guard let url = URL(string: NCBrandOptions.shared.linkLoginHost) else { return }
UIApplication.shared.open(url)
}

func showNoInternetAlert() {
let alertController = UIAlertController(title: NSLocalizedString("_no_internet_alert_title_", comment: ""), message: NSLocalizedString("_no_internet_alert_message_", comment: ""), preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { action in }))
self.present(alertController, animated: true)
}
}

extension UINavigationController {
Expand Down
35 changes: 28 additions & 7 deletions Brand/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -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" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -17,16 +17,37 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="logo" translatesAutoresizingMaskIntoConstraints="NO" id="7UE-Dr-Fma">
<rect key="frame" x="59.5" y="269.5" width="256" height="128"/>
<rect key="frame" x="123.5" y="191" width="128" height="128"/>
<constraints>
<constraint firstAttribute="width" constant="128" id="mLZ-SH-p7T"/>
<constraint firstAttribute="height" constant="128" id="scw-Dy-y3z"/>
</constraints>
</imageView>
<stackView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="rV0-dq-CYC">
<rect key="frame" x="98" y="319" width="179" height="29"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Magenta" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nMQ-jy-tWk">
<rect key="frame" x="0.0" y="0.0" width="98.5" height="29"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="24"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="CLOUD" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Nf3-uV-bIb">
<rect key="frame" x="98.5" y="0.0" width="80.5" height="29"/>
<fontDescription key="fontDescription" type="system" pointSize="24"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
</subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" red="0.0" green="0.50980392156862742" blue="0.78823529411764703" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" red="0.88627450980392" green="0" blue="0.45490196078431" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="7UE-Dr-Fma" firstAttribute="width" relation="lessThanOrEqual" secondItem="6Tk-OE-BBY" secondAttribute="width" id="8ik-eB-po8"/>
<constraint firstItem="7UE-Dr-Fma" firstAttribute="height" relation="lessThanOrEqual" secondItem="6Tk-OE-BBY" secondAttribute="height" id="G3L-l7-lxv"/>
<constraint firstItem="rV0-dq-CYC" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="XMf-14-BfA"/>
<constraint firstItem="7UE-Dr-Fma" firstAttribute="centerX" secondItem="6Tk-OE-BBY" secondAttribute="centerX" id="XdS-tM-D9I"/>
<constraint firstItem="7UE-Dr-Fma" firstAttribute="centerY" secondItem="6Tk-OE-BBY" secondAttribute="centerY" id="ZR5-ct-Gg8"/>
<constraint firstItem="rV0-dq-CYC" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="ft2-xl-coE"/>
<constraint firstItem="rV0-dq-CYC" firstAttribute="top" secondItem="7UE-Dr-Fma" secondAttribute="bottom" id="pl6-HZ-ReW"/>
</constraints>
</view>
</viewController>
Expand Down
Loading