Skip to content

Commit

Permalink
[BackgroundAssets] Add new framework from Xcode1 4 beta 4. (#15649)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Soto <alex@alexsoto.me>
  • Loading branch information
mandel-macaque and dalexsoto committed Aug 8, 2022
1 parent f35cc9b commit d9cd069
Show file tree
Hide file tree
Showing 9 changed files with 194 additions and 120 deletions.
185 changes: 185 additions & 0 deletions src/backgroundassets.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
//
// BackgroundAssets C# bindings
//
// Authors:
// Manuel de la Pena Saenz <mandel@microsoft.com>
//
// Copyright 2022 Microsoft Corporation All rights reserved.
//

using System;

using CoreFoundation;
using Foundation;
using ObjCRuntime;

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

namespace BackgroundAssets {
[NoWatch, NoTV, Mac (13,0), iOS (16,0), MacCatalyst (16,0)]
[Native]
public enum BADownloadState : long {
Failed = -1,
Created = 0,
Waiting,
Downloading,
Finished,
}

[NoWatch, NoTV, Mac (13,0), iOS (16,0), MacCatalyst (16,0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface BADownload : NSCoding, NSSecureCoding, NSCopying
{
[Export ("state")]
BADownloadState State { get; }

[Export ("identifier")]
string Identifier { get; }

[Export ("uniqueIdentifier")]
string UniqueIdentifier { get; }

[Export ("priority")]
nint Priority { get; }

[NullAllowed, Export ("error")]
NSError Error { get; }
}

[NoWatch, NoTV, Mac (13,0), iOS (16,0), MacCatalyst (16,0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface BAApplicationExtensionInfo : NSSecureCoding
{
[Export ("applicationIdentifier")]
string ApplicationIdentifier { get; }

[NullAllowed, Export ("lastPeriodicCheckTime")]
NSDate LastPeriodicCheckTime { get; }

[NullAllowed, Export ("lastApplicationLaunchTime")]
NSDate LastApplicationLaunchTime { get; }

[Export ("downloadSizeRestricted")]
bool DownloadSizeRestricted { get; }
}

[NoWatch, NoTV, Mac (13,0), iOS (16,0), MacCatalyst (16,0)]
[Protocol]
interface BADownloaderExtension {

[Export ("applicationDidInstallWithMetadata:")]
void DidInstallWithMetadata (BAApplicationExtensionInfo metadata);

[Export ("applicationDidUpdateWithMetadata:")]
void DidUpdateWithMetadata (BAApplicationExtensionInfo metadata);

[Export ("checkForUpdatesWithMetadata:")]
void CheckForUpdates (BAApplicationExtensionInfo metadata);

[Export ("receivedAuthenticationChallenge:download:completionHandler:")]
void ReceivedAuthenticationChallenge (NSUrlAuthenticationChallenge challenge, BADownload download, Action<NSUrlSessionAuthChallengeDisposition, NSUrlCredential> completionHandler);

[Export ("backgroundDownloadDidFail:")]
void BackgroundDownloadDidFail (BADownload failedDownload);

[Export ("backgroundDownloadDidFinish:fileURL:")]
void BackgroundDownloadDidFinish (BADownload finishedDownload, NSUrl fileUrl);

[Export ("extensionWillTerminate")]
void ExtensionWillTerminate ();
}

interface IBADownloadManagerDelegate {}

[NoWatch, NoTV, Mac (13,0), iOS (16,0), MacCatalyst (16,0)]
#if NET
[Protocol][Model]
#else
[Protocol][Model (AutoGeneratedName = true)]
#endif
[BaseType (typeof (NSObject))]
interface BADownloadManagerDelegate
{
[Export ("downloadDidBegin:")]
void DidBegin (BADownload download);

[Export ("downloadDidPause:")]
void DidPause (BADownload download);

[Export ("download:didWriteBytes:totalBytesWritten:totalBytesExpectedToWrite:")]
void DidWriteBytes (BADownload download, long bytesWritten, long totalBytesWritten, long totalExpectedBytes);

[Export ("download:didReceiveChallenge:completionHandler:")]
void DidReceiveChallenge (BADownload download, NSUrlAuthenticationChallenge challenge, Action<NSUrlSessionAuthChallengeDisposition, NSUrlCredential> completionHandler);

[Export ("download:failedWithError:")]
void Failed (BADownload download, NSError error);

[Export ("download:finishedWithFileURL:")]
void Finished (BADownload download, NSUrl fileUrl);
}

[NoWatch, NoTV, Mac (13,0), iOS (16,0), MacCatalyst (16,0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface BADownloadManager
{
[Static]
[Export ("sharedManager", ArgumentSemantic.Strong)]
BADownloadManager SharedManager { get; }

[Wrap ("WeakDelegate")]
[NullAllowed]
IBADownloadManagerDelegate Delegate { get; set; }

[NullAllowed, Export ("delegate", ArgumentSemantic.Weak)]
NSObject WeakDelegate { get; set; }

[Async]
[Export ("fetchCurrentDownloadsWithCompletionHandler:")]
void FetchCurrentDownloads (Action<NSArray<BADownload>, NSError> completionHandler);

[Export ("scheduleDownload:error:")]
bool ScheduleDownload (BADownload download, [NullAllowed] out NSError outError);

[Export ("performWithExclusiveControl:")]
void PerformWithExclusiveControl (Action<NSError> performHandler);

[Export ("performWithExclusiveControlBeforeDate:completion:")]
void PerformWithExclusiveControl (NSDate date, Action<bool, NSError> performHandler);

[Export ("startForegroundDownload:error:")]
bool StartForegroundDownload (BADownload download, [NullAllowed] out NSError outError);

[Export ("cancelDownload:error:")]
bool CancelDownload (BADownload download, [NullAllowed] out NSError error);
}

[NoWatch, NoTV, Mac (13,0), iOS (16,0), MacCatalyst (16,0)]
[BaseType (typeof (BADownload), Name = "BAURLDownload")]
[DisableDefaultCtor]
interface BAUrlDownload
{

[Field ("BADownloaderPriorityMin")]
nint MinPriority { get; }

[Field ("BADownloaderPriorityDefault")]
nint DefaultPriority { get; }

[Field ("BADownloaderPriorityMax")]
nint MaxPriority { get; }

[Export ("initWithIdentifier:request:applicationGroupIdentifier:")]
NativeHandle Constructor (string identifier, NSUrlRequest request, string applicationGroupIdentifier);

[Export ("initWithIdentifier:request:applicationGroupIdentifier:priority:")]
[DesignatedInitializer]
NativeHandle Constructor (string identifier, NSUrlRequest request, string applicationGroupIdentifier, nint priority);
}

}
3 changes: 3 additions & 0 deletions src/frameworks.sources
Original file line number Diff line number Diff line change
Expand Up @@ -1992,6 +1992,7 @@ MACOS_FRAMEWORKS = \
AutomaticAssessmentConfiguration \
AVKit \
BusinessChat \
BackgroundAssets \
CallKit \
CFNetwork \
Chip \
Expand Down Expand Up @@ -2095,6 +2096,7 @@ IOS_FRAMEWORKS = \
AudioToolbox \
AudioUnit \
AutomaticAssessmentConfiguration \
BackgroundAssets \
BackgroundTasks \
BusinessChat \
CallKit \
Expand Down Expand Up @@ -2287,6 +2289,7 @@ MACCATALYST_FRAMEWORKS = \
AudioToolbox \
AudioUnit \
AutomaticAssessmentConfiguration \
BackgroundAssets \
BackgroundTasks \
BusinessChat \
CallKit \
Expand Down
1 change: 1 addition & 0 deletions tests/mtouch/RegistrarTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ public void MT4134 ()
new { Framework = "CoreLocationUI", Version = "15.0" },
new { Framework = "Chip", Version = "15.0" },
new { Framework = "ThreadNetwork", Version = "15.0" },
new { Framework = "BackgroundAssets", Version = "16.0" },
new { Framework = "PushToTalk", Version = "16.0" },
};
foreach (var framework in invalidFrameworks)
Expand Down

This file was deleted.

This file was deleted.

30 changes: 0 additions & 30 deletions tests/xtro-sharpie/iOS-BackgroundAssets.todo

This file was deleted.

30 changes: 0 additions & 30 deletions tests/xtro-sharpie/macOS-BackgroundAssets.todo

This file was deleted.

3 changes: 3 additions & 0 deletions tools/common/Frameworks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ public static Frameworks MacFrameworks {
{ "ShazamKit", "ShazamKit", 12,0 },

{ "ScreenCaptureKit", "ScreenCaptureKit", 12,3 },

{ "BackgroundAssets", "BackgroundAssets", 13,0},
};
}
return mac_frameworks;
Expand Down Expand Up @@ -445,6 +447,7 @@ public static Frameworks CreateiOSFrameworks (bool is_simulator_build)
{ "ShazamKit", "ShazamKit", new Version (15,0), NotAvailableInSimulator},
{ "ThreadNetwork", "ThreadNetwork", new Version (15,0), NotAvailableInSimulator},

{ "BackgroundAssets", "BackgroundAssets", 16,0},
{ "PushToTalk", "PushToTalk", new Version (16,0), NotAvailableInSimulator},

// the above MUST be kept in sync with simlauncher
Expand Down
2 changes: 2 additions & 0 deletions tools/mtouch/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ SIMLAUNCHER_FRAMEWORKS = \
\
-weak_framework CoreLocationUI \
-weak_framework OSLog \
\
-weak_framework BackgroundAssets \

SIMLAUNCHER64_FRAMEWORKS = \
-framework GameKit \
Expand Down

5 comments on commit d9cd069

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💻 [CI Build] Tests on macOS Mac Catalina (10.15) passed 💻

All tests on macOS Mac Catalina (10.15) passed.

Pipeline on Agent
Hash: d9cd069f07bab1f1a3d2bbdef8f5e8e7c9ce8eba [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ API diff for current PR / commit

Legacy Xamarin (No breaking changes)
  • iOS: vsdrops gist (No breaking changes)
  • tvOS (no change detected)
  • watchOS (no change detected)
  • macOS: vsdrops gist (No breaking changes)
.NET (No breaking changes)

❗ API diff vs stable (Breaking changes)

Legacy Xamarin (:heavy_exclamation_mark: Breaking changes :heavy_exclamation_mark:)
  • iOS: vsdrops gist (:heavy_exclamation_mark: Breaking changes :heavy_exclamation_mark:)
  • tvOS: vsdrops gist (:heavy_exclamation_mark: Breaking changes :heavy_exclamation_mark:)
  • watchOS: vsdrops gist (:heavy_exclamation_mark: Breaking changes :heavy_exclamation_mark:)
  • macOS: vsdrops gist (:heavy_exclamation_mark: Breaking changes :heavy_exclamation_mark:)
.NET (:heavy_exclamation_mark: Breaking changes :heavy_exclamation_mark:)
  • iOS: vsdrops gist (:heavy_exclamation_mark: Breaking changes :heavy_exclamation_mark:)
  • tvOS: vsdrops gist (:heavy_exclamation_mark: Breaking changes :heavy_exclamation_mark:)
  • MacCatalyst: vsdrops gist (:heavy_exclamation_mark: Breaking changes :heavy_exclamation_mark:)
  • macOS: vsdrops gist (:heavy_exclamation_mark: Breaking changes :heavy_exclamation_mark:)
  • Microsoft.iOS vs Microsoft.MacCatalyst: vsdrops gist
Legacy Xamarin (stable) vs .NET

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: d9cd069f07bab1f1a3d2bbdef8f5e8e7c9ce8eba [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ [CI Build] Tests on macOS M1 - Mac Big Sur (11.5) failed ❌

Tests timed out

Pipeline on Agent
Hash: d9cd069f07bab1f1a3d2bbdef8f5e8e7c9ce8eba [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📚 [CI Build] Artifacts 📚

Packages generated

View packages

Pipeline on Agent XAMMINI-068.Monterey'
Hash: d9cd069f07bab1f1a3d2bbdef8f5e8e7c9ce8eba [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 [CI Build] Test results 🔥

Test results

❌ Tests failed on VSTS: simulator tests

0 tests crashed, 3 tests failed, 225 tests passed.

Failures

❌ introspection tests

1 tests failed, 12 tests passed.
  • introspection/watchOS 32-bits - simulator/Debug (watchOS 6.0): Crashed Known issue: HE0038)

Html Report (VSDrops) Download

❌ monotouch tests

2 tests failed, 21 tests passed.
  • monotouch-test/Mac Catalyst [dotnet]/Debug [dotnet]: TimedOut (Execution timed out after 1200 seconds.
    Test run crashed)
  • monotouch-test/watchOS 32-bits - simulator/Debug (LinkSdk): TimedOut

Html Report (VSDrops) Download

Successes

✅ bcl: All 69 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests: All 1 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 7 tests passed. Html Report (VSDrops) Download
✅ framework: All 8 tests passed. Html Report (VSDrops) Download
✅ generator: All 2 tests passed. Html Report (VSDrops) Download
✅ interdependent_binding_projects: All 7 tests passed. Html Report (VSDrops) Download
✅ install_source: All 1 tests passed. Html Report (VSDrops) Download
✅ linker: All 65 tests passed. Html Report (VSDrops) Download
✅ mac_binding_project: All 1 tests passed. Html Report (VSDrops) Download
✅ mmp: All 2 tests passed. Html Report (VSDrops) Download
✅ mononative: All 12 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ mtouch: All 1 tests passed. Html Report (VSDrops) Download
✅ xammac: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 8 tests passed. Html Report (VSDrops) Download
✅ xtro: All 2 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: [CI build]

Please sign in to comment.