File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 11const withAppsFlyerIos = require ( './withAppsFlyerIos' ) ;
2+ const withAppsFlyerAndroid = require ( './withAppsFlyerAndroid' ) ;
3+
24module . exports = function withAppsFlyer ( config , { shouldUseStrictMode = false } ) {
35 config = withAppsFlyerIos ( config , shouldUseStrictMode ) ;
6+ config = withAppsFlyerAndroid ( config )
47 return config ;
58} ;
Original file line number Diff line number Diff line change 1+ const { withMainActivity} = require ( '@expo/config-plugins' )
2+
3+ function overrideOnNewIntent ( contents , packageName = '' ) {
4+ let nextContent = contents
5+ const intentImportString = 'import android.content.intent'
6+
7+ if ( ! nextContent . includes ( intentImportString ) ) {
8+ const packageString = `${ packageName } \n`
9+ nextContent = nextContent . replace ( packageString , `${ packageString } \n${ intentImportString } ` )
10+ }
11+
12+ if ( ! nextContent . includes ( 'override fun onNewIntent(intent: Intent?)' ) ) {
13+ const mainActivityClassString = 'class MainActivity : ReactActivity() {'
14+ nextContent = nextContent . replace (
15+ mainActivityClassString ,
16+ `${ mainActivityClassString }
17+
18+ override fun onNewIntent(intent: Intent?) {
19+ super.onNewIntent(intent)
20+ setIntent(intent)
21+ }
22+ ` )
23+ }
24+ return nextContent
25+ }
26+
27+ module . exports = function withAppsFlyerAndroid ( config ) {
28+ return withMainActivity ( config , function ( config ) {
29+ const { modResults :{ contents} , android} = config
30+ config . modResults . contents = overrideOnNewIntent ( contents , android ?. package )
31+ return config
32+ } )
33+ }
You can’t perform that action at this time.
0 commit comments