Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Upgrade Fabric/Crashlytics to new FirebaseCrashlytics#1699

Merged
EddyVerbruggen merged 7 commits into
EddyVerbruggen:masterfrom
apolloai:feature/firebase-crashlytics-upgrade
Oct 30, 2020
Merged

Upgrade Fabric/Crashlytics to new FirebaseCrashlytics#1699
EddyVerbruggen merged 7 commits into
EddyVerbruggen:masterfrom
apolloai:feature/firebase-crashlytics-upgrade

Conversation

@kl4n4
Copy link
Copy Markdown
Contributor

@kl4n4 kl4n4 commented Oct 11, 2020

As discussed in #1642 Google is deprecating the Fabric Crashlytics SDK on November 15, 2020 so to continue the crashlytics support for this plugin it has to be upgraded to the new FirebaseCrashlytics SDK

My colleague @000panther and myself upgraded the Android and iOS specific SDKs to the new dependencies and new API. For iOS I also was able to remove the custom wrapper library TNSCrashlyticsLogger since it is no longer needed - just as its creator @kanclalg suggested.

Known issues/open tasks:

Please feel free to test it yourselves and give us feedback.

Paul Weber and others added 3 commits October 5, 2020 17:19
@kl4n4 kl4n4 marked this pull request as draft October 11, 2020 16:31
@kl4n4 kl4n4 marked this pull request as ready for review October 11, 2020 16:31
Comment thread src/firebase.ios.ts Outdated
if (arg.crashlyticsCollectionEnabled && typeof (Crashlytics) !== "undefined") {
Fabric.with(NSArray.arrayWithObject(Crashlytics.class()));
}
// if (arg.crashlyticsCollectionEnabled && typeof (Crashlytics) !== "undefined") {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should this be removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yes, you are right I unfortunately missed to clean up that code.
For reference: now only FIRApp.configure() should be necessary to initialize the new crashlytics SDK (which is done a few lines above).

}
}

export function setString(key: string, value: string): void {
Copy link
Copy Markdown

@Codex- Codex- Oct 16, 2020

Choose a reason for hiding this comment

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

Since all these methods deeply call the same method, perhaps mark the parent typings for these methods as deprecated and add a singular function to replace them? Would make it easier to digest / consume.

Seems to be that way for both the Android & iOS versions

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The reason that I did not do what you recommended was to keep the change size and the impact on the existing api minimal, to have a quick solution that can be used on 15th of November. I think that this refactoring should be done, but maybe not right now.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This would only add to the API, not remove used API's, marking deprecated just prepares people for the future removal is all.

@@ -5,72 +5,69 @@ declare const com: any;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

import * as appModule from 'tns-core-modules/application'; should be removed, not ns7 compat

export function crash(): void {
if (isCrashlyticsAvailable()) {
Crashlytics.sharedInstance().crash();
// TODO: manually force crash - https://firebase.google.com/docs/crashlytics/test-implementation?authuser=0&platform=ios#force_a_crash_to_test_your_implementation
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

From my understanding, you can crash with:

    NSException.exceptionWithNameReasonUserInfo(
      "FIRCrashlytics",
      "test crash",
      null
    ).raise();

I tested this in a demo app I made quickly (since the one in this repo isn't working for me):

***** Fatal JavaScript exception - application has been terminated. *****
NativeScript encountered a fatal error: Uncaught Error: test crash

...

*** First throw call stack:
...

@EddyVerbruggen
Copy link
Copy Markdown
Owner

Many thanks to all involved! ❤️

I've just published 10.6.0 to npm which includes these changes.

I'm now going to attempt to make this {N}7 compatible as well.

EddyVerbruggen added a commit that referenced this pull request Nov 2, 2020
…requires a setting in Xcode to be flipped on every release build)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants