This is an automated email from the ASF dual-hosted git repository.
normanbreau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-android.git
The following commit(s) were added to refs/heads/master by this push:
new b91639db refactor: Removed obsolete version code checks (#1588)
b91639db is described below
commit b91639dbb5410617eff7333fdd169958fb460da2
Author: Norman Breau <[email protected]>
AuthorDate: Sat Apr 8 15:32:19 2023 -0300
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.
---
.../src/org/apache/cordova/CordovaInterfaceImpl.java | 10 +---------
framework/src/org/apache/cordova/PluginManager.java | 19 ++++---------------
2 files changed, 5 insertions(+), 24 deletions(-)
diff --git a/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
b/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
index 84e2c0a4..eccc9663 100644
--- a/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
+++ b/framework/src/org/apache/cordova/CordovaInterfaceImpl.java
@@ -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);
}
}
diff --git a/framework/src/org/apache/cordova/PluginManager.java
b/framework/src/org/apache/cordova/PluginManager.java
index 05029937..9531e8fa 100755
--- a/framework/src/org/apache/cordova/PluginManager.java
+++ b/framework/src/org/apache/cordova/PluginManager.java
@@ -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);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]