-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for the AuthenticationServices framework
- Loading branch information
Showing
68 changed files
with
2,642 additions
and
5 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -7,3 +7,5 @@ | |
#if TARGET_OS_OSX | ||
#import <AppKit/AppKit.h> | ||
#endif | ||
|
||
#import <AuthenticationServices/AuthenticationServices.h> |
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
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
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
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,11 @@ | ||
use crate::Foundation::NSObject; | ||
|
||
// TODO: UIViewController on iOS, NSViewController on macOS | ||
pub type ASViewController = NSObject; | ||
// TODO: UIWindow on iOS, NSWindow on macOS | ||
pub type ASPresentationAnchor = NSObject; | ||
// TODO: UIImage on iOS, NSImage on macOS | ||
pub type ASImage = NSObject; | ||
|
||
// TODO: UIControl on iOS, NSControl on macOS | ||
pub(crate) type ASControl = NSObject; |
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,7 @@ | ||
mod fixes; | ||
#[allow(unused_imports)] | ||
#[path = "../generated/AuthenticationServices/mod.rs"] | ||
mod generated; | ||
|
||
pub use self::fixes::*; | ||
pub use self::generated::*; |
20 changes: 20 additions & 0 deletions
20
crates/icrate/src/AuthenticationServices/translation-config.toml
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,20 @@ | ||
imports = ["AuthenticationServices", "Foundation"] | ||
|
||
# Uses a bit of complex feature testing setup, see ASFoundation.h | ||
[typedef.ASPresentationAnchor] | ||
skipped = true | ||
[typedef.ASViewController] | ||
skipped = true | ||
[typedef.ASImage] | ||
skipped = true | ||
|
||
# It is a bit difficult to extract the original typedef name from the | ||
# superclass name, so let's just overwrite it here. | ||
[class.ASCredentialProviderViewController] | ||
superclass-name = "ASViewController" | ||
[class.ASAccountAuthenticationModificationViewController] | ||
superclass-name = "ASViewController" | ||
|
||
# Specifies UIControl or NSControl conditionally | ||
[class.ASAuthorizationAppleIDButton] | ||
superclass-name = "ASControl" |
83 changes: 83 additions & 0 deletions
83
...ate/src/generated/AuthenticationServices/ASAccountAuthenticationModificationController.rs
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,83 @@ | ||
//! This file has been automatically generated by `objc2`'s `header-translator`. | ||
//! DO NOT EDIT | ||
use crate::common::*; | ||
use crate::AuthenticationServices::*; | ||
use crate::Foundation::*; | ||
|
||
extern_protocol!( | ||
pub struct ASAccountAuthenticationModificationControllerDelegate; | ||
|
||
unsafe impl ASAccountAuthenticationModificationControllerDelegate { | ||
#[optional] | ||
#[method(accountAuthenticationModificationController:didSuccessfullyCompleteRequest:withUserInfo:)] | ||
pub unsafe fn accountAuthenticationModificationController_didSuccessfullyCompleteRequest_withUserInfo( | ||
&self, | ||
controller: &ASAccountAuthenticationModificationController, | ||
request: &ASAccountAuthenticationModificationRequest, | ||
userInfo: Option<&NSDictionary>, | ||
); | ||
|
||
#[optional] | ||
#[method(accountAuthenticationModificationController:didFailRequest:withError:)] | ||
pub unsafe fn accountAuthenticationModificationController_didFailRequest_withError( | ||
&self, | ||
controller: &ASAccountAuthenticationModificationController, | ||
request: &ASAccountAuthenticationModificationRequest, | ||
error: &NSError, | ||
); | ||
} | ||
); | ||
|
||
extern_protocol!( | ||
pub struct ASAccountAuthenticationModificationControllerPresentationContextProviding; | ||
|
||
unsafe impl ASAccountAuthenticationModificationControllerPresentationContextProviding { | ||
#[method_id(@__retain_semantics Other presentationAnchorForAccountAuthenticationModificationController:)] | ||
pub unsafe fn presentationAnchorForAccountAuthenticationModificationController( | ||
&self, | ||
controller: &ASAccountAuthenticationModificationController, | ||
) -> Id<ASPresentationAnchor, Shared>; | ||
} | ||
); | ||
|
||
extern_class!( | ||
#[derive(Debug)] | ||
pub struct ASAccountAuthenticationModificationController; | ||
|
||
unsafe impl ClassType for ASAccountAuthenticationModificationController { | ||
type Super = NSObject; | ||
} | ||
); | ||
|
||
extern_methods!( | ||
unsafe impl ASAccountAuthenticationModificationController { | ||
#[method_id(@__retain_semantics Other delegate)] | ||
pub unsafe fn delegate( | ||
&self, | ||
) -> Option<Id<ASAccountAuthenticationModificationControllerDelegate, Shared>>; | ||
|
||
#[method(setDelegate:)] | ||
pub unsafe fn setDelegate( | ||
&self, | ||
delegate: Option<&ASAccountAuthenticationModificationControllerDelegate>, | ||
); | ||
|
||
#[method_id(@__retain_semantics Other presentationContextProvider)] | ||
pub unsafe fn presentationContextProvider( | ||
&self, | ||
) -> Option< | ||
Id<ASAccountAuthenticationModificationControllerPresentationContextProviding, Shared>, | ||
>; | ||
|
||
#[method(setPresentationContextProvider:)] | ||
pub unsafe fn setPresentationContextProvider( | ||
&self, | ||
presentationContextProvider: Option< | ||
&ASAccountAuthenticationModificationControllerPresentationContextProviding, | ||
>, | ||
); | ||
|
||
#[method(performRequest:)] | ||
pub unsafe fn performRequest(&self, request: &ASAccountAuthenticationModificationRequest); | ||
} | ||
); |
42 changes: 42 additions & 0 deletions
42
...c/generated/AuthenticationServices/ASAccountAuthenticationModificationExtensionContext.rs
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,42 @@ | ||
//! This file has been automatically generated by `objc2`'s `header-translator`. | ||
//! DO NOT EDIT | ||
use crate::common::*; | ||
use crate::AuthenticationServices::*; | ||
use crate::Foundation::*; | ||
|
||
extern_class!( | ||
#[derive(Debug)] | ||
pub struct ASAccountAuthenticationModificationExtensionContext; | ||
|
||
unsafe impl ClassType for ASAccountAuthenticationModificationExtensionContext { | ||
type Super = NSExtensionContext; | ||
} | ||
); | ||
|
||
extern_methods!( | ||
unsafe impl ASAccountAuthenticationModificationExtensionContext { | ||
#[method(getSignInWithAppleUpgradeAuthorizationWithState:nonce:completionHandler:)] | ||
pub unsafe fn getSignInWithAppleUpgradeAuthorizationWithState_nonce_completionHandler( | ||
&self, | ||
state: Option<&NSString>, | ||
nonce: Option<&NSString>, | ||
completionHandler: &Block<(*mut ASAuthorizationAppleIDCredential, *mut NSError), ()>, | ||
); | ||
|
||
#[method(completeUpgradeToSignInWithAppleWithUserInfo:)] | ||
pub unsafe fn completeUpgradeToSignInWithAppleWithUserInfo( | ||
&self, | ||
userInfo: Option<&NSDictionary>, | ||
); | ||
|
||
#[method(completeChangePasswordRequestWithUpdatedCredential:userInfo:)] | ||
pub unsafe fn completeChangePasswordRequestWithUpdatedCredential_userInfo( | ||
&self, | ||
updatedCredential: &ASPasswordCredential, | ||
userInfo: Option<&NSDictionary>, | ||
); | ||
|
||
#[method(cancelRequestWithError:)] | ||
pub unsafe fn cancelRequestWithError(&self, error: &NSError); | ||
} | ||
); |
37 changes: 37 additions & 0 deletions
37
...nServices/ASAccountAuthenticationModificationReplacePasswordWithSignInWithAppleRequest.rs
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,37 @@ | ||
//! This file has been automatically generated by `objc2`'s `header-translator`. | ||
//! DO NOT EDIT | ||
use crate::common::*; | ||
use crate::AuthenticationServices::*; | ||
use crate::Foundation::*; | ||
|
||
extern_class!( | ||
#[derive(Debug)] | ||
pub struct ASAccountAuthenticationModificationReplacePasswordWithSignInWithAppleRequest; | ||
|
||
unsafe impl ClassType | ||
for ASAccountAuthenticationModificationReplacePasswordWithSignInWithAppleRequest | ||
{ | ||
type Super = ASAccountAuthenticationModificationRequest; | ||
} | ||
); | ||
|
||
extern_methods!( | ||
unsafe impl ASAccountAuthenticationModificationReplacePasswordWithSignInWithAppleRequest { | ||
#[method_id(@__retain_semantics Init initWithUser:serviceIdentifier:userInfo:)] | ||
pub unsafe fn initWithUser_serviceIdentifier_userInfo( | ||
this: Option<Allocated<Self>>, | ||
user: &NSString, | ||
serviceIdentifier: &ASCredentialServiceIdentifier, | ||
userInfo: Option<&NSDictionary>, | ||
) -> Id<Self, Shared>; | ||
|
||
#[method_id(@__retain_semantics Other user)] | ||
pub unsafe fn user(&self) -> Id<NSString, Shared>; | ||
|
||
#[method_id(@__retain_semantics Other serviceIdentifier)] | ||
pub unsafe fn serviceIdentifier(&self) -> Id<ASCredentialServiceIdentifier, Shared>; | ||
|
||
#[method_id(@__retain_semantics Other userInfo)] | ||
pub unsafe fn userInfo(&self) -> Option<Id<NSDictionary, Shared>>; | ||
} | ||
); |
18 changes: 18 additions & 0 deletions
18
...icrate/src/generated/AuthenticationServices/ASAccountAuthenticationModificationRequest.rs
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,18 @@ | ||
//! This file has been automatically generated by `objc2`'s `header-translator`. | ||
//! DO NOT EDIT | ||
use crate::common::*; | ||
use crate::AuthenticationServices::*; | ||
use crate::Foundation::*; | ||
|
||
extern_class!( | ||
#[derive(Debug)] | ||
pub struct ASAccountAuthenticationModificationRequest; | ||
|
||
unsafe impl ClassType for ASAccountAuthenticationModificationRequest { | ||
type Super = NSObject; | ||
} | ||
); | ||
|
||
extern_methods!( | ||
unsafe impl ASAccountAuthenticationModificationRequest {} | ||
); |
37 changes: 37 additions & 0 deletions
37
...tionServices/ASAccountAuthenticationModificationUpgradePasswordToStrongPasswordRequest.rs
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,37 @@ | ||
//! This file has been automatically generated by `objc2`'s `header-translator`. | ||
//! DO NOT EDIT | ||
use crate::common::*; | ||
use crate::AuthenticationServices::*; | ||
use crate::Foundation::*; | ||
|
||
extern_class!( | ||
#[derive(Debug)] | ||
pub struct ASAccountAuthenticationModificationUpgradePasswordToStrongPasswordRequest; | ||
|
||
unsafe impl ClassType | ||
for ASAccountAuthenticationModificationUpgradePasswordToStrongPasswordRequest | ||
{ | ||
type Super = ASAccountAuthenticationModificationRequest; | ||
} | ||
); | ||
|
||
extern_methods!( | ||
unsafe impl ASAccountAuthenticationModificationUpgradePasswordToStrongPasswordRequest { | ||
#[method_id(@__retain_semantics Init initWithUser:serviceIdentifier:userInfo:)] | ||
pub unsafe fn initWithUser_serviceIdentifier_userInfo( | ||
this: Option<Allocated<Self>>, | ||
user: &NSString, | ||
serviceIdentifier: &ASCredentialServiceIdentifier, | ||
userInfo: Option<&NSDictionary>, | ||
) -> Id<Self, Shared>; | ||
|
||
#[method_id(@__retain_semantics Other user)] | ||
pub unsafe fn user(&self) -> Id<NSString, Shared>; | ||
|
||
#[method_id(@__retain_semantics Other serviceIdentifier)] | ||
pub unsafe fn serviceIdentifier(&self) -> Id<ASCredentialServiceIdentifier, Shared>; | ||
|
||
#[method_id(@__retain_semantics Other userInfo)] | ||
pub unsafe fn userInfo(&self) -> Option<Id<NSDictionary, Shared>>; | ||
} | ||
); |
60 changes: 60 additions & 0 deletions
60
...src/generated/AuthenticationServices/ASAccountAuthenticationModificationViewController.rs
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,60 @@ | ||
//! This file has been automatically generated by `objc2`'s `header-translator`. | ||
//! DO NOT EDIT | ||
use crate::common::*; | ||
use crate::AuthenticationServices::*; | ||
use crate::Foundation::*; | ||
|
||
extern_class!( | ||
#[derive(Debug)] | ||
pub struct ASAccountAuthenticationModificationViewController; | ||
|
||
unsafe impl ClassType for ASAccountAuthenticationModificationViewController { | ||
type Super = ASViewController; | ||
} | ||
); | ||
|
||
extern_methods!( | ||
unsafe impl ASAccountAuthenticationModificationViewController { | ||
#[method_id(@__retain_semantics Other extensionContext)] | ||
pub unsafe fn extensionContext( | ||
&self, | ||
) -> Id<ASAccountAuthenticationModificationExtensionContext, Shared>; | ||
|
||
#[method(convertAccountToSignInWithAppleWithoutUserInteractionForServiceIdentifier:existingCredential:userInfo:)] | ||
pub unsafe fn convertAccountToSignInWithAppleWithoutUserInteractionForServiceIdentifier_existingCredential_userInfo( | ||
&self, | ||
serviceIdentifier: &ASCredentialServiceIdentifier, | ||
existingCredential: &ASPasswordCredential, | ||
userInfo: Option<&NSDictionary>, | ||
); | ||
|
||
#[method(prepareInterfaceToConvertAccountToSignInWithAppleForServiceIdentifier:existingCredential:userInfo:)] | ||
pub unsafe fn prepareInterfaceToConvertAccountToSignInWithAppleForServiceIdentifier_existingCredential_userInfo( | ||
&self, | ||
serviceIdentifier: &ASCredentialServiceIdentifier, | ||
existingCredential: &ASPasswordCredential, | ||
userInfo: Option<&NSDictionary>, | ||
); | ||
|
||
#[method(changePasswordWithoutUserInteractionForServiceIdentifier:existingCredential:newPassword:userInfo:)] | ||
pub unsafe fn changePasswordWithoutUserInteractionForServiceIdentifier_existingCredential_newPassword_userInfo( | ||
&self, | ||
serviceIdentifier: &ASCredentialServiceIdentifier, | ||
existingCredential: &ASPasswordCredential, | ||
newPassword: &NSString, | ||
userInfo: Option<&NSDictionary>, | ||
); | ||
|
||
#[method(prepareInterfaceToChangePasswordForServiceIdentifier:existingCredential:newPassword:userInfo:)] | ||
pub unsafe fn prepareInterfaceToChangePasswordForServiceIdentifier_existingCredential_newPassword_userInfo( | ||
&self, | ||
serviceIdentifier: &ASCredentialServiceIdentifier, | ||
existingCredential: &ASPasswordCredential, | ||
newPassword: &NSString, | ||
userInfo: Option<&NSDictionary>, | ||
); | ||
|
||
#[method(cancelRequest)] | ||
pub unsafe fn cancelRequest(&self); | ||
} | ||
); |
Oops, something went wrong.