File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,18 +106,21 @@ const withAndroidAuth0Manifest: ConfigPlugin<Auth0PluginConfig[]> = (
106106 } ) ;
107107} ;
108108
109- export const addAuth0AppDelegateCode = ( src : string ) : string => {
109+ export const addAuth0AppDelegateCode = (
110+ src : string ,
111+ language : string
112+ ) : string => {
110113 let tempSrc = src ;
111114
112115 // Check if this is a Swift app delegate file by looking for Swift syntax patterns
113116 // rather than relying on import statements that may change
114- const isSwift =
115- src . includes ( 'class AppDelegate: ExpoAppDelegate' ) ||
116- ( src . includes ( '@UIApplicationMain' ) && src . includes ( 'class AppDelegate' ) ) ;
117+ const isSwift = language === 'swift' ;
117118
118119 if ( ! isSwift ) {
119- // For non-Swift files, return unchanged since we're only supporting Swift app delegates
120- return tempSrc ;
120+ // Throw error for non-Swift files, since we're only supporting Swift app delegates (RN 78+)
121+ throw new Error (
122+ 'This plugin only supports expo 53 or greater. If you are using older version 4.x'
123+ ) ;
121124 }
122125
123126 // Swift handling for Expo 53+
@@ -146,7 +149,8 @@ export const addAuth0AppDelegateCode = (src: string): string => {
146149const withIOSAuth0AppDelegate : ConfigPlugin < Auth0PluginConfig [ ] > = ( config ) => {
147150 return withAppDelegate ( config , ( config ) => {
148151 const src = config . modResults . contents ;
149- config . modResults . contents = addAuth0AppDelegateCode ( src ) ;
152+ const language = config . modResults . language ;
153+ config . modResults . contents = addAuth0AppDelegateCode ( src , language ) ;
150154 return config ;
151155 } ) ;
152156} ;
You can’t perform that action at this time.
0 commit comments