Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[safariservices] Update up to beta 4 #2380

Merged
merged 1 commit into from
Jul 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion src/SafariServices/SSEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
namespace XamCore.SafariServices {

// NSInteger -> SSReadingList.h
[NoMac]
[NoMac][iOS (7,0)]
[Native]
[ErrorDomain ("SSReadingListErrorDomain")]
public enum SSReadingListError : nint {
UrlSchemeNotAllowed = 1
}
Expand All @@ -40,4 +41,31 @@ public enum SFErrorCode : nint
NoAttachmentFound = 2,
LoadingInterrupted = 3
}

[NoMac]
[iOS (11,0)]
[Native]
public enum SFSafariViewControllerDismissButtonStyle : nint {
Done,
Close,
Cancel,
}

[NoMac]
[iOS (11,0)]
[Native]
[ErrorDomain ("SFAuthenticationErrorDomain")]
public enum SFAuthenticationError : nint {
CanceledLogin = 1,
}

[NoiOS]
[Mac (10,12,4, only64: true)]
[Native]
public enum SFSafariServicesVersion : nint {
V10_0,
V10_1,
[Mac (10,13, only64: true)]
V11_0,
}
}
69 changes: 65 additions & 4 deletions src/safariservices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ partial interface SSReadingList {
[Export ("addReadingListItemWithURL:title:previewText:error:")]
bool Add (NSUrl url, [NullAllowed] string title, [NullAllowed] string previewText, out NSError error);

#if !XAMCORE_4_0
[Field ("SSReadingListErrorDomain")]
NSString ErrorDomain { get; }
#endif
}

[iOS (9,0)]
Expand All @@ -71,6 +73,12 @@ interface SFSafariViewController {
[PostGet ("NibBundle")]
IntPtr Constructor ([NullAllowed] string nibName, [NullAllowed] NSBundle bundle);

[iOS (11,0)]
[Export ("initWithURL:configuration:")]
[DesignatedInitializer]
IntPtr Constructor (NSUrl url, SFSafariViewControllerConfiguration configuration);

[Deprecated (PlatformName.iOS, 11,0, message: "Use '.ctor (NSUrl, SFSafariViewControllerConfiguration)' instead.")]
[DesignatedInitializer]
[Export ("initWithURL:entersReaderIfAvailable:")]
IntPtr Constructor (NSUrl url, bool entersReaderIfAvailable);
Expand All @@ -87,12 +95,22 @@ interface SFSafariViewController {
SFSafariViewControllerDelegate Delegate { get; set; }

[iOS (10, 0)]
[NullAllowed]
[Export ("preferredBarTintColor", ArgumentSemantic.Assign)]
UIColor PreferredBarTintColor { get; set; }

[iOS (10, 0)]
[NullAllowed]
[Export ("preferredControlTintColor", ArgumentSemantic.Assign)]
UIColor PreferredControlTintColor { get; set; }

[iOS (11,0)]
[Export ("configuration", ArgumentSemantic.Copy)]
SFSafariViewControllerConfiguration Configuration { get; }

[iOS (11,0)]
[Export ("dismissButtonStyle", ArgumentSemantic.Assign)]
SFSafariViewControllerDismissButtonStyle DismissButtonStyle { get; set; }
}

[iOS (9,0)]
Expand All @@ -108,6 +126,37 @@ partial interface SFSafariViewControllerDelegate {

[Export ("safariViewController:didCompleteInitialLoad:")]
void DidCompleteInitialLoad (SFSafariViewController controller, bool didLoadSuccessfully);

[iOS (11,0)]
[Export ("safariViewController:excludedActivityTypesForURL:title:")]
string[] GetExcludedActivityTypes (SFSafariViewController controller, NSUrl url, [NullAllowed] string title);
}

[iOS (11,0)]
[BaseType (typeof (NSObject))]
interface SFSafariViewControllerConfiguration : NSCopying {
[Export ("entersReaderIfAvailable")]
bool EntersReaderIfAvailable { get; set; }

[Export ("barCollapsingEnabled")]
bool BarCollapsingEnabled { get; set; }
}

[iOS (11,0)]
delegate void SFAuthenticationCompletionHandler ([NullAllowed] NSUrl callbackUrl, [NullAllowed] NSError error);

[iOS (11,0)]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface SFAuthenticationSession {
[Export ("initWithURL:callbackURLScheme:completionHandler:")]
IntPtr Constructor (NSUrl url, [NullAllowed] string callbackUrlScheme, SFAuthenticationCompletionHandler completionHandler);

[Export ("start")]
bool Start ();

[Export ("cancel")]
void Cancel ();
}
#else
[Mac (10,12, onlyOn64: true)]
Expand All @@ -131,10 +180,17 @@ interface SFSafariApplication
[Export ("showPreferencesForExtensionWithIdentifier:completionHandler:")]
void ShowPreferencesForExtension (string identifier, [NullAllowed] Action<NSError> completionHandler);

[Mac (10, 12, 4)]
[Mac (10,12,4, onlyOn64 : true)]
[Advice ("Unavailable to extensions")]
[Static][Async]
[Export ("dispatchMessageWithName:toExtensionWithIdentifier:userInfo:completionHandler:")]
void DispatchMessage (string messageName, string identifier, [NullAllowed] NSDictionary<NSString, NSObject> userInfo, [NullAllowed] Action<NSError> completionHandler);

[Mac (10,13, onlyOn64 : true)]
[Static]
[Async]
[Export ("getHostApplicationWithCompletionHandler:")]
void GetHostApplication (Action<NSRunningApplication> completionHandler);
}

[Mac (10,12, onlyOn64 : true)]
Expand Down Expand Up @@ -228,20 +284,25 @@ interface SFSafariTab
[DisableDefaultCtor]
interface SFSafariToolbarItem
{
[Deprecated (PlatformName.MacOSX, 10,13, message: "Use 'SetEnabled (bool)' or 'SetBadgeText' instead.")]
[Export ("setEnabled:withBadgeText:")]
void SetEnabled (bool enabled, [NullAllowed] string badgeText);

[Mac (10, 12, 4)]
[Mac (10,12,4, onlyOn64: true)]
[Export ("setEnabled:")]
void SetEnabled (bool enabled);

[Mac (10, 12, 4)]
[Mac (10,12,4, onlyOn64: true)]
[Export ("setBadgeText:")]
void SetBadgeText ([NullAllowed] string badgeText);

[Mac (10, 12, 4)]
[Mac (10,12,4, onlyOn64: true)]
[Export ("setImage:")]
void SetImage ([NullAllowed] NSImage image);

[Mac (10,13, onlyOn64: true)]
[Export ("setLabel:")]
void SetLabel ([NullAllowed] string label);
}

[Mac (10,12, onlyOn64: true)]
Expand Down