Skip to content

Commit

Permalink
firebase analytics poc
Browse files Browse the repository at this point in the history
  • Loading branch information
oriefrati committed Mar 11, 2024
1 parent d043f77 commit 61b83e4
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@
ReferencedContainer = "container:Locomotion.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "-FIRDebugEnabled"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "-FIRAnalyticsDebugEnabled"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
7 changes: 4 additions & 3 deletions examples/client/Locomotion/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,18 @@ target 'Locomotion' do
# Note that if you have use_frameworks! / use_modular_headers! enabled, Flipper will not work and
# you should disable the next line.
# use_flipper!()

# use_frameworks!

post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
installer.pods_project.targets.each do |target|
if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"

target.build_configurations.each do |config|
config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
end
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', '_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION']
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = "arm64"
end
end
end
Expand Down
72 changes: 70 additions & 2 deletions examples/client/Locomotion/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,34 @@ PODS:
- React-Core (= 0.68.5)
- React-jsi (= 0.68.5)
- ReactCommon/turbomodule/core (= 0.68.5)
- Firebase/Analytics (8.15.0):
- Firebase/Core
- Firebase/Core (8.15.0):
- Firebase/CoreOnly
- FirebaseAnalytics (~> 8.15.0)
- Firebase/CoreOnly (8.15.0):
- FirebaseCore (= 8.15.0)
- Firebase/Crashlytics (8.15.0):
- Firebase/CoreOnly
- FirebaseCrashlytics (~> 8.15.0)
- FirebaseAnalytics (8.15.0):
- FirebaseAnalytics/AdIdSupport (= 8.15.0)
- FirebaseCore (~> 8.0)
- FirebaseInstallations (~> 8.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.7)
- GoogleUtilities/MethodSwizzler (~> 7.7)
- GoogleUtilities/Network (~> 7.7)
- "GoogleUtilities/NSData+zlib (~> 7.7)"
- nanopb (~> 2.30908.0)
- FirebaseAnalytics/AdIdSupport (8.15.0):
- FirebaseCore (~> 8.0)
- FirebaseInstallations (~> 8.0)
- GoogleAppMeasurement (= 8.15.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.7)
- GoogleUtilities/MethodSwizzler (~> 7.7)
- GoogleUtilities/Network (~> 7.7)
- "GoogleUtilities/NSData+zlib (~> 7.7)"
- nanopb (~> 2.30908.0)
- FirebaseCore (8.15.0):
- FirebaseCoreDiagnostics (~> 8.0)
- GoogleUtilities/Environment (~> 7.7)
Expand Down Expand Up @@ -58,6 +81,26 @@ PODS:
- GoogleMaps
- Google-Maps-iOS-Utils/QuadTree (4.1.0):
- GoogleMaps
- GoogleAppMeasurement (8.15.0):
- GoogleAppMeasurement/AdIdSupport (= 8.15.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.7)
- GoogleUtilities/MethodSwizzler (~> 7.7)
- GoogleUtilities/Network (~> 7.7)
- "GoogleUtilities/NSData+zlib (~> 7.7)"
- nanopb (~> 2.30908.0)
- GoogleAppMeasurement/AdIdSupport (8.15.0):
- GoogleAppMeasurement/WithoutAdIdSupport (= 8.15.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.7)
- GoogleUtilities/MethodSwizzler (~> 7.7)
- GoogleUtilities/Network (~> 7.7)
- "GoogleUtilities/NSData+zlib (~> 7.7)"
- nanopb (~> 2.30908.0)
- GoogleAppMeasurement/WithoutAdIdSupport (8.15.0):
- GoogleUtilities/AppDelegateSwizzler (~> 7.7)
- GoogleUtilities/MethodSwizzler (~> 7.7)
- GoogleUtilities/Network (~> 7.7)
- "GoogleUtilities/NSData+zlib (~> 7.7)"
- nanopb (~> 2.30908.0)
- GoogleDataTransport (9.2.5):
- GoogleUtilities/Environment (~> 7.7)
- nanopb (< 2.30910.0, >= 2.30908.0)
Expand All @@ -67,10 +110,23 @@ PODS:
- GoogleMaps/Base (7.3.0)
- GoogleMaps/Maps (7.3.0):
- GoogleMaps/Base
- GoogleUtilities/AppDelegateSwizzler (7.11.5):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Environment (7.11.5):
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/Logger (7.11.5):
- GoogleUtilities/Environment
- GoogleUtilities/MethodSwizzler (7.11.5):
- GoogleUtilities/Logger
- GoogleUtilities/Network (7.11.5):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (7.11.5)"
- GoogleUtilities/Reachability (7.11.5):
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (7.11.5):
- GoogleUtilities/Logger
- libwebp (1.3.1):
Expand Down Expand Up @@ -440,6 +496,10 @@ PODS:
- React-Core
- SDWebImage (~> 5.11.1)
- SDWebImageWebPCoder (~> 0.8.4)
- RNFBAnalytics (14.12.0):
- Firebase/Analytics (= 8.15.0)
- React-Core
- RNFBApp
- RNFBApp (14.12.0):
- Firebase/CoreOnly (= 8.15.0)
- React-Core
Expand Down Expand Up @@ -572,6 +632,7 @@ DEPENDENCIES:
- RNDeviceInfo (from `../node_modules/react-native-device-info`)
- RNExitApp (from `../node_modules/react-native-exit-app`)
- RNFastImage (from `../node_modules/react-native-fast-image`)
- "RNFBAnalytics (from `../node_modules/@react-native-firebase/analytics`)"
- "RNFBApp (from `../node_modules/@react-native-firebase/app`)"
- "RNFBCrashlytics (from `../node_modules/@react-native-firebase/crashlytics`)"
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
Expand All @@ -585,12 +646,14 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- Firebase
- FirebaseAnalytics
- FirebaseCore
- FirebaseCoreDiagnostics
- FirebaseCrashlytics
- FirebaseInstallations
- fmt
- Google-Maps-iOS-Utils
- GoogleAppMeasurement
- GoogleDataTransport
- GoogleMaps
- GoogleUtilities
Expand Down Expand Up @@ -722,6 +785,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-exit-app"
RNFastImage:
:path: "../node_modules/react-native-fast-image"
RNFBAnalytics:
:path: "../node_modules/@react-native-firebase/analytics"
RNFBApp:
:path: "../node_modules/@react-native-firebase/app"
RNFBCrashlytics:
Expand All @@ -748,13 +813,15 @@ SPEC CHECKSUMS:
FBLazyVector: 2b47ff52037bd9ae07cc9b051c9975797814b736
FBReactNativeSpec: 0e0d384ef17a33b385f13f0c7f97702c7cd17858
Firebase: 5f8193dff4b5b7c5d5ef72ae54bb76c08e2b841d
FirebaseAnalytics: 7761cbadb00a717d8d0939363eb46041526474fa
FirebaseCore: 5743c5785c074a794d35f2fff7ecc254a91e08b1
FirebaseCoreDiagnostics: 92e07a649aeb66352b319d43bdd2ee3942af84cb
FirebaseCrashlytics: feb07e4e9187be3c23c6a846cce4824e5ce2dd0b
FirebaseInstallations: 40bd9054049b2eae9a2c38ef1c3dd213df3605cd
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 476ee3e89abb49e07f822b48323c51c57124b572
Google-Maps-iOS-Utils: 3343332b18dfd5be8f1f44edd7d481ace3da4d9a
GoogleAppMeasurement: 4c19f031220c72464d460c9daa1fb5d1acce958e
GoogleDataTransport: 54dee9d48d14580407f8f5fbf2f496e92437a2f2
GoogleMaps: a146f275ee429d14822178c7a841c03366ec92a1
GoogleUtilities: 13e2c67ede716b8741c7989e26893d151b2b2084
Expand Down Expand Up @@ -814,6 +881,7 @@ SPEC CHECKSUMS:
RNDeviceInfo: af47a7d1a09d64c8cbb8b0c883db9bca422a9813
RNExitApp: 7d81855142a4d11eb75f4f06fdebf5a950d7aef2
RNFastImage: 3207b9eb17c2425d574ca40db35185db6e324f4e
RNFBAnalytics: ea1421b49a0bf5e5bb7274df4a330713d0e85d2e
RNFBApp: e4439717c23252458da2b41b81b4b475c86f90c4
RNFBCrashlytics: 94e1f78e2a9aa9e02edbfb0d3f1f0921ce00094b
RNGestureHandler: c0d04458598fcb26052494ae23dda8f8f5162b13
Expand All @@ -831,6 +899,6 @@ SPEC CHECKSUMS:
StripeUICore: 08c1efbd7e3c54ee7fa74334a37a1d4c08ba944d
Yoga: c4d61225a466f250c35c1ee78d2d0b3d41fe661c

