Skip to content

Commit

Permalink
fix(expo): fixed config plugin crashing build with no options passed
Browse files Browse the repository at this point in the history
  • Loading branch information
mfkrause committed Oct 2, 2024
1 parent 023e93d commit fe34eaf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
22 changes: 12 additions & 10 deletions src/expo-plugin/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
export interface RNCloudStorageConfigPluginOptions {
/**
* The iCloud container environment to use. Defaults to 'Production'.
*/
iCloudContainerEnvironment?: 'Production' | 'Development';
/**
* The iCloud container identifier to use. Defaults to `iCloud.{appBundleIdentifier}`
*/
iCloudContainerIdentifier?: string;
}
export type RNCloudStorageConfigPluginOptions =
| {
/**
* The iCloud container environment to use. Defaults to 'Production'.
*/
iCloudContainerEnvironment?: 'Production' | 'Development';
/**
* The iCloud container identifier to use. Defaults to `iCloud.{appBundleIdentifier}`
*/
iCloudContainerIdentifier?: string;
}
| undefined;
2 changes: 1 addition & 1 deletion src/expo-plugin/withRNCloudStorageIos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { type ExpoConfig } from '@expo/config-types';
import type { RNCloudStorageConfigPluginOptions } from './types';

const getICloudContainerIdentifier = (config: ExpoConfig, options: RNCloudStorageConfigPluginOptions) => {
if (options.iCloudContainerIdentifier) return options.iCloudContainerIdentifier;
if (options?.iCloudContainerIdentifier) return options.iCloudContainerIdentifier;

if (!config?.ios?.bundleIdentifier) throw new Error('Missing iOS bundle identifier');
return `iCloud.${config.ios.bundleIdentifier}`;
Expand Down

0 comments on commit fe34eaf

Please sign in to comment.