Commit 1ec397f3 authored by Mehdi Achour's avatar Mehdi Achour

style: reformat files

parent ed5bc527
......@@ -13,8 +13,7 @@ import java.util.List;
public class RNDeviceInfo implements ReactPackage {
@Override
public List<NativeModule> createNativeModules(
ReactApplicationContext reactContext) {
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
modules.add(new RNDeviceModule(reactContext));
......@@ -24,13 +23,13 @@ public class RNDeviceInfo implements ReactPackage {
// Deprecated RN 0.47
public List<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
return Collections.emptyList();
}
@Override
public List<ViewManager> createViewManagers(
ReactApplicationContext reactContext) {
return Collections.emptyList();
ReactApplicationContext reactContext) {
return Collections.emptyList();
}
}
......@@ -51,7 +51,7 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
}
private WifiInfo getWifiInfo() {
if ( this.wifiInfo == null ) {
if (this.wifiInfo == null) {
WifiManager manager = (WifiManager) reactContext.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
this.wifiInfo = manager.getConnectionInfo();
}
......@@ -59,18 +59,18 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
}
private String getCurrentLanguage() {
Locale current = getReactApplicationContext().getResources().getConfiguration().locale;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return current.toLanguageTag();
} else {
StringBuilder builder = new StringBuilder();
builder.append(current.getLanguage());
if (current.getCountry() != null) {
builder.append("-");
builder.append(current.getCountry());
}
return builder.toString();
Locale current = getReactApplicationContext().getResources().getConfiguration().locale;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return current.toLanguageTag();
} else {
StringBuilder builder = new StringBuilder();
builder.append(current.getLanguage());
if (current.getCountry() != null) {
builder.append("-");
builder.append(current.getCountry());
}
return builder.toString();
}
}
private String getCurrentCountry() {
......@@ -80,13 +80,13 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
private Boolean isEmulator() {
return Build.FINGERPRINT.startsWith("generic")
|| Build.FINGERPRINT.startsWith("unknown")
|| Build.MODEL.contains("google_sdk")
|| Build.MODEL.contains("Emulator")
|| Build.MODEL.contains("Android SDK built for x86")
|| Build.MANUFACTURER.contains("Genymotion")
|| (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic"))
|| "google_sdk".equals(Build.PRODUCT);
|| Build.FINGERPRINT.startsWith("unknown")
|| Build.MODEL.contains("google_sdk")
|| Build.MODEL.contains("Emulator")
|| Build.MODEL.contains("Android SDK built for x86")
|| Build.MANUFACTURER.contains("Genymotion")
|| (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic"))
|| "google_sdk".equals(Build.PRODUCT);
}
private Boolean isTablet() {
......@@ -135,12 +135,13 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
}
@Override
public @Nullable Map<String, Object> getConstants() {
public @Nullable
Map<String, Object> getConstants() {
HashMap<String, Object> constants = new HashMap<String, Object>();
PackageManager packageManager = this.reactContext.getPackageManager();
String packageName = this.reactContext.getPackageName();
constants.put("appVersion", "not available");
constants.put("appName", "not available");
constants.put("buildVersion", "not available");
......@@ -175,7 +176,6 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
}
try {
if (Class.forName("com.google.android.gms.iid.InstanceID") != null) {
constants.put("instanceId", com.google.android.gms.iid.InstanceID.getInstance(this.reactContext).getId());
......@@ -208,11 +208,11 @@ public class RNDeviceModule extends ReactContextBaseJavaModule {
constants.put("isTablet", this.isTablet());
constants.put("is24Hour", this.is24Hour());
if (getCurrentActivity() != null &&
(getCurrentActivity().checkCallingOrSelfPermission(Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED ||
(getCurrentActivity().checkCallingOrSelfPermission(Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED ||
getCurrentActivity().checkCallingOrSelfPermission(Manifest.permission.READ_SMS) == PackageManager.PERMISSION_GRANTED ||
getCurrentActivity().checkCallingOrSelfPermission("android.permission.READ_PHONE_NUMBERS") == PackageManager.PERMISSION_GRANTED)) {
TelephonyManager telMgr = (TelephonyManager) this.reactContext.getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
constants.put("phoneNumber", telMgr.getLine1Number());
TelephonyManager telMgr = (TelephonyManager) this.reactContext.getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
constants.put("phoneNumber", telMgr.getLine1Number());
}
constants.put("carrier", this.getCarrier());
constants.put("totalDiskCapacity", this.getTotalDiskCapacity());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment