diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/AndroidSettingsModule.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/AndroidSettingsModule.java
index d14b9828d..af51ccdfe 100644
--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/AndroidSettingsModule.java
+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/AndroidSettingsModule.java
@@ -15,18 +15,16 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
class AndroidSettingsModule extends ReactContextBaseJavaModule {
- /**
- * React Native module name.
- */
- private static final String MODULE_NAME = "AndroidSettings";
-
public AndroidSettingsModule(ReactApplicationContext reactContext) {
super(reactContext);
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public String getName() {
- return MODULE_NAME;
+ return "AndroidSettings";
}
@ReactMethod
diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/AppInfoModule.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/AppInfoModule.java
index 951430bf2..4b7479076 100644
--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/AppInfoModule.java
+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/AppInfoModule.java
@@ -12,45 +12,53 @@ import java.util.HashMap;
import java.util.Map;
class AppInfoModule extends ReactContextBaseJavaModule {
- /**
- * React Native module name.
- */
- private static final String MODULE_NAME = "AppInfo";
-
public AppInfoModule(ReactApplicationContext reactContext) {
super(reactContext);
}
/**
- * Gets a mapping with the constants this module is exporting.
+ * Gets a Map of constants this module exports to JS. Supports JSON
+ * types.
*
- * @return a {@link Map} mapping the constants to be exported with their
- * values.
+ * @return a {@link Map} of constants this module exports to JS
*/
@Override
public Map getConstants() {
- Map constants = new HashMap<>();
Context context = getReactApplicationContext();
- PackageManager pm = context.getPackageManager();
- ApplicationInfo appInfo;
+ PackageManager packageManager = context.getPackageManager();
+ ApplicationInfo applicationInfo;
PackageInfo packageInfo;
try {
- appInfo = pm.getApplicationInfo(context.getPackageName(), 0);
- packageInfo = pm.getPackageInfo(context.getPackageName(), 0);
+ String packageName = context.getPackageName();
+
+ applicationInfo
+ = packageManager.getApplicationInfo(packageName, 0);
+ packageInfo = packageManager.getPackageInfo(packageName, 0);
} catch (PackageManager.NameNotFoundException e) {
- constants.put("name", "");
- constants.put("version", "");
- return constants;
+ applicationInfo = null;
+ packageInfo = null;
}
- constants.put("name", pm.getApplicationLabel(appInfo));
- constants.put("version", packageInfo.versionName);
+ Map constants = new HashMap<>();
+
+ constants.put(
+ "name",
+ applicationInfo == null
+ ? ""
+ : packageManager.getApplicationLabel(applicationInfo));
+ constants.put(
+ "version",
+ packageInfo == null ? "" : packageInfo.versionName);
+
return constants;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public String getName() {
- return MODULE_NAME;
+ return "AppInfo";
}
}
diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/AudioModeModule.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/AudioModeModule.java
index 26e949beb..7338d29d8 100644
--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/AudioModeModule.java
+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/AudioModeModule.java
@@ -74,12 +74,13 @@ class AudioModeModule extends ReactContextBaseJavaModule {
: Intent.ACTION_HEADSET_PLUG;
/**
- * React Native module name.
+ * The name of AudioModeModule to be used in the React Native
+ * bridge.
*/
private static final String MODULE_NAME = "AudioMode";
/**
- * Tag used when logging messages.
+ * The Log tag AudioModeModule is to log messages with.
*/
static final String TAG = MODULE_NAME;
@@ -155,7 +156,7 @@ class AudioModeModule extends ReactContextBaseJavaModule {
}
/**
- * Gets the name for this module, to be used in the React Native bridge.
+ * Gets the name for this module to be used in the React Native bridge.
*
* @return a string with the module name.
*/
diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java
index 413ac36f1..6aacbccf2 100644
--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java
+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java
@@ -47,11 +47,6 @@ class ExternalAPIModule extends ReactContextBaseJavaModule {
private static final Map JITSI_MEET_VIEW_LISTENER_METHODS
= new HashMap<>();
- /**
- * The name of this module to be used in the React Native bridge.
- */
- private static final String MODULE_NAME = "ExternalAPI";
-
static {
// Figure out the mapping between the JitsiMeetViewListener methods
// and the events i.e. redux action types.
@@ -113,7 +108,7 @@ class ExternalAPIModule extends ReactContextBaseJavaModule {
*/
@Override
public String getName() {
- return MODULE_NAME;
+ return "ExternalAPI";
}
/**
diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/ProximityModule.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/ProximityModule.java
index 0dad3d16f..b8aa3d521 100644
--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/ProximityModule.java
+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/ProximityModule.java
@@ -33,7 +33,8 @@ import com.facebook.react.bridge.UiThreadUtil;
*/
class ProximityModule extends ReactContextBaseJavaModule {
/**
- * React Native module name.
+ * The name of ProximityModule to be used in the React Native
+ * bridge.
*/
private static final String MODULE_NAME = "Proximity";
diff --git a/ios/sdk/src/AppInfo.m b/ios/sdk/src/AppInfo.m
index ba356bdf5..69aa195b2 100644
--- a/ios/sdk/src/AppInfo.m
+++ b/ios/sdk/src/AppInfo.m
@@ -27,16 +27,22 @@
RCT_EXPORT_MODULE();
- (NSDictionary *)constantsToExport {
- NSString *name = [[[NSBundle mainBundle]infoDictionary]objectForKey :@"CFBundleDisplayName"];
- NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
+ NSDictionary *infoDictionary
+ = [[NSBundle mainBundle] infoDictionary];
+ NSString *name = infoDictionary[@"CFBundleDisplayName"];
+ NSString *version = infoDictionary[@"CFBundleShortVersionString"];
+
if (version == nil) {
- version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
+ version = infoDictionary[@"CFBundleVersion"];
if (version == nil) {
version = @"";
}
}
- return @{ @"name" : name, @"version" : version };
+ return @{
+ @"name": name,
+ @"version": version
+ };
};
@end