Skip to content

Commit

Permalink
[permissions] Migrate interface to expo-modules-core (expo#12961)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsapeta authored May 24, 2021
1 parent e0cdbbd commit 8b6228f
Show file tree
Hide file tree
Showing 17 changed files with 45 additions and 56 deletions.
1 change: 0 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ apply from: project(":unimodules-core").file("../unimodules-core.gradle")
dependencies {
unimodule 'unimodules-core'
unimodule 'expo-modules-core'
unimodule 'unimodules-permissions-interface'
unimodule 'unimodules-image-loader-interface'

api "androidx.exifinterface:exifinterface:1.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.unimodules.core.Promise;
import org.unimodules.core.interfaces.ExpoMethod;
import org.unimodules.core.interfaces.services.UIManager;
import org.unimodules.interfaces.permissions.Permissions;

import java.io.File;
import java.util.ArrayList;
Expand All @@ -26,6 +25,7 @@
import java.util.SortedSet;

import expo.modules.camera.tasks.ResolveTakenPictureAsyncTask;
import expo.modules.interfaces.permissions.Permissions;

public class CameraModule extends ExportedModule {
private static final String TAG = "ExponentCameraModule";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.unimodules.core.interfaces.LifecycleEventListener;
import org.unimodules.core.interfaces.services.EventEmitter;
import org.unimodules.core.interfaces.services.UIManager;
import org.unimodules.interfaces.permissions.Permissions;

import java.io.File;
import java.io.IOException;
Expand All @@ -43,6 +42,7 @@
import expo.modules.interfaces.camera.CameraViewInterface;
import expo.modules.interfaces.facedetector.FaceDetectorInterface;
import expo.modules.interfaces.facedetector.FaceDetectorProviderInterface;
import expo.modules.interfaces.permissions.Permissions;

public class ExpoCameraView extends CameraView implements LifecycleEventListener, BarCodeScannerAsyncTaskDelegate, FaceDetectorAsyncTaskDelegate, PictureSavedDelegate, CameraViewInterface {
private static final String MUTE_KEY = "mute";
Expand Down
2 changes: 1 addition & 1 deletion build/Camera.types.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PermissionResponse, PermissionStatus, PermissionExpiration } from 'expo-modules-core';
import { ViewProps } from 'react-native';
import { PermissionResponse, PermissionStatus, PermissionExpiration } from 'unimodules-permissions-interface';
export declare enum CameraType {
/**
* @platforms ios, android, web
Expand Down
2 changes: 1 addition & 1 deletion build/Camera.types.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build/Camera.types.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion ios/EXCamera.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Pod::Spec.new do |s|
s.dependency 'UMCore'
s.dependency 'ExpoModulesCore'
s.dependency 'UMImageLoaderInterface'
s.dependency 'UMPermissionsInterface'

if !$ExpoUseSources&.include?(package['name']) && ENV['EXPO_USE_SOURCE'].to_i == 0 && File.exist?("#{s.name}.xcframework") && Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0')
s.source_files = "#{s.name}/**/*.h"
Expand Down
6 changes: 3 additions & 3 deletions ios/EXCamera/EXCamera.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
#import <ExpoModulesCore/EXFaceDetectorManagerInterface.h>
#import <ExpoModulesCore/EXFaceDetectorManagerProviderInterface.h>
#import <ExpoModulesCore/EXFileSystemInterface.h>
#import <UMPermissionsInterface/UMPermissionsInterface.h>
#import <ExpoModulesCore/EXPermissionsInterface.h>

@interface EXCamera ()

@property (nonatomic, weak) id<EXFileSystemInterface> fileSystem;
@property (nonatomic, weak) UMModuleRegistry *moduleRegistry;
@property (nonatomic, strong) id<EXFaceDetectorManagerInterface> faceDetectorManager;
@property (nonatomic, strong) id<EXBarCodeScannerInterface> barCodeScanner;
@property (nonatomic, weak) id<UMPermissionsInterface> permissionsManager;
@property (nonatomic, weak) id<EXPermissionsInterface> permissionsManager;
@property (nonatomic, weak) id<UMAppLifecycleService> lifecycleManager;

@property (nonatomic, assign, getter=isSessionPaused) BOOL paused;
Expand Down Expand Up @@ -53,7 +53,7 @@ - (id)initWithModuleRegistry:(UMModuleRegistry *)moduleRegistry
_barCodeScanner = [self createBarCodeScanner];
_lifecycleManager = [moduleRegistry getModuleImplementingProtocol:@protocol(UMAppLifecycleService)];
_fileSystem = [moduleRegistry getModuleImplementingProtocol:@protocol(EXFileSystemInterface)];
_permissionsManager = [moduleRegistry getModuleImplementingProtocol:@protocol(UMPermissionsInterface)];
_permissionsManager = [moduleRegistry getModuleImplementingProtocol:@protocol(EXPermissionsInterface)];
#if !(TARGET_IPHONE_SIMULATOR)
_previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:_session];
_previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
Expand Down
Loading

0 comments on commit 8b6228f

Please sign in to comment.