Skip to content
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

Update plugin to support multiple plugins in the same project #41

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
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
2 changes: 0 additions & 2 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ end

target 'Plugin' do
capacitor_pods

pod 'Firebase/Core'
pod 'Firebase/Analytics'
end

Expand Down
Loading