Skip to content

Commit

Permalink
Issue #281: Send user to folder creation right after successful serve…
Browse files Browse the repository at this point in the history
…r connect.
  • Loading branch information
tladesignz committed Mar 11, 2024
1 parent 5eeb5f7 commit 05e890e
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 5 deletions.
14 changes: 14 additions & 0 deletions Save/Main/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,20 @@ class MainViewController: UIViewController, UICollectionViewDelegateFlowLayout,
updateManageBt()
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
super.prepare(for: segue, sender: sender)

// Make sure, the `SpaceWizardViewController` calls us back on success,
// so we can make the user select/create a folder right after
// connecting the server.
if segue.identifier == Self.segueConnectSpace,
let navC = segue.destination as? UINavigationController,
let vc = navC.viewControllers.first as? SpaceWizardViewController
{
vc.delegate = self
}
}

/**
Workaround for the filtered view, which potentially got reset by the share
extension's `Db#setup` call.
Expand Down
2 changes: 1 addition & 1 deletion Save/Space/DropboxWizardViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SwiftyDropbox

class DropboxWizardViewController: BaseViewController, WizardDelegatable {

var delegate: WizardDelegate?
weak var delegate: WizardDelegate?

@IBOutlet weak var iconIv: UIImageView! {
didSet {
Expand Down
2 changes: 1 addition & 1 deletion Save/Space/GdriveWizardViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import CleanInsightsSDK

class GdriveWizardViewController: BaseViewController, WizardDelegatable {

var delegate: WizardDelegate?
weak var delegate: WizardDelegate?

@IBOutlet weak var iconIv: UIImageView! {
didSet {
Expand Down
6 changes: 4 additions & 2 deletions Save/Space/SpaceSuccessViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

import UIKit

class SpaceSuccessViewController: BaseViewController {
class SpaceSuccessViewController: BaseViewController, WizardDelegatable {

weak var delegate: WizardDelegate?

var spaceName = ""

Expand All @@ -32,6 +34,6 @@ class SpaceSuccessViewController: BaseViewController {
}

@IBAction func done() {
dismiss(animated: true)
delegate?.dismiss(success: true)
}
}
12 changes: 12 additions & 0 deletions Save/Space/SpaceWizardViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ protocol WizardDelegate: AnyObject {
func back()

func next(_ vc: UIViewController, pos: Int)

func dismiss(success: Bool)
}

protocol WizardDelegatable: AnyObject {
Expand All @@ -22,6 +24,8 @@ protocol WizardDelegatable: AnyObject {

class SpaceWizardViewController: BasePageViewController, WizardDelegate {

weak var delegate: MainViewController?

private lazy var viewControllers: [UIViewController] = [UIStoryboard.main.instantiate(SpaceTypeViewController.self)]

override func viewDidLoad() {
Expand Down Expand Up @@ -72,6 +76,14 @@ class SpaceWizardViewController: BasePageViewController, WizardDelegate {
pageControl.currentPage = page
}

func dismiss(success: Bool) {
dismiss(animated: true)

if success {
delegate?.addFolder()
}
}


// MARK: UIPageViewControllerDataSource

Expand Down
2 changes: 1 addition & 1 deletion Save/Space/WebDavWizardViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import FavIcon

class WebDavWizardViewController: BaseViewController, WizardDelegatable, TextBoxDelegate {

var delegate: WizardDelegate?
weak var delegate: WizardDelegate?


@IBOutlet weak var iconIv: UIImageView!
Expand Down

0 comments on commit 05e890e

Please sign in to comment.