New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(app): include play service utils #3240
Conversation
requestPermission example is missing `await` keyword.
Codecov Report
@@ Coverage Diff @@
## next #3240 +/- ##
==========================================
- Coverage 85.44% 85.07% -0.37%
==========================================
Files 108 108
Lines 3392 3407 +15
==========================================
Hits 2898 2898
- Misses 494 509 +15 |
packages/app/lib/utils/index.js
Outdated
@@ -31,6 +31,41 @@ class FirebaseUtilsModule extends FirebaseModule { | |||
return this.native.isRunningInTestLab; | |||
} | |||
|
|||
get androidPlayServices() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This use to be called playServicesAvailability
- the example above in the quick start also uses playServicesAvailability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, Mike. Sorting out types now
Made a note on a couple small things I noticed, also the TS types are missing here
default `return` for iOS Co-Authored-By: Mike Diarmid <mike.diarmid@gmail.com>
Co-Authored-By: Mike Diarmid <mike.diarmid@gmail.com>
resolve promises Co-Authored-By: Mike Diarmid <mike.diarmid@gmail.com>
One to document in the new docs - maybe under app? |
@Ehesp Agreed. I've already put the |
return Promise.resolve(null); | ||
} | ||
return this.native.androidGetPlayServicesStatus(); | ||
} | ||
|
||
promptForPlayServices() { | ||
if (isIOS) { | ||
return Promise.resolve(null); | ||
} | ||
return this.native.androidPromptForPlayServices(); | ||
} | ||
|
||
makePlayServicesAvailable() { | ||
if (isIOS) { | ||
return Promise.resolve(null); | ||
} | ||
return this.native.androidMakePlayServicesAvailable(); | ||
} | ||
|
||
resolutionForPlayServices() { | ||
if (isIOS) { | ||
return Promise.resolve(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your types now say these return undefined on iOS; updated below to match;
return Promise.resolve(null); | |
} | |
return this.native.androidGetPlayServicesStatus(); | |
} | |
promptForPlayServices() { | |
if (isIOS) { | |
return Promise.resolve(null); | |
} | |
return this.native.androidPromptForPlayServices(); | |
} | |
makePlayServicesAvailable() { | |
if (isIOS) { | |
return Promise.resolve(null); | |
} | |
return this.native.androidMakePlayServicesAvailable(); | |
} | |
resolutionForPlayServices() { | |
if (isIOS) { | |
return Promise.resolve(null); | |
return Promise.resolve(); | |
} | |
return this.native.androidGetPlayServicesStatus(); | |
} | |
promptForPlayServices() { | |
if (isIOS) { | |
return Promise.resolve(); | |
} | |
return this.native.androidPromptForPlayServices(); | |
} | |
makePlayServicesAvailable() { | |
if (isIOS) { | |
return Promise.resolve(); | |
} | |
return this.native.androidMakePlayServicesAvailable(); | |
} | |
resolutionForPlayServices() { | |
if (isIOS) { | |
return Promise.resolve(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused, I thought my types for iOS were returning null
undefined
I'll change accordingly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. Cool, I'll update to :Promise<void | null>
for the types then
packages/app/lib/index.d.ts
Outdated
* If true, allows the device to collect analytical data and send it to | ||
* Firebase. Useful for GDPR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy pasta derp
packages/app/lib/index.d.ts
Outdated
@@ -379,6 +465,66 @@ export namespace Utils { | |||
* @android | |||
*/ | |||
isRunningInTestLab: boolean; | |||
|
|||
/** | |||
* Returns true if this app is running inside a Firebase Test Lab environment. Always returns false on iOS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy pasta derp
fixes this issue: https://invertase.canny.io/react-native-firebase/p/playservicesavailability.
Summary
Checklist
Android
iOS
e2e
tests added or updated in packages/**/e2eTest Plan
Release Plan
[CATEGORY][type] [LOCATION] - Message
Think
react-native-firebase
is great? Please consider supporting the project with any of the below:React Native Firebase
andInvertase
on Twitter