From 215ad5bb6da8baa737b13b202fad3babfc3f4d72 Mon Sep 17 00:00:00 2001 From: Trey t Date: Fri, 11 Mar 2022 10:32:12 -0600 Subject: [PATCH] add in firebase logging --- Feels.xcodeproj/project.pbxproj | 37 ++++++ .../xcshareddata/swiftpm/Package.resolved | 108 ++++++++++++++++++ .../xcschemes/xcschememanagement.plist | 29 ++++- Shared/AppDelegate.swift | 5 +- Shared/EventLogger.swift | 15 +++ Shared/GoogleService-Info.plist | 34 ++++++ 6 files changed, 223 insertions(+), 5 deletions(-) create mode 100644 Shared/EventLogger.swift create mode 100644 Shared/GoogleService-Info.plist diff --git a/Feels.xcodeproj/project.pbxproj b/Feels.xcodeproj/project.pbxproj index aa66921..d243529 100644 --- a/Feels.xcodeproj/project.pbxproj +++ b/Feels.xcodeproj/project.pbxproj @@ -53,6 +53,11 @@ 1C414BF127D3CAB300BC1720 /* OnboardingData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C5F4975279C84090092F1B4 /* OnboardingData.swift */; }; 1C414BF527D3CB2200BC1720 /* OnboardingDay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CA03774279A294800D26164 /* OnboardingDay.swift */; }; 1C414C0F27D51FB500BC1720 /* EntryListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C414C0E27D51FB500BC1720 /* EntryListView.swift */; }; + 1C414C2A27DB1AF900BC1720 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1C414C2927DB1AF900BC1720 /* GoogleService-Info.plist */; }; + 1C414C2B27DB1AF900BC1720 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1C414C2927DB1AF900BC1720 /* GoogleService-Info.plist */; }; + 1C414C2E27DB1B9B00BC1720 /* FirebaseAnalyticsWithoutAdIdSupport in Frameworks */ = {isa = PBXBuildFile; productRef = 1C414C2D27DB1B9B00BC1720 /* FirebaseAnalyticsWithoutAdIdSupport */; }; + 1C414C3027DB1C2400BC1720 /* EventLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C414C2F27DB1C2400BC1720 /* EventLogger.swift */; }; + 1C414C3327DB1CCE00BC1720 /* FirebaseAnalyticsWithoutAdIdSupport in Frameworks */ = {isa = PBXBuildFile; productRef = 1C414C3227DB1CCE00BC1720 /* FirebaseAnalyticsWithoutAdIdSupport */; }; 1C4FF3BB27BEDDF000BE8F34 /* ShowBasedOnVoteLogics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C4FF3BA27BEDDF000BE8F34 /* ShowBasedOnVoteLogics.swift */; }; 1C4FF3BC27BEDF6600BE8F34 /* ShowBasedOnVoteLogics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C4FF3BA27BEDDF000BE8F34 /* ShowBasedOnVoteLogics.swift */; }; 1C4FF3BE27BEDF9100BE8F34 /* PersistenceHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C4FF3BD27BEDF9100BE8F34 /* PersistenceHelper.swift */; }; @@ -198,6 +203,8 @@ 1C361F1327C03C8600E832FC /* OnboardingDataDataManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingDataDataManager.swift; sourceTree = ""; }; 1C361F1627C046D800E832FC /* MonthDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MonthDetailView.swift; sourceTree = ""; }; 1C414C0E27D51FB500BC1720 /* EntryListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntryListView.swift; sourceTree = ""; }; + 1C414C2927DB1AF900BC1720 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; + 1C414C2F27DB1C2400BC1720 /* EventLogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventLogger.swift; sourceTree = ""; }; 1C4FF3BA27BEDDF000BE8F34 /* ShowBasedOnVoteLogics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShowBasedOnVoteLogics.swift; sourceTree = ""; }; 1C4FF3BD27BEDF9100BE8F34 /* PersistenceHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistenceHelper.swift; sourceTree = ""; }; 1C4FF3BF27BEE06900BE8F34 /* PersistenceGET.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistenceGET.swift; sourceTree = ""; }; @@ -272,6 +279,7 @@ 1C747CC9279F06EB00762CBD /* CloudKitSyncMonitor in Frameworks */, 1CD90B6C278C7F78001C4FEA /* CloudKit.framework in Frameworks */, 1C2618FA2795E41D00FDC148 /* Charts in Frameworks */, + 1C414C2E27DB1B9B00BC1720 /* FirebaseAnalyticsWithoutAdIdSupport in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -303,6 +311,7 @@ 1CD90B6E278C7F8B001C4FEA /* CloudKit.framework in Frameworks */, 1CD90B4A278C7E7A001C4FEA /* SwiftUI.framework in Frameworks */, 1CD90B48278C7E7A001C4FEA /* WidgetKit.framework in Frameworks */, + 1C414C3327DB1CCE00BC1720 /* FirebaseAnalyticsWithoutAdIdSupport in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -485,9 +494,11 @@ 1CD90AEA278C7DDF001C4FEA /* Shared */ = { isa = PBXGroup; children = ( + 1C414C2927DB1AF900BC1720 /* GoogleService-Info.plist */, 1CD90AED278C7DDF001C4FEA /* FeelsApp.swift */, 1C744F2B278CE15600953A57 /* AppDelegate.swift */, 1CC469A9278F30A0003E0C6E /* BGTask.swift */, + 1C414C2F27DB1C2400BC1720 /* EventLogger.swift */, 1CD90B75278C8119001C4FEA /* LocalNotification.swift */, 1C4FF3C527BEE07800BE8F34 /* Persisence */, 1CD90B5C278C7EAD001C4FEA /* Random.swift */, @@ -603,6 +614,7 @@ packageProductDependencies = ( 1C2618F92795E41D00FDC148 /* Charts */, 1C747CC8279F06EB00762CBD /* CloudKitSyncMonitor */, + 1C414C2D27DB1B9B00BC1720 /* FirebaseAnalyticsWithoutAdIdSupport */, ); productName = "Feels (iOS)"; productReference = 1CD90AF5278C7DE0001C4FEA /* iFeel.app */; @@ -674,6 +686,9 @@ dependencies = ( ); name = FeelsWidgetExtension; + packageProductDependencies = ( + 1C414C3227DB1CCE00BC1720 /* FirebaseAnalyticsWithoutAdIdSupport */, + ); productName = FeelsWidgetExtension; productReference = 1CD90B45278C7E7A001C4FEA /* FeelsWidgetExtension.appex */; productType = "com.apple.product-type.app-extension"; @@ -720,6 +735,7 @@ packageReferences = ( 1C2618F82795E41D00FDC148 /* XCRemoteSwiftPackageReference "ChartsPackage" */, 1C747CC7279F06EB00762CBD /* XCRemoteSwiftPackageReference "CloudKitSyncMonitor" */, + 1C414C2C27DB1B9B00BC1720 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */, ); productRefGroup = 1CD90AF6278C7DE0001C4FEA /* Products */; projectDirPath = ""; @@ -741,6 +757,7 @@ files = ( 1CD90B1E278C7DE0001C4FEA /* Assets.xcassets in Resources */, 1C0DAB45279DB0FB003B1F21 /* Localizable.strings in Resources */, + 1C414C2A27DB1AF900BC1720 /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -771,6 +788,7 @@ buildActionMask = 2147483647; files = ( 1CD90B50278C7E7A001C4FEA /* Assets.xcassets in Resources */, + 1C414C2B27DB1AF900BC1720 /* GoogleService-Info.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -834,6 +852,7 @@ 1CA0377A279A296E00D26164 /* OnboardingMain.swift in Sources */, 1C358FBA27B35252002C83A6 /* ActivityViewController.swift in Sources */, 1C5F4978279C945E0092F1B4 /* UserDefaultsStore.swift in Sources */, + 1C414C3027DB1C2400BC1720 /* EventLogger.swift in Sources */, 1CD90B18278C7DE0001C4FEA /* FeelsApp.swift in Sources */, 1C358FC027B4D20C002C83A6 /* MonthTotalTemplate.swift in Sources */, 1CA03777279A295600D26164 /* OnboardingTitle.swift in Sources */, @@ -1411,6 +1430,14 @@ kind = branch; }; }; + 1C414C2C27DB1B9B00BC1720 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/firebase/firebase-ios-sdk"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 8.0.0; + }; + }; 1C747CC7279F06EB00762CBD /* XCRemoteSwiftPackageReference "CloudKitSyncMonitor" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/ggruen/CloudKitSyncMonitor"; @@ -1427,6 +1454,16 @@ package = 1C2618F82795E41D00FDC148 /* XCRemoteSwiftPackageReference "ChartsPackage" */; productName = Charts; }; + 1C414C2D27DB1B9B00BC1720 /* FirebaseAnalyticsWithoutAdIdSupport */ = { + isa = XCSwiftPackageProductDependency; + package = 1C414C2C27DB1B9B00BC1720 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseAnalyticsWithoutAdIdSupport; + }; + 1C414C3227DB1CCE00BC1720 /* FirebaseAnalyticsWithoutAdIdSupport */ = { + isa = XCSwiftPackageProductDependency; + package = 1C414C2C27DB1B9B00BC1720 /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */; + productName = FirebaseAnalyticsWithoutAdIdSupport; + }; 1C747CC8279F06EB00762CBD /* CloudKitSyncMonitor */ = { isa = XCSwiftPackageProductDependency; package = 1C747CC7279F06EB00762CBD /* XCRemoteSwiftPackageReference "CloudKitSyncMonitor" */; diff --git a/Feels.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Feels.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index c705fc2..7fa445f 100644 --- a/Feels.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Feels.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,6 +1,24 @@ { "object": { "pins": [ + { + "package": "abseil", + "repositoryURL": "https://github.com/firebase/abseil-cpp-SwiftPM.git", + "state": { + "branch": null, + "revision": "fffc3c2729be5747390ad02d5100291a0d9ad26a", + "version": "0.20200225.4" + } + }, + { + "package": "BoringSSL-GRPC", + "repositoryURL": "https://github.com/firebase/boringssl-SwiftPM.git", + "state": { + "branch": null, + "revision": "734a8247442fde37df4364c21f6a0085b6a36728", + "version": "0.7.2" + } + }, { "package": "ChartsPackage", "repositoryURL": "https://github.com/akatreyt/ChartsPackage", @@ -19,6 +37,87 @@ "version": "1.1.1" } }, + { + "package": "Firebase", + "repositoryURL": "https://github.com/firebase/firebase-ios-sdk", + "state": { + "branch": null, + "revision": "d4c4e8c7b8898ea771e90beab71112ea279d73a5", + "version": "8.13.0" + } + }, + { + "package": "GoogleAppMeasurement", + "repositoryURL": "https://github.com/google/GoogleAppMeasurement.git", + "state": { + "branch": null, + "revision": "6cc2991c11872510a5314bc112cc7558dd9d046a", + "version": "8.12.0" + } + }, + { + "package": "GoogleDataTransport", + "repositoryURL": "https://github.com/google/GoogleDataTransport.git", + "state": { + "branch": null, + "revision": "15ccdfd25ac55b9239b82809531ff26605e7556e", + "version": "9.1.2" + } + }, + { + "package": "GoogleUtilities", + "repositoryURL": "https://github.com/google/GoogleUtilities.git", + "state": { + "branch": null, + "revision": "b3bb0c5551fb3f80ca939829639ab5b093edd14f", + "version": "7.7.0" + } + }, + { + "package": "gRPC", + "repositoryURL": "https://github.com/firebase/grpc-SwiftPM.git", + "state": { + "branch": null, + "revision": "fb405dd2c7901485f7e158b24e3a0a47e4efd8b5", + "version": "1.28.4" + } + }, + { + "package": "GTMSessionFetcher", + "repositoryURL": "https://github.com/google/gtm-session-fetcher.git", + "state": { + "branch": null, + "revision": "bc6a19702ac76ac4e488b68148710eb815f9bc56", + "version": "1.7.0" + } + }, + { + "package": "leveldb", + "repositoryURL": "https://github.com/firebase/leveldb.git", + "state": { + "branch": null, + "revision": "0706abcc6b0bd9cedfbb015ba840e4a780b5159b", + "version": "1.22.2" + } + }, + { + "package": "nanopb", + "repositoryURL": "https://github.com/firebase/nanopb.git", + "state": { + "branch": null, + "revision": "7ee9ef9f627d85cbe1b8c4f49a3ed26eed216c77", + "version": "2.30908.0" + } + }, + { + "package": "Promises", + "repositoryURL": "https://github.com/google/promises.git", + "state": { + "branch": null, + "revision": "611337c330350c9c1823ad6d671e7f936af5ee13", + "version": "2.0.0" + } + }, { "package": "swift-algorithms", "repositoryURL": "https://github.com/apple/swift-algorithms", @@ -36,6 +135,15 @@ "revision": "6583ac70c326c3ee080c1d42d9ca3361dca816cd", "version": "0.1.0" } + }, + { + "package": "SwiftProtobuf", + "repositoryURL": "https://github.com/apple/swift-protobuf.git", + "state": { + "branch": null, + "revision": "e1499bc69b9040b29184f7f2996f7bab467c1639", + "version": "1.19.0" + } } ] }, diff --git a/Feels.xcodeproj/xcuserdata/treyt.xcuserdatad/xcschemes/xcschememanagement.plist b/Feels.xcodeproj/xcuserdata/treyt.xcuserdatad/xcschemes/xcschememanagement.plist index 8f6b7bc..78042d3 100644 --- a/Feels.xcodeproj/xcuserdata/treyt.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Feels.xcodeproj/xcuserdata/treyt.xcuserdatad/xcschemes/xcschememanagement.plist @@ -12,7 +12,7 @@ Feels (macOS).xcscheme_^#shared#^_ orderHint - 2 + 3 FeelsWidgetExtension.xcscheme_^#shared#^_ @@ -24,7 +24,7 @@ isShown orderHint - 4 + 5 PlaygroundChart (Playground) 10.xcscheme @@ -66,7 +66,7 @@ isShown orderHint - 5 + 6 PlaygroundChart (Playground) 3.xcscheme @@ -122,7 +122,28 @@ isShown orderHint - 3 + 4 + + Promises (Playground) 1.xcscheme + + isShown + + orderHint + 7 + + Promises (Playground) 2.xcscheme + + isShown + + orderHint + 8 + + Promises (Playground).xcscheme + + isShown + + orderHint + 2 SuppressBuildableAutocreation diff --git a/Shared/AppDelegate.swift b/Shared/AppDelegate.swift index f5aae45..f22b753 100644 --- a/Shared/AppDelegate.swift +++ b/Shared/AppDelegate.swift @@ -10,6 +10,7 @@ import UserNotifications import UIKit import WidgetKit import SwiftUI +import Firebase class AppDelegate: NSObject, UIApplicationDelegate { private let savedOnboardingData = UserDefaultsStore.getOnboarding() @@ -20,7 +21,7 @@ class AppDelegate: NSObject, UIApplicationDelegate { // PersistenceController.shared.deleteLast(numberOfEntries: 5) // GroupUserDefaults.groupDefaults.set(false, forKey: UserDefaultsStore.Keys.showNSFW.rawValue) - + FirebaseApp.configure() PersistenceController.shared.removeNoForDates() PersistenceController.shared.fillInMissingDates() UNUserNotificationCenter.current().delegate = self @@ -33,6 +34,8 @@ class AppDelegate: NSObject, UIApplicationDelegate { UITabBar.appearance().standardAppearance = appearance UITabBar.appearance().scrollEdgeAppearance = appearance + EventLogger.log(event: "app_launced") + return true } diff --git a/Shared/EventLogger.swift b/Shared/EventLogger.swift new file mode 100644 index 0000000..1ed2610 --- /dev/null +++ b/Shared/EventLogger.swift @@ -0,0 +1,15 @@ +// +// EventLogger.swift +// Feels +// +// Created by Trey Tartt on 3/10/22. +// + +import Foundation +import Firebase + +class EventLogger { + static func log(event: String, withData data: [String: Any]? = nil) { + Analytics.logEvent(event, parameters: data) + } +} diff --git a/Shared/GoogleService-Info.plist b/Shared/GoogleService-Info.plist new file mode 100644 index 0000000..e14813c --- /dev/null +++ b/Shared/GoogleService-Info.plist @@ -0,0 +1,34 @@ + + + + + CLIENT_ID + 113402203908-pp7g3udve7koa6tmmovrdj83kq2egugd.apps.googleusercontent.com + REVERSED_CLIENT_ID + com.googleusercontent.apps.113402203908-pp7g3udve7koa6tmmovrdj83kq2egugd + API_KEY + AIzaSyDtkxvslzC5Fv3n-JfXqvIY6rTZrNCOh5E + GCM_SENDER_ID + 113402203908 + PLIST_VERSION + 1 + BUNDLE_ID + com.88oak.ifeelDebug2 + PROJECT_ID + ifeeldev-5b1ad + STORAGE_BUCKET + ifeeldev-5b1ad.appspot.com + IS_ADS_ENABLED + + IS_ANALYTICS_ENABLED + + IS_APPINVITE_ENABLED + + IS_GCM_ENABLED + + IS_SIGNIN_ENABLED + + GOOGLE_APP_ID + 1:113402203908:ios:90d3fb2e367af0adab4a51 + + \ No newline at end of file