|
9 | 9 | * Native modules are registered via react-native.config.js and standard |
10 | 10 | * React Native autolinking (RCTViewManager / ReactPackage). |
11 | 11 | */ |
12 | | -const { withXcodeProject, withDangerousMod, withInfoPlist, withAppBuildGradle } = require('@expo/config-plugins'); |
| 12 | +const { |
| 13 | + withXcodeProject, |
| 14 | + withDangerousMod, |
| 15 | + withInfoPlist, |
| 16 | + withAppBuildGradle, |
| 17 | + withEntitlementsPlist, |
| 18 | +} = require('@expo/config-plugins'); |
13 | 19 | const path = require('path'); |
14 | 20 | const fs = require('fs'); |
15 | 21 |
|
@@ -507,6 +513,26 @@ const withClerkAndroid = config => { |
507 | 513 | console.log('✅ Clerk Android packaging exclusions added'); |
508 | 514 | } |
509 | 515 |
|
| 516 | + // --- Kotlin metadata version check skip --- |
| 517 | + if (!buildGradle.includes('-Xskip-metadata-version-check')) { |
| 518 | + const kotlinOptionsMatch = buildGradle.match(/kotlinOptions\s*\{/); |
| 519 | + if (kotlinOptionsMatch) { |
| 520 | + buildGradle = buildGradle.replace( |
| 521 | + /kotlinOptions\s*\{/, |
| 522 | + `kotlinOptions {\n // Clerk: allow reading metadata from newer Kotlin versions\n freeCompilerArgs += ['-Xskip-metadata-version-check']`, |
| 523 | + ); |
| 524 | + } else { |
| 525 | + const androidMatch = buildGradle.match(/android\s*\{/); |
| 526 | + if (androidMatch) { |
| 527 | + buildGradle = buildGradle.replace( |
| 528 | + /android\s*\{/, |
| 529 | + `android {\n kotlinOptions {\n // Clerk: allow reading metadata from newer Kotlin versions\n freeCompilerArgs += ['-Xskip-metadata-version-check']\n }`, |
| 530 | + ); |
| 531 | + } |
| 532 | + } |
| 533 | + console.log('✅ Clerk Android Kotlin metadata version check skip added'); |
| 534 | + } |
| 535 | + |
510 | 536 | modConfig.modResults.contents = buildGradle; |
511 | 537 | return modConfig; |
512 | 538 | }); |
@@ -572,8 +598,23 @@ const withClerkKeychainService = (config, { keychainService } = {}) => { |
572 | 598 | }); |
573 | 599 | }; |
574 | 600 |
|
| 601 | +/** |
| 602 | + * Add Sign in with Apple entitlement to the iOS app. |
| 603 | + * Required for the native Apple Sign In flow via ASAuthorizationController. |
| 604 | + */ |
| 605 | +const withClerkAppleSignIn = config => { |
| 606 | + return withEntitlementsPlist(config, modConfig => { |
| 607 | + if (!modConfig.modResults['com.apple.developer.applesignin']) { |
| 608 | + modConfig.modResults['com.apple.developer.applesignin'] = ['Default']; |
| 609 | + console.log('✅ Added Sign in with Apple entitlement'); |
| 610 | + } |
| 611 | + return modConfig; |
| 612 | + }); |
| 613 | +}; |
| 614 | + |
575 | 615 | const withClerkExpo = (config, props = {}) => { |
576 | 616 | config = withClerkIOS(config); |
| 617 | + config = withClerkAppleSignIn(config); |
577 | 618 | config = withClerkGoogleSignIn(config); |
578 | 619 | config = withClerkAndroid(config); |
579 | 620 | config = withClerkKeychainService(config, props); |
|
0 commit comments