first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
// Copyright 2018-present 650 Industries. All rights reserved.
#import <AVKit/AVKit.h>
@protocol EXCameraInterface
#if !TARGET_OS_TV
@property (nonatomic, strong) dispatch_queue_t sessionQueue;
@property (nonatomic, strong) AVCaptureSession *session;
#endif
@end

View File

@@ -0,0 +1,9 @@
// Copyright 2018-present 650 Industries. All rights reserved.
#import <Foundation/Foundation.h>
@protocol EXConstantsInterface
- (NSDictionary *)constants;
@end

View File

@@ -0,0 +1,19 @@
// Copyright © 2018 650 Industries. All rights reserved.
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
@protocol EXFaceDetectorManagerInterface
#if !TARGET_OS_TV
- (void)setSessionQueue:(dispatch_queue_t)sessionQueue;
- (void)setIsEnabled:(BOOL)enabled;
- (void)setOnFacesDetected:(void (^)(NSArray<NSDictionary *> *))onFacesDetected;
- (void)updateSettings:(NSDictionary *)settings;
- (void)updateMirrored:(BOOL) mirrored;
- (void)maybeStartFaceDetectionOnSession:(AVCaptureSession *)session withPreviewLayer:(AVCaptureVideoPreviewLayer *)previewLayer;
- (void)maybeStartFaceDetectionOnSession:(AVCaptureSession *)session withPreviewLayer:(AVCaptureVideoPreviewLayer *)previewLayer mirrored:(BOOL) mirrored;
- (void)stopFaceDetection;
#endif
@end

View File

@@ -0,0 +1,9 @@
// Copyright © 2018 650 Industries. All rights reserved.
#import <ExpoModulesCore/EXFaceDetectorManagerInterface.h>
@protocol EXFaceDetectorManagerProviderInterface
- (id<EXFaceDetectorManagerInterface>)createFaceDetectorManager;
@end

View File

@@ -0,0 +1,10 @@
// Copyright 2018-present 650 Industries. All rights reserved.
#import <ExpoModulesCore/EXFileSystemInterface.h>
@protocol EXFilePermissionModuleInterface
- (EXFileSystemPermissionFlags)getPathPermissions:(NSString *)path;
@end

View File

@@ -0,0 +1,23 @@
// Copyright 2016-present 650 Industries. All rights reserved.
#import <Foundation/Foundation.h>
typedef NS_OPTIONS(unsigned int, EXFileSystemPermissionFlags) {
EXFileSystemPermissionNone = 0,
EXFileSystemPermissionRead = 1 << 1,
EXFileSystemPermissionWrite = 1 << 2,
};
// TODO: Maybe get rid of this interface in favor of EXFileSystemManager and private utilities classes
@protocol EXFileSystemInterface
@property (nonatomic, readonly) NSString *documentDirectory;
@property (nonatomic, readonly) NSString *cachesDirectory;
@property (nonatomic, readonly) NSString *applicationSupportDirectory;
// TODO: Move permissionsForURI to EXFileSystemManagerInterface
- (EXFileSystemPermissionFlags)permissionsForURI:(NSURL *)uri;
- (nonnull NSString *)generatePathInDirectory:(NSString *)directory withExtension:(NSString *)extension;
- (BOOL)ensureDirExistsWithPath:(NSString *)path;
@end

View File

@@ -0,0 +1,12 @@
// Copyright © 2018 650 Industries. All rights reserved.
#import <ExpoModulesCore/Platform.h>
typedef void (^EXImageLoaderCompletionBlock)(NSError *error, UIImage *image);
@protocol EXImageLoaderInterface <NSObject>
- (void)loadImageForURL:(NSURL *)imageURL
completionHandler:(EXImageLoaderCompletionBlock)completionHandler;
@end

View File

