123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- #import <Realm/RLMConstants.h>
- #import <AuthenticationServices/AuthenticationServices.h>
- RLM_HEADER_AUDIT_BEGIN(nullability, sendability)
- @protocol RLMNetworkTransport, RLMBSON;
- @class RLMUser, RLMCredentials, RLMSyncManager, RLMEmailPasswordAuth, RLMPushClient;
- typedef void(^RLMUserCompletionBlock)(RLMUser * _Nullable, NSError * _Nullable);
- typedef void(^RLMOptionalErrorBlock)(NSError * _Nullable);
- #pragma mark RLMAppConfiguration
- @interface RLMAppConfiguration : NSObject
- @property (nonatomic, strong, nullable) NSString *baseURL;
- @property (nonatomic, strong, nullable) id<RLMNetworkTransport> transport;
- @property (nonatomic, strong, nullable) NSString *localAppName;
- @property (nonatomic, strong, nullable) NSString *localAppVersion;
- @property (nonatomic, assign) NSUInteger defaultRequestTimeoutMS;
- - (instancetype)initWithBaseURL:(nullable NSString *)baseURL
- transport:(nullable id<RLMNetworkTransport>)transport
- localAppName:(nullable NSString *)localAppName
- localAppVersion:(nullable NSString *)localAppVersion;
- - (instancetype)initWithBaseURL:(nullable NSString *) baseURL
- transport:(nullable id<RLMNetworkTransport>)transport
- localAppName:(nullable NSString *)localAppName
- localAppVersion:(nullable NSString *)localAppVersion
- defaultRequestTimeoutMS:(NSUInteger)defaultRequestTimeoutMS;
- @end
- #pragma mark RLMApp
- RLM_SWIFT_SENDABLE RLM_FINAL
- @interface RLMApp : NSObject
- @property (nonatomic, readonly) RLMAppConfiguration *configuration;
- @property (nonatomic, readonly) RLMSyncManager *syncManager;
- @property (nonatomic, readonly) NSDictionary<NSString *, RLMUser *> *allUsers;
- @property (nonatomic, readonly, nullable) RLMUser *currentUser;
- @property (nonatomic, readonly) NSString *appId;
- @property (nonatomic, readonly) RLMEmailPasswordAuth *emailPasswordAuth;
- + (instancetype)appWithId:(NSString *)appId;
- + (instancetype)appWithId:(NSString *)appId
- configuration:(nullable RLMAppConfiguration *)configuration;
- - (void)loginWithCredential:(RLMCredentials *)credentials
- completion:(RLMUserCompletionBlock)completion NS_REFINED_FOR_SWIFT;
- - (RLMUser *)switchToUser:(RLMUser *)syncUser;
- - (RLMPushClient *)pushClientWithServiceName:(NSString *)serviceName
- NS_SWIFT_NAME(pushClient(serviceName:));
- - (instancetype)init __attribute__((unavailable("Use +appWithId or appWithId:configuration:.")));
- + (instancetype)new __attribute__((unavailable("Use +appWithId or appWithId:configuration:.")));
- @end
- #pragma mark - Sign In With Apple Extension
- API_AVAILABLE(ios(13.0), macos(10.15), tvos(13.0), watchos(6.0))
- @protocol RLMASLoginDelegate
- - (void)authenticationDidFailWithError:(NSError *)error NS_SWIFT_NAME(authenticationDidComplete(error:));
- - (void)authenticationDidCompleteWithUser:(RLMUser *)user NS_SWIFT_NAME(authenticationDidComplete(user:));
- @end
- API_AVAILABLE(ios(13.0), macos(10.15), tvos(13.0), watchos(6.0))
- @interface RLMApp (ASLogin)
- @property (nonatomic, weak, nullable) id<RLMASLoginDelegate> authorizationDelegate;
- - (void)setASAuthorizationControllerDelegateForController:(ASAuthorizationController *)controller NS_REFINED_FOR_SWIFT;
- @end
- RLM_HEADER_AUDIT_END(nullability, sendability)
|