Skip to content

Commit 5627a4f

Browse files
committed
use WarningAggregator instead of console.warn
1 parent 379d3bf commit 5627a4f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

packages/auth/plugin/__tests__/iosPlugin_openUrlFix.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import fs from 'fs/promises';
22
import path from 'path';
33
import { beforeEach, describe, expect, it, jest } from '@jest/globals';
4+
import { WarningAggregator } from '@expo/config-plugins';
45
import type { AppDelegateProjectFile } from '@expo/config-plugins/build/ios/Paths';
56
import {
67
shouldApplyIosOpenUrlFix,
@@ -218,10 +219,11 @@ describe('Config Plugin iOS Tests - openUrlFix', () => {
218219
modRawConfig: { name: 'TestName', slug: 'TestSlug' },
219220
};
220221
const props = undefined;
221-
const spy = jest.spyOn(console, 'warn').mockImplementation(() => undefined);
222+
const spy = jest.spyOn(WarningAggregator, 'addWarningIOS');
222223
const result = withOpenUrlFixForAppDelegate({ config, props });
223224
expect(result.modResults.contents).toBe(appDelegate);
224225
expect(spy).toHaveBeenCalledWith(
226+
'@react-native-firebase/auth',
225227
"Skipping iOS openURL fix because no 'openURL' method was found",
226228
);
227229
});

packages/auth/plugin/src/ios/openUrlFix.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
withAppDelegate,
44
withInfoPlist,
55
ExportedConfigWithProps,
6+
WarningAggregator,
67
} from '@expo/config-plugins';
78
import type { ExpoConfig } from '@expo/config/build/Config.types';
89
import type { AppDelegateProjectFile } from '@expo/config-plugins/build/ios/Paths';
@@ -66,8 +67,10 @@ export function withOpenUrlFixForAppDelegate({
6667
if (props?.ios?.captchaOpenUrlFix === true) {
6768
throw new Error("Failed to apply iOS openURL fix because no 'openURL' method was found");
6869
} else {
69-
// eslint-disable-next-line no-console
70-
console.warn("Skipping iOS openURL fix because no 'openURL' method was found");
70+
WarningAggregator.addWarningIOS(
71+
'@react-native-firebase/auth',
72+
"Skipping iOS openURL fix because no 'openURL' method was found",
73+
);
7174
return config;
7275
}
7376
} else {

0 commit comments

Comments
 (0)