mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-18 22:52:54 +08:00
refactor: Removed obsolete version code checks (#1588)
Now that our Min SDK is 24, testing for >= N (API 24) and >= M (API 22) is obsolete as it will always be true. Simplify the codebase by removing the conditions and keeping only the API 24 or later codepath.
This commit is contained in:
parent
c2013439bc
commit
b91639dbb5
@ -237,14 +237,6 @@ public class CordovaInterfaceImpl implements CordovaInterface {
|
||||
|
||||
public boolean hasPermission(String permission)
|
||||
{
|
||||
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
|
||||
{
|
||||
int result = activity.checkSelfPermission(permission);
|
||||
return PackageManager.PERMISSION_GRANTED == result;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return PackageManager.PERMISSION_GRANTED == activity.checkSelfPermission(permission);
|
||||
}
|
||||
}
|
||||
|
@ -339,22 +339,11 @@ public class PluginManager {
|
||||
public Object postMessage(String id, Object data) {
|
||||
LOG.d(TAG, "postMessage: " + id);
|
||||
synchronized (this.pluginMap) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
this.pluginMap.forEach((s, plugin) -> {
|
||||
if (plugin != null) {
|
||||
plugin.onMessage(id, data);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
for (CordovaPlugin plugin : this.pluginMap.values()) {
|
||||
if (plugin != null) {
|
||||
Object obj = plugin.onMessage(id, data);
|
||||
if (obj != null) {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
this.pluginMap.forEach((s, plugin) -> {
|
||||
if (plugin != null) {
|
||||
plugin.onMessage(id, data);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return ctx.onMessage(id, data);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user