Skip to content
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

[fix/share-extension-passcode-lock-interval] Share Extension Passcode Lock Interval #1156

Merged
merged 6 commits into from
Sep 21, 2022
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Summary
-------

* Bugfix - Enabling Markup Mode on iOS 16, Updating Theme: [#1141](https://github.com/owncloud/ios-app/issues/1141)
* Bugfix - Share Extension Passcode Lock Interval: [#1156](https://github.com/owncloud/ios-app/issues/1156)
* Bugfix - Video Metadata Image: [#5296](https://github.com/owncloud/enterprise/issues/5296)
* Change - New Dark Mode Themes: [#1146](https://github.com/owncloud/ios-app/issues/1146)

Expand All @@ -23,6 +24,12 @@ Details

https://github.com/owncloud/ios-app/issues/1141

* Bugfix - Share Extension Passcode Lock Interval: [#1156](https://github.com/owncloud/ios-app/issues/1156)

The passcode lock interval was not taken into use in the share extension.

https://github.com/owncloud/ios-app/issues/1156

* Bugfix - Video Metadata Image: [#5296](https://github.com/owncloud/enterprise/issues/5296)

If a video file includes a metadata image, the video file was not visible, because the metadata
Expand Down
5 changes: 5 additions & 0 deletions changelog/unreleased/1156
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Share Extension Passcode Lock Interval

The passcode lock interval was not taken into use in the share extension.

https://github.com/owncloud/ios-app/issues/1156
23 changes: 19 additions & 4 deletions ownCloud Share Extension/ShareViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ class ShareViewController: MoreStaticTableViewController {
// Share extension allowed
if !willAppearInitial {
willAppearInitial = true

if AppLockManager.supportedOnDevice {
AppLockManager.shared.showLockscreenIfNeeded()
}
if AppLockManager.supportedOnDevice {
AppLockManager.shared.showLockscreenIfNeeded()
}

if let appexNavigationController = self.navigationController as? AppExtensionNavigationController {
appexNavigationController.dismissalAction = { [weak self] (_) in
AppLockManager.shared.appDidEnterBackground()
self?.returnCores(completion: {
Log.debug("Returned all cores (share sheet was closed / dismissed)")
})
Expand Down Expand Up @@ -96,6 +97,18 @@ class ShareViewController: MoreStaticTableViewController {
didAppearInitial = true
}
}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
if didAppearInitial {
AppLockManager.shared.appDidEnterBackground()
}
}

@objc open override func dismissAnimated() {
AppLockManager.shared.appDidEnterBackground()
super.dismissAnimated()
}

private var requestedCoreBookmarks : [OCBookmark] = []

Expand Down Expand Up @@ -146,6 +159,7 @@ class ShareViewController: MoreStaticTableViewController {
}

@objc private func cancelAction () {
AppLockManager.shared.appDidEnterBackground()
self.returnCores(completion: {
let error = NSError(domain: NSErrorDomain.ShareViewErrorDomain, code: 0, userInfo: [NSLocalizedDescriptionKey: "Canceled by user"])
self.extensionContext?.cancelRequest(withError: error)
Expand All @@ -172,6 +186,7 @@ class ShareViewController: MoreStaticTableViewController {

for (bookmark) in bookmarks {
let row = StaticTableViewRow(buttonWithAction: { (_ row, _ sender) in
self.didAppearInitial = false
self.openDirectoryPicker(for: bookmark, withBackButton: true)
}, title: bookmark.shortName, style: .plain, image: UIImage(named: "bookmark-icon")?.scaledImageFitting(in: CGSize(width: 25.0, height: 25.0)), imageWidth: 25, alignment: .left)
actionsRows.append(row)
Expand Down
21 changes: 14 additions & 7 deletions ownCloudAppShared/AppLock/AppLockManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,19 @@ public class AppLockManager: NSObject {
lockscreenOpenForced = forceShow
lockscreenOpen = true

// Show biometrical
if !forceShow, !self.shouldDisplayCountdown, self.biometricalAuthenticationSucceeded {
showBiometricalAuthenticationInterface(context: context)
} else if setupMode {
showBiometricalAuthenticationInterface(context: context)
}
// The following code needs to be executed after a short delay, because in the share sheet the biometrical unlock UI can block adding the PasscodeViewController UI
var delay = 0.0
if self.passwordViewHostViewController != nil {
delay = 0.5
}
OnMainThread(after: delay) {
// Show biometrical
if !forceShow, !self.shouldDisplayCountdown, self.biometricalAuthenticationSucceeded {
self.showBiometricalAuthenticationInterface(context: context)
} else if setupMode {
self.showBiometricalAuthenticationInterface(context: context)
}
}
} else {
dismissLockscreen(animated: true)
}
Expand Down Expand Up @@ -333,7 +340,7 @@ public class AppLockManager: NSObject {
}

// MARK: - App Events
@objc func appDidEnterBackground() {
@objc public func appDidEnterBackground() {
if unlocked {
lastApplicationBackgroundedDate = Date()
} else {
Expand Down