Skip to content
Merged
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
40 changes: 8 additions & 32 deletions Nextcloud.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

64 changes: 32 additions & 32 deletions iOSClient/DeepLink/NCDeepLinkHandler.swift
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
//
// DeepLinkHandler.swift
// Nextcloud
//
// Created by Amrut Waghmare on 29/05/24.
// Copyright © 2024 Marino Faggiana. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2024 Amrut Waghmare
// SPDX-FileCopyrightText: 2026 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later

import Foundation
import UIKit
Expand All @@ -42,12 +26,10 @@ enum DeepLink: String {
enum ControllerConstants {
static let filesIndex = 0
static let favouriteIndex = 1
static let mediaIndex = 3
static let mediaIndex = 2
static let activityIndex = 3
static let moreIndex = 4
static let notification = "NCNotification"
static let shares = "segueShares"
static let offline = "segueOffline"
static let delete = "segueTrash"
}

class NCDeepLinkHandler {
Expand Down Expand Up @@ -75,13 +57,19 @@ class NCDeepLinkHandler {
case .openMedia:
navigateTo(index: ControllerConstants.mediaIndex, controller: controller)
case .openShared:
navigateToMore(withSegue: ControllerConstants.shares, controller: controller)
Task { @MainActor in
navigateToMore(destination: .storyboard(name: "NCShares", presentation: .push), controller: controller)
}
case .openOffline:
navigateToMore(withSegue: ControllerConstants.offline, controller: controller)
Task { @MainActor in
navigateToMore(destination: .storyboard(name: "NCOffline", presentation: .push), controller: controller)
}
case .openDeleted:
Task { @MainActor in
navigateToMore(destination: .storyboard(name: "NCTrash", presentation: .push), controller: controller)
}
case .openNotifications:
navigateToNotification(controller: controller)
case .openDeleted:
navigateToMore(withSegue: ControllerConstants.delete, controller: controller)
case .openSettings:
navigateToSettings(controller: controller)
case .openAutoUpload:
Expand Down Expand Up @@ -129,20 +117,30 @@ class NCDeepLinkHandler {
}
}

private func navigateToMore(withSegue segue: String, controller: NCMainTabBarController) {
@MainActor
private func navigateToMore(destination: NCMoreModel.Destination, controller: NCMainTabBarController) {
controller.selectedIndex = ControllerConstants.moreIndex
guard let navigationController = controller.viewControllers?[controller.selectedIndex] as? UINavigationController else { return }
navigationController.viewControllers = navigationController.viewControllers.filter({$0.isKind(of: NCMore.self)})
navigationController.performSegue(withIdentifier: segue, sender: self)
guard let navigationController = controller.viewControllers?[controller.selectedIndex] as? UINavigationController else {
return
}

navigationController.popToRootViewController(animated: false)

let model = NCMoreModel(controller: controller)

model.perform(destination)
}

private func navigateToSettings(controller: NCMainTabBarController) {
controller.selectedIndex = ControllerConstants.moreIndex
guard let navigationController = controller.viewControllers?[controller.selectedIndex] as? UINavigationController else { return }

Task { @MainActor in
navigationController.popToRootViewController(animated: false)

let settingsView = NCSettingsView(model: NCSettingsModel(controller: controller))
let settingsController = UIHostingController(rootView: settingsView)
settingsController.title = NSLocalizedString("_settings_", comment: "")
navigationController.pushViewController(settingsController, animated: true)
}
}
Expand All @@ -152,6 +150,8 @@ class NCDeepLinkHandler {
guard let navigationController = controller.viewControllers?[controller.selectedIndex] as? UINavigationController else { return }

Task { @MainActor in
navigationController.popToRootViewController(animated: false)

let autoUploadView = NCAutoUploadView(model: NCAutoUploadModel(controller: controller), albumModel: AlbumModel(controller: controller))
let autoUploadController = UIHostingController(rootView: autoUploadView)
navigationController.pushViewController(autoUploadController, animated: true)
Expand Down
89 changes: 2 additions & 87 deletions iOSClient/Main/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="24127" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="FkP-Lh-8zt">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="24765" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="FkP-Lh-8zt">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24063"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24743"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand All @@ -24,7 +24,6 @@
<segue destination="hwM-4d-Afb" kind="relationship" relationship="viewControllers" id="tds-0Q-7Zf"/>
<segue destination="Npr-vu-PSD" kind="relationship" relationship="viewControllers" id="XeU-GF-etm"/>
<segue destination="cJk-3t-NeM" kind="relationship" relationship="viewControllers" id="2WL-hY-2Cp"/>
<segue destination="1Z8-Bx-Dqo" kind="relationship" relationship="viewControllers" id="z6l-ei-IMY"/>
</connections>
</tabBarController>
<placeholder placeholderIdentifier="IBFirstResponder" id="d2B-Yg-rp2" userLabel="First Responder" sceneMemberID="firstResponder"/>
Expand Down Expand Up @@ -145,89 +144,5 @@
</objects>
<point key="canvasLocation" x="7749" y="943"/>
</scene>
<!--More-->
<scene sceneID="4RE-f1-SKU">
<objects>
<navigationController extendedLayoutIncludesOpaqueBars="YES" automaticallyAdjustsScrollViewInsets="NO" id="1Z8-Bx-Dqo" customClass="NCMoreNavigationController" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="More" id="U4f-qS-cgh"/>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" largeTitles="YES" id="yVo-p8-ApS">
<rect key="frame" x="0.0" y="96" width="414" height="106"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="WTp-0D-Gpe" kind="show" identifier="segueTrash" id="bPq-YD-SUy"/>
<segue destination="biz-Qc-WHi" kind="show" identifier="segueOffline" id="Pdi-HO-f4O"/>
<segue destination="zzk-gS-FKl" kind="show" identifier="segueRecent" id="Snj-Bw-Ce2"/>
<segue destination="z7i-Sl-6Di" kind="show" identifier="segueShares" id="c59-fC-R3W"/>
<segue destination="3YH-o1-17m" kind="relationship" relationship="rootViewController" id="les-zO-92u"/>
<segue destination="hGk-eR-32T" kind="show" identifier="segueGroupfolders" id="Sfw-Dn-3uD"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="D7n-Z1-9wU" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="8458" y="327"/>
</scene>
<!--NCMore.storyboard-->
<scene sceneID="OXv-NF-UnP">
<objects>
<viewControllerPlaceholder storyboardName="NCMore" referencedIdentifier="NCMore.storyboard" id="3YH-o1-17m" sceneMemberID="viewController">
<navigationItem key="navigationItem" id="kVD-Ed-Voa"/>
</viewControllerPlaceholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="CL1-x1-23E" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="8458" y="943"/>
</scene>
<!--NCTrash.storyboard-->
<scene sceneID="361-ZH-Lss">
<objects>
<viewControllerPlaceholder storyboardIdentifier="NCTrash.storyboard" storyboardName="NCTrash" referencedIdentifier="NCTrash.storyboard" id="WTp-0D-Gpe" sceneMemberID="viewController">
<navigationItem key="navigationItem" id="mjj-Fc-L6W"/>
</viewControllerPlaceholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="WGZ-c6-AXe" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="10176" y="82"/>
</scene>
<!--NCOffline.storyboard-->
<scene sceneID="mwv-1V-aJg">
<objects>
<viewControllerPlaceholder storyboardIdentifier="NCOnDevice.storyboard" storyboardName="NCOffline" referencedIdentifier="NCOffline.storyboard" id="biz-Qc-WHi" sceneMemberID="viewController">
<navigationItem key="navigationItem" id="rfB-6v-cRv"/>
</viewControllerPlaceholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="d9n-lT-FK4" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="10182" y="125"/>
</scene>
<!--NCRecent.storyboard-->
<scene sceneID="nO2-dy-n7J">
<objects>
<viewControllerPlaceholder storyboardName="NCRecent" referencedIdentifier="NCRecent.storyboard" id="zzk-gS-FKl" sceneMemberID="viewController">
<navigationItem key="navigationItem" id="9Kb-01-l1b"/>
</viewControllerPlaceholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="rsS-r1-oFg" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="10181" y="265"/>
</scene>
<!--NCShares.storyboard-->
<scene sceneID="eRk-6B-fMu">
<objects>
<viewControllerPlaceholder storyboardName="NCShares" referencedIdentifier="NCShares.storyboard" id="z7i-Sl-6Di" sceneMemberID="viewController">
<navigationItem key="navigationItem" id="h1l-zn-SNX"/>
</viewControllerPlaceholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="olY-7a-lXK" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="10182" y="307"/>
</scene>
<!--NCGroupfolders.storyboard-->
<scene sceneID="kED-94-ouZ">
<objects>
<viewControllerPlaceholder storyboardName="NCGroupfolders" referencedIdentifier="NCGroupfolders.storyboard" id="hGk-eR-32T" sceneMemberID="viewController">
<navigationItem key="navigationItem" id="vBT-eK-wJG"/>
</viewControllerPlaceholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="R0O-cD-1ke" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="10209" y="348"/>
</scene>
</scenes>
</document>
114 changes: 75 additions & 39 deletions iOSClient/Main/NCMainTabBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,45 +47,9 @@ class NCMainTabBarController: UITabBarController {

tabBar.tintColor = NCBrandColor.shared.getElement(account: account)

// File
if let item = tabBar.items?[0] {
item.title = NSLocalizedString("_home_", comment: "")
item.image = UIImage(systemName: "folder.fill")
item.selectedImage = item.image
item.tag = 100
}

// Favorite
if let item = tabBar.items?[1] {
item.title = NSLocalizedString("_favorites_", comment: "")
item.image = UIImage(systemName: "star.fill")
item.selectedImage = item.image
item.tag = 101
}

// Media
if let item = tabBar.items?[2] {
item.title = NSLocalizedString("_media_", comment: "")
item.image = UIImage(systemName: "photo.fill")
item.selectedImage = item.image
item.tag = 102
}

// Activity
if let item = tabBar.items?[3] {
item.title = NSLocalizedString("_activity_", comment: "")
item.image = UIImage(systemName: "bolt.fill")
item.selectedImage = item.image
item.tag = 103
}

// More
if let item = tabBar.items?[4] {
item.title = NSLocalizedString("_more_", comment: "")
item.image = UIImage(systemName: "ellipsis.circle.fill")
item.selectedImage = item.image
item.tag = 104
}
configureMoreController()
configureTabBarItems()
configureTabBarAppearance()

NotificationCenter.default.addObserver(forName: NSNotification.Name(rawValue: self.global.notificationCenterChangeTheming), object: nil, queue: .main) { [weak self] notification in
if let userInfo = notification.userInfo as? NSDictionary,
Expand Down Expand Up @@ -130,6 +94,78 @@ class NCMainTabBarController: UITabBarController {
}
}

private func configureTabBarAppearance() {
let appearance = UITabBarAppearance()
appearance.configureWithDefaultBackground()

tabBar.standardAppearance = appearance
tabBar.scrollEdgeAppearance = appearance
}

private func configureMoreController() {
guard var controllers = viewControllers else { return }

controllers.append(makeMoreNavigationController())
viewControllers = controllers
}

private func makeMoreNavigationController() -> UIViewController {
let moreView = NCMoreView(account: account, controller: self)
let hostingController = UIHostingController(rootView: moreView)

hostingController.title = NSLocalizedString("_more_", comment: "")

let navigationController = NCMoreNavigationController(rootViewController: hostingController)
return navigationController
}

private func configureTabBarItems() {
configureTabBarItem(
at: 0,
title: "_home_",
imageName: "folder.fill",
tag: 100
)

configureTabBarItem(
at: 1,
title: "_favorites_",
imageName: "star.fill",
tag: 101
)

configureTabBarItem(
at: 2,
title: "_media_",
imageName: "photo.fill",
tag: 102
)

configureTabBarItem(
at: 3,
title: "_activity_",
imageName: "bolt.fill",
tag: 103
)

configureTabBarItem(
at: 4,
title: "_more_",
imageName: "ellipsis.circle.fill",
tag: 104
)
}

private func configureTabBarItem(at index: Int, title: String, imageName: String, tag: Int) {
guard let items = tabBar.items, items.indices.contains(index) else { return }

let item = items[index]
item.title = NSLocalizedString(title, comment: "")
item.image = UIImage(systemName: imageName)
item.selectedImage = item.image
item.tag = tag
}

@MainActor
private func timerCheck() async {
while !Task.isCancelled {
Expand Down
Loading
Loading