@@ -0,0 +1,39 @@
// Copyright 2018-present 650 Industries. All rights reserved.
#import <Foundation/Foundation.h>
#import <ExpoModulesCore/EXModuleRegistry.h>
typedef enum EXPermissionStatus {
EXPermissionStatusDenied,
EXPermissionStatusGranted,
EXPermissionStatusUndetermined,
} EXPermissionStatus;
@protocol EXPermissionsRequester <NSObject>
+ (NSString *)permissionType;
- (void)requestPermissionsWithResolver:(EXPromiseResolveBlock)resolve rejecter:(EXPromiseRejectBlock)reject;
- (NSDictionary *)getPermissions;
@end
@protocol EXPermissionsInterface
- (void)registerRequesters:(NSArray<id<EXPermissionsRequester>> *)newRequesters;
- (void)getPermissionUsingRequesterClass:(Class)requesterClass
resolve:(EXPromiseResolveBlock)resolve
reject:(EXPromiseRejectBlock)reject;
- (BOOL)hasGrantedPermissionUsingRequesterClass:(Class)requesterClass;
- (void)askForPermissionUsingRequesterClass:(Class)requesterClass
resolve:(EXPromiseResolveBlock)resolve
reject:(EXPromiseRejectBlock)reject;
- (id<EXPermissionsRequester>)getPermissionRequesterForType:(NSString *)type;
@end

View File

@@ -0,0 +1,21 @@
// Copyright 2018-present 650 Industries. All rights reserved.
#import <Foundation/Foundation.h>
#import <ExpoModulesCore/EXPermissionsInterface.h>
@interface EXPermissionsMethodsDelegate : NSObject
+ (void)getPermissionWithPermissionsManager:(id<EXPermissionsInterface>)permissionsManager
withRequester:(Class)requesterClass
resolve:(EXPromiseResolveBlock)resolve
reject:(EXPromiseRejectBlock)reject;
+ (void)askForPermissionWithPermissionsManager:(id<EXPermissionsInterface>)permissionsManager
withRequester:(Class)requesterClass
resolve:(EXPromiseResolveBlock)resolve
reject:(EXPromiseRejectBlock)reject;
+ (void)registerRequesters:(NSArray<id<EXPermissionsRequester>> *)newRequesters
withPermissionsManager:(id<EXPermissionsInterface>)permissionsManager;
@end

View File

@@ -0,0 +1,41 @@
// Copyright 2018-present 650 Industries. All rights reserved.
#import <ExpoModulesCore/EXPermissionsMethodsDelegate.h>
@implementation EXPermissionsMethodsDelegate
+ (void)askForPermissionWithPermissionsManager:(id<EXPermissionsInterface>)permissionsManager
withRequester:(Class)requesterClass
resolve:(EXPromiseResolveBlock)resolve
reject:(EXPromiseRejectBlock)reject
{
if (!permissionsManager) {
return reject(@"E_NO_PERMISSIONS", @"Permissions module not found. Are you sure that Expo modules are properly linked?", nil);
}
[permissionsManager askForPermissionUsingRequesterClass:requesterClass
resolve:resolve
reject:reject];
}
+ (void)getPermissionWithPermissionsManager:(id<EXPermissionsInterface>)permissionsManager
withRequester:(Class)requesterClass
resolve:(EXPromiseResolveBlock)resolve
reject:(EXPromiseRejectBlock)reject
{
if (!permissionsManager) {
return reject(@"E_NO_PERMISSIONS", @"Permissions module not found. Are you sure that Expo modules are properly linked?", nil);
}
[permissionsManager getPermissionUsingRequesterClass:requesterClass
resolve:resolve
reject:reject];
}
+ (void)registerRequesters:(NSArray<id<EXPermissionsRequester>> *)newRequesters
withPermissionsManager:(id<EXPermissionsInterface>)permissionsManager
{
if (permissionsManager) {
[permissionsManager registerRequesters:newRequesters];
}
}
@end

View File

