Skip to content

Commit

Permalink
Stable 5.2.7 (#2879)
Browse files Browse the repository at this point in the history
* Hotfix

Signed-off-by: Milen Pivchev <[email protected]>

* Version 5.2.7

Signed-off-by: Marino Faggiana <[email protected]>

---------

Signed-off-by: Milen Pivchev <[email protected]>
Signed-off-by: Marino Faggiana <[email protected]>
Co-authored-by: Milen Pivchev <[email protected]>
  • Loading branch information
marinofaggiana and mpivchev authored Apr 15, 2024
1 parent 366ed03 commit 08d7f76
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 44 deletions.
4 changes: 2 additions & 2 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5073,7 +5073,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 5.2.6;
MARKETING_VERSION = 5.2.7;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -5135,7 +5135,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 5.2.6;
MARKETING_VERSION = 5.2.7;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
SDKROOT = iphoneos;
Expand Down
43 changes: 12 additions & 31 deletions iOSClient/Viewer/NCViewerMedia/NCViewerMedia+VisionKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,43 +25,24 @@ import Foundation
import VisionKit

extension NCViewerMedia {
@available(iOS 16.0, *)
@available(iOS 17.0, *)
func analyzeCurrentImage() {
if let image = image {
let interaction = ImageAnalysisInteraction()
let analyzer = ImageAnalyzer()
interaction.preferredInteractionTypes = []
interaction.analysis = nil

self.imageVideoContainer.addInteraction(interaction)
let configuration = ImageAnalyzer.Configuration([.text, .machineReadableCode, .visualLookUp])

Task {
let configuration = ImageAnalyzer.Configuration([.text, .machineReadableCode, .visualLookUp])
let analysis = try? await analyzer.imageAnalyzer?.analyze(image, configuration: configuration)
let analysis = try? await analyzer.analyze(image, configuration: configuration)
if image == self.image {
analyzer.imageInteraction?.analysis = analysis
analyzer.imageInteraction?.preferredInteractionTypes = .automatic
interaction.analysis = analysis
interaction.preferredInteractionTypes = .automatic
}
}
}
}
}

// TODO: Remove when min SDK is 16
@MainActor
struct Analyzer {
private var _imageAnalyzer: Any?
private var _imageInteraction: Any?

@available(iOS 16, *)
var imageAnalyzer: ImageAnalyzer? {
get { return _imageAnalyzer as? ImageAnalyzer }
set { _imageAnalyzer = newValue }
}

@available(iOS 16, *)
var imageInteraction: ImageAnalysisInteraction? {
get { return _imageInteraction as? ImageAnalysisInteraction }
set { _imageInteraction = newValue }
}

init() {
if #available(iOS 16, *) {
imageAnalyzer = ImageAnalyzer()
imageInteraction = ImageAnalysisInteraction()
}
}
}
12 changes: 1 addition & 11 deletions iOSClient/Viewer/NCViewerMedia/NCViewerMedia.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import SwiftUI
import MobileVLCKit
import JGProgressHUD
import Alamofire
import VisionKit

public protocol NCViewerMediaViewDelegate: AnyObject {
func didOpenDetail()
Expand All @@ -49,17 +48,14 @@ class NCViewerMedia: UIViewController {
private var tipView: EasyTipView?
private let player = VLCMediaPlayer()
private let appDelegate = (UIApplication.shared.delegate as? AppDelegate)!
let analyzer = Analyzer()
let utilityFileSystem = NCUtilityFileSystem()
let utility = NCUtility()
weak var viewerMediaPage: NCViewerMediaPage?
var playerToolBar: NCPlayerToolBar?
var ncplayer: NCPlayer?
var image: UIImage? {
didSet {
if #available(iOS 16, *), metadata.isImage {
analyzer.imageInteraction?.preferredInteractionTypes = []
analyzer.imageInteraction?.analysis = nil
if #available(iOS 17.0, *), metadata.isImage {
analyzeCurrentImage()
}
}
Expand Down Expand Up @@ -144,12 +140,6 @@ class NCViewerMedia: UIViewController {
self.imageVideoContainer.image = nil

loadImage()

if #available(iOS 16, *) {
if let interaction = analyzer.imageInteraction {
self.imageVideoContainer.addInteraction(interaction)
}
}
}

override func viewWillAppear(_ animated: Bool) {
Expand Down

0 comments on commit 08d7f76

Please sign in to comment.