PODFILE CHECKSUM: 42909390370d7a65830c84fab99e66e070f1b4f9
PODFILE CHECKSUM: 0c7516c45cfa76aa6e5619c0fe93f86017635593

COCOAPODS: 1.12.1
COCOAPODS: 1.15.2
5 changes: 5 additions & 0 deletions examples/client/Locomotion/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/client/Locomotion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@react-native-community/clipboard": "^1.5.1",
"@react-native-community/geolocation": "^2.0.2",
"@react-native-community/netinfo": "^9.3.7",
"@react-native-firebase/analytics": "^14.12.0",
"@react-native-firebase/app": "^14.11.1",
"@react-native-firebase/crashlytics": "^14.11.1",
"@react-native-picker/picker": "^2.4.1",
Expand Down
10 changes: 9 additions & 1 deletion examples/client/Locomotion/src/LocomotionRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { PortalProvider } from '@gorhom/portal';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import crashlytics from '@react-native-firebase/crashlytics';
import { NavigationContainer } from '@react-navigation/native';
import analytics from '@react-native-firebase/analytics';
import i18n from './I18n';
import { MainProvider, RideStateContextContextProvider } from './context';
import MainRouter from './pages';
Expand All @@ -23,7 +24,14 @@ LogBox.ignoreAllLogs();
export default (props) => {
const navigatorRef = useRef(null);
const appStateRef = useRef(AppState.currentState);

(async () => {
const appInstanceId = await analytics().getAppInstanceId();
console.log('appInstanceId', appInstanceId);
const ana = await analytics().logEvent('loadPage', {
id: 3745092,
});
console.log('analytics', ana);
})();
const registerAppStateListener = () => AppState.addEventListener('change', (appState) => {
const properties = { newAppState: appState, currentAppState: appStateRef.current };
if (appState === 'active' && appState !== appStateRef.current) {
Expand Down
2 changes: 2 additions & 0 deletions examples/client/Locomotion/src/services/firebase.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import crashlytics from '@react-native-firebase/crashlytics';
import { firebase } from '@react-native-firebase/analytics';

class Firebase {
constructor(enable = false) {
this.crashlytics = crashlytics();
firebase.analytics().setAnalyticsCollectionEnabled(true);
}
}

Expand Down

0 comments on commit 61b83e4

Please sign in to comment.