@@ -0,0 +1,11 @@
// Copyright 2018-present 650 Industries. All rights reserved.
#import <Foundation/Foundation.h>
#import <UserNotifications/UserNotifications.h>
@protocol EXUserNotificationCenterProxyInterface <NSObject>
- (void)getNotificationSettingsWithCompletionHandler:(nonnull void(^)(UNNotificationSettings *__nonnull settings))completionHandler;
- (void)requestAuthorizationWithOptions:(UNAuthorizationOptions)options completionHandler:(nonnull void (^)(BOOL granted, NSError *__nullable error))completionHandler;
@end

View File

@@ -0,0 +1,10 @@
// Copyright 2018-present 650 Industries. All rights reserved.
@protocol EXAccelerometerInterface
- (void)sensorModuleDidSubscribeForAccelerometerUpdates:(id)scopedSensorModule withHandler:(void (^)(NSDictionary *event))handlerBlock;
- (void)sensorModuleDidUnsubscribeForAccelerometerUpdates:(id)scopedSensorModule;
- (void)setAccelerometerUpdateInterval:(NSTimeInterval)intervalMs;
- (BOOL)isAccelerometerAvailable;
@end

View File

@@ -0,0 +1,10 @@
// Copyright 2018-present 650 Industries. All rights reserved.
@protocol EXBarometerInterface
- (void)sensorModuleDidSubscribeForBarometerUpdates:(id)scopedSensorModule withHandler:(void (^)(NSDictionary *event))handlerBlock;
- (void)sensorModuleDidUnsubscribeForBarometerUpdates:(id)scopedSensorModule;
- (void)setBarometerUpdateInterval:(NSTimeInterval)intervalMs;
- (BOOL)isBarometerAvailable;
@end

View File

@@ -0,0 +1,11 @@
// Copyright 2018-present 650 Industries. All rights reserved.
@protocol EXDeviceMotionInterface
- (float)getGravity;
- (void)sensorModuleDidSubscribeForDeviceMotionUpdates:(id)scopedSensorModule withHandler:(void (^)(NSDictionary *event))handlerBlock;
- (void)sensorModuleDidUnsubscribeForDeviceMotionUpdates:(id)scopedSensorModule;
- (void)setDeviceMotionUpdateInterval:(NSTimeInterval)intervalMs;
- (BOOL)isDeviceMotionAvailable;
@end

View File

@@ -0,0 +1,10 @@
// Copyright 2018-present 650 Industries. All rights reserved.
@protocol EXGyroscopeInterface
- (void)sensorModuleDidSubscribeForGyroscopeUpdates:(id)scopedSensorModule withHandler:(void (^)(NSDictionary *event))handlerBlock;
- (void)sensorModuleDidUnsubscribeForGyroscopeUpdates:(id)scopedSensorModule;
- (void)setGyroscopeUpdateInterval:(NSTimeInterval)intervalMs;
- (BOOL)isGyroAvailable;
@end

View File

@@ -0,0 +1,10 @@
// Copyright 2018-present 650 Industries. All rights reserved.
@protocol EXMagnetometerInterface
- (void)sensorModuleDidSubscribeForMagnetometerUpdates:(id)scopedSensorModule withHandler:(void (^)(NSDictionary *event))handlerBlock;
- (void)sensorModuleDidUnsubscribeForMagnetometerUpdates:(id)scopedSensorModule;
- (void)setMagnetometerUpdateInterval:(NSTimeInterval)intervalMs;
- (BOOL)isMagnetometerAvailable;
@end

View File

@@ -0,0 +1,11 @@
// Copyright 2018-present 650 Industries. All rights reserved.
@protocol EXMagnetometerUncalibratedInterface
- (void)sensorModuleDidSubscribeForMagnetometerUncalibratedUpdates:(id)scopedSensorModule
withHandler:(void (^)(NSDictionary *event))handlerBlock;
- (void)sensorModuleDidUnsubscribeForMagnetometerUncalibratedUpdates:(id)scopedSensorModule;
- (void)setMagnetometerUncalibratedUpdateInterval:(NSTimeInterval)intervalMs;
- (BOOL)isMagnetometerUncalibratedAvailable;
@end

View File

