-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ios17 bindings: new framework Background Assets - Schedule backgrou…
…nd downloads of large assets after app installation, when the app updates, and periodically while the app remains on-device.
- Loading branch information
Showing
12 changed files
with
1,012 additions
and
0 deletions.
There are no files selected for viewing
92 changes: 92 additions & 0 deletions
92
compiler/cocoatouch/src/main/bro-gen/backgroundassets.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package: org.robovm.apple.backgroundassets | ||
include: [foundation] | ||
library: BackgroundAssets | ||
framework: BackgroundAssets | ||
clang_args: ['-x', 'objective-c'] | ||
headers: | ||
- /System/Library/Frameworks/BackgroundAssets.framework/Headers/BackgroundAssets.h | ||
typedefs: {} | ||
|
||
enums: | ||
BAContentRequest: {} | ||
BADownloadState: {} | ||
BAErrorCode: { nserror: true } #since 17.0 | ||
|
||
classes: | ||
BAAppExtensionInfo: {} #since 16.1 | ||
BADownload: {} #since 16.1 | ||
BADownloadManager: #since 16.1 | ||
methods: | ||
'-fetchCurrentDownloadsWithCompletionHandler:': | ||
name: fetchCurrentDownloads | ||
'-scheduleDownload:error:': | ||
name: scheduleDownload | ||
throws: NSErrorException | ||
'-performWithExclusiveControl:': | ||
name: performWithExclusiveControl | ||
'-performWithExclusiveControlBeforeDate:performHandler:': | ||
name: performWithExclusiveControl | ||
'-startForegroundDownload:error:': | ||
name: startForegroundDownload | ||
throws: NSErrorException | ||
'-cancelDownload:error:': | ||
name: cancelDownload | ||
throws: NSErrorException | ||
BAURLDownload: #since 16.1 | ||
methods: | ||
'-initWithIdentifier:request:fileSize:applicationGroupIdentifier:': | ||
name: init | ||
'-initWithIdentifier:request:essential:fileSize:applicationGroupIdentifier:priority:': | ||
name: init | ||
'-initWithIdentifier:request:applicationGroupIdentifier:': | ||
name: init | ||
'-initWithIdentifier:request:applicationGroupIdentifier:priority:': | ||
name: init | ||
|
||
protocols: | ||
BADownloadManagerDelegate: #since 16.1 | ||
methods: | ||
'-download:didWriteBytes:totalBytesWritten:totalBytesExpectedToWrite:': | ||
name: didWriteBytes | ||
'-download:didReceiveChallenge:completionHandler:': | ||
name: didReceiveChallenge | ||
'-download:failedWithError:': | ||
name: failed | ||
'-download:finishedWithFileURL:': | ||
name: finished | ||
BADownloaderExtension: #since 16.1 | ||
methods: | ||
'-downloadsForRequest:manifestURL:extensionInfo:': | ||
name: getDownloads | ||
'-backgroundDownload:didReceiveChallenge:completionHandler:': | ||
name: backgroundDownloadDidReceiveChallenge | ||
'-backgroundDownload:failedWithError:': | ||
name: backgroundDownloadFailed | ||
'-backgroundDownload:finishedWithFileURL:': | ||
name: backgroundDownloadFinished | ||
|
||
functions: | ||
# Make sure we don't miss any functions if new ones are introduced in a later version | ||
(.*): | ||
class: FIXME | ||
name: 'Function__#{g[0]}' | ||
|
||
values: | ||
BAErrorDomain: | ||
class: BAErrorCode | ||
name: getClassDomain | ||
BADownloaderPriority(.*): | ||
class: BADownload | ||
static_class: Priority | ||
name: '#{g[0]}' | ||
|
||
# Make sure we don't miss any values if new ones are introduced in a later version | ||
(.*): | ||
class: FIXME | ||
name: 'Value__#{g[0]}' | ||
|
||
constants: | ||
# Make sure we don't miss any constants if new ones are introduced in a later version | ||
(.*): | ||
class: FIXME | ||
name: 'Constant__#{g[0]}' |
71 changes: 71 additions & 0 deletions
71
compiler/cocoatouch/src/main/java/org/robovm/apple/backgroundassets/BAAppExtensionInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright (C) 2013-2015 RoboVM AB | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.robovm.apple.backgroundassets; | ||
|
||
/*<imports>*/ | ||
import java.io.*; | ||
import java.nio.*; | ||
import java.util.*; | ||
import org.robovm.objc.*; | ||
import org.robovm.objc.annotation.*; | ||
import org.robovm.objc.block.*; | ||
import org.robovm.rt.*; | ||
import org.robovm.rt.annotation.*; | ||
import org.robovm.rt.bro.*; | ||
import org.robovm.rt.bro.annotation.*; | ||
import org.robovm.rt.bro.ptr.*; | ||
import org.robovm.apple.foundation.*; | ||
/*</imports>*/ | ||
|
||
/*<javadoc>*/ | ||
/** | ||
* @since Available in iOS 16.1 and later. | ||
*/ | ||
/*</javadoc>*/ | ||
/*<annotations>*/@Library("BackgroundAssets") @NativeClass/*</annotations>*/ | ||
/*<visibility>*/public/*</visibility>*/ class /*<name>*/BAAppExtensionInfo/*</name>*/ | ||
extends /*<extends>*/NSObject/*</extends>*/ | ||
/*<implements>*/implements NSSecureCoding/*</implements>*/ { | ||
|
||
/*<ptr>*/public static class BAAppExtensionInfoPtr extends Ptr<BAAppExtensionInfo, BAAppExtensionInfoPtr> {}/*</ptr>*/ | ||
/*<bind>*/static { ObjCRuntime.bind(BAAppExtensionInfo.class); }/*</bind>*/ | ||
/*<constants>*//*</constants>*/ | ||
/*<constructors>*/ | ||
protected BAAppExtensionInfo() {} | ||
protected BAAppExtensionInfo(Handle h, long handle) { super(h, handle); } | ||
protected BAAppExtensionInfo(SkipInit skipInit) { super(skipInit); } | ||
@Method(selector = "initWithCoder:") | ||
public BAAppExtensionInfo(NSCoder coder) { super((SkipInit) null); initObject(init(coder)); } | ||
/*</constructors>*/ | ||
/*<properties>*/ | ||
@Property(selector = "restrictedDownloadSizeRemaining") | ||
public native NSNumber getRestrictedDownloadSizeRemaining(); | ||
/** | ||
* @since Available in iOS 16.4 and later. | ||
*/ | ||
@Property(selector = "restrictedEssentialDownloadSizeRemaining") | ||
public native NSNumber getRestrictedEssentialDownloadSizeRemaining(); | ||
@Property(selector = "supportsSecureCoding") | ||
public static native boolean supportsSecureCoding(); | ||
/*</properties>*/ | ||
/*<members>*//*</members>*/ | ||
/*<methods>*/ | ||
@Method(selector = "encodeWithCoder:") | ||
public native void encode(NSCoder coder); | ||
@Method(selector = "initWithCoder:") | ||
protected native @Pointer long init(NSCoder coder); | ||
/*</methods>*/ | ||
} |
62 changes: 62 additions & 0 deletions
62
compiler/cocoatouch/src/main/java/org/robovm/apple/backgroundassets/BAContentRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright (C) 2013-2015 RoboVM AB | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.robovm.apple.backgroundassets; | ||
|
||
/*<imports>*/ | ||
import java.io.*; | ||
import java.nio.*; | ||
import java.util.*; | ||
import org.robovm.objc.*; | ||
import org.robovm.objc.annotation.*; | ||
import org.robovm.objc.block.*; | ||
import org.robovm.rt.*; | ||
import org.robovm.rt.annotation.*; | ||
import org.robovm.rt.bro.*; | ||
import org.robovm.rt.bro.annotation.*; | ||
import org.robovm.rt.bro.ptr.*; | ||
import org.robovm.apple.foundation.*; | ||
/*</imports>*/ | ||
|
||
/*<javadoc>*/ | ||
|
||
/*</javadoc>*/ | ||
/*<annotations>*/@Marshaler(ValuedEnum.AsMachineSizedSIntMarshaler.class)/*</annotations>*/ | ||
public enum /*<name>*/BAContentRequest/*</name>*/ implements ValuedEnum { | ||
/*<values>*/ | ||
Install(1L), | ||
Update(2L), | ||
Periodic(3L); | ||
/*</values>*/ | ||
|
||
/*<bind>*/ | ||
/*</bind>*/ | ||
/*<constants>*//*</constants>*/ | ||
/*<methods>*//*</methods>*/ | ||
|
||
private final long n; | ||
|
||
private /*<name>*/BAContentRequest/*</name>*/(long n) { this.n = n; } | ||
public long value() { return n; } | ||
public static /*<name>*/BAContentRequest/*</name>*/ valueOf(long n) { | ||
for (/*<name>*/BAContentRequest/*</name>*/ v : values()) { | ||
if (v.n == n) { | ||
return v; | ||
} | ||
} | ||
throw new IllegalArgumentException("No constant with value " + n + " found in " | ||
+ /*<name>*/BAContentRequest/*</name>*/.class.getName()); | ||
} | ||
} |
115 changes: 115 additions & 0 deletions
115
compiler/cocoatouch/src/main/java/org/robovm/apple/backgroundassets/BADownload.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/* | ||
* Copyright (C) 2013-2015 RoboVM AB | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.robovm.apple.backgroundassets; | ||
|
||
/*<imports>*/ | ||
import java.io.*; | ||
import java.nio.*; | ||
import java.util.*; | ||
import org.robovm.objc.*; | ||
import org.robovm.objc.annotation.*; | ||
import org.robovm.objc.block.*; | ||
import org.robovm.rt.*; | ||
import org.robovm.rt.annotation.*; | ||
import org.robovm.rt.bro.*; | ||
import org.robovm.rt.bro.annotation.*; | ||
import org.robovm.rt.bro.ptr.*; | ||
import org.robovm.apple.foundation.*; | ||
/*</imports>*/ | ||
|
||
/*<javadoc>*/ | ||
/** | ||
* @since Available in iOS 16.1 and later. | ||
*/ | ||
/*</javadoc>*/ | ||
/*<annotations>*/@Library("BackgroundAssets") @NativeClass/*</annotations>*/ | ||
/*<visibility>*/public/*</visibility>*/ class /*<name>*/BADownload/*</name>*/ | ||
extends /*<extends>*/NSObject/*</extends>*/ | ||
/*<implements>*/implements NSCoding, NSSecureCoding/*</implements>*/ { | ||
|
||
/*<ptr>*/public static class BADownloadPtr extends Ptr<BADownload, BADownloadPtr> {}/*</ptr>*/ | ||
/*<bind>*/static { ObjCRuntime.bind(BADownload.class); }/*</bind>*/ | ||
/*<constants>*//*</constants>*/ | ||
/*<constructors>*/ | ||
protected BADownload() {} | ||
protected BADownload(Handle h, long handle) { super(h, handle); } | ||
protected BADownload(SkipInit skipInit) { super(skipInit); } | ||
@Method(selector = "initWithCoder:") | ||
public BADownload(NSCoder coder) { super((SkipInit) null); initObject(init(coder)); } | ||
/*</constructors>*/ | ||
/*<properties>*/ | ||
/** | ||
* @since Available in iOS 16.1 and later. | ||
*/ | ||
@Property(selector = "state") | ||
public native BADownloadState getState(); | ||
/** | ||
* @since Available in iOS 16.1 and later. | ||
*/ | ||
@Property(selector = "identifier") | ||
public native String getIdentifier(); | ||
/** | ||
* @since Available in iOS 16.1 and later. | ||
*/ | ||
@Property(selector = "uniqueIdentifier") | ||
public native String getUniqueIdentifier(); | ||
/** | ||
* @since Available in iOS 16.1 and later. | ||
*/ | ||
@Property(selector = "priority") | ||
public native @MachineSizedSInt long getPriority(); | ||
/** | ||
* @since Available in iOS 16.4 and later. | ||
*/ | ||
@Property(selector = "isEssential") | ||
public native boolean isEssential(); | ||
@Property(selector = "supportsSecureCoding") | ||
public static native boolean supportsSecureCoding(); | ||
/*</properties>*/ | ||
/*<members>*//*</members>*/ | ||
/*<methods>*/ | ||
@Library("BackgroundAssets") | ||
public static class Priority { | ||
static { Bro.bind(Priority.class); } | ||
|
||
/** | ||
* @since Available in iOS 16.1 and later. | ||
*/ | ||
@GlobalValue(symbol="BADownloaderPriorityMin", optional=true) | ||
public static native @MachineSizedSInt long Min(); | ||
/** | ||
* @since Available in iOS 16.1 and later. | ||
*/ | ||
@GlobalValue(symbol="BADownloaderPriorityDefault", optional=true) | ||
public static native @MachineSizedSInt long Default(); | ||
/** | ||
* @since Available in iOS 16.1 and later. | ||
*/ | ||
@GlobalValue(symbol="BADownloaderPriorityMax", optional=true) | ||
public static native @MachineSizedSInt long Max(); | ||
} | ||
|
||
/** | ||
* @since Available in iOS 16.4 and later. | ||
*/ | ||
@Method(selector = "copyAsNonEssential") | ||
public native BADownload copyAsNonEssential(); | ||
@Method(selector = "encodeWithCoder:") | ||
public native void encode(NSCoder coder); | ||
@Method(selector = "initWithCoder:") | ||
protected native @Pointer long init(NSCoder coder); | ||
/*</methods>*/ | ||
} |
Oops, something went wrong.