woocommerce / woocommerce-android

WooCommerce Android app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
277 stars 135 forks source link

[Wear App] Add Sentry support #12225

Closed ThomazFB closed 2 months ago

ThomazFB commented 2 months ago

Summary

After the recent events with the Wear app crash detected in the Play Store console, the need for Sentry adoption in the Wear app became high priority.

The WCAndroid code base approaches Sentry support through the Automattic-Tracks-Android library, which is directly imported into the app dependencies. This library works by linking the FluxC account and storing data with the app context through the CrashLoggingDataProvider interface delegated by the SentryCrashLogging . We can see this happening in the WCCrashLoggingDataProvider class.

Solution

Pocket Casts uses a build-time tag to differentiate Mobile from Wear crashes alongside a modular strategy to allow the Crash Logging logic available to both Wear and Mobile apps. We can use something similar for WCAndroid, coupling the Wear app reports to the same Mobile project.

However, since we don’t have a fully modular architecture in the WCAndroid project, we can resort to the commons module that’s used for declaring code used by both Mobile and Wear modules. The solution start point is moving the CrashLogging code to that module.

### Tasks
- [x] Introduce the Automattic-Tracks-Android to the commons module https://github.com/woocommerce/woocommerce-android/pull/12233
- [x] Create the Wear counterpart of the `WCCrashLoggingDataProvider` class https://github.com/woocommerce/woocommerce-android/pull/12233
- [x] Support sending Settings from the Phone to the Wear https://github.com/woocommerce/woocommerce-android/pull/12280
- [x] Prepare the WCAndroid Sentry project with the Wear connection https://github.com/woocommerce/woocommerce-android/pull/12313
- [x] Test both Mobile and Wear reports are working as expected
dangermattic commented 2 months ago

Thanks for reporting! 👍