@@ -0,0 +1,63 @@
// Copyright 2015-present 650 Industries. All rights reserved.
#import <ExpoModulesCore/EXTaskInterface.h>
#import <ExpoModulesCore/EXTaskLaunchReason.h>
// Interface for task consumers. Task consumers are the objects that are responsible for handling tasks.
// Consumers are getting signals from TaskManager (and service) about a few events that are happening during task's lifecycle.
@protocol EXTaskConsumerInterface <NSObject>
@property (nonatomic, strong) id<EXTaskInterface> __nullable task;
@required
/**
* The type of the task, like "location" or "geofencing".
*/
- (nonnull NSString *)taskType;
/**
* Called by EXTaskService when the task is created and associated with the consumer.
*/
- (void)didRegisterTask:(nonnull id<EXTaskInterface>)task;
@optional
/**
* Static method returning boolean value whether the consumer supports launch reason.
*/
+ (BOOL)supportsLaunchReason:(EXTaskLaunchReason)launchReason;
/**
* Version of the consumer. Increase returned number in case of any breaking changes made to the task consumer,
* so the existing tasks will be automatically unregistered when the native code gets upgraded.
*/
+ (NSUInteger)taskConsumerVersion;
/**
* Sets options for the task.
*/
- (void)setOptions:(nonnull NSDictionary *)options;
/**
* Called by EXTaskService to inform the consumer that the associated task is ready to be executed with accompanying data.
*/
- (void)didBecomeReadyToExecuteWithData:(nullable NSDictionary *)data;
/**
* Called right after the task has been unregistered.
*/
- (void)didUnregister;
/**
* Called by EXTaskManager when the task has been completed and we received a result from JS app.
*/
- (void)didFinish;
/**
* Method used to normalize task result that comes from JS app.
*/
- (NSUInteger)normalizeTaskResult:(nullable id)result;
@end

View File

@@ -0,0 +1,40 @@
// Copyright 2015-present 650 Industries. All rights reserved.
#import <Foundation/Foundation.h>
// forward declaration for consumer interface
@protocol EXTaskConsumerInterface;
@protocol EXTaskInterface
/**
* Name of the task.
*/
@property (nonatomic, strong, readonly) NSString *__nonnull name;
/**
* Identifier of the application for which the task was created.
*/
@property (nonatomic, strong, readonly) NSString *__nonnull appId;
/**
* The URL to the application for which the task was created.
*/
@property (nonatomic, strong, readonly) NSString *__nonnull appUrl;
/**
* Task consumer instance that is responsible for handling (consuming) this task.
*/
@property (nonatomic, strong, readonly) id<EXTaskConsumerInterface> __nonnull consumer;
/**
* Options passed to the task.
*/
@property (nonatomic, strong) NSDictionary *__nullable options;
/**
* Executes the task with given dictionary data and given error.
*/
- (void)executeWithData:(nullable NSDictionary *)data withError:(nullable NSError *)error;
@end

View File

@@ -0,0 +1,13 @@
// Copyright 2018-present 650 Industries. All rights reserved.
typedef enum {
EXTaskLaunchReasonUnrecognized,
EXTaskLaunchReasonUser,
EXTaskLaunchReasonBluetoothCentrals,
EXTaskLaunchReasonBluetoothPeripherals,
EXTaskLaunchReasonBackgroundFetch,
EXTaskLaunchReasonLocation,
EXTaskLaunchReasonNewsstandDownloads,
EXTaskLaunchReasonRemoteNotification,
EXTaskLaunchReasonBackgroundTask,
} EXTaskLaunchReason;

View File

