@grouplinknetwork/group-link-ionic-plugin 1.0.7-beta.1 → 1.0.7-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -123,13 +123,35 @@ public class GroupLinkPlugin extends Plugin {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
// @PermissionCallback
|
|
127
|
+
// private void permissionCallback(PluginCall call) {
|
|
128
|
+
// permissionIsGranted("bluetooth", call);
|
|
129
|
+
// permissionIsGranted("foreground_service", call);
|
|
130
|
+
// permissionIsGranted("location", call);
|
|
131
|
+
// permissionIsGranted("wifi_state", call);
|
|
132
|
+
// permissionIsGranted("notification", call);
|
|
133
|
+
// }
|
|
134
|
+
|
|
126
135
|
@PermissionCallback
|
|
127
136
|
private void permissionCallback(PluginCall call) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
137
|
+
try {
|
|
138
|
+
boolean granted = true;
|
|
139
|
+
|
|
140
|
+
if (getPermissionState("bluetooth") != PermissionState.GRANTED) granted = false;
|
|
141
|
+
if (getPermissionState("foreground_service") != PermissionState.GRANTED) granted = false;
|
|
142
|
+
if (getPermissionState("location") != PermissionState.GRANTED) granted = false;
|
|
143
|
+
if (getPermissionState("wifi_state") != PermissionState.GRANTED) granted = false;
|
|
144
|
+
if (getPermissionState("notification") != PermissionState.GRANTED) granted = false;
|
|
145
|
+
|
|
146
|
+
if (granted) {
|
|
147
|
+
call.resolve();
|
|
148
|
+
} else {
|
|
149
|
+
call.reject("Permission denied");
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
} catch (Exception error) {
|
|
153
|
+
handleError(error, call);
|
|
154
|
+
}
|
|
133
155
|
}
|
|
134
156
|
|
|
135
157
|
@PluginMethod
|
|
@@ -144,16 +166,16 @@ public class GroupLinkPlugin extends Plugin {
|
|
|
144
166
|
}
|
|
145
167
|
}
|
|
146
168
|
|
|
147
|
-
private void permissionIsGranted(String alias, PluginCall call) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
169
|
+
// private void permissionIsGranted(String alias, PluginCall call) {
|
|
170
|
+
// try {
|
|
171
|
+
// if (getPermissionState(alias) == PermissionState.GRANTED) {
|
|
172
|
+
// } else {
|
|
173
|
+
// call.reject("Permission denied");
|
|
174
|
+
// }
|
|
175
|
+
// } catch (Exception error) {
|
|
176
|
+
// handleError(error, call);
|
|
177
|
+
// }
|
|
178
|
+
// }
|
|
157
179
|
|
|
158
180
|
private void handleError(Exception error, PluginCall call) {
|
|
159
181
|
Context context = this.getActivity().getApplicationContext();
|
package/package.json
CHANGED