-
-
Notifications
You must be signed in to change notification settings - Fork 37
Adds "Share Vault" option to vault detail settings. #424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
iammajid
wants to merge
5
commits into
develop
Choose a base branch
from
feature/hub-sharebutton
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ad78d19
Add Share Vault Button in Vault Detail
iammajid a317f83
Fix SwiftLint and SwiftFormat violations
iammajid 3b313d5
Fix SwiftFormat violations
iammajid 727673c
Merge develop into feature/hub-sharebutton
iammajid 1922f76
Refactor Hub URL extraction
iammajid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
Cryptomator/VaultDetail/ShareVault/ShareVaultCoordinator.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // | ||
| // ShareVaultCoordinator.swift | ||
| // Cryptomator | ||
| // | ||
| // Created by Majid Achhoud on 30.10.25. | ||
| // Copyright © 2025 Skymatic GmbH. All rights reserved. | ||
| // | ||
|
|
||
| import CryptomatorCloudAccessCore | ||
| import CryptomatorCommonCore | ||
| import UIKit | ||
|
|
||
| class ShareVaultCoordinator: Coordinator { | ||
| weak var parentCoordinator: Coordinator? | ||
| lazy var childCoordinators = [Coordinator]() | ||
| var navigationController: UINavigationController | ||
| private let vaultInfo: VaultInfo | ||
|
|
||
| init(vaultInfo: VaultInfo, navigationController: UINavigationController) { | ||
| self.vaultInfo = vaultInfo | ||
| self.navigationController = navigationController | ||
| } | ||
|
|
||
| func start() { | ||
| let viewModel: ShareVaultViewModel | ||
| if vaultInfo.vaultConfigType == .hub, let hubURL = extractHubVaultURL() { | ||
| viewModel = ShareVaultViewModel(type: .hub(hubURL)) | ||
| } else { | ||
| viewModel = ShareVaultViewModel(type: .normal) | ||
| } | ||
| let shareVaultViewController = ShareVaultViewController(viewModel: viewModel) | ||
| shareVaultViewController.coordinator = self | ||
| navigationController.pushViewController(shareVaultViewController, animated: true) | ||
| } | ||
|
|
||
| private func extractHubVaultURL() -> URL? { | ||
| guard let cachedVault = try? VaultDBCache().getCachedVault(withVaultUID: vaultInfo.vaultUID), | ||
| let vaultConfigToken = cachedVault.vaultConfigToken, | ||
| let vaultConfig = try? UnverifiedVaultConfig(token: vaultConfigToken), | ||
| let hubConfig = vaultConfig.allegedHubConfig else { | ||
| return nil | ||
| } | ||
|
|
||
| return hubConfig.getWebAppURL() | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider handling Hub URL extraction failures more explicitly.
When
vaultInfo.vaultConfigType == .hubbutextractHubVaultURL()returnsnil, the code silently falls back to.normaltype. This could confuse users who expect Hub-specific features. Consider:🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tobihagemann I see three ways to fix this:
Option 1 - it's the clearest for users. Alternatively, is this just an edge case that's unlikely to happen in practice? In the worst case, users would currently just see our Hub marketing page instead of their actual Hub instance, which would be confusing but not breaking anything. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, let's go with option 1. It's totally an edge case and shouldn't happen, but you never know what we're changing in the future. 😄