File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 1
1
var fs = require ( 'fs' ) ;
2
2
var path = require ( 'path' ) ;
3
+ const editManist = require ( './edit_manifest' ) ;
3
4
4
5
const ibgBuildGradleExists = ( ) => {
5
6
var target = path . join ( 'plugins' , 'instabug-cordova' , 'build.gradle' ) ;
@@ -53,5 +54,6 @@ module.exports = function(ctx) {
53
54
) ;
54
55
writeIbgBuildGradle ( buildGradle ) ;
55
56
}
57
+ return editManist ( ctx ) ;
56
58
}
57
59
} ;
Original file line number Diff line number Diff line change
1
+ module . exports = function ( ctx ) {
2
+ console . log ( 'INNN' ) ;
3
+ const fs = ctx . requireCordovaModule ( 'fs' ) ;
4
+ const path = ctx . requireCordovaModule ( 'path' ) ;
5
+ const Q = ctx . requireCordovaModule ( 'q' ) ;
6
+ const xml = ctx . requireCordovaModule ( 'cordova-common' ) . xmlHelpers ;
7
+
8
+ const deferred = Q . defer ( ) ;
9
+ const platformPath = path . join ( ctx . opts . projectRoot , './platforms/android' ) ;
10
+ const manifestPaths = [
11
+ path . join ( platformPath , './AndroidManifest.xml' ) ,
12
+ path . join ( platformPath , './app/src/main/AndroidManifest.xml' ) ,
13
+ ] ;
14
+
15
+ const manifestPath = manifestPaths . find ( ( filepath ) => {
16
+ try {
17
+ fs . accessSync ( filepath , fs . constants . F_OK )
18
+ return true
19
+ } catch ( err ) {
20
+ return false
21
+ }
22
+ } ) ;
23
+
24
+ var doc ;
25
+
26
+ if ( manifestPath != null ) {
27
+ doc = xml . parseElementtreeSync ( manifestPath )
28
+ doc . getroot ( ) . find ( './application' ) . attrib [ 'android:name' ] =
29
+ 'com.instabug.cordova.plugin.MyApplication'
30
+ fs . writeFileSync ( manifestPath , doc . write ( { indent : 4 } ) )
31
+ deferred . resolve ( )
32
+ } else {
33
+ deferred . reject ( new Error ( "Can't find AndroidManifest.xml" ) )
34
+ }
35
+
36
+ return deferred . promise
37
+ }
You can’t perform that action at this time.
0 commit comments