Skip to content

SensitiveContentAnalysis iOS xcode15.0 b1

Haritha Mohan edited this page Sep 14, 2023 · 3 revisions

#SensitiveContentAnalysis.framework https://github.com/xamarin/xamarin-macios/pull/19020

diff -ruN /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensitiveContentAnalysis.framework/Headers/SCSensitivityAnalyzer.h /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensitiveContentAnalysis.framework/Headers/SCSensitivityAnalyzer.h
--- /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensitiveContentAnalysis.framework/Headers/SCSensitivityAnalyzer.h	1969-12-31 19:00:00
+++ /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensitiveContentAnalysis.framework/Headers/SCSensitivityAnalyzer.h	2023-05-19 21:08:28
@@ -0,0 +1,73 @@
+//
+//  SCSensitivityAnalyzer.h
+//  SensitiveContentAnalysis
+//
+//  Created by Andrey Cherkashin on 4/11/23.
+//
+
+#import <Foundation/Foundation.h>
+#import <CoreGraphics/CoreGraphics.h>
+#import <ImageIO/ImageIO.h>
+
+NS_HEADER_AUDIT_BEGIN(nullability, sendability)
+
+/// Sensitive Analysis Results object is returned after sensitivity analysis is performed on media
+NS_SWIFT_SENDABLE
+@interface SCSensitivityAnalysis : NSObject
+/// Set to YES if analyzed media contains sensitive content
+@property(readonly, getter=isSensitive) BOOL sensitive;
+@end
+
+/// SensitivityAnalysis Policy on device, represents type of interventions when enabled
+typedef NS_ENUM(NSInteger, SCSensitivityAnalysisPolicy) {
+    /// No feature enabled that is requiring Sensitive Analysis on device, analysis will be disabled
+    SCSensitivityAnalysisPolicyDisabled = 0,
+    /// Sensitive Analysis is enabled on device through "Sensitive Content Warning" in Settings.
+    /// It is expected that brief/inline UI, like simple "show" button.
+    SCSensitivityAnalysisPolicySimpleInterventions = 1,
+    /// Sensitive Analysis is enabled for kids or teens in ScreenTime through "Communications Safety" feature.
+    /// It's expected to have more descriptive UI for the user, explaining potential risks.
+    SCSensitivityAnalysisPolicyDescriptiveInterventions = 2,
+};
+
+/// Main class for content sensitivity analysis
+NS_SWIFT_SENDABLE
+API_AVAILABLE(macos(14.0), ios(17.0), watchos(10.0))
+@interface SCSensitivityAnalyzer : NSObject
+
+- (instancetype)init;
+
+/// Current SCSensitivityAnalysisPolicy set on device. Can be used to determine whether analysis is available or not
+@property (assign, readonly) SCSensitivityAnalysisPolicy analysisPolicy;
+
+/**
+ * Analyze sensitivity of Image File on disk (only local fileURL)
+ * @param fileURL  Image file location on disk
+ * @param completionHandler  Block to be called on completion (callback is called on unspecified queue)
+ */
+- (void)analyzeImageFile:(nonnull NSURL *)fileURL
+       completionHandler:(void(^)(SCSensitivityAnalysis * _Nullable results, NSError * _Nullable error))completionHandler
+            NS_SWIFT_NAME(analyzeImage(at:completionHandler:));
+
+/**
+ * Analyze sensitivity of CGImage in memory
+ * @param image  CGImage reference
+ * @param completionHandler  Block to be called on completion (callback is called on unspecified queue)
+ */
+- (void)analyzeCGImage:(nonnull CGImageRef)image
+     completionHandler:(void(^)(SCSensitivityAnalysis * _Nullable results, NSError * _Nullable error))completionHandler
+            NS_SWIFT_NAME(analyzeImage(_:completionHandler:));
+
+/**
+ * Analyze sensitivity of Video File on disk.
+ * @param fileURL  Video file location on disk
+ * @param completionHandler  Block to be called on completion (callback is called on unspecified queue)
+ * @return An NSProgress instance for tracking video file analysis progress
+ */
+- (NSProgress *)analyzeVideoFile:(nonnull NSURL *)fileURL
+               completionHandler:(void(^)(SCSensitivityAnalysis * _Nullable results, NSError * _Nullable error))completionHandler
+                NS_REFINED_FOR_SWIFT;
+
+@end
+
+NS_HEADER_AUDIT_END(nullability, sendability)
diff -ruN /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensitiveContentAnalysis.framework/Headers/SensitiveContentAnalysis.h /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensitiveContentAnalysis.framework/Headers/SensitiveContentAnalysis.h
--- /Applications/Xcode_14.3.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensitiveContentAnalysis.framework/Headers/SensitiveContentAnalysis.h	1969-12-31 19:00:00
+++ /Applications/Xcode_15.0.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/SensitiveContentAnalysis.framework/Headers/SensitiveContentAnalysis.h	2023-05-19 21:08:27
@@ -0,0 +1,14 @@
+//
+//  SensitiveContentAnalysis.h
+//  SensitiveContentAnalysis
+//
+//  Created by Andrey Cherkashin on 4/11/23.
+//
+
+#import <Foundation/Foundation.h>
+
+// In this header, you should import all the public headers of your framework using statements like #import <SensitiveContentAnalysis/PublicHeader.h>
+
+#if (!TARGET_OS_TV && !TARGET_OS_XR)
+#import <SensitiveContentAnalysis/SCSensitivityAnalyzer.h>
+#endif // !TARGET_OS_TV
Clone this wiki locally