File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-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 classDeclarationRegex = / c l a s s \s + \w + .* \{ /
14+ nextContent = nextContent . replace (
15+ classDeclarationRegex ,
16+ match => `${ match }
17+ override fun onNewIntent(intent: Intent?) {
18+ super.onNewIntent(intent)
19+ setIntent(intent)
20+ }
21+ ` )
22+ }
23+ return nextContent
24+ }
25+
26+ module . exports = function withAppsFlyerAndroid ( config ) {
27+ return withMainActivity ( config , function ( config ) {
28+ const { modResults :{ contents} , android} = config
29+ config . modResults . contents = overrideOnNewIntent ( contents , android ?. package )
30+ return config
31+ } )
32+ }
You can’t perform that action at this time.
0 commit comments