Skip to content

Commit

Permalink
fixed [bug] method setScreenName is no longer supported.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mickey Mokotov committed Jun 6, 2021
1 parent 8fa1827 commit bb1d0ff
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 52 deletions.
16 changes: 1 addition & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ git checkout -b firebase-analytics
| setUserId ||||
| setUserProperty ||||
| getAppInstanceId ||||
| setScreenName ||||
| reset ||||
| logEvent ||||
| setCollectionEnabled ||||
Expand Down Expand Up @@ -163,19 +162,6 @@ FirebaseAnalytics.setUserProperty({
*/
FirebaseAnalytics.getAppInstanceId();

/**
* Platform: Android/iOS
* Sets the current screen name, which specifies the current visual context in your app.
* @param screenName - name of the current screen to track
* nameOverride - name of the screen class to override
* @returns instanceId - individual instance id value
* https://firebase.google.com/docs/analytics/screenviews
*/
FirebaseAnalytics.setScreenName({
screenName: "login",
nameOverride: "LoginScreen",
});

/**
* Platform: Web/Android/iOS
* Clears all analytics data for this app from the device and resets the app instance id.
Expand Down Expand Up @@ -307,7 +293,7 @@ If you were previously using the `capacitor-analytics` package from npm
2. on android's _MainActivity.java_ change the import path from `io.stewan.capacitor.analytics.AnalyticsPlugin;` to `com.getcapacitor.community.firebaseanalytics.FirebaseAnalytics;`
3. public api changes
- `instance()` is now `getAppInstanceId()`
- `setScreen()` is now `setScreenName()`
- `setScreenName()` removed, see https://firebase.googleblog.com/2020/08/google-analytics-manual-screen-view.html
- `setUserID()` is now `setUserId()`
- `setUserProp()` us now `setUserProperty()`

Expand Down
1 change: 0 additions & 1 deletion ios/Plugin/Plugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
CAP_PLUGIN_METHOD(setUserId, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(setUserProperty, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(getAppInstanceId, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(setScreenName, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(reset, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(logEvent, CAPPluginReturnPromise);
CAP_PLUGIN_METHOD(setCollectionEnabled, CAPPluginReturnPromise);
Expand Down
19 changes: 0 additions & 19 deletions ios/Plugin/Plugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,7 @@ public class FirebaseAnalytics: CAPPlugin {
"instanceId": instanceId
])
}


/// Sets the current screen name, which specifies the current visual context in your app.
/// - Parameter call: screenName - the activity to which the screen name and class name apply.
/// nameOverride - the name of the current screen. Set to null to clear the current screen name.
@objc func setScreenName(_ call: CAPPluginCall) {
if !call.hasOption("screenName") {
call.error("screenName property is missing")
return
}

let screenName = call.getString("screenName")
let nameOverride = call.getString("nameOverride") ?? nil

DispatchQueue.main.async {
Analytics.setScreenName(screenName, screenClass: nameOverride)
}
call.success()
}


/// Clears all analytics data for this app from the device and resets the app instance id.
@objc func reset(_ call: CAPPluginCall) {
Expand Down
4 changes: 0 additions & 4 deletions src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ export interface FirebaseAnalyticsPlugin {
setUserId(options: { userId: string }): Promise<void>;
setUserProperty(options: { name: string; value: string }): Promise<void>;
getAppInstanceId(): Promise<{ instanceId: string }>;
setScreenName(options: {
screenName: string;
nameOverride?: string;
}): Promise<void>;
reset(): Promise<void>;
logEvent(options: { name: string; params: object }): Promise<void>;
setCollectionEnabled(options: { enabled: boolean }): Promise<void>;
Expand Down
13 changes: 0 additions & 13 deletions src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,6 @@ export class FirebaseAnalyticsWeb extends WebPlugin
return new Promise((resolve, _reject) => resolve);
}

/**
* Sets the current screen name, which specifies the current visual context in your app.
* @param options - screenName: the activity to which the screen name and class name apply.
* nameOverride: the name of the current screen. Set to null to clear the current screen name.
* Platform: Android/iOS
*/
setScreenName(_options: {
screenName: string;
nameOverride: string;
}): Promise<void> {
return new Promise((resolve, _reject) => resolve);
}

/**
* Clears all analytics data for this app from the device and resets the app instance id.
* Platform: Android/iOS
Expand Down

0 comments on commit bb1d0ff

Please sign in to comment.