forked from rajivnarayana/CordovaFragments
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added more handlers and added cordova-android 7 support
- Loading branch information
1 parent
ecb936c
commit d18babf
Showing
6 changed files
with
143 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
|
||
module.exports = { | ||
|
||
getAndroidResPath: function(context) { | ||
|
||
var platforms = context.opts.cordova.platforms; | ||
|
||
if (platforms.indexOf("android") === -1) { | ||
return null; | ||
} | ||
|
||
var androidPath = context.opts.projectRoot + '/platforms/android'; | ||
|
||
if (!fs.existsSync(androidPath)) { | ||
androidPath = context.opts.projectRoot + '/platforms/android/app/src/main'; | ||
|
||
if (!fs.existsSync(androidPath)) { | ||
console.log("Unable to detect type of cordova-android application structure"); | ||
throw new Error("Unable to detect type of cordova-android application structure"); | ||
} else { | ||
console.log("Detected cordova-android 7 application structure"); | ||
} | ||
} else { | ||
console.log("Detected pre cordova-android 7 application structure"); | ||
} | ||
|
||
return androidPath; | ||
}, | ||
|
||
getAndroidManifestPath: function(context) { | ||
return this.getAndroidResPath(context); | ||
}, | ||
|
||
getAndroidSourcePath: function(context) { | ||
var platforms = context.opts.cordova.platforms; | ||
|
||
if (platforms.indexOf("android") === -1) { | ||
return null; | ||
} | ||
|
||
var androidPath = context.opts.projectRoot + '/platforms/android/src'; | ||
|
||
if (!fs.existsSync(androidPath)) { | ||
androidPath = context.opts.projectRoot + '/platforms/android/app/src/main/java'; | ||
|
||
if (!fs.existsSync(androidPath)) { | ||
console.log("Unable to detect type of cordova-android application structure"); | ||
throw new Error("Unable to detect type of cordova-android application structure"); | ||
} else { | ||
console.log("Detected cordova-android 7 application structure"); | ||
} | ||
} else { | ||
console.log("Detected pre cordova-android 7 application structure"); | ||
} | ||
|
||
return androidPath; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters