forked from Wizcorp/phonegap-facebook-plugin
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure the dev uses minsdk 15 as Facebook SDK requires that
- Loading branch information
1 parent
81dbe94
commit 5b4f6fd
Showing
2 changed files
with
40 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
def getConfigPreference(name) { | ||
name = name.toLowerCase() | ||
def xml = file("res/xml/config.xml").getText() | ||
// Disable namespace awareness since Cordova doesn't use them properly | ||
def root = new XmlParser(false, false).parseText(xml) | ||
|
||
def ret, defaultValue | ||
root.preference.each { it -> | ||
def attrName = it.attribute("name") | ||
if (attrName && attrName.toLowerCase() == name) { | ||
if (it.attribute('default') != null) { | ||
defaultValue = it.attribute('default'); | ||
} else { | ||
ret = it.attribute("value") | ||
} | ||
} | ||
} | ||
return ret ? ret : defaultValue | ||
} | ||
|
||
if (cdvMinSdkVersion == null) { | ||
// first check config.xml | ||
def minSdk = getConfigPreference("android-minSdkVersion"); | ||
|
||
// if there's no minSdk defined check AndroidManifest.xml | ||
if (!minSdk) { | ||
def manifest = new XmlSlurper().parse(file("AndroidManifest.xml")) | ||
manifest.children().find { it.name() == "uses-sdk" }.each { | ||
minSdk = it.attributes().get("android:minSdkVersion") | ||
} | ||
} | ||
|
||
// update the minSdk from config.xml or AndroidManifest, with a fallback to 15 | ||
ext.cdvMinSdkVersion = minSdk && minSdk.toInteger() > 15 ? minSdk : 15; | ||
} |