Merge pull request #1398 from invertase/functions-multi-app-regions
[utils][js][android] add `firebase.utils().getPlayServicesStatus(): P…
This commit is contained in:
commit
23e28e453f
|
@ -73,10 +73,15 @@ public class RNFirebaseModule extends ReactContextBaseJavaModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ReactMethod
|
||||||
|
public void getPlayServicesStatus(Promise promise) {
|
||||||
|
promise.resolve(getPlayServicesStatusMap());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private WritableMap getPlayServicesStatus() {
|
private WritableMap getPlayServicesStatusMap() {
|
||||||
GoogleApiAvailability gapi = GoogleApiAvailability.getInstance();
|
GoogleApiAvailability gapi = GoogleApiAvailability.getInstance();
|
||||||
final int status = gapi.isGooglePlayServicesAvailable(getReactApplicationContext());
|
final int status = gapi.isGooglePlayServicesAvailable(getReactApplicationContext());
|
||||||
WritableMap result = Arguments.createMap();
|
WritableMap result = Arguments.createMap();
|
||||||
|
@ -176,7 +181,7 @@ public class RNFirebaseModule extends ReactContextBaseJavaModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
constants.put("apps", appMapsList);
|
constants.put("apps", appMapsList);
|
||||||
constants.put("playServicesAvailability", getPlayServicesStatus());
|
constants.put("playServicesAvailability", getPlayServicesStatusMap());
|
||||||
return constants;
|
return constants;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,11 @@ export default class RNFirebaseUtils extends ModuleBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPlayServicesStatus(): Promise<GoogleApiAvailabilityType | null> {
|
||||||
|
if (isIOS) return Promise.resolve(null);
|
||||||
|
return FirebaseCoreModule.getPlayServicesStatus();
|
||||||
|
}
|
||||||
|
|
||||||
promptForPlayServices() {
|
promptForPlayServices() {
|
||||||
if (isIOS) return null;
|
if (isIOS) return null;
|
||||||
return FirebaseCoreModule.promptForPlayServices();
|
return FirebaseCoreModule.promptForPlayServices();
|
||||||
|
|
Loading…
Reference in New Issue