From c96f2eb66b612fc3f1f9233c7d10cc0f81f19faf Mon Sep 17 00:00:00 2001 From: sdenaci Date: Mon, 8 Feb 2021 11:00:16 -0500 Subject: [PATCH 1/2] feat: support booleans, integers in android --- .../RNMDMManager/RNMobileDeviceManagerModule.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/android/src/main/java/com/robinpowered/RNMDMManager/RNMobileDeviceManagerModule.java b/android/src/main/java/com/robinpowered/RNMDMManager/RNMobileDeviceManagerModule.java index 8dbb617..6c3d161 100644 --- a/android/src/main/java/com/robinpowered/RNMDMManager/RNMobileDeviceManagerModule.java +++ b/android/src/main/java/com/robinpowered/RNMDMManager/RNMobileDeviceManagerModule.java @@ -160,7 +160,17 @@ public void getConfiguration(final Promise promise) { Bundle appRestrictions = restrictionsManager.getApplicationRestrictions(); WritableNativeMap data = new WritableNativeMap(); for (String key : appRestrictions.keySet()){ - data.putString(key, appRestrictions.getString(key)); + Object value = appRestrictions.get(key); + + if (value instanceof Boolean) { + data.putBoolean(key, (Boolean) value); + } else if (value instanceof Integer) { + data.putInt(key, (Integer) value); + } else if (value instanceof String) { + data.putString(key, (String) value); + } else { + data.putString(key, value.toString()); + } } promise.resolve(data); } else { From 5acf53a652d09d1c46683e033e24bf3d03821813 Mon Sep 17 00:00:00 2001 From: sdenaci Date: Mon, 8 Feb 2021 11:29:49 -0500 Subject: [PATCH 2/2] fix: remove extra space --- .../RNMDMManager/RNMobileDeviceManagerModule.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/src/main/java/com/robinpowered/RNMDMManager/RNMobileDeviceManagerModule.java b/android/src/main/java/com/robinpowered/RNMDMManager/RNMobileDeviceManagerModule.java index 6c3d161..c38234e 100644 --- a/android/src/main/java/com/robinpowered/RNMDMManager/RNMobileDeviceManagerModule.java +++ b/android/src/main/java/com/robinpowered/RNMDMManager/RNMobileDeviceManagerModule.java @@ -162,9 +162,9 @@ public void getConfiguration(final Promise promise) { for (String key : appRestrictions.keySet()){ Object value = appRestrictions.get(key); - if (value instanceof Boolean) { + if (value instanceof Boolean) { data.putBoolean(key, (Boolean) value); - } else if (value instanceof Integer) { + } else if (value instanceof Integer) { data.putInt(key, (Integer) value); } else if (value instanceof String) { data.putString(key, (String) value);