teachers-assistant

[RADIOACTIVE] oh boy did i make bad apps back in the day
git clone git://git.figbert.com/teachers-assistant.git
Log | Files | Refs

commit 32ae7a8db13b56c79333e6611baf200650655ccb
parent 94e86d17562f6a48dceac1f0686992aabae112fa
Author: Naomi Welner <naomi@Naomis-MacBook-Air.local>
Date:   Wed, 13 Mar 2019 17:50:09 -0700

Adding existing files

Diffstat:
M.DS_Store | 0
MPodfile | 2--
MPodfile.lock | 90+------------------------------------------------------------------------------
DPods/Firebase/CoreOnly/Sources/Firebase.h | 113-------------------------------------------------------------------------------
DPods/Firebase/CoreOnly/Sources/module.modulemap | 5-----
DPods/Firebase/README.md | 90-------------------------------------------------------------------------------
DPods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector | 0
DPods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/Modules/module.modulemap | 9---------
DPods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/FirebaseAnalytics | 0
DPods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics+AppDelegate.h | 62--------------------------------------------------------------
DPods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics.h | 119-------------------------------------------------------------------------------
DPods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIREventNames.h | 407-------------------------------------------------------------------------------
DPods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRParameterNames.h | 532-------------------------------------------------------------------------------
DPods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h | 17-----------------
DPods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h | 5-----
DPods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Modules/module.modulemap | 10----------
DPods/FirebaseAnalytics/Frameworks/FirebaseCoreDiagnostics.framework/FirebaseCoreDiagnostics | 0
DPods/FirebaseAnalytics/Frameworks/FirebaseCoreDiagnostics.framework/Modules/module.modulemap | 6------
DPods/FirebaseCore/Firebase/Core/FIRAnalyticsConfiguration.m | 69---------------------------------------------------------------------
DPods/FirebaseCore/Firebase/Core/FIRApp.m | 784-------------------------------------------------------------------------------
DPods/FirebaseCore/Firebase/Core/FIRAppAssociationRegistration.m | 47-----------------------------------------------
DPods/FirebaseCore/Firebase/Core/FIRBundleUtil.m | 57---------------------------------------------------------
DPods/FirebaseCore/Firebase/Core/FIRComponent.m | 65-----------------------------------------------------------------
DPods/FirebaseCore/Firebase/Core/FIRComponentContainer.m | 176-------------------------------------------------------------------------------
DPods/FirebaseCore/Firebase/Core/FIRComponentType.m | 28----------------------------
DPods/FirebaseCore/Firebase/Core/FIRConfiguration.m | 44--------------------------------------------
DPods/FirebaseCore/Firebase/Core/FIRDependency.m | 44--------------------------------------------
DPods/FirebaseCore/Firebase/Core/FIRErrors.m | 29-----------------------------
DPods/FirebaseCore/Firebase/Core/FIRLogger.m | 171-------------------------------------------------------------------------------
DPods/FirebaseCore/Firebase/Core/FIROptions.m | 443-------------------------------------------------------------------------------
DPods/FirebaseCore/Firebase/Core/FIRVersion.m | 33---------------------------------
DPods/FirebaseCore/Firebase/Core/Private/FIRAnalyticsConfiguration+Internal.h | 49-------------------------------------------------
DPods/FirebaseCore/Firebase/Core/Private/FIRAppAssociationRegistration.h | 49-------------------------------------------------
DPods/FirebaseCore/Firebase/Core/Private/FIRAppInternal.h | 182-------------------------------------------------------------------------------
DPods/FirebaseCore/Firebase/Core/Private/FIRBundleUtil.h | 52----------------------------------------------------
DPods/FirebaseCore/Firebase/Core/Private/FIRComponent.h | 91-------------------------------------------------------------------------------
DPods/FirebaseCore/Firebase/Core/Private/FIRComponentContainer.h | 44--------------------------------------------
DPods/FirebaseCore/Firebase/Core/Private/FIRComponentContainerInternal.h | 43-------------------------------------------
DPods/FirebaseCore/Firebase/Core/Private/FIRComponentType.h | 34----------------------------------
DPods/FirebaseCore/Firebase/Core/Private/FIRDependency.h | 45---------------------------------------------
DPods/FirebaseCore/Firebase/Core/Private/FIRErrorCode.h | 55-------------------------------------------------------
DPods/FirebaseCore/Firebase/Core/Private/FIRErrors.h | 33---------------------------------
DPods/FirebaseCore/Firebase/Core/Private/FIRLibrary.h | 44--------------------------------------------
DPods/FirebaseCore/Firebase/Core/Private/FIRLogger.h | 159-------------------------------------------------------------------------------
DPods/FirebaseCore/Firebase/Core/Private/FIROptionsInternal.h | 114-------------------------------------------------------------------------------
DPods/FirebaseCore/Firebase/Core/Private/FIRVersion.h | 23-----------------------
DPods/FirebaseCore/Firebase/Core/Public/FIRAnalyticsConfiguration.h | 55-------------------------------------------------------
DPods/FirebaseCore/Firebase/Core/Public/FIRApp.h | 127-------------------------------------------------------------------------------
DPods/FirebaseCore/Firebase/Core/Public/FIRConfiguration.h | 50--------------------------------------------------
DPods/FirebaseCore/Firebase/Core/Public/FIRLoggerLevel.h | 38--------------------------------------
DPods/FirebaseCore/Firebase/Core/Public/FIROptions.h | 116-------------------------------------------------------------------------------
DPods/FirebaseCore/Firebase/Core/Public/FirebaseCore.h | 21---------------------
DPods/FirebaseCore/LICENSE | 202-------------------------------------------------------------------------------
DPods/FirebaseCore/README.md | 197-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRIMessageCode.h | 155-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceID+Private.h | 55-------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceID+Private.m | 46----------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceID+Testing.h | 48------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceID.m | 1217-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDAPNSInfo.h | 64----------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDAPNSInfo.m | 79-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDAuthKeyChain.h | 98-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDAuthKeyChain.m | 219-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDAuthService.h | 91-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDAuthService.m | 302------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDBackupExcludedPlist.h | 89-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDBackupExcludedPlist.m | 200-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinPreferences+Internal.h | 64----------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinPreferences+Internal.m | 112-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinPreferences.h | 63---------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinPreferences.m | 97-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinPreferences_Private.h | 27---------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinService.h | 81-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinService.m | 223-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinStore.h | 108-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinStore.m | 239-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDConstants.h | 63---------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDConstants.m | 46----------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDDefines.h | 70----------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeyPair.h | 78------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeyPair.m | 73-------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeyPairStore.h | 85-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeyPairStore.m | 526-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeyPairUtilities.h | 36------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeyPairUtilities.m | 84-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeychain.h | 76----------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeychain.m | 175-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDLogger.h | 66------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDLogger.m | 92-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDStore.h | 183-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDStore.m | 232-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDStringEncoding.h | 66------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDStringEncoding.m | 202-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDTokenDeleteOperation.h | 31-------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDTokenDeleteOperation.m | 120-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDTokenFetchOperation.h | 29-----------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDTokenFetchOperation.m | 200-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDTokenInfo.h | 82-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDTokenInfo.m | 188-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDTokenManager.h | 149-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDTokenManager.m | 341-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDTokenOperation+Private.h | 67-------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDTokenOperation.h | 73-------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDTokenOperation.m | 243-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDTokenStore.h | 106-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDTokenStore.m | 137-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDURLQueryItem.h | 39---------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDURLQueryItem.m | 55-------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDUtilities.h | 85-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDUtilities.m | 194-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDVersionUtilities.h | 35-----------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDVersionUtilities.m | 91-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/NSError+FIRInstanceID.h | 70----------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/NSError+FIRInstanceID.m | 44--------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/Public/FIRInstanceID.h | 320-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/Firebase/InstanceID/Public/FirebaseInstanceID.h | 17-----------------
DPods/FirebaseInstanceID/LICENSE | 202-------------------------------------------------------------------------------
DPods/FirebaseInstanceID/README.md | 197-------------------------------------------------------------------------------
DPods/GTMSessionFetcher/LICENSE | 202-------------------------------------------------------------------------------
DPods/GTMSessionFetcher/README.md | 23-----------------------
DPods/GTMSessionFetcher/Source/GTMGatherInputStream.h | 52----------------------------------------------------
DPods/GTMSessionFetcher/Source/GTMGatherInputStream.m | 185-------------------------------------------------------------------------------
DPods/GTMSessionFetcher/Source/GTMMIMEDocument.h | 148-------------------------------------------------------------------------------
DPods/GTMSessionFetcher/Source/GTMMIMEDocument.m | 631-------------------------------------------------------------------------------
DPods/GTMSessionFetcher/Source/GTMReadMonitorInputStream.h | 49-------------------------------------------------
DPods/GTMSessionFetcher/Source/GTMReadMonitorInputStream.m | 190-------------------------------------------------------------------------------
DPods/GTMSessionFetcher/Source/GTMSessionFetcher.h | 1305-------------------------------------------------------------------------------
DPods/GTMSessionFetcher/Source/GTMSessionFetcher.m | 4579-------------------------------------------------------------------------------
DPods/GTMSessionFetcher/Source/GTMSessionFetcherLogging.h | 112-------------------------------------------------------------------------------
DPods/GTMSessionFetcher/Source/GTMSessionFetcherLogging.m | 982-------------------------------------------------------------------------------
DPods/GTMSessionFetcher/Source/GTMSessionFetcherService.h | 193-------------------------------------------------------------------------------
DPods/GTMSessionFetcher/Source/GTMSessionFetcherService.m | 1365-------------------------------------------------------------------------------
DPods/GTMSessionFetcher/Source/GTMSessionUploadFetcher.h | 166-------------------------------------------------------------------------------
DPods/GTMSessionFetcher/Source/GTMSessionUploadFetcher.m | 1954-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/LICENSE | 202-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/README.md | 48------------------------------------------------
DPods/GoogleAPIClientForREST/Source/GTLRDefines.h | 109-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/GeneratedServices/Sheets/GTLRSheets.h | 13-------------
DPods/GoogleAPIClientForREST/Source/GeneratedServices/Sheets/GTLRSheetsObjects.h | 9245-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/GeneratedServices/Sheets/GTLRSheetsObjects.m | 2856-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/GeneratedServices/Sheets/GTLRSheetsQuery.h | 1078-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/GeneratedServices/Sheets/GTLRSheetsQuery.m | 497-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/GeneratedServices/Sheets/GTLRSheetsService.h | 103-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/GeneratedServices/Sheets/GTLRSheetsService.m | 39---------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRBatchQuery.h | 85-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRBatchQuery.m | 179-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRBatchResult.h | 78------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRBatchResult.m | 168-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRDateTime.h | 115-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRDateTime.m | 373-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRDuration.h | 83-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRDuration.m | 222-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRErrorObject.h | 116-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRErrorObject.m | 140-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRObject.h | 317-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRObject.m | 760-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRQuery.h | 253-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRQuery.m | 313-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRRuntimeCommon.h | 73-------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRRuntimeCommon.m | 1060-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRService.h | 879-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRService.m | 2883-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRUploadParameters.h | 124-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Objects/GTLRUploadParameters.m | 119-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Utilities/GTLRBase64.h | 29-----------------------------
DPods/GoogleAPIClientForREST/Source/Utilities/GTLRBase64.m | 143-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Utilities/GTLRFramework.h | 34----------------------------------
DPods/GoogleAPIClientForREST/Source/Utilities/GTLRFramework.m | 44--------------------------------------------
DPods/GoogleAPIClientForREST/Source/Utilities/GTLRURITemplate.h | 48------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Utilities/GTLRURITemplate.m | 511-------------------------------------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Utilities/GTLRUtilities.h | 52----------------------------------------------------
DPods/GoogleAPIClientForREST/Source/Utilities/GTLRUtilities.m | 117-------------------------------------------------------------------------------
DPods/GoogleAppMeasurement/Frameworks/GoogleAppMeasurement.framework/GoogleAppMeasurement | 0
DPods/GoogleAppMeasurement/Frameworks/GoogleAppMeasurement.framework/Modules/module.modulemap | 9---------
DPods/GoogleUtilities/GoogleUtilities/AppDelegateSwizzler/GULAppDelegateSwizzler.m | 718-------------------------------------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/AppDelegateSwizzler/Internal/GULAppDelegateSwizzler_Private.h | 64----------------------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/AppDelegateSwizzler/Private/GULAppDelegateSwizzler.h | 63---------------------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Common/GULLoggerCodes.h | 36------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.h | 43-------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m | 250-------------------------------------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Logger/GULLogger.m | 209-------------------------------------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Logger/Private/GULLogger.h | 159-------------------------------------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Logger/Public/GULLoggerLevel.h | 35-----------------------------------
DPods/GoogleUtilities/GoogleUtilities/MethodSwizzler/GULSwizzler.m | 185-------------------------------------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/MethodSwizzler/Private/GULOriginalIMPConvenienceMacros.h | 207-------------------------------------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/MethodSwizzler/Private/GULSwizzler.h | 91-------------------------------------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/NSData+zlib/GULNSData+zlib.h | 49-------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/NSData+zlib/GULNSData+zlib.m | 207-------------------------------------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Network/GULMutableDictionary.m | 97-------------------------------------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Network/GULNetwork.m | 389-------------------------------------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Network/GULNetworkConstants.m | 40----------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Network/GULNetworkURLSession.m | 740-------------------------------------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Network/Private/GULMutableDictionary.h | 46----------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Network/Private/GULNetwork.h | 87-------------------------------------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Network/Private/GULNetworkConstants.h | 79-------------------------------------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Network/Private/GULNetworkLoggerProtocol.h | 51---------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Network/Private/GULNetworkMessageCode.h | 45---------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Network/Private/GULNetworkURLSession.h | 62--------------------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Reachability/GULReachabilityChecker+Internal.h | 47-----------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Reachability/GULReachabilityChecker.m | 240-------------------------------------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Reachability/Private/GULReachabilityChecker.h | 77-----------------------------------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/Reachability/Private/GULReachabilityMessageCode.h | 27---------------------------
DPods/GoogleUtilities/GoogleUtilities/UserDefaults/GULUserDefaults.m | 235-------------------------------------------------------------------------------
DPods/GoogleUtilities/GoogleUtilities/UserDefaults/Private/GULUserDefaults.h | 110-------------------------------------------------------------------------------
DPods/GoogleUtilities/LICENSE | 202-------------------------------------------------------------------------------
DPods/GoogleUtilities/README.md | 193-------------------------------------------------------------------------------
DPods/Headers/Private/Firebase/Firebase.h | 2--
DPods/Headers/Public/Firebase/Firebase.h | 2--
MPods/Manifest.lock | 90+------------------------------------------------------------------------------
MPods/Pods.xcodeproj/project.pbxproj | 2603++++---------------------------------------------------------------------------
DPods/Pods.xcodeproj/xcuserdata/naomi.xcuserdatad/xcschemes/Firebase.xcscheme | 60------------------------------------------------------------
DPods/Pods.xcodeproj/xcuserdata/naomi.xcuserdatad/xcschemes/FirebaseAnalytics.xcscheme | 60------------------------------------------------------------
DPods/Pods.xcodeproj/xcuserdata/naomi.xcuserdatad/xcschemes/FirebaseCore.xcscheme | 60------------------------------------------------------------
DPods/Pods.xcodeproj/xcuserdata/naomi.xcuserdatad/xcschemes/FirebaseInstanceID.xcscheme | 60------------------------------------------------------------
DPods/Pods.xcodeproj/xcuserdata/naomi.xcuserdatad/xcschemes/GTMSessionFetcher.xcscheme | 60------------------------------------------------------------
DPods/Pods.xcodeproj/xcuserdata/naomi.xcuserdatad/xcschemes/GoogleAPIClientForREST.xcscheme | 60------------------------------------------------------------
DPods/Pods.xcodeproj/xcuserdata/naomi.xcuserdatad/xcschemes/GoogleAppMeasurement.xcscheme | 60------------------------------------------------------------
DPods/Pods.xcodeproj/xcuserdata/naomi.xcuserdatad/xcschemes/GoogleUtilities.xcscheme | 60------------------------------------------------------------
MPods/Pods.xcodeproj/xcuserdata/naomi.xcuserdatad/xcschemes/Pods-TeachersAssistant.xcscheme | 4++--
DPods/Pods.xcodeproj/xcuserdata/naomi.xcuserdatad/xcschemes/nanopb.xcscheme | 60------------------------------------------------------------
MPods/Pods.xcodeproj/xcuserdata/naomi.xcuserdatad/xcschemes/xcschememanagement.plist | 67++-----------------------------------------------------------------
DPods/Target Support Files/Firebase/Firebase.xcconfig | 10----------
DPods/Target Support Files/FirebaseAnalytics/FirebaseAnalytics.xcconfig | 10----------
DPods/Target Support Files/FirebaseCore/FirebaseCore-Info.plist | 26--------------------------
DPods/Target Support Files/FirebaseCore/FirebaseCore-dummy.m | 5-----
DPods/Target Support Files/FirebaseCore/FirebaseCore-umbrella.h | 22----------------------
DPods/Target Support Files/FirebaseCore/FirebaseCore.modulemap | 6------
DPods/Target Support Files/FirebaseCore/FirebaseCore.xcconfig | 11-----------
DPods/Target Support Files/FirebaseInstanceID/FirebaseInstanceID-Info.plist | 26--------------------------
DPods/Target Support Files/FirebaseInstanceID/FirebaseInstanceID-dummy.m | 5-----
DPods/Target Support Files/FirebaseInstanceID/FirebaseInstanceID-umbrella.h | 18------------------
DPods/Target Support Files/FirebaseInstanceID/FirebaseInstanceID.modulemap | 6------
DPods/Target Support Files/FirebaseInstanceID/FirebaseInstanceID.xcconfig | 10----------
DPods/Target Support Files/GTMSessionFetcher/GTMSessionFetcher-Info.plist | 26--------------------------
DPods/Target Support Files/GTMSessionFetcher/GTMSessionFetcher-dummy.m | 5-----
DPods/Target Support Files/GTMSessionFetcher/GTMSessionFetcher-prefix.pch | 12------------
DPods/Target Support Files/GTMSessionFetcher/GTMSessionFetcher-umbrella.h | 23-----------------------
DPods/Target Support Files/GTMSessionFetcher/GTMSessionFetcher.modulemap | 6------
DPods/Target Support Files/GTMSessionFetcher/GTMSessionFetcher.xcconfig | 9---------
DPods/Target Support Files/GoogleAPIClientForREST/GoogleAPIClientForREST-Info.plist | 26--------------------------
DPods/Target Support Files/GoogleAPIClientForREST/GoogleAPIClientForREST-dummy.m | 5-----
DPods/Target Support Files/GoogleAPIClientForREST/GoogleAPIClientForREST-prefix.pch | 12------------
DPods/Target Support Files/GoogleAPIClientForREST/GoogleAPIClientForREST-umbrella.h | 35-----------------------------------
DPods/Target Support Files/GoogleAPIClientForREST/GoogleAPIClientForREST.modulemap | 6------
DPods/Target Support Files/GoogleAPIClientForREST/GoogleAPIClientForREST.xcconfig | 9---------
DPods/Target Support Files/GoogleAppMeasurement/GoogleAppMeasurement.xcconfig | 10----------
DPods/Target Support Files/GoogleUtilities/GoogleUtilities-Info.plist | 26--------------------------
DPods/Target Support Files/GoogleUtilities/GoogleUtilities-dummy.m | 5-----
DPods/Target Support Files/GoogleUtilities/GoogleUtilities-prefix.pch | 12------------
DPods/Target Support Files/GoogleUtilities/GoogleUtilities-umbrella.h | 19-------------------
DPods/Target Support Files/GoogleUtilities/GoogleUtilities.modulemap | 6------
DPods/Target Support Files/GoogleUtilities/GoogleUtilities.xcconfig | 9---------
MPods/Target Support Files/Pods-TeachersAssistant/Pods-TeachersAssistant-acknowledgements.markdown | 1066-------------------------------------------------------------------------------
MPods/Target Support Files/Pods-TeachersAssistant/Pods-TeachersAssistant-acknowledgements.plist | 1120-------------------------------------------------------------------------------
MPods/Target Support Files/Pods-TeachersAssistant/Pods-TeachersAssistant.debug.xcconfig | 5+----
MPods/Target Support Files/Pods-TeachersAssistant/Pods-TeachersAssistant.release.xcconfig | 5+----
MPods/Target Support Files/Pods-TeachersAssistantTests/Pods-TeachersAssistantTests.debug.xcconfig | 5+----
MPods/Target Support Files/Pods-TeachersAssistantTests/Pods-TeachersAssistantTests.release.xcconfig | 5+----
DPods/Target Support Files/nanopb/nanopb-Info.plist | 26--------------------------
DPods/Target Support Files/nanopb/nanopb-dummy.m | 5-----
DPods/Target Support Files/nanopb/nanopb-prefix.pch | 12------------
DPods/Target Support Files/nanopb/nanopb-umbrella.h | 26--------------------------
DPods/Target Support Files/nanopb/nanopb.modulemap | 6------
DPods/Target Support Files/nanopb/nanopb.xcconfig | 8--------
DPods/nanopb/LICENSE.txt | 20--------------------
DPods/nanopb/README.md | 71-----------------------------------------------------------------------
DPods/nanopb/pb.h | 593-------------------------------------------------------------------------------
DPods/nanopb/pb_common.c | 97-------------------------------------------------------------------------------
DPods/nanopb/pb_common.h | 42------------------------------------------
DPods/nanopb/pb_decode.c | 1508-------------------------------------------------------------------------------
DPods/nanopb/pb_decode.h | 175-------------------------------------------------------------------------------
DPods/nanopb/pb_encode.c | 869-------------------------------------------------------------------------------
DPods/nanopb/pb_encode.h | 170-------------------------------------------------------------------------------
MTeachers' Assistant/AppDelegate.swift | 1-
DTeachers' Assistant/GoogleService-Info.plist | 40----------------------------------------
MTeachersAssistant.xcodeproj/project.pbxproj | 29-----------------------------
MTeachersAssistant.xcodeproj/xcuserdata/naomi.xcuserdatad/xcschemes/xcschememanagement.plist | 2+-
MTeachersAssistant.xcworkspace/xcuserdata/naomi.xcuserdatad/UserInterfaceState.xcuserstate | 0
278 files changed, 138 insertions(+), 64453 deletions(-)

diff --git a/.DS_Store b/.DS_Store Binary files differ. diff --git a/Podfile b/Podfile @@ -4,8 +4,6 @@ platform :ios, '9.0' target 'TeachersAssistant' do # Comment the next line if you're not using Swift and don't want to use dynamic frameworks use_frameworks! - pod 'Firebase/Core' - pod 'GoogleAPIClientForREST/Sheets' target 'TeachersAssistantTests' do inherit! :search_paths diff --git a/Podfile.lock b/Podfile.lock @@ -1,91 +1,3 @@ -PODS: - - Firebase/Core (5.18.0): - - Firebase/CoreOnly - - FirebaseAnalytics (= 5.7.0) - - Firebase/CoreOnly (5.18.0): - - FirebaseCore (= 5.3.1) - - FirebaseAnalytics (5.7.0): - - FirebaseCore (~> 5.3) - - FirebaseInstanceID (~> 3.6) - - GoogleAppMeasurement (= 5.7.0) - - GoogleUtilities/AppDelegateSwizzler (~> 5.2) - - GoogleUtilities/MethodSwizzler (~> 5.2) - - GoogleUtilities/Network (~> 5.2) - - "GoogleUtilities/NSData+zlib (~> 5.2)" - - nanopb (~> 0.3) - - FirebaseCore (5.3.1): - - GoogleUtilities/Logger (~> 5.2) - - FirebaseInstanceID (3.7.0): - - FirebaseCore (~> 5.2) - - GoogleUtilities/Environment (~> 5.2) - - GoogleUtilities/UserDefaults (~> 5.2) - - GoogleAPIClientForREST/Core (1.3.8): - - GTMSessionFetcher (>= 1.1.7) - - GoogleAPIClientForREST/Sheets (1.3.8): - - GoogleAPIClientForREST/Core - - GTMSessionFetcher (>= 1.1.7) - - GoogleAppMeasurement (5.7.0): - - GoogleUtilities/AppDelegateSwizzler (~> 5.2) - - GoogleUtilities/MethodSwizzler (~> 5.2) - - GoogleUtilities/Network (~> 5.2) - - "GoogleUtilities/NSData+zlib (~> 5.2)" - - nanopb (~> 0.3) - - GoogleUtilities/AppDelegateSwizzler (5.3.7): - - GoogleUtilities/Environment - - GoogleUtilities/Logger - - GoogleUtilities/Network - - GoogleUtilities/Environment (5.3.7) - - GoogleUtilities/Logger (5.3.7): - - GoogleUtilities/Environment - - GoogleUtilities/MethodSwizzler (5.3.7): - - GoogleUtilities/Logger - - GoogleUtilities/Network (5.3.7): - - GoogleUtilities/Logger - - "GoogleUtilities/NSData+zlib" - - GoogleUtilities/Reachability - - "GoogleUtilities/NSData+zlib (5.3.7)" - - GoogleUtilities/Reachability (5.3.7): - - GoogleUtilities/Logger - - GoogleUtilities/UserDefaults (5.3.7): - - GoogleUtilities/Logger - - GTMSessionFetcher (1.2.1): - - GTMSessionFetcher/Full (= 1.2.1) - - GTMSessionFetcher/Core (1.2.1) - - GTMSessionFetcher/Full (1.2.1): - - GTMSessionFetcher/Core (= 1.2.1) - - nanopb (0.3.901): - - nanopb/decode (= 0.3.901) - - nanopb/encode (= 0.3.901) - - nanopb/decode (0.3.901) - - nanopb/encode (0.3.901) - -DEPENDENCIES: - - Firebase/Core - - GoogleAPIClientForREST/Sheets - -SPEC REPOS: - https://github.com/cocoapods/specs.git: - - Firebase - - FirebaseAnalytics - - FirebaseCore - - FirebaseInstanceID - - GoogleAPIClientForREST - - GoogleAppMeasurement - - GoogleUtilities - - GTMSessionFetcher - - nanopb - -SPEC CHECKSUMS: - Firebase: 02f3281965c075426141a0ce1277e9de6649cab9 - FirebaseAnalytics: 23851fe602c872130a2c5c55040b302120346cc2 - FirebaseCore: 52f851b30e11360f1e67cf04b1edfebf0a47a2d3 - FirebaseInstanceID: bd6fc5a258884e206fd5c474ebe4f5b00e21770e - GoogleAPIClientForREST: 5447a194eae517986cafe6421a5330b80b820591 - GoogleAppMeasurement: 6cf307834da065863f9faf4c0de0a936d81dd832 - GoogleUtilities: 111a012f4c3a29c9e7c954c082fafd6ee3c999c0 - GTMSessionFetcher: 32aeca0aa144acea523e1c8e053089dec2cb98ca - nanopb: 2901f78ea1b7b4015c860c2fdd1ea2fee1a18d48 - -PODFILE CHECKSUM: 4852c02225a8d343844dd5ce2a4039dcb525ad3c +PODFILE CHECKSUM: 63ac3d21ea92db5b9ad2b6028ed0e73c7741657d COCOAPODS: 1.6.1 diff --git a/Pods/Firebase/CoreOnly/Sources/Firebase.h b/Pods/Firebase/CoreOnly/Sources/Firebase.h @@ -1,113 +0,0 @@ -#import <FirebaseCore/FirebaseCore.h> - -#if !defined(__has_include) - #error "Firebase.h won't import anything if your compiler doesn't support __has_include. Please \ - import the headers individually." -#else - #if __has_include(<FirebaseAnalytics/FirebaseAnalytics.h>) - #import <FirebaseAnalytics/FirebaseAnalytics.h> - #else - #ifndef FIREBASE_ANALYTICS_SUPPRESS_WARNING - #warning "FirebaseAnalytics.framework is not included in your target. Please add \ -`Firebase/Core` to your Podfile or add FirebaseAnalytics.framework to your project to ensure \ -Firebase services work as intended." - #endif // #ifndef FIREBASE_ANALYTICS_SUPPRESS_WARNING - #endif - - #if __has_include(<FirebaseAuth/FirebaseAuth.h>) - #import <FirebaseAuth/FirebaseAuth.h> - #endif - - #if __has_include(<FirebaseCrash/FirebaseCrash.h>) - #import <FirebaseCrash/FirebaseCrash.h> - #endif - - #if __has_include(<FirebaseDatabase/FirebaseDatabase.h>) - #import <FirebaseDatabase/FirebaseDatabase.h> - #endif - - #if __has_include(<FirebaseDynamicLinks/FirebaseDynamicLinks.h>) - #import <FirebaseDynamicLinks/FirebaseDynamicLinks.h> - #endif - - #if __has_include(<FirebaseFirestore/FirebaseFirestore.h>) - #import <FirebaseFirestore/FirebaseFirestore.h> - #endif - - #if __has_include(<FirebaseFunctions/FirebaseFunctions.h>) - #import <FirebaseFunctions/FirebaseFunctions.h> - #endif - - #if __has_include(<FirebaseInAppMessaging/FirebaseInAppMessaging.h>) - #import <FirebaseInAppMessaging/FirebaseInAppMessaging.h> - #endif - - #if __has_include(<FirebaseInstanceID/FirebaseInstanceID.h>) - #import <FirebaseInstanceID/FirebaseInstanceID.h> - #endif - - #if __has_include(<FirebaseInvites/FirebaseInvites.h>) - #import <FirebaseInvites/FirebaseInvites.h> - #endif - - #if __has_include(<FirebaseMessaging/FirebaseMessaging.h>) - #import <FirebaseMessaging/FirebaseMessaging.h> - #endif - - #if __has_include(<FirebaseMLModelInterpreter/FirebaseMLModelInterpreter.h>) - #import <FirebaseMLModelInterpreter/FirebaseMLModelInterpreter.h> - #endif - - #if __has_include(<FirebaseMLNLLanguageID/FirebaseMLNLLanguageID.h>) - #import <FirebaseMLNLLanguageID/FirebaseMLNLLanguageID.h> - #endif - - #if __has_include(<FirebaseMLNaturalLanguage/FirebaseMLNaturalLanguage.h>) - #import <FirebaseMLNaturalLanguage/FirebaseMLNaturalLanguage.h> - #endif - - #if __has_include(<FirebaseMLVision/FirebaseMLVision.h>) - #import <FirebaseMLVision/FirebaseMLVision.h> - #endif - - #if __has_include(<FirebaseMLVisionBarcodeModel/FirebaseMLVisionBarcodeModel.h>) - #import <FirebaseMLVisionBarcodeModel/FirebaseMLVisionBarcodeModel.h> - #endif - - #if __has_include(<FirebaseMLVisionFaceModel/FirebaseMLVisionFaceModel.h>) - #import <FirebaseMLVisionFaceModel/FirebaseMLVisionFaceModel.h> - #endif - - #if __has_include(<FirebaseMLVisionLabelModel/FirebaseMLVisionLabelModel.h>) - #import <FirebaseMLVisionLabelModel/FirebaseMLVisionLabelModel.h> - #endif - - #if __has_include(<FirebaseMLVisionTextModel/FirebaseMLVisionTextModel.h>) - #import <FirebaseMLVisionTextModel/FirebaseMLVisionTextModel.h> - #endif - - #if __has_include(<FirebasePerformance/FirebasePerformance.h>) - #import <FirebasePerformance/FirebasePerformance.h> - #endif - - #if __has_include(<FirebaseRemoteConfig/FirebaseRemoteConfig.h>) - #import <FirebaseRemoteConfig/FirebaseRemoteConfig.h> - #endif - - #if __has_include(<FirebaseStorage/FirebaseStorage.h>) - #import <FirebaseStorage/FirebaseStorage.h> - #endif - - #if __has_include(<GoogleMobileAds/GoogleMobileAds.h>) - #import <GoogleMobileAds/GoogleMobileAds.h> - #endif - - #if __has_include(<Fabric/Fabric.h>) - #import <Fabric/Fabric.h> - #endif - - #if __has_include(<Crashlytics/Crashlytics.h>) - #import <Crashlytics/Crashlytics.h> - #endif - -#endif // defined(__has_include) diff --git a/Pods/Firebase/CoreOnly/Sources/module.modulemap b/Pods/Firebase/CoreOnly/Sources/module.modulemap @@ -1,4 +0,0 @@ -module Firebase { - export * - header "Firebase.h" -} -\ No newline at end of file diff --git a/Pods/Firebase/README.md b/Pods/Firebase/README.md @@ -1,90 +0,0 @@ -# Firebase APIs for iOS - -Simplify your iOS development, grow your user base, and monetize more -effectively with Firebase services. - -Much more information can be found at [https://firebase.google.com](https://firebase.google.com). - -## Install a Firebase SDK using CocoaPods - -Firebase distributes several iOS specific APIs and SDKs via CocoaPods. -You can install the CocoaPods tool on OS X by running the following command from -the terminal. Detailed information is available in the [Getting Started -guide](https://guides.cocoapods.org/using/getting-started.html#getting-started). - -``` -$ sudo gem install cocoapods -``` - -## Try out an SDK - -You can try any of the SDKs with `pod try`. Run the following command and select -the SDK you are interested in when prompted: - -``` -$ pod try Firebase -``` - -Note that some SDKs may require credentials. More information is available in -the SDK-specific documentation at [https://firebase.google.com/docs/](https://firebase.google.com/docs/). - -## Add a Firebase SDK to your iOS app - -CocoaPods is used to install and manage dependencies in existing Xcode projects. - -1. Create an Xcode project, and save it to your local machine. -2. Create a file named `Podfile` in your project directory. This file defines - your project's dependencies, and is commonly referred to as a Podspec. -3. Open `Podfile`, and add your dependencies. A simple Podspec is shown here: - - ``` - platform :ios, '8.0' - pod 'Firebase' - ``` - -4. Save the file. - -5. Open a terminal and `cd` to the directory containing the Podfile. - - ``` - $ cd <path-to-project>/project/ - ``` - -6. Run the `pod install` command. This will install the SDKs specified in the - Podspec, along with any dependencies they may have. - - ``` - $ pod install - ``` - -7. Open your app's `.xcworkspace` file to launch Xcode. Use this file for all - development on your app. - -8. You can also install other Firebase SDKs by adding the subspecs in the - Podfile. - - ``` - pod 'Firebase/AdMob' - pod 'Firebase/Analytics' - pod 'Firebase/Auth' - pod 'Firebase/Database' - pod 'Firebase/DynamicLinks' - pod 'Firebase/Firestore' - pod 'Firebase/Functions' - pod 'Firebase/InAppMessaging' - pod 'Firebase/InAppMessagingDisplay' - pod 'Firebase/Messaging' - pod 'Firebase/MLCommon' - pod 'Firebase/MLModelInterpreter' - pod 'Firebase/MLNLLanguageID' - pod 'Firebase/MLNLSmartReply' - pod 'Firebase/MLNaturalLanguage' - pod 'Firebase/MLVision' - pod 'Firebase/MLVisionBarcodeModel' - pod 'Firebase/MLVisionFaceModel' - pod 'Firebase/MLVisionLabelModel' - pod 'Firebase/MLVisionTextModel' - pod 'Firebase/Performance' - pod 'Firebase/RemoteConfig' - pod 'Firebase/Storage' - ``` diff --git a/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector b/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector Binary files differ. diff --git a/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/Modules/module.modulemap b/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/Modules/module.modulemap @@ -1,9 +0,0 @@ -framework module FIRAnalyticsConnector { - export * - module * { export *} - link "sqlite3" - link "z" - link framework "Security" - link framework "StoreKit" - link framework "SystemConfiguration" - link framework "UIKit"} diff --git a/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/FirebaseAnalytics b/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/FirebaseAnalytics Binary files differ. diff --git a/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics+AppDelegate.h b/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics+AppDelegate.h @@ -1,62 +0,0 @@ -#import <Foundation/Foundation.h> - -#import "FIRAnalytics.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - * Provides App Delegate handlers to be used in your App Delegate. - * - * To save time integrating Firebase Analytics in an application, Firebase Analytics does not - * require delegation implementation from the AppDelegate. Instead this is automatically done by - * Firebase Analytics. Should you choose instead to delegate manually, you can turn off the App - * Delegate Proxy by adding FirebaseAppDelegateProxyEnabled into your app's Info.plist and setting - * it to NO, and adding the methods in this category to corresponding delegation handlers. - * - * To handle Universal Links, you must return YES in - * [UIApplicationDelegate application:didFinishLaunchingWithOptions:]. - */ -@interface FIRAnalytics (AppDelegate) - -/** - * Handles events related to a URL session that are waiting to be processed. - * - * For optimal use of Firebase Analytics, call this method from the - * [UIApplicationDelegate application:handleEventsForBackgroundURLSession:completionHandler] - * method of the app delegate in your app. - * - * @param identifier The identifier of the URL session requiring attention. - * @param completionHandler The completion handler to call when you finish processing the events. - * Calling this completion handler lets the system know that your app's user interface is - * updated and a new snapshot can be taken. - */ -+ (void)handleEventsForBackgroundURLSession:(NSString *)identifier - completionHandler:(nullable void (^)(void))completionHandler; - -/** - * Handles the event when the app is launched by a URL. - * - * Call this method from [UIApplicationDelegate application:openURL:options:] &#40;on iOS 9.0 and - * above&#41;, or [UIApplicationDelegate application:openURL:sourceApplication:annotation:] &#40;on - * iOS 8.x and below&#41; in your app. - * - * @param url The URL resource to open. This resource can be a network resource or a file. - */ -+ (void)handleOpenURL:(NSURL *)url; - -/** - * Handles the event when the app receives data associated with user activity that includes a - * Universal Link (on iOS 9.0 and above). - * - * Call this method from [UIApplication continueUserActivity:restorationHandler:] in your app - * delegate (on iOS 9.0 and above). - * - * @param userActivity The activity object containing the data associated with the task the user - * was performing. - */ -+ (void)handleUserActivity:(id)userActivity; - -@end - -NS_ASSUME_NONNULL_END - diff --git a/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics.h b/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRAnalytics.h @@ -1,119 +0,0 @@ -#import <Foundation/Foundation.h> - -#import "FIREventNames.h" -#import "FIRParameterNames.h" -#import "FIRUserPropertyNames.h" - -NS_ASSUME_NONNULL_BEGIN - -/// The top level Firebase Analytics singleton that provides methods for logging events and setting -/// user properties. See <a href="http://goo.gl/gz8SLz">the developer guides</a> for general -/// information on using Firebase Analytics in your apps. -NS_SWIFT_NAME(Analytics) -@interface FIRAnalytics : NSObject - -/// Logs an app event. The event can have up to 25 parameters. Events with the same name must have -/// the same parameters. Up to 500 event names are supported. Using predefined events and/or -/// parameters is recommended for optimal reporting. -/// -/// The following event names are reserved and cannot be used: -/// <ul> -/// <li>ad_activeview</li> -/// <li>ad_click</li> -/// <li>ad_exposure</li> -/// <li>ad_impression</li> -/// <li>ad_query</li> -/// <li>adunit_exposure</li> -/// <li>app_clear_data</li> -/// <li>app_remove</li> -/// <li>app_update</li> -/// <li>error</li> -/// <li>first_open</li> -/// <li>in_app_purchase</li> -/// <li>notification_dismiss</li> -/// <li>notification_foreground</li> -/// <li>notification_open</li> -/// <li>notification_receive</li> -/// <li>os_update</li> -/// <li>screen_view</li> -/// <li>session_start</li> -/// <li>user_engagement</li> -/// </ul> -/// -/// @param name The name of the event. Should contain 1 to 40 alphanumeric characters or -/// underscores. The name must start with an alphabetic character. Some event names are -/// reserved. See FIREventNames.h for the list of reserved event names. The "firebase_", -/// "google_", and "ga_" prefixes are reserved and should not be used. Note that event names are -/// case-sensitive and that logging two events whose names differ only in case will result in -/// two distinct events. -/// @param parameters The dictionary of event parameters. Passing nil indicates that the event has -/// no parameters. Parameter names can be up to 40 characters long and must start with an -/// alphabetic character and contain only alphanumeric characters and underscores. Only NSString -/// and NSNumber (signed 64-bit integer and 64-bit floating-point number) parameter types are -/// supported. NSString parameter values can be up to 100 characters long. The "firebase_", -/// "google_", and "ga_" prefixes are reserved and should not be used for parameter names. -+ (void)logEventWithName:(NSString *)name - parameters:(nullable NSDictionary<NSString *, id> *)parameters - NS_SWIFT_NAME(logEvent(_:parameters:)); - -/// Sets a user property to a given value. Up to 25 user property names are supported. Once set, -/// user property values persist throughout the app lifecycle and across sessions. -/// -/// The following user property names are reserved and cannot be used: -/// <ul> -/// <li>first_open_time</li> -/// <li>last_deep_link_referrer</li> -/// <li>user_id</li> -/// </ul> -/// -/// @param value The value of the user property. Values can be up to 36 characters long. Setting the -/// value to nil removes the user property. -/// @param name The name of the user property to set. Should contain 1 to 24 alphanumeric characters -/// or underscores and must start with an alphabetic character. The "firebase_", "google_", and -/// "ga_" prefixes are reserved and should not be used for user property names. -+ (void)setUserPropertyString:(nullable NSString *)value forName:(NSString *)name - NS_SWIFT_NAME(setUserProperty(_:forName:)); - -/// Sets the user ID property. This feature must be used in accordance with -/// <a href="https://www.google.com/policies/privacy">Google's Privacy Policy</a> -/// -/// @param userID The user ID to ascribe to the user of this app on this device, which must be -/// non-empty and no more than 256 characters long. Setting userID to nil removes the user ID. -+ (void)setUserID:(nullable NSString *)userID; - -/// Sets the current screen name, which specifies the current visual context in your app. This helps -/// identify the areas in your app where users spend their time and how they interact with your app. -/// Must be called on the main thread. -/// -/// Note that screen reporting is enabled automatically and records the class name of the current -/// UIViewController for you without requiring you to call this method. If you implement -/// viewDidAppear in your UIViewController but do not call [super viewDidAppear:], that screen class -/// will not be automatically tracked. The class name can optionally be overridden by calling this -/// method in the viewDidAppear callback of your UIViewController and specifying the -/// screenClassOverride parameter. setScreenName:screenClass: must be called after -/// [super viewDidAppear:]. -/// -/// If your app does not use a distinct UIViewController for each screen, you should call this -/// method and specify a distinct screenName each time a new screen is presented to the user. -/// -/// The screen name and screen class remain in effect until the current UIViewController changes or -/// a new call to setScreenName:screenClass: is made. -/// -/// @param screenName The name of the current screen. Should contain 1 to 100 characters. Set to nil -/// to clear the current screen name. -/// @param screenClassOverride The name of the screen class. Should contain 1 to 100 characters. By -/// default this is the class name of the current UIViewController. Set to nil to revert to the -/// default class name. -+ (void)setScreenName:(nullable NSString *)screenName - screenClass:(nullable NSString *)screenClassOverride; - -/// The unique ID for this instance of the application. -+ (NSString *)appInstanceID; - -/// Clears all analytics data for this instance from the device and resets the app instance ID. -/// FIRAnalyticsConfiguration values will be reset to the default values. -+ (void)resetAnalyticsData; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIREventNames.h b/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIREventNames.h @@ -1,407 +0,0 @@ -/// @file FIREventNames.h -/// -/// Predefined event names. -/// -/// An Event is an important occurrence in your app that you want to measure. You can report up to -/// 500 different types of Events per app and you can associate up to 25 unique parameters with each -/// Event type. Some common events are suggested below, but you may also choose to specify custom -/// Event types that are associated with your specific app. Each event type is identified by a -/// unique name. Event names can be up to 40 characters long, may only contain alphanumeric -/// characters and underscores ("_"), and must start with an alphabetic character. The "firebase_", -/// "google_", and "ga_" prefixes are reserved and should not be used. - -#import <Foundation/Foundation.h> - -/// Add Payment Info event. This event signifies that a user has submitted their payment information -/// to your app. -static NSString *const kFIREventAddPaymentInfo NS_SWIFT_NAME(AnalyticsEventAddPaymentInfo) = - @"add_payment_info"; - -/// E-Commerce Add To Cart event. This event signifies that an item was added to a cart for -/// purchase. Add this event to a funnel with kFIREventEcommercePurchase to gauge the effectiveness -/// of your checkout process. Note: If you supply the @c kFIRParameterValue parameter, you must -/// also supply the @c kFIRParameterCurrency parameter so that revenue metrics can be computed -/// accurately. Params: -/// -/// <ul> -/// <li>@c kFIRParameterQuantity (signed 64-bit integer as NSNumber)</li> -/// <li>@c kFIRParameterItemID (NSString)</li> -/// <li>@c kFIRParameterItemName (NSString)</li> -/// <li>@c kFIRParameterItemCategory (NSString)</li> -/// <li>@c kFIRParameterItemLocationID (NSString) (optional)</li> -/// <li>@c kFIRParameterPrice (double as NSNumber) (optional)</li> -/// <li>@c kFIRParameterCurrency (NSString) (optional)</li> -/// <li>@c kFIRParameterValue (double as NSNumber) (optional)</li> -/// <li>@c kFIRParameterOrigin (NSString) (optional)</li> -/// <li>@c kFIRParameterDestination (NSString) (optional)</li> -/// <li>@c kFIRParameterStartDate (NSString) (optional)</li> -/// <li>@c kFIRParameterEndDate (NSString) (optional)</li> -/// </ul> -static NSString *const kFIREventAddToCart NS_SWIFT_NAME(AnalyticsEventAddToCart) = @"add_to_cart"; - -/// E-Commerce Add To Wishlist event. This event signifies that an item was added to a wishlist. -/// Use this event to identify popular gift items in your app. Note: If you supply the -/// @c kFIRParameterValue parameter, you must also supply the @c kFIRParameterCurrency -/// parameter so that revenue metrics can be computed accurately. Params: -/// -/// <ul> -/// <li>@c kFIRParameterQuantity (signed 64-bit integer as NSNumber)</li> -/// <li>@c kFIRParameterItemID (NSString)</li> -/// <li>@c kFIRParameterItemName (NSString)</li> -/// <li>@c kFIRParameterItemCategory (NSString)</li> -/// <li>@c kFIRParameterItemLocationID (NSString) (optional)</li> -/// <li>@c kFIRParameterPrice (double as NSNumber) (optional)</li> -/// <li>@c kFIRParameterCurrency (NSString) (optional)</li> -/// <li>@c kFIRParameterValue (double as NSNumber) (optional)</li> -/// </ul> -static NSString *const kFIREventAddToWishlist NS_SWIFT_NAME(AnalyticsEventAddToWishlist) = - @"add_to_wishlist"; - -/// App Open event. By logging this event when an App becomes active, developers can understand how -/// often users leave and return during the course of a Session. Although Sessions are automatically -/// reported, this event can provide further clarification around the continuous engagement of -/// app-users. -static NSString *const kFIREventAppOpen NS_SWIFT_NAME(AnalyticsEventAppOpen) = @"app_open"; - -/// E-Commerce Begin Checkout event. This event signifies that a user has begun the process of -/// checking out. Add this event to a funnel with your kFIREventEcommercePurchase event to gauge the -/// effectiveness of your checkout process. Note: If you supply the @c kFIRParameterValue -/// parameter, you must also supply the @c kFIRParameterCurrency parameter so that revenue -/// metrics can be computed accurately. Params: -/// -/// <ul> -/// <li>@c kFIRParameterValue (double as NSNumber) (optional)</li> -/// <li>@c kFIRParameterCurrency (NSString) (optional)</li> -/// <li>@c kFIRParameterTransactionID (NSString) (optional)</li> -/// <li>@c kFIRParameterStartDate (NSString) (optional)</li> -/// <li>@c kFIRParameterEndDate (NSString) (optional)</li> -/// <li>@c kFIRParameterNumberOfNights (signed 64-bit integer as NSNumber) (optional) for -/// hotel bookings</li> -/// <li>@c kFIRParameterNumberOfRooms (signed 64-bit integer as NSNumber) (optional) for -/// hotel bookings</li> -/// <li>@c kFIRParameterNumberOfPassengers (signed 64-bit integer as NSNumber) (optional) -/// for travel bookings</li> -/// <li>@c kFIRParameterOrigin (NSString) (optional)</li> -/// <li>@c kFIRParameterDestination (NSString) (optional)</li> -/// <li>@c kFIRParameterTravelClass (NSString) (optional) for travel bookings</li> -/// </ul> -static NSString *const kFIREventBeginCheckout NS_SWIFT_NAME(AnalyticsEventBeginCheckout) = - @"begin_checkout"; - -/// Campaign Detail event. Log this event to supply the referral details of a re-engagement -/// campaign. Note: you must supply at least one of the required parameters kFIRParameterSource, -/// kFIRParameterMedium or kFIRParameterCampaign. Params: -/// -/// <ul> -/// <li>@c kFIRParameterSource (NSString)</li> -/// <li>@c kFIRParameterMedium (NSString)</li> -/// <li>@c kFIRParameterCampaign (NSString)</li> -/// <li>@c kFIRParameterTerm (NSString) (optional)</li> -/// <li>@c kFIRParameterContent (NSString) (optional)</li> -/// <li>@c kFIRParameterAdNetworkClickID (NSString) (optional)</li> -/// <li>@c kFIRParameterCP1 (NSString) (optional)</li> -/// </ul> -static NSString *const kFIREventCampaignDetails NS_SWIFT_NAME(AnalyticsEventCampaignDetails) = - @"campaign_details"; - -/// Checkout progress. Params: -/// -/// <ul> -/// <li>@c kFIRParameterCheckoutStep (unsigned 64-bit integer as NSNumber)</li> -/// <li>@c kFIRParameterCheckoutOption (NSString) (optional)</li> -/// </ul> -static NSString *const kFIREventCheckoutProgress NS_SWIFT_NAME(AnalyticsEventCheckoutProgress) = - @"checkout_progress"; - -/// Earn Virtual Currency event. This event tracks the awarding of virtual currency in your app. Log -/// this along with @c kFIREventSpendVirtualCurrency to better understand your virtual economy. -/// Params: -/// -/// <ul> -/// <li>@c kFIRParameterVirtualCurrencyName (NSString)</li> -/// <li>@c kFIRParameterValue (signed 64-bit integer or double as NSNumber)</li> -/// </ul> -static NSString *const kFIREventEarnVirtualCurrency - NS_SWIFT_NAME(AnalyticsEventEarnVirtualCurrency) = @"earn_virtual_currency"; - -/// E-Commerce Purchase event. This event signifies that an item was purchased by a user. Note: -/// This is different from the in-app purchase event, which is reported automatically for App -/// Store-based apps. Note: If you supply the @c kFIRParameterValue parameter, you must also -/// supply the @c kFIRParameterCurrency parameter so that revenue metrics can be computed -/// accurately. Params: -/// -/// <ul> -/// <li>@c kFIRParameterCurrency (NSString) (optional)</li> -/// <li>@c kFIRParameterValue (double as NSNumber) (optional)</li> -/// <li>@c kFIRParameterTransactionID (NSString) (optional)</li> -/// <li>@c kFIRParameterTax (double as NSNumber) (optional)</li> -/// <li>@c kFIRParameterShipping (double as NSNumber) (optional)</li> -/// <li>@c kFIRParameterCoupon (NSString) (optional)</li> -/// <li>@c kFIRParameterLocation (NSString) (optional)</li> -/// <li>@c kFIRParameterStartDate (NSString) (optional)</li> -/// <li>@c kFIRParameterEndDate (NSString) (optional)</li> -/// <li>@c kFIRParameterNumberOfNights (signed 64-bit integer as NSNumber) (optional) for -/// hotel bookings</li> -/// <li>@c kFIRParameterNumberOfRooms (signed 64-bit integer as NSNumber) (optional) for -/// hotel bookings</li> -/// <li>@c kFIRParameterNumberOfPassengers (signed 64-bit integer as NSNumber) (optional) -/// for travel bookings</li> -/// <li>@c kFIRParameterOrigin (NSString) (optional)</li> -/// <li>@c kFIRParameterDestination (NSString) (optional)</li> -/// <li>@c kFIRParameterTravelClass (NSString) (optional) for travel bookings</li> -/// </ul> -static NSString *const kFIREventEcommercePurchase NS_SWIFT_NAME(AnalyticsEventEcommercePurchase) = - @"ecommerce_purchase"; - -/// Generate Lead event. Log this event when a lead has been generated in the app to understand the -/// efficacy of your install and re-engagement campaigns. Note: If you supply the -/// @c kFIRParameterValue parameter, you must also supply the @c kFIRParameterCurrency -/// parameter so that revenue metrics can be computed accurately. Params: -/// -/// <ul> -/// <li>@c kFIRParameterCurrency (NSString) (optional)</li> -/// <li>@c kFIRParameterValue (double as NSNumber) (optional)</li> -/// </ul> -static NSString *const kFIREventGenerateLead NS_SWIFT_NAME(AnalyticsEventGenerateLead) = - @"generate_lead"; - -/// Join Group event. Log this event when a user joins a group such as a guild, team or family. Use -/// this event to analyze how popular certain groups or social features are in your app. Params: -/// -/// <ul> -/// <li>@c kFIRParameterGroupID (NSString)</li> -/// </ul> -static NSString *const kFIREventJoinGroup NS_SWIFT_NAME(AnalyticsEventJoinGroup) = @"join_group"; - -/// Level Up event. This event signifies that a player has leveled up in your gaming app. It can -/// help you gauge the level distribution of your userbase and help you identify certain levels that -/// are difficult to pass. Params: -/// -/// <ul> -/// <li>@c kFIRParameterLevel (signed 64-bit integer as NSNumber)</li> -/// <li>@c kFIRParameterCharacter (NSString) (optional)</li> -/// </ul> -static NSString *const kFIREventLevelUp NS_SWIFT_NAME(AnalyticsEventLevelUp) = @"level_up"; - -/// Login event. Apps with a login feature can report this event to signify that a user has logged -/// in. -static NSString *const kFIREventLogin NS_SWIFT_NAME(AnalyticsEventLogin) = @"login"; - -/// Post Score event. Log this event when the user posts a score in your gaming app. This event can -/// help you understand how users are actually performing in your game and it can help you correlate -/// high scores with certain audiences or behaviors. Params: -/// -/// <ul> -/// <li>@c kFIRParameterScore (signed 64-bit integer as NSNumber)</li> -/// <li>@c kFIRParameterLevel (signed 64-bit integer as NSNumber) (optional)</li> -/// <li>@c kFIRParameterCharacter (NSString) (optional)</li> -/// </ul> -static NSString *const kFIREventPostScore NS_SWIFT_NAME(AnalyticsEventPostScore) = @"post_score"; - -/// Present Offer event. This event signifies that the app has presented a purchase offer to a user. -/// Add this event to a funnel with the kFIREventAddToCart and kFIREventEcommercePurchase to gauge -/// your conversion process. Note: If you supply the @c kFIRParameterValue parameter, you must -/// also supply the @c kFIRParameterCurrency parameter so that revenue metrics can be computed -/// accurately. Params: -/// -/// <ul> -/// <li>@c kFIRParameterQuantity (signed 64-bit integer as NSNumber)</li> -/// <li>@c kFIRParameterItemID (NSString)</li> -/// <li>@c kFIRParameterItemName (NSString)</li> -/// <li>@c kFIRParameterItemCategory (NSString)</li> -/// <li>@c kFIRParameterItemLocationID (NSString) (optional)</li> -/// <li>@c kFIRParameterPrice (double as NSNumber) (optional)</li> -/// <li>@c kFIRParameterCurrency (NSString) (optional)</li> -/// <li>@c kFIRParameterValue (double as NSNumber) (optional)</li> -/// </ul> -static NSString *const kFIREventPresentOffer NS_SWIFT_NAME(AnalyticsEventPresentOffer) = - @"present_offer"; - -/// E-Commerce Purchase Refund event. This event signifies that an item purchase was refunded. -/// Note: If you supply the @c kFIRParameterValue parameter, you must also supply the -/// @c kFIRParameterCurrency parameter so that revenue metrics can be computed accurately. -/// Params: -/// -/// <ul> -/// <li>@c kFIRParameterCurrency (NSString) (optional)</li> -/// <li>@c kFIRParameterValue (double as NSNumber) (optional)</li> -/// <li>@c kFIRParameterTransactionID (NSString) (optional)</li> -/// </ul> -static NSString *const kFIREventPurchaseRefund NS_SWIFT_NAME(AnalyticsEventPurchaseRefund) = - @"purchase_refund"; - -/// Remove from cart event. Params: -/// -/// <ul> -/// <li>@c kFIRParameterQuantity (signed 64-bit integer as NSNumber)</li> -/// <li>@c kFIRParameterItemID (NSString)</li> -/// <li>@c kFIRParameterItemName (NSString)</li> -/// <li>@c kFIRParameterItemCategory (NSString)</li> -/// <li>@c kFIRParameterItemLocationID (NSString) (optional)</li> -/// <li>@c kFIRParameterPrice (double as NSNumber) (optional)</li> -/// <li>@c kFIRParameterCurrency (NSString) (optional)</li> -/// <li>@c kFIRParameterValue (double as NSNumber) (optional)</li> -/// <li>@c kFIRParameterOrigin (NSString) (optional)</li> -/// <li>@c kFIRParameterDestination (NSString) (optional)</li> -/// <li>@c kFIRParameterStartDate (NSString) (optional)</li> -/// <li>@c kFIRParameterEndDate (NSString) (optional)</li> -/// </ul> -static NSString *const kFIREventRemoveFromCart NS_SWIFT_NAME(AnalyticsEventRemoveFromCart) = - @"remove_from_cart"; - -/// Search event. Apps that support search features can use this event to contextualize search -/// operations by supplying the appropriate, corresponding parameters. This event can help you -/// identify the most popular content in your app. Params: -/// -/// <ul> -/// <li>@c kFIRParameterSearchTerm (NSString)</li> -/// <li>@c kFIRParameterStartDate (NSString) (optional)</li> -/// <li>@c kFIRParameterEndDate (NSString) (optional)</li> -/// <li>@c kFIRParameterNumberOfNights (signed 64-bit integer as NSNumber) (optional) for -/// hotel bookings</li> -/// <li>@c kFIRParameterNumberOfRooms (signed 64-bit integer as NSNumber) (optional) for -/// hotel bookings</li> -/// <li>@c kFIRParameterNumberOfPassengers (signed 64-bit integer as NSNumber) (optional) -/// for travel bookings</li> -/// <li>@c kFIRParameterOrigin (NSString) (optional)</li> -/// <li>@c kFIRParameterDestination (NSString) (optional)</li> -/// <li>@c kFIRParameterTravelClass (NSString) (optional) for travel bookings</li> -/// </ul> -static NSString *const kFIREventSearch NS_SWIFT_NAME(AnalyticsEventSearch) = @"search"; - -/// Select Content event. This general purpose event signifies that a user has selected some content -/// of a certain type in an app. The content can be any object in your app. This event can help you -/// identify popular content and categories of content in your app. Params: -/// -/// <ul> -/// <li>@c kFIRParameterContentType (NSString)</li> -/// <li>@c kFIRParameterItemID (NSString)</li> -/// </ul> -static NSString *const kFIREventSelectContent NS_SWIFT_NAME(AnalyticsEventSelectContent) = - @"select_content"; - -/// Set checkout option. Params: -/// -/// <ul> -/// <li>@c kFIRParameterCheckoutStep (unsigned 64-bit integer as NSNumber)</li> -/// <li>@c kFIRParameterCheckoutOption (NSString)</li> -/// </ul> -static NSString *const kFIREventSetCheckoutOption NS_SWIFT_NAME(AnalyticsEventSetCheckoutOption) = - @"set_checkout_option"; - -/// Share event. Apps with social features can log the Share event to identify the most viral -/// content. Params: -/// -/// <ul> -/// <li>@c kFIRParameterContentType (NSString)</li> -/// <li>@c kFIRParameterItemID (NSString)</li> -/// </ul> -static NSString *const kFIREventShare NS_SWIFT_NAME(AnalyticsEventShare) = @"share"; - -/// Sign Up event. This event indicates that a user has signed up for an account in your app. The -/// parameter signifies the method by which the user signed up. Use this event to understand the -/// different behaviors between logged in and logged out users. Params: -/// -/// <ul> -/// <li>@c kFIRParameterSignUpMethod (NSString)</li> -/// </ul> -static NSString *const kFIREventSignUp NS_SWIFT_NAME(AnalyticsEventSignUp) = @"sign_up"; - -/// Spend Virtual Currency event. This event tracks the sale of virtual goods in your app and can -/// help you identify which virtual goods are the most popular objects of purchase. Params: -/// -/// <ul> -/// <li>@c kFIRParameterItemName (NSString)</li> -/// <li>@c kFIRParameterVirtualCurrencyName (NSString)</li> -/// <li>@c kFIRParameterValue (signed 64-bit integer or double as NSNumber)</li> -/// </ul> -static NSString *const kFIREventSpendVirtualCurrency - NS_SWIFT_NAME(AnalyticsEventSpendVirtualCurrency) = @"spend_virtual_currency"; - -/// Tutorial Begin event. This event signifies the start of the on-boarding process in your app. Use -/// this in a funnel with kFIREventTutorialComplete to understand how many users complete this -/// process and move on to the full app experience. -static NSString *const kFIREventTutorialBegin NS_SWIFT_NAME(AnalyticsEventTutorialBegin) = - @"tutorial_begin"; - -/// Tutorial End event. Use this event to signify the user's completion of your app's on-boarding -/// process. Add this to a funnel with kFIREventTutorialBegin to gauge the completion rate of your -/// on-boarding process. -static NSString *const kFIREventTutorialComplete NS_SWIFT_NAME(AnalyticsEventTutorialComplete) = - @"tutorial_complete"; - -/// Unlock Achievement event. Log this event when the user has unlocked an achievement in your -/// game. Since achievements generally represent the breadth of a gaming experience, this event can -/// help you understand how many users are experiencing all that your game has to offer. Params: -/// -/// <ul> -/// <li>@c kFIRParameterAchievementID (NSString)</li> -/// </ul> -static NSString *const kFIREventUnlockAchievement NS_SWIFT_NAME(AnalyticsEventUnlockAchievement) = - @"unlock_achievement"; - -/// View Item event. This event signifies that some content was shown to the user. This content may -/// be a product, a webpage or just a simple image or text. Use the appropriate parameters to -/// contextualize the event. Use this event to discover the most popular items viewed in your app. -/// Note: If you supply the @c kFIRParameterValue parameter, you must also supply the -/// @c kFIRParameterCurrency parameter so that revenue metrics can be computed accurately. -/// Params: -/// -/// <ul> -/// <li>@c kFIRParameterItemID (NSString)</li> -/// <li>@c kFIRParameterItemName (NSString)</li> -/// <li>@c kFIRParameterItemCategory (NSString)</li> -/// <li>@c kFIRParameterItemLocationID (NSString) (optional)</li> -/// <li>@c kFIRParameterPrice (double as NSNumber) (optional)</li> -/// <li>@c kFIRParameterQuantity (signed 64-bit integer as NSNumber) (optional)</li> -/// <li>@c kFIRParameterCurrency (NSString) (optional)</li> -/// <li>@c kFIRParameterValue (double as NSNumber) (optional)</li> -/// <li>@c kFIRParameterStartDate (NSString) (optional)</li> -/// <li>@c kFIRParameterEndDate (NSString) (optional)</li> -/// <li>@c kFIRParameterFlightNumber (NSString) (optional) for travel bookings</li> -/// <li>@c kFIRParameterNumberOfPassengers (signed 64-bit integer as NSNumber) (optional) -/// for travel bookings</li> -/// <li>@c kFIRParameterNumberOfNights (signed 64-bit integer as NSNumber) (optional) for -/// travel bookings</li> -/// <li>@c kFIRParameterNumberOfRooms (signed 64-bit integer as NSNumber) (optional) for -/// travel bookings</li> -/// <li>@c kFIRParameterOrigin (NSString) (optional)</li> -/// <li>@c kFIRParameterDestination (NSString) (optional)</li> -/// <li>@c kFIRParameterSearchTerm (NSString) (optional) for travel bookings</li> -/// <li>@c kFIRParameterTravelClass (NSString) (optional) for travel bookings</li> -/// </ul> -static NSString *const kFIREventViewItem NS_SWIFT_NAME(AnalyticsEventViewItem) = @"view_item"; - -/// View Item List event. Log this event when the user has been presented with a list of items of a -/// certain category. Params: -/// -/// <ul> -/// <li>@c kFIRParameterItemCategory (NSString)</li> -/// </ul> -static NSString *const kFIREventViewItemList NS_SWIFT_NAME(AnalyticsEventViewItemList) = - @"view_item_list"; - -/// View Search Results event. Log this event when the user has been presented with the results of a -/// search. Params: -/// -/// <ul> -/// <li>@c kFIRParameterSearchTerm (NSString)</li> -/// </ul> -static NSString *const kFIREventViewSearchResults NS_SWIFT_NAME(AnalyticsEventViewSearchResults) = - @"view_search_results"; - -/// Level Start event. Log this event when the user starts a new level. Params: -/// -/// <ul> -/// <li>@c kFIRParameterLevelName (NSString)</li> -/// </ul> -static NSString *const kFIREventLevelStart NS_SWIFT_NAME(AnalyticsEventLevelStart) = - @"level_start"; - -/// Level End event. Log this event when the user finishes a level. Params: -/// -/// <ul> -/// <li>@c kFIRParameterLevelName (NSString)</li> -/// <li>@c kFIRParameterSuccess (NSString)</li> -/// </ul> -static NSString *const kFIREventLevelEnd NS_SWIFT_NAME(AnalyticsEventLevelEnd) = @"level_end"; diff --git a/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRParameterNames.h b/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRParameterNames.h @@ -1,532 +0,0 @@ -/// @file FIRParameterNames.h -/// -/// Predefined event parameter names. -/// -/// Params supply information that contextualize Events. You can associate up to 25 unique Params -/// with each Event type. Some Params are suggested below for certain common Events, but you are -/// not limited to these. You may supply extra Params for suggested Events or custom Params for -/// Custom events. Param names can be up to 40 characters long, may only contain alphanumeric -/// characters and underscores ("_"), and must start with an alphabetic character. Param values can -/// be up to 100 characters long. The "firebase_", "google_", and "ga_" prefixes are reserved and -/// should not be used. - -#import <Foundation/Foundation.h> - -/// Game achievement ID (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterAchievementID : @"10_matches_won", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterAchievementID NS_SWIFT_NAME(AnalyticsParameterAchievementID) = - @"achievement_id"; - -/// Ad Network Click ID (NSString). Used for network-specific click IDs which vary in format. -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterAdNetworkClickID : @"1234567", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterAdNetworkClickID - NS_SWIFT_NAME(AnalyticsParameterAdNetworkClickID) = @"aclid"; - -/// The store or affiliation from which this transaction occurred (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterAffiliation : @"Google Store", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterAffiliation NS_SWIFT_NAME(AnalyticsParameterAffiliation) = - @"affiliation"; - -/// The individual campaign name, slogan, promo code, etc. Some networks have pre-defined macro to -/// capture campaign information, otherwise can be populated by developer. Highly Recommended -/// (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterCampaign : @"winter_promotion", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterCampaign NS_SWIFT_NAME(AnalyticsParameterCampaign) = - @"campaign"; - -/// Character used in game (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterCharacter : @"beat_boss", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterCharacter NS_SWIFT_NAME(AnalyticsParameterCharacter) = - @"character"; - -/// The checkout step (1..N) (unsigned 64-bit integer as NSNumber). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterCheckoutStep : @"1", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterCheckoutStep NS_SWIFT_NAME(AnalyticsParameterCheckoutStep) = - @"checkout_step"; - -/// Some option on a step in an ecommerce flow (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterCheckoutOption : @"Visa", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterCheckoutOption - NS_SWIFT_NAME(AnalyticsParameterCheckoutOption) = @"checkout_option"; - -/// Campaign content (NSString). -static NSString *const kFIRParameterContent NS_SWIFT_NAME(AnalyticsParameterContent) = @"content"; - -/// Type of content selected (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterContentType : @"news article", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterContentType NS_SWIFT_NAME(AnalyticsParameterContentType) = - @"content_type"; - -/// Coupon code for a purchasable item (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterCoupon : @"zz123", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterCoupon NS_SWIFT_NAME(AnalyticsParameterCoupon) = @"coupon"; - -/// Campaign custom parameter (NSString). Used as a method of capturing custom data in a campaign. -/// Use varies by network. -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterCP1 : @"custom_data", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterCP1 NS_SWIFT_NAME(AnalyticsParameterCP1) = @"cp1"; - -/// The name of a creative used in a promotional spot (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterCreativeName : @"Summer Sale", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterCreativeName NS_SWIFT_NAME(AnalyticsParameterCreativeName) = - @"creative_name"; - -/// The name of a creative slot (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterCreativeSlot : @"summer_banner2", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterCreativeSlot NS_SWIFT_NAME(AnalyticsParameterCreativeSlot) = - @"creative_slot"; - -/// Purchase currency in 3-letter <a href="http://en.wikipedia.org/wiki/ISO_4217#Active_codes"> -/// ISO_4217</a> format (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterCurrency : @"USD", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterCurrency NS_SWIFT_NAME(AnalyticsParameterCurrency) = - @"currency"; - -/// Flight or Travel destination (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterDestination : @"Mountain View, CA", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterDestination NS_SWIFT_NAME(AnalyticsParameterDestination) = - @"destination"; - -/// The arrival date, check-out date or rental end date for the item. This should be in -/// YYYY-MM-DD format (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterEndDate : @"2015-09-14", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterEndDate NS_SWIFT_NAME(AnalyticsParameterEndDate) = @"end_date"; - -/// Flight number for travel events (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterFlightNumber : @"ZZ800", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterFlightNumber NS_SWIFT_NAME(AnalyticsParameterFlightNumber) = - @"flight_number"; - -/// Group/clan/guild ID (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterGroupID : @"g1", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterGroupID NS_SWIFT_NAME(AnalyticsParameterGroupID) = @"group_id"; - -/// Index of an item in a list (signed 64-bit integer as NSNumber). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterIndex : @(1), -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterIndex NS_SWIFT_NAME(AnalyticsParameterIndex) = @"index"; - -/// Item brand (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterItemBrand : @"Google", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterItemBrand NS_SWIFT_NAME(AnalyticsParameterItemBrand) = - @"item_brand"; - -/// Item category (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterItemCategory : @"t-shirts", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterItemCategory NS_SWIFT_NAME(AnalyticsParameterItemCategory) = - @"item_category"; - -/// Item ID (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterItemID : @"p7654", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterItemID NS_SWIFT_NAME(AnalyticsParameterItemID) = @"item_id"; - -/// The Google <a href="https://developers.google.com/places/place-id">Place ID</a> (NSString) that -/// corresponds to the associated item. Alternatively, you can supply your own custom Location ID. -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterItemLocationID : @"ChIJiyj437sx3YAR9kUWC8QkLzQ", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterItemLocationID - NS_SWIFT_NAME(AnalyticsParameterItemLocationID) = @"item_location_id"; - -/// Item name (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterItemName : @"abc", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterItemName NS_SWIFT_NAME(AnalyticsParameterItemName) = - @"item_name"; - -/// The list in which the item was presented to the user (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterItemList : @"Search Results", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterItemList NS_SWIFT_NAME(AnalyticsParameterItemList) = - @"item_list"; - -/// Item variant (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterItemVariant : @"Red", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterItemVariant NS_SWIFT_NAME(AnalyticsParameterItemVariant) = - @"item_variant"; - -/// Level in game (signed 64-bit integer as NSNumber). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterLevel : @(42), -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterLevel NS_SWIFT_NAME(AnalyticsParameterLevel) = @"level"; - -/// Location (NSString). The Google <a href="https://developers.google.com/places/place-id">Place ID -/// </a> that corresponds to the associated event. Alternatively, you can supply your own custom -/// Location ID. -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterLocation : @"ChIJiyj437sx3YAR9kUWC8QkLzQ", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterLocation NS_SWIFT_NAME(AnalyticsParameterLocation) = - @"location"; - -/// The advertising or marketing medium, for example: cpc, banner, email, push. Highly recommended -/// (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterMedium : @"email", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterMedium NS_SWIFT_NAME(AnalyticsParameterMedium) = @"medium"; - -/// Number of nights staying at hotel (signed 64-bit integer as NSNumber). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterNumberOfNights : @(3), -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterNumberOfNights - NS_SWIFT_NAME(AnalyticsParameterNumberOfNights) = @"number_of_nights"; - -/// Number of passengers traveling (signed 64-bit integer as NSNumber). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterNumberOfPassengers : @(11), -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterNumberOfPassengers - NS_SWIFT_NAME(AnalyticsParameterNumberOfPassengers) = @"number_of_passengers"; - -/// Number of rooms for travel events (signed 64-bit integer as NSNumber). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterNumberOfRooms : @(2), -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterNumberOfRooms NS_SWIFT_NAME(AnalyticsParameterNumberOfRooms) = - @"number_of_rooms"; - -/// Flight or Travel origin (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterOrigin : @"Mountain View, CA", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterOrigin NS_SWIFT_NAME(AnalyticsParameterOrigin) = @"origin"; - -/// Purchase price (double as NSNumber). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterPrice : @(1.0), -/// kFIRParameterCurrency : @"USD", // e.g. $1.00 USD -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterPrice NS_SWIFT_NAME(AnalyticsParameterPrice) = @"price"; - -/// Purchase quantity (signed 64-bit integer as NSNumber). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterQuantity : @(1), -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterQuantity NS_SWIFT_NAME(AnalyticsParameterQuantity) = - @"quantity"; - -/// Score in game (signed 64-bit integer as NSNumber). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterScore : @(4200), -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterScore NS_SWIFT_NAME(AnalyticsParameterScore) = @"score"; - -/// The search string/keywords used (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterSearchTerm : @"periodic table", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterSearchTerm NS_SWIFT_NAME(AnalyticsParameterSearchTerm) = - @"search_term"; - -/// Shipping cost (double as NSNumber). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterShipping : @(9.50), -/// kFIRParameterCurrency : @"USD", // e.g. $9.50 USD -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterShipping NS_SWIFT_NAME(AnalyticsParameterShipping) = - @"shipping"; - -/// Sign up method (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterSignUpMethod : @"google", -/// // ... -/// }; -/// </pre> -/// -/// <b>This constant has been deprecated. Use Method constant instead.</b> -static NSString *const kFIRParameterSignUpMethod NS_SWIFT_NAME(AnalyticsParameterSignUpMethod) = - @"sign_up_method"; - -/// A particular approach used in an operation; for example, "facebook" or "email" in the context -/// of a sign_up or login event. (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterMethod : @"google", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterMethod NS_SWIFT_NAME(AnalyticsParameterMethod) = @"method"; - -/// The origin of your traffic, such as an Ad network (for example, google) or partner (urban -/// airship). Identify the advertiser, site, publication, etc. that is sending traffic to your -/// property. Highly recommended (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterSource : @"InMobi", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterSource NS_SWIFT_NAME(AnalyticsParameterSource) = @"source"; - -/// The departure date, check-in date or rental start date for the item. This should be in -/// YYYY-MM-DD format (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterStartDate : @"2015-09-14", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterStartDate NS_SWIFT_NAME(AnalyticsParameterStartDate) = - @"start_date"; - -/// Tax amount (double as NSNumber). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterTax : @(1.0), -/// kFIRParameterCurrency : @"USD", // e.g. $1.00 USD -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterTax NS_SWIFT_NAME(AnalyticsParameterTax) = @"tax"; - -/// If you're manually tagging keyword campaigns, you should use utm_term to specify the keyword -/// (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterTerm : @"game", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterTerm NS_SWIFT_NAME(AnalyticsParameterTerm) = @"term"; - -/// A single ID for a ecommerce group transaction (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterTransactionID : @"ab7236dd9823", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterTransactionID NS_SWIFT_NAME(AnalyticsParameterTransactionID) = - @"transaction_id"; - -/// Travel class (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterTravelClass : @"business", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterTravelClass NS_SWIFT_NAME(AnalyticsParameterTravelClass) = - @"travel_class"; - -/// A context-specific numeric value which is accumulated automatically for each event type. This is -/// a general purpose parameter that is useful for accumulating a key metric that pertains to an -/// event. Examples include revenue, distance, time and points. Value should be specified as signed -/// 64-bit integer or double as NSNumber. Notes: Values for pre-defined currency-related events -/// (such as @c kFIREventAddToCart) should be supplied using double as NSNumber and must be -/// accompanied by a @c kFIRParameterCurrency parameter. The valid range of accumulated values is -/// [-9,223,372,036,854.77, 9,223,372,036,854.77]. Supplying a non-numeric value, omitting the -/// corresponding @c kFIRParameterCurrency parameter, or supplying an invalid -/// <a href="https://goo.gl/qqX3J2">currency code</a> for conversion events will cause that -/// conversion to be omitted from reporting. -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterValue : @(3.99), -/// kFIRParameterCurrency : @"USD", // e.g. $3.99 USD -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterValue NS_SWIFT_NAME(AnalyticsParameterValue) = @"value"; - -/// Name of virtual currency type (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterVirtualCurrencyName : @"virtual_currency_name", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterVirtualCurrencyName - NS_SWIFT_NAME(AnalyticsParameterVirtualCurrencyName) = @"virtual_currency_name"; - -/// The name of a level in a game (NSString). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterLevelName : @"room_1", -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterLevelName NS_SWIFT_NAME(AnalyticsParameterLevelName) = - @"level_name"; - -/// The result of an operation. Specify 1 to indicate success and 0 to indicate failure (unsigned -/// integer as NSNumber). -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterSuccess : @(1), -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterSuccess NS_SWIFT_NAME(AnalyticsParameterSuccess) = @"success"; - -/// Indicates that the associated event should either extend the current session -/// or start a new session if no session was active when the event was logged. -/// Specify YES to extend the current session or to start a new session; any -/// other value will not extend or start a session. -/// <pre> -/// NSDictionary *params = @{ -/// kFIRParameterExtendSession : @YES, -/// // ... -/// }; -/// </pre> -static NSString *const kFIRParameterExtendSession NS_SWIFT_NAME(AnalyticsParameterExtendSession) = - @"extend_session"; diff --git a/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h b/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h @@ -1,17 +0,0 @@ -/// @file FIRUserPropertyNames.h -/// -/// Predefined user property names. -/// -/// A UserProperty is an attribute that describes the app-user. By supplying UserProperties, you can -/// later analyze different behaviors of various segments of your userbase. You may supply up to 25 -/// unique UserProperties per app, and you can use the name and value of your choosing for each one. -/// UserProperty names can be up to 24 characters long, may only contain alphanumeric characters and -/// underscores ("_"), and must start with an alphabetic character. UserProperty values can be up to -/// 36 characters long. The "firebase_", "google_", and "ga_" prefixes are reserved and should not -/// be used. - -#import <Foundation/Foundation.h> - -/// The method used to sign in. For example, "google", "facebook" or "twitter". -static NSString *const kFIRUserPropertySignUpMethod - NS_SWIFT_NAME(AnalyticsUserPropertySignUpMethod) = @"sign_up_method"; diff --git a/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h b/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h @@ -1,5 +0,0 @@ -#import "FIRAnalytics+AppDelegate.h" -#import "FIRAnalytics.h" -#import "FIREventNames.h" -#import "FIRParameterNames.h" -#import "FIRUserPropertyNames.h" diff --git a/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Modules/module.modulemap b/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Modules/module.modulemap @@ -1,10 +0,0 @@ -framework module FirebaseAnalytics { - umbrella header "FirebaseAnalytics.h" - export * - module * { export *} - link "sqlite3" - link "z" - link framework "Security" - link framework "StoreKit" - link framework "SystemConfiguration" - link framework "UIKit"} diff --git a/Pods/FirebaseAnalytics/Frameworks/FirebaseCoreDiagnostics.framework/FirebaseCoreDiagnostics b/Pods/FirebaseAnalytics/Frameworks/FirebaseCoreDiagnostics.framework/FirebaseCoreDiagnostics Binary files differ. diff --git a/Pods/FirebaseAnalytics/Frameworks/FirebaseCoreDiagnostics.framework/Modules/module.modulemap b/Pods/FirebaseAnalytics/Frameworks/FirebaseCoreDiagnostics.framework/Modules/module.modulemap @@ -1,6 +0,0 @@ -framework module FirebaseCoreDiagnostics { - export * - module * { export *} - link "z" - link framework "Security" - link framework "SystemConfiguration"} diff --git a/Pods/FirebaseCore/Firebase/Core/FIRAnalyticsConfiguration.m b/Pods/FirebaseCore/Firebase/Core/FIRAnalyticsConfiguration.m @@ -1,69 +0,0 @@ -// Copyright 2017 Google -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#import "FIRAnalyticsConfiguration.h" - -#import "Private/FIRAnalyticsConfiguration+Internal.h" - -@implementation FIRAnalyticsConfiguration - -+ (FIRAnalyticsConfiguration *)sharedInstance { - static FIRAnalyticsConfiguration *sharedInstance = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedInstance = [[FIRAnalyticsConfiguration alloc] init]; - }); - return sharedInstance; -} - -- (void)postNotificationName:(NSString *)name value:(id)value { - if (!name.length || !value) { - return; - } - [[NSNotificationCenter defaultCenter] postNotificationName:name - object:self - userInfo:@{name : value}]; -} - -- (void)setMinimumSessionInterval:(NSTimeInterval)minimumSessionInterval { - [self postNotificationName:kFIRAnalyticsConfigurationSetMinimumSessionIntervalNotification - value:@(minimumSessionInterval)]; -} - -- (void)setSessionTimeoutInterval:(NSTimeInterval)sessionTimeoutInterval { - [self postNotificationName:kFIRAnalyticsConfigurationSetSessionTimeoutIntervalNotification - value:@(sessionTimeoutInterval)]; -} - -- (void)setAnalyticsCollectionEnabled:(BOOL)analyticsCollectionEnabled { - [self setAnalyticsCollectionEnabled:analyticsCollectionEnabled persistSetting:YES]; -} - -- (void)setAnalyticsCollectionEnabled:(BOOL)analyticsCollectionEnabled - persistSetting:(BOOL)shouldPersist { - // Persist the measurementEnabledState. Use FIRAnalyticsEnabledState values instead of YES/NO. - FIRAnalyticsEnabledState analyticsEnabledState = - analyticsCollectionEnabled ? kFIRAnalyticsEnabledStateSetYes : kFIRAnalyticsEnabledStateSetNo; - if (shouldPersist) { - NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; - [userDefaults setObject:@(analyticsEnabledState) - forKey:kFIRAPersistedConfigMeasurementEnabledStateKey]; - [userDefaults synchronize]; - } - - [self postNotificationName:kFIRAnalyticsConfigurationSetEnabledNotification - value:@(analyticsCollectionEnabled)]; -} - -@end diff --git a/Pods/FirebaseCore/Firebase/Core/FIRApp.m b/Pods/FirebaseCore/Firebase/Core/FIRApp.m @@ -1,784 +0,0 @@ -// Copyright 2017 Google -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include <sys/utsname.h> - -#import "FIRApp.h" -#import "FIRConfiguration.h" -#import "Private/FIRAnalyticsConfiguration+Internal.h" -#import "Private/FIRAppInternal.h" -#import "Private/FIRBundleUtil.h" -#import "Private/FIRComponentContainerInternal.h" -#import "Private/FIRLibrary.h" -#import "Private/FIRLogger.h" -#import "Private/FIROptionsInternal.h" - -NSString *const kFIRServiceAdMob = @"AdMob"; -NSString *const kFIRServiceAuth = @"Auth"; -NSString *const kFIRServiceAuthUI = @"AuthUI"; -NSString *const kFIRServiceCrash = @"Crash"; -NSString *const kFIRServiceDatabase = @"Database"; -NSString *const kFIRServiceDynamicLinks = @"DynamicLinks"; -NSString *const kFIRServiceFirestore = @"Firestore"; -NSString *const kFIRServiceFunctions = @"Functions"; -NSString *const kFIRServiceInstanceID = @"InstanceID"; -NSString *const kFIRServiceInvites = @"Invites"; -NSString *const kFIRServiceMessaging = @"Messaging"; -NSString *const kFIRServiceMeasurement = @"Measurement"; -NSString *const kFIRServicePerformance = @"Performance"; -NSString *const kFIRServiceRemoteConfig = @"RemoteConfig"; -NSString *const kFIRServiceStorage = @"Storage"; -NSString *const kGGLServiceAnalytics = @"Analytics"; -NSString *const kGGLServiceSignIn = @"SignIn"; - -NSString *const kFIRDefaultAppName = @"__FIRAPP_DEFAULT"; -NSString *const kFIRAppReadyToConfigureSDKNotification = @"FIRAppReadyToConfigureSDKNotification"; -NSString *const kFIRAppDeleteNotification = @"FIRAppDeleteNotification"; -NSString *const kFIRAppIsDefaultAppKey = @"FIRAppIsDefaultAppKey"; -NSString *const kFIRAppNameKey = @"FIRAppNameKey"; -NSString *const kFIRGoogleAppIDKey = @"FIRGoogleAppIDKey"; - -NSString *const kFIRGlobalAppDataCollectionEnabledDefaultsKeyFormat = - @"/google/firebase/global_data_collection_enabled:%@"; -NSString *const kFIRGlobalAppDataCollectionEnabledPlistKey = - @"FirebaseDataCollectionDefaultEnabled"; - -NSString *const kFIRAppDiagnosticsNotification = @"FIRAppDiagnosticsNotification"; - -NSString *const kFIRAppDiagnosticsConfigurationTypeKey = @"ConfigType"; -NSString *const kFIRAppDiagnosticsErrorKey = @"Error"; -NSString *const kFIRAppDiagnosticsFIRAppKey = @"FIRApp"; -NSString *const kFIRAppDiagnosticsSDKNameKey = @"SDKName"; -NSString *const kFIRAppDiagnosticsSDKVersionKey = @"SDKVersion"; - -// Auth internal notification notification and key. -NSString *const FIRAuthStateDidChangeInternalNotification = - @"FIRAuthStateDidChangeInternalNotification"; -NSString *const FIRAuthStateDidChangeInternalNotificationAppKey = - @"FIRAuthStateDidChangeInternalNotificationAppKey"; -NSString *const FIRAuthStateDidChangeInternalNotificationTokenKey = - @"FIRAuthStateDidChangeInternalNotificationTokenKey"; -NSString *const FIRAuthStateDidChangeInternalNotificationUIDKey = - @"FIRAuthStateDidChangeInternalNotificationUIDKey"; - -/** - * The URL to download plist files. - */ -static NSString *const kPlistURL = @"https://console.firebase.google.com/"; - -/** - * An array of all classes that registered as `FIRCoreConfigurable` in order to receive lifecycle - * events from Core. - */ -static NSMutableArray<Class<FIRLibrary>> *sRegisteredAsConfigurable; - -@interface FIRApp () - -#ifdef DEBUG -@property(nonatomic) BOOL alreadyOutputDataCollectionFlag; -#endif // DEBUG - -@end - -@implementation FIRApp - -// This is necessary since our custom getter prevents `_options` from being created. -@synthesize options = _options; - -static NSMutableDictionary *sAllApps; -static FIRApp *sDefaultApp; -static NSMutableDictionary *sLibraryVersions; - -+ (void)configure { - FIROptions *options = [FIROptions defaultOptions]; - if (!options) { - // Read the Info.plist to see if the flag is set. At this point we can't check any user defaults - // since the app isn't configured at all, so only rely on the Info.plist value. - NSNumber *collectionEnabledPlistValue = [[self class] readDataCollectionSwitchFromPlist]; - if (collectionEnabledPlistValue == nil || [collectionEnabledPlistValue boolValue]) { - [[NSNotificationCenter defaultCenter] - postNotificationName:kFIRAppDiagnosticsNotification - object:nil - userInfo:@{ - kFIRAppDiagnosticsConfigurationTypeKey : @(FIRConfigTypeCore), - kFIRAppDiagnosticsErrorKey : [FIRApp errorForMissingOptions] - }]; - } - - [NSException raise:kFirebaseCoreErrorDomain - format:@"`[FIRApp configure];` (`FirebaseApp.configure()` in Swift) could not find " - @"a valid GoogleService-Info.plist in your project. Please download one " - @"from %@.", - kPlistURL]; - } - [FIRApp configureWithOptions:options]; -#if TARGET_OS_OSX || TARGET_OS_TV - FIRLogNotice(kFIRLoggerCore, @"I-COR000028", - @"tvOS and macOS SDK support is not part of the official Firebase product. " - @"Instead they are community supported. Details at " - @"https://github.com/firebase/firebase-ios-sdk/blob/master/README.md."); -#endif -} - -+ (void)configureWithOptions:(FIROptions *)options { - if (!options) { - [NSException raise:kFirebaseCoreErrorDomain - format:@"Options is nil. Please pass a valid options."]; - } - [FIRApp configureWithName:kFIRDefaultAppName options:options]; -} - -+ (void)configureWithName:(NSString *)name options:(FIROptions *)options { - if (!name || !options) { - [NSException raise:kFirebaseCoreErrorDomain format:@"Neither name nor options can be nil."]; - } - if (name.length == 0) { - [NSException raise:kFirebaseCoreErrorDomain format:@"Name cannot be empty."]; - } - - if ([name isEqualToString:kFIRDefaultAppName]) { - if (sDefaultApp) { - [NSException raise:kFirebaseCoreErrorDomain - format:@"Default app has already been configured."]; - } - - FIRLogDebug(kFIRLoggerCore, @"I-COR000001", @"Configuring the default app."); - } else { - // Validate the app name and ensure it hasn't been configured already. - for (NSUInteger charIndex = 0; charIndex < name.length; charIndex++) { - char character = [name characterAtIndex:charIndex]; - if (!((character >= 'a' && character <= 'z') || (character >= 'A' && character <= 'Z') || - (character >= '0' && character <= '9') || character == '_' || character == '-')) { - [NSException raise:kFirebaseCoreErrorDomain - format:@"App name should only contain Letters, " - @"Numbers, Underscores, and Dashes."]; - } - } - - if (sAllApps && sAllApps[name]) { - [NSException raise:kFirebaseCoreErrorDomain - format:@"App named %@ has already been configured.", name]; - } - - FIRLogDebug(kFIRLoggerCore, @"I-COR000002", @"Configuring app named %@", name); - } - - @synchronized(self) { - FIRApp *app = [[FIRApp alloc] initInstanceWithName:name options:options]; - if (app.isDefaultApp) { - sDefaultApp = app; - } - - [FIRApp addAppToAppDictionary:app]; - [FIRApp sendNotificationsToSDKs:app]; - } -} - -+ (FIRApp *)defaultApp { - if (sDefaultApp) { - return sDefaultApp; - } - FIRLogError(kFIRLoggerCore, @"I-COR000003", - @"The default Firebase app has not yet been " - @"configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your " - @"application initialization. Read more: https://goo.gl/ctyzm8."); - return nil; -} - -+ (FIRApp *)appNamed:(NSString *)name { - @synchronized(self) { - if (sAllApps) { - FIRApp *app = sAllApps[name]; - if (app) { - return app; - } - } - FIRLogError(kFIRLoggerCore, @"I-COR000004", @"App with name %@ does not exist.", name); - return nil; - } -} - -+ (NSDictionary *)allApps { - @synchronized(self) { - if (!sAllApps) { - FIRLogError(kFIRLoggerCore, @"I-COR000005", @"No app has been configured yet."); - } - NSDictionary *dict = [NSDictionary dictionaryWithDictionary:sAllApps]; - return dict; - } -} - -// Public only for tests -+ (void)resetApps { - sDefaultApp = nil; - [sAllApps removeAllObjects]; - sAllApps = nil; - [sLibraryVersions removeAllObjects]; - sLibraryVersions = nil; -} - -- (void)deleteApp:(FIRAppVoidBoolCallback)completion { - @synchronized([self class]) { - if (sAllApps && sAllApps[self.name]) { - FIRLogDebug(kFIRLoggerCore, @"I-COR000006", @"Deleting app named %@", self.name); - - // Remove all cached instances from the container before deleting the app. - [self.container removeAllCachedInstances]; - - [sAllApps removeObjectForKey:self.name]; - [self clearDataCollectionSwitchFromUserDefaults]; - if ([self.name isEqualToString:kFIRDefaultAppName]) { - sDefaultApp = nil; - } - NSDictionary *appInfoDict = @{kFIRAppNameKey : self.name}; - [[NSNotificationCenter defaultCenter] postNotificationName:kFIRAppDeleteNotification - object:[self class] - userInfo:appInfoDict]; - completion(YES); - } else { - FIRLogError(kFIRLoggerCore, @"I-COR000007", @"App does not exist."); - completion(NO); - } - } -} - -+ (void)addAppToAppDictionary:(FIRApp *)app { - if (!sAllApps) { - sAllApps = [NSMutableDictionary dictionary]; - } - if ([app configureCore]) { - sAllApps[app.name] = app; - } else { - [NSException raise:kFirebaseCoreErrorDomain - format:@"Configuration fails. It may be caused by an invalid GOOGLE_APP_ID in " - @"GoogleService-Info.plist or set in the customized options."]; - } -} - -- (instancetype)initInstanceWithName:(NSString *)name options:(FIROptions *)options { - self = [super init]; - if (self) { - _name = [name copy]; - _options = [options copy]; - _options.editingLocked = YES; - _isDefaultApp = [name isEqualToString:kFIRDefaultAppName]; - _container = [[FIRComponentContainer alloc] initWithApp:self]; - } - return self; -} - -- (BOOL)configureCore { - [self checkExpectedBundleID]; - if (![self isAppIDValid]) { - if (_options.usingOptionsFromDefaultPlist && [self isDataCollectionDefaultEnabled]) { - [[NSNotificationCenter defaultCenter] - postNotificationName:kFIRAppDiagnosticsNotification - object:nil - userInfo:@{ - kFIRAppDiagnosticsConfigurationTypeKey : @(FIRConfigTypeCore), - kFIRAppDiagnosticsErrorKey : [FIRApp errorForInvalidAppID], - }]; - } - return NO; - } - - if ([self isDataCollectionDefaultEnabled]) { - [[NSNotificationCenter defaultCenter] - postNotificationName:kFIRAppDiagnosticsNotification - object:nil - userInfo:@{ - kFIRAppDiagnosticsConfigurationTypeKey : @(FIRConfigTypeCore), - kFIRAppDiagnosticsFIRAppKey : self - }]; - } - -#if TARGET_OS_IOS - // Initialize the Analytics once there is a valid options under default app. Analytics should - // always initialize first by itself before the other SDKs. - if ([self.name isEqualToString:kFIRDefaultAppName]) { - Class firAnalyticsClass = NSClassFromString(@"FIRAnalytics"); - if (!firAnalyticsClass) { - FIRLogWarning(kFIRLoggerCore, @"I-COR000022", - @"Firebase Analytics is not available. To add it, include Firebase/Core in the " - @"Podfile or add FirebaseAnalytics.framework to the Link Build Phase"); - } else { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wundeclared-selector" - SEL startWithConfigurationSelector = @selector(startWithConfiguration:options:); -#pragma clang diagnostic pop - if ([firAnalyticsClass respondsToSelector:startWithConfigurationSelector]) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-performSelector-leaks" - [firAnalyticsClass performSelector:startWithConfigurationSelector - withObject:[FIRConfiguration sharedInstance].analyticsConfiguration - withObject:_options]; -#pragma clang diagnostic pop - } - } - } -#endif - - return YES; -} - -- (FIROptions *)options { - return [_options copy]; -} - -- (void)setDataCollectionDefaultEnabled:(BOOL)dataCollectionDefaultEnabled { -#ifdef DEBUG - FIRLogDebug(kFIRLoggerCore, @"I-COR000034", @"Explicitly %@ data collection flag.", - dataCollectionDefaultEnabled ? @"enabled" : @"disabled"); - self.alreadyOutputDataCollectionFlag = YES; -#endif // DEBUG - - NSString *key = - [NSString stringWithFormat:kFIRGlobalAppDataCollectionEnabledDefaultsKeyFormat, self.name]; - [[NSUserDefaults standardUserDefaults] setBool:dataCollectionDefaultEnabled forKey:key]; - - // Core also controls the FirebaseAnalytics flag, so check if the Analytics flags are set - // within FIROptions and change the Analytics value if necessary. Analytics only works with the - // default app, so return if this isn't the default app. - if (!self.isDefaultApp) { - return; - } - - // Check if the Analytics flag is explicitly set. If so, no further actions are necessary. - if ([self.options isAnalyticsCollectionExpicitlySet]) { - return; - } - - // The Analytics flag has not been explicitly set, so update with the value being set. - [[FIRAnalyticsConfiguration sharedInstance] - setAnalyticsCollectionEnabled:dataCollectionDefaultEnabled - persistSetting:NO]; -} - -- (BOOL)isDataCollectionDefaultEnabled { - // Check if it's been manually set before in code, and use that as the higher priority value. - NSNumber *defaultsObject = [[self class] readDataCollectionSwitchFromUserDefaultsForApp:self]; - if (defaultsObject != nil) { -#ifdef DEBUG - if (!self.alreadyOutputDataCollectionFlag) { - FIRLogDebug(kFIRLoggerCore, @"I-COR000031", @"Data Collection flag is %@ in user defaults.", - [defaultsObject boolValue] ? @"enabled" : @"disabled"); - self.alreadyOutputDataCollectionFlag = YES; - } -#endif // DEBUG - return [defaultsObject boolValue]; - } - - // Read the Info.plist to see if the flag is set. If it's not set, it should default to `YES`. - // As per the implementation of `readDataCollectionSwitchFromPlist`, it's a cached value and has - // no performance impact calling multiple times. - NSNumber *collectionEnabledPlistValue = [[self class] readDataCollectionSwitchFromPlist]; - if (collectionEnabledPlistValue != nil) { -#ifdef DEBUG - if (!self.alreadyOutputDataCollectionFlag) { - FIRLogDebug(kFIRLoggerCore, @"I-COR000032", @"Data Collection flag is %@ in plist.", - [collectionEnabledPlistValue boolValue] ? @"enabled" : @"disabled"); - self.alreadyOutputDataCollectionFlag = YES; - } -#endif // DEBUG - return [collectionEnabledPlistValue boolValue]; - } - -#ifdef DEBUG - if (!self.alreadyOutputDataCollectionFlag) { - FIRLogDebug(kFIRLoggerCore, @"I-COR000033", @"Data Collection flag is not set."); - self.alreadyOutputDataCollectionFlag = YES; - } -#endif // DEBUG - return YES; -} - -#pragma mark - private - -+ (void)sendNotificationsToSDKs:(FIRApp *)app { - // TODO: Remove this notification once all SDKs are registered with `FIRCoreConfigurable`. - NSNumber *isDefaultApp = [NSNumber numberWithBool:app.isDefaultApp]; - NSDictionary *appInfoDict = @{ - kFIRAppNameKey : app.name, - kFIRAppIsDefaultAppKey : isDefaultApp, - kFIRGoogleAppIDKey : app.options.googleAppID - }; - [[NSNotificationCenter defaultCenter] postNotificationName:kFIRAppReadyToConfigureSDKNotification - object:self - userInfo:appInfoDict]; - - // This is the new way of sending information to SDKs. - // TODO: Do we want this on a background thread, maybe? - for (Class<FIRLibrary> library in sRegisteredAsConfigurable) { - [library configureWithApp:app]; - } -} - -+ (NSError *)errorForMissingOptions { - NSDictionary *errorDict = @{ - NSLocalizedDescriptionKey : - @"Unable to parse GoogleService-Info.plist in order to configure services.", - NSLocalizedRecoverySuggestionErrorKey : - @"Check formatting and location of GoogleService-Info.plist." - }; - return [NSError errorWithDomain:kFirebaseCoreErrorDomain - code:FIRErrorCodeInvalidPlistFile - userInfo:errorDict]; -} - -+ (NSError *)errorForSubspecConfigurationFailureWithDomain:(NSString *)domain - errorCode:(FIRErrorCode)code - service:(NSString *)service - reason:(NSString *)reason { - NSString *description = - [NSString stringWithFormat:@"Configuration failed for service %@.", service]; - NSDictionary *errorDict = - @{NSLocalizedDescriptionKey : description, NSLocalizedFailureReasonErrorKey : reason}; - return [NSError errorWithDomain:domain code:code userInfo:errorDict]; -} - -+ (NSError *)errorForInvalidAppID { - NSDictionary *errorDict = @{ - NSLocalizedDescriptionKey : @"Unable to validate Google App ID", - NSLocalizedRecoverySuggestionErrorKey : - @"Check formatting and location of GoogleService-Info.plist or GoogleAppID set in the " - @"customized options." - }; - return [NSError errorWithDomain:kFirebaseCoreErrorDomain - code:FIRErrorCodeInvalidAppID - userInfo:errorDict]; -} - -+ (BOOL)isDefaultAppConfigured { - return (sDefaultApp != nil); -} - -+ (void)registerLibrary:(nonnull NSString *)name withVersion:(nonnull NSString *)version { - // Create the set of characters which aren't allowed, only if this feature is used. - NSMutableCharacterSet *allowedSet = [NSMutableCharacterSet alphanumericCharacterSet]; - [allowedSet addCharactersInString:@"-_."]; - NSCharacterSet *disallowedSet = [allowedSet invertedSet]; - // Make sure the library name and version strings do not contain unexpected characters, and - // add the name/version pair to the dictionary. - if ([name rangeOfCharacterFromSet:disallowedSet].location == NSNotFound && - [version rangeOfCharacterFromSet:disallowedSet].location == NSNotFound) { - if (!sLibraryVersions) { - sLibraryVersions = [[NSMutableDictionary alloc] init]; - } - sLibraryVersions[name] = version; - } else { - FIRLogError(kFIRLoggerCore, @"I-COR000027", - @"The library name (%@) or version number (%@) contain invalid characters. " - @"Only alphanumeric, dash, underscore and period characters are allowed.", - name, version); - } -} - -+ (void)registerInternalLibrary:(nonnull Class<FIRLibrary>)library - withName:(nonnull NSString *)name - withVersion:(nonnull NSString *)version { - // This is called at +load time, keep the work to a minimum. - - // Ensure the class given conforms to the proper protocol. - if (![(Class)library conformsToProtocol:@protocol(FIRLibrary)] || - ![(Class)library respondsToSelector:@selector(componentsToRegister)]) { - [NSException raise:NSInvalidArgumentException - format:@"Class %@ attempted to register components, but it does not conform to " - @"`FIRLibrary or provide a `componentsToRegister:` method.", - library]; - } - - [FIRComponentContainer registerAsComponentRegistrant:library]; - if ([(Class)library respondsToSelector:@selector(configureWithApp:)]) { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sRegisteredAsConfigurable = [[NSMutableArray alloc] init]; - }); - [sRegisteredAsConfigurable addObject:library]; - } - [self registerLibrary:name withVersion:version]; -} - -+ (NSString *)firebaseUserAgent { - NSMutableArray<NSString *> *libraries = - [[NSMutableArray<NSString *> alloc] initWithCapacity:sLibraryVersions.count]; - for (NSString *libraryName in sLibraryVersions) { - [libraries - addObject:[NSString stringWithFormat:@"%@/%@", libraryName, sLibraryVersions[libraryName]]]; - } - [libraries sortUsingSelector:@selector(localizedCaseInsensitiveCompare:)]; - return [libraries componentsJoinedByString:@" "]; -} - -- (void)checkExpectedBundleID { - NSArray *bundles = [FIRBundleUtil relevantBundles]; - NSString *expectedBundleID = [self expectedBundleID]; - // The checking is only done when the bundle ID is provided in the serviceInfo dictionary for - // backward compatibility. - if (expectedBundleID != nil && ![FIRBundleUtil hasBundleIdentifier:expectedBundleID - inBundles:bundles]) { - FIRLogError(kFIRLoggerCore, @"I-COR000008", - @"The project's Bundle ID is inconsistent with " - @"either the Bundle ID in '%@.%@', or the Bundle ID in the options if you are " - @"using a customized options. To ensure that everything can be configured " - @"correctly, you may need to make the Bundle IDs consistent. To continue with this " - @"plist file, you may change your app's bundle identifier to '%@'. Or you can " - @"download a new configuration file that matches your bundle identifier from %@ " - @"and replace the current one.", - kServiceInfoFileName, kServiceInfoFileType, expectedBundleID, kPlistURL); - } -} - -#pragma mark - private - App ID Validation - -/** - * Validates the format and fingerprint of the app ID contained in GOOGLE_APP_ID in the plist file. - * This is the main method for validating app ID. - * - * @return YES if the app ID fulfills the expected format and fingerprint, NO otherwise. - */ -- (BOOL)isAppIDValid { - NSString *appID = _options.googleAppID; - BOOL isValid = [FIRApp validateAppID:appID]; - if (!isValid) { - NSString *expectedBundleID = [self expectedBundleID]; - FIRLogError(kFIRLoggerCore, @"I-COR000009", - @"The GOOGLE_APP_ID either in the plist file " - @"'%@.%@' or the one set in the customized options is invalid. If you are using " - @"the plist file, use the iOS version of bundle identifier to download the file, " - @"and do not manually edit the GOOGLE_APP_ID. You may change your app's bundle " - @"identifier to '%@'. Or you can download a new configuration file that matches " - @"your bundle identifier from %@ and replace the current one.", - kServiceInfoFileName, kServiceInfoFileType, expectedBundleID, kPlistURL); - }; - return isValid; -} - -+ (BOOL)validateAppID:(NSString *)appID { - // Failing validation only occurs when we are sure we are looking at a V2 app ID and it does not - // have a valid fingerprint, otherwise we just warn about the potential issue. - if (!appID.length) { - return NO; - } - - // All app IDs must start with at least "<version number>:". - NSString *const versionPattern = @"^\\d+:"; - NSRegularExpression *versionRegex = - [NSRegularExpression regularExpressionWithPattern:versionPattern options:0 error:NULL]; - if (!versionRegex) { - return NO; - } - - NSRange appIDRange = NSMakeRange(0, appID.length); - NSArray *versionMatches = [versionRegex matchesInString:appID options:0 range:appIDRange]; - if (versionMatches.count != 1) { - return NO; - } - - NSRange versionRange = [(NSTextCheckingResult *)versionMatches.firstObject range]; - NSString *appIDVersion = [appID substringWithRange:versionRange]; - NSArray *knownVersions = @[ @"1:" ]; - if (![knownVersions containsObject:appIDVersion]) { - // Permit unknown yet properly formatted app ID versions. - return YES; - } - - if (![FIRApp validateAppIDFormat:appID withVersion:appIDVersion]) { - return NO; - } - - if (![FIRApp validateAppIDFingerprint:appID withVersion:appIDVersion]) { - return NO; - } - - return YES; -} - -+ (NSString *)actualBundleID { - return [[NSBundle mainBundle] bundleIdentifier]; -} - -/** - * Validates that the format of the app ID string is what is expected based on the supplied version. - * The version must end in ":". - * - * For v1 app ids the format is expected to be - * '<version #>:<project number>:ios:<fingerprint of bundle id>'. - * - * This method does not verify that the contents of the app id are correct, just that they fulfill - * the expected format. - * - * @param appID Contents of GOOGLE_APP_ID from the plist file. - * @param version Indicates what version of the app id format this string should be. - * @return YES if provided string fufills the expected format, NO otherwise. - */ -+ (BOOL)validateAppIDFormat:(NSString *)appID withVersion:(NSString *)version { - if (!appID.length || !version.length) { - return NO; - } - - if (![version hasSuffix:@":"]) { - return NO; - } - - if (![appID hasPrefix:version]) { - return NO; - } - - NSString *const pattern = @"^\\d+:ios:[a-f0-9]+$"; - NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:pattern - options:0 - error:NULL]; - if (!regex) { - return NO; - } - - NSRange localRange = NSMakeRange(version.length, appID.length - version.length); - NSUInteger numberOfMatches = [regex numberOfMatchesInString:appID options:0 range:localRange]; - if (numberOfMatches != 1) { - return NO; - } - return YES; -} - -/** - * Validates that the fingerprint of the app ID string is what is expected based on the supplied - * version. The version must end in ":". - * - * Note that the v1 hash algorithm is not permitted on the client and cannot be fully validated. - * - * @param appID Contents of GOOGLE_APP_ID from the plist file. - * @param version Indicates what version of the app id format this string should be. - * @return YES if provided string fufills the expected fingerprint and the version is known, NO - * otherwise. - */ -+ (BOOL)validateAppIDFingerprint:(NSString *)appID withVersion:(NSString *)version { - if (!appID.length || !version.length) { - return NO; - } - - if (![version hasSuffix:@":"]) { - return NO; - } - - if (![appID hasPrefix:version]) { - return NO; - } - - // Extract the supplied fingerprint from the supplied app ID. - // This assumes the app ID format is the same for all known versions below. If the app ID format - // changes in future versions, the tokenizing of the app ID format will need to take into account - // the version of the app ID. - NSArray *components = [appID componentsSeparatedByString:@":"]; - if (components.count != 4) { - return NO; - } - - NSString *suppliedFingerprintString = components[3]; - if (!suppliedFingerprintString.length) { - return NO; - } - - uint64_t suppliedFingerprint; - NSScanner *scanner = [NSScanner scannerWithString:suppliedFingerprintString]; - if (![scanner scanHexLongLong:&suppliedFingerprint]) { - return NO; - } - - if ([version isEqual:@"1:"]) { - // The v1 hash algorithm is not permitted on the client so the actual hash cannot be validated. - return YES; - } - - // Unknown version. - return NO; -} - -- (NSString *)expectedBundleID { - return _options.bundleID; -} - -// end App ID validation - -#pragma mark - Reading From Plist & User Defaults - -/** - * Clears the data collection switch from the standard NSUserDefaults for easier testing and - * readability. - */ -- (void)clearDataCollectionSwitchFromUserDefaults { - NSString *key = - [NSString stringWithFormat:kFIRGlobalAppDataCollectionEnabledDefaultsKeyFormat, self.name]; - [[NSUserDefaults standardUserDefaults] removeObjectForKey:key]; -} - -/** - * Reads the data collection switch from the standard NSUserDefaults for easier testing and - * readability. - */ -+ (nullable NSNumber *)readDataCollectionSwitchFromUserDefaultsForApp:(FIRApp *)app { - // Read the object in user defaults, and only return if it's an NSNumber. - NSString *key = - [NSString stringWithFormat:kFIRGlobalAppDataCollectionEnabledDefaultsKeyFormat, app.name]; - id collectionEnabledDefaultsObject = [[NSUserDefaults standardUserDefaults] objectForKey:key]; - if ([collectionEnabledDefaultsObject isKindOfClass:[NSNumber class]]) { - return collectionEnabledDefaultsObject; - } - - return nil; -} - -/** - * Reads the data collection switch from the Info.plist for easier testing and readability. Will - * only read once from the plist and return the cached value. - */ -+ (nullable NSNumber *)readDataCollectionSwitchFromPlist { - static NSNumber *collectionEnabledPlistObject; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - // Read the data from the `Info.plist`, only assign it if it's there and an NSNumber. - id plistValue = [[NSBundle mainBundle] - objectForInfoDictionaryKey:kFIRGlobalAppDataCollectionEnabledPlistKey]; - if (plistValue && [plistValue isKindOfClass:[NSNumber class]]) { - collectionEnabledPlistObject = (NSNumber *)plistValue; - } - }); - - return collectionEnabledPlistObject; -} - -#pragma mark - Sending Logs - -- (void)sendLogsWithServiceName:(NSString *)serviceName - version:(NSString *)version - error:(NSError *)error { - // If the user has manually turned off data collection, return and don't send logs. - if (![self isDataCollectionDefaultEnabled]) { - return; - } - - NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] initWithDictionary:@{ - kFIRAppDiagnosticsConfigurationTypeKey : @(FIRConfigTypeSDK), - kFIRAppDiagnosticsSDKNameKey : serviceName, - kFIRAppDiagnosticsSDKVersionKey : version, - kFIRAppDiagnosticsFIRAppKey : self - }]; - if (error) { - userInfo[kFIRAppDiagnosticsErrorKey] = error; - } - [[NSNotificationCenter defaultCenter] postNotificationName:kFIRAppDiagnosticsNotification - object:nil - userInfo:userInfo]; -} - -@end diff --git a/Pods/FirebaseCore/Firebase/Core/FIRAppAssociationRegistration.m b/Pods/FirebaseCore/Firebase/Core/FIRAppAssociationRegistration.m @@ -1,47 +0,0 @@ -// Copyright 2017 Google -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#import "Private/FIRAppAssociationRegistration.h" - -#import <objc/runtime.h> - -@implementation FIRAppAssociationRegistration - -+ (nullable id)registeredObjectWithHost:(id)host - key:(NSString *)key - creationBlock:(id _Nullable (^)(void))creationBlock { - @synchronized(self) { - SEL dictKey = @selector(registeredObjectWithHost:key:creationBlock:); - NSMutableDictionary<NSString *, id> *objectsByKey = objc_getAssociatedObject(host, dictKey); - if (!objectsByKey) { - objectsByKey = [[NSMutableDictionary alloc] init]; - objc_setAssociatedObject(host, dictKey, objectsByKey, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - } - id obj = objectsByKey[key]; - NSValue *creationBlockBeingCalled = [NSValue valueWithPointer:dictKey]; - if (obj) { - if ([creationBlockBeingCalled isEqual:obj]) { - [NSException raise:@"Reentering registeredObjectWithHost:key:creationBlock: not allowed" - format:@"host: %@ key: %@", host, key]; - } - return obj; - } - objectsByKey[key] = creationBlockBeingCalled; - obj = creationBlock(); - objectsByKey[key] = obj; - return obj; - } -} - -@end diff --git a/Pods/FirebaseCore/Firebase/Core/FIRBundleUtil.m b/Pods/FirebaseCore/Firebase/Core/FIRBundleUtil.m @@ -1,57 +0,0 @@ -// Copyright 2017 Google -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#import "Private/FIRBundleUtil.h" - -@implementation FIRBundleUtil - -+ (NSArray *)relevantBundles { - return @[ [NSBundle mainBundle], [NSBundle bundleForClass:[self class]] ]; -} - -+ (NSString *)optionsDictionaryPathWithResourceName:(NSString *)resourceName - andFileType:(NSString *)fileType - inBundles:(NSArray *)bundles { - // Loop through all bundles to find the config dict. - for (NSBundle *bundle in bundles) { - NSString *path = [bundle pathForResource:resourceName ofType:fileType]; - // Use the first one we find. - if (path) { - return path; - } - } - return nil; -} - -+ (NSArray *)relevantURLSchemes { - NSMutableArray *result = [[NSMutableArray alloc] init]; - for (NSBundle *bundle in [[self class] relevantBundles]) { - NSArray *urlTypes = [bundle objectForInfoDictionaryKey:@"CFBundleURLTypes"]; - for (NSDictionary *urlType in urlTypes) { - [result addObjectsFromArray:urlType[@"CFBundleURLSchemes"]]; - } - } - return result; -} - -+ (BOOL)hasBundleIdentifier:(NSString *)bundleIdentifier inBundles:(NSArray *)bundles { - for (NSBundle *bundle in bundles) { - if ([bundle.bundleIdentifier isEqualToString:bundleIdentifier]) { - return YES; - } - } - return NO; -} - -@end diff --git a/Pods/FirebaseCore/Firebase/Core/FIRComponent.m b/Pods/FirebaseCore/Firebase/Core/FIRComponent.m @@ -1,65 +0,0 @@ -/* - * Copyright 2018 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "Private/FIRComponent.h" - -#import "Private/FIRComponentContainer.h" -#import "Private/FIRDependency.h" - -@interface FIRComponent () - -- (instancetype)initWithProtocol:(Protocol *)protocol - instantiationTiming:(FIRInstantiationTiming)instantiationTiming - dependencies:(NSArray<FIRDependency *> *)dependencies - creationBlock:(FIRComponentCreationBlock)creationBlock; - -@end - -@implementation FIRComponent - -+ (instancetype)componentWithProtocol:(Protocol *)protocol - creationBlock:(FIRComponentCreationBlock)creationBlock { - return [[FIRComponent alloc] initWithProtocol:protocol - instantiationTiming:FIRInstantiationTimingLazy - dependencies:@[] - creationBlock:creationBlock]; -} - -+ (instancetype)componentWithProtocol:(Protocol *)protocol - instantiationTiming:(FIRInstantiationTiming)instantiationTiming - dependencies:(NSArray<FIRDependency *> *)dependencies - creationBlock:(FIRComponentCreationBlock)creationBlock { - return [[FIRComponent alloc] initWithProtocol:protocol - instantiationTiming:instantiationTiming - dependencies:dependencies - creationBlock:creationBlock]; -} - -- (instancetype)initWithProtocol:(Protocol *)protocol - instantiationTiming:(FIRInstantiationTiming)instantiationTiming - dependencies:(NSArray<FIRDependency *> *)dependencies - creationBlock:(FIRComponentCreationBlock)creationBlock { - self = [super init]; - if (self) { - _protocol = protocol; - _instantiationTiming = instantiationTiming; - _dependencies = [dependencies copy]; - _creationBlock = creationBlock; - } - return self; -} - -@end diff --git a/Pods/FirebaseCore/Firebase/Core/FIRComponentContainer.m b/Pods/FirebaseCore/Firebase/Core/FIRComponentContainer.m @@ -1,176 +0,0 @@ -/* - * Copyright 2018 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "Private/FIRComponentContainer.h" - -#import "Private/FIRAppInternal.h" -#import "Private/FIRComponent.h" -#import "Private/FIRLibrary.h" -#import "Private/FIRLogger.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface FIRComponentContainer () - -/// The dictionary of components that are registered for a particular app. The key is an NSString -/// of the protocol. -@property(nonatomic, strong) NSMutableDictionary<NSString *, FIRComponentCreationBlock> *components; - -/// Cached instances of components that requested to be cached. -@property(nonatomic, strong) NSMutableDictionary<NSString *, id> *cachedInstances; - -@end - -@implementation FIRComponentContainer - -// Collection of all classes that register to provide components. -static NSMutableSet<Class> *sFIRComponentRegistrants; - -#pragma mark - Public Registration - -+ (void)registerAsComponentRegistrant:(Class<FIRLibrary>)klass { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sFIRComponentRegistrants = [[NSMutableSet<Class> alloc] init]; - }); - - [self registerAsComponentRegistrant:klass inSet:sFIRComponentRegistrants]; -} - -+ (void)registerAsComponentRegistrant:(Class<FIRLibrary>)klass - inSet:(NSMutableSet<Class> *)allRegistrants { - [allRegistrants addObject:klass]; -} - -#pragma mark - Internal Initialization - -- (instancetype)initWithApp:(FIRApp *)app { - return [self initWithApp:app registrants:sFIRComponentRegistrants]; -} - -- (instancetype)initWithApp:(FIRApp *)app registrants:(NSMutableSet<Class> *)allRegistrants { - self = [super init]; - if (self) { - _app = app; - _cachedInstances = [NSMutableDictionary<NSString *, id> dictionary]; - _components = [NSMutableDictionary<NSString *, FIRComponentCreationBlock> dictionary]; - - [self populateComponentsFromRegisteredClasses:allRegistrants forApp:app]; - } - return self; -} - -- (void)populateComponentsFromRegisteredClasses:(NSSet<Class> *)classes forApp:(FIRApp *)app { - // Loop through the verified component registrants and populate the components array. - for (Class<FIRLibrary> klass in classes) { - // Loop through all the components being registered and store them as appropriate. - // Classes which do not provide functionality should use a dummy FIRComponentRegistrant - // protocol. - for (FIRComponent *component in [klass componentsToRegister]) { - // Check if the component has been registered before, and error out if so. - NSString *protocolName = NSStringFromProtocol(component.protocol); - if (self.components[protocolName]) { - FIRLogError(kFIRLoggerCore, @"I-COR000029", - @"Attempted to register protocol %@, but it already has an implementation.", - protocolName); - continue; - } - - // Store the creation block for later usage. - self.components[protocolName] = component.creationBlock; - - // Instantiate the - BOOL shouldInstantiateEager = - (component.instantiationTiming == FIRInstantiationTimingAlwaysEager); - BOOL shouldInstantiateDefaultEager = - (component.instantiationTiming == FIRInstantiationTimingEagerInDefaultApp && - [app isDefaultApp]); - if (shouldInstantiateEager || shouldInstantiateDefaultEager) { - [self instantiateInstanceForProtocol:component.protocol withBlock:component.creationBlock]; - } - } - } -} - -#pragma mark - Instance Creation - -/// Instantiate an instance of a class that conforms to the specified protocol. -/// This will: -/// - Call the block to create an instance if possible, -/// - Validate that the instance returned conforms to the protocol it claims to, -/// - Cache the instance if the block requests it -- (nullable id)instantiateInstanceForProtocol:(Protocol *)protocol - withBlock:(FIRComponentCreationBlock)creationBlock { - if (!creationBlock) { - return nil; - } - - // Create an instance using the creation block. - BOOL shouldCache = NO; - id instance = creationBlock(self, &shouldCache); - if (!instance) { - return nil; - } - - // An instance was created, validate that it conforms to the protocol it claims to. - NSString *protocolName = NSStringFromProtocol(protocol); - if (![instance conformsToProtocol:protocol]) { - FIRLogError(kFIRLoggerCore, @"I-COR000030", - @"An instance conforming to %@ was requested, but the instance provided does not " - @"conform to the protocol", - protocolName); - } - - // The instance is ready to be returned, but check if it should be cached first before returning. - if (shouldCache) { - self.cachedInstances[protocolName] = instance; - } - - return instance; -} - -#pragma mark - Internal Retrieval - -- (nullable id)instanceForProtocol:(Protocol *)protocol { - // Check if there is a cached instance, and return it if so. - NSString *protocolName = NSStringFromProtocol(protocol); - id cachedInstance = self.cachedInstances[protocolName]; - if (cachedInstance) { - return cachedInstance; - } - - // Use the creation block to instantiate an instance and return it. - FIRComponentCreationBlock creationBlock = self.components[protocolName]; - return [self instantiateInstanceForProtocol:protocol withBlock:creationBlock]; -} - -#pragma mark - Lifecycle - -- (void)removeAllCachedInstances { - // Loop through the cache and notify each instance that is a maintainer to clean up after itself. - for (id instance in self.cachedInstances.allValues) { - if ([instance conformsToProtocol:@protocol(FIRComponentLifecycleMaintainer)] && - [instance respondsToSelector:@selector(appWillBeDeleted:)]) { - [instance appWillBeDeleted:self.app]; - } - } - - [self.cachedInstances removeAllObjects]; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/FirebaseCore/Firebase/Core/FIRComponentType.m b/Pods/FirebaseCore/Firebase/Core/FIRComponentType.m @@ -1,28 +0,0 @@ -/* - * Copyright 2018 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "Private/FIRComponentType.h" - -#import "Private/FIRComponentContainerInternal.h" - -@implementation FIRComponentType - -+ (id)instanceForProtocol:(Protocol *)protocol inContainer:(FIRComponentContainer *)container { - // Forward the call to the container. - return [container instanceForProtocol:protocol]; -} - -@end diff --git a/Pods/FirebaseCore/Firebase/Core/FIRConfiguration.m b/Pods/FirebaseCore/Firebase/Core/FIRConfiguration.m @@ -1,44 +0,0 @@ -// Copyright 2017 Google -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#import "FIRConfiguration.h" - -extern void FIRSetLoggerLevel(FIRLoggerLevel loggerLevel); - -@implementation FIRConfiguration - -+ (instancetype)sharedInstance { - static FIRConfiguration *sharedInstance = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedInstance = [[FIRConfiguration alloc] init]; - }); - return sharedInstance; -} - -- (instancetype)init { - self = [super init]; - if (self) { - _analyticsConfiguration = [FIRAnalyticsConfiguration sharedInstance]; - } - return self; -} - -- (void)setLoggerLevel:(FIRLoggerLevel)loggerLevel { - NSAssert(loggerLevel <= FIRLoggerLevelMax && loggerLevel >= FIRLoggerLevelMin, - @"Invalid logger level, %ld", (long)loggerLevel); - FIRSetLoggerLevel(loggerLevel); -} - -@end diff --git a/Pods/FirebaseCore/Firebase/Core/FIRDependency.m b/Pods/FirebaseCore/Firebase/Core/FIRDependency.m @@ -1,44 +0,0 @@ -/* - * Copyright 2018 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "Private/FIRDependency.h" - -@interface FIRDependency () - -- (instancetype)initWithProtocol:(Protocol *)protocol isRequired:(BOOL)required; - -@end - -@implementation FIRDependency - -+ (instancetype)dependencyWithProtocol:(Protocol *)protocol { - return [[self alloc] initWithProtocol:protocol isRequired:YES]; -} - -+ (instancetype)dependencyWithProtocol:(Protocol *)protocol isRequired:(BOOL)required { - return [[self alloc] initWithProtocol:protocol isRequired:required]; -} - -- (instancetype)initWithProtocol:(Protocol *)protocol isRequired:(BOOL)required { - self = [super init]; - if (self) { - _protocol = protocol; - _isRequired = required; - } - return self; -} - -@end diff --git a/Pods/FirebaseCore/Firebase/Core/FIRErrors.m b/Pods/FirebaseCore/Firebase/Core/FIRErrors.m @@ -1,29 +0,0 @@ -// Copyright 2017 Google -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#import "Private/FIRErrors.h" - -NSString *const kFirebaseErrorDomain = @"com.firebase"; -NSString *const kFirebaseAdMobErrorDomain = @"com.firebase.admob"; -NSString *const kFirebaseAppInviteErrorDomain = @"com.firebase.appinvite"; -NSString *const kFirebaseAuthErrorDomain = @"com.firebase.auth"; -NSString *const kFirebaseCloudMessagingErrorDomain = @"com.firebase.cloudmessaging"; -NSString *const kFirebaseConfigErrorDomain = @"com.firebase.config"; -NSString *const kFirebaseCoreErrorDomain = @"com.firebase.core"; -NSString *const kFirebaseCrashReportingErrorDomain = @"com.firebase.crashreporting"; -NSString *const kFirebaseDatabaseErrorDomain = @"com.firebase.database"; -NSString *const kFirebaseDurableDeepLinkErrorDomain = @"com.firebase.durabledeeplink"; -NSString *const kFirebaseInstanceIDErrorDomain = @"com.firebase.instanceid"; -NSString *const kFirebasePerfErrorDomain = @"com.firebase.perf"; -NSString *const kFirebaseStorageErrorDomain = @"com.firebase.storage"; diff --git a/Pods/FirebaseCore/Firebase/Core/FIRLogger.m b/Pods/FirebaseCore/Firebase/Core/FIRLogger.m @@ -1,171 +0,0 @@ -// Copyright 2017 Google -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#import "Private/FIRLogger.h" - -#import <FirebaseCore/FIRLoggerLevel.h> -#import <GoogleUtilities/GULAppEnvironmentUtil.h> -#import <GoogleUtilities/GULLogger.h> - -#import "Private/FIRVersion.h" - -FIRLoggerService kFIRLoggerABTesting = @"[Firebase/ABTesting]"; -FIRLoggerService kFIRLoggerAdMob = @"[Firebase/AdMob]"; -FIRLoggerService kFIRLoggerAnalytics = @"[Firebase/Analytics]"; -FIRLoggerService kFIRLoggerAuth = @"[Firebase/Auth]"; -FIRLoggerService kFIRLoggerCore = @"[Firebase/Core]"; -FIRLoggerService kFIRLoggerCrash = @"[Firebase/Crash]"; -FIRLoggerService kFIRLoggerDatabase = @"[Firebase/Database]"; -FIRLoggerService kFIRLoggerDynamicLinks = @"[Firebase/DynamicLinks]"; -FIRLoggerService kFIRLoggerFirestore = @"[Firebase/Firestore]"; -FIRLoggerService kFIRLoggerInstanceID = @"[Firebase/InstanceID]"; -FIRLoggerService kFIRLoggerInvites = @"[Firebase/Invites]"; -FIRLoggerService kFIRLoggerMLKit = @"[Firebase/MLKit]"; -FIRLoggerService kFIRLoggerMessaging = @"[Firebase/Messaging]"; -FIRLoggerService kFIRLoggerPerf = @"[Firebase/Performance]"; -FIRLoggerService kFIRLoggerRemoteConfig = @"[Firebase/RemoteConfig]"; -FIRLoggerService kFIRLoggerStorage = @"[Firebase/Storage]"; -FIRLoggerService kFIRLoggerSwizzler = @"[FirebaseSwizzlingUtilities]"; - -/// Arguments passed on launch. -NSString *const kFIRDisableDebugModeApplicationArgument = @"-FIRDebugDisabled"; -NSString *const kFIREnableDebugModeApplicationArgument = @"-FIRDebugEnabled"; -NSString *const kFIRLoggerForceSDTERRApplicationArgument = @"-FIRLoggerForceSTDERR"; - -/// Key for the debug mode bit in NSUserDefaults. -NSString *const kFIRPersistedDebugModeKey = @"/google/firebase/debug_mode"; - -/// NSUserDefaults that should be used to store and read variables. If nil, `standardUserDefaults` -/// will be used. -static NSUserDefaults *sFIRLoggerUserDefaults; - -static dispatch_once_t sFIRLoggerOnceToken; - -// The sFIRAnalyticsDebugMode flag is here to support the -FIRDebugEnabled/-FIRDebugDisabled -// flags used by Analytics. Users who use those flags expect Analytics to log verbosely, -// while the rest of Firebase logs at the default level. This flag is introduced to support -// that behavior. -static BOOL sFIRAnalyticsDebugMode; - -#ifdef DEBUG -/// The regex pattern for the message code. -static NSString *const kMessageCodePattern = @"^I-[A-Z]{3}[0-9]{6}$"; -static NSRegularExpression *sMessageCodeRegex; -#endif - -void FIRLoggerInitializeASL() { - dispatch_once(&sFIRLoggerOnceToken, ^{ - // Register Firebase Version with GULLogger. - GULLoggerRegisterVersion(FIRVersionString); - - // Override the aslOptions to ASL_OPT_STDERR if the override argument is passed in. - NSArray *arguments = [NSProcessInfo processInfo].arguments; - BOOL overrideSTDERR = [arguments containsObject:kFIRLoggerForceSDTERRApplicationArgument]; - - // Use the standard NSUserDefaults if it hasn't been explicitly set. - if (sFIRLoggerUserDefaults == nil) { - sFIRLoggerUserDefaults = [NSUserDefaults standardUserDefaults]; - } - - BOOL forceDebugMode = NO; - BOOL debugMode = [sFIRLoggerUserDefaults boolForKey:kFIRPersistedDebugModeKey]; - if ([arguments containsObject:kFIRDisableDebugModeApplicationArgument]) { // Default mode - [sFIRLoggerUserDefaults removeObjectForKey:kFIRPersistedDebugModeKey]; - } else if ([arguments containsObject:kFIREnableDebugModeApplicationArgument] || - debugMode) { // Debug mode - [sFIRLoggerUserDefaults setBool:YES forKey:kFIRPersistedDebugModeKey]; - forceDebugMode = YES; - } - GULLoggerInitializeASL(); - if (overrideSTDERR) { - GULLoggerEnableSTDERR(); - } - if (forceDebugMode) { - GULLoggerForceDebug(); - } - }); -} - -__attribute__((no_sanitize("thread"))) void FIRSetAnalyticsDebugMode(BOOL analyticsDebugMode) { - sFIRAnalyticsDebugMode = analyticsDebugMode; -} - -void FIRSetLoggerLevel(FIRLoggerLevel loggerLevel) { - FIRLoggerInitializeASL(); - GULSetLoggerLevel((GULLoggerLevel)loggerLevel); -} - -/** - * Check if the level is high enough to be loggable. - * - * Analytics can override the log level with an intentional race condition. - * Add the attribute to get a clean thread sanitizer run. - */ -__attribute__((no_sanitize("thread"))) BOOL FIRIsLoggableLevel(FIRLoggerLevel loggerLevel, - BOOL analyticsComponent) { - FIRLoggerInitializeASL(); - if (sFIRAnalyticsDebugMode && analyticsComponent) { - return YES; - } - return GULIsLoggableLevel((GULLoggerLevel)loggerLevel); -} - -void FIRLogBasic(FIRLoggerLevel level, - FIRLoggerService service, - NSString *messageCode, - NSString *message, - va_list args_ptr) { - FIRLoggerInitializeASL(); - GULLogBasic((GULLoggerLevel)level, service, - sFIRAnalyticsDebugMode && [kFIRLoggerAnalytics isEqualToString:service], messageCode, - message, args_ptr); -} - -/** - * Generates the logging functions using macros. - * - * Calling FIRLogError(kFIRLoggerCore, @"I-COR000001", @"Configure %@ failed.", @"blah") shows: - * yyyy-mm-dd hh:mm:ss.SSS sender[PID] <Error> [Firebase/Core][I-COR000001] Configure blah failed. - * Calling FIRLogDebug(kFIRLoggerCore, @"I-COR000001", @"Configure succeed.") shows: - * yyyy-mm-dd hh:mm:ss.SSS sender[PID] <Debug> [Firebase/Core][I-COR000001] Configure succeed. - */ -#define FIR_LOGGING_FUNCTION(level) \ - void FIRLog##level(FIRLoggerService service, NSString *messageCode, NSString *message, ...) { \ - va_list args_ptr; \ - va_start(args_ptr, message); \ - FIRLogBasic(FIRLoggerLevel##level, service, messageCode, message, args_ptr); \ - va_end(args_ptr); \ - } - -FIR_LOGGING_FUNCTION(Error) -FIR_LOGGING_FUNCTION(Warning) -FIR_LOGGING_FUNCTION(Notice) -FIR_LOGGING_FUNCTION(Info) -FIR_LOGGING_FUNCTION(Debug) - -#undef FIR_MAKE_LOGGER - -#pragma mark - FIRLoggerWrapper - -@implementation FIRLoggerWrapper - -+ (void)logWithLevel:(FIRLoggerLevel)level - withService:(FIRLoggerService)service - withCode:(NSString *)messageCode - withMessage:(NSString *)message - withArgs:(va_list)args { - FIRLogBasic(level, service, messageCode, message, args); -} - -@end diff --git a/Pods/FirebaseCore/Firebase/Core/FIROptions.m b/Pods/FirebaseCore/Firebase/Core/FIROptions.m @@ -1,443 +0,0 @@ -// Copyright 2017 Google -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#import "Private/FIRAppInternal.h" -#import "Private/FIRBundleUtil.h" -#import "Private/FIRErrors.h" -#import "Private/FIRLogger.h" -#import "Private/FIROptionsInternal.h" - -// Keys for the strings in the plist file. -NSString *const kFIRAPIKey = @"API_KEY"; -NSString *const kFIRTrackingID = @"TRACKING_ID"; -NSString *const kFIRGoogleAppID = @"GOOGLE_APP_ID"; -NSString *const kFIRClientID = @"CLIENT_ID"; -NSString *const kFIRGCMSenderID = @"GCM_SENDER_ID"; -NSString *const kFIRAndroidClientID = @"ANDROID_CLIENT_ID"; -NSString *const kFIRDatabaseURL = @"DATABASE_URL"; -NSString *const kFIRStorageBucket = @"STORAGE_BUCKET"; -// The key to locate the expected bundle identifier in the plist file. -NSString *const kFIRBundleID = @"BUNDLE_ID"; -// The key to locate the project identifier in the plist file. -NSString *const kFIRProjectID = @"PROJECT_ID"; - -NSString *const kFIRIsMeasurementEnabled = @"IS_MEASUREMENT_ENABLED"; -NSString *const kFIRIsAnalyticsCollectionEnabled = @"FIREBASE_ANALYTICS_COLLECTION_ENABLED"; -NSString *const kFIRIsAnalyticsCollectionDeactivated = @"FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED"; - -NSString *const kFIRIsAnalyticsEnabled = @"IS_ANALYTICS_ENABLED"; -NSString *const kFIRIsSignInEnabled = @"IS_SIGNIN_ENABLED"; - -// Library version ID. -NSString *const kFIRLibraryVersionID = @"5" // Major version (one or more digits) - @"03" // Minor version (exactly 2 digits) - @"01" // Build number (exactly 2 digits) - @"000"; // Fixed "000" -// Plist file name. -NSString *const kServiceInfoFileName = @"GoogleService-Info"; -// Plist file type. -NSString *const kServiceInfoFileType = @"plist"; - -// Exception raised from attempting to modify a FIROptions after it's been copied to a FIRApp. -NSString *const kFIRExceptionBadModification = - @"Attempted to modify options after it's set on FIRApp. Please modify all properties before " - @"initializing FIRApp."; - -@interface FIROptions () - -/** - * This property maintains the actual configuration key-value pairs. - */ -@property(nonatomic, readwrite) NSMutableDictionary *optionsDictionary; - -/** - * Calls `analyticsOptionsDictionaryWithInfoDictionary:` using [NSBundle mainBundle].infoDictionary. - * It combines analytics options from both the infoDictionary and the GoogleService-Info.plist. - * Values which are present in the main plist override values from the GoogleService-Info.plist. - */ -@property(nonatomic, readonly) NSDictionary *analyticsOptionsDictionary; - -/** - * Combination of analytics options from both the infoDictionary and the GoogleService-Info.plist. - * Values which are present in the infoDictionary override values from the GoogleService-Info.plist. - */ -- (NSDictionary *)analyticsOptionsDictionaryWithInfoDictionary:(NSDictionary *)infoDictionary; - -/** - * Throw exception if editing is locked when attempting to modify an option. - */ -- (void)checkEditingLocked; - -@end - -@implementation FIROptions { - /// Backing variable for self.analyticsOptionsDictionary. - NSDictionary *_analyticsOptionsDictionary; -} - -static FIROptions *sDefaultOptions = nil; -static NSDictionary *sDefaultOptionsDictionary = nil; - -#pragma mark - Public only for internal class methods - -+ (FIROptions *)defaultOptions { - if (sDefaultOptions != nil) { - return sDefaultOptions; - } - - NSDictionary *defaultOptionsDictionary = [self defaultOptionsDictionary]; - if (defaultOptionsDictionary == nil) { - return nil; - } - - sDefaultOptions = [[FIROptions alloc] initInternalWithOptionsDictionary:defaultOptionsDictionary]; - return sDefaultOptions; -} - -#pragma mark - Private class methods - -+ (void)initialize { - // Report FirebaseCore version for useragent string - NSRange major = NSMakeRange(0, 1); - NSRange minor = NSMakeRange(1, 2); - NSRange patch = NSMakeRange(3, 2); - [FIRApp - registerLibrary:@"fire-ios" - withVersion:[NSString stringWithFormat:@"%@.%d.%d", - [kFIRLibraryVersionID substringWithRange:major], - [[kFIRLibraryVersionID substringWithRange:minor] - intValue], - [[kFIRLibraryVersionID substringWithRange:patch] - intValue]]]; - NSDictionary<NSString *, id> *info = [[NSBundle mainBundle] infoDictionary]; - NSString *xcodeVersion = info[@"DTXcodeBuild"]; - NSString *sdkVersion = info[@"DTSDKBuild"]; - if (xcodeVersion) { - [FIRApp registerLibrary:@"xcode" withVersion:xcodeVersion]; - } - if (sdkVersion) { - [FIRApp registerLibrary:@"apple-sdk" withVersion:sdkVersion]; - } -} - -+ (NSDictionary *)defaultOptionsDictionary { - if (sDefaultOptionsDictionary != nil) { - return sDefaultOptionsDictionary; - } - NSString *plistFilePath = [FIROptions plistFilePathWithName:kServiceInfoFileName]; - if (plistFilePath == nil) { - return nil; - } - sDefaultOptionsDictionary = [NSDictionary dictionaryWithContentsOfFile:plistFilePath]; - if (sDefaultOptionsDictionary == nil) { - FIRLogError(kFIRLoggerCore, @"I-COR000011", - @"The configuration file is not a dictionary: " - @"'%@.%@'.", - kServiceInfoFileName, kServiceInfoFileType); - } - return sDefaultOptionsDictionary; -} - -// Returns the path of the plist file with a given file name. -+ (NSString *)plistFilePathWithName:(NSString *)fileName { - NSArray *bundles = [FIRBundleUtil relevantBundles]; - NSString *plistFilePath = - [FIRBundleUtil optionsDictionaryPathWithResourceName:fileName - andFileType:kServiceInfoFileType - inBundles:bundles]; - if (plistFilePath == nil) { - FIRLogError(kFIRLoggerCore, @"I-COR000012", @"Could not locate configuration file: '%@.%@'.", - fileName, kServiceInfoFileType); - } - return plistFilePath; -} - -+ (void)resetDefaultOptions { - sDefaultOptions = nil; - sDefaultOptionsDictionary = nil; -} - -#pragma mark - Private instance methods - -- (instancetype)initInternalWithOptionsDictionary:(NSDictionary *)optionsDictionary { - self = [super init]; - if (self) { - _optionsDictionary = [optionsDictionary mutableCopy]; - _usingOptionsFromDefaultPlist = YES; - } - return self; -} - -- (id)copyWithZone:(NSZone *)zone { - FIROptions *newOptions = [[[self class] allocWithZone:zone] init]; - if (newOptions) { - newOptions.optionsDictionary = self.optionsDictionary; - newOptions.deepLinkURLScheme = self.deepLinkURLScheme; - newOptions.editingLocked = self.isEditingLocked; - newOptions.usingOptionsFromDefaultPlist = self.usingOptionsFromDefaultPlist; - } - return newOptions; -} - -#pragma mark - Public instance methods - -- (instancetype)initWithContentsOfFile:(NSString *)plistPath { - self = [super init]; - if (self) { - if (plistPath == nil) { - FIRLogError(kFIRLoggerCore, @"I-COR000013", @"The plist file path is nil."); - return nil; - } - _optionsDictionary = [[NSDictionary dictionaryWithContentsOfFile:plistPath] mutableCopy]; - if (_optionsDictionary == nil) { - FIRLogError(kFIRLoggerCore, @"I-COR000014", - @"The configuration file at %@ does not exist or " - @"is not a well-formed plist file.", - plistPath); - return nil; - } - // TODO: Do we want to validate the dictionary here? It says we do that already in - // the public header. - } - return self; -} - -- (instancetype)initWithGoogleAppID:(NSString *)googleAppID GCMSenderID:(NSString *)GCMSenderID { - self = [super init]; - if (self) { - NSMutableDictionary *mutableOptionsDict = [NSMutableDictionary dictionary]; - [mutableOptionsDict setValue:googleAppID forKey:kFIRGoogleAppID]; - [mutableOptionsDict setValue:GCMSenderID forKey:kFIRGCMSenderID]; - [mutableOptionsDict setValue:[[NSBundle mainBundle] bundleIdentifier] forKey:kFIRBundleID]; - self.optionsDictionary = mutableOptionsDict; - } - return self; -} - -- (NSString *)APIKey { - return self.optionsDictionary[kFIRAPIKey]; -} - -- (void)checkEditingLocked { - if (self.isEditingLocked) { - [NSException raise:kFirebaseCoreErrorDomain format:kFIRExceptionBadModification]; - } -} - -- (void)setAPIKey:(NSString *)APIKey { - [self checkEditingLocked]; - _optionsDictionary[kFIRAPIKey] = [APIKey copy]; -} - -- (NSString *)clientID { - return self.optionsDictionary[kFIRClientID]; -} - -- (void)setClientID:(NSString *)clientID { - [self checkEditingLocked]; - _optionsDictionary[kFIRClientID] = [clientID copy]; -} - -- (NSString *)trackingID { - return self.optionsDictionary[kFIRTrackingID]; -} - -- (void)setTrackingID:(NSString *)trackingID { - [self checkEditingLocked]; - _optionsDictionary[kFIRTrackingID] = [trackingID copy]; -} - -- (NSString *)GCMSenderID { - return self.optionsDictionary[kFIRGCMSenderID]; -} - -- (void)setGCMSenderID:(NSString *)GCMSenderID { - [self checkEditingLocked]; - _optionsDictionary[kFIRGCMSenderID] = [GCMSenderID copy]; -} - -- (NSString *)projectID { - return self.optionsDictionary[kFIRProjectID]; -} - -- (void)setProjectID:(NSString *)projectID { - [self checkEditingLocked]; - _optionsDictionary[kFIRProjectID] = [projectID copy]; -} - -- (NSString *)androidClientID { - return self.optionsDictionary[kFIRAndroidClientID]; -} - -- (void)setAndroidClientID:(NSString *)androidClientID { - [self checkEditingLocked]; - _optionsDictionary[kFIRAndroidClientID] = [androidClientID copy]; -} - -- (NSString *)googleAppID { - return self.optionsDictionary[kFIRGoogleAppID]; -} - -- (void)setGoogleAppID:(NSString *)googleAppID { - [self checkEditingLocked]; - _optionsDictionary[kFIRGoogleAppID] = [googleAppID copy]; -} - -- (NSString *)libraryVersionID { - return kFIRLibraryVersionID; -} - -- (void)setLibraryVersionID:(NSString *)libraryVersionID { - _optionsDictionary[kFIRLibraryVersionID] = [libraryVersionID copy]; -} - -- (NSString *)databaseURL { - return self.optionsDictionary[kFIRDatabaseURL]; -} - -- (void)setDatabaseURL:(NSString *)databaseURL { - [self checkEditingLocked]; - - _optionsDictionary[kFIRDatabaseURL] = [databaseURL copy]; -} - -- (NSString *)storageBucket { - return self.optionsDictionary[kFIRStorageBucket]; -} - -- (void)setStorageBucket:(NSString *)storageBucket { - [self checkEditingLocked]; - _optionsDictionary[kFIRStorageBucket] = [storageBucket copy]; -} - -- (void)setDeepLinkURLScheme:(NSString *)deepLinkURLScheme { - [self checkEditingLocked]; - _deepLinkURLScheme = [deepLinkURLScheme copy]; -} - -- (NSString *)bundleID { - return self.optionsDictionary[kFIRBundleID]; -} - -- (void)setBundleID:(NSString *)bundleID { - [self checkEditingLocked]; - _optionsDictionary[kFIRBundleID] = [bundleID copy]; -} - -#pragma mark - Internal instance methods - -- (NSDictionary *)analyticsOptionsDictionaryWithInfoDictionary:(NSDictionary *)infoDictionary { - if (_analyticsOptionsDictionary == nil) { - NSMutableDictionary *tempAnalyticsOptions = [[NSMutableDictionary alloc] init]; - NSArray *measurementKeys = @[ - kFIRIsMeasurementEnabled, kFIRIsAnalyticsCollectionEnabled, - kFIRIsAnalyticsCollectionDeactivated - ]; - for (NSString *key in measurementKeys) { - id value = infoDictionary[key] ?: self.optionsDictionary[key] ?: nil; - if (!value) { - continue; - } - tempAnalyticsOptions[key] = value; - } - _analyticsOptionsDictionary = tempAnalyticsOptions; - } - return _analyticsOptionsDictionary; -} - -- (NSDictionary *)analyticsOptionsDictionary { - return [self analyticsOptionsDictionaryWithInfoDictionary:[NSBundle mainBundle].infoDictionary]; -} - -/** - * Whether or not Measurement was enabled. Measurement is enabled unless explicitly disabled in - * GoogleService-Info.plist. This uses the old plist flag IS_MEASUREMENT_ENABLED, which should still - * be supported. - */ -- (BOOL)isMeasurementEnabled { - if (self.isAnalyticsCollectionDeactivated) { - return NO; - } - NSNumber *value = self.analyticsOptionsDictionary[kFIRIsMeasurementEnabled]; - if (value == nil) { - // TODO: This could probably be cleaned up since FIROptions shouldn't know about FIRApp or have - // to check if it's the default app. The FIROptions instance can't be modified after - // `+configure` is called, so it's not a good place to copy it either in case the flag is - // changed at runtime. - - // If no values are set for Analytics, fall back to the global collection switch in FIRApp. - // Analytics only supports the default FIRApp, so check that first. - if (![FIRApp isDefaultAppConfigured]) { - return NO; - } - - // Fall back to the default app's collection switch when the key is not in the dictionary. - return [FIRApp defaultApp].isDataCollectionDefaultEnabled; - } - return [value boolValue]; -} - -- (BOOL)isAnalyticsCollectionExpicitlySet { - // If it's de-activated, it classifies as explicity set. If not, it's not a good enough indication - // that the developer wants FirebaseAnalytics enabled so continue checking. - if (self.isAnalyticsCollectionDeactivated) { - return YES; - } - - // Check if the current Analytics flag is set. - id collectionEnabledObject = self.analyticsOptionsDictionary[kFIRIsAnalyticsCollectionEnabled]; - if (collectionEnabledObject && [collectionEnabledObject isKindOfClass:[NSNumber class]]) { - // It doesn't matter what the value is, it's explicitly set. - return YES; - } - - // Check if the old measurement flag is set. - id measurementEnabledObject = self.analyticsOptionsDictionary[kFIRIsMeasurementEnabled]; - if (measurementEnabledObject && [measurementEnabledObject isKindOfClass:[NSNumber class]]) { - // It doesn't matter what the value is, it's explicitly set. - return YES; - } - - // No flags are set to explicitly enable or disable FirebaseAnalytics. - return NO; -} - -- (BOOL)isAnalyticsCollectionEnabled { - if (self.isAnalyticsCollectionDeactivated) { - return NO; - } - NSNumber *value = self.analyticsOptionsDictionary[kFIRIsAnalyticsCollectionEnabled]; - if (value == nil) { - return self.isMeasurementEnabled; // Fall back to older plist flag. - } - return [value boolValue]; -} - -- (BOOL)isAnalyticsCollectionDeactivated { - NSNumber *value = self.analyticsOptionsDictionary[kFIRIsAnalyticsCollectionDeactivated]; - if (value == nil) { - return NO; // Analytics Collection is not deactivated when the key is not in the dictionary. - } - return [value boolValue]; -} - -- (BOOL)isAnalyticsEnabled { - return [self.optionsDictionary[kFIRIsAnalyticsEnabled] boolValue]; -} - -- (BOOL)isSignInEnabled { - return [self.optionsDictionary[kFIRIsSignInEnabled] boolValue]; -} - -@end diff --git a/Pods/FirebaseCore/Firebase/Core/FIRVersion.m b/Pods/FirebaseCore/Firebase/Core/FIRVersion.m @@ -1,33 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef Firebase_VERSION -#error "Firebase_VERSION is not defined: add -DFirebase_VERSION=... to the build invocation" -#endif - -#ifndef FIRCore_VERSION -#error "FIRCore_VERSION is not defined: add -DFIRCore_VERSION=... to the build invocation" -#endif - -// The following two macros supply the incantation so that the C -// preprocessor does not try to parse the version as a floating -// point number. See -// https://www.guyrutenberg.com/2008/12/20/expanding-macros-into-string-constants-in-c/ -#define STR(x) STR_EXPAND(x) -#define STR_EXPAND(x) #x - -const char *const FIRVersionString = (const char *const)STR(Firebase_VERSION); -const char *const FIRCoreVersionString = (const char *const)STR(FIRCore_VERSION); diff --git a/Pods/FirebaseCore/Firebase/Core/Private/FIRAnalyticsConfiguration+Internal.h b/Pods/FirebaseCore/Firebase/Core/Private/FIRAnalyticsConfiguration+Internal.h @@ -1,49 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRAnalyticsConfiguration.h" - -/// Values stored in analyticsEnabledState. Never alter these constants since they must match with -/// values persisted to disk. -typedef NS_ENUM(int64_t, FIRAnalyticsEnabledState) { - // 0 is the default value for keys not found stored in persisted config, so it cannot represent - // kFIRAnalyticsEnabledStateSetNo. It must represent kFIRAnalyticsEnabledStateNotSet. - kFIRAnalyticsEnabledStateNotSet = 0, - kFIRAnalyticsEnabledStateSetYes = 1, - kFIRAnalyticsEnabledStateSetNo = 2, -}; - -/// The user defaults key for the persisted measurementEnabledState value. FIRAPersistedConfig reads -/// measurementEnabledState using this same key. -static NSString *const kFIRAPersistedConfigMeasurementEnabledStateKey = - @"/google/measurement/measurement_enabled_state"; - -static NSString *const kFIRAnalyticsConfigurationSetEnabledNotification = - @"FIRAnalyticsConfigurationSetEnabledNotification"; -static NSString *const kFIRAnalyticsConfigurationSetMinimumSessionIntervalNotification = - @"FIRAnalyticsConfigurationSetMinimumSessionIntervalNotification"; -static NSString *const kFIRAnalyticsConfigurationSetSessionTimeoutIntervalNotification = - @"FIRAnalyticsConfigurationSetSessionTimeoutIntervalNotification"; - -@interface FIRAnalyticsConfiguration (Internal) - -/// Sets whether analytics collection is enabled for this app on this device, and a flag to persist -/// the value or not. The setting should not be persisted if being set by the global data collection -/// flag. -- (void)setAnalyticsCollectionEnabled:(BOOL)analyticsCollectionEnabled - persistSetting:(BOOL)shouldPersist; - -@end diff --git a/Pods/FirebaseCore/Firebase/Core/Private/FIRAppAssociationRegistration.h b/Pods/FirebaseCore/Firebase/Core/Private/FIRAppAssociationRegistration.h @@ -1,49 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -NS_ASSUME_NONNULL_BEGIN - -// TODO: Remove this once Auth moves over to Core's instance registration system. -/** @class FIRAppAssociationRegistration - @brief Manages object associations as a singleton-dependent: At most one object is - registered for any given host/key pair, and the object shall be created on-the-fly when - asked for. - */ -@interface FIRAppAssociationRegistration<ObjectType> : NSObject - -/** @fn registeredObjectWithHost:key:creationBlock: - @brief Retrieves the registered object with a particular host and key. - @param host The host object. - @param key The key to specify the registered object on the host. - @param creationBlock The block to return the object to be registered if not already. - The block is executed immediately before this method returns if it is executed at all. - It can also be executed multiple times across different method invocations if previous - execution of the block returns @c nil. - @return The registered object for the host/key pair, or @c nil if no object is registered - and @c creationBlock returns @c nil. - @remarks The method is thread-safe but non-reentrant in the sense that attempting to call this - method again within the @c creationBlock with the same host/key pair raises an exception. - The registered object is retained by the host. - */ -+ (nullable ObjectType)registeredObjectWithHost:(id)host - key:(NSString *)key - creationBlock:(ObjectType _Nullable (^)(void))creationBlock; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/FirebaseCore/Firebase/Core/Private/FIRAppInternal.h b/Pods/FirebaseCore/Firebase/Core/Private/FIRAppInternal.h @@ -1,182 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRApp.h" -#import "FIRErrors.h" - -@class FIRComponentContainer; -@protocol FIRLibrary; - -/** - * The internal interface to FIRApp. This is meant for first-party integrators, who need to receive - * FIRApp notifications, log info about the success or failure of their configuration, and access - * other internal functionality of FIRApp. - * - * TODO(b/28296561): Restructure this header. - */ -NS_ASSUME_NONNULL_BEGIN - -typedef NS_ENUM(NSInteger, FIRConfigType) { - FIRConfigTypeCore = 1, - FIRConfigTypeSDK = 2, -}; - -/** - * Names of services provided by Firebase. - */ -extern NSString *const kFIRServiceAdMob; -extern NSString *const kFIRServiceAuth; -extern NSString *const kFIRServiceAuthUI; -extern NSString *const kFIRServiceCrash; -extern NSString *const kFIRServiceDatabase; -extern NSString *const kFIRServiceDynamicLinks; -extern NSString *const kFIRServiceInstanceID; -extern NSString *const kFIRServiceInvites; -extern NSString *const kFIRServiceMessaging; -extern NSString *const kFIRServiceMeasurement; -extern NSString *const kFIRServiceRemoteConfig; -extern NSString *const kFIRServiceStorage; - -/** - * Names of services provided by the Google pod, but logged by the Firebase pod. - */ -extern NSString *const kGGLServiceAnalytics; -extern NSString *const kGGLServiceSignIn; - -extern NSString *const kFIRDefaultAppName; -extern NSString *const kFIRAppReadyToConfigureSDKNotification; -extern NSString *const kFIRAppDeleteNotification; -extern NSString *const kFIRAppIsDefaultAppKey; -extern NSString *const kFIRAppNameKey; -extern NSString *const kFIRGoogleAppIDKey; - -/** - * The format string for the User Defaults key used for storing the data collection enabled flag. - * This includes formatting to append the Firebase App's name. - */ -extern NSString *const kFIRGlobalAppDataCollectionEnabledDefaultsKeyFormat; - -/** - * The plist key used for storing the data collection enabled flag. - */ -extern NSString *const kFIRGlobalAppDataCollectionEnabledPlistKey; - -/** - * A notification fired containing diagnostic information when SDK errors occur. - */ -extern NSString *const kFIRAppDiagnosticsNotification; - -/** @var FIRAuthStateDidChangeInternalNotification - @brief The name of the @c NSNotificationCenter notification which is posted when the auth state - changes (e.g. a new token has been produced, a user logs in or out). The object parameter of - the notification is a dictionary possibly containing the key: - @c FIRAuthStateDidChangeInternalNotificationTokenKey (the new access token.) If it does not - contain this key it indicates a sign-out event took place. - */ -extern NSString *const FIRAuthStateDidChangeInternalNotification; - -/** @var FIRAuthStateDidChangeInternalNotificationTokenKey - @brief A key present in the dictionary object parameter of the - @c FIRAuthStateDidChangeInternalNotification notification. The value associated with this - key will contain the new access token. - */ -extern NSString *const FIRAuthStateDidChangeInternalNotificationTokenKey; - -/** @var FIRAuthStateDidChangeInternalNotificationAppKey - @brief A key present in the dictionary object parameter of the - @c FIRAuthStateDidChangeInternalNotification notification. The value associated with this - key will contain the FIRApp associated with the auth instance. - */ -extern NSString *const FIRAuthStateDidChangeInternalNotificationAppKey; - -/** @var FIRAuthStateDidChangeInternalNotificationUIDKey - @brief A key present in the dictionary object parameter of the - @c FIRAuthStateDidChangeInternalNotification notification. The value associated with this - key will contain the new user's UID (or nil if there is no longer a user signed in). - */ -extern NSString *const FIRAuthStateDidChangeInternalNotificationUIDKey; - -@interface FIRApp () - -/** - * A flag indicating if this is the default app (has the default app name). - */ -@property(nonatomic, readonly) BOOL isDefaultApp; - -/* - * The container of interop SDKs for this app. - */ -@property(nonatomic) FIRComponentContainer *container; - -/** - * Creates an error for failing to configure a subspec service. This method is called by each - * FIRApp notification listener. - */ -+ (NSError *)errorForSubspecConfigurationFailureWithDomain:(NSString *)domain - errorCode:(FIRErrorCode)code - service:(NSString *)service - reason:(NSString *)reason; -/** - * Checks if the default app is configured without trying to configure it. - */ -+ (BOOL)isDefaultAppConfigured; - -/** - * Registers a given third-party library with the given version number to be reported for - * analytics. - * - * @param name Name of the library. - * @param version Version of the library. - */ -+ (void)registerLibrary:(nonnull NSString *)name withVersion:(nonnull NSString *)version; - -/** - * Registers a given internal library with the given version number to be reported for - * analytics. - * - * @param library Optional parameter for component registration. - * @param name Name of the library. - * @param version Version of the library. - */ -+ (void)registerInternalLibrary:(nonnull Class<FIRLibrary>)library - withName:(nonnull NSString *)name - withVersion:(nonnull NSString *)version; - -/** - * A concatenated string representing all the third-party libraries and version numbers. - */ -+ (NSString *)firebaseUserAgent; - -/** - * Used by each SDK to send logs about SDK configuration status to Clearcut. - */ -- (void)sendLogsWithServiceName:(NSString *)serviceName - version:(NSString *)version - error:(NSError *)error; - -/** - * Can be used by the unit tests in eack SDK to reset FIRApp. This method is thread unsafe. - */ -+ (void)resetApps; - -/** - * Can be used by the unit tests in each SDK to set customized options. - */ -- (instancetype)initInstanceWithName:(NSString *)name options:(FIROptions *)options; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/FirebaseCore/Firebase/Core/Private/FIRBundleUtil.h b/Pods/FirebaseCore/Firebase/Core/Private/FIRBundleUtil.h @@ -1,52 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -/** - * This class provides utilities for accessing resources in bundles. - */ -@interface FIRBundleUtil : NSObject - -/** - * Finds all relevant bundles, starting with [NSBundle mainBundle]. - */ -+ (NSArray *)relevantBundles; - -/** - * Reads the options dictionary from one of the provided bundles. - * - * @param resourceName The resource name, e.g. @"GoogleService-Info". - * @param fileType The file type (extension), e.g. @"plist". - * @param bundles The bundles to expect, in priority order. See also - * +[FIRBundleUtil relevantBundles]. - */ -+ (NSString *)optionsDictionaryPathWithResourceName:(NSString *)resourceName - andFileType:(NSString *)fileType - inBundles:(NSArray *)bundles; - -/** - * Finds URL schemes defined in all relevant bundles, starting with those from - * [NSBundle mainBundle]. - */ -+ (NSArray *)relevantURLSchemes; - -/** - * Checks if the bundle identifier exists in the given bundles. - */ -+ (BOOL)hasBundleIdentifier:(NSString *)bundleIdentifier inBundles:(NSArray *)bundles; - -@end diff --git a/Pods/FirebaseCore/Firebase/Core/Private/FIRComponent.h b/Pods/FirebaseCore/Firebase/Core/Private/FIRComponent.h @@ -1,91 +0,0 @@ -/* - * Copyright 2018 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -@class FIRApp; -@class FIRComponentContainer; - -NS_ASSUME_NONNULL_BEGIN - -/// Provides a system to clean up cached instances returned from the component system. -NS_SWIFT_NAME(ComponentLifecycleMaintainer) -@protocol FIRComponentLifecycleMaintainer -/// The associated app will be deleted, clean up any resources as they are about to be deallocated. -- (void)appWillBeDeleted:(FIRApp *)app; -@end - -typedef _Nullable id (^FIRComponentCreationBlock)(FIRComponentContainer *container, - BOOL *isCacheable) - NS_SWIFT_NAME(ComponentCreationBlock); - -@class FIRDependency; - -/// Describes the timing of instantiation. Note: new components should default to lazy unless there -/// is a strong reason to be eager. -typedef NS_ENUM(NSInteger, FIRInstantiationTiming) { - FIRInstantiationTimingLazy, - FIRInstantiationTimingAlwaysEager, - FIRInstantiationTimingEagerInDefaultApp -} NS_SWIFT_NAME(InstantiationTiming); - -/// A component that can be used from other Firebase SDKs. -NS_SWIFT_NAME(Component) -@interface FIRComponent : NSObject - -/// The protocol describing functionality provided from the Component. -@property(nonatomic, strong, readonly) Protocol *protocol; - -/// The timing of instantiation. -@property(nonatomic, readonly) FIRInstantiationTiming instantiationTiming; - -/// An array of dependencies for the component. -@property(nonatomic, copy, readonly) NSArray<FIRDependency *> *dependencies; - -/// A block to instantiate an instance of the component with the appropriate dependencies. -@property(nonatomic, copy, readonly) FIRComponentCreationBlock creationBlock; - -// There's an issue with long NS_SWIFT_NAMES that causes compilation to fail, disable clang-format -// for the next two methods. -// clang-format off - -/// Creates a component with no dependencies that will be lazily initialized. -+ (instancetype)componentWithProtocol:(Protocol *)protocol - creationBlock:(FIRComponentCreationBlock)creationBlock -NS_SWIFT_NAME(init(_:creationBlock:)); - -/// Creates a component to be registered with the component container. -/// -/// @param protocol - The protocol describing functionality provided by the component. -/// @param instantiationTiming - When the component should be initialized. Use .lazy unless there's -/// a good reason to be instantiated earlier. -/// @param dependencies - Any dependencies the `implementingClass` has, optional or required. -/// @param creationBlock - A block to instantiate the component with a container, and if -/// @return A component that can be registered with the component container. -+ (instancetype)componentWithProtocol:(Protocol *)protocol - instantiationTiming:(FIRInstantiationTiming)instantiationTiming - dependencies:(NSArray<FIRDependency *> *)dependencies - creationBlock:(FIRComponentCreationBlock)creationBlock -NS_SWIFT_NAME(init(_:instantiationTiming:dependencies:creationBlock:)); - -// clang-format on - -/// Unavailable. -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/FirebaseCore/Firebase/Core/Private/FIRComponentContainer.h b/Pods/FirebaseCore/Firebase/Core/Private/FIRComponentContainer.h @@ -1,44 +0,0 @@ -/* - * Copyright 2018 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#import <Foundation/Foundation.h> - -#import "FIRComponentType.h" -#import "FIRLibrary.h" - -NS_ASSUME_NONNULL_BEGIN - -/// A type-safe macro to retrieve a component from a container. This should be used to retrieve -/// components instead of using the container directly. -#define FIR_COMPONENT(type, container) \ - [FIRComponentType<id<type>> instanceForProtocol:@protocol(type) inContainer:container] - -@class FIRApp; - -/// A container that holds different components that are registered via the -/// `registerAsComponentRegistrant:` call. These classes should conform to `FIRComponentRegistrant` -/// in order to properly register components for Core. -NS_SWIFT_NAME(FirebaseComponentContainer) -@interface FIRComponentContainer : NSObject - -/// A weak reference to the app that an instance of the container belongs to. -@property(nonatomic, weak, readonly) FIRApp *app; - -/// Unavailable. Use the `container` property on `FIRApp`. -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/FirebaseCore/Firebase/Core/Private/FIRComponentContainerInternal.h b/Pods/FirebaseCore/Firebase/Core/Private/FIRComponentContainerInternal.h @@ -1,43 +0,0 @@ -/* - * Copyright 2018 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#import <Foundation/Foundation.h> - -#import "FIRComponent.h" -#import "FIRComponentContainer.h" - -@class FIRApp; - -NS_ASSUME_NONNULL_BEGIN - -@interface FIRComponentContainer (Private) - -/// Initializes a contain for a given app. This should only be called by the app itself. -- (instancetype)initWithApp:(FIRApp *)app; - -/// Retrieves an instance that conforms to the specified protocol. This will return `nil` if the -/// protocol wasn't registered, or if the instance couldn't instantiate for the provided app. -- (nullable id)instanceForProtocol:(Protocol *)protocol NS_SWIFT_NAME(instance(for:)); - -/// Remove all of the cached instances stored and allow them to clean up after themselves. -- (void)removeAllCachedInstances; - -/// Register a class to provide components for the interoperability system. The class should conform -/// to `FIRComponentRegistrant` and provide an array of `FIRComponent` objects. -+ (void)registerAsComponentRegistrant:(Class<FIRLibrary>)klass; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/FirebaseCore/Firebase/Core/Private/FIRComponentType.h b/Pods/FirebaseCore/Firebase/Core/Private/FIRComponentType.h @@ -1,34 +0,0 @@ -/* - * Copyright 2018 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -@class FIRComponentContainer; - -NS_ASSUME_NONNULL_BEGIN - -/// Do not use directly. A placeholder type in order to provide a macro that will warn users of -/// mis-matched protocols. -NS_SWIFT_NAME(ComponentType) -@interface FIRComponentType<__covariant T> : NSObject - -/// Do not use directly. A factory method to retrieve an instance that provides a specific -/// functionality. -+ (T)instanceForProtocol:(Protocol *)protocol inContainer:(FIRComponentContainer *)container; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/FirebaseCore/Firebase/Core/Private/FIRDependency.h b/Pods/FirebaseCore/Firebase/Core/Private/FIRDependency.h @@ -1,45 +0,0 @@ -/* - * Copyright 2018 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -NS_ASSUME_NONNULL_BEGIN - -/// A dependency on a specific protocol's functionality. -NS_SWIFT_NAME(Dependency) -@interface FIRDependency : NSObject - -/// The protocol describing functionality being depended on. -@property(nonatomic, strong, readonly) Protocol *protocol; - -/// A flag to specify if the dependency is required or not. -@property(nonatomic, readonly) BOOL isRequired; - -/// Initializes a dependency that is required. Calls `initWithProtocol:isRequired` with `YES` for -/// the required parameter. -/// Creates a required dependency on the specified protocol's functionality. -+ (instancetype)dependencyWithProtocol:(Protocol *)protocol; - -/// Creates a dependency on the specified protocol's functionality and specify if it's required for -/// the class's functionality. -+ (instancetype)dependencyWithProtocol:(Protocol *)protocol isRequired:(BOOL)required; - -/// Use `dependencyWithProtocol:isRequired:` instead. -- (instancetype)init NS_UNAVAILABLE; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/FirebaseCore/Firebase/Core/Private/FIRErrorCode.h b/Pods/FirebaseCore/Firebase/Core/Private/FIRErrorCode.h @@ -1,55 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** Error codes in Firebase error domain. */ -typedef NS_ENUM(NSInteger, FIRErrorCode) { - /** - * Unknown error. - */ - FIRErrorCodeUnknown = 0, - /** - * Loading data from the GoogleService-Info.plist file failed. This is a fatal error and should - * not be ignored. Further calls to the API will fail and/or possibly cause crashes. - */ - FIRErrorCodeInvalidPlistFile = -100, - - /** - * Validating the Google App ID format failed. - */ - FIRErrorCodeInvalidAppID = -101, - - /** - * Error code for failing to configure a specific service. - */ - FIRErrorCodeAdMobFailed = -110, - FIRErrorCodeAppInviteFailed = -112, - FIRErrorCodeCloudMessagingFailed = -113, - FIRErrorCodeConfigFailed = -114, - FIRErrorCodeDatabaseFailed = -115, - FIRErrorCodeCrashReportingFailed = -118, - FIRErrorCodeDurableDeepLinkFailed = -119, - FIRErrorCodeAuthFailed = -120, - FIRErrorCodeInstanceIDFailed = -121, - FIRErrorCodeStorageFailed = -123, - - /** - * Error codes returned by Dynamic Links - */ - FIRErrorCodeDynamicLinksStrongMatchNotAvailable = -124, - FIRErrorCodeDynamicLinksManualRetrievalNotEnabled = -125, - FIRErrorCodeDynamicLinksPendingLinkOnlyAvailableAtFirstLaunch = -126, - FIRErrorCodeDynamicLinksPendingLinkRetrievalAlreadyRunning = -127, -}; diff --git a/Pods/FirebaseCore/Firebase/Core/Private/FIRErrors.h b/Pods/FirebaseCore/Firebase/Core/Private/FIRErrors.h @@ -1,33 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -#include "FIRErrorCode.h" - -extern NSString *const kFirebaseErrorDomain; -extern NSString *const kFirebaseAdMobErrorDomain; -extern NSString *const kFirebaseAppInviteErrorDomain; -extern NSString *const kFirebaseAuthErrorDomain; -extern NSString *const kFirebaseCloudMessagingErrorDomain; -extern NSString *const kFirebaseConfigErrorDomain; -extern NSString *const kFirebaseCoreErrorDomain; -extern NSString *const kFirebaseCrashReportingErrorDomain; -extern NSString *const kFirebaseDatabaseErrorDomain; -extern NSString *const kFirebaseDurableDeepLinkErrorDomain; -extern NSString *const kFirebaseInstanceIDErrorDomain; -extern NSString *const kFirebasePerfErrorDomain; -extern NSString *const kFirebaseStorageErrorDomain; diff --git a/Pods/FirebaseCore/Firebase/Core/Private/FIRLibrary.h b/Pods/FirebaseCore/Firebase/Core/Private/FIRLibrary.h @@ -1,44 +0,0 @@ -/* - * Copyright 2018 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef FIRLibrary_h -#define FIRLibrary_h - -#import <Foundation/Foundation.h> -#import "FIRComponent.h" - -@class FIRApp; - -NS_ASSUME_NONNULL_BEGIN - -/// Provide an interface to register a library for userAgent logging and availability to others. -NS_SWIFT_NAME(Library) -@protocol FIRLibrary - -/// Returns one or more FIRComponents that will be registered in -/// FIRApp and participate in dependency resolution and injection. -+ (NSArray<FIRComponent *> *)componentsToRegister; - -@optional -/// Implement this method if the library needs notifications for lifecycle events. This method is -/// called when the developer calls `FirebaseApp.configure()`. -+ (void)configureWithApp:(FIRApp *)app; - -@end - -NS_ASSUME_NONNULL_END - -#endif /* FIRLibrary_h */ diff --git a/Pods/FirebaseCore/Firebase/Core/Private/FIRLogger.h b/Pods/FirebaseCore/Firebase/Core/Private/FIRLogger.h @@ -1,159 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -#import "FIRLoggerLevel.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - * The Firebase services used in Firebase logger. - */ -typedef NSString *const FIRLoggerService; - -extern FIRLoggerService kFIRLoggerABTesting; -extern FIRLoggerService kFIRLoggerAdMob; -extern FIRLoggerService kFIRLoggerAnalytics; -extern FIRLoggerService kFIRLoggerAuth; -extern FIRLoggerService kFIRLoggerCore; -extern FIRLoggerService kFIRLoggerCrash; -extern FIRLoggerService kFIRLoggerDatabase; -extern FIRLoggerService kFIRLoggerDynamicLinks; -extern FIRLoggerService kFIRLoggerFirestore; -extern FIRLoggerService kFIRLoggerInstanceID; -extern FIRLoggerService kFIRLoggerInvites; -extern FIRLoggerService kFIRLoggerMLKit; -extern FIRLoggerService kFIRLoggerMessaging; -extern FIRLoggerService kFIRLoggerPerf; -extern FIRLoggerService kFIRLoggerRemoteConfig; -extern FIRLoggerService kFIRLoggerStorage; -extern FIRLoggerService kFIRLoggerSwizzler; - -/** - * The key used to store the logger's error count. - */ -extern NSString *const kFIRLoggerErrorCountKey; - -/** - * The key used to store the logger's warning count. - */ -extern NSString *const kFIRLoggerWarningCountKey; - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -/** - * Enables or disables Analytics debug mode. - * If set to YES, the logging level for Analytics will be set to FIRLoggerLevelDebug. - * Enabling the debug mode has no effect if the app is running from App Store. - * (required) analytics debug mode flag. - */ -void FIRSetAnalyticsDebugMode(BOOL analyticsDebugMode); - -/** - * Changes the default logging level of FIRLoggerLevelNotice to a user-specified level. - * The default level cannot be set above FIRLoggerLevelNotice if the app is running from App Store. - * (required) log level (one of the FIRLoggerLevel enum values). - */ -void FIRSetLoggerLevel(FIRLoggerLevel loggerLevel); - -/** - * Checks if the specified logger level is loggable given the current settings. - * (required) log level (one of the FIRLoggerLevel enum values). - * (required) whether or not this function is called from the Analytics component. - */ -BOOL FIRIsLoggableLevel(FIRLoggerLevel loggerLevel, BOOL analyticsComponent); - -/** - * Logs a message to the Xcode console and the device log. If running from AppStore, will - * not log any messages with a level higher than FIRLoggerLevelNotice to avoid log spamming. - * (required) log level (one of the FIRLoggerLevel enum values). - * (required) service name of type FIRLoggerService. - * (required) message code starting with "I-" which means iOS, followed by a capitalized - * three-character service identifier and a six digit integer message ID that is unique - * within the service. - * An example of the message code is @"I-COR000001". - * (required) message string which can be a format string. - * (optional) variable arguments list obtained from calling va_start, used when message is a format - * string. - */ -extern void FIRLogBasic(FIRLoggerLevel level, - FIRLoggerService service, - NSString *messageCode, - NSString *message, -// On 64-bit simulators, va_list is not a pointer, so cannot be marked nullable -// See: http://stackoverflow.com/q/29095469 -#if __LP64__ && TARGET_OS_SIMULATOR || TARGET_OS_OSX - va_list args_ptr -#else - va_list _Nullable args_ptr -#endif -); - -/** - * The following functions accept the following parameters in order: - * (required) service name of type FIRLoggerService. - * (required) message code starting from "I-" which means iOS, followed by a capitalized - * three-character service identifier and a six digit integer message ID that is unique - * within the service. - * An example of the message code is @"I-COR000001". - * See go/firebase-log-proposal for details. - * (required) message string which can be a format string. - * (optional) the list of arguments to substitute into the format string. - * Example usage: - * FIRLogError(kFIRLoggerCore, @"I-COR000001", @"Configuration of %@ failed.", app.name); - */ -extern void FIRLogError(FIRLoggerService service, NSString *messageCode, NSString *message, ...) - NS_FORMAT_FUNCTION(3, 4); -extern void FIRLogWarning(FIRLoggerService service, NSString *messageCode, NSString *message, ...) - NS_FORMAT_FUNCTION(3, 4); -extern void FIRLogNotice(FIRLoggerService service, NSString *messageCode, NSString *message, ...) - NS_FORMAT_FUNCTION(3, 4); -extern void FIRLogInfo(FIRLoggerService service, NSString *messageCode, NSString *message, ...) - NS_FORMAT_FUNCTION(3, 4); -extern void FIRLogDebug(FIRLoggerService service, NSString *messageCode, NSString *message, ...) - NS_FORMAT_FUNCTION(3, 4); - -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - -@interface FIRLoggerWrapper : NSObject - -/** - * Objective-C wrapper for FIRLogBasic to allow weak linking to FIRLogger - * (required) log level (one of the FIRLoggerLevel enum values). - * (required) service name of type FIRLoggerService. - * (required) message code starting with "I-" which means iOS, followed by a capitalized - * three-character service identifier and a six digit integer message ID that is unique - * within the service. - * An example of the message code is @"I-COR000001". - * (required) message string which can be a format string. - * (optional) variable arguments list obtained from calling va_start, used when message is a format - * string. - */ - -+ (void)logWithLevel:(FIRLoggerLevel)level - withService:(FIRLoggerService)service - withCode:(NSString *)messageCode - withMessage:(NSString *)message - withArgs:(va_list)args; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/FirebaseCore/Firebase/Core/Private/FIROptionsInternal.h b/Pods/FirebaseCore/Firebase/Core/Private/FIROptionsInternal.h @@ -1,114 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIROptions.h" - -/** - * Keys for the strings in the plist file. - */ -extern NSString *const kFIRAPIKey; -extern NSString *const kFIRTrackingID; -extern NSString *const kFIRGoogleAppID; -extern NSString *const kFIRClientID; -extern NSString *const kFIRGCMSenderID; -extern NSString *const kFIRAndroidClientID; -extern NSString *const kFIRDatabaseURL; -extern NSString *const kFIRStorageBucket; -extern NSString *const kFIRBundleID; -extern NSString *const kFIRProjectID; - -/** - * Keys for the plist file name - */ -extern NSString *const kServiceInfoFileName; - -extern NSString *const kServiceInfoFileType; - -/** - * This header file exposes the initialization of FIROptions to internal use. - */ -@interface FIROptions () - -/** - * resetDefaultOptions and initInternalWithOptionsDictionary: are exposed only for unit tests. - */ -+ (void)resetDefaultOptions; - -/** - * Initializes the options with dictionary. The above strings are the keys of the dictionary. - * This is the designated initializer. - */ -- (instancetype)initInternalWithOptionsDictionary:(NSDictionary *)serviceInfoDictionary; - -/** - * defaultOptions and defaultOptionsDictionary are exposed in order to be used in FIRApp and - * other first party services. - */ -+ (FIROptions *)defaultOptions; - -+ (NSDictionary *)defaultOptionsDictionary; - -/** - * Indicates whether or not Analytics collection was explicitly enabled via a plist flag or at - * runtime. - */ -@property(nonatomic, readonly) BOOL isAnalyticsCollectionExpicitlySet; - -/** - * Whether or not Analytics Collection was enabled. Analytics Collection is enabled unless - * explicitly disabled in GoogleService-Info.plist. - */ -@property(nonatomic, readonly) BOOL isAnalyticsCollectionEnabled; - -/** - * Whether or not Analytics Collection was completely disabled. If YES, then - * isAnalyticsCollectionEnabled will be NO. - */ -@property(nonatomic, readonly) BOOL isAnalyticsCollectionDeactivated; - -/** - * The version ID of the client library, e.g. @"1100000". - */ -@property(nonatomic, readonly, copy) NSString *libraryVersionID; - -/** - * The flag indicating whether this object was constructed with the values in the default plist - * file. - */ -@property(nonatomic) BOOL usingOptionsFromDefaultPlist; - -/** - * Whether or not Measurement was enabled. Measurement is enabled unless explicitly disabled in - * GoogleService-Info.plist. - */ -@property(nonatomic, readonly) BOOL isMeasurementEnabled; - -/** - * Whether or not Analytics was enabled in the developer console. - */ -@property(nonatomic, readonly) BOOL isAnalyticsEnabled; - -/** - * Whether or not SignIn was enabled in the developer console. - */ -@property(nonatomic, readonly) BOOL isSignInEnabled; - -/** - * Whether or not editing is locked. This should occur after FIROptions has been set on a FIRApp. - */ -@property(nonatomic, getter=isEditingLocked) BOOL editingLocked; - -@end diff --git a/Pods/FirebaseCore/Firebase/Core/Private/FIRVersion.h b/Pods/FirebaseCore/Firebase/Core/Private/FIRVersion.h @@ -1,23 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -/** The version of the Firebase SDK. */ -FOUNDATION_EXPORT const char *const FIRVersionString; - -/** The version of the FirebaseCore Component. */ -FOUNDATION_EXPORT const char *const FIRCoreVersionString; diff --git a/Pods/FirebaseCore/Firebase/Core/Public/FIRAnalyticsConfiguration.h b/Pods/FirebaseCore/Firebase/Core/Public/FIRAnalyticsConfiguration.h @@ -1,55 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -NS_ASSUME_NONNULL_BEGIN - -/** - * This class provides configuration fields for Firebase Analytics. - */ -NS_SWIFT_NAME(AnalyticsConfiguration) -@interface FIRAnalyticsConfiguration : NSObject - -/** - * Returns the shared instance of FIRAnalyticsConfiguration. - */ -+ (FIRAnalyticsConfiguration *)sharedInstance NS_SWIFT_NAME(shared()); - -/** - * Deprecated. - * Sets the minimum engagement time in seconds required to start a new session. The default value - * is 10 seconds. - */ -- (void)setMinimumSessionInterval:(NSTimeInterval)minimumSessionInterval - DEPRECATED_MSG_ATTRIBUTE( - "Sessions are started immediately. More information at https://bit.ly/2FU46av"); - -/** - * Sets the interval of inactivity in seconds that terminates the current session. The default - * value is 1800 seconds (30 minutes). - */ -- (void)setSessionTimeoutInterval:(NSTimeInterval)sessionTimeoutInterval; - -/** - * Sets whether analytics collection is enabled for this app on this device. This setting is - * persisted across app sessions. By default it is enabled. - */ -- (void)setAnalyticsCollectionEnabled:(BOOL)analyticsCollectionEnabled; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/FirebaseCore/Firebase/Core/Public/FIRApp.h b/Pods/FirebaseCore/Firebase/Core/Public/FIRApp.h @@ -1,127 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -@class FIROptions; - -NS_ASSUME_NONNULL_BEGIN - -/** A block that takes a BOOL and has no return value. */ -typedef void (^FIRAppVoidBoolCallback)(BOOL success) NS_SWIFT_NAME(FirebaseAppVoidBoolCallback); - -/** - * The entry point of Firebase SDKs. - * - * Initialize and configure FIRApp using +[FIRApp configure] - * or other customized ways as shown below. - * - * The logging system has two modes: default mode and debug mode. In default mode, only logs with - * log level Notice, Warning and Error will be sent to device. In debug mode, all logs will be sent - * to device. The log levels that Firebase uses are consistent with the ASL log levels. - * - * Enable debug mode by passing the -FIRDebugEnabled argument to the application. You can add this - * argument in the application's Xcode scheme. When debug mode is enabled via -FIRDebugEnabled, - * further executions of the application will also be in debug mode. In order to return to default - * mode, you must explicitly disable the debug mode with the application argument -FIRDebugDisabled. - * - * It is also possible to change the default logging level in code by calling setLoggerLevel: on - * the FIRConfiguration interface. - */ -NS_SWIFT_NAME(FirebaseApp) -@interface FIRApp : NSObject - -/** - * Configures a default Firebase app. Raises an exception if any configuration step fails. The - * default app is named "__FIRAPP_DEFAULT". This method should be called after the app is launched - * and before using Firebase services. This method is thread safe and contains synchronous file I/O - * (reading GoogleService-Info.plist from disk). - */ -+ (void)configure; - -/** - * Configures the default Firebase app with the provided options. The default app is named - * "__FIRAPP_DEFAULT". Raises an exception if any configuration step fails. This method is thread - * safe. - * - * @param options The Firebase application options used to configure the service. - */ -+ (void)configureWithOptions:(FIROptions *)options NS_SWIFT_NAME(configure(options:)); - -/** - * Configures a Firebase app with the given name and options. Raises an exception if any - * configuration step fails. This method is thread safe. - * - * @param name The application's name given by the developer. The name should should only contain - Letters, Numbers and Underscore. - * @param options The Firebase application options used to configure the services. - */ -// clang-format off -+ (void)configureWithName:(NSString *)name - options:(FIROptions *)options NS_SWIFT_NAME(configure(name:options:)); -// clang-format on - -/** - * Returns the default app, or nil if the default app does not exist. - */ -+ (nullable FIRApp *)defaultApp NS_SWIFT_NAME(app()); - -/** - * Returns a previously created FIRApp instance with the given name, or nil if no such app exists. - * This method is thread safe. - */ -+ (nullable FIRApp *)appNamed:(NSString *)name NS_SWIFT_NAME(app(name:)); - -/** - * Returns the set of all extant FIRApp instances, or nil if there are no FIRApp instances. This - * method is thread safe. - */ -@property(class, readonly, nullable) NSDictionary<NSString *, FIRApp *> *allApps; - -/** - * Cleans up the current FIRApp, freeing associated data and returning its name to the pool for - * future use. This method is thread safe. - */ -- (void)deleteApp:(FIRAppVoidBoolCallback)completion; - -/** - * FIRApp instances should not be initialized directly. Call +[FIRApp configure], - * +[FIRApp configureWithOptions:], or +[FIRApp configureWithNames:options:] directly. - */ -- (instancetype)init NS_UNAVAILABLE; - -/** - * Gets the name of this app. - */ -@property(nonatomic, copy, readonly) NSString *name; - -/** - * Gets a copy of the options for this app. These are non-modifiable. - */ -@property(nonatomic, copy, readonly) FIROptions *options; - -/** - * Gets or sets whether automatic data collection is enabled for all products. Defaults to `YES` - * unless `FirebaseDataCollectionDefaultEnabled` is set to `NO` in your app's Info.plist. This value - * is persisted across runs of the app so that it can be set once when users have consented to - * collection. - */ -@property(nonatomic, readwrite, getter=isDataCollectionDefaultEnabled) - BOOL dataCollectionDefaultEnabled; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/FirebaseCore/Firebase/Core/Public/FIRConfiguration.h b/Pods/FirebaseCore/Firebase/Core/Public/FIRConfiguration.h @@ -1,50 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -#import "FIRAnalyticsConfiguration.h" -#import "FIRLoggerLevel.h" - -NS_ASSUME_NONNULL_BEGIN - -/** - * This interface provides global level properties that the developer can tweak, and the singleton - * of the Firebase Analytics configuration class. - */ -NS_SWIFT_NAME(FirebaseConfiguration) -@interface FIRConfiguration : NSObject - -/** Returns the shared configuration object. */ -@property(class, nonatomic, readonly) FIRConfiguration *sharedInstance NS_SWIFT_NAME(shared); - -/** The configuration class for Firebase Analytics. */ -@property(nonatomic, readwrite) FIRAnalyticsConfiguration *analyticsConfiguration; - -/** - * Sets the logging level for internal Firebase logging. Firebase will only log messages - * that are logged at or below loggerLevel. The messages are logged both to the Xcode - * console and to the device's log. Note that if an app is running from AppStore, it will - * never log above FIRLoggerLevelNotice even if loggerLevel is set to a higher (more verbose) - * setting. - * - * @param loggerLevel The maximum logging level. The default level is set to FIRLoggerLevelNotice. - */ -- (void)setLoggerLevel:(FIRLoggerLevel)loggerLevel; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/FirebaseCore/Firebase/Core/Public/FIRLoggerLevel.h b/Pods/FirebaseCore/Firebase/Core/Public/FIRLoggerLevel.h @@ -1,38 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// Note that importing GULLoggerLevel.h will lead to a non-modular header -// import error. - -/** - * The log levels used by internal logging. - */ -typedef NS_ENUM(NSInteger, FIRLoggerLevel) { - /** Error level, matches ASL_LEVEL_ERR. */ - FIRLoggerLevelError = 3, - /** Warning level, matches ASL_LEVEL_WARNING. */ - FIRLoggerLevelWarning = 4, - /** Notice level, matches ASL_LEVEL_NOTICE. */ - FIRLoggerLevelNotice = 5, - /** Info level, matches ASL_LEVEL_INFO. */ - FIRLoggerLevelInfo = 6, - /** Debug level, matches ASL_LEVEL_DEBUG. */ - FIRLoggerLevelDebug = 7, - /** Minimum log level. */ - FIRLoggerLevelMin = FIRLoggerLevelError, - /** Maximum log level. */ - FIRLoggerLevelMax = FIRLoggerLevelDebug -} NS_SWIFT_NAME(FirebaseLoggerLevel); diff --git a/Pods/FirebaseCore/Firebase/Core/Public/FIROptions.h b/Pods/FirebaseCore/Firebase/Core/Public/FIROptions.h @@ -1,116 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -NS_ASSUME_NONNULL_BEGIN - -/** - * This class provides constant fields of Google APIs. - */ -NS_SWIFT_NAME(FirebaseOptions) -@interface FIROptions : NSObject <NSCopying> - -/** - * Returns the default options. The first time this is called it synchronously reads - * GoogleService-Info.plist from disk. - */ -+ (nullable FIROptions *)defaultOptions NS_SWIFT_NAME(defaultOptions()); - -/** - * An iOS API key used for authenticating requests from your app, e.g. - * @"AIzaSyDdVgKwhZl0sTTTLZ7iTmt1r3N2cJLnaDk", used to identify your app to Google servers. - */ -@property(nonatomic, copy, nullable) NSString *APIKey NS_SWIFT_NAME(apiKey); - -/** - * The bundle ID for the application. Defaults to `[[NSBundle mainBundle] bundleID]` when not set - * manually or in a plist. - */ -@property(nonatomic, copy) NSString *bundleID; - -/** - * The OAuth2 client ID for iOS application used to authenticate Google users, for example - * @"12345.apps.googleusercontent.com", used for signing in with Google. - */ -@property(nonatomic, copy, nullable) NSString *clientID; - -/** - * The tracking ID for Google Analytics, e.g. @"UA-12345678-1", used to configure Google Analytics. - */ -@property(nonatomic, copy, nullable) NSString *trackingID; - -/** - * The Project Number from the Google Developer's console, for example @"012345678901", used to - * configure Google Cloud Messaging. - */ -@property(nonatomic, copy) NSString *GCMSenderID NS_SWIFT_NAME(gcmSenderID); - -/** - * The Project ID from the Firebase console, for example @"abc-xyz-123". - */ -@property(nonatomic, copy, nullable) NSString *projectID; - -/** - * The Android client ID used in Google AppInvite when an iOS app has its Android version, for - * example @"12345.apps.googleusercontent.com". - */ -@property(nonatomic, copy, nullable) NSString *androidClientID; - -/** - * The Google App ID that is used to uniquely identify an instance of an app. - */ -@property(nonatomic, copy) NSString *googleAppID; - -/** - * The database root URL, e.g. @"http://abc-xyz-123.firebaseio.com". - */ -@property(nonatomic, copy, nullable) NSString *databaseURL; - -/** - * The URL scheme used to set up Durable Deep Link service. - */ -@property(nonatomic, copy, nullable) NSString *deepLinkURLScheme; - -/** - * The Google Cloud Storage bucket name, e.g. @"abc-xyz-123.storage.firebase.com". - */ -@property(nonatomic, copy, nullable) NSString *storageBucket; - -/** - * Initializes a customized instance of FIROptions from the file at the given plist file path. This - * will read the file synchronously from disk. - * For example, - * NSString *filePath = - * [[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"]; - * FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:filePath]; - * Returns nil if the plist file does not exist or is invalid. - */ -- (nullable instancetype)initWithContentsOfFile:(NSString *)plistPath; - -/** - * Initializes a customized instance of FIROptions with required fields. Use the mutable properties - * to modify fields for configuring specific services. - */ -// clang-format off -- (instancetype)initWithGoogleAppID:(NSString *)googleAppID - GCMSenderID:(NSString *)GCMSenderID - NS_SWIFT_NAME(init(googleAppID:gcmSenderID:)); -// clang-format on - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/FirebaseCore/Firebase/Core/Public/FirebaseCore.h b/Pods/FirebaseCore/Firebase/Core/Public/FirebaseCore.h @@ -1,21 +0,0 @@ -/* - * Copyright 2017 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRAnalyticsConfiguration.h" -#import "FIRApp.h" -#import "FIRConfiguration.h" -#import "FIRLoggerLevel.h" -#import "FIROptions.h" diff --git a/Pods/FirebaseCore/LICENSE b/Pods/FirebaseCore/LICENSE @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/Pods/FirebaseCore/README.md b/Pods/FirebaseCore/README.md @@ -1,197 +0,0 @@ -# Firebase iOS Open Source Development [![Build Status](https://travis-ci.org/firebase/firebase-ios-sdk.svg?branch=master)](https://travis-ci.org/firebase/firebase-ios-sdk) - -This repository contains a subset of the Firebase iOS SDK source. It currently -includes FirebaseCore, FirebaseAuth, FirebaseDatabase, FirebaseFirestore, -FirebaseFunctions, FirebaseInstanceID, FirebaseInAppMessaging, -FirebaseInAppMessagingDisplay, FirebaseMessaging and FirebaseStorage. - -The repository also includes GoogleUtilities source. The -[GoogleUtilities](GoogleUtilities/README.md) pod is -a set of utilities used by Firebase and other Google products. - -Firebase is an app development platform with tools to help you build, grow and -monetize your app. More information about Firebase can be found at -[https://firebase.google.com](https://firebase.google.com). - -## Installation - -See the three subsections for details about three different installation methods. -1. [Standard pod install](README.md#standard-pod-install) -1. [Installing from the GitHub repo](README.md#installing-from-github) -1. [Experimental Carthage](README.md#carthage-ios-only) - -### Standard pod install - -Go to -[https://firebase.google.com/docs/ios/setup](https://firebase.google.com/docs/ios/setup). - -### Installing from GitHub - -For releases starting with 5.0.0, the source for each release is also deployed -to CocoaPods master and available via standard -[CocoaPods Podfile syntax](https://guides.cocoapods.org/syntax/podfile.html#pod). - -These instructions can be used to access the Firebase repo at other branches, -tags, or commits. - -#### Background - -See -[the Podfile Syntax Reference](https://guides.cocoapods.org/syntax/podfile.html#pod) -for instructions and options about overriding pod source locations. - -#### Accessing Firebase Source Snapshots - -All of the official releases are tagged in this repo and available via CocoaPods. To access a local -source snapshot or unreleased branch, use Podfile directives like the following: - -To access FirebaseFirestore via a branch: -``` -pod 'FirebaseCore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :branch => 'master' -pod 'FirebaseFirestore', :git => 'https://github.com/firebase/firebase-ios-sdk.git', :branch => 'master' -``` - -To access FirebaseMessaging via a checked out version of the firebase-ios-sdk repo do: - -``` -pod 'FirebaseCore', :path => '/path/to/firebase-ios-sdk' -pod 'FirebaseMessaging', :path => '/path/to/firebase-ios-sdk' -``` - -### Carthage (iOS only) - -Instructions for the experimental Carthage distribution are at -[Carthage](Carthage.md). - -### Rome - -Instructions for installing binary frameworks via -[Rome](https://github.com/CocoaPods/Rome) are at [Rome](Rome.md). - -## Development - -Follow the subsequent instructions to develop, debug, unit test, run integration -tests, and try out reference samples: - -``` -$ git clone git@github.com:firebase/firebase-ios-sdk.git -$ cd firebase-ios-sdk/Example -$ pod update -$ open Firebase.xcworkspace -``` - -Firestore and Functions have self contained Xcode projects. See -[Firestore/README.md](Firestore/README.md) and -[Functions/README.md](Functions/README.md). - -### Code Formatting - -To ensure that the code is formatted consistently, run the script -[./scripts/style.sh](https://github.com/firebase/firebase-ios-sdk/blob/master/scripts/style.sh) -before creating a PR. - -Travis will verify that any code changes are done in a style compliant way. Install -`clang-format` and `swiftformat`. -This command will get the right `clang-format` version: - -`brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/773cb75d360b58f32048f5964038d09825a507c8/Formula/clang-format.rb` - -### Running Unit Tests - -Select a scheme and press Command-u to build a component and run its unit tests. - -### Running Sample Apps -In order to run the sample apps and integration tests, you'll need valid -`GoogleService-Info.plist` files for those samples. The Firebase Xcode project contains dummy plist -files without real values, but can be replaced with real plist files. To get your own -`GoogleService-Info.plist` files: - -1. Go to the [Firebase Console](https://console.firebase.google.com/) -2. Create a new Firebase project, if you don't already have one -3. For each sample app you want to test, create a new Firebase app with the sample app's bundle -identifier (e.g. `com.google.Database-Example`) -4. Download the resulting `GoogleService-Info.plist` and replace the appropriate dummy plist file -(e.g. in [Example/Database/App/](Example/Database/App/)); - -Some sample apps like Firebase Messaging ([Example/Messaging/App](Example/Messaging/App)) require -special Apple capabilities, and you will have to change the sample app to use a unique bundle -identifier that you can control in your own Apple Developer account. - -## Specific Component Instructions -See the sections below for any special instructions for those components. - -### Firebase Auth - -If you're doing specific Firebase Auth development, see -[the Auth Sample README](Example/Auth/README.md) for instructions about -building and running the FirebaseAuth pod along with various samples and tests. - -### Firebase Database - -To run the Database Integration tests, make your database authentication rules -[public](https://firebase.google.com/docs/database/security/quickstart). - -### Firebase Storage - -To run the Storage Integration tests, follow the instructions in -[FIRStorageIntegrationTests.m](Example/Storage/Tests/Integration/FIRStorageIntegrationTests.m). - -#### Push Notifications - -Push notifications can only be delivered to specially provisioned App IDs in the developer portal. -In order to actually test receiving push notifications, you will need to: - -1. Change the bundle identifier of the sample app to something you own in your Apple Developer -account, and enable that App ID for push notifications. -2. You'll also need to -[upload your APNs Provider Authentication Key or certificate to the Firebase Console](https://firebase.google.com/docs/cloud-messaging/ios/certs) -at **Project Settings > Cloud Messaging > [Your Firebase App]**. -3. Ensure your iOS device is added to your Apple Developer portal as a test device. - -#### iOS Simulator - -The iOS Simulator cannot register for remote notifications, and will not receive push notifications. -In order to receive push notifications, you'll have to follow the steps above and run the app on a -physical device. - -## Community Supported Efforts - -We've seen an amazing amount of interest and contributions to improve the Firebase SDKs, and we are -very grateful! We'd like to empower as many developers as we can to be able to use Firebase and -participate in the Firebase community. - -### macOS and tvOS -FirebaseAuth, FirebaseCore, FirebaseDatabase and FirebaseStorage now compile, run unit tests, and -work on macOS and tvOS, thanks to contributions from the community. There are a few tweaks needed, -like ensuring iOS-only, macOS-only, or tvOS-only code is correctly guarded with checks for -`TARGET_OS_IOS`, `TARGET_OS_OSX` and `TARGET_OS_TV`. - -For tvOS, checkout the [Sample](Example/tvOSSample). - -Keep in mind that macOS and tvOS are not officially supported by Firebase, and this repository is -actively developed primarily for iOS. While we can catch basic unit test issues with Travis, there -may be some changes where the SDK no longer works as expected on macOS or tvOS. If you encounter -this, please [file an issue](https://github.com/firebase/firebase-ios-sdk/issues). - -For installation instructions, see [above](README.md#accessing-firebase-source-snapshots). - -Note that the Firebase pod is not available for macOS and tvOS. Install a selection of the -`FirebaseAuth`, `FirebaseCore`, `FirebaseDatabase` and `FirebaseStorage` CocoaPods. - -## Roadmap - -See [Roadmap](ROADMAP.md) for more about the Firebase iOS SDK Open Source -plans and directions. - -## Contributing - -See [Contributing](CONTRIBUTING.md) for more information on contributing to the Firebase -iOS SDK. - -## License - -The contents of this repository is licensed under the -[Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0). - -Your use of Firebase is governed by the -[Terms of Service for Firebase Services](https://firebase.google.com/terms/). diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRIMessageCode.h b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRIMessageCode.h @@ -1,155 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -// The format of the debug code will show in the log as: e.g. -// for code 1000, it will show as I-IID001000. -typedef NS_ENUM(NSInteger, FIRInstanceIDMessageCode) { - // DO NOT USE 2000, 2002. - kFIRInstanceIDMessageCodeFIRApp000 = 1000, // I-IID001000 - kFIRInstanceIDMessageCodeFIRApp001 = 1001, - kFIRInstanceIDMessageCodeFIRApp002 = 1002, - kFIRInstanceIDMessageCodeInternal001 = 2001, - kFIRInstanceIDMessageCodeInternal002 = 2002, - // FIRInstanceID.m - // DO NOT USE 4000. - kFIRInstanceIDMessageCodeInstanceID000 = 3000, - kFIRInstanceIDMessageCodeInstanceID001 = 3001, - kFIRInstanceIDMessageCodeInstanceID002 = 3002, - kFIRInstanceIDMessageCodeInstanceID003 = 3003, - kFIRInstanceIDMessageCodeInstanceID004 = 3004, - kFIRInstanceIDMessageCodeInstanceID005 = 3005, - kFIRInstanceIDMessageCodeInstanceID006 = 3006, - kFIRInstanceIDMessageCodeInstanceID007 = 3007, - kFIRInstanceIDMessageCodeInstanceID008 = 3008, - kFIRInstanceIDMessageCodeInstanceID009 = 3009, - kFIRInstanceIDMessageCodeInstanceID010 = 3010, - kFIRInstanceIDMessageCodeInstanceID011 = 3011, - kFIRInstanceIDMessageCodeInstanceID012 = 3012, - kFIRInstanceIDMessageCodeInstanceID013 = 3013, - kFIRInstanceIDMessageCodeInstanceID014 = 3014, - kFIRInstanceIDMessageCodeInstanceID015 = 3015, - kFIRInstanceIDMessageCodeRefetchingTokenForAPNS = 3016, - // FIRInstanceIDAuthService.m - kFIRInstanceIDMessageCodeAuthService000 = 5000, - kFIRInstanceIDMessageCodeAuthService001 = 5001, - kFIRInstanceIDMessageCodeAuthService002 = 5002, - kFIRInstanceIDMessageCodeAuthService003 = 5003, - kFIRInstanceIDMessageCodeAuthService004 = 5004, - kFIRInstanceIDMessageCodeAuthServiceCheckinInProgress = 5004, - - // FIRInstanceIDBackupExcludedPlist.m - kFIRInstanceIDMessageCodeBackupExcludedPlist000 = 6000, - kFIRInstanceIDMessageCodeBackupExcludedPlist001 = 6001, - kFIRInstanceIDMessageCodeBackupExcludedPlist002 = 6002, - kFIRInstanceIDMessageCodeBackupExcludedPlistInvalidPlistEnum = 6003, - // FIRInstanceIDCheckinService.m - kFIRInstanceIDMessageCodeService000 = 7000, - kFIRInstanceIDMessageCodeService001 = 7001, - kFIRInstanceIDMessageCodeService002 = 7002, - kFIRInstanceIDMessageCodeService003 = 7003, - kFIRInstanceIDMessageCodeService004 = 7004, - kFIRInstanceIDMessageCodeService005 = 7005, - kFIRInstanceIDMessageCodeService006 = 7006, - // FIRInstanceIDCheckinStore.m - // DO NOT USE 8002, 8004 - 8008 - kFIRInstanceIDMessageCodeCheckinStore000 = 8000, - kFIRInstanceIDMessageCodeCheckinStore001 = 8001, - kFIRInstanceIDMessageCodeCheckinStore003 = 8003, - // FIRInstanceIDKeyPair.m - // DO NOT USE 9001, 9003 - kFIRInstanceIDMessageCodeKeyPair000 = 9000, - kFIRInstanceIDMessageCodeKeyPair002 = 9002, - kFIRInstanceIDMessageCodeKeyPairMigrationError = 9004, - kFIRInstanceIDMessageCodeKeyPairMigrationSuccess = 9005, - // FIRInstanceIDKeyPairStore.m - kFIRInstanceIDMessageCodeKeyPairStore000 = 10000, - kFIRInstanceIDMessageCodeKeyPairStore001 = 10001, - kFIRInstanceIDMessageCodeKeyPairStore002 = 10002, - kFIRInstanceIDMessageCodeKeyPairStore003 = 10003, - kFIRInstanceIDMessageCodeKeyPairStore004 = 10004, - kFIRInstanceIDMessageCodeKeyPairStore005 = 10005, - kFIRInstanceIDMessageCodeKeyPairStore006 = 10006, - kFIRInstanceIDMessageCodeKeyPairStore007 = 10007, - kFIRInstanceIDMessageCodeKeyPairStore008 = 10008, - kFIRInstanceIDMessageCodeKeyPairStoreCouldNotLoadKeyPair = 10009, - // FIRInstanceIDKeyPairUtilities.m - kFIRInstanceIDMessageCodeKeyPairUtilities000 = 11000, - kFIRInstanceIDMessageCodeKeyPairUtilities001 = 11001, - kFIRInstanceIDMessageCodeKeyPairUtilitiesFirstConcatenateParamNil = 11002, - - // DO NOT USE 12000 - 12014 - - // FIRInstanceIDStore.m - // DO NOT USE 13004, 13005, 13007, 13008, 13010, 13011, 13013, 13014 - kFIRInstanceIDMessageCodeStore000 = 13000, - kFIRInstanceIDMessageCodeStore001 = 13001, - kFIRInstanceIDMessageCodeStore002 = 13002, - kFIRInstanceIDMessageCodeStore003 = 13003, - kFIRInstanceIDMessageCodeStore006 = 13006, - kFIRInstanceIDMessageCodeStore009 = 13009, - kFIRInstanceIDMessageCodeStore012 = 13012, - // FIRInstanceIDTokenManager.m - // DO NOT USE 14002, 14005 - kFIRInstanceIDMessageCodeTokenManager000 = 14000, - kFIRInstanceIDMessageCodeTokenManager001 = 14001, - kFIRInstanceIDMessageCodeTokenManager003 = 14003, - kFIRInstanceIDMessageCodeTokenManager004 = 14004, - kFIRInstanceIDMessageCodeTokenManagerErrorDeletingFCMTokensOnAppReset = 14006, - kFIRInstanceIDMessageCodeTokenManagerDeletedFCMTokensOnAppReset = 14007, - kFIRInstanceIDMessageCodeTokenManagerSavedAppVersion = 14008, - kFIRInstanceIDMessageCodeTokenManagerErrorInvalidatingAllTokens = 14009, - kFIRInstanceIDMessageCodeTokenManagerAPNSChanged = 14010, - kFIRInstanceIDMessageCodeTokenManagerAPNSChangedTokenInvalidated = 14011, - kFIRInstanceIDMessageCodeTokenManagerInvalidateStaleToken = 14012, - // FIRInstanceIDTokenStore.m - // DO NOT USE 15002 - 15013 - kFIRInstanceIDMessageCodeTokenStore000 = 15000, - kFIRInstanceIDMessageCodeTokenStore001 = 15001, - kFIRInstanceIDMessageCodeTokenStoreExceptionUnarchivingTokenInfo = 15015, - - // DO NOT USE 16000, 18004 - - // FIRInstanceIDUtilities.m - kFIRInstanceIDMessageCodeUtilitiesMissingBundleIdentifier = 18000, - kFIRInstanceIDMessageCodeUtilitiesAppEnvironmentUtilNotAvailable = 18001, - kFIRInstanceIDMessageCodeUtilitiesCannotGetHardwareModel = 18002, - kFIRInstanceIDMessageCodeUtilitiesCannotGetSystemVersion = 18003, - // FIRInstanceIDTokenOperation.m - kFIRInstanceIDMessageCodeTokenOperationFailedToSignParams = 19000, - // FIRInstanceIDTokenFetchOperation.m - // DO NOT USE 20004, 20005 - kFIRInstanceIDMessageCodeTokenFetchOperationFetchRequest = 20000, - kFIRInstanceIDMessageCodeTokenFetchOperationRequestError = 20001, - kFIRInstanceIDMessageCodeTokenFetchOperationBadResponse = 20002, - kFIRInstanceIDMessageCodeTokenFetchOperationBadTokenStructure = 20003, - // FIRInstanceIDTokenDeleteOperation.m - kFIRInstanceIDMessageCodeTokenDeleteOperationFetchRequest = 21000, - kFIRInstanceIDMessageCodeTokenDeleteOperationRequestError = 21001, - kFIRInstanceIDMessageCodeTokenDeleteOperationBadResponse = 21002, - // FIRInstanceIDTokenInfo.m - kFIRInstanceIDMessageCodeTokenInfoBadAPNSInfo = 22000, - kFIRInstanceIDMessageCodeTokenInfoFirebaseAppIDChanged = 22001, - kFIRInstanceIDMessageCodeTokenInfoLocaleChanged = 22002, - // FIRInstanceIDKeychain.m - kFIRInstanceIDKeychainReadItemError = 23000, - kFIRInstanceIDKeychainAddItemError = 23001, - kFIRInstanceIDKeychainDeleteItemError = 23002, - kFIRInstanceIDKeychainCreateKeyPairError = 23003, - kFIRInstanceIDKeychainUpdateItemError = 23004, - -}; diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceID+Private.h b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceID+Private.h @@ -1,55 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceID.h" - -#import "FIRInstanceIDCheckinService.h" - -/** - * Internal API used by other Firebase SDK teams, including Messaging, Analytics and Remote config. - */ -@interface FIRInstanceID (Private) - -/** - * Return the cached checkin preferences on the disk. This is used internally only by Messaging. - * - * @return The cached checkin preferences on the client. - */ -- (nullable FIRInstanceIDCheckinPreferences *)cachedCheckinPreferences; - -/** - * Fetches checkin info for the app. If the app has valid cached checkin preferences - * they are returned instead of making a network request. - * - * @param handler The completion handler to invoke once the request has completed. - */ -- (void)fetchCheckinInfoWithHandler:(nullable FIRInstanceIDDeviceCheckinCompletion)handler; - -/** - * Get the InstanceID for the app. If an ID was created before and cached - * successfully we will return that ID. If no cached ID exists we create - * a new ID, cache it and return that. - * - * This is a blocking call and should not really be called on the main thread. - * - * @param error The error object that represents the error while trying to - * retrieve the instance id. - * - * @return The InstanceID for the app. - */ -- (nullable NSString *)appInstanceID:(NSError *_Nullable *_Nullable)error; - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceID+Private.m b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceID+Private.m @@ -1,46 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceID+Private.h" - -#import "FIRInstanceIDAuthService.h" -#import "FIRInstanceIDKeyPairStore.h" -#import "FIRInstanceIDTokenManager.h" - -@interface FIRInstanceID () - -@property(nonatomic, readonly, strong) FIRInstanceIDTokenManager *tokenManager; -@property(nonatomic, readonly, strong) FIRInstanceIDKeyPairStore *keyPairStore; - -@end - -@implementation FIRInstanceID (Private) - -- (FIRInstanceIDCheckinPreferences *)cachedCheckinPreferences { - return [self.tokenManager.authService checkinPreferences]; -} - -// This method just wraps our pre-configured auth service to make the request. -// This method is only needed by first-party users, like Remote Config. -- (void)fetchCheckinInfoWithHandler:(FIRInstanceIDDeviceCheckinCompletion)handler { - [self.tokenManager.authService fetchCheckinInfoWithHandler:handler]; -} - -- (NSString *)appInstanceID:(NSError **)error { - return [self.keyPairStore appIdentityWithError:error]; -} - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceID+Testing.h b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceID+Testing.h @@ -1,48 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceID+Private.h" -#import "FIRInstanceID.h" -#import "FIRInstanceIDKeyPairStore.h" -#import "FIRInstanceIDTokenManager.h" - -@interface FIRInstanceID (Testing) - -@property(nonatomic, readwrite, strong) FIRInstanceIDTokenManager *tokenManager; -@property(nonatomic, readwrite, strong) FIRInstanceIDKeyPairStore *keyPairStore; -@property(nonatomic, readwrite, copy) NSString *fcmSenderID; - -/** - * Private initializer. - */ -- (instancetype)initPrivately; - -/** - * Actually makes InstanceID instantiate both the IID and Token-related subsystems. - */ -- (void)start; - -/** - * Without checking any caches etc, always attempts to fetch the default token (unless a fetch - * is already in progress. - */ -- (void)fetchDefaultToken; - -+ (int64_t)maxRetryCountForDefaultToken; -+ (int64_t)minIntervalForDefaultTokenRetry; -+ (int64_t)maxRetryIntervalForDefaultTokenInSeconds; - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceID.m b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceID.m @@ -1,1217 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceID.h" - -#import <FirebaseCore/FIRAppInternal.h> -#import <FirebaseCore/FIRComponent.h> -#import <FirebaseCore/FIRComponentContainer.h> -#import <FirebaseCore/FIRLibrary.h> -#import <FirebaseCore/FIROptions.h> -#import <GoogleUtilities/GULAppEnvironmentUtil.h> -#import "FIRInstanceID+Private.h" -#import "FIRInstanceIDAuthService.h" -#import "FIRInstanceIDConstants.h" -#import "FIRInstanceIDDefines.h" -#import "FIRInstanceIDKeyPairStore.h" -#import "FIRInstanceIDLogger.h" -#import "FIRInstanceIDStore.h" -#import "FIRInstanceIDTokenInfo.h" -#import "FIRInstanceIDTokenManager.h" -#import "FIRInstanceIDUtilities.h" -#import "FIRInstanceIDVersionUtilities.h" -#import "NSError+FIRInstanceID.h" - -// Public constants -NSString *const kFIRInstanceIDScopeFirebaseMessaging = @"fcm"; - -#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 -const NSNotificationName kFIRInstanceIDTokenRefreshNotification = - @"com.firebase.iid.notif.refresh-token"; -#else -NSString *const kFIRInstanceIDTokenRefreshNotification = @"com.firebase.iid.notif.refresh-token"; -#endif // defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 - -NSString *const kFIRInstanceIDInvalidNilHandlerError = @"Invalid nil handler."; - -// Private constants -int64_t const kMaxRetryIntervalForDefaultTokenInSeconds = 20 * 60; // 20 minutes -int64_t const kMinRetryIntervalForDefaultTokenInSeconds = 10; // 10 seconds -// we retry only a max 5 times. -// TODO(chliangGoogle): If we still fail we should listen for the network change notification -// since GCM would have started Reachability. We only start retrying after we see a configuration -// change. -NSInteger const kMaxRetryCountForDefaultToken = 5; - -static NSString *const kEntitlementsAPSEnvironmentKey = @"Entitlements.aps-environment"; -static NSString *const kAPSEnvironmentDevelopmentValue = @"development"; -/// FIRMessaging selector that returns the current FIRMessaging auto init -/// enabled flag. -static NSString *const kFIRInstanceIDFCMSelectorAutoInitEnabled = @"isAutoInitEnabled"; -static NSString *const kFIRInstanceIDFCMSelectorInstance = @"messaging"; - -static NSString *const kFIRInstanceIDAPNSTokenType = @"APNSTokenType"; -static NSString *const kFIRIIDAppReadyToConfigureSDKNotification = - @"FIRAppReadyToConfigureSDKNotification"; -static NSString *const kFIRIIDAppNameKey = @"FIRAppNameKey"; -static NSString *const kFIRIIDErrorDomain = @"com.firebase.instanceid"; -static NSString *const kFIRIIDServiceInstanceID = @"InstanceID"; - -// This should be the same value as FIRErrorCodeInstanceIDFailed, which we can't import directly -static NSInteger const kFIRIIDErrorCodeInstanceIDFailed = -121; - -typedef void (^FIRInstanceIDKeyPairHandler)(FIRInstanceIDKeyPair *keyPair, NSError *error); - -/** - * The APNS token type for the app. If the token type is set to `UNKNOWN` - * InstanceID will implicitly try to figure out what the actual token type - * is from the provisioning profile. - * This must match FIRMessagingAPNSTokenType in FIRMessaging.h - */ -typedef NS_ENUM(NSInteger, FIRInstanceIDAPNSTokenType) { - /// Unknown token type. - FIRInstanceIDAPNSTokenTypeUnknown, - /// Sandbox token type. - FIRInstanceIDAPNSTokenTypeSandbox, - /// Production token type. - FIRInstanceIDAPNSTokenTypeProd, -} NS_SWIFT_NAME(InstanceIDAPNSTokenType); - -@interface FIRInstanceIDResult () -@property(nonatomic, readwrite, copy) NSString *instanceID; -@property(nonatomic, readwrite, copy) NSString *token; -@end - -@interface FIRInstanceID () - -// FIRApp configuration objects. -@property(nonatomic, readwrite, copy) NSString *fcmSenderID; -@property(nonatomic, readwrite, copy) NSString *firebaseAppID; - -// Raw APNS token data -@property(nonatomic, readwrite, strong) NSData *apnsTokenData; - -@property(nonatomic, readwrite) FIRInstanceIDAPNSTokenType apnsTokenType; -// String-based, internal representation of APNS token -@property(nonatomic, readwrite, copy) NSString *APNSTupleString; -// Token fetched from the server automatically for the default app. -@property(nonatomic, readwrite, copy) NSString *defaultFCMToken; - -@property(nonatomic, readwrite, strong) FIRInstanceIDTokenManager *tokenManager; -@property(nonatomic, readwrite, strong) FIRInstanceIDKeyPairStore *keyPairStore; - -// backoff and retry for default token -@property(atomic, readwrite, assign) BOOL isFetchingDefaultToken; -@property(atomic, readwrite, assign) BOOL isDefaultTokenFetchScheduled; -@property(nonatomic, readwrite, assign) NSInteger retryCountForDefaultToken; - -@end - -// InstanceID doesn't provide any functionality to other components, -// so it provides a private, empty protocol that it conforms to and use it for registration. - -@protocol FIRInstanceIDInstanceProvider -@end - -@interface FIRInstanceID () <FIRInstanceIDInstanceProvider, FIRLibrary> -@end - -@implementation FIRInstanceIDResult -- (id)copyWithZone:(NSZone *)zone { - FIRInstanceIDResult *result = [[[self class] allocWithZone:zone] init]; - result.instanceID = self.instanceID; - result.token = self.token; - return result; -} -@end - -@implementation FIRInstanceID - -// File static to support InstanceID tests that call [FIRInstanceID instanceID] after -// [FIRInstanceID instanceIDForTests]. -static FIRInstanceID *gInstanceID; - -+ (instancetype)instanceID { - // If the static instance was created, return it. This should only be set in tests and we should - // eventually use proper dependency injection for a better test structure. - if (gInstanceID != nil) { - return gInstanceID; - } - FIRApp *defaultApp = [FIRApp defaultApp]; // Missing configure will be logged here. - FIRInstanceID *instanceID = - (FIRInstanceID *)FIR_COMPONENT(FIRInstanceIDInstanceProvider, defaultApp.container); - return instanceID; -} - -- (instancetype)initPrivately { - self = [super init]; - if (self != nil) { - // Use automatic detection of sandbox, unless otherwise set by developer - _apnsTokenType = FIRInstanceIDAPNSTokenTypeUnknown; - } - return self; -} - -+ (FIRInstanceID *)instanceIDForTests { - gInstanceID = [[FIRInstanceID alloc] initPrivately]; - [gInstanceID start]; - return gInstanceID; -} - -- (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (void)stopAllRequests { - [self.tokenManager stopAllTokenOperations]; -} - -#pragma mark - Tokens - -- (NSString *)token { - if (!self.fcmSenderID.length) { - return nil; - } - - NSString *cachedToken = [self cachedTokenIfAvailable]; - - if (cachedToken) { - return cachedToken; - } else { - // If we've never had a cached default token, we should fetch one because unrelatedly, - // this request will help us determine whether the locally-generated Instance ID keypair is not - // unique, and therefore generate a new one. - [self fetchDefaultToken]; - return nil; - } -} - -- (void)instanceIDWithHandler:(FIRInstanceIDResultHandler)handler { - FIRInstanceID_WEAKIFY(self); - [self getIDWithHandler:^(NSString *identity, NSError *error) { - FIRInstanceID_STRONGIFY(self); - // This is in main queue already - if (error) { - if (handler) { - handler(nil, error); - } - return; - } - FIRInstanceIDResult *result = [[FIRInstanceIDResult alloc] init]; - result.instanceID = identity; - NSString *cachedToken = [self cachedTokenIfAvailable]; - if (cachedToken) { - if (handler) { - result.token = cachedToken; - handler(result, nil); - } - // If no handler, simply return since client has generated iid and token. - return; - } - - // Now get token - FIRInstanceIDTokenHandler tokenHandler = ^void(NSString *token, NSError *error) { - if (error) { - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeInstanceID007, - @"Failed to retrieve the default FCM token after %ld retries", - (long)self.retryCountForDefaultToken); - if (handler) { - // If token fetching fails, result should be nil with error returned. - handler(nil, error); - } - return; - } - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeInstanceID008, @"Got default token %@", - token); - NSString *previousFCMToken = self.defaultFCMToken; - self.defaultFCMToken = token; - - // Only notify of token refresh if we have a new valid token that's different than before - if (self.defaultFCMToken.length && ![self.defaultFCMToken isEqualToString:previousFCMToken]) { - NSNotification *tokenRefreshNotification = - [NSNotification notificationWithName:kFIRInstanceIDTokenRefreshNotification - object:[self.defaultFCMToken copy]]; - [[NSNotificationQueue defaultQueue] enqueueNotification:tokenRefreshNotification - postingStyle:NSPostASAP]; - } - - if (handler) { - result.token = token; - handler(result, nil); - } - }; - - [self defaultTokenWithHandler:tokenHandler]; - }]; -} - -- (NSString *)cachedTokenIfAvailable { - FIRInstanceIDTokenInfo *cachedTokenInfo = - [self.tokenManager cachedTokenInfoWithAuthorizedEntity:self.fcmSenderID - scope:kFIRInstanceIDDefaultTokenScope]; - return cachedTokenInfo.token; -} - -- (void)setDefaultFCMToken:(NSString *)defaultFCMToken { - if (_defaultFCMToken && defaultFCMToken && [defaultFCMToken isEqualToString:_defaultFCMToken]) { - return; - } - - _defaultFCMToken = defaultFCMToken; - - // Sending this notification out will ensure that FIRMessaging has the updated - // default FCM token. - NSNotification *internalDefaultTokenNotification = - [NSNotification notificationWithName:kFIRInstanceIDDefaultGCMTokenNotification - object:_defaultFCMToken]; - [[NSNotificationQueue defaultQueue] enqueueNotification:internalDefaultTokenNotification - postingStyle:NSPostASAP]; -} - -- (void)tokenWithAuthorizedEntity:(NSString *)authorizedEntity - scope:(NSString *)scope - options:(NSDictionary *)options - handler:(FIRInstanceIDTokenHandler)handler { - _FIRInstanceIDDevAssert(handler != nil && [authorizedEntity length] && [scope length], - @"Invalid authorizedEntity or scope to new token"); - if (!handler) { - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeInstanceID000, - kFIRInstanceIDInvalidNilHandlerError); - return; - } - - NSMutableDictionary *tokenOptions = [NSMutableDictionary dictionary]; - if (options.count) { - [tokenOptions addEntriesFromDictionary:options]; - } - - NSString *APNSKey = kFIRInstanceIDTokenOptionsAPNSKey; - NSString *serverTypeKey = kFIRInstanceIDTokenOptionsAPNSIsSandboxKey; - - if (tokenOptions[APNSKey] != nil && tokenOptions[serverTypeKey] == nil) { - // APNS key was given, but server type is missing. Supply the server type with automatic - // checking. This can happen when the token is requested from FCM, which does not include a - // server type during its request. - tokenOptions[serverTypeKey] = @([self isSandboxApp]); - } - - // comparing enums to ints directly throws a warning - FIRInstanceIDErrorCode noError = INT_MAX; - FIRInstanceIDErrorCode errorCode = noError; - if (FIRInstanceIDIsValidGCMScope(scope) && !tokenOptions[APNSKey]) { - errorCode = kFIRInstanceIDErrorCodeMissingAPNSToken; - } else if (FIRInstanceIDIsValidGCMScope(scope) && - ![tokenOptions[APNSKey] isKindOfClass:[NSData class]]) { - errorCode = kFIRInstanceIDErrorCodeInvalidRequest; - } else if (![authorizedEntity length]) { - errorCode = kFIRInstanceIDErrorCodeInvalidAuthorizedEntity; - } else if (![scope length]) { - errorCode = kFIRInstanceIDErrorCodeInvalidScope; - } else if (!self.keyPairStore) { - errorCode = kFIRInstanceIDErrorCodeInvalidStart; - } - - FIRInstanceIDTokenHandler newHandler = ^(NSString *token, NSError *error) { - dispatch_async(dispatch_get_main_queue(), ^{ - handler(token, error); - }); - }; - - if (errorCode != noError) { - newHandler(nil, [NSError errorWithFIRInstanceIDErrorCode:errorCode]); - return; - } - - // TODO(chliangGoogle): Add some validation logic that the APNs token data and sandbox value are - // supplied in the valid format (NSData and BOOL, respectively). - - // Add internal options - if (self.firebaseAppID) { - tokenOptions[kFIRInstanceIDTokenOptionsFirebaseAppIDKey] = self.firebaseAppID; - } - - FIRInstanceID_WEAKIFY(self); - FIRInstanceIDAuthService *authService = self.tokenManager.authService; - [authService - fetchCheckinInfoWithHandler:^(FIRInstanceIDCheckinPreferences *preferences, NSError *error) { - FIRInstanceID_STRONGIFY(self); - if (error) { - newHandler(nil, error); - return; - } - - // Only use the token in the cache if the APNSInfo matches what the request's options has. - // It's possible for the request to be with a newer APNs device token, which should be - // honored. - FIRInstanceIDTokenInfo *cachedTokenInfo = - [self.tokenManager cachedTokenInfoWithAuthorizedEntity:authorizedEntity scope:scope]; - if (cachedTokenInfo) { - // Ensure that the cached token matches APNs data before returning it. - FIRInstanceIDAPNSInfo *optionsAPNSInfo = - [[FIRInstanceIDAPNSInfo alloc] initWithTokenOptionsDictionary:tokenOptions]; - // If either the APNs info is missing in both, or if they are an exact match, then we can - // use this cached token. - if ((!cachedTokenInfo.APNSInfo && !optionsAPNSInfo) || - [cachedTokenInfo.APNSInfo isEqualToAPNSInfo:optionsAPNSInfo]) { - newHandler(cachedTokenInfo.token, nil); - return; - } - } - - FIRInstanceID_WEAKIFY(self); - [self asyncLoadKeyPairWithHandler:^(FIRInstanceIDKeyPair *keyPair, NSError *error) { - FIRInstanceID_STRONGIFY(self); - - if (error) { - NSError *newError = - [NSError errorWithFIRInstanceIDErrorCode:kFIRInstanceIDErrorCodeInvalidKeyPair]; - newHandler(nil, newError); - - } else { - [self.tokenManager fetchNewTokenWithAuthorizedEntity:[authorizedEntity copy] - scope:[scope copy] - keyPair:keyPair - options:tokenOptions - handler:newHandler]; - } - }]; - }]; -} - -- (void)deleteTokenWithAuthorizedEntity:(NSString *)authorizedEntity - scope:(NSString *)scope - handler:(FIRInstanceIDDeleteTokenHandler)handler { - _FIRInstanceIDDevAssert(handler != nil && [authorizedEntity length] && [scope length], - @"Invalid authorizedEntity or scope to delete token"); - - if (!handler) { - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeInstanceID001, - kFIRInstanceIDInvalidNilHandlerError); - } - - // comparing enums to ints directly throws a warning - FIRInstanceIDErrorCode noError = INT_MAX; - FIRInstanceIDErrorCode errorCode = noError; - - if (![authorizedEntity length]) { - errorCode = kFIRInstanceIDErrorCodeInvalidAuthorizedEntity; - } else if (![scope length]) { - errorCode = kFIRInstanceIDErrorCodeInvalidScope; - } else if (!self.keyPairStore) { - errorCode = kFIRInstanceIDErrorCodeInvalidStart; - } - - FIRInstanceIDDeleteTokenHandler newHandler = ^(NSError *error) { - // If a default token is deleted successfully, reset the defaultFCMToken too. - if (!error && [authorizedEntity isEqualToString:self.fcmSenderID] && - [scope isEqualToString:kFIRInstanceIDDefaultTokenScope]) { - self.defaultFCMToken = nil; - } - dispatch_async(dispatch_get_main_queue(), ^{ - handler(error); - }); - }; - - if (errorCode != noError) { - newHandler([NSError errorWithFIRInstanceIDErrorCode:errorCode]); - return; - } - - FIRInstanceID_WEAKIFY(self); - FIRInstanceIDAuthService *authService = self.tokenManager.authService; - [authService - fetchCheckinInfoWithHandler:^(FIRInstanceIDCheckinPreferences *preferences, NSError *error) { - FIRInstanceID_STRONGIFY(self); - if (error) { - newHandler(error); - return; - } - - FIRInstanceID_WEAKIFY(self); - [self asyncLoadKeyPairWithHandler:^(FIRInstanceIDKeyPair *keyPair, NSError *error) { - FIRInstanceID_STRONGIFY(self); - if (error) { - NSError *newError = - [NSError errorWithFIRInstanceIDErrorCode:kFIRInstanceIDErrorCodeInvalidKeyPair]; - newHandler(newError); - - } else { - [self.tokenManager deleteTokenWithAuthorizedEntity:authorizedEntity - scope:scope - keyPair:keyPair - handler:newHandler]; - } - }]; - }]; -} - -- (void)asyncLoadKeyPairWithHandler:(FIRInstanceIDKeyPairHandler)handler { - FIRInstanceID_WEAKIFY(self); - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - FIRInstanceID_STRONGIFY(self); - - NSError *error = nil; - FIRInstanceIDKeyPair *keyPair = [self.keyPairStore loadKeyPairWithError:&error]; - dispatch_async(dispatch_get_main_queue(), ^{ - if (error) { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeInstanceID002, - @"Failed to retreieve keyPair %@", error); - if (handler) { - handler(nil, error); - } - } else if (!keyPair && !error) { - if (handler) { - handler(nil, - [NSError errorWithFIRInstanceIDErrorCode:kFIRInstanceIDErrorCodeInvalidKeyPair]); - } - } else { - if (handler) { - handler(keyPair, nil); - } - } - }); - }); -} - -#pragma mark - Identity - -- (void)getIDWithHandler:(FIRInstanceIDHandler)handler { - _FIRInstanceIDDevAssert(handler, @"Invalid nil handler to getIdentity"); - - if (!handler) { - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeInstanceID003, - kFIRInstanceIDInvalidNilHandlerError); - return; - } - - void (^callHandlerOnMainThread)(NSString *, NSError *) = ^(NSString *identity, NSError *error) { - dispatch_async(dispatch_get_main_queue(), ^{ - handler(identity, error); - }); - }; - - if (!self.keyPairStore) { - NSError *error = [NSError errorWithFIRInstanceIDErrorCode:kFIRInstanceIDErrorCodeInvalidStart]; - callHandlerOnMainThread(nil, error); - return; - } - - FIRInstanceID_WEAKIFY(self); - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - FIRInstanceID_STRONGIFY(self); - NSError *error; - NSString *appIdentity = [self.keyPairStore appIdentityWithError:&error]; - // When getID is explicitly called, trigger getToken to make sure token always exists. - // This is to avoid ID conflict (ID is not checked for conflict until we generate a token) - if (appIdentity) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [self token]; -#pragma clang diagnostic pop - } - callHandlerOnMainThread(appIdentity, error); - }); -} - -- (void)deleteIDWithHandler:(FIRInstanceIDDeleteHandler)handler { - _FIRInstanceIDDevAssert(handler, @"Invalid nil handler to delete Identity"); - - if (!handler) { - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeInstanceID004, - kFIRInstanceIDInvalidNilHandlerError); - return; - } - - void (^callHandlerOnMainThread)(NSError *) = ^(NSError *error) { - if ([NSThread isMainThread]) { - handler(error); - return; - } - dispatch_async(dispatch_get_main_queue(), ^{ - handler(error); - }); - }; - - if (!self.keyPairStore) { - FIRInstanceIDErrorCode error = kFIRInstanceIDErrorCodeInvalidStart; - callHandlerOnMainThread([NSError errorWithFIRInstanceIDErrorCode:error]); - return; - } - - FIRInstanceID_WEAKIFY(self); - void (^deleteTokensHandler)(NSError *) = ^void(NSError *error) { - FIRInstanceID_STRONGIFY(self); - if (error) { - callHandlerOnMainThread(error); - return; - } - [self deleteIdentityWithHandler:^(NSError *error) { - callHandlerOnMainThread(error); - }]; - }; - - [self asyncLoadKeyPairWithHandler:^(FIRInstanceIDKeyPair *keyPair, NSError *error) { - FIRInstanceID_STRONGIFY(self); - if (error) { - NSError *newError = - [NSError errorWithFIRInstanceIDErrorCode:kFIRInstanceIDErrorCodeInvalidKeyPair]; - callHandlerOnMainThread(newError); - } else { - [self.tokenManager deleteAllTokensWithKeyPair:keyPair handler:deleteTokensHandler]; - } - }]; -} - -- (void)notifyIdentityReset { - [self deleteIdentityWithHandler:nil]; -} - -// Delete all the local cache checkin, IID and token. -- (void)deleteIdentityWithHandler:(FIRInstanceIDDeleteHandler)handler { - // Delete tokens. - [self.tokenManager deleteAllTokensLocallyWithHandler:^(NSError *deleteTokenError) { - // Reset FCM token. - self.defaultFCMToken = nil; - if (deleteTokenError) { - if (handler) { - handler(deleteTokenError); - } - return; - } - - // Delete Instance ID. - [self.keyPairStore - deleteSavedKeyPairWithSubtype:kFIRInstanceIDKeyPairSubType - handler:^(NSError *error) { - NSError *deletePlistError; - [self.keyPairStore - removeKeyPairCreationTimePlistWithError:&deletePlistError]; - if (error || deletePlistError) { - if (handler) { - // Prefer to use the delete Instance ID error. - error = [NSError - errorWithFIRInstanceIDErrorCode: - kFIRInstanceIDErrorCodeUnknown - userInfo:@{ - NSUnderlyingErrorKey : error - ? error - : deletePlistError - }]; - handler(error); - } - return; - } - // Delete checkin. - [self.tokenManager.authService - resetCheckinWithHandler:^(NSError *error) { - if (error) { - if (handler) { - handler(error); - } - return; - } - // Only request new token if FCM auto initialization is - // enabled. - if ([self isFCMAutoInitEnabled]) { - // Deletion succeeds! Requesting new checkin, IID and token. - // TODO(chliangGoogle) see if dispatch_after is necessary - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, - (int64_t)(0.5 * NSEC_PER_SEC)), - dispatch_get_main_queue(), ^{ - [self fetchDefaultToken]; - }); - } - if (handler) { - handler(nil); - } - }]; - }]; - }]; -} - -#pragma mark - Config - -+ (void)load { - [FIRApp registerInternalLibrary:(Class<FIRLibrary>)self - withName:@"fire-iid" - withVersion:FIRInstanceIDCurrentLibraryVersion()]; -} - -+ (nonnull NSArray<FIRComponent *> *)componentsToRegister { - FIRComponentCreationBlock creationBlock = - ^id _Nullable(FIRComponentContainer *container, BOOL *isCacheable) { - // Ensure it's cached so it returns the same instance every time instanceID is called. - *isCacheable = YES; - FIRInstanceID *instanceID = [[FIRInstanceID alloc] initPrivately]; - [instanceID start]; - return instanceID; - }; - FIRComponent *instanceIDProvider = - [FIRComponent componentWithProtocol:@protocol(FIRInstanceIDInstanceProvider) - instantiationTiming:FIRInstantiationTimingLazy - dependencies:@[] - creationBlock:creationBlock]; - return @[ instanceIDProvider ]; -} - -+ (void)configureWithApp:(FIRApp *)app { - if (!app.isDefaultApp) { - // Only configure for the default FIRApp. - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeFIRApp002, - @"Firebase Instance ID only works with the default app."); - return; - } - [[FIRInstanceID instanceID] configureInstanceIDWithOptions:app.options app:app]; -} - -- (void)configureInstanceIDWithOptions:(FIROptions *)options app:(FIRApp *)firApp { - NSString *GCMSenderID = options.GCMSenderID; - if (!GCMSenderID.length) { - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeFIRApp000, - @"Firebase not set up correctly, nil or empty senderID."); - [FIRInstanceID exitWithReason:@"GCM_SENDER_ID must not be nil or empty." forFirebaseApp:firApp]; - return; - } - - self.fcmSenderID = GCMSenderID; - self.firebaseAppID = firApp.options.googleAppID; - - // FCM generates a FCM token during app start for sending push notification to device. - // This is not needed for app extension. - if (![GULAppEnvironmentUtil isAppExtension]) { - [self didCompleteConfigure]; - } -} - -+ (NSError *)configureErrorWithReason:(nonnull NSString *)reason { - NSString *description = - [NSString stringWithFormat:@"Configuration failed for service %@.", kFIRIIDServiceInstanceID]; - if (!reason.length) { - reason = @"Unknown reason"; - } - - NSDictionary *userInfo = - @{NSLocalizedDescriptionKey : description, NSLocalizedFailureReasonErrorKey : reason}; - - return [NSError errorWithDomain:kFIRIIDErrorDomain - code:kFIRIIDErrorCodeInstanceIDFailed - userInfo:userInfo]; -} - -// If the firebaseApp is available we should send logs for the error through it before -// raising an exception. -+ (void)exitWithReason:(nonnull NSString *)reason forFirebaseApp:(FIRApp *)firebaseApp { - [firebaseApp sendLogsWithServiceName:kFIRIIDServiceInstanceID - version:FIRInstanceIDCurrentLibraryVersion() - error:[self configureErrorWithReason:reason]]; - - [NSException raise:kFIRIIDErrorDomain - format:@"Could not configure Firebase InstanceID. %@", reason]; -} - -// This is used to start any operations when we receive FirebaseSDK setup notification -// from FIRCore. -- (void)didCompleteConfigure { - NSString *cachedToken = [self cachedTokenIfAvailable]; - // When there is a cached token, do the token refresh. - if (cachedToken) { - // Clean up expired tokens by checking the token refresh policy. - if ([self.tokenManager checkForTokenRefreshPolicy]) { - // Default token is expired, fetch default token from server. - [self fetchDefaultToken]; - } - // Notify FCM with the default token. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - self.defaultFCMToken = [self token]; -#pragma clang diagnostic pop - } else if ([self isFCMAutoInitEnabled]) { - // When there is no cached token, must check auto init is enabled. - // If it's disabled, don't initiate token generation/refresh. - // If no cache token and auto init is enabled, fetch a token from server. - [self fetchDefaultToken]; - // Notify FCM with the default token. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - self.defaultFCMToken = [self token]; -#pragma clang diagnostic pop - } - // ONLY checkin when auto data collection is turned on. - if ([self isFCMAutoInitEnabled]) { - [self.tokenManager.authService scheduleCheckin:YES]; - } -} - -- (BOOL)isFCMAutoInitEnabled { - Class messagingClass = NSClassFromString(kFIRInstanceIDFCMSDKClassString); - // Firebase Messaging is not installed, auto init should be disabled since it's for FCM. - if (!messagingClass) { - return NO; - } - - // Messaging doesn't have the singleton method, auto init should be enabled since FCM exists. - SEL instanceSelector = NSSelectorFromString(kFIRInstanceIDFCMSelectorInstance); - if (![messagingClass respondsToSelector:instanceSelector]) { - return YES; - } - - // Get FIRMessaging shared instance. - IMP messagingInstanceIMP = [messagingClass methodForSelector:instanceSelector]; - id (*getMessagingInstance)(id, SEL) = (void *)messagingInstanceIMP; - id messagingInstance = getMessagingInstance(messagingClass, instanceSelector); - - // Messaging doesn't have the property, auto init should be enabled since FCM exists. - SEL autoInitSelector = NSSelectorFromString(kFIRInstanceIDFCMSelectorAutoInitEnabled); - if (![messagingInstance respondsToSelector:autoInitSelector]) { - return YES; - } - - // Get autoInitEnabled method. - IMP isAutoInitEnabledIMP = [messagingInstance methodForSelector:autoInitSelector]; - BOOL (*isAutoInitEnabled)(id, SEL) = (BOOL(*)(id, SEL))isAutoInitEnabledIMP; - - // Check FCM's isAutoInitEnabled property. - return isAutoInitEnabled(messagingInstance, autoInitSelector); -} - -// Actually makes InstanceID instantiate both the IID and Token-related subsystems. -- (void)start { - NSString *instanceIDSubDirectory = kFIRInstanceIDApplicationSupportSubDirectory; - if (![FIRInstanceIDStore hasApplicationSupportSubDirectory:instanceIDSubDirectory]) { - [FIRInstanceIDStore createApplicationSupportSubDirectory:instanceIDSubDirectory]; - } - - [self setupTokenManager]; - [self setupKeyPairManager]; - [self setupNotificationListeners]; -} - -// Creates the token manager, which is used for fetching, caching, and retrieving tokens. -- (void)setupTokenManager { - self.tokenManager = [[FIRInstanceIDTokenManager alloc] init]; -} - -// Creates a key pair manager, which stores the public/private keys needed to generate an -// application instance ID. -- (void)setupKeyPairManager { - self.keyPairStore = [[FIRInstanceIDKeyPairStore alloc] init]; - if ([self.keyPairStore invalidateKeyPairsIfNeeded]) { - // Reset tokens right away when keypair is deleted, otherwise async call can make first query - // of token happens before reset old tokens during app start. - // TODO(chliangGoogle): Delete all tokens on server too, using - // deleteAllTokensWithKeyPair:handler:. This requires actually retrieving the invalid keypair - // from Keychain, which is something that the key pair store does not currently do. - [self.tokenManager deleteAllTokensLocallyWithHandler:nil]; - } -} - -- (void)setupNotificationListeners { - // To prevent double notifications remove observer from all events during setup. - NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; - [center removeObserver:self]; - [center addObserver:self - selector:@selector(notifyIdentityReset) - name:kFIRInstanceIDIdentityInvalidatedNotification - object:nil]; - [center addObserver:self - selector:@selector(notifyAPNSTokenIsSet:) - name:kFIRInstanceIDAPNSTokenNotification - object:nil]; -} - -#pragma mark - Private Helpers -/// Maximum retry count to fetch the default token. -+ (int64_t)maxRetryCountForDefaultToken { - return kMaxRetryCountForDefaultToken; -} - -/// Minimum interval in seconds between retries to fetch the default token. -+ (int64_t)minIntervalForDefaultTokenRetry { - return kMinRetryIntervalForDefaultTokenInSeconds; -} - -/// Maximum retry interval between retries to fetch default token. -+ (int64_t)maxRetryIntervalForDefaultTokenInSeconds { - return kMaxRetryIntervalForDefaultTokenInSeconds; -} - -- (NSInteger)retryIntervalToFetchDefaultToken { - if (self.retryCountForDefaultToken >= [[self class] maxRetryCountForDefaultToken]) { - return (NSInteger)[[self class] maxRetryIntervalForDefaultTokenInSeconds]; - } - // exponential backoff with a fixed initial retry time - // 11s, 22s, 44s, 88s ... - int64_t minInterval = [[self class] minIntervalForDefaultTokenRetry]; - return (NSInteger)MIN( - (1 << self.retryCountForDefaultToken) + minInterval * self.retryCountForDefaultToken, - kMaxRetryIntervalForDefaultTokenInSeconds); -} - -- (void)fetchDefaultToken { - if (self.isFetchingDefaultToken) { - return; - } - - FIRInstanceID_WEAKIFY(self); - FIRInstanceIDTokenHandler handler = ^void(NSString *token, NSError *error) { - FIRInstanceID_STRONGIFY(self); - - if (error) { - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeInstanceID007, - @"Failed to retrieve the default FCM token after %ld retries", - (long)self.retryCountForDefaultToken); - } else { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeInstanceID008, @"Got default token %@", - token); - NSString *previousFCMToken = self.defaultFCMToken; - self.defaultFCMToken = token; - - // Only notify of token refresh if we have a new valid token that's different than before - if (self.defaultFCMToken.length && ![self.defaultFCMToken isEqualToString:previousFCMToken]) { - NSNotification *tokenRefreshNotification = - [NSNotification notificationWithName:kFIRInstanceIDTokenRefreshNotification - object:[self.defaultFCMToken copy]]; - [[NSNotificationQueue defaultQueue] enqueueNotification:tokenRefreshNotification - postingStyle:NSPostASAP]; - } - } - }; - - // Get a "*" token using this APNS token. - [self defaultTokenWithHandler:handler]; -} - -- (void)defaultTokenWithHandler:(FIRInstanceIDTokenHandler)handler { - if (self.isFetchingDefaultToken || self.isDefaultTokenFetchScheduled) { - return; - } - NSDictionary *instanceIDOptions = @{}; - BOOL hasFirebaseMessaging = NSClassFromString(kFIRInstanceIDFCMSDKClassString) != nil; - if (hasFirebaseMessaging && self.apnsTokenData) { - BOOL isSandboxApp = (self.apnsTokenType == FIRInstanceIDAPNSTokenTypeSandbox); - if (self.apnsTokenType == FIRInstanceIDAPNSTokenTypeUnknown) { - isSandboxApp = [self isSandboxApp]; - } - instanceIDOptions = @{ - kFIRInstanceIDTokenOptionsAPNSKey : self.apnsTokenData, - kFIRInstanceIDTokenOptionsAPNSIsSandboxKey : @(isSandboxApp), - }; - } - - FIRInstanceID_WEAKIFY(self); - FIRInstanceIDTokenHandler newHandler = ^void(NSString *token, NSError *error) { - FIRInstanceID_STRONGIFY(self); - self.isFetchingDefaultToken = NO; - - if (error) { - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeInstanceID009, - @"Failed to fetch default token %@", error); - - // This notification can be sent multiple times since we can't guarantee success at any point - // of time. - NSNotification *tokenFetchFailNotification = - [NSNotification notificationWithName:kFIRInstanceIDDefaultGCMTokenFailNotification - object:[error copy]]; - [[NSNotificationQueue defaultQueue] enqueueNotification:tokenFetchFailNotification - postingStyle:NSPostASAP]; - - self.retryCountForDefaultToken = (NSInteger)MIN(self.retryCountForDefaultToken + 1, - [[self class] maxRetryCountForDefaultToken]); - - // Do not retry beyond the maximum limit. - if (self.retryCountForDefaultToken < [[self class] maxRetryCountForDefaultToken]) { - NSInteger retryInterval = [self retryIntervalToFetchDefaultToken]; - FIRInstanceID_WEAKIFY(self); - self.isDefaultTokenFetchScheduled = YES; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(retryInterval * NSEC_PER_SEC)), - dispatch_get_main_queue(), ^{ - FIRInstanceID_STRONGIFY(self); - self.isDefaultTokenFetchScheduled = NO; - [self defaultTokenWithHandler:handler]; - }); - } else { - if (handler) { - handler(nil, error); - } - } - } else { - // If somebody updated IID with APNS token while our initial request did not have it - // set we need to update it on the server. - BOOL shouldNotifyHandler = YES; - NSData *deviceTokenInRequest = instanceIDOptions[kFIRInstanceIDTokenOptionsAPNSKey]; - BOOL isSandboxInRequest = - [instanceIDOptions[kFIRInstanceIDTokenOptionsAPNSIsSandboxKey] boolValue]; - // Note that APNSTupleStringInRequest will be nil if deviceTokenInRequest is nil - NSString *APNSTupleStringInRequest = FIRInstanceIDAPNSTupleStringForTokenAndServerType( - deviceTokenInRequest, isSandboxInRequest); - // If the APNs value either remained nil, or was the same non-nil value, the APNs value - // did not change. - BOOL APNSRemainedSameDuringFetch = - (self.APNSTupleString == nil && APNSTupleStringInRequest == nil) || - ([self.APNSTupleString isEqualToString:APNSTupleStringInRequest]); - if (!APNSRemainedSameDuringFetch && hasFirebaseMessaging) { - // APNs value did change mid-fetch, so the token should be re-fetched with the current APNs - // value. - self.isDefaultTokenFetchScheduled = YES; - // Wait to notify until we can modify this token with APNS (or receive a new token) - shouldNotifyHandler = NO; - FIRInstanceID_WEAKIFY(self); - dispatch_async(dispatch_get_main_queue(), ^{ - FIRInstanceID_STRONGIFY(self); - self.isDefaultTokenFetchScheduled = NO; - [self defaultTokenWithHandler:handler]; - }); - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeRefetchingTokenForAPNS, - @"Received APNS token while fetching default token. " - @"Refetching default token."); - } else { - FIRInstanceIDLoggerInfo(kFIRInstanceIDMessageCodeInstanceID010, - @"Successfully fetched default token."); - } - // Post the required notifications if somebody is waiting. - if (shouldNotifyHandler && handler) { - handler(token, nil); - } - } - }; - - self.isFetchingDefaultToken = YES; - [self tokenWithAuthorizedEntity:self.fcmSenderID - scope:kFIRInstanceIDDefaultTokenScope - options:instanceIDOptions - handler:newHandler]; -} - -#pragma mark - APNS Token -// This should only be triggered from FCM. -- (void)notifyAPNSTokenIsSet:(NSNotification *)notification { - NSData *token = notification.object; - if (!token || ![token isKindOfClass:[NSData class]]) { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeInternal002, @"Invalid APNS token type %@", - NSStringFromClass([notification.object class])); - return; - } - NSInteger type = [notification.userInfo[kFIRInstanceIDAPNSTokenType] integerValue]; - - // The APNS token is being added, or has changed (rare) - if ([self.apnsTokenData isEqualToData:token]) { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeInstanceID011, - @"Trying to reset APNS token to the same value. Will return"); - return; - } - // Use this token type for when we have to automatically fetch tokens in the future - self.apnsTokenType = type; - BOOL isSandboxApp = (type == FIRInstanceIDAPNSTokenTypeSandbox); - if (self.apnsTokenType == FIRInstanceIDAPNSTokenTypeUnknown) { - isSandboxApp = [self isSandboxApp]; - } - self.apnsTokenData = [token copy]; - self.APNSTupleString = FIRInstanceIDAPNSTupleStringForTokenAndServerType(token, isSandboxApp); - - // Pro-actively invalidate the default token, if the APNs change makes it - // invalid. Previously, we invalidated just before fetching the token. - NSArray<FIRInstanceIDTokenInfo *> *invalidatedTokens = - [self.tokenManager updateTokensToAPNSDeviceToken:self.apnsTokenData isSandbox:isSandboxApp]; - - // Re-fetch any invalidated tokens automatically, this time with the current APNs token, so that - // they are up-to-date. - if (invalidatedTokens.count > 0) { - FIRInstanceID_WEAKIFY(self); - [self asyncLoadKeyPairWithHandler:^(FIRInstanceIDKeyPair *keyPair, NSError *error) { - FIRInstanceID_STRONGIFY(self); - - NSMutableDictionary *tokenOptions = [@{ - kFIRInstanceIDTokenOptionsAPNSKey : self.apnsTokenData, - kFIRInstanceIDTokenOptionsAPNSIsSandboxKey : @(isSandboxApp) - } mutableCopy]; - if (self.firebaseAppID) { - tokenOptions[kFIRInstanceIDTokenOptionsFirebaseAppIDKey] = self.firebaseAppID; - } - - for (FIRInstanceIDTokenInfo *tokenInfo in invalidatedTokens) { - if ([tokenInfo.token isEqualToString:self.defaultFCMToken]) { - // We will perform a special fetch for the default FCM token, so that the delegate methods - // are called. For all others, we will do an internal re-fetch. - [self fetchDefaultToken]; - } else { - [self.tokenManager fetchNewTokenWithAuthorizedEntity:tokenInfo.authorizedEntity - scope:tokenInfo.scope - keyPair:keyPair - options:tokenOptions - handler:^(NSString *_Nullable token, - NSError *_Nullable error){ - - }]; - } - } - }]; - } -} - -- (BOOL)isSandboxApp { - static BOOL isSandboxApp = YES; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - isSandboxApp = ![self isProductionApp]; - }); - return isSandboxApp; -} - -- (BOOL)isProductionApp { - const BOOL defaultAppTypeProd = YES; - - NSError *error = nil; - - Class envClass = NSClassFromString(@"FIRAppEnvironmentUtil"); - SEL isSimulatorSelector = NSSelectorFromString(@"isSimulator"); - if ([envClass respondsToSelector:isSimulatorSelector]) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-performSelector-leaks" - if ([envClass performSelector:isSimulatorSelector]) { -#pragma clang diagnostic pop - [self logAPNSConfigurationError:@"Running InstanceID on a simulator doesn't have APNS. " - @"Use prod profile by default."]; - return defaultAppTypeProd; - } - } - - NSString *path = [[[NSBundle mainBundle] bundlePath] - stringByAppendingPathComponent:@"embedded.mobileprovision"]; - - // Apps distributed via AppStore or TestFlight use the Production APNS certificates. - SEL isFromAppStoreSelector = NSSelectorFromString(@"isFromAppStore"); - if ([envClass respondsToSelector:isFromAppStoreSelector]) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-performSelector-leaks" - if ([envClass performSelector:isFromAppStoreSelector]) { -#pragma clang diagnostic pop - return defaultAppTypeProd; - } - } - - SEL isAppStoreReceiptSandboxSelector = NSSelectorFromString(@"isAppStoreReceiptSandbox"); - if ([envClass respondsToSelector:isAppStoreReceiptSandboxSelector]) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-performSelector-leaks" - if ([envClass performSelector:isAppStoreReceiptSandboxSelector] && !path.length) { -#pragma clang diagnostic pop - // Distributed via TestFlight - return defaultAppTypeProd; - } - } - - NSMutableData *profileData = [NSMutableData dataWithContentsOfFile:path options:0 error:&error]; - - if (!profileData.length || error) { - NSString *errorString = - [NSString stringWithFormat:@"Error while reading embedded mobileprovision %@", error]; - [self logAPNSConfigurationError:errorString]; - return defaultAppTypeProd; - } - - // The "embedded.mobileprovision" sometimes contains characters with value 0, which signals the - // end of a c-string and halts the ASCII parser, or with value > 127, which violates strict 7-bit - // ASCII. Replace any 0s or invalid characters in the input. - uint8_t *profileBytes = (uint8_t *)profileData.bytes; - for (int i = 0; i < profileData.length; i++) { - uint8_t currentByte = profileBytes[i]; - if (!currentByte || currentByte > 127) { - profileBytes[i] = '.'; - } - } - - NSString *embeddedProfile = [[NSString alloc] initWithBytesNoCopy:profileBytes - length:profileData.length - encoding:NSASCIIStringEncoding - freeWhenDone:NO]; - - if (error || !embeddedProfile.length) { - NSString *errorString = - [NSString stringWithFormat:@"Error while reading embedded mobileprovision %@", error]; - [self logAPNSConfigurationError:errorString]; - return defaultAppTypeProd; - } - - NSScanner *scanner = [NSScanner scannerWithString:embeddedProfile]; - NSString *plistContents; - if ([scanner scanUpToString:@"<plist" intoString:nil]) { - if ([scanner scanUpToString:@"</plist>" intoString:&plistContents]) { - plistContents = [plistContents stringByAppendingString:@"</plist>"]; - } - } - - if (!plistContents.length) { - return defaultAppTypeProd; - } - - NSData *data = [plistContents dataUsingEncoding:NSUTF8StringEncoding]; - if (!data.length) { - [self logAPNSConfigurationError:@"Couldn't read plist fetched from embedded mobileprovision"]; - return defaultAppTypeProd; - } - - NSError *plistMapError; - id plistData = [NSPropertyListSerialization propertyListWithData:data - options:NSPropertyListImmutable - format:nil - error:&plistMapError]; - if (plistMapError || ![plistData isKindOfClass:[NSDictionary class]]) { - NSString *errorString = - [NSString stringWithFormat:@"Error while converting assumed plist to dict %@", - plistMapError.localizedDescription]; - [self logAPNSConfigurationError:errorString]; - return defaultAppTypeProd; - } - NSDictionary *plistMap = (NSDictionary *)plistData; - - if ([plistMap valueForKeyPath:@"ProvisionedDevices"]) { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeInstanceID012, - @"Provisioning profile has specifically provisioned devices, " - @"most likely a Dev profile."); - } - - NSString *apsEnvironment = [plistMap valueForKeyPath:kEntitlementsAPSEnvironmentKey]; - NSString *debugString __unused = - [NSString stringWithFormat:@"APNS Environment in profile: %@", apsEnvironment]; - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeInstanceID013, @"%@", debugString); - - // No aps-environment in the profile. - if (!apsEnvironment.length) { - [self logAPNSConfigurationError:@"No aps-environment set. If testing on a device APNS is not " - @"correctly configured. Please recheck your provisioning " - @"profiles. If testing on a simulator this is fine since APNS " - @"doesn't work on the simulator."]; - return defaultAppTypeProd; - } - - if ([apsEnvironment isEqualToString:kAPSEnvironmentDevelopmentValue]) { - return NO; - } - - return defaultAppTypeProd; -} - -/// Log error messages only when Messaging exists in the pod. -- (void)logAPNSConfigurationError:(NSString *)errorString { - BOOL hasFirebaseMessaging = NSClassFromString(kFIRInstanceIDFCMSDKClassString) != nil; - if (hasFirebaseMessaging) { - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeInstanceID014, @"%@", errorString); - } else { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeInstanceID015, @"%@", errorString); - } -} - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDAPNSInfo.h b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDAPNSInfo.h @@ -1,64 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -NS_ASSUME_NONNULL_BEGIN - -/** - * Represents an APNS device token and whether its environment is for sandbox. - * It can read from and write to an NSDictionary for simple serialization. - */ -@interface FIRInstanceIDAPNSInfo : NSObject <NSCoding> - -/// The APNs device token, provided by the OS to the application delegate -@property(nonatomic, readonly, strong) NSData *deviceToken; -/// Represents whether or not this is deviceToken is for the sandbox -/// environment, or production. -@property(nonatomic, readonly, getter=isSandbox) BOOL sandbox; - -/** - * Initializes the receiver with an APNs device token, and boolean - * representing whether that token is for the sandbox environment. - * - * @param deviceToken The APNs device token typically provided by the - * operating system. - * @param isSandbox YES if the APNs device token is for the sandbox - * environment, or NO if it is for production. - * @return An instance of FIRInstanceIDAPNSInfo. - */ -- (instancetype)initWithDeviceToken:(NSData *)deviceToken isSandbox:(BOOL)isSandbox; - -/** - * Initializes the receiver from a token options dictionary containing data - * within the `kFIRInstanceIDTokenOptionsAPNSKey` and - * `kFIRInstanceIDTokenOptionsAPNSIsSandboxKey` keys. The token should be an - * NSData blob, and the sandbox value should be an NSNumber - * representing a boolean value. - * - * @param dictionary A dictionary containing values under the keys - * `kFIRInstanceIDTokenOptionsAPNSKey` and - * `kFIRInstanceIDTokenOptionsAPNSIsSandboxKey`. - * @return An instance of FIRInstanceIDAPNSInfo, or nil if the - * dictionary data was invalid or missing. - */ -- (nullable instancetype)initWithTokenOptionsDictionary:(NSDictionary *)dictionary; - -- (BOOL)isEqualToAPNSInfo:(FIRInstanceIDAPNSInfo *)otherInfo; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDAPNSInfo.m b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDAPNSInfo.m @@ -1,79 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceIDAPNSInfo.h" - -#import "FIRInstanceIDConstants.h" - -/// The key used to find the APNs device token in an archive. -NSString *const kFIRInstanceIDAPNSInfoTokenKey = @"device_token"; -/// The key used to find the sandbox value in an archive. -NSString *const kFIRInstanceIDAPNSInfoSandboxKey = @"sandbox"; - -@implementation FIRInstanceIDAPNSInfo - -- (instancetype)initWithDeviceToken:(NSData *)deviceToken isSandbox:(BOOL)isSandbox { - self = [super init]; - if (self) { - _deviceToken = [deviceToken copy]; - _sandbox = isSandbox; - } - return self; -} - -- (instancetype)initWithTokenOptionsDictionary:(NSDictionary *)dictionary { - id deviceToken = dictionary[kFIRInstanceIDTokenOptionsAPNSKey]; - if (![deviceToken isKindOfClass:[NSData class]]) { - return nil; - } - - id isSandbox = dictionary[kFIRInstanceIDTokenOptionsAPNSIsSandboxKey]; - if (![isSandbox isKindOfClass:[NSNumber class]]) { - return nil; - } - self = [super init]; - if (self) { - _deviceToken = (NSData *)deviceToken; - _sandbox = ((NSNumber *)isSandbox).boolValue; - } - return self; -} - -#pragma mark - NSCoding - -- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder { - id deviceToken = [aDecoder decodeObjectForKey:kFIRInstanceIDAPNSInfoTokenKey]; - if (![deviceToken isKindOfClass:[NSData class]]) { - return nil; - } - BOOL isSandbox = [aDecoder decodeBoolForKey:kFIRInstanceIDAPNSInfoSandboxKey]; - return [self initWithDeviceToken:(NSData *)deviceToken isSandbox:isSandbox]; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder { - [aCoder encodeObject:self.deviceToken forKey:kFIRInstanceIDAPNSInfoTokenKey]; - [aCoder encodeBool:self.sandbox forKey:kFIRInstanceIDAPNSInfoSandboxKey]; -} - -- (BOOL)isEqualToAPNSInfo:(FIRInstanceIDAPNSInfo *)otherInfo { - if ([super isEqual:otherInfo]) { - return YES; - } - return ([self.deviceToken isEqualToData:otherInfo.deviceToken] && - self.isSandbox == otherInfo.isSandbox); -} - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDAuthKeyChain.h b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDAuthKeyChain.h @@ -1,98 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -extern NSString *__nonnull const kFIRInstanceIDKeychainWildcardIdentifier; - -NS_ASSUME_NONNULL_BEGIN - -/** - * Wrapper around storing FCM auth data in iOS keychain. - */ -@interface FIRInstanceIDAuthKeychain : NSObject - -/** - * Designated Initializer. Init a generic `SecClassGenericPassword` keychain with `identifier` - * as the `kSecAttrGeneric`. - * - * @param identifier The generic attribute to be used by the keychain. - * - * @return A Keychain object with `kSecAttrGeneric` attribute set to identifier. - */ -- (instancetype)initWithIdentifier:(NSString *)identifier; - -/** - * Get keychain items matching the given service and account. The service and/or account - * can be a wildcard (`kFIRInstanceIDKeychainWildcardIdentifier`), which case the query - * will include all items matching any services and/or accounts. - * - * @param service The kSecAttrService used to save the password. Can be wildcard. - * @param account The kSecAttrAccount used to save the password. Can be wildcard. - * - * @return An array of |NSData|s matching the provided inputs. - */ -- (NSArray<NSData *> *)itemsMatchingService:(NSString *)service account:(NSString *)account; - -/** - * Get keychain item for a given service and account. - * - * @param service The kSecAttrService used to save the password. - * @param account The kSecAttrAccount used to save the password. - * - * @return A cached keychain item for a given account and service, or nil if it was not - * found or could not be retrieved. - */ -- (NSData *)dataForService:(NSString *)service account:(NSString *)account; - -/** - * Remove the cached items from the keychain matching the service, account and access group. - * In case the items do not exist, YES is returned but with a valid error object with code - * `errSecItemNotFound`. - * - * @param service The kSecAttrService used to save the password. - * @param account The kSecAttrAccount used to save the password. - * @param handler The callback handler which is invoked when the remove operation is complete, with - * an error if there is any. - */ -- (void)removeItemsMatchingService:(NSString *)service - account:(NSString *)account - handler:(nullable void (^)(NSError *error))handler; - -/** - * Set the data for a given service and account with a specific accessibility. If - * accessibility is NULL we use `kSecAttrAccessibleAlwaysThisDeviceOnly` which - * prevents backup and restore to iCloud, and works for app extension that can - * execute right after a device is restarted (and not unlocked). - * - * @param data The data to save. - * @param service The `kSecAttrService` used to save the password. - * @param accessibility The `kSecAttrAccessibility` used to save the password. If NULL - * set this to `kSecAttrAccessibleAlwaysThisDeviceOnly`. - * @param account The `kSecAttrAccount` used to save the password. - * @param handler The callback handler which is invoked when the add operation is complete, - * with an error if there is any. - * - */ -- (void)setData:(NSData *)data - forService:(NSString *)service - accessibility:(nullable CFTypeRef)accessibility - account:(NSString *)account - handler:(nullable void (^)(NSError *))handler; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDAuthKeyChain.m b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDAuthKeyChain.m @@ -1,219 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceIDAuthKeyChain.h" -#import "FIRInstanceIDKeychain.h" -#import "FIRInstanceIDLogger.h" - -/** - * The error type representing why we couldn't read data from the keychain. - */ -typedef NS_ENUM(int, FIRInstanceIDKeychainErrorType) { - kFIRInstanceIDKeychainErrorBadArguments = -1301, -}; - -NSString *const kFIRInstanceIDKeychainWildcardIdentifier = @"*"; - -@interface FIRInstanceIDAuthKeychain () - -@property(nonatomic, copy) NSString *generic; -// cachedKeychainData is keyed by service and account, the value is an array of NSData. -// It is used to cache the tokens per service, per account, as well as checkin data per service, -// per account inside the keychain. -@property(nonatomic, copy) - NSMutableDictionary<NSString *, NSMutableDictionary<NSString *, NSArray<NSData *> *> *> - *cachedKeychainData; - -@end - -@implementation FIRInstanceIDAuthKeychain - -- (instancetype)initWithIdentifier:(NSString *)identifier { - self = [super init]; - if (self) { - _generic = [identifier copy]; - _cachedKeychainData = [[NSMutableDictionary alloc] init]; - } - return self; -} - -+ (NSMutableDictionary *)keychainQueryForService:(NSString *)service - account:(NSString *)account - generic:(NSString *)generic { - NSDictionary *query = @{(__bridge id)kSecClass : (__bridge id)kSecClassGenericPassword}; - - NSMutableDictionary *finalQuery = [NSMutableDictionary dictionaryWithDictionary:query]; - if ([generic length] && ![kFIRInstanceIDKeychainWildcardIdentifier isEqualToString:generic]) { - finalQuery[(__bridge NSString *)kSecAttrGeneric] = generic; - } - if ([account length] && ![kFIRInstanceIDKeychainWildcardIdentifier isEqualToString:account]) { - finalQuery[(__bridge NSString *)kSecAttrAccount] = account; - } - if ([service length] && ![kFIRInstanceIDKeychainWildcardIdentifier isEqualToString:service]) { - finalQuery[(__bridge NSString *)kSecAttrService] = service; - } - return finalQuery; -} - -- (NSMutableDictionary *)keychainQueryForService:(NSString *)service account:(NSString *)account { - return [[self class] keychainQueryForService:service account:account generic:self.generic]; -} - -- (NSArray<NSData *> *)itemsMatchingService:(NSString *)service account:(NSString *)account { - // If query wildcard service, it asks for all the results, which always query from keychain. - if (![service isEqualToString:kFIRInstanceIDKeychainWildcardIdentifier] && - ![account isEqualToString:kFIRInstanceIDKeychainWildcardIdentifier] && - _cachedKeychainData[service][account]) { - // As long as service, account array exist, even it's empty, it means we've queried it before, - // returns the cache value. - return _cachedKeychainData[service][account]; - } - - NSMutableDictionary *keychainQuery = [self keychainQueryForService:service account:account]; - - NSMutableArray<NSData *> *results; - keychainQuery[(__bridge id)kSecReturnData] = (__bridge id)kCFBooleanTrue; - keychainQuery[(__bridge id)kSecReturnAttributes] = (__bridge id)kCFBooleanTrue; - keychainQuery[(__bridge id)kSecMatchLimit] = (__bridge id)kSecMatchLimitAll; - // FIRInstanceIDKeychain should only take a query and return a result, will handle the query here. - CFArrayRef passwordInfos = [[FIRInstanceIDKeychain sharedInstance] itemWithQuery:keychainQuery]; - - if (!passwordInfos) { - // Nothing was found, simply return from this sync block. - // Make sure to label the cache entry empty, signaling that we've queried this entry. - if ([service isEqualToString:kFIRInstanceIDKeychainWildcardIdentifier] || - [account isEqualToString:kFIRInstanceIDKeychainWildcardIdentifier]) { - // Do not update cache if it's wildcard query. - return @[]; - } else if (_cachedKeychainData[service]) { - [_cachedKeychainData[service] setObject:@[] forKey:account]; - } else { - [_cachedKeychainData setObject:[@{account : @[]} mutableCopy] forKey:service]; - } - return @[]; - } - NSInteger numPasswords = CFArrayGetCount(passwordInfos); - results = [[NSMutableArray alloc] init]; - if (0 < numPasswords) { - for (NSUInteger i = 0; i < numPasswords; i++) { - NSDictionary *passwordInfo = [((__bridge NSArray *)passwordInfos) objectAtIndex:i]; - if (passwordInfo[(__bridge id)kSecValueData]) { - [results addObject:passwordInfo[(__bridge id)kSecValueData]]; - } - } - } - if (passwordInfos != NULL) { - CFRelease(passwordInfos); - } - - // We query the keychain because it didn't exist in cache, now query is done, update the result in - // the cache. - if ([service isEqualToString:kFIRInstanceIDKeychainWildcardIdentifier] || - [account isEqualToString:kFIRInstanceIDKeychainWildcardIdentifier]) { - // Do not update cache if it's wildcard query. - return [results copy]; - } else if (_cachedKeychainData[service]) { - [_cachedKeychainData[service] setObject:[results copy] forKey:account]; - } else { - NSMutableDictionary *entry = [@{account : [results copy]} mutableCopy]; - [_cachedKeychainData setObject:entry forKey:service]; - } - return [results copy]; -} - -- (NSData *)dataForService:(NSString *)service account:(NSString *)account { - NSArray<NSData *> *items = [self itemsMatchingService:service account:account]; - // If items is nil or empty, nil will be returned. - return items.firstObject; -} - -- (void)removeItemsMatchingService:(NSString *)service - account:(NSString *)account - handler:(void (^)(NSError *error))handler { - if ([service isEqualToString:kFIRInstanceIDKeychainWildcardIdentifier]) { - // Delete all keychain items. - _cachedKeychainData = [[NSMutableDictionary alloc] init]; - } else if ([account isEqualToString:kFIRInstanceIDKeychainWildcardIdentifier]) { - // Delete all entries under service, - if (_cachedKeychainData[service]) { - _cachedKeychainData[service] = [[NSMutableDictionary alloc] init]; - } - } else if (_cachedKeychainData[service]) { - // We should keep the service/account entry instead of nil so we know - // it's "empty entry" instead of "not query from keychain yet". - [_cachedKeychainData[service] setObject:@[] forKey:account]; - } else { - [_cachedKeychainData setObject:[@{account : @[]} mutableCopy] forKey:service]; - } - NSMutableDictionary *keychainQuery = [self keychainQueryForService:service account:account]; - [[FIRInstanceIDKeychain sharedInstance] removeItemWithQuery:keychainQuery handler:handler]; -} - -- (void)setData:(NSData *)data - forService:(NSString *)service - accessibility:(CFTypeRef)accessibility - account:(NSString *)account - handler:(void (^)(NSError *))handler { - if ([service isEqualToString:kFIRInstanceIDKeychainWildcardIdentifier] || - [account isEqualToString:kFIRInstanceIDKeychainWildcardIdentifier]) { - if (handler) { - handler([NSError errorWithDomain:kFIRInstanceIDKeychainErrorDomain - code:kFIRInstanceIDKeychainErrorBadArguments - userInfo:nil]); - } - return; - } - [self removeItemsMatchingService:service - account:account - handler:^(NSError *error) { - if (error) { - if (handler) { - handler(error); - } - return; - } - if (data.length > 0) { - NSMutableDictionary *keychainQuery = - [self keychainQueryForService:service account:account]; - keychainQuery[(__bridge id)kSecValueData] = data; - - if (accessibility != NULL) { - keychainQuery[(__bridge id)kSecAttrAccessible] = - (__bridge id)accessibility; - } else { - // Defaults to No backup - keychainQuery[(__bridge id)kSecAttrAccessible] = - (__bridge id)kSecAttrAccessibleAlwaysThisDeviceOnly; - } - [[FIRInstanceIDKeychain sharedInstance] - addItemWithQuery:keychainQuery - handler:handler]; - } - }]; - // Set the cache value. This must happen after removeItemsMatchingService:account:handler was - // called, so the cache value was reset before setting a new value. - if (_cachedKeychainData[service]) { - if (_cachedKeychainData[service][account]) { - _cachedKeychainData[service][account] = @[ data ]; - } else { - [_cachedKeychainData[service] setObject:@[ data ] forKey:account]; - } - } else { - [_cachedKeychainData setObject:[@{account : @[ data ]} mutableCopy] forKey:service]; - } -} - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDAuthService.h b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDAuthService.h @@ -1,91 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> -#import "FIRInstanceIDCheckinService.h" - -@class FIRInstanceIDCheckinPreferences; -@class FIRInstanceIDStore; - -/** - * FIRInstanceIDAuthService is responsible for retrieving, caching, and supplying checkin info - * for the rest of Instance ID. A checkin can be scheduled, meaning that it will keep retrying the - * checkin request until it is successful. A checkin can also be requested directly, with a - * completion handler. - */ -@interface FIRInstanceIDAuthService : NSObject - -/** - * Used only for testing. In addition to taking a store (for locally caching the checkin info), it - * also takes a checkinService. - */ -- (instancetype)initWithCheckinService:(FIRInstanceIDCheckinService *)checkinService - store:(FIRInstanceIDStore *)store; - -/** - * Initializes the auth service given a store (which provides the local caching of checkin info). - * This initializer will create its own instance of FIRInstanceIDCheckinService. - */ -- (instancetype)initWithStore:(FIRInstanceIDStore *)store; - -#pragma mark - Checkin Service - -/** - * Checks if the current deviceID and secret are valid or not. - * - * @return YES if the checkin credentials are valid else NO. - */ -- (BOOL)hasValidCheckinInfo; - -/** - * Fetch checkin info from the server. This would usually refresh the existing - * checkin credentials for the current app. - * - * @param handler The completion handler to invoke once the checkin info has been - * refreshed. - */ -- (void)fetchCheckinInfoWithHandler:(FIRInstanceIDDeviceCheckinCompletion)handler; - -/** - * Schedule checkin. Will hit the network only if the currently loaded checkin - * preferences are stale. - * - * @param immediately YES if we want it to be scheduled immediately else NO. - */ -- (void)scheduleCheckin:(BOOL)immediately; - -/** - * Returns the checkin preferences currently loaded in memory. The Checkin preferences - * can be either valid or invalid. - * - * @return The checkin preferences loaded in memory. - */ -- (FIRInstanceIDCheckinPreferences *)checkinPreferences; - -/** - * Cancels any ongoing checkin fetch, if any. - */ -- (void)stopCheckinRequest; - -/** - * Resets the checkin information. - * - * @param handler The callback handler which is invoked when checkin reset is complete, - * with an error if there is any. - */ -- (void)resetCheckinWithHandler:(void (^)(NSError *error))handler; - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDAuthService.m b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDAuthService.m @@ -1,302 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceIDAuthService.h" - -#import "FIRInstanceIDCheckinPreferences+Internal.h" -#import "FIRInstanceIDCheckinPreferences.h" -#import "FIRInstanceIDCheckinPreferences_Private.h" -#import "FIRInstanceIDConstants.h" -#import "FIRInstanceIDDefines.h" -#import "FIRInstanceIDLogger.h" -#import "FIRInstanceIDStore.h" -#import "NSError+FIRInstanceID.h" - -// Max time interval between checkin retry in seconds. -static const int64_t kMaxCheckinRetryIntervalInSeconds = 1 << 5; - -@interface FIRInstanceIDAuthService () - -// Used to retrieve and cache the checkin info to disk and Keychain. -@property(nonatomic, readwrite, strong) FIRInstanceIDStore *store; -// Used to perform single checkin fetches. -@property(nonatomic, readwrite, strong) FIRInstanceIDCheckinService *checkinService; -// The current checkin info. It will be compared to what is retrieved to determine whether it is -// different than what is in the cache. -@property(nonatomic, readwrite, strong) FIRInstanceIDCheckinPreferences *checkinPreferences; - -// This array will track multiple handlers waiting for checkin to be performed. When a checkin -// request completes, all the handlers will be notified. -// Changes to the checkinHandlers array should happen in a thread-safe manner. -@property(nonatomic, readonly, strong) - NSMutableArray<FIRInstanceIDDeviceCheckinCompletion> *checkinHandlers; - -// This is set to true if there is a checkin request in-flight. -@property(atomic, readwrite, assign) BOOL isCheckinInProgress; -// This timer is used a perform checkin retries. It is cancellable. -@property(atomic, readwrite, strong) NSTimer *scheduledCheckinTimer; -// The number of times checkin has been retried during a scheduled checkin. -@property(atomic, readwrite, assign) int checkinRetryCount; - -@end - -@implementation FIRInstanceIDAuthService - -- (instancetype)initWithCheckinService:(FIRInstanceIDCheckinService *)checkinService - store:(FIRInstanceIDStore *)store { - self = [super init]; - if (self) { - _store = store; - _checkinPreferences = [_store cachedCheckinPreferences]; - _checkinService = checkinService; - _checkinHandlers = [NSMutableArray array]; - } - return self; -} - -- (void)dealloc { - [_scheduledCheckinTimer invalidate]; -} - -- (instancetype)initWithStore:(FIRInstanceIDStore *)store { - FIRInstanceIDCheckinService *checkinService = [[FIRInstanceIDCheckinService alloc] init]; - return [self initWithCheckinService:checkinService store:store]; -} - -#pragma mark - Schedule Checkin - -- (void)scheduleCheckin:(BOOL)immediately { - // Checkin is still valid, so a remote checkin is not required. - if ([self.checkinPreferences hasValidCheckinInfo]) { - return; - } - - // Checkin is already scheduled, so this (non-immediate) request can be ignored. - if (!immediately && [self.scheduledCheckinTimer isValid]) { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeAuthService000, - @"Checkin sync already scheduled. Will not schedule."); - return; - } - - if (immediately) { - [self performScheduledCheckin]; - } else { - int64_t checkinRetryDuration = [self calculateNextCheckinRetryIntervalInSeconds]; - [self startCheckinTimerWithDuration:(NSTimeInterval)checkinRetryDuration]; - } -} - -- (void)startCheckinTimerWithDuration:(NSTimeInterval)timerDuration { - self.scheduledCheckinTimer = - [NSTimer scheduledTimerWithTimeInterval:timerDuration - target:self - selector:@selector(onScheduledCheckinTimerFired:) - userInfo:nil - repeats:NO]; - // Add some tolerance to the timer, to allow iOS to be more flexible with this timer - self.scheduledCheckinTimer.tolerance = 0.5; -} - -- (void)clearScheduledCheckinTimer { - [self.scheduledCheckinTimer invalidate]; - self.scheduledCheckinTimer = nil; -} - -- (void)onScheduledCheckinTimerFired:(NSTimer *)timer { - [self performScheduledCheckin]; -} - -- (void)performScheduledCheckin { - // No checkin scheduled as of now. - [self clearScheduledCheckinTimer]; - - // Checkin is still valid, so a remote checkin is not required. - if ([self.checkinPreferences hasValidCheckinInfo]) { - return; - } - - FIRInstanceID_WEAKIFY(self); - [self - fetchCheckinInfoWithHandler:^(FIRInstanceIDCheckinPreferences *preferences, NSError *error) { - FIRInstanceID_STRONGIFY(self); - self.checkinRetryCount++; - - if (error) { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeAuthService001, @"Checkin error %@.", - error); - - dispatch_async(dispatch_get_main_queue(), ^{ - // Schedule another checkin - [self scheduleCheckin:NO]; - }); - - } else { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeAuthService002, @"Checkin success."); - } - }]; -} - -- (int64_t)calculateNextCheckinRetryIntervalInSeconds { - // persistent failures can lead to overflow prevent that. - if (self.checkinRetryCount >= 10) { - return kMaxCheckinRetryIntervalInSeconds; - } - return MIN(1 << self.checkinRetryCount, kMaxCheckinRetryIntervalInSeconds); -} - -#pragma mark - Checkin Service - -- (BOOL)hasValidCheckinInfo { - return [self.checkinPreferences hasValidCheckinInfo]; -} - -- (void)fetchCheckinInfoWithHandler:(nonnull FIRInstanceIDDeviceCheckinCompletion)handler { - // Perform any changes to self.checkinHandlers and _isCheckinInProgress in a thread-safe way. - @synchronized(self) { - [self.checkinHandlers addObject:handler]; - - if (_isCheckinInProgress) { - // Nothing more to do until our checkin request is done - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeAuthServiceCheckinInProgress, - @"Checkin is in progress\n"); - return; - } - } - - // Checkin is still valid, so a remote checkin is not required. - if ([self.checkinPreferences hasValidCheckinInfo]) { - [self notifyCheckinHandlersWithCheckin:self.checkinPreferences error:nil]; - return; - } - - @synchronized(self) { - _isCheckinInProgress = YES; - } - [self.checkinService - checkinWithExistingCheckin:self.checkinPreferences - completion:^(FIRInstanceIDCheckinPreferences *checkinPreferences, - NSError *error) { - @synchronized(self) { - self->_isCheckinInProgress = NO; - } - if (error) { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeAuthService003, - @"Failed to checkin device %@", error); - [self notifyCheckinHandlersWithCheckin:nil error:error]; - return; - } - - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeAuthService004, - @"Successfully got checkin credentials"); - BOOL hasSameCachedPreferences = - [self cachedCheckinMatchesCheckin:checkinPreferences]; - checkinPreferences.hasPreCachedAuthCredentials = hasSameCachedPreferences; - - // Update to the most recent checkin preferences - self.checkinPreferences = checkinPreferences; - - // Save the checkin info to disk - // Keychain might not be accessible, so confirm that checkin preferences can - // be saved - [self.store - saveCheckinPreferences:checkinPreferences - handler:^(NSError *checkinSaveError) { - if (checkinSaveError && !hasSameCachedPreferences) { - // The checkin info was new, but it couldn't be - // written to the Keychain. Delete any stuff that was - // cached in memory. This doesn't delete any - // previously persisted preferences. - FIRInstanceIDLoggerError( - kFIRInstanceIDMessageCodeService004, - @"Unable to save checkin info, resetting " - @"checkin preferences " - "in memory."); - [checkinPreferences reset]; - [self - notifyCheckinHandlersWithCheckin:nil - error: - checkinSaveError]; - } else { - // The checkin is either new, or it was the same (and - // it couldn't be saved). Either way, report that the - // checkin preferences were received successfully. - [self notifyCheckinHandlersWithCheckin: - checkinPreferences - error:nil]; - if (!hasSameCachedPreferences) { - // Checkin is new. - // Notify any listeners that might be waiting for - // checkin to be fetched, such as Firebase - // Messaging (for its MCS connection). - dispatch_async(dispatch_get_main_queue(), ^{ - [[NSNotificationCenter defaultCenter] - postNotificationName: - kFIRInstanceIDCheckinFetchedNotification - object:nil]; - }); - } - } - }]; - }]; -} - -- (FIRInstanceIDCheckinPreferences *)checkinPreferences { - return _checkinPreferences; -} - -- (void)stopCheckinRequest { - [self.checkinService stopFetching]; -} - -- (void)resetCheckinWithHandler:(void (^)(NSError *error))handler { - [self.store removeCheckinPreferencesWithHandler:^(NSError *error) { - if (!error) { - self.checkinPreferences = nil; - } - if (handler) { - handler(error); - } - }]; -} - -#pragma mark - Private - -/** - * Goes through the current list of checkin handlers and fires them with the same checkin and/or - * error info. The checkin handlers will get cleared after. - */ -- (void)notifyCheckinHandlersWithCheckin:(nullable FIRInstanceIDCheckinPreferences *)checkin - error:(nullable NSError *)error { - @synchronized(self) { - for (FIRInstanceIDDeviceCheckinCompletion handler in self.checkinHandlers) { - handler(checkin, error); - } - [self.checkinHandlers removeAllObjects]; - } -} - -/** - * Given a |checkin|, it will compare it to the current checkinPreferences to see if the - * deviceID and secretToken are the same. - */ -- (BOOL)cachedCheckinMatchesCheckin:(FIRInstanceIDCheckinPreferences *)checkin { - if (self.checkinPreferences && checkin) { - return ([self.checkinPreferences.deviceID isEqualToString:checkin.deviceID] && - [self.checkinPreferences.secretToken isEqualToString:checkin.secretToken]); - } - return NO; -} -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDBackupExcludedPlist.h b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDBackupExcludedPlist.h @@ -1,89 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -@interface FIRInstanceIDBackupExcludedPlist : NSObject - -/** - * Caches the plist contents in memory so we don't hit the disk each time we want - * to query something in the plist. This is loaded lazily i.e. if you write to the - * plist the contents you want to write will be stored here if the write was - * successful. The other case where it is loaded is if you read the plist contents - * by calling `contentAsDictionary`. - * - * In case you write to the plist and then try to read the file using - * `contentAsDictionary` we would just return the cachedPlistContents since it would - * represent the disk contents. - */ -@property(nonatomic, readonly, strong) NSDictionary *cachedPlistContents; - -/** - * Init a backup excluded plist file. - * - * @param fileName The filename for the plist file. - * @param applicationSupportSubDirectory The subdirectory in Application Support to save the plist. - * - * @return Helper which allows to read write data to a backup excluded plist. - */ -- (instancetype)initWithFileName:(NSString *)fileName - applicationSupportSubDirectory:(NSString *)applicationSupportSubDirectory; - -/** - * Write dictionary data to the backup excluded plist file. If the file does not exist - * it would be created before writing to it. - * - * @param dict The data to be written to the plist. - * @param error The error object if any while writing the data. - * - * @return YES if the write was successful else NO. - */ -- (BOOL)writeDictionary:(NSDictionary *)dict error:(NSError **)error; - -/** - * Delete the backup excluded plist created with the above filename. - * - * @param error The error object if any while deleting the file. - * - * @return YES If the delete was successful else NO. - */ -- (BOOL)deleteFile:(NSError **)error; - -/** - * The contents of the plist file. We also store the contents of the file in-memory. - * If the in-memory contents are valid we return the in-memory contents else we read - * the file from disk. - * - * @return A dictionary object that contains the contents of the plist file if the file - * exists else nil. - */ -- (NSDictionary *)contentAsDictionary; - -/** - * Check if the plist exists on the disk or not. - * - * @return YES if the file exists on the disk else NO. - */ -- (BOOL)doesFileExist; - -/** - * Move the plist to Application Support subdirectory. If the plist is already in the correct - * subdirectory this will be a no-op. If the plist was never written to before this will remember - * to write this plist to the Application Support subfolder if it's written to in future. - */ -- (void)moveToApplicationSupportSubDirectory; - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDBackupExcludedPlist.m b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDBackupExcludedPlist.m @@ -1,200 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceIDBackupExcludedPlist.h" - -#import "FIRInstanceIDDefines.h" -#import "FIRInstanceIDLogger.h" - -typedef enum : NSUInteger { - FIRInstanceIDPlistDirectoryUnknown, - FIRInstanceIDPlistDirectoryDocuments, - FIRInstanceIDPlistDirectoryApplicationSupport, -} FIRInstanceIDPlistDirectory; - -@interface FIRInstanceIDBackupExcludedPlist () - -@property(nonatomic, readwrite, copy) NSString *fileName; -@property(nonatomic, readwrite, copy) NSString *applicationSupportSubDirectory; -@property(nonatomic, readwrite, assign) BOOL fileInApplicationSupport; - -@property(nonatomic, readwrite, strong) NSDictionary *cachedPlistContents; - -@end - -@implementation FIRInstanceIDBackupExcludedPlist - -- (instancetype)initWithFileName:(NSString *)fileName - applicationSupportSubDirectory:(NSString *)applicationSupportSubDirectory { - self = [super init]; - if (self) { - _fileName = [fileName copy]; - _applicationSupportSubDirectory = [applicationSupportSubDirectory copy]; - _fileInApplicationSupport = - [self moveToApplicationSupportSubDirectory:applicationSupportSubDirectory]; - } - return self; -} - -- (BOOL)writeDictionary:(NSDictionary *)dict error:(NSError **)error { - NSString *path = [self plistPathInDirectory:[self plistDirectory]]; - if (![dict writeToFile:path atomically:YES]) { - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeBackupExcludedPlist000, - @"Failed to write to %@.plist", self.fileName); - return NO; - } - - // Successfully wrote contents -- change the in-memory contents - self.cachedPlistContents = [dict copy]; - - _FIRInstanceIDDevAssert([[NSFileManager defaultManager] fileExistsAtPath:path], - @"Error writing data to non-backed up plist %@.plist", self.fileName); - - NSURL *URL = [NSURL fileURLWithPath:path]; - if (error) { - *error = nil; - } - - NSDictionary *preferences = [URL resourceValuesForKeys:@[ NSURLIsExcludedFromBackupKey ] - error:error]; - if ([preferences[NSURLIsExcludedFromBackupKey] boolValue]) { - return YES; - } - - BOOL success = [URL setResourceValue:@(YES) forKey:NSURLIsExcludedFromBackupKey error:error]; - if (!success) { - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeBackupExcludedPlist001, - @"Error excluding %@ from backup, %@", [URL lastPathComponent], - error ? *error : @""); - } - return success; -} - -- (BOOL)deleteFile:(NSError **)error { - BOOL success = YES; - NSString *path = [self plistPathInDirectory:[self plistDirectory]]; - if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { - success = [[NSFileManager defaultManager] removeItemAtPath:path error:error]; - } - // remove the in-memory contents - self.cachedPlistContents = nil; - return success; -} - -- (NSDictionary *)contentAsDictionary { - if (!self.cachedPlistContents) { - NSString *path = [self plistPathInDirectory:[self plistDirectory]]; - if ([[NSFileManager defaultManager] fileExistsAtPath:path]) { - self.cachedPlistContents = [[NSDictionary alloc] initWithContentsOfFile:path]; - } - } - return self.cachedPlistContents; -} - -- (void)moveToApplicationSupportSubDirectory { - self.fileInApplicationSupport = - [self moveToApplicationSupportSubDirectory:self.applicationSupportSubDirectory]; -} - -- (BOOL)moveToApplicationSupportSubDirectory:(NSString *)subDirectoryName { - NSArray *directoryPaths = - NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); - NSString *applicationSupportDirPath = directoryPaths.lastObject; - NSArray *components = @[ applicationSupportDirPath, subDirectoryName ]; - NSString *subDirectoryPath = [NSString pathWithComponents:components]; - BOOL hasSubDirectory; - if (![[NSFileManager defaultManager] fileExistsAtPath:subDirectoryPath - isDirectory:&hasSubDirectory]) { - // Cannot move to non-existent directory - return NO; - } - - if ([self doesFileExistInDirectory:FIRInstanceIDPlistDirectoryDocuments]) { - NSString *oldPlistPath = [self plistPathInDirectory:FIRInstanceIDPlistDirectoryDocuments]; - NSString *newPlistPath = - [self plistPathInDirectory:FIRInstanceIDPlistDirectoryApplicationSupport]; - if ([self doesFileExistInDirectory:FIRInstanceIDPlistDirectoryApplicationSupport]) { - // File exists in both Documents and ApplicationSupport - return NO; - } - NSError *moveError; - if (![[NSFileManager defaultManager] moveItemAtPath:oldPlistPath - toPath:newPlistPath - error:&moveError]) { - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeBackupExcludedPlist002, - @"Failed to move file %@ from %@ to %@. Error: %@", self.fileName, - oldPlistPath, newPlistPath, moveError); - return NO; - } - } - // We moved the file if it existed, otherwise we didn't need to do anything - return YES; -} - -- (BOOL)doesFileExist { - return [self doesFileExistInDirectory:[self plistDirectory]]; -} - -#pragma mark - Private - -- (FIRInstanceIDPlistDirectory)plistDirectory { - if (self.fileInApplicationSupport) { - return FIRInstanceIDPlistDirectoryApplicationSupport; - } else { - return FIRInstanceIDPlistDirectoryDocuments; - }; -} - -- (NSString *)plistPathInDirectory:(FIRInstanceIDPlistDirectory)directory { - return [self pathWithName:self.fileName inDirectory:directory]; -} - -- (NSString *)pathWithName:(NSString *)plistName - inDirectory:(FIRInstanceIDPlistDirectory)directory { - NSArray *directoryPaths; - NSArray *components = @[]; - NSString *plistNameWithExtension = [NSString stringWithFormat:@"%@.plist", plistName]; - switch (directory) { - case FIRInstanceIDPlistDirectoryDocuments: - directoryPaths = - NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - components = @[ directoryPaths.lastObject, plistNameWithExtension ]; - break; - - case FIRInstanceIDPlistDirectoryApplicationSupport: - directoryPaths = - NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); - components = @[ - directoryPaths.lastObject, self.applicationSupportSubDirectory, plistNameWithExtension - ]; - break; - - default: - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeBackupExcludedPlistInvalidPlistEnum, - @"Invalid plist directory type: %lu", (unsigned long)directory); - NSAssert(NO, @"Invalid plist directory type: %lu", (unsigned long)directory); - break; - } - - return [NSString pathWithComponents:components]; -} - -- (BOOL)doesFileExistInDirectory:(FIRInstanceIDPlistDirectory)directory { - NSString *path = [self plistPathInDirectory:directory]; - return [[NSFileManager defaultManager] fileExistsAtPath:path]; -} - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinPreferences+Internal.h b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinPreferences+Internal.h @@ -1,64 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceIDCheckinPreferences.h" - -@interface FIRInstanceIDCheckinPreferences (Internal) - -/** - * Parse the checkin auth credentials saved in the Keychain to initialize checkin - * preferences. - * - * @param keychainContent The checkin auth credentials saved in the Keychain. - * - * @return A valid checkin preferences object if the checkin auth credentials in the - * keychain can be parsed successfully else nil. - */ -+ (FIRInstanceIDCheckinPreferences *)preferencesFromKeychainContents:(NSString *)keychainContent; - -/** - * Default initializer for InstanceID checkin preferences. - * - * @param deviceID The deviceID for the app. - * @param secretToken The secret token the app uses to authenticate with the server. - * - * @return A checkin preferences object with given deviceID and secretToken. - */ -- (instancetype)initWithDeviceID:(NSString *)deviceID secretToken:(NSString *)secretToken; - -/** - * Update checkin preferences from the preferences dict persisted as a plist. The dict contains - * all the checkin preferences retrieved from the server except the deviceID and secret which - * are stored in the Keychain. - * - * @param checkinPlistContent The checkin preferences saved in a plist on the disk. - */ -- (void)updateWithCheckinPlistContents:(NSDictionary *)checkinPlistContent; - -/** - * Reset the current checkin preferences object. - */ -- (void)reset; - -/** - * The string that contains the checkin auth credentials i.e. deviceID and secret. This - * needs to be stored in the Keychain. - * - * @return The checkin auth credential string containing the deviceID and secret. - */ -- (NSString *)checkinKeychainContent; - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinPreferences+Internal.m b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinPreferences+Internal.m @@ -1,112 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceIDCheckinPreferences+Internal.h" - -#import "FIRInstanceIDCheckinService.h" -#import "FIRInstanceIDUtilities.h" - -static NSString *const kCheckinKeychainContentSeparatorString = @"|"; - -@interface FIRInstanceIDCheckinPreferences () - -@property(nonatomic, readwrite, copy) NSString *deviceID; -@property(nonatomic, readwrite, copy) NSString *secretToken; -@property(nonatomic, readwrite, copy) NSString *digest; -@property(nonatomic, readwrite, copy) NSString *versionInfo; -@property(nonatomic, readwrite, copy) NSString *deviceDataVersion; - -@property(nonatomic, readwrite, strong) NSMutableDictionary *gServicesData; -@property(nonatomic, readwrite, assign) int64_t lastCheckinTimestampMillis; - -@end - -@implementation FIRInstanceIDCheckinPreferences (Internal) - -+ (FIRInstanceIDCheckinPreferences *)preferencesFromKeychainContents:(NSString *)keychainContent { - NSString *deviceID = [self checkinDeviceIDFromKeychainContent:keychainContent]; - NSString *secret = [self checkinSecretFromKeychainContent:keychainContent]; - if ([deviceID length] && [secret length]) { - return [[FIRInstanceIDCheckinPreferences alloc] initWithDeviceID:deviceID secretToken:secret]; - } else { - return nil; - } -} - -- (instancetype)initWithDeviceID:(NSString *)deviceID secretToken:(NSString *)secretToken { - self = [super init]; - if (self) { - self.deviceID = [deviceID copy]; - self.secretToken = [secretToken copy]; - } - return self; -} - -- (void)reset { - self.deviceID = nil; - self.secretToken = nil; - self.digest = nil; - self.versionInfo = nil; - self.gServicesData = nil; - self.deviceDataVersion = nil; - self.lastCheckinTimestampMillis = 0; -} - -- (void)updateWithCheckinPlistContents:(NSDictionary *)checkinPlistContent { - for (NSString *key in checkinPlistContent) { - if ([kFIRInstanceIDDigestStringKey isEqualToString:key]) { - self.digest = [checkinPlistContent[key] copy]; - } else if ([kFIRInstanceIDVersionInfoStringKey isEqualToString:key]) { - self.versionInfo = [checkinPlistContent[key] copy]; - } else if ([kFIRInstanceIDLastCheckinTimeKey isEqualToString:key]) { - self.lastCheckinTimestampMillis = [checkinPlistContent[key] longLongValue]; - } else if ([kFIRInstanceIDGServicesDictionaryKey isEqualToString:key]) { - self.gServicesData = [checkinPlistContent[key] mutableCopy]; - } else if ([kFIRInstanceIDDeviceDataVersionKey isEqualToString:key]) { - self.deviceDataVersion = [checkinPlistContent[key] copy]; - } - // Otherwise we have some keys we don't care about - } -} - -- (NSString *)checkinKeychainContent { - if ([self.deviceID length] && [self.secretToken length]) { - return [NSString stringWithFormat:@"%@%@%@", self.deviceID, - kCheckinKeychainContentSeparatorString, self.secretToken]; - } else { - return nil; - } -} - -+ (NSString *)checkinDeviceIDFromKeychainContent:(NSString *)keychainContent { - return [self checkinKeychainContent:keychainContent forIndex:0]; -} - -+ (NSString *)checkinSecretFromKeychainContent:(NSString *)keychainContent { - return [self checkinKeychainContent:keychainContent forIndex:1]; -} - -+ (NSString *)checkinKeychainContent:(NSString *)keychainContent forIndex:(int)index { - NSArray *keychainComponents = - [keychainContent componentsSeparatedByString:kCheckinKeychainContentSeparatorString]; - if (index >= 0 && index < 2 && [keychainComponents count] == 2) { - return keychainComponents[index]; - } else { - return nil; - } -} - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinPreferences.h b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinPreferences.h @@ -1,63 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -/** - * The preferences InstanceID loads from checkin server. The deviceID and secret that checkin - * provides is used to authenticate all future requests to the server. Besides the deviceID - * and secret the other information that checkin provides is stored in a plist on the device. - * The deviceID and secret are persisted in the device keychain. - */ -@interface FIRInstanceIDCheckinPreferences : NSObject - -/** - * DeviceID and secretToken are the checkin auth credentials and are stored in the Keychain. - */ -@property(nonatomic, readonly, copy) NSString *deviceID; -@property(nonatomic, readonly, copy) NSString *secretToken; - -/** - * All the other checkin preferences other than deviceID and secret are stored in a plist. - */ -@property(nonatomic, readonly, copy) NSString *deviceDataVersion; -@property(nonatomic, readonly, copy) NSString *digest; -@property(nonatomic, readonly, copy) NSString *versionInfo; -@property(nonatomic, readonly, strong) NSMutableDictionary *gServicesData; -@property(nonatomic, readonly, assign) int64_t lastCheckinTimestampMillis; - -/** - * The content retrieved from checkin server that should be persisted in a plist. This - * doesn't contain the deviceID and secret which are stored in the Keychain since they - * should be more private. - * - * @return The checkin preferences that should be persisted in a plist. - */ -- (NSDictionary *)checkinPlistContents; - -/** - * Return whether checkin info exists, valid or not. - */ -- (BOOL)hasCheckinInfo; - -/** - * Verify if checkin preferences are valid or not. - * - * @return YES if valid checkin preferences else NO. - */ -- (BOOL)hasValidCheckinInfo; - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinPreferences.m b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinPreferences.m @@ -1,97 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceIDCheckinPreferences.h" - -#import <GoogleUtilities/GULUserDefaults.h> -#import "FIRInstanceIDCheckinService.h" -#import "FIRInstanceIDDefines.h" -#import "FIRInstanceIDUtilities.h" - -const NSTimeInterval kFIRInstanceIDDefaultCheckinInterval = 7 * 24 * 60 * 60; // 7 days. - -@interface FIRInstanceIDCheckinPreferences () - -@property(nonatomic, readwrite, copy) NSString *deviceID; -@property(nonatomic, readwrite, copy) NSString *secretToken; -@property(nonatomic, readwrite, copy) NSString *digest; -@property(nonatomic, readwrite, copy) NSString *versionInfo; -@property(nonatomic, readwrite, copy) NSString *deviceDataVersion; - -@property(nonatomic, readwrite, strong) NSMutableDictionary *gServicesData; -@property(nonatomic, readwrite, assign) int64_t lastCheckinTimestampMillis; - -// This flag indicates that we have already saved the above deviceID and secret -// to our keychain and hence we don't need to save again. This is helpful since -// on checkin refresh we can avoid writing to the Keychain which can sometimes -// be very buggy. For info check this https://forums.developer.apple.com/thread/4743 -@property(nonatomic, readwrite, assign) BOOL hasPreCachedAuthCredentials; - -@end - -@implementation FIRInstanceIDCheckinPreferences - -- (NSDictionary *)checkinPlistContents { - NSMutableDictionary *checkinPlistContents = [NSMutableDictionary dictionary]; - checkinPlistContents[kFIRInstanceIDDigestStringKey] = self.digest ?: @""; - checkinPlistContents[kFIRInstanceIDVersionInfoStringKey] = self.versionInfo ?: @""; - checkinPlistContents[kFIRInstanceIDDeviceDataVersionKey] = self.deviceDataVersion ?: @""; - checkinPlistContents[kFIRInstanceIDLastCheckinTimeKey] = @(self.lastCheckinTimestampMillis); - checkinPlistContents[kFIRInstanceIDGServicesDictionaryKey] = - [self.gServicesData count] ? self.gServicesData : @{}; - return checkinPlistContents; -} - -- (BOOL)hasCheckinInfo { - return (self.deviceID.length && self.secretToken.length); -} - -- (BOOL)hasValidCheckinInfo { - int64_t currentTimestampInMillis = FIRInstanceIDCurrentTimestampInMilliseconds(); - int64_t timeSinceLastCheckinInMillis = currentTimestampInMillis - self.lastCheckinTimestampMillis; - _FIRInstanceIDDevAssert(timeSinceLastCheckinInMillis >= 0, - @"FCM error: cannot have last checkin timestamp in future"); - BOOL hasCheckinInfo = [self hasCheckinInfo]; - NSString *lastLocale = - [[GULUserDefaults standardUserDefaults] stringForKey:kFIRInstanceIDUserDefaultsKeyLocale]; - // If it's app's first time open and checkin is already fetched and no locale information is - // stored, then checkin info is valid. We should not checkin again because locale is considered - // "changed". - if (hasCheckinInfo && !lastLocale) { - NSString *currentLocale = FIRInstanceIDCurrentLocale(); - [[GULUserDefaults standardUserDefaults] setObject:currentLocale - forKey:kFIRInstanceIDUserDefaultsKeyLocale]; - return YES; - } - - // If locale has changed, checkin info is no longer valid. - // Also update locale information if changed. (Only do it here not in token refresh) - if (FIRInstanceIDHasLocaleChanged()) { - NSString *currentLocale = FIRInstanceIDCurrentLocale(); - [[GULUserDefaults standardUserDefaults] setObject:currentLocale - forKey:kFIRInstanceIDUserDefaultsKeyLocale]; - return NO; - } - - return (hasCheckinInfo && - (timeSinceLastCheckinInMillis / 1000.0 < kFIRInstanceIDDefaultCheckinInterval)); -} - -- (void)setHasPreCachedAuthCredentials:(BOOL)hasPreCachedAuthCredentials { - _hasPreCachedAuthCredentials = hasPreCachedAuthCredentials; -} - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinPreferences_Private.h b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinPreferences_Private.h @@ -1,27 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceIDCheckinPreferences.h" - -/** Checkin refresh interval. **/ -FOUNDATION_EXPORT const NSTimeInterval kFIRInstanceIDDefaultCheckinInterval; - -@interface FIRInstanceIDCheckinPreferences () - -- (BOOL)hasPreCachedAuthCredentials; -- (void)setHasPreCachedAuthCredentials:(BOOL)hasPreCachedAuthCredentials; - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinService.h b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinService.h @@ -1,81 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -#import "FIRInstanceIDUtilities.h" - -NS_ASSUME_NONNULL_BEGIN - -// keys in Checkin preferences -FOUNDATION_EXPORT NSString *const kFIRInstanceIDDeviceAuthIdKey; -FOUNDATION_EXPORT NSString *const kFIRInstanceIDSecretTokenKey; -FOUNDATION_EXPORT NSString *const kFIRInstanceIDDigestStringKey; -FOUNDATION_EXPORT NSString *const kFIRInstanceIDLastCheckinTimeKey; -FOUNDATION_EXPORT NSString *const kFIRInstanceIDVersionInfoStringKey; -FOUNDATION_EXPORT NSString *const kFIRInstanceIDGServicesDictionaryKey; -FOUNDATION_EXPORT NSString *const kFIRInstanceIDDeviceDataVersionKey; - -@class FIRInstanceIDCheckinPreferences; - -/** - * @related FIRInstanceIDCheckinService - * - * The completion handler invoked once the fetch from Checkin server finishes. - * For successful fetches we returned checkin information by the checkin service - * and `nil` error, else we return the appropriate error object as reported by the - * Checkin Service. - * - * @param checkinPreferences The checkin preferences as fetched from the server. - * @param error The error object which fetching GServices data. - */ -typedef void (^FIRInstanceIDDeviceCheckinCompletion)( - FIRInstanceIDCheckinPreferences *_Nullable checkinPreferences, NSError *_Nullable error); - -/** - * Register the device with Checkin Service and get back the `authID`, `secret - * token` etc. for the client. Checkin results are cached in the - * `FIRInstanceIDCache` and periodically refreshed to prevent them from being stale. - * Each client needs to register with checkin before registering with InstanceID. - */ -@interface FIRInstanceIDCheckinService : NSObject - -/** - * Execute a device checkin request to obtain an deviceID, secret token, - * gService data. - * - * @param existingCheckin An existing checkin preference object, if available. - * @param completion Completion hander called on success or failure of device checkin. - */ -- (void)checkinWithExistingCheckin:(nullable FIRInstanceIDCheckinPreferences *)existingCheckin - completion:(FIRInstanceIDDeviceCheckinCompletion)completion; - -/** - * This would stop any request that the service made to the checkin backend and also - * release any callback handlers that it holds. - */ -- (void)stopFetching; - -/** - * Set test block for mock testing network requests. - * - * @param block The block to invoke as a mock response from the network. - */ -+ (void)setCheckinTestBlock:(nullable FIRInstanceIDURLRequestTestBlock)block; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinService.m b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinService.m @@ -1,223 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceIDCheckinService.h" - -#import "FIRInstanceIDCheckinPreferences+Internal.h" -#import "FIRInstanceIDCheckinPreferences_Private.h" -#import "FIRInstanceIDDefines.h" -#import "FIRInstanceIDLogger.h" -#import "FIRInstanceIDStore.h" -#import "FIRInstanceIDUtilities.h" -#import "NSError+FIRInstanceID.h" - -static NSString *const kDeviceCheckinURL = @"https://device-provisioning.googleapis.com/checkin"; - -// keys in Checkin preferences -NSString *const kFIRInstanceIDDeviceAuthIdKey = @"GMSInstanceIDDeviceAuthIdKey"; -NSString *const kFIRInstanceIDSecretTokenKey = @"GMSInstanceIDSecretTokenKey"; -NSString *const kFIRInstanceIDDigestStringKey = @"GMSInstanceIDDigestKey"; -NSString *const kFIRInstanceIDLastCheckinTimeKey = @"GMSInstanceIDLastCheckinTimestampKey"; -NSString *const kFIRInstanceIDVersionInfoStringKey = @"GMSInstanceIDVersionInfo"; -NSString *const kFIRInstanceIDGServicesDictionaryKey = @"GMSInstanceIDGServicesData"; -NSString *const kFIRInstanceIDDeviceDataVersionKey = @"GMSInstanceIDDeviceDataVersion"; - -static NSUInteger const kCheckinType = 2; // DeviceType IOS in l/w/a/_checkin.proto -static NSUInteger const kCheckinVersion = 2; -static NSUInteger const kFragment = 0; - -static FIRInstanceIDURLRequestTestBlock testBlock; - -@interface FIRInstanceIDCheckinService () - -@property(nonatomic, readwrite, strong) NSURLSession *session; - -@end - -@implementation FIRInstanceIDCheckinService -; - -- (instancetype)init { - self = [super init]; - if (self) { - // Create an URLSession once, even though checkin should happen about once a day - NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration]; - config.timeoutIntervalForResource = 60.0f; // 1 minute - config.allowsCellularAccess = YES; - _session = [NSURLSession sessionWithConfiguration:config]; - _session.sessionDescription = @"com.google.iid-checkin"; - } - return self; -} - -- (void)dealloc { - testBlock = nil; - [self.session invalidateAndCancel]; -} - -- (void)checkinWithExistingCheckin:(FIRInstanceIDCheckinPreferences *)existingCheckin - completion:(FIRInstanceIDDeviceCheckinCompletion)completion { - _FIRInstanceIDDevAssert(completion != nil, @"completion required"); - - NSURL *url = [NSURL URLWithString:kDeviceCheckinURL]; - NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; - [request setValue:@"application/json" forHTTPHeaderField:@"content-type"]; - NSDictionary *checkinParameters = [self checkinParametersWithExistingCheckin:existingCheckin]; - NSData *checkinData = [NSJSONSerialization dataWithJSONObject:checkinParameters - options:0 - error:nil]; - request.HTTPMethod = @"POST"; - request.HTTPBody = checkinData; - - void (^handler)(NSData *, NSURLResponse *, NSError *) = - ^(NSData *data, NSURLResponse *response, NSError *error) { - if (error) { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeService000, - @"Device checkin HTTP fetch error. Error Code: %ld", - (long)error.code); - completion(nil, error); - return; - } - - NSError *serializationError; - NSDictionary *dataResponse = [NSJSONSerialization JSONObjectWithData:data - options:0 - error:&serializationError]; - if (serializationError) { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeService001, - @"Error serializing json object. Error Code: %ld", - _FIRInstanceID_L(serializationError.code)); - completion(nil, serializationError); - return; - } - - NSString *deviceAuthID = [dataResponse[@"android_id"] stringValue]; - NSString *secretToken = [dataResponse[@"security_token"] stringValue]; - if ([deviceAuthID length] == 0) { - NSError *error = - [NSError errorWithFIRInstanceIDErrorCode:kFIRInstanceIDErrorCodeInvalidRequest]; - completion(nil, error); - return; - } - - int64_t lastCheckinTimestampMillis = [dataResponse[@"time_msec"] longLongValue]; - int64_t currentTimestampMillis = FIRInstanceIDCurrentTimestampInMilliseconds(); - // Somehow the server clock gets out of sync with the device clock. - // Reset the last checkin timestamp in case this happens. - if (lastCheckinTimestampMillis > currentTimestampMillis) { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeService002, - @"Invalid last checkin timestamp in future."); - lastCheckinTimestampMillis = currentTimestampMillis; - } - - NSString *deviceDataVersionInfo = dataResponse[@"device_data_version_info"] ?: @""; - NSString *digest = dataResponse[@"digest"] ?: @""; - - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeService003, - @"Checkin successful with authId: %@, " - @"digest: %@, " - @"lastCheckinTimestamp: %lld", - deviceAuthID, digest, lastCheckinTimestampMillis); - - NSString *versionInfo = dataResponse[@"version_info"] ?: @""; - NSMutableDictionary *gservicesData = [NSMutableDictionary dictionary]; - - // Read gServices data. - NSArray *flatSettings = dataResponse[@"setting"]; - for (NSDictionary *dict in flatSettings) { - if (dict[@"name"] && dict[@"value"]) { - gservicesData[dict[@"name"]] = dict[@"value"]; - } else { - _FIRInstanceIDDevAssert(NO, @"Invalid setting in checkin response: (%@: %@)", - dict[@"name"], dict[@"value"]); - } - } - - FIRInstanceIDCheckinPreferences *checkinPreferences = - [[FIRInstanceIDCheckinPreferences alloc] initWithDeviceID:deviceAuthID - secretToken:secretToken]; - NSDictionary *preferences = @{ - kFIRInstanceIDDigestStringKey : digest, - kFIRInstanceIDVersionInfoStringKey : versionInfo, - kFIRInstanceIDLastCheckinTimeKey : @(lastCheckinTimestampMillis), - kFIRInstanceIDGServicesDictionaryKey : gservicesData, - kFIRInstanceIDDeviceDataVersionKey : deviceDataVersionInfo, - }; - [checkinPreferences updateWithCheckinPlistContents:preferences]; - completion(checkinPreferences, nil); - }; - // Test block - if (testBlock) { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeService005, - @"Test block set, will not hit the server"); - testBlock(request, handler); - return; - } - - NSURLSessionDataTask *task = [self.session dataTaskWithRequest:request completionHandler:handler]; - [task resume]; -} - -- (void)stopFetching { - [self.session invalidateAndCancel]; -} - -#pragma mark - Private - -- (NSDictionary *)checkinParametersWithExistingCheckin: - (nullable FIRInstanceIDCheckinPreferences *)checkinPreferences { - NSString *deviceModel = FIRInstanceIDDeviceModel(); - NSString *systemVersion = FIRInstanceIDOperatingSystemVersion(); - NSString *osVersion = [NSString stringWithFormat:@"IOS_%@", systemVersion]; - - // Get locale from GCM if GCM exists else use system API. - NSString *locale = FIRInstanceIDCurrentLocale(); - - NSInteger userNumber = 0; // Multi Profile may change this. - NSInteger userSerialNumber = 0; // Multi Profile may change this - - uint32_t loggingID = arc4random(); - NSString *timeZone = [NSTimeZone localTimeZone].name; - int64_t lastCheckingTimestampMillis = checkinPreferences.lastCheckinTimestampMillis; - - NSDictionary *checkinParameters = @{ - @"checkin" : @{ - @"iosbuild" : @{@"model" : deviceModel, @"os_version" : osVersion}, - @"type" : @(kCheckinType), - @"user_number" : @(userNumber), - @"last_checkin_msec" : @(lastCheckingTimestampMillis), - }, - @"fragment" : @(kFragment), - @"logging_id" : @(loggingID), - @"locale" : locale, - @"version" : @(kCheckinVersion), - @"digest" : checkinPreferences.digest ?: @"", - @"timezone" : timeZone, - @"user_serial_number" : @(userSerialNumber), - @"id" : @([checkinPreferences.deviceID longLongValue]), - @"security_token" : @([checkinPreferences.secretToken longLongValue]), - }; - - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeService006, @"Checkin parameters: %@", - checkinParameters); - return checkinParameters; -} - -+ (void)setCheckinTestBlock:(FIRInstanceIDURLRequestTestBlock)block { - testBlock = [block copy]; -} - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinStore.h b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinStore.h @@ -1,108 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -@class FIRInstanceIDAuthKeychain; -@class FIRInstanceIDBackupExcludedPlist; -@class FIRInstanceIDCheckinPreferences; - -// These values exposed for testing -extern NSString *const kFIRInstanceIDCheckinKeychainService; -extern NSString *const kFIRInstanceIDLegacyCheckinKeychainAccount; -extern NSString *const kFIRInstanceIDLegacyCheckinKeychainService; - -/** - * Checkin preferences backing store. - */ -@interface FIRInstanceIDCheckinStore : NSObject - -/** - * Designated Initializer. Initialize a checkin store with the given backup excluded - * plist filename. - * - * @param checkinFilename The backup excluded plist filename to persist checkin - * preferences. - * - * @param applicationSupportSubDirectory Sub-directory in Application support where we write - * InstanceID plist. - * - * @return Store to persist checkin preferences. - */ -- (instancetype)initWithCheckinPlistFileName:(NSString *)checkinFilename - applicationSupportSubDirectory:(NSString *)applicationSupportSubDirectory; - -/** - * Initialize a checkin store with the given backup excluded plist and keychain. - * - * @param plist The backup excluded plist to persist checkin preferences. - * @param keychain The keychain used to persist checkin auth preferences. - * - * @return Store to persist checkin preferences. - */ -- (instancetype)initWithCheckinPlist:(FIRInstanceIDBackupExcludedPlist *)plist - keychain:(FIRInstanceIDAuthKeychain *)keychain; - -/** - * Checks whether the backup excluded checkin preferences are present on the disk or not. - * - * @return YES if the backup excluded checkin plist exists on the disks else NO. - */ -- (BOOL)hasCheckinPlist; - -#pragma mark - Save - -/** - * Save the checkin preferences to backing store. - * - * @param preferences Checkin preferences to save. - * @param handler The callback handler which is invoked when the operation is complete, - * with an error if there is any. - */ -- (void)saveCheckinPreferences:(FIRInstanceIDCheckinPreferences *)preferences - handler:(void (^)(NSError *error))handler; - -#pragma mark - Delete - -/** - * Remove the cached checkin preferences. - * - * @param handler The callback handler which is invoked when the operation is complete, - * with an error if there is any. - */ -- (void)removeCheckinPreferencesWithHandler:(void (^)(NSError *error))handler; - -#pragma mark - Get - -/** - * Get the cached device secret. If we cannot access it for some reason we - * return the appropriate error object. - * - * @return The cached checkin preferences if present else nil. - */ -- (FIRInstanceIDCheckinPreferences *)cachedCheckinPreferences; - -/** - * Migrate the checkin item from old service/account to the new one. - * The new account is dynamic as it uses bundle ID. - * This is to ensure checkin is not shared across apps, but still the same - * if app has used GCM before. - * This call should only happen once. - * - */ -- (void)migrateCheckinItemIfNeeded; - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinStore.m b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDCheckinStore.m @@ -1,239 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceIDCheckinStore.h" - -#import "FIRInstanceIDAuthKeyChain.h" -#import "FIRInstanceIDBackupExcludedPlist.h" -#import "FIRInstanceIDCheckinPreferences+Internal.h" -#import "FIRInstanceIDCheckinPreferences_Private.h" -#import "FIRInstanceIDCheckinService.h" -#import "FIRInstanceIDLogger.h" -#import "FIRInstanceIDUtilities.h" -#import "FIRInstanceIDVersionUtilities.h" -#import "NSError+FIRInstanceID.h" - -static NSString *const kFIRInstanceIDCheckinKeychainGeneric = @"com.google.iid"; - -NSString *const kFIRInstanceIDCheckinKeychainService = @"com.google.iid.checkin"; -NSString *const kFIRInstanceIDLegacyCheckinKeychainAccount = @"com.google.iid.checkin-account"; -NSString *const kFIRInstanceIDLegacyCheckinKeychainService = @"com.google.iid.checkin-service"; - -// Checkin plist used to have the deviceID and secret stored in them and that's why they -// had 6 items in it. Since the deviceID and secret have been moved to the keychain -// there would only be 4 items. -static const NSInteger kOldCheckinPlistCount = 6; - -@interface FIRInstanceIDCheckinStore () - -@property(nonatomic, readwrite, strong) FIRInstanceIDBackupExcludedPlist *plist; -@property(nonatomic, readwrite, strong) FIRInstanceIDAuthKeychain *keychain; -// Checkin will store items under -// Keychain account: <app bundle id>, -// Keychain service: |kFIRInstanceIDCheckinKeychainService| -@property(nonatomic, readonly) NSString *bundleIdentifierForKeychainAccount; - -@end - -@implementation FIRInstanceIDCheckinStore - -- (instancetype)initWithCheckinPlistFileName:(NSString *)checkinFilename - applicationSupportSubDirectory:(NSString *)applicationSupportSubDirectory { - FIRInstanceIDBackupExcludedPlist *plist = - [[FIRInstanceIDBackupExcludedPlist alloc] initWithFileName:checkinFilename - applicationSupportSubDirectory:applicationSupportSubDirectory]; - - FIRInstanceIDAuthKeychain *keychain = - [[FIRInstanceIDAuthKeychain alloc] initWithIdentifier:kFIRInstanceIDCheckinKeychainGeneric]; - return [self initWithCheckinPlist:plist keychain:keychain]; -} - -- (instancetype)initWithCheckinPlist:(FIRInstanceIDBackupExcludedPlist *)plist - keychain:(FIRInstanceIDAuthKeychain *)keychain { - self = [super init]; - if (self) { - _plist = plist; - _keychain = keychain; - } - return self; -} - -- (BOOL)hasCheckinPlist { - return [self.plist doesFileExist]; -} - -- (NSString *)bundleIdentifierForKeychainAccount { - static NSString *bundleIdentifier; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - bundleIdentifier = FIRInstanceIDAppIdentifier(); - }); - return bundleIdentifier; -} - -- (void)saveCheckinPreferences:(FIRInstanceIDCheckinPreferences *)preferences - handler:(void (^)(NSError *error))handler { - NSDictionary *checkinPlistContents = [preferences checkinPlistContents]; - NSString *checkinKeychainContent = [preferences checkinKeychainContent]; - - if (![checkinKeychainContent length]) { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeCheckinStore000, - @"Failed to get checkin keychain content from memory."); - if (handler) { - handler([NSError - errorWithFIRInstanceIDErrorCode:kFIRInstanceIDErrorCodeRegistrarFailedToCheckIn]); - } - return; - } - if (![checkinPlistContents count]) { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeCheckinStore001, - @"Failed to get checkin plist contents from memory."); - if (handler) { - handler([NSError - errorWithFIRInstanceIDErrorCode:kFIRInstanceIDErrorCodeRegistrarFailedToCheckIn]); - } - return; - } - - // Save the deviceID and secret in the Keychain - __block BOOL shouldContinue = YES; - if (!preferences.hasPreCachedAuthCredentials) { - NSData *data = [checkinKeychainContent dataUsingEncoding:NSUTF8StringEncoding]; - [self.keychain setData:data - forService:kFIRInstanceIDCheckinKeychainService - accessibility:nil - account:self.bundleIdentifierForKeychainAccount - handler:^(NSError *error) { - if (error) { - if (handler) { - handler(error); - } - shouldContinue = NO; - return; - } - }]; - } - if (!shouldContinue) { - return; - } - - // Save all other checkin preferences in a plist - NSError *error; - if (![self.plist writeDictionary:checkinPlistContents error:&error]) { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeCheckinStore003, - @"Failed to save checkin plist contents." - @"Will delete auth credentials"); - [self.keychain removeItemsMatchingService:kFIRInstanceIDCheckinKeychainService - account:self.bundleIdentifierForKeychainAccount - handler:nil]; - if (handler) { - handler(error); - } - return; - } - handler(nil); -} - -- (void)removeCheckinPreferencesWithHandler:(void (^)(NSError *error))handler { - // Remove deviceID and secret from Keychain - [self.keychain - removeItemsMatchingService:kFIRInstanceIDCheckinKeychainService - account:self.bundleIdentifierForKeychainAccount - handler:^(NSError *error) { - if (error) { - if (handler) { - handler(error); - } - return; - } - // Delete the checkin preferences plist - NSError *deletePlistError; - [self.plist deleteFile:&deletePlistError]; - - // Try to remove from old location as well because migration - // is no longer needed. Consider this is either a fresh install - // or an identity wipe. - [self.keychain - removeItemsMatchingService:kFIRInstanceIDLegacyCheckinKeychainService - account:kFIRInstanceIDLegacyCheckinKeychainAccount - handler:nil]; - handler(deletePlistError); - }]; -} - -- (FIRInstanceIDCheckinPreferences *)cachedCheckinPreferences { - // Query the keychain for deviceID and secret - NSData *item = [self.keychain dataForService:kFIRInstanceIDCheckinKeychainService - account:self.bundleIdentifierForKeychainAccount]; - - // Check info found in keychain - NSString *checkinKeychainContent = [[NSString alloc] initWithData:item - encoding:NSUTF8StringEncoding]; - FIRInstanceIDCheckinPreferences *checkinPreferences = - [FIRInstanceIDCheckinPreferences preferencesFromKeychainContents:checkinKeychainContent]; - - NSDictionary *checkinPlistContents = [self.plist contentAsDictionary]; - - NSString *plistDeviceAuthID = checkinPlistContents[kFIRInstanceIDDeviceAuthIdKey]; - NSString *plistSecretToken = checkinPlistContents[kFIRInstanceIDSecretTokenKey]; - - // If deviceID and secret not found in the keychain verify that we don't have them in the - // checkin preferences plist. - if (![checkinPreferences.deviceID length] && ![checkinPreferences.secretToken length]) { - if ([plistDeviceAuthID length] && [plistSecretToken length]) { - // Couldn't find checkin credentials in keychain but found them in the plist. - checkinPreferences = - [[FIRInstanceIDCheckinPreferences alloc] initWithDeviceID:plistDeviceAuthID - secretToken:plistSecretToken]; - } else { - // Couldn't find checkin credentials in keychain nor plist - return nil; - } - } else if (kOldCheckinPlistCount == checkinPlistContents.count) { - // same check as above but just to be extra sure that we cover all upgrade cases properly. - // TODO(chliangGoogle): Remove this case, after verifying it's not needed - if ([plistDeviceAuthID length] && [plistSecretToken length]) { - checkinPreferences = - [[FIRInstanceIDCheckinPreferences alloc] initWithDeviceID:plistDeviceAuthID - secretToken:plistSecretToken]; - } - } - - [checkinPreferences updateWithCheckinPlistContents:checkinPlistContents]; - return checkinPreferences; -} - -- (void)migrateCheckinItemIfNeeded { - // Check for checkin in the old location, using the legacy keys - // Query the keychain for deviceID and secret - NSData *dataInOldLocation = - [self.keychain dataForService:kFIRInstanceIDLegacyCheckinKeychainService - account:kFIRInstanceIDLegacyCheckinKeychainAccount]; - if (dataInOldLocation) { - // Save to new location - [self.keychain setData:dataInOldLocation - forService:kFIRInstanceIDCheckinKeychainService - accessibility:NULL - account:self.bundleIdentifierForKeychainAccount - handler:nil]; - // Remove from old location - [self.keychain removeItemsMatchingService:kFIRInstanceIDLegacyCheckinKeychainService - account:kFIRInstanceIDLegacyCheckinKeychainAccount - handler:nil]; - } -} - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDConstants.h b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDConstants.h @@ -1,63 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -#pragma mark - Commands - -/** - * Value included in a structured response or GCM message from IID, indicating - * an identity reset. - */ -FOUNDATION_EXPORT NSString *const kFIRInstanceID_CMD_RST; - -#pragma mark - Notifications - -/// Notification used to deliver GCM messages for InstanceID. -FOUNDATION_EXPORT NSString *const kFIRInstanceIDCheckinFetchedNotification; -FOUNDATION_EXPORT NSString *const kFIRInstanceIDAPNSTokenNotification; -FOUNDATION_EXPORT NSString *const kFIRInstanceIDDefaultGCMTokenNotification; -FOUNDATION_EXPORT NSString *const kFIRInstanceIDDefaultGCMTokenFailNotification; - -FOUNDATION_EXPORT NSString *const kFIRInstanceIDIdentityInvalidatedNotification; - -#pragma mark - Miscellaneous - -/// The scope used to save the IID "*" scope token. This is used for saving the -/// IID auth token that we receive from the server. This feature was never -/// implemented on the server side. -FOUNDATION_EXPORT NSString *const kFIRInstanceIDAllScopeIdentifier; -/// The scope used to save the IID "*" scope token. -FOUNDATION_EXPORT NSString *const kFIRInstanceIDDefaultTokenScope; - -/// Subdirectory in Application Support directory to store InstanceID preferences. -FOUNDATION_EXPORT NSString *const kFIRInstanceIDApplicationSupportSubDirectory; - -/// The key for APNS token in options dictionary. -FOUNDATION_EXPORT NSString *const kFIRInstanceIDTokenOptionsAPNSKey; - -/// The key for APNS token environment type in options dictionary. -FOUNDATION_EXPORT NSString *const kFIRInstanceIDTokenOptionsAPNSIsSandboxKey; - -/// The key for GMP AppID sent in registration requests. -FOUNDATION_EXPORT NSString *const kFIRInstanceIDTokenOptionsFirebaseAppIDKey; - -/// The key to enable auto-register by swizzling AppDelegate's methods. -FOUNDATION_EXPORT NSString *const kFIRInstanceIDAppDelegateProxyEnabledInfoPlistKey; - -/// Error code for missing entitlements in Keychain. iOS Keychain error -/// https://forums.developer.apple.com/thread/4743 -FOUNDATION_EXPORT const int kFIRInstanceIDSecMissingEntitlementErrorCode; diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDConstants.m b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDConstants.m @@ -1,46 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceIDConstants.h" - -// Commands -NSString *const kFIRInstanceID_CMD_RST = @"RST"; - -// NOTIFICATIONS -NSString *const kFIRInstanceIDCheckinFetchedNotification = @"com.google.gcm.notif-checkin-fetched"; -NSString *const kFIRInstanceIDAPNSTokenNotification = @"com.firebase.iid.notif.apns-token"; -NSString *const kFIRInstanceIDDefaultGCMTokenNotification = @"com.firebase.iid.notif.fcm-token"; -NSString *const kFIRInstanceIDDefaultGCMTokenFailNotification = - @"com.firebase.iid.notif.fcm-token-fail"; - -NSString *const kFIRInstanceIDIdentityInvalidatedNotification = @"com.google.iid.identity-invalid"; - -// Miscellaneous -NSString *const kFIRInstanceIDAllScopeIdentifier = @"iid-all"; -NSString *const kFIRInstanceIDDefaultTokenScope = @"*"; -NSString *const kFIRInstanceIDApplicationSupportSubDirectory = @"Google/FirebaseInstanceID"; - -// Registration Options -NSString *const kFIRInstanceIDTokenOptionsAPNSKey = @"apns_token"; -NSString *const kFIRInstanceIDTokenOptionsAPNSIsSandboxKey = @"apns_sandbox"; -NSString *const kFIRInstanceIDTokenOptionsFirebaseAppIDKey = @"gmp_app_id"; - -NSString *const kFIRInstanceIDAppDelegateProxyEnabledInfoPlistKey = - @"FirebaseAppDelegateProxyEnabled"; - -// iOS Keychain error https://forums.developer.apple.com/thread/4743 -// An undocumented error code hence need to be redeclared. -const int kFIRInstanceIDSecMissingEntitlementErrorCode = -34018; diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDDefines.h b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDDefines.h @@ -1,70 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef FIRInstanceIDLib_FIRInstanceIDDefines_h -#define FIRInstanceIDLib_FIRInstanceIDDefines_h - -#define _FIRInstanceID_VERBOSE_LOGGING 1 - -// Verbose Logging -#if (_FIRInstanceID_VERBOSE_LOGGING) -#define FIRInstanceID_DEV_VERBOSE_LOG(...) NSLog(__VA_ARGS__) -#else -#define FIRInstanceID_DEV_VERBOSE_LOG(...) \ - do { \ - } while (0) -#endif // VERBOSE_LOGGING - -// WEAKIFY & STRONGIFY -// Helper macro. -#define _FIRInstanceID_WEAKNAME(VAR) VAR##_weak_ - -#define FIRInstanceID_WEAKIFY(VAR) __weak __typeof__(VAR) _FIRInstanceID_WEAKNAME(VAR) = (VAR); - -#define FIRInstanceID_STRONGIFY(VAR) \ - _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wshadow\"") \ - __strong __typeof__(VAR) VAR = _FIRInstanceID_WEAKNAME(VAR); \ - _Pragma("clang diagnostic pop") - -// Type Conversions (used for NSInteger etc) -#ifndef _FIRInstanceID_L -#define _FIRInstanceID_L(v) (long)(v) -#endif - -#endif - -// Debug Assert -#ifndef _FIRInstanceIDDevAssert -// we directly invoke the NSAssert handler so we can pass on the varargs -// (NSAssert doesn't have a macro we can use that takes varargs) -#if !defined(NS_BLOCK_ASSERTIONS) -#define _FIRInstanceIDDevAssert(condition, ...) \ - do { \ - if (!(condition)) { \ - [[NSAssertionHandler currentHandler] \ - handleFailureInFunction:(NSString *)[NSString stringWithUTF8String:__PRETTY_FUNCTION__] \ - file:(NSString *)[NSString stringWithUTF8String:__FILE__] \ - lineNumber:__LINE__ \ - description:__VA_ARGS__]; \ - } \ - } while (0) -#else // !defined(NS_BLOCK_ASSERTIONS) -#define _FIRInstanceIDDevAssert(condition, ...) \ - do { \ - } while (0) -#endif // !defined(NS_BLOCK_ASSERTIONS) - -#endif // _FIRInstanceIDDevAssert diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeyPair.h b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeyPair.h @@ -1,78 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -@interface FIRInstanceIDKeyPair : NSObject - -- (instancetype)init __attribute__(( - unavailable("Use -initWithPrivateKey:publicKey:publicKeyData:privateKeyData: instead."))); -; - -/** - * Initialize a new 2048 bit RSA keypair. This also stores the keypair in the Keychain - * Preferences. - * - * @param publicKey The publicKey stored in Keychain. - * @param privateKey The privateKey stored in Keychain. - * @param publicKeyData The publicKey in NSData format. - * @param privateKeyData The privateKey in NSData format. - * - * @return A new KeyPair instance with the generated public and private key. - */ -- (instancetype)initWithPrivateKey:(SecKeyRef)privateKey - publicKey:(SecKeyRef)publicKey - publicKeyData:(NSData *)publicKeyData - privateKeyData:(NSData *)privateKeyData NS_DESIGNATED_INITIALIZER; - -/** - * The public key in the RSA 20148 bit generated KeyPair. - * - * @return The 2048 bit RSA KeyPair's public key. - */ -@property(nonatomic, readonly, strong) NSData *publicKeyData; - -/** - * The private key in the RSA 20148 bit generated KeyPair. - * - * @return The 2048 bit RSA KeyPair's private key. - */ -@property(nonatomic, readonly, strong) NSData *privateKeyData; - -#pragma mark - Info - -/** - * Checks if the private and public keyPair are valid or not. - * - * @return YES if keypair is valid else NO. - */ -- (BOOL)isValid; - -/** - * The public key in the RSA 2048 bit generated KeyPair. - * - * @return The 2048 bit RSA KeyPair's public key. - */ -- (SecKeyRef)publicKey; - -/** - * The private key in the RSA 2048 bit generated KeyPair. - * - * @return The 2048 bit RSA KeyPair's private key. - */ -- (SecKeyRef)privateKey; - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeyPair.m b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeyPair.m @@ -1,73 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceIDKeyPair.h" - -#import <Security/Security.h> - -#import "FIRInstanceIDKeyPairUtilities.h" -#import "FIRInstanceIDKeychain.h" -#import "FIRInstanceIDLogger.h" -#import "NSError+FIRInstanceID.h" - -@interface FIRInstanceIDKeyPair () { - SecKeyRef _privateKey; - SecKeyRef _publicKey; -} - -@property(nonatomic, readwrite, strong) NSData *publicKeyData; -@property(nonatomic, readwrite, strong) NSData *privateKeyData; -@end - -@implementation FIRInstanceIDKeyPair -- (instancetype)initWithPrivateKey:(SecKeyRef)privateKey - publicKey:(SecKeyRef)publicKey - publicKeyData:(NSData *)publicKeyData - privateKeyData:(NSData *)privateKeyData { - self = [super init]; - if (self) { - _privateKey = privateKey; - _publicKey = publicKey; - _publicKeyData = publicKeyData; - _privateKeyData = privateKeyData; - } - return self; -} - -- (void)dealloc { - if (_privateKey) { - CFRelease(_privateKey); - } - if (_publicKey) { - CFRelease(_publicKey); - } -} - -#pragma mark - Info - -- (BOOL)isValid { - return _privateKey != NULL && _publicKey != NULL; -} - -- (SecKeyRef)publicKey { - return _publicKey; -} - -- (SecKeyRef)privateKey { - return _privateKey; -} - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeyPairStore.h b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeyPairStore.h @@ -1,85 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -@class FIRInstanceIDKeyPair; - -extern NSString *const kFIRInstanceIDKeyPairSubType; - -@class FIRInstanceIDKeyPairStore; - -@interface FIRInstanceIDKeyPairStore : NSObject - -/** - * Invalidates the cached keypairs in the Keychain, if needed. The keypair metadata plist is - * checked for existence. If the plist file does not exist, it is a signal of a new installation, - * and therefore the key pairs are not valid. - * - * Returns YES if keypair has been invalidated. - */ -- (BOOL)invalidateKeyPairsIfNeeded; - -/** - * Delete the cached RSA keypair from Keychain with the given subtype. - * - * @param subtype The subtype used to cache the RSA keypair in Keychain. - * @param handler The callback handler which is invoked when the keypair deletion is - * complete, with an error if there is any. - */ -- (void)deleteSavedKeyPairWithSubtype:(NSString *)subtype handler:(void (^)(NSError *))handler; - -/** - * Delete the plist that caches KeyPair generation timestamps. - * - * @param error The error if any while deleting the plist else nil. - * - * @return YES if the delete was successful else NO. - */ -- (BOOL)removeKeyPairCreationTimePlistWithError:(NSError **)error; - -/** - * Loads a cached KeyPair if it exists in the Keychain else generate a new - * one. If a keyPair already exists in memory this will just return that. This should - * not be called from the main thread since it could potentially lead to creating a new - * RSA-2048 bit keyPair which is an expensive operation. - * - * @param error The error, if any, while accessing the Keychain. - * - * @return A valid 2048 bit RSA key pair. - */ -- (FIRInstanceIDKeyPair *)loadKeyPairWithError:(NSError **)error; - -/** - * Check if the Keychain has any cached keypairs or not. - * - * @return YES if the Keychain has cached RSA KeyPairs else NO. - */ -- (BOOL)hasCachedKeyPairs; - -/** - * Return an identifier for the app instance. The result is a short identifier that can - * be used as a key when storing information about the app. This method will return the same - * ID as long as the application identity remains active. If the identity has been revoked or - * expired the method will generate and return a new identifier. - * - * @param error The error if any while loading the RSA KeyPair. - * - * @return The identifier, as url safe string. - */ -- (NSString *)appIdentityWithError:(NSError *__autoreleasing *)error; - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeyPairStore.m b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeyPairStore.m @@ -1,526 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceIDKeyPairStore.h" - -#import "FIRInstanceIDBackupExcludedPlist.h" -#import "FIRInstanceIDConstants.h" -#import "FIRInstanceIDDefines.h" -#import "FIRInstanceIDKeyPair.h" -#import "FIRInstanceIDKeyPairUtilities.h" -#import "FIRInstanceIDKeychain.h" -#import "FIRInstanceIDLogger.h" -#import "FIRInstanceIDUtilities.h" -#import "NSError+FIRInstanceID.h" - -// NOTE: These values should be in sync with what InstanceID saves in as. -static NSString *const kFIRInstanceIDKeyPairStoreFileName = @"com.google.iid-keypair"; - -static NSString *const kFIRInstanceIDStoreKeyGenerationTime = @"cre"; - -static NSString *const kFIRInstanceIDStoreKeyPrefix = @"com.google.iid-"; -static NSString *const kFIRInstanceIDStoreKeyPublic = @"|P|"; -static NSString *const kFIRInstanceIDStoreKeyPrivate = @"|K|"; -static NSString *const kFIRInstanceIDStoreKeySubtype = @"|S|"; - -static NSString *const kFIRInstanceIDKeyPairPublicTagPrefix = @"com.google.iid.keypair.public-"; -static NSString *const kFIRInstanceIDKeyPairPrivateTagPrefix = @"com.google.iid.keypair.private-"; - -static const int kMaxMissingEntitlementErrorCount = 3; - -NSString *const kFIRInstanceIDKeyPairSubType = @""; - -// Query the key with NSData format -NSData *FIRInstanceIDKeyDataWithTag(NSString *tag) { - _FIRInstanceIDDevAssert([tag length], @"Invalid tag for keychain specified"); - if (![tag length]) { - return NULL; - } - NSDictionary *queryKey = FIRInstanceIDKeyPairQuery(tag, YES, YES); - CFTypeRef result = [[FIRInstanceIDKeychain sharedInstance] itemWithQuery:queryKey]; - if (!result) { - return NULL; - } - return (__bridge NSData *)result; -} - -// Query the key given a tag -SecKeyRef FIRInstanceIDCachedKeyRefWithTag(NSString *tag) { - _FIRInstanceIDDevAssert([tag length], @"Invalid tag for keychain specified"); - if (![tag length]) { - return NULL; - } - NSDictionary *queryKey = FIRInstanceIDKeyPairQuery(tag, YES, NO); - CFTypeRef result = [[FIRInstanceIDKeychain sharedInstance] itemWithQuery:queryKey]; - return (SecKeyRef)result; -} - -// Check if keypair has been migrated from the legacy to the new version -BOOL FIRInstanceIDHasMigratedKeyPair(NSString *legacyPublicKeyTag, NSString *newPublicKeyTag) { - NSData *oldPublicKeyData = FIRInstanceIDKeyDataWithTag(legacyPublicKeyTag); - NSData *newPublicKeyData = FIRInstanceIDKeyDataWithTag(newPublicKeyTag); - return [oldPublicKeyData isEqualToData:newPublicKeyData]; -} - -// The legacy value is hardcoded to be the same key. This is a potential problem in shared keychain -// environments. -NSString *FIRInstanceIDLegacyPublicTagWithSubtype(NSString *subtype) { - NSString *prefix = kFIRInstanceIDStoreKeyPrefix; - return [NSString stringWithFormat:@"%@%@%@", prefix, subtype, kFIRInstanceIDStoreKeyPublic]; -} - -// The legacy value is hardcoded to be the same key. This is a potential problem in shared keychain -// environments. -NSString *FIRInstanceIDLegacyPrivateTagWithSubtype(NSString *subtype) { - NSString *prefix = kFIRInstanceIDStoreKeyPrefix; - return [NSString stringWithFormat:@"%@%@%@", prefix, subtype, kFIRInstanceIDStoreKeyPrivate]; -} - -NSString *FIRInstanceIDPublicTagWithSubtype(NSString *subtype) { - static NSString *publicTag; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - NSString *mainAppBundleID = FIRInstanceIDAppIdentifier(); - publicTag = - [NSString stringWithFormat:@"%@%@", kFIRInstanceIDKeyPairPublicTagPrefix, mainAppBundleID]; - }); - return publicTag; -} - -NSString *FIRInstanceIDPrivateTagWithSubtype(NSString *subtype) { - static NSString *privateTag; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - NSString *mainAppBundleID = FIRInstanceIDAppIdentifier(); - privateTag = - [NSString stringWithFormat:@"%@%@", kFIRInstanceIDKeyPairPrivateTagPrefix, mainAppBundleID]; - }); - return privateTag; -} - -NSString *FIRInstanceIDCreationTimeKeyWithSubtype(NSString *subtype) { - return [NSString stringWithFormat:@"%@%@%@", subtype, kFIRInstanceIDStoreKeySubtype, - kFIRInstanceIDStoreKeyGenerationTime]; -} - -@interface FIRInstanceIDKeyPairStore () - -@property(nonatomic, readwrite, strong) FIRInstanceIDBackupExcludedPlist *plist; -@property(nonatomic, readwrite, strong) FIRInstanceIDKeyPair *keyPair; -@property(nonatomic, readwrite, assign) NSInteger keychainEntitlementsErrorCount; - -@end - -@implementation FIRInstanceIDKeyPairStore - -- (instancetype)init { - self = [super init]; - if (self) { - NSString *fileName = [[self class] keyStoreFileName]; - _plist = [[FIRInstanceIDBackupExcludedPlist alloc] - initWithFileName:fileName - applicationSupportSubDirectory:kFIRInstanceIDApplicationSupportSubDirectory]; - } - return self; -} - -- (BOOL)invalidateKeyPairsIfNeeded { - // Currently keypairs are always invalidated if self.plist is missing. This normally indicates - // a fresh install (or an uninstall/reinstall). In those situations the key pairs should be - // deleted. - // NOTE: Although this class refers to multiple key pairs, with different subtypes, in practice - // only a single subtype is currently supported. (b/64906549) - if (![self.plist doesFileExist]) { - // A fresh install, clear all the key pairs in the key chain. Do not perform migration as all - // key pairs are gone. - [self deleteSavedKeyPairWithSubtype:kFIRInstanceIDKeyPairSubType handler:nil]; - return YES; - } - // Not a fresh install, perform migration at early state. - [self migrateKeyPairCacheIfNeededWithHandler:nil]; - return NO; -} - -- (BOOL)hasCachedKeyPairs { - NSError *error; - if ([self cachedKeyPairWithSubtype:kFIRInstanceIDKeyPairSubType error:&error] == nil) { - if (error) { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeKeyPairStore000, - @"Failed to get cached keyPair %@", error); - } - error = nil; - [self removeKeyPairCreationTimePlistWithError:&error]; - if (error) { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeKeyPairStore001, - @"Failed to remove keyPair creationTime plist %@", error); - } - return NO; - } - return YES; -} - -- (NSString *)appIdentityWithError:(NSError *__autoreleasing *)error { - // Load the keyPair from Keychain (or generate a key pair, if this is the first run of the app). - FIRInstanceIDKeyPair *keyPair = [self loadKeyPairWithError:error]; - if (!keyPair) { - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeKeyPairStoreCouldNotLoadKeyPair, - @"Keypair could not be loaded from Keychain. Error: %@", (*error)); - return nil; - } - - if (error) { - *error = nil; - } - NSString *appIdentity = FIRInstanceIDAppIdentity(keyPair); - if (!appIdentity.length) { - if (error) { - *error = [NSError errorWithFIRInstanceIDErrorCode:kFIRInstanceIDErrorCodeUnknown]; - } - } - return appIdentity; -} - -- (FIRInstanceIDKeyPair *)loadKeyPairWithError:(NSError **)error { - // In case we call this from different threads we don't want to generate or fetch the - // keyPair multiple times. Once we have a keyPair in the cache it would mostly be used - // from there. - @synchronized(self) { - if ([self.keyPair isValid]) { - return self.keyPair; - } - - if (self.keychainEntitlementsErrorCount >= kMaxMissingEntitlementErrorCount) { - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeKeyPairStore002, - @"Keychain not accessible, Entitlements missing error (-34018). " - @"Will not check token in cache."); - return nil; - } - - if (!self.keyPair) { - self.keyPair = [self validCachedKeyPairWithSubtype:kFIRInstanceIDKeyPairSubType error:error]; - } - - if ((*error).code == kFIRInstanceIDSecMissingEntitlementErrorCode) { - self.keychainEntitlementsErrorCount++; - } - - if (!self.keyPair) { - self.keyPair = [self generateAndSaveKeyWithSubtype:kFIRInstanceIDKeyPairSubType - creationTime:FIRInstanceIDCurrentTimestampInSeconds() - error:error]; - } - } - return self.keyPair; -} - -// TODO(chliangGoogle: Remove subtype support, as it's not being used. -- (FIRInstanceIDKeyPair *)generateAndSaveKeyWithSubtype:(NSString *)subtype - creationTime:(int64_t)creationTime - error:(NSError **)error { - NSString *publicKeyTag = FIRInstanceIDPublicTagWithSubtype(subtype); - NSString *privateKeyTag = FIRInstanceIDPrivateTagWithSubtype(subtype); - FIRInstanceIDKeyPair *keyPair = - [[FIRInstanceIDKeychain sharedInstance] generateKeyPairWithPrivateTag:privateKeyTag - publicTag:publicKeyTag]; - - if (![keyPair isValid]) { - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeKeyPairStore003, - @"Unable to generate keypair."); - return nil; - } - - NSString *creationTimeKey = FIRInstanceIDCreationTimeKeyWithSubtype(subtype); - NSDictionary *keyPairData = @{creationTimeKey : @(creationTime)}; - - if (error) { - *error = nil; - } - NSMutableDictionary *allKeyPairs = [[self.plist contentAsDictionary] mutableCopy]; - if (allKeyPairs.count) { - [allKeyPairs addEntriesFromDictionary:keyPairData]; - } else { - allKeyPairs = [keyPairData mutableCopy]; - } - if (![self.plist writeDictionary:allKeyPairs error:error]) { - [FIRInstanceIDKeyPairStore deleteKeyPairWithPrivateTag:privateKeyTag - publicTag:publicKeyTag - handler:nil]; - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeKeyPairStore004, - @"Failed to save keypair data to plist %@", error ? *error : @""); - return nil; - } - - return keyPair; -} - -- (FIRInstanceIDKeyPair *)validCachedKeyPairWithSubtype:(NSString *)subtype - error:(NSError **)error { - // On a new install (or if the ID was deleted), the plist will be missing, which should trigger - // a reset of the key pairs in Keychain (if they exist). - NSDictionary *allKeyPairs = [self.plist contentAsDictionary]; - NSString *creationTimeKey = FIRInstanceIDCreationTimeKeyWithSubtype(subtype); - - if (allKeyPairs[creationTimeKey] > 0) { - return [self cachedKeyPairWithSubtype:subtype error:error]; - } else { - // There is no need to reset keypair again here as FIRInstanceID init call is always - // going to be ahead of this call, which already trigger keypair reset if it's new install - FIRInstanceIDErrorCode code = kFIRInstanceIDErrorCodeInvalidKeyPairCreationTime; - *error = [NSError errorWithFIRInstanceIDErrorCode:code]; - return nil; - } -} - -- (FIRInstanceIDKeyPair *)cachedKeyPairWithSubtype:(NSString *)subtype - error:(NSError *__autoreleasing *)error { - // base64 encoded keys - NSString *publicKeyTag = FIRInstanceIDPublicTagWithSubtype(subtype); - NSString *privateKeyTag = FIRInstanceIDPrivateTagWithSubtype(subtype); - return [FIRInstanceIDKeyPairStore keyPairForPrivateKeyTag:privateKeyTag - publicKeyTag:publicKeyTag - error:error]; -} - -+ (FIRInstanceIDKeyPair *)keyPairForPrivateKeyTag:(NSString *)privateKeyTag - publicKeyTag:(NSString *)publicKeyTag - error:(NSError *__autoreleasing *)error { - _FIRInstanceIDDevAssert([privateKeyTag length] && [publicKeyTag length], - @"Invalid tags for keypair"); - if (![privateKeyTag length] || ![publicKeyTag length]) { - if (error) { - *error = [NSError errorWithFIRInstanceIDErrorCode:kFIRInstanceIDErrorCodeInvalidKeyPairTags]; - } - return nil; - } - - SecKeyRef privateKeyRef = FIRInstanceIDCachedKeyRefWithTag(privateKeyTag); - SecKeyRef publicKeyRef = FIRInstanceIDCachedKeyRefWithTag(publicKeyTag); - - if (!privateKeyRef || !publicKeyRef) { - if (error) { - *error = [NSError errorWithFIRInstanceIDErrorCode:kFIRInstanceIDErrorCodeMissingKeyPair]; - } - FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeKeyPair000, - @"No keypair info is retrieved with tag %@", privateKeyTag); - return nil; - } - - NSData *publicKeyData = FIRInstanceIDKeyDataWithTag(publicKeyTag); - NSData *privateKeyData = FIRInstanceIDKeyDataWithTag(privateKeyTag); - - FIRInstanceIDKeyPair *keyPair = [[FIRInstanceIDKeyPair alloc] initWithPrivateKey:privateKeyRef - publicKey:publicKeyRef - publicKeyData:publicKeyData - privateKeyData:privateKeyData]; - return keyPair; -} - -// Migrates from keypair saved under legacy keys (hardcoded value) to dynamic keys (stable, but -// unique for the app's bundle id -- (void)migrateKeyPairCacheIfNeededWithHandler:(void (^)(NSError *error))handler { - // Attempt to load keypair using legacy keys - NSString *legacyPublicKeyTag = - FIRInstanceIDLegacyPublicTagWithSubtype(kFIRInstanceIDKeyPairSubType); - NSString *legacyPrivateKeyTag = - FIRInstanceIDLegacyPrivateTagWithSubtype(kFIRInstanceIDKeyPairSubType); - NSError *error; - FIRInstanceIDKeyPair *keyPair = - [FIRInstanceIDKeyPairStore keyPairForPrivateKeyTag:legacyPrivateKeyTag - publicKeyTag:legacyPublicKeyTag - error:&error]; - if (![keyPair isValid]) { - if (handler) { - handler(nil); - } - return; - } - - // Check whether migration already done. - NSString *publicKeyTag = FIRInstanceIDPublicTagWithSubtype(kFIRInstanceIDKeyPairSubType); - if (FIRInstanceIDHasMigratedKeyPair(legacyPublicKeyTag, publicKeyTag)) { - if (handler) { - handler(nil); - } - return; - } - - // Also cache locally since we are sure to use the migrated key pair. - self.keyPair = keyPair; - - // Either new key pair doesn't exist or it's different than legacy key pair, start the migration. - NSString *privateKeyTag = FIRInstanceIDPrivateTagWithSubtype(kFIRInstanceIDKeyPairSubType); - [self updateKeyRef:keyPair.publicKey - withTag:publicKeyTag - handler:^(NSError *error) { - if (error) { - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeKeyPairMigrationError, - @"Unable to migrate key pair from legacy ones."); - } - [self updateKeyRef:keyPair.privateKey - withTag:privateKeyTag - handler:^(NSError *error) { - if (error) { - FIRInstanceIDLoggerError( - kFIRInstanceIDMessageCodeKeyPairMigrationError, - @"Unable to migrate key pair from legacy ones."); - return; - } - FIRInstanceIDLoggerDebug( - kFIRInstanceIDMessageCodeKeyPairMigrationSuccess, - @"Successfully migrated the key pair from legacy ones."); - if (handler) { - handler(error); - } - }]; - }]; -} - -// Used for migrating from legacy tags to updated tags. The legacy keychain is not deleted for -// backward compatibility. -// TODO(chliangGoogle) Delete the legacy keychain when GCM is fully deprecated. -- (void)updateKeyRef:(SecKeyRef)keyRef - withTag:(NSString *)tag - handler:(void (^)(NSError *error))handler { - NSData *updatedTagData = [tag dataUsingEncoding:NSUTF8StringEncoding]; - - // Always delete the old keychain before adding a new one to avoid conflicts. - NSDictionary *deleteQuery = @{ - (__bridge id)kSecAttrApplicationTag : updatedTagData, - (__bridge id)kSecClass : (__bridge id)kSecClassKey, - (__bridge id)kSecAttrKeyType : (__bridge id)kSecAttrKeyTypeRSA, - (__bridge id)kSecReturnRef : @(YES), - }; - - [[FIRInstanceIDKeychain sharedInstance] - removeItemWithQuery:deleteQuery - handler:^(NSError *error) { - if (error) { - if (handler) { - handler(error); - } - return; - } - NSDictionary *addQuery = @{ - (__bridge id)kSecAttrApplicationTag : updatedTagData, - (__bridge id)kSecClass : (__bridge id)kSecClassKey, - (__bridge id)kSecValueRef : (__bridge id)keyRef, - (__bridge id) - kSecAttrAccessible : (__bridge id)kSecAttrAccessibleAlwaysThisDeviceOnly, - }; - [[FIRInstanceIDKeychain sharedInstance] addItemWithQuery:addQuery - handler:^(NSError *addError) { - if (handler) { - handler(addError); - } - }]; - }]; -} - -- (void)deleteSavedKeyPairWithSubtype:(NSString *)subtype - handler:(void (^)(NSError *error))handler { - NSDictionary *allKeyPairs = [self.plist contentAsDictionary]; - - NSString *publicKeyTag = FIRInstanceIDPublicTagWithSubtype(subtype); - NSString *privateKeyTag = FIRInstanceIDPrivateTagWithSubtype(subtype); - NSString *creationTimeKey = FIRInstanceIDCreationTimeKeyWithSubtype(subtype); - - // remove the creation time - if (allKeyPairs[creationTimeKey] > 0) { - NSMutableDictionary *newKeyPairs = [NSMutableDictionary dictionaryWithDictionary:allKeyPairs]; - [newKeyPairs removeObjectForKey:creationTimeKey]; - - NSError *plistError; - if (![self.plist writeDictionary:newKeyPairs error:&plistError]) { - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeKeyPairStore006, - @"Unable to remove keypair creation time from plist %@", plistError); - } - } - - [FIRInstanceIDKeyPairStore - deleteKeyPairWithPrivateTag:privateKeyTag - publicTag:publicKeyTag - handler:^(NSError *error) { - // Delete legacy key pairs from GCM/FCM If they exist. All key pairs - // should be deleted when app is newly installed. - NSString *legacyPublicKeyTag = - FIRInstanceIDLegacyPublicTagWithSubtype(subtype); - NSString *legacyPrivateKeyTag = - FIRInstanceIDLegacyPrivateTagWithSubtype(subtype); - [FIRInstanceIDKeyPairStore - deleteKeyPairWithPrivateTag:legacyPrivateKeyTag - publicTag:legacyPublicKeyTag - handler:nil]; - if (error) { - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeKeyPairStore007, - @"Unable to remove RSA keypair, error: %@", - error); - if (handler) { - handler(error); - } - } else { - self.keyPair = nil; - if (handler) { - handler(nil); - } - } - }]; -} - -+ (void)deleteKeyPairWithPrivateTag:(NSString *)privateTag - publicTag:(NSString *)publicTag - handler:(void (^)(NSError *))handler { - NSDictionary *queryPublicKey = FIRInstanceIDKeyPairQuery(publicTag, NO, NO); - NSDictionary *queryPrivateKey = FIRInstanceIDKeyPairQuery(privateTag, NO, NO); - - // Always remove public key first because it is the key we generate IID. - [[FIRInstanceIDKeychain sharedInstance] removeItemWithQuery:queryPublicKey - handler:^(NSError *error) { - if (error) { - if (handler) { - handler(error); - } - return; - } - [[FIRInstanceIDKeychain sharedInstance] - removeItemWithQuery:queryPrivateKey - handler:^(NSError *error) { - if (error) { - if (handler) { - handler(error); - } - return; - } - if (handler) { - handler(nil); - } - }]; - }]; -} - -- (BOOL)removeKeyPairCreationTimePlistWithError:(NSError *__autoreleasing *)error { - if (![self.plist deleteFile:error]) { - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeKeyPairStore008, - @"Unable to delete keypair creation times plist"); - return NO; - } - return YES; -} - -+ (NSString *)keyStoreFileName { - return kFIRInstanceIDKeyPairStoreFileName; -} - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeyPairUtilities.h b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeyPairUtilities.h @@ -1,36 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -@class FIRInstanceIDKeyPair; - -/** - * A web-safe base64 encoded string with no padding. - * - * @param data The data to encode. - * - * @return A web-safe base 64 encoded string with no padding. - */ -FOUNDATION_EXPORT NSString *FIRInstanceIDWebSafeBase64(NSData *data); - -FOUNDATION_EXPORT NSData *FIRInstanceIDSHA1(NSData *data); - -FOUNDATION_EXPORT NSDictionary *FIRInstanceIDKeyPairQuery(NSString *tag, - BOOL addReturnAttr, - BOOL returnData); - -FOUNDATION_EXPORT NSString *FIRInstanceIDAppIdentity(FIRInstanceIDKeyPair *keyPair); diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeyPairUtilities.m b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeyPairUtilities.m @@ -1,84 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceIDKeyPairUtilities.h" - -#import <CommonCrypto/CommonDigest.h> - -#import "FIRInstanceIDDefines.h" -#import "FIRInstanceIDKeyPair.h" -#import "FIRInstanceIDLogger.h" -#import "FIRInstanceIDStringEncoding.h" - -NSString *FIRInstanceIDWebSafeBase64(NSData *data) { - // Websafe encoding with no padding. - FIRInstanceIDStringEncoding *encoding = - [FIRInstanceIDStringEncoding rfc4648Base64WebsafeStringEncoding]; - [encoding setDoPad:NO]; - return [encoding encode:data]; -} - -NSData *FIRInstanceIDSHA1(NSData *data) { - unsigned int outputLength = CC_SHA1_DIGEST_LENGTH; - unsigned char output[outputLength]; - unsigned int length = (unsigned int)[data length]; - - CC_SHA1(data.bytes, length, output); - return [NSMutableData dataWithBytes:output length:outputLength]; -} - -NSDictionary *FIRInstanceIDKeyPairQuery(NSString *tag, BOOL addReturnAttr, BOOL returnData) { - NSMutableDictionary *queryKey = [NSMutableDictionary dictionary]; - NSData *tagData = [tag dataUsingEncoding:NSUTF8StringEncoding]; - - queryKey[(__bridge id)kSecClass] = (__bridge id)kSecClassKey; - queryKey[(__bridge id)kSecAttrApplicationTag] = tagData; - queryKey[(__bridge id)kSecAttrKeyType] = (__bridge id)kSecAttrKeyTypeRSA; - if (addReturnAttr) { - if (returnData) { - queryKey[(__bridge id)kSecReturnData] = @(YES); - } else { - queryKey[(__bridge id)kSecReturnRef] = @(YES); - } - } - return queryKey; -} - -NSString *FIRInstanceIDAppIdentity(FIRInstanceIDKeyPair *keyPair) { - // An Instance-ID is a 64 bit (8 byte) integer with a fixed 4-bit header of 0111 (=^ 0x7). - // The variable 60 bits are obtained by truncating the SHA1 of the app-instance's public key. - SecKeyRef publicKeyRef = [keyPair publicKey]; - if (!publicKeyRef) { - FIRInstanceIDLoggerError(kFIRInstanceIDMessageCodeKeyPair002, - @"Unable to create a valid asymmetric crypto key"); - return nil; - } - NSData *publicKeyData = keyPair.publicKeyData; - NSData *publicKeySHA1 = FIRInstanceIDSHA1(publicKeyData); - - const uint8_t *bytes = publicKeySHA1.bytes; - NSMutableData *identityData = [NSMutableData dataWithData:publicKeySHA1]; - - uint8_t b0 = bytes[0]; - // Take the first byte and make the initial four 7 by initially making the initial 4 bits 0 - // and then adding 0x70 to it. - b0 = 0x70 + (0xF & b0); - // failsafe should give you back b0 itself - b0 = (b0 & 0xFF); - [identityData replaceBytesInRange:NSMakeRange(0, 1) withBytes:&b0]; - NSData *data = [identityData subdataWithRange:NSMakeRange(0, 8 * sizeof(Byte))]; - return FIRInstanceIDWebSafeBase64(data); -} diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeychain.h b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeychain.h @@ -1,76 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import <Foundation/Foundation.h> - -/* The Keychain error domain */ -extern NSString *const kFIRInstanceIDKeychainErrorDomain; - -@class FIRInstanceIDKeyPair; - -/* - * Wrapping the keychain operations in a serialize queue. This is to avoid keychain operation - * blocking main queue. - */ -@interface FIRInstanceIDKeychain : NSObject - -/** - * FIRInstanceIDKeychain. - * - * @return A shared instance of FIRInstanceIDKeychain. - */ -+ (instancetype)sharedInstance; - -/** - * Get keychain items matching the given a query. - * - * @param keychainQuery The keychain query. - * - * @return An CFTypeRef result matching the provided inputs. - */ -- (CFTypeRef)itemWithQuery:(NSDictionary *)keychainQuery; - -/** - * Remove the cached items from the keychain matching the query. - * - * @param keychainQuery The keychain query. - * @param handler The callback handler which is invoked when the remove operation is - * complete, with an error if there is any. - */ -- (void)removeItemWithQuery:(NSDictionary *)keychainQuery handler:(void (^)(NSError *error))handler; - -/** - * Add the item with a given query. - * - * @param keychainQuery The keychain query. - * @param handler The callback handler which is invoked when the add operation is - * complete, with an error if there is any. - */ -- (void)addItemWithQuery:(NSDictionary *)keychainQuery handler:(void (^)(NSError *))handler; - -#pragma mark - Keypair -/** - * Generate a public/private key pair given their tags. - * - * @param privateTag The private tag associated with the private key. - * @param publicTag The public tag associated with the public key. - * - * @return A new FIRInstanceIDKeyPair object. - */ -- (FIRInstanceIDKeyPair *)generateKeyPairWithPrivateTag:(NSString *)privateTag - publicTag:(NSString *)publicTag; - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeychain.m b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDKeychain.m @@ -1,175 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceIDKeychain.h" - -#import "FIRInstanceIDKeyPair.h" -#import "FIRInstanceIDKeyPairUtilities.h" -#import "FIRInstanceIDLogger.h" - -NSString *const kFIRInstanceIDKeychainErrorDomain = @"com.google.iid"; - -static const NSUInteger kRSA2048KeyPairSize = 2048; - -@interface FIRInstanceIDKeychain () { - dispatch_queue_t _keychainOperationQueue; -} - -@end - -@implementation FIRInstanceIDKeychain - -+ (instancetype)sharedInstance { - static FIRInstanceIDKeychain *sharedInstance; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - sharedInstance = [[FIRInstanceIDKeychain alloc] init]; - }); - return sharedInstance; -} - -- (instancetype)init { - self = [super init]; - if (self) { - _keychainOperationQueue = - dispatch_queue_create("com.google.FirebaseInstanceID.Keychain", DISPATCH_QUEUE_SERIAL); - } - return self; -} - -- (CFTypeRef)itemWithQuery:(NSDictionary *)keychainQuery { - __block SecKeyRef keyRef = NULL; - dispatch_sync(_keychainOperationQueue, ^{ - OSStatus status = - SecItemCopyMatching((__bridge CFDictionaryRef)keychainQuery, (CFTypeRef *)&keyRef); - - if (status != noErr) { - if (keyRef) { - CFRelease(keyRef); - } - FIRInstanceIDLoggerDebug( - kFIRInstanceIDKeychainReadItemError, - @"No info is retrieved from Keychain OSStatus: %d with the keychain query %@", - (int)status, keychainQuery); - } - }); - return keyRef; -} - -- (void)removeItemWithQuery:(NSDictionary *)keychainQuery - handler:(void (^)(NSError *error))handler { - dispatch_async(_keychainOperationQueue, ^{ - OSStatus status = SecItemDelete((__bridge CFDictionaryRef)keychainQuery); - if (status != noErr) { - FIRInstanceIDLoggerDebug( - kFIRInstanceIDKeychainDeleteItemError, - @"Couldn't delete item from Keychain OSStatus: %d with the keychain query %@", - (int)status, keychainQuery); - } - - if (handler) { - NSError *error; - // When item is not found, it should NOT be considered as an error. The operation should - // continue. - if (status != noErr && status != errSecItemNotFound) { - error = [NSError errorWithDomain:kFIRInstanceIDKeychainErrorDomain - code:status - userInfo:nil]; - } - dispatch_async(dispatch_get_main_queue(), ^{ - handler(error); - }); - } - }); -} - -- (void)addItemWithQuery:(NSDictionary *)keychainQuery handler:(void (^)(NSError *))handler { - dispatch_async(_keychainOperationQueue, ^{ - OSStatus status = SecItemAdd((__bridge CFDictionaryRef)keychainQuery, NULL); - - if (handler) { - NSError *error; - if (status != noErr) { - FIRInstanceIDLoggerWarning(kFIRInstanceIDKeychainAddItemError, - @"Couldn't add item to Keychain OSStatus: %d", (int)status); - error = [NSError errorWithDomain:kFIRInstanceIDKeychainErrorDomain - code:status - userInfo:nil]; - } - dispatch_async(dispatch_get_main_queue(), ^{ - handler(error); - }); - } - }); -} - -- (FIRInstanceIDKeyPair *)generateKeyPairWithPrivateTag:(NSString *)privateTag - publicTag:(NSString *)publicTag { - // TODO(chliangGoogle) this is called by appInstanceID, which is an internal API used by other - // Firebase teams, will see if we can make it async. - NSData *publicTagData = [publicTag dataUsingEncoding:NSUTF8StringEncoding]; - NSData *privateTagData = [privateTag dataUsingEncoding:NSUTF8StringEncoding]; - - NSDictionary *privateKeyAttr = @{ - (__bridge id)kSecAttrIsPermanent : @YES, - (__bridge id)kSecAttrApplicationTag : privateTagData, - (__bridge id)kSecAttrLabel : @"Firebase InstanceID Key Pair Private Key", - (__bridge id)kSecAttrAccessible : (__bridge id)kSecAttrAccessibleAlwaysThisDeviceOnly, - }; - - NSDictionary *publicKeyAttr = @{ - (__bridge id)kSecAttrIsPermanent : @YES, - (__bridge id)kSecAttrApplicationTag : publicTagData, - (__bridge id)kSecAttrLabel : @"Firebase InstanceID Key Pair Public Key", - (__bridge id)kSecAttrAccessible : (__bridge id)kSecAttrAccessibleAlwaysThisDeviceOnly, - }; - - NSDictionary *keyPairAttributes = @{ - (__bridge id)kSecAttrKeyType : (__bridge id)kSecAttrKeyTypeRSA, - (__bridge id)kSecAttrLabel : @"Firebase InstanceID Key Pair", - (__bridge id)kSecAttrKeySizeInBits : @(kRSA2048KeyPairSize), - (__bridge id)kSecPrivateKeyAttrs : privateKeyAttr, - (__bridge id)kSecPublicKeyAttrs : publicKeyAttr, - }; - - __block SecKeyRef privateKey = NULL; - __block SecKeyRef publicKey = NULL; - dispatch_sync(_keychainOperationQueue, ^{ - // SecKeyGeneratePair does not allow you to set kSetAttrAccessible on the keys. We need the keys - // to be accessible even when the device is locked (i.e. app is woken up during a push - // notification, or some background refresh). - OSStatus status = - SecKeyGeneratePair((__bridge CFDictionaryRef)keyPairAttributes, &publicKey, &privateKey); - if (status != noErr || publicKey == NULL || privateKey == NULL) { - FIRInstanceIDLoggerWarning(kFIRInstanceIDKeychainCreateKeyPairError, - @"Couldn't create keypair from Keychain OSStatus: %d", - (int)status); - } - }); - // Extract the actual public and private key data from the Keychain - NSDictionary *publicKeyDataQuery = FIRInstanceIDKeyPairQuery(publicTag, YES, YES); - NSDictionary *privateKeyDataQuery = FIRInstanceIDKeyPairQuery(privateTag, YES, YES); - - NSData *publicKeyData = (__bridge NSData *)[self itemWithQuery:publicKeyDataQuery]; - NSData *privateKeyData = (__bridge NSData *)[self itemWithQuery:privateKeyDataQuery]; - - return [[FIRInstanceIDKeyPair alloc] initWithPrivateKey:privateKey - publicKey:publicKey - publicKeyData:publicKeyData - privateKeyData:privateKeyData]; -} - -@end diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDLogger.h b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDLogger.h @@ -1,66 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRIMessageCode.h" - -// The convenience macros are only defined if they haven't already been defined. -#ifndef FIRInstanceIDLoggerInfo - -// Convenience macros that log to the shared GTMLogger instance. These macros -// are how users should typically log to FIRInstanceIDLogger. -#define FIRInstanceIDLoggerDebug(code, ...) \ - [FIRInstanceIDSharedLogger() logFuncDebug:__func__ messageCode:code msg:__VA_ARGS__] -#define FIRInstanceIDLoggerInfo(code, ...) \ - [FIRInstanceIDSharedLogger() logFuncInfo:__func__ messageCode:code msg:__VA_ARGS__] -#define FIRInstanceIDLoggerNotice(code, ...) \ - [FIRInstanceIDSharedLogger() logFuncNotice:__func__ messageCode:code msg:__VA_ARGS__] -#define FIRInstanceIDLoggerWarning(code, ...) \ - [FIRInstanceIDSharedLogger() logFuncWarning:__func__ messageCode:code msg:__VA_ARGS__] -#define FIRInstanceIDLoggerError(code, ...) \ - [FIRInstanceIDSharedLogger() logFuncError:__func__ messageCode:code msg:__VA_ARGS__] - -#endif // !defined(FIRInstanceIDLoggerInfo) - -@interface FIRInstanceIDLogger : NSObject - -- (void)logFuncDebug:(const char *)func - messageCode:(FIRInstanceIDMessageCode)messageCode - msg:(NSString *)fmt, ... NS_FORMAT_FUNCTION(3, 4); - -- (void)logFuncInfo:(const char *)func - messageCode:(FIRInstanceIDMessageCode)messageCode - msg:(NSString *)fmt, ... NS_FORMAT_FUNCTION(3, 4); - -- (void)logFuncNotice:(const char *)func - messageCode:(FIRInstanceIDMessageCode)messageCode - msg:(NSString *)fmt, ... NS_FORMAT_FUNCTION(3, 4); - -- (void)logFuncWarning:(const char *)func - messageCode:(FIRInstanceIDMessageCode)messageCode - msg:(NSString *)fmt, ... NS_FORMAT_FUNCTION(3, 4); - -- (void)logFuncError:(const char *)func - messageCode:(FIRInstanceIDMessageCode)messageCode - msg:(NSString *)fmt, ... NS_FORMAT_FUNCTION(3, 4); - -@end - -/** - * Instantiates and/or returns a shared GTMLogger used exclusively - * for InstanceID log messages. - * @return the shared GTMLogger instance - */ -FIRInstanceIDLogger *FIRInstanceIDSharedLogger(void); diff --git a/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDLogger.m b/Pods/FirebaseInstanceID/Firebase/InstanceID/FIRInstanceIDLogger.m @@ -1,92 +0,0 @@ -/* - * Copyright 2019 Google - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "FIRInstanceIDLogger.h" - -#import <FirebaseCore/FIRLogger.h> - -// Re-definition of FIRLogger service, as it is not included in :FIRAppHeaders target -N