chore: Remove semicolons (#1846)
* chore: Disable `semi` in Prettier * chore: Format w/o semi * Remove more `;` * Lint example * More ;
This commit is contained in:
@@ -1,23 +1,23 @@
|
||||
import { ConfigPlugin, withGradleProperties } from '@expo/config-plugins';
|
||||
import { ConfigPlugin, withGradleProperties } from '@expo/config-plugins'
|
||||
|
||||
/**
|
||||
* Set the `VisionCamera_disableFrameProcessors` value in the static `gradle.properties` file.
|
||||
* This is used to disable frame processors if you don't need it for android.
|
||||
*/
|
||||
export const withDisableFrameProcessorsAndroid: ConfigPlugin = (c) => {
|
||||
const disableFrameProcessorsKey = 'VisionCamera_disableFrameProcessors';
|
||||
const disableFrameProcessorsKey = 'VisionCamera_disableFrameProcessors'
|
||||
return withGradleProperties(c, (config) => {
|
||||
config.modResults = config.modResults.filter((item) => {
|
||||
if (item.type === 'property' && item.key === disableFrameProcessorsKey) return false;
|
||||
return true;
|
||||
});
|
||||
if (item.type === 'property' && item.key === disableFrameProcessorsKey) return false
|
||||
return true
|
||||
})
|
||||
|
||||
config.modResults.push({
|
||||
type: 'property',
|
||||
key: disableFrameProcessorsKey,
|
||||
value: 'true',
|
||||
});
|
||||
})
|
||||
|
||||
return config;
|
||||
});
|
||||
};
|
||||
return config
|
||||
})
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { ConfigPlugin, withPodfileProperties } from '@expo/config-plugins';
|
||||
import { ConfigPlugin, withPodfileProperties } from '@expo/config-plugins'
|
||||
|
||||
/**
|
||||
* Set the `disableFrameProcessors` inside of the XcodeProject.
|
||||
@@ -7,7 +7,7 @@ import { ConfigPlugin, withPodfileProperties } from '@expo/config-plugins';
|
||||
export const withDisableFrameProcessorsIOS: ConfigPlugin = (c) => {
|
||||
return withPodfileProperties(c, (config) => {
|
||||
// TODO: Implement Podfile writing
|
||||
config.ios = config.ios;
|
||||
return config;
|
||||
});
|
||||
};
|
||||
config.ios = config.ios
|
||||
return config
|
||||
})
|
||||
}
|
||||
|
@@ -1,37 +1,37 @@
|
||||
import { withPlugins, AndroidConfig, ConfigPlugin, createRunOncePlugin } from '@expo/config-plugins';
|
||||
import { withDisableFrameProcessorsAndroid } from './withDisableFrameProcessorsAndroid';
|
||||
import { withDisableFrameProcessorsIOS } from './withDisableFrameProcessorsIOS';
|
||||
import { withPlugins, AndroidConfig, ConfigPlugin, createRunOncePlugin } from '@expo/config-plugins'
|
||||
import { withDisableFrameProcessorsAndroid } from './withDisableFrameProcessorsAndroid'
|
||||
import { withDisableFrameProcessorsIOS } from './withDisableFrameProcessorsIOS'
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-assignment
|
||||
const pkg = require('../../../package.json');
|
||||
const pkg = require('../../../package.json')
|
||||
|
||||
const CAMERA_USAGE = 'Allow $(PRODUCT_NAME) to access your camera';
|
||||
const MICROPHONE_USAGE = 'Allow $(PRODUCT_NAME) to access your microphone';
|
||||
const CAMERA_USAGE = 'Allow $(PRODUCT_NAME) to access your camera'
|
||||
const MICROPHONE_USAGE = 'Allow $(PRODUCT_NAME) to access your microphone'
|
||||
|
||||
type Props = {
|
||||
cameraPermissionText?: string;
|
||||
enableMicrophonePermission?: boolean;
|
||||
microphonePermissionText?: string;
|
||||
disableFrameProcessors?: boolean;
|
||||
};
|
||||
cameraPermissionText?: string
|
||||
enableMicrophonePermission?: boolean
|
||||
microphonePermissionText?: string
|
||||
disableFrameProcessors?: boolean
|
||||
}
|
||||
|
||||
const withCamera: ConfigPlugin<Props> = (config, props = {}) => {
|
||||
if (config.ios == null) config.ios = {};
|
||||
if (config.ios.infoPlist == null) config.ios.infoPlist = {};
|
||||
if (config.ios == null) config.ios = {}
|
||||
if (config.ios.infoPlist == null) config.ios.infoPlist = {}
|
||||
config.ios.infoPlist.NSCameraUsageDescription =
|
||||
props.cameraPermissionText ?? (config.ios.infoPlist.NSCameraUsageDescription as string | undefined) ?? CAMERA_USAGE;
|
||||
props.cameraPermissionText ?? (config.ios.infoPlist.NSCameraUsageDescription as string | undefined) ?? CAMERA_USAGE
|
||||
if (props.enableMicrophonePermission) {
|
||||
config.ios.infoPlist.NSMicrophoneUsageDescription =
|
||||
props.microphonePermissionText ?? (config.ios.infoPlist.NSMicrophoneUsageDescription as string | undefined) ?? MICROPHONE_USAGE;
|
||||
props.microphonePermissionText ?? (config.ios.infoPlist.NSMicrophoneUsageDescription as string | undefined) ?? MICROPHONE_USAGE
|
||||
}
|
||||
const androidPermissions = ['android.permission.CAMERA'];
|
||||
if (props.enableMicrophonePermission) androidPermissions.push('android.permission.RECORD_AUDIO');
|
||||
const androidPermissions = ['android.permission.CAMERA']
|
||||
if (props.enableMicrophonePermission) androidPermissions.push('android.permission.RECORD_AUDIO')
|
||||
|
||||
if (props.disableFrameProcessors) {
|
||||
config = withDisableFrameProcessorsAndroid(config);
|
||||
config = withDisableFrameProcessorsIOS(config);
|
||||
config = withDisableFrameProcessorsAndroid(config)
|
||||
config = withDisableFrameProcessorsIOS(config)
|
||||
}
|
||||
|
||||
return withPlugins(config, [[AndroidConfig.Permissions.withPermissions, androidPermissions]]);
|
||||
};
|
||||
return withPlugins(config, [[AndroidConfig.Permissions.withPermissions, androidPermissions]])
|
||||
}
|
||||
|
||||
export default createRunOncePlugin(withCamera, pkg.name, pkg.version);
|
||||
export default createRunOncePlugin(withCamera, pkg.name, pkg.version)
|
||||
|
Reference in New Issue
Block a user