Skip to content

Commit

Permalink
[SensitiveContentAnalysis] Add support for Xcode 15 (#19020)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
Co-authored-by: Alex Soto <alex@soto.dev>
  • Loading branch information
3 people authored Sep 15, 2023
1 parent 3e2ef13 commit 4f1cbbc
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 36 deletions.
5 changes: 5 additions & 0 deletions src/build/generator-frameworks.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ partial class Frameworks {
"SceneKit",
"ScreenTime",
"Security",
"SensitiveContentAnalysis",
"SensorKit",
"SharedWithYou",
"SharedWithYouCore",
Expand Down Expand Up @@ -254,6 +255,7 @@ partial class Frameworks {
"ScriptingBridge",
"SearchKit",
"Security",
"SensitiveContentAnalysis",
"ServiceManagement",
"SharedWithYou",
"SharedWithYouCore",
Expand Down Expand Up @@ -516,6 +518,7 @@ partial class Frameworks {
"SceneKit",
"ScreenTime",
"Security",
"SensitiveContentAnalysis",
"SensorKit",
"ServiceManagement",
"SharedWithYou",
Expand Down Expand Up @@ -674,6 +677,7 @@ partial class Frameworks {
bool? _ScriptingBridge;
bool? _SearchKit;
bool? _Security;
bool? _SensitiveContentAnalysis;
bool? _SensorKit;
bool? _ServiceManagement;
bool? _SharedWithYou;
Expand Down Expand Up @@ -838,6 +842,7 @@ partial class Frameworks {
public bool HaveScriptingBridge { get { if (!_ScriptingBridge.HasValue) _ScriptingBridge = GetValue ("ScriptingBridge"); return _ScriptingBridge.Value; } }
public bool HaveSearchKit { get { if (!_SearchKit.HasValue) _SearchKit = GetValue ("SearchKit"); return _SearchKit.Value; } }
public bool HaveSecurity { get { if (!_Security.HasValue) _Security = GetValue ("Security"); return _Security.Value; } }
public bool HaveSensitiveContentAnalysis { get { if (!_SensitiveContentAnalysis.HasValue) _SensitiveContentAnalysis = GetValue ("SensitiveContentAnalysis"); return _SensitiveContentAnalysis.Value; } }
public bool HaveSensorKit { get { if (!_SensorKit.HasValue) _SensorKit = GetValue ("SensorKit"); return _SensorKit.Value; } }
public bool HaveServiceManagement { get { if (!_ServiceManagement.HasValue) _ServiceManagement = GetValue ("ServiceManagement"); return _ServiceManagement.Value; } }
public bool HaveSharedWithYou { get { if (!_SharedWithYou.HasValue) _SharedWithYou = GetValue ("SharedWithYou"); return _SharedWithYou.Value; } }
Expand Down
3 changes: 3 additions & 0 deletions src/frameworks.sources
Original file line number Diff line number Diff line change
Expand Up @@ -2114,6 +2114,7 @@ MACOS_FRAMEWORKS = \
ScreenTime \
ScriptingBridge \
SearchKit \
SensitiveContentAnalysis \
ServiceManagement \
Security \
SharedWithYou \
Expand Down Expand Up @@ -2225,6 +2226,7 @@ IOS_FRAMEWORKS = \
SafariServices \
ScreenTime \
Security \
SensitiveContentAnalysis \
SensorKit \
SharedWithYou \
SharedWithYouCore \
Expand Down Expand Up @@ -2418,6 +2420,7 @@ MACCATALYST_FRAMEWORKS = \
SafariServices \
ScreenTime \
Security \
SensitiveContentAnalysis \
SensorKit \
ServiceManagement \
SharedWithYou \
Expand Down
1 change: 1 addition & 0 deletions src/rsp/dotnet/ios-defines-dotnet.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
-d:HAS_SCENEKIT
-d:HAS_SCREENTIME
-d:HAS_SECURITY
-d:HAS_SENSITIVECONTENTANALYSIS
-d:HAS_SENSORKIT
-d:HAS_SHAREDWITHYOU
-d:HAS_SHAREDWITHYOUCORE
Expand Down
1 change: 1 addition & 0 deletions src/rsp/dotnet/maccatalyst-defines-dotnet.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
-d:HAS_SCENEKIT
-d:HAS_SCREENTIME
-d:HAS_SECURITY
-d:HAS_SENSITIVECONTENTANALYSIS
-d:HAS_SENSORKIT
-d:HAS_SERVICEMANAGEMENT
-d:HAS_SHAREDWITHYOU
Expand Down
1 change: 1 addition & 0 deletions src/rsp/dotnet/macos-defines-dotnet.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
-d:HAS_SCRIPTINGBRIDGE
-d:HAS_SEARCHKIT
-d:HAS_SECURITY
-d:HAS_SENSITIVECONTENTANALYSIS
-d:HAS_SERVICEMANAGEMENT
-d:HAS_SHAREDWITHYOU
-d:HAS_SHAREDWITHYOUCORE
Expand Down
1 change: 1 addition & 0 deletions src/rsp/ios-defines.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
-d:HAS_SCENEKIT
-d:HAS_SCREENTIME
-d:HAS_SECURITY
-d:HAS_SENSITIVECONTENTANALYSIS
-d:HAS_SENSORKIT
-d:HAS_SHAREDWITHYOU
-d:HAS_SHAREDWITHYOUCORE
Expand Down
1 change: 1 addition & 0 deletions src/rsp/macos-defines.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
-d:HAS_SCRIPTINGBRIDGE
-d:HAS_SEARCHKIT
-d:HAS_SECURITY
-d:HAS_SENSITIVECONTENTANALYSIS
-d:HAS_SERVICEMANAGEMENT
-d:HAS_SHAREDWITHYOU
-d:HAS_SHAREDWITHYOUCORE
Expand Down
45 changes: 45 additions & 0 deletions src/sensitivecontentanalysis.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;
using CoreGraphics;
using Foundation;
using ObjCRuntime;

#if !NET
using NativeHandle = System.IntPtr;
#endif

namespace SensitiveContentAnalysis {
[NoTV, NoWatch, Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface SCSensitivityAnalysis {
[Export ("sensitive")]
bool Sensitive { [Bind ("isSensitive")] get; }
}

[NoTV, NoWatch, Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[Native]
public enum SCSensitivityAnalysisPolicy : long {
Disabled = 0,
SimpleInterventions = 1,
DescriptiveInterventions = 2,
}

[NoTV, NoWatch, Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[BaseType (typeof (NSObject))]
interface SCSensitivityAnalyzer {
[Export ("analysisPolicy", ArgumentSemantic.Assign)]
SCSensitivityAnalysisPolicy AnalysisPolicy { get; }

[Export ("analyzeImageFile:completionHandler:")]
[Async]
void AnalyzeImage (NSUrl fileUrl, Action<SCSensitivityAnalysis, NSError> completionHandler);

[Export ("analyzeCGImage:completionHandler:")]
[Async]
void AnalyzeImage (CGImage image, Action<SCSensitivityAnalysis, NSError> completionHandler);

[Export ("analyzeVideoFile:completionHandler:")]
[Async]
NSProgress AnalyzeVideo (NSUrl fileUrl, Action<SCSensitivityAnalysis, NSError> completionHandler);
}
}
1 change: 1 addition & 0 deletions tests/mtouch/RegistrarTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ public void MT4134 ()
new { Framework = "SharedWithYouCore", Version = "16.0" },
new { Framework = "Cinematic", Version = "17.0" },
new { Framework = "Symbols", Version = "17.0" },
new { Framework = "SensitiveContentAnalysis", Version = "17.0" },
};
foreach (var framework in invalidFrameworks)
mtouch.AssertError (4134, $"Your application is using the '{framework.Framework}' framework, which isn't included in the iOS SDK you're using to build your app (this framework was introduced in iOS {framework.Version}, while you're building with the iOS {mtouch.Sdk} SDK.) Please select a newer SDK in your app's iOS Build options.");
Expand Down

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions tests/xtro-sharpie/iOS-SensitiveContentAnalysis.todo

This file was deleted.

9 changes: 0 additions & 9 deletions tests/xtro-sharpie/macOS-SensitiveContentAnalysis.todo

This file was deleted.

2 changes: 2 additions & 0 deletions tools/common/Frameworks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ public static Frameworks MacFrameworks {

{ "Cinematic", "Cinematic", 14,0 },
{ "Symbols", "Symbols", 14, 0 },
{ "SensitiveContentAnalysis", "SensitiveContentAnalysis", 14, 0 },
};
}
return mac_frameworks;
Expand Down Expand Up @@ -463,6 +464,7 @@ public static Frameworks CreateiOSFrameworks (bool is_simulator_build)

{ "Cinematic", "Cinematic", new Version (17, 0), NotAvailableInSimulator },
{ "Symbols", "Symbols", 17, 0 },
{ "SensitiveContentAnalysis", "SensitiveContentAnalysis", 17, 0 },

// the above MUST be kept in sync with simlauncher
// see tools/mtouch/Makefile
Expand Down
1 change: 1 addition & 0 deletions tools/linker/ObjCExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ static class Namespaces {
public const string SceneKit = nameof (SceneKit);
public const string ScriptingBridge = nameof (ScriptingBridge);
public const string Security = nameof (Security);
public const string SensitiveContentAnalysis = nameof (SensitiveContentAnalysis);
public const string Social = nameof (Social);
public const string SpriteKit = nameof (SpriteKit);
public const string StoreKit = nameof (StoreKit);
Expand Down
1 change: 1 addition & 0 deletions tools/mtouch/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ SIMLAUNCHER_FRAMEWORKS = \
-weak_framework SharedWithYouCore \
\
-weak_framework Symbols \
-weak_framework SensitiveContentAnalysis \

SIMLAUNCHER64_FRAMEWORKS = \
-framework GameKit \
Expand Down

4 comments on commit 4f1cbbc

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.