@@ -0,0 +1,56 @@
// Copyright 2018-present 650 Industries. All rights reserved.
#import <Foundation/Foundation.h>
#import <ExpoModulesCore/EXTaskInterface.h>
NS_ASSUME_NONNULL_BEGIN
// Interface for EXTaskManager module.
@protocol EXTaskManagerInterface
/**
* Returns boolean value whether task with given taskName has been registered by the app.
*/
- (BOOL)hasRegisteredTaskWithName:(NSString *)taskName;
/**
* Returns boolean value whether or not the task's consumer is a member of given class.
*/
- (BOOL)taskWithName:(NSString *)taskName hasConsumerOfClass:(Class)consumerClass;
/**
* Registers task with given name, task consumer class and options.
* Can throw an exception if task with given name is already registered
* or given consumer class doesn't conform to EXTaskConsumerInterface protocol.
*/
- (void)registerTaskWithName:(NSString *)taskName
consumer:(Class)consumerClass
options:(NSDictionary *)options;
/**
* Unregisters task with given name and consumer class.
* Can throw an exception if the consumer class mismatches.
*/
- (void)unregisterTaskWithName:(NSString *)taskName
consumerClass:(nullable Class)consumerClass;
/**
* Returns boolean value whether the application contains
* given backgroundMode in UIBackgroundModes field in Info.plist file.
*/
- (BOOL)hasBackgroundModeEnabled:(NSString *)backgroundMode;
/**
* Called by task manager service to send an event with given body.
*/
- (void)executeWithBody:(NSDictionary<NSString *, id> *)body;
/**
* Whether or not the module was initialized for headless (background) JS app.
*/
- (BOOL)isRunningInHeadlessMode;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,78 @@
// Copyright 2015-present 650 Industries. All rights reserved.
#import <ExpoModulesCore/EXTaskLaunchReason.h>
#import <ExpoModulesCore/EXTaskInterface.h>
#import <ExpoModulesCore/EXTaskManagerInterface.h>
@protocol EXTaskServiceInterface
/**
* Returns boolean value whether the task with given name is already registered for given appId.
*/
- (BOOL)hasRegisteredTaskWithName:(nonnull NSString *)taskName
forAppId:(nonnull NSString *)appId;
/**
* Registers task in any kind of persistent storage, so it could be restored in future sessions.
*/
- (void)registerTaskWithName:(nonnull NSString *)taskName
appId:(nonnull NSString *)appId
appUrl:(nullable NSString *)appUrl
consumerClass:(nonnull Class)consumerClass
options:(nullable NSDictionary *)options;
/**
* Unregisters task with given name and for given appId. If consumer class is provided,
* it can throw an exception if task's consumer is not a member of that class.
*/
- (void)unregisterTaskWithName:(nonnull NSString *)taskName
forAppId:(nonnull NSString *)appId
consumerClass:(nullable Class)consumerClass;
/**
* Unregisters all tasks registered for the app with given appId.
*/
- (void)unregisterAllTasksForAppId:(nonnull NSString *)appId;
/**
* Returns boolean value whether or not the task's consumer is a member of given class.
*/
- (BOOL)taskWithName:(nonnull NSString *)taskName
forAppId:(nonnull NSString *)appId
hasConsumerOfClass:(nonnull Class)consumerClass;
/**
* Returns options associated with the task with given name and appId or nil if task not found.
*/
- (nullable NSDictionary *)getOptionsForTaskName:(nonnull NSString *)taskName
forAppId:(nonnull NSString *)appId;
/**
* Returns an array of registered tasks for given appId.
*/
- (nonnull NSArray *)getRegisteredTasksForAppId:(nullable NSString *)appId;
/**
* Notifies the service that a task has just finished.
*/
- (void)notifyTaskWithName:(nonnull NSString *)taskName
forAppId:(nonnull NSString *)appId
didFinishWithResponse:(nonnull NSDictionary *)response;
/**
* Passes a reference of task manager for given appId to the service.
*/
- (void)setTaskManager:(nonnull id<EXTaskManagerInterface>)taskManager
forAppId:(nonnull NSString *)appId
withUrl:(nullable NSString *)appUrl;
#if !TARGET_OS_OSX
/**
* Executes tasks that supports the provided launch reason.
*/
- (void)runTasksWithReason:(EXTaskLaunchReason)launchReason
userInfo:(nullable NSDictionary *)userInfo
completionHandler:(nullable void (^)(UIBackgroundFetchResult))completionHandler;
#endif
@end