Skip to content

[firebase-analytics] Add native Firebase Analytics #7017

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

Merged
merged 30 commits into from
Feb 21, 2020

Conversation

IjzerenHein
Copy link
Contributor

@IjzerenHein IjzerenHein commented Feb 11, 2020

Why

Firebase Analytics is currently not support on the Expo client because is requires certain browser features (it dynamically loads gtag.js, which in turn also requires browser features). You can install native Firebase Analytics on bare-projects, but there is no solution for the managed workflow.

How

This PR add support for native Firebase Analytics (written from scratch by @EvanBacon) to the managed workflow. This is fully support on standalone builds and custom clients. On the standard Expo client there is a limitation which prevents loaded projects from using native analytics (FirebaseAnalytics in a singleton and cannot be succesfuly updated after initial configuration). For that case, a dummy shim is used which logs the events to the console (for debugging purposes) & generates a one-time warning.
A pure JS based analytics tracking is currently being researched as a workaround solution.

Test Plan

  • Tests (Firebase Analytics) have been added to the test-suite
  • You can run the tests on bare and should see analytics in the Expo Custom Client Firebase project

Running on Expo client

The tests in the test-suite are conditional and will run different checks whether a googleServicesFile is found in app.json or not. By default the test-suite does not (yet) have a googleServicesFile config for iOS or Android. This means that the standard client will run tests to verify that the analytics functions fail (because of the missing config).

To run the the other tests, add googleServicesFile configs to app.json of test-suite.

{
  "expo": {
    "ios": {
      "bundleIdentifier": "io.expo.testsuite",
      "googleServicesFile": "./GoogleService-Info.plist"
     },
     "android": {
      "googleServicesFile": "./google-services.json"
     }
  }
}

Now when running the tests in the expo client, it will validate that the Analytics functions can be called correctly. Because of the previously mentioned limitation, it will now log the analytics events to the console.

@ExpoBot
Copy link

ExpoBot commented Feb 11, 2020

Warnings
⚠️

You modified sdk/firebase-core.md in the unversioned directory. Please consider copying the changes to the latest released version if applicable.

Generated by 🚫 dangerJS against 597ca90

@IjzerenHein IjzerenHein force-pushed the @hein/expo-firebase/analytics branch from 5e6a540 to e1c5c91 Compare February 11, 2020 16:34
@IjzerenHein IjzerenHein force-pushed the @hein/expo-firebase/core branch from ddeb9a8 to 1bff248 Compare February 17, 2020 15:46
@IjzerenHein IjzerenHein force-pushed the @hein/expo-firebase/analytics branch from d35bb8e to 24ead96 Compare February 17, 2020 16:02
@IjzerenHein IjzerenHein force-pushed the @hein/expo-firebase/core branch from 1bff248 to 200c7c1 Compare February 17, 2020 16:46
@IjzerenHein IjzerenHein force-pushed the @hein/expo-firebase/analytics branch from 24ead96 to 3552c0a Compare February 17, 2020 16:47
@IjzerenHein IjzerenHein force-pushed the @hein/expo-firebase/core branch from cb9ea49 to 8035eeb Compare February 18, 2020 13:51
@IjzerenHein IjzerenHein force-pushed the @hein/expo-firebase/analytics branch 2 times, most recently from 3853ef5 to dade76c Compare February 18, 2020 15:47
Copy link
Member

@brentvatne brentvatne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a couple comments, this is looking good!

try {
systemApp = FirebaseApp.getInstance();
} catch (Exception e) {
// nop
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should log this, it looks like it will throw an IllegalStateException if the app isn't initialized yet

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just for checking whether the default firebase app is initialized. Unfortunately that's not possible without an exception handler here. If no default app exists, then that's not an error situation per-se.


@ExpoMethod
public void setCurrentScreen(final String screenName, final String screenClassOverride, final Promise promise) {
// This is the only method that runs on the main thread.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting.. I wonder why this is required, it seems like the Firebase docs don't really explain it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, it just says: "This method must be called from the app's main thread.".

Copy link
Contributor

@EvanBacon EvanBacon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work

@IjzerenHein IjzerenHein force-pushed the @hein/expo-firebase/analytics branch from dade76c to 3f1291b Compare February 19, 2020 17:22
@IjzerenHein
Copy link
Contributor Author

Nice work

Thanks 😄

@IjzerenHein IjzerenHein force-pushed the @hein/expo-firebase/analytics branch from 3f1291b to c3f7d25 Compare February 20, 2020 10:14
@IjzerenHein IjzerenHein force-pushed the @hein/expo-firebase/core branch from 9bfe1a9 to 6be28f8 Compare February 20, 2020 13:32
@IjzerenHein IjzerenHein force-pushed the @hein/expo-firebase/analytics branch from c3f7d25 to 80c1f6b Compare February 21, 2020 10:26
…g `setCurrentScreen`

On web, calling `setCurrentScreen` does not automatically record a screen_view event as
it does on native. We therefore record the 'screen_view' event manually.
https://stackoverflow.com/questions/59330467/how-to-track-page-view-with-firebase-analytics-in-a-web-single-page-app
"peerDependencies": {
"@unimodules/core": "*",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the reason we don't put this as a regular peer dep is that if you install react-native-unimodules then @unimodules/core is a dep of that, and peer deps can only be satisfied by direct dependencies so even though the code will work the user will get a warning on install

@brentvatne brentvatne merged commit aa93fca into @hein/expo-firebase/core Feb 21, 2020
brentvatne pushed a commit that referenced this pull request Feb 21, 2020
* [firebase-core] Add tests to test-suite

* [fireabse-analytics] Add expo-firebase-analytics package

* [firebase-core] Add firebase-core to Expo client iOS project file

* [firebase-analytics] Add tests to test-suite

* [bare-expo] Update iOS app-icon assets

* [firebase-analytics] Add expo-firebase-analytics to Expo client

* [bare-expo] Add firebase-analytics to BasePackageList.java

* [firebase-analytics] Add firebase-analytics to bundleNativeModules.json

* [docs] Add firebase-analytics docs

* [firebase-analytics] Update yarn.lock after adding `firebase` (js sdk) dependency

* [firebase-analytics] Add js build output

* [firebase-analytics] Update sdk docs

* [firebase-analytics] Update SDK docs

* [firebase-analytics] Remove firebase JS dep to check CI

* [docs] Update SDK docs & readme for expo-firebase-analytics

* [expo-analytics] Remove firebase peer-dependency

* [firebase-analytics] Add web-support & code cleanup

* [docs] Update firebase-analytics docs

* [firebase-analytics] Update build files

* [firebase-analytics] Fix outdated build files

* [firebase-analytics] Fix lint warnings

* [firebase-analytics] Fixed code-style errors & typos after review

* [firebase-analytics] Moved `unimodulePeerDependencies` to regular peerDependencies in package.json

* [firebase-analytics] Update js build output

* [fireabse-analytics] Update changelog

* [firebse-analytics] Update Android build.gradle

* [ios] Update pods

* [firebase-analytics] Add recording of `screen_view` event when calling `setCurrentScreen`

On web, calling `setCurrentScreen` does not automatically record a screen_view event as
it does on native. We therefore record the 'screen_view' event manually.
https://stackoverflow.com/questions/59330467/how-to-track-page-view-with-firebase-analytics-in-a-web-single-page-app

* [firebase-analytics] Update JS build files

* [firebase-analytics] Remove @unimodules/core peerDependency from package.json
@alexbchr
Copy link

I have 2 questions related to this PR:

  1. Will this be included in Expo 37? I don't see it planned in the roadmap.
  2. Can we expect other native Firebase SDK integrations planned soon? I am mostly interested by Firestore and Dynamic Links integrations.

@IjzerenHein
Copy link
Contributor Author

IjzerenHein commented Feb 25, 2020

@alexbchr Yes this is planned for Expo 37 👍

As for other integrations, I cannot give you any assurances, but yes we are working on bringing more Firebase services to Expo.

Dynamic Links will likely not be possible in the Expo client though, as it requires an URL scheme linked into the app.

Regarding Firestore, you can currently use it with the Firebase JS SDK. Does this provide any limitations for you?

@alexbchr
Copy link

@alexbchr Yes this is planned for Expo 37

Thanks a lot for the info! I am really looking forward to this!

As for other integrations, I cannot give you any assurances, but yet we are working on bringing more Firebase services to Expo.

Dynamic Links will likely not be possible in the Expo client though, as it requires an URL scheme linked into the app.

Regarding Firestore, you can currently use it with the Firebase JS SDK. Does this provide any limitations for you?

Good to know! And yes for Dynamic Links I understand the limitations. It would however be great if we can use them in standalone apps! As to Firestore, I currently use the Firebase JS SDK and it works quite well, but I encountered some performance issues with it, as it runs on the JS thread. I think a native integration would hopefully be a little bit more performant with fast successive updates.

@cemo
Copy link

cemo commented Feb 27, 2020

@IjzerenHein Will you add other firebase features support as well? 😇

@IjzerenHein
Copy link
Contributor Author

IjzerenHein commented Feb 27, 2020

@IjzerenHein Will you add other firebase features support as well? 😇

Yes, that is definitely our goal.

Analytics is ready and we will publish an update for Phone auth soon as well.

I think this sums up the situation and goals for Firebase nicely 👍

One of the problems is that some parts of the native Firebase SDK are written for single app environments and are tightly coupled with other services. This makes running the native Firebase SDK in the multi-app Expo client a challenge and in some cases, like Analytics, even impossible. Other Firebase services, like Dynamic Links and some Auth providers, require that URL schemes are defined in the app, otherwise they won't work.

Lastly, we need to minimize dependencies on external services in packages included in the Expo client that we ship to the stores. The core of the Expo SDK will be free of third party service dependencies in the long-run, and those libraries will instead be available to developers through our upcoming build service. This is still evolving and we will speak about it more in the future.

We are looking forward to bringing as much of the Firebase functionality to our users as possible. If you have Firebase related feature requests, feel free to add or upvote them in our feature request tracker.

ccheever added a commit that referenced this pull request Mar 2, 2020
I made some updates to the guide for using custom fonts.

Changes include:
- Using Snacks for examples
- Using the `useFonts` hook for a simpler example
- Example of loading a remote font
- Discussion of font formats

Squashed commits below

* [android] 🤏 Update react-native-gesture-handler to 1.6.0 (#7121)

# Why

Part of #7006 

# How

- Used `et update-vendored-module` to update `react-native-gesture-handler`.
- Updated versions in some apps.
- Tried to run it on Android... and it turned out there is a new `RNGHModalUtils` file scoped under `com.facebook.react` package so I've copied this file manually to appropriate directory in `expoview`.
- Added a warning saying that `com.facebook.react` needs to be manually updated, we already do the same in `react-native-reanimated`.
- Added changelog entry.

# Test Plan

Tested examples in `native-component-list`.

* [constants] make installationId available in bare (#6906)

* [constants] make available in bare

* make filename constant

* remove installationId from scoped android module

* remove installationId from scoped ios

* fix ios_test_suite

* fix app auth code block (#7138)

* fix app auth code block

* Update app-auth.md

* Update app-auth.md

* [ios][expo-constants] remove duplicate symbol kEXDeviceInstallUUIDKey to fix iOS client build

* Updated linking.md (#7136)

* Updated linking.md

Updated description for WebBrowser to follow latest changes.

* Tidy up docs

Less `const fn = () => `, function keyword is usually better

Co-authored-by: James Ide <ide@users.noreply.github.com>

* [android][home] 🤖 Add DevMenu on Android (#6829)

# Why

Fixes #6521 

# How

- Created unversioned `DevMenuManager` class which mostly just delegates calls to versioned `DevMenuModule` modules specific for SDK version. These modules are responsible for providing initial props, dev menu options and actions to run when these options are selected. The manager creates a new `ReactRootView` that bases on kernel's (home's) React instance manager and starts `HomeMenu` app which is registered as a second entry point in `home` and then, manager adds this root view to the currently used activity (it must implement `ExperienceActivity`). As I needed to know which experience activity is the current one, I've added `sCurrentActivity` static member to that class and just track it using activity's lifecycle methods.
- Backported `DevMenuModule` to all SDK versions included in the client. Including some changes between them - for example hot and fast reloading.
- Added support for back button and Android's menu press (which can be simulated by `adb shell input keyevent 82`).
- Removed some unused code related to `Nux` and replaced it with new onboarding screen (see #6793).
- Created new `ShakeDetector` which works more like on iOS. The one provided by React Native is annoying in most cases as it actually requires two shakes.
- Updated `ReactAndroidCodeTransformer` to turn off showing React Native dev menu in non-standalone apps.
- **To do after merging:** Rebuild versioned expoviews.

# Test Plan

- [x] Test on experience in debug mode
- [x] Test on experience in production mode
- [x] Test on snacks
- [x] Test on older SDKs
- [x] Test on simulators
- [x] Test that onboarding shows up once you open the experience for the first time or you didn't accept it yet (clicked `Got it` button).
- [x] Test that using dev menu still works once we kill home's activity.

* [home] 🏠 Publish new dev home

* [auth-session] Extract AuthSession into unimodule (#6989)

* [expo-auth-session] Extract

* [expo-auth-session] Remove from the expo package

* [expo-auth-session] Add bare support

* [expo-auth-session] Refactor

* [expo-auth-session] Fix CI

* [expo-auth-session] Update CHANGELOG

* [expo-auth-session] Apply requested changes

* [expo-auth-session] Update README

* [expo-auth-session] Update documentation

* [expo-auth-session] apply requested changes

* [auth-session] Fix CI

* run yarn

* [expo-screen-orientation] Update documentation (#6838)

* [expo-screen-orientation] Update docs & add checks to lockPlatfomAsync on iOS

* [expo-screen-orientation] Update installation instruction

* [expo-screen-orientation] Fix quotations marks

* [expo-screen-orientation] Update changelog

* [expo-screen-orientation] Apply requested changes

* [screen-orientation] Apply requested changes

* [screen-orientation] Apply requested changes

* [screen-orientation] Apply requested changes

* [firebase-core] Add core functionality for supporting native Firebase packages (#7013)

* [bare-expo] Fix database-url in GoogleService-Info.plist

* [firebase-core] Add `expo-firebase-core` package

* [firebase-core] Add tests to test-suite

* [firebase-core] Add scoped firebase-core to Expo client to create native sandboxed firebase apps

* [firebase-core] Update bare-expo BasePackageList

* [firebase-core] Add firebase-core to bundledNativeModules.json

* [firebase-core] Add SDK documentation

* [firebase-core] Add firebase-core to Expo client iOS project file

* [firebase-core] Add js build files

* [firebase-core] Update SDK doc to refer to native firebase guide

* [firebase-core] Add web-support & code cleanup

* [docs] Fixes to firebase-core docs

* [firebase-core] Update build files

* [firebase-core] Fix test in test-suite

* [fireabase-core] Cleanup COMPARISON.md

* [firebase-core] Improve google-services.json parsing and client selection

* [firebase-core] Updated SDK docs

* [fireabse-core] Update readme description

* [firebase-core] Removed outcommented line on Android

* [firebase-core] Minor iOS code improvements after review

* [firebase-core] Fixes after review to unit tests

* [firebase-core] Updated iOS code after review feedback

* [firebase-core] Fix tests

* [firebase-core] Simplify JS code

* [firebase-core] Update js build output

* [fireabse-core] Add DEFAULT_WEB_APP_OPTIONS constant + doc improvements

* [firebase-core] Update JS build files

* [firebase-core] Fix unimodulePeerDependencies in package.json

* [firebase-core] Android build.gradle fixes

* [firebase-core] Android base64 encoding code improvement

* [firebase-core] Prevent hard javascript import error when native lib not linked

* [firebase-core] Update various Android methods to be protected i.s.o. public

* [firebase-core] Android protected DEFAULT_APP_NAME and re-use in scoped

* [firebase-core] Update changelog

* [fireabse-core] Update JS build files

* [firebase-android] Fix Firebase App cleanup when multiple projects are loaded on Android

* [ios] Update pods

* [firebase-analytics] Add native Firebase Analytics (#7017)

* [firebase-core] Add tests to test-suite

* [fireabse-analytics] Add expo-firebase-analytics package

* [firebase-core] Add firebase-core to Expo client iOS project file

* [firebase-analytics] Add tests to test-suite

* [bare-expo] Update iOS app-icon assets

* [firebase-analytics] Add expo-firebase-analytics to Expo client

* [bare-expo] Add firebase-analytics to BasePackageList.java

* [firebase-analytics] Add firebase-analytics to bundleNativeModules.json

* [docs] Add firebase-analytics docs

* [firebase-analytics] Update yarn.lock after adding `firebase` (js sdk) dependency

* [firebase-analytics] Add js build output

* [firebase-analytics] Update sdk docs

* [firebase-analytics] Update SDK docs

* [firebase-analytics] Remove firebase JS dep to check CI

* [docs] Update SDK docs & readme for expo-firebase-analytics

* [expo-analytics] Remove firebase peer-dependency

* [firebase-analytics] Add web-support & code cleanup

* [docs] Update firebase-analytics docs

* [firebase-analytics] Update build files

* [firebase-analytics] Fix outdated build files

* [firebase-analytics] Fix lint warnings

* [firebase-analytics] Fixed code-style errors & typos after review

* [firebase-analytics] Moved `unimodulePeerDependencies` to regular peerDependencies in package.json

* [firebase-analytics] Update js build output

* [fireabse-analytics] Update changelog

* [firebse-analytics] Update Android build.gradle

* [ios] Update pods

* [firebase-analytics] Add recording of `screen_view` event when calling `setCurrentScreen`

On web, calling `setCurrentScreen` does not automatically record a screen_view event as
it does on native. We therefore record the 'screen_view' event manually.
https://stackoverflow.com/questions/59330467/how-to-track-page-view-with-firebase-analytics-in-a-web-single-page-app

* [firebase-analytics] Update JS build files

* [firebase-analytics] Remove @unimodules/core peerDependency from package.json

* [docs] Add firebase web-config to app.json docs (#7086)

* [firebase-analytics] Add pure JS analytics for use on Expo Client (#7093)

* [firebase-analytics] WIP js analytics

* [firebase-analytics] Add Pure JS FirebaseAnalytics (wip, 80% done)

* [firebase-analytics] Add pure JS Firebase Analytics (done)

* [firebase-analytics] Update & integrate Pure JS Analytics tracker

* [docs] Add instruction on how to use firebase analytics on Expo Client

* [firebase-analytics] Fixes after review feedback

* [firebase-analytics] Update JS build files

* [firebase-analytics] Update analytics-js to use DEFAULT_WEB_APP_OPTIONS

* [firebase-analytics] Update JS build files

* [firebase-analytics] Add recording of `screen_view` events on Expo client, when calling `setCurrentScreen`

This mimics the behavior on Native, when calling setCurrentScreen also records a screen-view event.

Note that this is different from the Firebase JS SDK, which does not record a screen-view event, and requires `logEvent` to be called manually.

* [firebase-analytics] Update JS build files

* [iOS][notifications] feature: customize notification preview placeholders (#7052)

* [ios] add handling for previewPlaceholder

* fix on android

* update docs

* feedback: mark api availability

* resolve conflict

* Update docs/pages/versions/unversioned/sdk/notifications.md

Co-Authored-By: James Ide <ide@users.noreply.github.com>

* fix typo

* fix ci errors for expo package

Co-authored-by: James Ide <ide@users.noreply.github.com>

* [camera][iOS] Reject from takePictureAsync if camera is not ready (#7144)

# Why

Resolves #3020

Calling [camera#takePictureAsync](https://docs.expo.io/versions/latest/sdk/camera/#takepictureasync) should reject if [camera#onCameraReady](https://docs.expo.io/versions/latest/sdk/camera/#oncameraready) callback wasn't called before (native camera isn't ready yet), while now call is silently lost and promise is neither resolved nor rejected.

# How

Reject from `camera.takePictureAsync` if native camera is not ready yet.

# Test Plan

[snack](https://snack.expo.io/@bbarthec/github---camera---ios---takepictureasync)

* [android][ncl] Update @react-native-community/masked-view to 0.1.6

* [android][ios][ncl] Update @react-native-community/viewpager to 3.3.0

* [android][ios][ncl][bare-expo] Update react-native-reanimated to 1.7.0

* [android][ios][ncl] Update react-native-svg to 11.0.1

* [android][ios][ncl] Updated react-native-webview to 8.1.1

* [expo] Update react-native-view-shot to 3.1.2

* [expotools] fix update-vendored-module for react-native-appearance

* [android][ncl][home] Update react-native-appearance to 0.3.2

* [android][ios][ncl][bare-expo] Update react-native-safe-area-context to 0.7.3

* [ios] fix improperly namespaced import in RNSVGForeignObject

* [bare-expo] reinstall pods

* [android][location] Fixed NPE crash when mTask is made null mid-process. (#7147)

* Remove ANY_HOSTNAME_VERIFIER from Android app-auth debug connection builder (#7152)

* Change constant declaration to static ot aviod duplication of symbols. (#7161)

* [image-picker] Prevent from reloading on OnePlus 7 (#7162)

# Why

Resolves #5804.

# How

Create the output file before open the camera intent.

# Test Plan

- NCL ✅
- #5804 (comment) ✅

* [test-suite] Fix test-suite error on start (#7163)

# Why

Dismissing error screen on every refresh can be daunting after some time (when running in `bare-expo`).

# How

- added `try`-`catch` around calls to missing Facebook Ads module
- added `if (ExpoTaskManager)` around `eventEmitter.addListener`, since event name is fetched as a constant of the module which may be `undefined`
- moved `require(testScreen)` which define tasks to _initialization phase_
- moved `require(cameraScreen)` to global scope since I feel `optionalRequire` only works in global scope (and well, it let me get rid of red screen)

# Test Plan

Running `bare-expo` does not show error screen.

* [image-picker] Remove unused header import (#7168)

# Why

Resolves #7167.

# How

Remove unused import.

# Test Plan

- ios build ✅

* [docs] add permissions methods to api list (#7053)

* add permissions methods to api list

* add requestPermissionsAsync and getPermissionsAsync methods to TOC

* Suggestion in sentry guide (#7157)

* Suggestion in sentry guide

* identical changes to v36.0.0 docs

* [android][task-manager] Task manager for bare in Expo (#6828)

Task manager for bare android and iOS applications.

* [docs] fix app signing page (#7171)

* [docs] fix app signing page

* unversioned

* typo

* [android] remove SDK 33 code re-committed after 38ccf62

* [docs] Update ‘using-firebase’ guide with Analytics section (#7145)

* [docs] Update ‘using-firebase’ guide with Analytics section

* [docs] Add missing `expo-firebase-core` dep to ‘usinig-firebase’ doc

* Update docs/pages/versions/unversioned/guides/using-firebase.md

Co-Authored-By: Brent Vatne <brentvatne@gmail.com>

* [jest-expo-enzyme] publish 1.0.0

* Update expo-module-scripts dependency (#7175)

* [docs] Custom fonts guide update

Work in progress

* [docs] Updating guide to using custom fonts

I made some updates to the guide for using custom fonts.

Changes include:
- Using Snacks for examples
- Using the `useFonts` hook for a simpler example
- Example of loading a remote font
- Discussion of font formats

* Update docs/pages/versions/unversioned/guides/using-custom-fonts.md

Co-Authored-By: Brent Vatne <brentvatne@gmail.com>

* Update docs/pages/versions/unversioned/guides/using-custom-fonts.md

Co-Authored-By: Cedric van Putten <me@bycedric.com>

* Update docs/pages/versions/unversioned/guides/using-custom-fonts.md

Co-Authored-By: Brent Vatne <brentvatne@gmail.com>

Co-authored-by: Tomasz Sapeta <1714764+tsapeta@users.noreply.github.com>
Co-authored-by: Charlie Cruzan <35579283+cruzach@users.noreply.github.com>
Co-authored-by: Evan Bacon <baconbrix@gmail.com>
Co-authored-by: Eric Samelson <esamelson@users.noreply.github.com>
Co-authored-by: Saumya Sharma <saumyasharma010@gmail.com>
Co-authored-by: James Ide <ide@users.noreply.github.com>
Co-authored-by: Łukasz Kosmaty <lukasz.kosmaty@student.uj.edu.pl>
Co-authored-by: Dominik Sokal <dominiksokal@gmail.com>
Co-authored-by: Hein Rutjes <IjzerenHein@users.noreply.github.com>
Co-authored-by: Bartłomiej Bukowski <bartlomiejbukowski.b@gmail.com>
Co-authored-by: briefjudofox <1484049+briefjudofox@users.noreply.github.com>
Co-authored-by: Michał Czernek <czernekmichal@gmail.com>
Co-authored-by: Stanisław Chmiela <sjchmiela@users.noreply.github.com>
Co-authored-by: Ziv Levy <zivl@users.noreply.github.com>
Co-authored-by: Nishant Singh <saysnishant@gmail.com>
Co-authored-by: Brent Vatne <brentvatne@gmail.com>
Co-authored-by: Cedric van Putten <me@bycedric.com>
bbarthec added a commit that referenced this pull request Mar 3, 2020
I made some updates to the guide for using custom fonts.

Changes include:
- Using Snacks for examples
- Using the `useFonts` hook for a simpler example
- Example of loading a remote font
- Discussion of font formats

Squashed commits below

* [android] 🤏 Update react-native-gesture-handler to 1.6.0 (#7121)

# Why

Part of #7006 

# How

- Used `et update-vendored-module` to update `react-native-gesture-handler`.
- Updated versions in some apps.
- Tried to run it on Android... and it turned out there is a new `RNGHModalUtils` file scoped under `com.facebook.react` package so I've copied this file manually to appropriate directory in `expoview`.
- Added a warning saying that `com.facebook.react` needs to be manually updated, we already do the same in `react-native-reanimated`.
- Added changelog entry.

# Test Plan

Tested examples in `native-component-list`.

* [constants] make installationId available in bare (#6906)

* [constants] make available in bare

* make filename constant

* remove installationId from scoped android module

* remove installationId from scoped ios

* fix ios_test_suite

* fix app auth code block (#7138)

* fix app auth code block

* Update app-auth.md

* Update app-auth.md

* [ios][expo-constants] remove duplicate symbol kEXDeviceInstallUUIDKey to fix iOS client build

* Updated linking.md (#7136)

* Updated linking.md

Updated description for WebBrowser to follow latest changes.

* Tidy up docs

Less `const fn = () => `, function keyword is usually better

Co-authored-by: James Ide <ide@users.noreply.github.com>

* [android][home] 🤖 Add DevMenu on Android (#6829)

# Why

Fixes #6521 

# How

- Created unversioned `DevMenuManager` class which mostly just delegates calls to versioned `DevMenuModule` modules specific for SDK version. These modules are responsible for providing initial props, dev menu options and actions to run when these options are selected. The manager creates a new `ReactRootView` that bases on kernel's (home's) React instance manager and starts `HomeMenu` app which is registered as a second entry point in `home` and then, manager adds this root view to the currently used activity (it must implement `ExperienceActivity`). As I needed to know which experience activity is the current one, I've added `sCurrentActivity` static member to that class and just track it using activity's lifecycle methods.
- Backported `DevMenuModule` to all SDK versions included in the client. Including some changes between them - for example hot and fast reloading.
- Added support for back button and Android's menu press (which can be simulated by `adb shell input keyevent 82`).
- Removed some unused code related to `Nux` and replaced it with new onboarding screen (see #6793).
- Created new `ShakeDetector` which works more like on iOS. The one provided by React Native is annoying in most cases as it actually requires two shakes.
- Updated `ReactAndroidCodeTransformer` to turn off showing React Native dev menu in non-standalone apps.
- **To do after merging:** Rebuild versioned expoviews.

# Test Plan

- [x] Test on experience in debug mode
- [x] Test on experience in production mode
- [x] Test on snacks
- [x] Test on older SDKs
- [x] Test on simulators
- [x] Test that onboarding shows up once you open the experience for the first time or you didn't accept it yet (clicked `Got it` button).
- [x] Test that using dev menu still works once we kill home's activity.

* [home] 🏠 Publish new dev home

* [auth-session] Extract AuthSession into unimodule (#6989)

* [expo-auth-session] Extract

* [expo-auth-session] Remove from the expo package

* [expo-auth-session] Add bare support

* [expo-auth-session] Refactor

* [expo-auth-session] Fix CI

* [expo-auth-session] Update CHANGELOG

* [expo-auth-session] Apply requested changes

* [expo-auth-session] Update README

* [expo-auth-session] Update documentation

* [expo-auth-session] apply requested changes

* [auth-session] Fix CI

* run yarn

* [expo-screen-orientation] Update documentation (#6838)

* [expo-screen-orientation] Update docs & add checks to lockPlatfomAsync on iOS

* [expo-screen-orientation] Update installation instruction

* [expo-screen-orientation] Fix quotations marks

* [expo-screen-orientation] Update changelog

* [expo-screen-orientation] Apply requested changes

* [screen-orientation] Apply requested changes

* [screen-orientation] Apply requested changes

* [screen-orientation] Apply requested changes

* [firebase-core] Add core functionality for supporting native Firebase packages (#7013)

* [bare-expo] Fix database-url in GoogleService-Info.plist

* [firebase-core] Add `expo-firebase-core` package

* [firebase-core] Add tests to test-suite

* [firebase-core] Add scoped firebase-core to Expo client to create native sandboxed firebase apps

* [firebase-core] Update bare-expo BasePackageList

* [firebase-core] Add firebase-core to bundledNativeModules.json

* [firebase-core] Add SDK documentation

* [firebase-core] Add firebase-core to Expo client iOS project file

* [firebase-core] Add js build files

* [firebase-core] Update SDK doc to refer to native firebase guide

* [firebase-core] Add web-support & code cleanup

* [docs] Fixes to firebase-core docs

* [firebase-core] Update build files

* [firebase-core] Fix test in test-suite

* [fireabase-core] Cleanup COMPARISON.md

* [firebase-core] Improve google-services.json parsing and client selection

* [firebase-core] Updated SDK docs

* [fireabse-core] Update readme description

* [firebase-core] Removed outcommented line on Android

* [firebase-core] Minor iOS code improvements after review

* [firebase-core] Fixes after review to unit tests

* [firebase-core] Updated iOS code after review feedback

* [firebase-core] Fix tests

* [firebase-core] Simplify JS code

* [firebase-core] Update js build output

* [fireabse-core] Add DEFAULT_WEB_APP_OPTIONS constant + doc improvements

* [firebase-core] Update JS build files

* [firebase-core] Fix unimodulePeerDependencies in package.json

* [firebase-core] Android build.gradle fixes

* [firebase-core] Android base64 encoding code improvement

* [firebase-core] Prevent hard javascript import error when native lib not linked

* [firebase-core] Update various Android methods to be protected i.s.o. public

* [firebase-core] Android protected DEFAULT_APP_NAME and re-use in scoped

* [firebase-core] Update changelog

* [fireabse-core] Update JS build files

* [firebase-android] Fix Firebase App cleanup when multiple projects are loaded on Android

* [ios] Update pods

* [firebase-analytics] Add native Firebase Analytics (#7017)

* [firebase-core] Add tests to test-suite

* [fireabse-analytics] Add expo-firebase-analytics package

* [firebase-core] Add firebase-core to Expo client iOS project file

* [firebase-analytics] Add tests to test-suite

* [bare-expo] Update iOS app-icon assets

* [firebase-analytics] Add expo-firebase-analytics to Expo client

* [bare-expo] Add firebase-analytics to BasePackageList.java

* [firebase-analytics] Add firebase-analytics to bundleNativeModules.json

* [docs] Add firebase-analytics docs

* [firebase-analytics] Update yarn.lock after adding `firebase` (js sdk) dependency

* [firebase-analytics] Add js build output

* [firebase-analytics] Update sdk docs

* [firebase-analytics] Update SDK docs

* [firebase-analytics] Remove firebase JS dep to check CI

* [docs] Update SDK docs & readme for expo-firebase-analytics

* [expo-analytics] Remove firebase peer-dependency

* [firebase-analytics] Add web-support & code cleanup

* [docs] Update firebase-analytics docs

* [firebase-analytics] Update build files

* [firebase-analytics] Fix outdated build files

* [firebase-analytics] Fix lint warnings

* [firebase-analytics] Fixed code-style errors & typos after review

* [firebase-analytics] Moved `unimodulePeerDependencies` to regular peerDependencies in package.json

* [firebase-analytics] Update js build output

* [fireabse-analytics] Update changelog

* [firebse-analytics] Update Android build.gradle

* [ios] Update pods

* [firebase-analytics] Add recording of `screen_view` event when calling `setCurrentScreen`

On web, calling `setCurrentScreen` does not automatically record a screen_view event as
it does on native. We therefore record the 'screen_view' event manually.
https://stackoverflow.com/questions/59330467/how-to-track-page-view-with-firebase-analytics-in-a-web-single-page-app

* [firebase-analytics] Update JS build files

* [firebase-analytics] Remove @unimodules/core peerDependency from package.json

* [docs] Add firebase web-config to app.json docs (#7086)

* [firebase-analytics] Add pure JS analytics for use on Expo Client (#7093)

* [firebase-analytics] WIP js analytics

* [firebase-analytics] Add Pure JS FirebaseAnalytics (wip, 80% done)

* [firebase-analytics] Add pure JS Firebase Analytics (done)

* [firebase-analytics] Update & integrate Pure JS Analytics tracker

* [docs] Add instruction on how to use firebase analytics on Expo Client

* [firebase-analytics] Fixes after review feedback

* [firebase-analytics] Update JS build files

* [firebase-analytics] Update analytics-js to use DEFAULT_WEB_APP_OPTIONS

* [firebase-analytics] Update JS build files

* [firebase-analytics] Add recording of `screen_view` events on Expo client, when calling `setCurrentScreen`

This mimics the behavior on Native, when calling setCurrentScreen also records a screen-view event.

Note that this is different from the Firebase JS SDK, which does not record a screen-view event, and requires `logEvent` to be called manually.

* [firebase-analytics] Update JS build files

* [iOS][notifications] feature: customize notification preview placeholders (#7052)

* [ios] add handling for previewPlaceholder

* fix on android

* update docs

* feedback: mark api availability

* resolve conflict

* Update docs/pages/versions/unversioned/sdk/notifications.md

Co-Authored-By: James Ide <ide@users.noreply.github.com>

* fix typo

* fix ci errors for expo package

Co-authored-by: James Ide <ide@users.noreply.github.com>

* [camera][iOS] Reject from takePictureAsync if camera is not ready (#7144)

# Why

Resolves #3020

Calling [camera#takePictureAsync](https://docs.expo.io/versions/latest/sdk/camera/#takepictureasync) should reject if [camera#onCameraReady](https://docs.expo.io/versions/latest/sdk/camera/#oncameraready) callback wasn't called before (native camera isn't ready yet), while now call is silently lost and promise is neither resolved nor rejected.

# How

Reject from `camera.takePictureAsync` if native camera is not ready yet.

# Test Plan

[snack](https://snack.expo.io/@bbarthec/github---camera---ios---takepictureasync)

* [android][ncl] Update @react-native-community/masked-view to 0.1.6

* [android][ios][ncl] Update @react-native-community/viewpager to 3.3.0

* [android][ios][ncl][bare-expo] Update react-native-reanimated to 1.7.0

* [android][ios][ncl] Update react-native-svg to 11.0.1

* [android][ios][ncl] Updated react-native-webview to 8.1.1

* [expo] Update react-native-view-shot to 3.1.2

* [expotools] fix update-vendored-module for react-native-appearance

* [android][ncl][home] Update react-native-appearance to 0.3.2

* [android][ios][ncl][bare-expo] Update react-native-safe-area-context to 0.7.3

* [ios] fix improperly namespaced import in RNSVGForeignObject

* [bare-expo] reinstall pods

* [android][location] Fixed NPE crash when mTask is made null mid-process. (#7147)

* Remove ANY_HOSTNAME_VERIFIER from Android app-auth debug connection builder (#7152)

* Change constant declaration to static ot aviod duplication of symbols. (#7161)

* [image-picker] Prevent from reloading on OnePlus 7 (#7162)

# Why

Resolves #5804.

# How

Create the output file before open the camera intent.

# Test Plan

- NCL ✅
- #5804 (comment) ✅

* [test-suite] Fix test-suite error on start (#7163)

# Why

Dismissing error screen on every refresh can be daunting after some time (when running in `bare-expo`).

# How

- added `try`-`catch` around calls to missing Facebook Ads module
- added `if (ExpoTaskManager)` around `eventEmitter.addListener`, since event name is fetched as a constant of the module which may be `undefined`
- moved `require(testScreen)` which define tasks to _initialization phase_
- moved `require(cameraScreen)` to global scope since I feel `optionalRequire` only works in global scope (and well, it let me get rid of red screen)

# Test Plan

Running `bare-expo` does not show error screen.

* [image-picker] Remove unused header import (#7168)

# Why

Resolves #7167.

# How

Remove unused import.

# Test Plan

- ios build ✅

* [docs] add permissions methods to api list (#7053)

* add permissions methods to api list

* add requestPermissionsAsync and getPermissionsAsync methods to TOC

* Suggestion in sentry guide (#7157)

* Suggestion in sentry guide

* identical changes to v36.0.0 docs

* [android][task-manager] Task manager for bare in Expo (#6828)

Task manager for bare android and iOS applications.

* [docs] fix app signing page (#7171)

* [docs] fix app signing page

* unversioned

* typo

* [android] remove SDK 33 code re-committed after 38ccf62

* [docs] Update ‘using-firebase’ guide with Analytics section (#7145)

* [docs] Update ‘using-firebase’ guide with Analytics section

* [docs] Add missing `expo-firebase-core` dep to ‘usinig-firebase’ doc

* Update docs/pages/versions/unversioned/guides/using-firebase.md

Co-Authored-By: Brent Vatne <brentvatne@gmail.com>

* [jest-expo-enzyme] publish 1.0.0

* Update expo-module-scripts dependency (#7175)

* [docs] Custom fonts guide update

Work in progress

* [docs] Updating guide to using custom fonts

I made some updates to the guide for using custom fonts.

Changes include:
- Using Snacks for examples
- Using the `useFonts` hook for a simpler example
- Example of loading a remote font
- Discussion of font formats

* Update docs/pages/versions/unversioned/guides/using-custom-fonts.md

Co-Authored-By: Brent Vatne <brentvatne@gmail.com>

* Update docs/pages/versions/unversioned/guides/using-custom-fonts.md

Co-Authored-By: Cedric van Putten <me@bycedric.com>

* Update docs/pages/versions/unversioned/guides/using-custom-fonts.md

Co-Authored-By: Brent Vatne <brentvatne@gmail.com>

Co-authored-by: Tomasz Sapeta <1714764+tsapeta@users.noreply.github.com>
Co-authored-by: Charlie Cruzan <35579283+cruzach@users.noreply.github.com>
Co-authored-by: Evan Bacon <baconbrix@gmail.com>
Co-authored-by: Eric Samelson <esamelson@users.noreply.github.com>
Co-authored-by: Saumya Sharma <saumyasharma010@gmail.com>
Co-authored-by: James Ide <ide@users.noreply.github.com>
Co-authored-by: Łukasz Kosmaty <lukasz.kosmaty@student.uj.edu.pl>
Co-authored-by: Dominik Sokal <dominiksokal@gmail.com>
Co-authored-by: Hein Rutjes <IjzerenHein@users.noreply.github.com>
Co-authored-by: Bartłomiej Bukowski <bartlomiejbukowski.b@gmail.com>
Co-authored-by: briefjudofox <1484049+briefjudofox@users.noreply.github.com>
Co-authored-by: Michał Czernek <czernekmichal@gmail.com>
Co-authored-by: Stanisław Chmiela <sjchmiela@users.noreply.github.com>
Co-authored-by: Ziv Levy <zivl@users.noreply.github.com>
Co-authored-by: Nishant Singh <saysnishant@gmail.com>
Co-authored-by: Brent Vatne <brentvatne@gmail.com>
Co-authored-by: Cedric van Putten <me@bycedric.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants