+
+/// Game achievement ID (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterAchievementID : @"10_matches_won",
+/// // ...
+/// };
+///
+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.
+///
+/// NSDictionary *params = @{
+/// kFIRParameterAdNetworkClickID : @"1234567",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterAdNetworkClickID
+ NS_SWIFT_NAME(AnalyticsParameterAdNetworkClickID) = @"aclid";
+
+/// The store or affiliation from which this transaction occurred (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterAffiliation : @"Google Store",
+/// // ...
+/// };
+///
+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).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterCampaign : @"winter_promotion",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterCampaign NS_SWIFT_NAME(AnalyticsParameterCampaign) =
+ @"campaign";
+
+/// Character used in game (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterCharacter : @"beat_boss",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterCharacter NS_SWIFT_NAME(AnalyticsParameterCharacter) =
+ @"character";
+
+/// The checkout step (1..N) (unsigned 64-bit integer as NSNumber).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterCheckoutStep : @"1",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterCheckoutStep NS_SWIFT_NAME(AnalyticsParameterCheckoutStep) =
+ @"checkout_step";
+
+/// Some option on a step in an ecommerce flow (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterCheckoutOption : @"Visa",
+/// // ...
+/// };
+///
+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).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterContentType : @"news article",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterContentType NS_SWIFT_NAME(AnalyticsParameterContentType) =
+ @"content_type";
+
+/// Coupon code for a purchasable item (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterCoupon : @"zz123",
+/// // ...
+/// };
+///
+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.
+///
+/// NSDictionary *params = @{
+/// kFIRParameterCP1 : @"custom_data",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterCP1 NS_SWIFT_NAME(AnalyticsParameterCP1) = @"cp1";
+
+/// The name of a creative used in a promotional spot (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterCreativeName : @"Summer Sale",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterCreativeName NS_SWIFT_NAME(AnalyticsParameterCreativeName) =
+ @"creative_name";
+
+/// The name of a creative slot (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterCreativeSlot : @"summer_banner2",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterCreativeSlot NS_SWIFT_NAME(AnalyticsParameterCreativeSlot) =
+ @"creative_slot";
+
+/// Purchase currency in 3-letter
+/// ISO_4217 format (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterCurrency : @"USD",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterCurrency NS_SWIFT_NAME(AnalyticsParameterCurrency) =
+ @"currency";
+
+/// Flight or Travel destination (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterDestination : @"Mountain View, CA",
+/// // ...
+/// };
+///
+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).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterEndDate : @"2015-09-14",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterEndDate NS_SWIFT_NAME(AnalyticsParameterEndDate) = @"end_date";
+
+/// Flight number for travel events (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterFlightNumber : @"ZZ800",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterFlightNumber NS_SWIFT_NAME(AnalyticsParameterFlightNumber) =
+ @"flight_number";
+
+/// Group/clan/guild ID (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterGroupID : @"g1",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterGroupID NS_SWIFT_NAME(AnalyticsParameterGroupID) = @"group_id";
+
+/// Index of an item in a list (signed 64-bit integer as NSNumber).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterIndex : @(1),
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterIndex NS_SWIFT_NAME(AnalyticsParameterIndex) = @"index";
+
+/// Item brand (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterItemBrand : @"Google",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterItemBrand NS_SWIFT_NAME(AnalyticsParameterItemBrand) =
+ @"item_brand";
+
+/// Item category (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterItemCategory : @"t-shirts",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterItemCategory NS_SWIFT_NAME(AnalyticsParameterItemCategory) =
+ @"item_category";
+
+/// Item ID (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterItemID : @"p7654",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterItemID NS_SWIFT_NAME(AnalyticsParameterItemID) = @"item_id";
+
+/// The Google Place ID (NSString) that
+/// corresponds to the associated item. Alternatively, you can supply your own custom Location ID.
+///
+/// NSDictionary *params = @{
+/// kFIRParameterItemLocationID : @"ChIJiyj437sx3YAR9kUWC8QkLzQ",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterItemLocationID
+ NS_SWIFT_NAME(AnalyticsParameterItemLocationID) = @"item_location_id";
+
+/// Item name (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterItemName : @"abc",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterItemName NS_SWIFT_NAME(AnalyticsParameterItemName) =
+ @"item_name";
+
+/// The list in which the item was presented to the user (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterItemList : @"Search Results",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterItemList NS_SWIFT_NAME(AnalyticsParameterItemList) =
+ @"item_list";
+
+/// Item variant (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterItemVariant : @"Red",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterItemVariant NS_SWIFT_NAME(AnalyticsParameterItemVariant) =
+ @"item_variant";
+
+/// Level in game (signed 64-bit integer as NSNumber).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterLevel : @(42),
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterLevel NS_SWIFT_NAME(AnalyticsParameterLevel) = @"level";
+
+/// Location (NSString). The Google Place ID
+/// that corresponds to the associated event. Alternatively, you can supply your own custom
+/// Location ID.
+///
+/// NSDictionary *params = @{
+/// kFIRParameterLocation : @"ChIJiyj437sx3YAR9kUWC8QkLzQ",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterLocation NS_SWIFT_NAME(AnalyticsParameterLocation) =
+ @"location";
+
+/// The advertising or marketing medium, for example: cpc, banner, email, push. Highly recommended
+/// (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterMedium : @"email",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterMedium NS_SWIFT_NAME(AnalyticsParameterMedium) = @"medium";
+
+/// Number of nights staying at hotel (signed 64-bit integer as NSNumber).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterNumberOfNights : @(3),
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterNumberOfNights
+ NS_SWIFT_NAME(AnalyticsParameterNumberOfNights) = @"number_of_nights";
+
+/// Number of passengers traveling (signed 64-bit integer as NSNumber).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterNumberOfPassengers : @(11),
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterNumberOfPassengers
+ NS_SWIFT_NAME(AnalyticsParameterNumberOfPassengers) = @"number_of_passengers";
+
+/// Number of rooms for travel events (signed 64-bit integer as NSNumber).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterNumberOfRooms : @(2),
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterNumberOfRooms NS_SWIFT_NAME(AnalyticsParameterNumberOfRooms) =
+ @"number_of_rooms";
+
+/// Flight or Travel origin (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterOrigin : @"Mountain View, CA",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterOrigin NS_SWIFT_NAME(AnalyticsParameterOrigin) = @"origin";
+
+/// Purchase price (double as NSNumber).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterPrice : @(1.0),
+/// kFIRParameterCurrency : @"USD", // e.g. $1.00 USD
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterPrice NS_SWIFT_NAME(AnalyticsParameterPrice) = @"price";
+
+/// Purchase quantity (signed 64-bit integer as NSNumber).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterQuantity : @(1),
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterQuantity NS_SWIFT_NAME(AnalyticsParameterQuantity) =
+ @"quantity";
+
+/// Score in game (signed 64-bit integer as NSNumber).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterScore : @(4200),
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterScore NS_SWIFT_NAME(AnalyticsParameterScore) = @"score";
+
+/// The search string/keywords used (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterSearchTerm : @"periodic table",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterSearchTerm NS_SWIFT_NAME(AnalyticsParameterSearchTerm) =
+ @"search_term";
+
+/// Shipping cost (double as NSNumber).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterShipping : @(9.50),
+/// kFIRParameterCurrency : @"USD", // e.g. $9.50 USD
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterShipping NS_SWIFT_NAME(AnalyticsParameterShipping) =
+ @"shipping";
+
+/// Sign up method (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterSignUpMethod : @"google",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterSignUpMethod NS_SWIFT_NAME(AnalyticsParameterSignUpMethod) =
+ @"sign_up_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).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterSource : @"InMobi",
+/// // ...
+/// };
+///
+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).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterStartDate : @"2015-09-14",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterStartDate NS_SWIFT_NAME(AnalyticsParameterStartDate) =
+ @"start_date";
+
+/// Tax amount (double as NSNumber).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterTax : @(1.0),
+/// kFIRParameterCurrency : @"USD", // e.g. $1.00 USD
+/// // ...
+/// };
+///
+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).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterTerm : @"game",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterTerm NS_SWIFT_NAME(AnalyticsParameterTerm) = @"term";
+
+/// A single ID for a ecommerce group transaction (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterTransactionID : @"ab7236dd9823",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterTransactionID NS_SWIFT_NAME(AnalyticsParameterTransactionID) =
+ @"transaction_id";
+
+/// Travel class (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterTravelClass : @"business",
+/// // ...
+/// };
+///
+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
+/// currency code for conversion events will cause that
+/// conversion to be omitted from reporting.
+///
+/// NSDictionary *params = @{
+/// kFIRParameterValue : @(3.99),
+/// kFIRParameterCurrency : @"USD", // e.g. $3.99 USD
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterValue NS_SWIFT_NAME(AnalyticsParameterValue) = @"value";
+
+/// Name of virtual currency type (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterVirtualCurrencyName : @"virtual_currency_name",
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterVirtualCurrencyName
+ NS_SWIFT_NAME(AnalyticsParameterVirtualCurrencyName) = @"virtual_currency_name";
+
+/// The name of a level in a game (NSString).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterLevelName : @"room_1",
+/// // ...
+/// };
+///
+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).
+///
+/// NSDictionary *params = @{
+/// kFIRParameterSuccess : @(1),
+/// // ...
+/// };
+///
+static NSString *const kFIRParameterSuccess NS_SWIFT_NAME(AnalyticsParameterSuccess) = @"success";
diff --git a/iOS/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h b/iOS/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h
new file mode 100755
index 0000000..f50707f
--- /dev/null
+++ b/iOS/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h
@@ -0,0 +1,17 @@
+/// @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
+
+/// 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/iOS/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h b/iOS/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h
new file mode 100755
index 0000000..ed7588a
--- /dev/null
+++ b/iOS/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h
@@ -0,0 +1,5 @@
+#import "FIRAnalytics+AppDelegate.h"
+#import "FIRAnalytics.h"
+#import "FIREventNames.h"
+#import "FIRParameterNames.h"
+#import "FIRUserPropertyNames.h"
diff --git a/iOS/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Modules/module.modulemap b/iOS/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Modules/module.modulemap
new file mode 100755
index 0000000..ef80595
--- /dev/null
+++ b/iOS/Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Modules/module.modulemap
@@ -0,0 +1,10 @@
+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/iOS/Pods/FirebaseAnalytics/Frameworks/FirebaseCoreDiagnostics.framework/FirebaseCoreDiagnostics b/iOS/Pods/FirebaseAnalytics/Frameworks/FirebaseCoreDiagnostics.framework/FirebaseCoreDiagnostics
new file mode 100755
index 0000000..0c57863
Binary files /dev/null and b/iOS/Pods/FirebaseAnalytics/Frameworks/FirebaseCoreDiagnostics.framework/FirebaseCoreDiagnostics differ
diff --git a/iOS/Pods/FirebaseAnalytics/Frameworks/FirebaseCoreDiagnostics.framework/Modules/module.modulemap b/iOS/Pods/FirebaseAnalytics/Frameworks/FirebaseCoreDiagnostics.framework/Modules/module.modulemap
new file mode 100755
index 0000000..bbcb94e
--- /dev/null
+++ b/iOS/Pods/FirebaseAnalytics/Frameworks/FirebaseCoreDiagnostics.framework/Modules/module.modulemap
@@ -0,0 +1,6 @@
+framework module FirebaseCoreDiagnostics {
+ export *
+ module * { export *}
+ link "z"
+ link framework "Security"
+ link framework "SystemConfiguration"}
diff --git a/iOS/Pods/FirebaseCore/Firebase/Core/FIRAnalyticsConfiguration.m b/iOS/Pods/FirebaseCore/Firebase/Core/FIRAnalyticsConfiguration.m
new file mode 100644
index 0000000..33aa168
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/FIRAnalyticsConfiguration.m
@@ -0,0 +1,69 @@
+// 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/iOS/Pods/FirebaseCore/Firebase/Core/FIRApp.m b/iOS/Pods/FirebaseCore/Firebase/Core/FIRApp.m
new file mode 100644
index 0000000..2edcb07
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/FIRApp.m
@@ -0,0 +1,805 @@
+// 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
+
+#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/FIRCoreConfigurable.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> *gRegisteredAsConfigurable;
+
+@interface FIRApp ()
+
+@property(nonatomic) BOOL alreadySentConfigureNotification;
+
+@property(nonatomic) BOOL alreadySentDeleteNotification;
+
+#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) {
+ [[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 configureDefaultAppWithOptions:options sendingNotifications:YES];
+#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 configureDefaultAppWithOptions:options sendingNotifications:YES];
+}
+
++ (void)configureDefaultAppWithOptions:(FIROptions *)options
+ sendingNotifications:(BOOL)sendNotifications {
+ if (sDefaultApp) {
+ // FIRApp sets up FirebaseAnalytics and does plist validation, but does not cause it
+ // to fire notifications. So, if the default app already exists, but has not sent out
+ // configuration notifications, then continue re-initializing it.
+ if (!sendNotifications || sDefaultApp.alreadySentConfigureNotification) {
+ [NSException raise:kFirebaseCoreErrorDomain
+ format:@"Default app has already been configured."];
+ }
+ }
+ @synchronized(self) {
+ FIRLogDebug(kFIRLoggerCore, @"I-COR000001", @"Configuring the default app.");
+ sDefaultApp = [[FIRApp alloc] initInstanceWithName:kFIRDefaultAppName options:options];
+ [FIRApp addAppToAppDictionary:sDefaultApp];
+ if (!sDefaultApp.alreadySentConfigureNotification && sendNotifications) {
+ [FIRApp sendNotificationsToSDKs:sDefaultApp];
+ sDefaultApp.alreadySentConfigureNotification = YES;
+ }
+ }
+}
+
++ (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]) {
+ [NSException raise:kFirebaseCoreErrorDomain format:@"Name cannot be __FIRAPP_DEFAULT."];
+ }
+ 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];
+ }
+
+ @synchronized(self) {
+ FIRLogDebug(kFIRLoggerCore, @"I-COR000002", @"Configuring app named %@", name);
+ FIRApp *app = [[FIRApp alloc] initInstanceWithName:name options:options];
+ [FIRApp addAppToAppDictionary:app];
+ if (!app.alreadySentConfigureNotification) {
+ [FIRApp sendNotificationsToSDKs:app];
+ app.alreadySentConfigureNotification = YES;
+ }
+ }
+}
+
++ (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;
+ }
+ if (!self.alreadySentDeleteNotification) {
+ NSDictionary *appInfoDict = @{kFIRAppNameKey : self.name};
+ [[NSNotificationCenter defaultCenter] postNotificationName:kFIRAppDeleteNotification
+ object:[self class]
+ userInfo:appInfoDict];
+ self.alreadySentDeleteNotification = YES;
+ }
+ 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;
+ [[NSNotificationCenter defaultCenter]
+ postNotificationName:kFIRAppDiagnosticsNotification
+ object:nil
+ userInfo:@{
+ kFIRAppDiagnosticsConfigurationTypeKey : @(FIRConfigTypeCore),
+ kFIRAppDiagnosticsFIRAppKey : 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];
+
+ FIRApp *app = sAllApps[name];
+ _alreadySentConfigureNotification = app.alreadySentConfigureNotification;
+ _alreadySentDeleteNotification = app.alreadySentDeleteNotification;
+ }
+ return self;
+}
+
+- (void)getTokenForcingRefresh:(BOOL)forceRefresh withCallback:(FIRTokenCallback)callback {
+ if (!_getTokenImplementation) {
+ callback(nil, nil);
+ return;
+ }
+
+ _getTokenImplementation(forceRefresh, callback);
+}
+
+- (BOOL)configureCore {
+ [self checkExpectedBundleID];
+ if (![self isAppIDValid]) {
+ if (_options.usingOptionsFromDefaultPlist) {
+ [[NSNotificationCenter defaultCenter]
+ postNotificationName:kFIRAppDiagnosticsNotification
+ object:nil
+ userInfo:@{
+ kFIRAppDiagnosticsConfigurationTypeKey : @(FIRConfigTypeCore),
+ kFIRAppDiagnosticsErrorKey : [FIRApp errorForInvalidAppID],
+ }];
+ }
+ return NO;
+ }
+
+#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 != sDefaultApp) {
+ 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 == sDefaultApp)];
+ 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 library in gRegisteredAsConfigurable) {
+ [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];
+}
+
++ (void)registerAsConfigurable:(Class)klass {
+ // This is called at +load time, keep the work to a minimum.
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ gRegisteredAsConfigurable = [[NSMutableArray alloc] initWithCapacity:1];
+ });
+
+ NSAssert([(Class)klass conformsToProtocol:@protocol(FIRCoreConfigurable)],
+ @"The class being registered (%@) must conform to `FIRCoreConfigurable`.", klass);
+ [gRegisteredAsConfigurable addObject:klass];
+}
+
++ (BOOL)isDefaultAppConfigured {
+ return (sDefaultApp != nil);
+}
+
++ (void)registerLibrary:(nonnull NSString *)library 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 ([library rangeOfCharacterFromSet:disallowedSet].location == NSNotFound &&
+ [version rangeOfCharacterFromSet:disallowedSet].location == NSNotFound) {
+ if (!sLibraryVersions) {
+ sLibraryVersions = [[NSMutableDictionary alloc] init];
+ }
+ sLibraryVersions[library] = version;
+ } else {
+ FIRLogError(kFIRLoggerCore, @"I-COR000027",
+ @"The library name (%@) or version number (%@) contain illegal characters. "
+ @"Only alphanumeric, dash, underscore and period characters are allowed.",
+ library, version);
+ }
+}
+
++ (NSString *)firebaseUserAgent {
+ NSMutableArray *libraries =
+ [[NSMutableArray 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);
+ }
+}
+
+// TODO: Remove once SDKs transition to Auth interop library.
+- (nullable NSString *)getUID {
+ if (!_getUIDImplementation) {
+ FIRLogWarning(kFIRLoggerCore, @"I-COR000025", @"FIRAuth getUID implementation wasn't set.");
+ return nil;
+ }
+ return _getUIDImplementation();
+}
+
+#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 ":".
+ 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
+ * '::ios:'.
+ *
+ * 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/iOS/Pods/FirebaseCore/Firebase/Core/FIRAppAssociationRegistration.m b/iOS/Pods/FirebaseCore/Firebase/Core/FIRAppAssociationRegistration.m
new file mode 100644
index 0000000..2aecdab
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/FIRAppAssociationRegistration.m
@@ -0,0 +1,47 @@
+// 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
+
+@implementation FIRAppAssociationRegistration
+
++ (nullable id)registeredObjectWithHost:(id)host
+ key:(NSString *)key
+ creationBlock:(id _Nullable (^)(void))creationBlock {
+ @synchronized(self) {
+ SEL dictKey = @selector(registeredObjectWithHost:key:creationBlock:);
+ NSMutableDictionary *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/iOS/Pods/FirebaseCore/Firebase/Core/FIRBundleUtil.m b/iOS/Pods/FirebaseCore/Firebase/Core/FIRBundleUtil.m
new file mode 100644
index 0000000..93ee02e
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/FIRBundleUtil.m
@@ -0,0 +1,57 @@
+// 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/iOS/Pods/FirebaseCore/Firebase/Core/FIRComponent.m b/iOS/Pods/FirebaseCore/Firebase/Core/FIRComponent.m
new file mode 100644
index 0000000..2474d1a
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/FIRComponent.m
@@ -0,0 +1,65 @@
+/*
+ * 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 *)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 *)dependencies
+ creationBlock:(FIRComponentCreationBlock)creationBlock {
+ return [[FIRComponent alloc] initWithProtocol:protocol
+ instantiationTiming:instantiationTiming
+ dependencies:dependencies
+ creationBlock:creationBlock];
+}
+
+- (instancetype)initWithProtocol:(Protocol *)protocol
+ instantiationTiming:(FIRInstantiationTiming)instantiationTiming
+ dependencies:(NSArray *)dependencies
+ creationBlock:(FIRComponentCreationBlock)creationBlock {
+ self = [super init];
+ if (self) {
+ _protocol = protocol;
+ _instantiationTiming = instantiationTiming;
+ _dependencies = [dependencies copy];
+ _creationBlock = creationBlock;
+ }
+ return self;
+}
+
+@end
diff --git a/iOS/Pods/FirebaseCore/Firebase/Core/FIRComponentContainer.m b/iOS/Pods/FirebaseCore/Firebase/Core/FIRComponentContainer.m
new file mode 100644
index 0000000..381c95c
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/FIRComponentContainer.m
@@ -0,0 +1,205 @@
+/*
+ * 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/FIRComponentRegistrant.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 *components;
+
+/// Cached instances of components that requested to be cached.
+@property(nonatomic, strong) NSMutableDictionary *cachedInstances;
+
+@end
+
+@implementation FIRComponentContainer
+
+// Collection of all classes that register to provide components.
+static NSMutableSet *gFIRComponentRegistrants;
+
+#pragma mark - Public Registration
+
++ (void)registerAsComponentRegistrant:(Class)klass {
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ gFIRComponentRegistrants = [[NSMutableSet alloc] init];
+ });
+
+ [self registerAsComponentRegistrant:klass inSet:gFIRComponentRegistrants];
+}
+
++ (void)registerAsComponentRegistrant:(Class)klass inSet:(NSMutableSet *)allRegistrants {
+ // Validate the array to store the components is initialized.
+ if (!allRegistrants) {
+ FIRLogWarning(kFIRLoggerCore, @"I-COR000025",
+ @"Attempted to store registered components in an empty set.");
+ return;
+ }
+
+ // Ensure the class given conforms to the proper protocol.
+ if (![klass conformsToProtocol:@protocol(FIRComponentRegistrant)] ||
+ ![klass respondsToSelector:@selector(componentsToRegister)]) {
+ [NSException raise:NSInvalidArgumentException
+ format:
+ @"Class %@ attempted to register components, but it does not conform to "
+ @"`FIRComponentRegistrant` or provide a `componentsToRegister:` method.",
+ klass];
+ }
+
+ [allRegistrants addObject:klass];
+}
+
+#pragma mark - Internal Initialization
+
+- (instancetype)initWithApp:(FIRApp *)app {
+ return [self initWithApp:app registrants:gFIRComponentRegistrants];
+}
+
+- (instancetype)initWithApp:(FIRApp *)app registrants:(NSMutableSet *)allRegistrants {
+ self = [super init];
+ if (self) {
+ _app = app;
+ _cachedInstances = [NSMutableDictionary dictionary];
+ _components = [NSMutableDictionary dictionary];
+
+ [self populateComponentsFromRegisteredClasses:allRegistrants forApp:app];
+ }
+ return self;
+}
+
+- (void)populateComponentsFromRegisteredClasses:(NSSet *)classes forApp:(FIRApp *)app {
+ // Loop through the verified component registrants and populate the components array.
+ for (Class 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];
+}
+
+#pragma mark - Testing Initializers
+
+// TODO(wilsonryan): Set up a testing flag so this only is compiled in with unit tests.
+/// Initialize an instance with an app and existing components.
+- (instancetype)initWithApp:(FIRApp *)app
+ components:(NSDictionary *)components {
+ self = [self initWithApp:app registrants:[[NSMutableSet alloc] init]];
+ if (self) {
+ _components = [components mutableCopy];
+ }
+ return self;
+}
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/iOS/Pods/FirebaseCore/Firebase/Core/FIRComponentType.m b/iOS/Pods/FirebaseCore/Firebase/Core/FIRComponentType.m
new file mode 100644
index 0000000..bdc004f
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/FIRComponentType.m
@@ -0,0 +1,28 @@
+/*
+ * 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/iOS/Pods/FirebaseCore/Firebase/Core/FIRConfiguration.m b/iOS/Pods/FirebaseCore/Firebase/Core/FIRConfiguration.m
new file mode 100644
index 0000000..cd64862
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/FIRConfiguration.m
@@ -0,0 +1,44 @@
+// 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/iOS/Pods/FirebaseCore/Firebase/Core/FIRDependency.m b/iOS/Pods/FirebaseCore/Firebase/Core/FIRDependency.m
new file mode 100644
index 0000000..f979984
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/FIRDependency.m
@@ -0,0 +1,44 @@
+/*
+ * 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/iOS/Pods/FirebaseCore/Firebase/Core/FIRErrors.m b/iOS/Pods/FirebaseCore/Firebase/Core/FIRErrors.m
new file mode 100644
index 0000000..6d6d52d
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/FIRErrors.m
@@ -0,0 +1,29 @@
+// 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/iOS/Pods/FirebaseCore/Firebase/Core/FIRLogger.m b/iOS/Pods/FirebaseCore/Firebase/Core/FIRLogger.m
new file mode 100644
index 0000000..d1e3b37
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/FIRLogger.m
@@ -0,0 +1,185 @@
+// 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
+#import
+#import
+
+#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);
+}
+
+#ifdef DEBUG
+void FIRResetLogger() {
+ extern void GULResetLogger(void);
+ sFIRLoggerOnceToken = 0;
+ [sFIRLoggerUserDefaults removeObjectForKey:kFIRPersistedDebugModeKey];
+ sFIRLoggerUserDefaults = nil;
+ GULResetLogger();
+}
+
+void FIRSetLoggerUserDefaults(NSUserDefaults *defaults) {
+ sFIRLoggerUserDefaults = defaults;
+}
+#endif
+
+/**
+ * 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] [Firebase/Core][I-COR000001] Configure blah failed.
+ * Calling FIRLogDebug(kFIRLoggerCore, @"I-COR000001", @"Configure succeed.") shows:
+ * yyyy-mm-dd hh:mm:ss.SSS sender[PID] [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/iOS/Pods/FirebaseCore/Firebase/Core/FIROptions.m b/iOS/Pods/FirebaseCore/Firebase/Core/FIROptions.m
new file mode 100644
index 0000000..8cbc7a2
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/FIROptions.m
@@ -0,0 +1,444 @@
+// 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)
+ @"01" // Minor version (exactly 2 digits)
+ @"04" // 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 *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/iOS/Pods/FirebaseCore/Firebase/Core/FIRVersion.m b/iOS/Pods/FirebaseCore/Firebase/Core/FIRVersion.m
new file mode 100644
index 0000000..ec0f6ba
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/FIRVersion.m
@@ -0,0 +1,33 @@
+/*
+ * 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/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRAnalyticsConfiguration+Internal.h b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRAnalyticsConfiguration+Internal.h
new file mode 100644
index 0000000..be624b4
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRAnalyticsConfiguration+Internal.h
@@ -0,0 +1,49 @@
+/*
+ * 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/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRAppAssociationRegistration.h b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRAppAssociationRegistration.h
new file mode 100644
index 0000000..3fc69c6
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRAppAssociationRegistration.h
@@ -0,0 +1,49 @@
+/*
+ * 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
+
+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 : 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/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRAppInternal.h b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRAppInternal.h
new file mode 100644
index 0000000..f9fc539
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRAppInternal.h
@@ -0,0 +1,222 @@
+/*
+ * 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 FIRCoreConfigurable;
+
+/**
+ * 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;
+
+/** @typedef FIRTokenCallback
+ @brief The type of block which gets called when a token is ready.
+ */
+typedef void (^FIRTokenCallback)(NSString *_Nullable token, NSError *_Nullable error);
+
+/** @typedef FIRAppGetTokenImplementation
+ @brief The type of block which can provide an implementation for the @c getTokenWithCallback:
+ method.
+ @param forceRefresh Forces the token to be refreshed.
+ @param callback The block which should be invoked when the async call completes.
+ */
+typedef void (^FIRAppGetTokenImplementation)(BOOL forceRefresh, FIRTokenCallback callback);
+
+/** @typedef FIRAppGetUID
+ @brief The type of block which can provide an implementation for the @c getUID method.
+ */
+typedef NSString *_Nullable (^FIRAppGetUIDImplementation)(void);
+
+@interface FIRApp ()
+
+/**
+ * A flag indicating if this is the default app.
+ */
+@property(nonatomic, readonly) BOOL isDefaultApp;
+
+/** @property getTokenImplementation
+ @brief Gets or sets the block to use for the implementation of
+ @c getTokenForcingRefresh:withCallback:
+ */
+@property(nonatomic, copy) FIRAppGetTokenImplementation getTokenImplementation;
+
+/** @property getUIDImplementation
+ @brief Gets or sets the block to use for the implementation of @c getUID.
+ */
+@property(nonatomic, copy) FIRAppGetUIDImplementation getUIDImplementation;
+
+/*
+ * 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;
+
+/**
+ * Register a class that conforms to `FIRCoreConfigurable`. Each SDK should have one class that
+ * registers in order to provide critical information for interoperability and lifecycle events.
+ * TODO(wilsonryan): Write more documentation.
+ */
++ (void)registerAsConfigurable:(Class)klass;
+
+/**
+ * Registers a given third-party library with the given version number to be reported for
+ * analyitcs.
+ *
+ * @param library Name of the library
+ * @param version Version of the library
+ */
+// clang-format off
++ (void)registerLibrary:(NSString *)library
+ withVersion:(NSString *)version NS_SWIFT_NAME(registerLibrary(_:version:));
+// clang-format on
+
+/**
+ * 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;
+
+/** @fn getTokenForcingRefresh:withCallback:
+ @brief Retrieves the Firebase authentication token, possibly refreshing it.
+ @param forceRefresh Forces a token refresh. Useful if the token becomes invalid for some reason
+ other than an expiration.
+ @param callback The block to invoke when the token is available.
+ */
+- (void)getTokenForcingRefresh:(BOOL)forceRefresh withCallback:(FIRTokenCallback)callback;
+
+/**
+ * Expose the UID of the current user for Firestore.
+ */
+- (nullable NSString *)getUID;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRBundleUtil.h b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRBundleUtil.h
new file mode 100644
index 0000000..c458a2c
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRBundleUtil.h
@@ -0,0 +1,52 @@
+/*
+ * 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
+
+/**
+ * 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/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRComponent.h b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRComponent.h
new file mode 100644
index 0000000..cb51ee7
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRComponent.h
@@ -0,0 +1,91 @@
+/*
+ * 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
+
+@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 *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 *)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/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRComponentContainer.h b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRComponentContainer.h
new file mode 100644
index 0000000..10e2255
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRComponentContainer.h
@@ -0,0 +1,47 @@
+/*
+ * 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
+
+#import "FIRComponentType.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> 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;
+
+/// 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)klass;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRComponentContainerInternal.h b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRComponentContainerInternal.h
new file mode 100644
index 0000000..bb73e7b
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRComponentContainerInternal.h
@@ -0,0 +1,39 @@
+/*
+ * 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
+
+#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;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRComponentRegistrant.h b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRComponentRegistrant.h
new file mode 100644
index 0000000..ad2cad2
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRComponentRegistrant.h
@@ -0,0 +1,38 @@
+/*
+ * 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 FIRComponentRegistrant_h
+#define FIRComponentRegistrant_h
+
+#import
+
+@class FIRComponent;
+
+NS_ASSUME_NONNULL_BEGIN
+
+/// Describes functionality for SDKs registering components in the `FIRComponentContainer`.
+NS_SWIFT_NAME(ComponentRegistrant)
+@protocol FIRComponentRegistrant
+
+/// Returns one or more FIRComponents that will be registered in
+/// FIRApp and participate in dependency resolution and injection.
++ (NSArray *)componentsToRegister;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif /* FIRComponentRegistrant_h */
diff --git a/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRComponentType.h b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRComponentType.h
new file mode 100644
index 0000000..6f2aca7
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRComponentType.h
@@ -0,0 +1,34 @@
+/*
+ * 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
+
+@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/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRCoreConfigurable.h b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRCoreConfigurable.h
new file mode 100644
index 0000000..6c2b077
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRCoreConfigurable.h
@@ -0,0 +1,38 @@
+/*
+ * 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 FIRCoreConfigurable_h
+#define FIRCoreConfigurable_h
+
+#import
+
+@class FIRApp;
+
+NS_ASSUME_NONNULL_BEGIN
+
+/// Provides an interface to set up an SDK once a `FIRApp` is configured.
+NS_SWIFT_NAME(CoreConfigurable)
+@protocol FIRCoreConfigurable
+
+/// Configure the SDK if needed ahead of time. This method is called when the developer calls
+/// `FirebaseApp.configure()`.
++ (void)configureWithApp:(FIRApp *)app;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif /* FIRCoreConfigurable_h */
diff --git a/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRDependency.h b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRDependency.h
new file mode 100644
index 0000000..46e9b7e
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRDependency.h
@@ -0,0 +1,45 @@
+/*
+ * 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
+
+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/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRErrorCode.h b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRErrorCode.h
new file mode 100644
index 0000000..01d3c56
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRErrorCode.h
@@ -0,0 +1,55 @@
+/*
+ * 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/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRErrors.h b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRErrors.h
new file mode 100644
index 0000000..cf69252
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRErrors.h
@@ -0,0 +1,33 @@
+/*
+ * 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
+
+#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/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRLogger.h b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRLogger.h
new file mode 100644
index 0000000..a538199
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRLogger.h
@@ -0,0 +1,159 @@
+/*
+ * 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
+
+#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/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIROptionsInternal.h b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIROptionsInternal.h
new file mode 100644
index 0000000..7bb40fc
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIROptionsInternal.h
@@ -0,0 +1,114 @@
+/*
+ * 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/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRVersion.h b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRVersion.h
new file mode 100644
index 0000000..226efb1
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Private/FIRVersion.h
@@ -0,0 +1,23 @@
+/*
+ * 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
+
+/** 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/iOS/Pods/FirebaseCore/Firebase/Core/Public/FIRAnalyticsConfiguration.h b/iOS/Pods/FirebaseCore/Firebase/Core/Public/FIRAnalyticsConfiguration.h
new file mode 100644
index 0000000..ca1d32c
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Public/FIRAnalyticsConfiguration.h
@@ -0,0 +1,52 @@
+/*
+ * 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
+
+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());
+
+/**
+ * Sets the minimum engagement time in seconds required to start a new session. The default value
+ * is 10 seconds.
+ */
+- (void)setMinimumSessionInterval:(NSTimeInterval)minimumSessionInterval;
+
+/**
+ * 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/iOS/Pods/FirebaseCore/Firebase/Core/Public/FIRApp.h b/iOS/Pods/FirebaseCore/Firebase/Core/Public/FIRApp.h
new file mode 100644
index 0000000..e0dd6d6
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Public/FIRApp.h
@@ -0,0 +1,127 @@
+/*
+ * 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
+
+@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 *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/iOS/Pods/FirebaseCore/Firebase/Core/Public/FIRConfiguration.h b/iOS/Pods/FirebaseCore/Firebase/Core/Public/FIRConfiguration.h
new file mode 100644
index 0000000..95bba5e
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Public/FIRConfiguration.h
@@ -0,0 +1,50 @@
+/*
+ * 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
+
+#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/iOS/Pods/FirebaseCore/Firebase/Core/Public/FIRLoggerLevel.h b/iOS/Pods/FirebaseCore/Firebase/Core/Public/FIRLoggerLevel.h
new file mode 100644
index 0000000..dca3aa0
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Public/FIRLoggerLevel.h
@@ -0,0 +1,38 @@
+/*
+ * 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/iOS/Pods/FirebaseCore/Firebase/Core/Public/FIROptions.h b/iOS/Pods/FirebaseCore/Firebase/Core/Public/FIROptions.h
new file mode 100644
index 0000000..87a01dd
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Public/FIROptions.h
@@ -0,0 +1,116 @@
+/*
+ * 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
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ * This class provides constant fields of Google APIs.
+ */
+NS_SWIFT_NAME(FirebaseOptions)
+@interface FIROptions : NSObject
+
+/**
+ * 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/iOS/Pods/FirebaseCore/Firebase/Core/Public/FirebaseCore.h b/iOS/Pods/FirebaseCore/Firebase/Core/Public/FirebaseCore.h
new file mode 100644
index 0000000..fa26f69
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/Firebase/Core/Public/FirebaseCore.h
@@ -0,0 +1,21 @@
+/*
+ * 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/iOS/Pods/FirebaseCore/LICENSE b/iOS/Pods/FirebaseCore/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/LICENSE
@@ -0,0 +1,202 @@
+
+ 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/iOS/Pods/FirebaseCore/README.md b/iOS/Pods/FirebaseCore/README.md
new file mode 100644
index 0000000..eb6ea33
--- /dev/null
+++ b/iOS/Pods/FirebaseCore/README.md
@@ -0,0 +1,180 @@
+# 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, 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)
+
+An experimental Carthage distribution is now available. See
+[Carthage](Carthage.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).
+
+### 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/iOS/Pods/FirebaseInstanceID/CHANGELOG.md b/iOS/Pods/FirebaseInstanceID/CHANGELOG.md
new file mode 100755
index 0000000..b2f5eac
--- /dev/null
+++ b/iOS/Pods/FirebaseInstanceID/CHANGELOG.md
@@ -0,0 +1,128 @@
+# 2018-09-25 -- v3.2.2
+- Fixed a crash caused by NSUserDefaults being called on background thread.
+
+# 2018-08-14 -- v3.2.1
+- Fixed an issue that checkin is not cached properly when app first started. (#1561)
+
+# 2018-07-31 -- v3.2.0
+- Added support for global Firebase data collection flag. (#1219)
+- Improved message tracking sent by server API.
+- Fixed an issue that InstanceID doesn't compile in app extensions, allowing its
+dependents like remote config to be working inside the app extensions.
+
+# 2018-06-19 -- v3.1.1
+- Ensure the checkin and tokens are refreshed if firebase project changed.
+- Fixed an issue that checkin should be turned off when FCM's autoInitEnabled flag is off.
+
+# 2018-06-12 -- v3.1.0
+- Added a new API to fetch InstanceID and Token with a completion handler. The completion handler returns a FIRInstanceIDResult with a instanceID and a token properties.
+- Deprecated the token method.
+- Added support to log a new customized label provided by developer.
+
+# 2018-05-08 -- v3.0.0
+- Removed deprecated method `setAPNSToken:type` defined in FIRInstanceID, please use `setAPNSToken:type` defined in FIRMessaging instead.
+- Removed deprecated enum `FIRInstanceIDAPNSTokenType` defined in FIRInstanceID, please use `FIRMessagingAPNSTokenType` defined in FIRMessaging instead.
+- Fixed an issue that FCM scheduled messages were not tracked successfully.
+
+# 2018-03-06 -- v2.0.10
+- Improved documentation on InstanceID usage for GDPR.
+- Improved the keypair handling during GCM to FCM migration. If you are migrating from GCM to FCM, we encourage you to update to this version and above.
+
+# 2018-02-06 -- v2.0.9
+- Improved support for language targeting for FCM service. Server updates happen more efficiently when language changes.
+- Improved support for FCM token auto generation enable/disable functions.
+
+# 2017-12-11 -- v2.0.8
+- Fixed a crash caused by a reflection call during logging.
+- Updating server with the latest parameters and deprecating old ones.
+
+# 2017-11-27 -- v2.0.7
+- Improve identity reset process, ensuring all information is reset during Identity deletion.
+
+# 2017-11-06 -- v2.0.6
+- Make token refresh weekly.
+- Fixed a crash when performing token operation.
+
+# 2017-10-11 -- v2.0.5
+- Improved support for working in shared Keychain environments.
+
+# 2017-09-26 -- v2.0.4
+- Fixed an issue where the FCM token was not associating correctly with an APNs
+ device token, depending on when the APNs device token was made available.
+- Fixed an issue where FCM tokens for different Sender IDs were not associating
+ correctly with an APNs device token.
+- Fixed an issue that was preventing the FCM direct channel from being
+ established on the first start after 24 hours of being opened.
+
+# 2017-09-13 -- v2.0.3
+- Fixed a race condition where a token was not being generated on first start,
+ if Firebase Messaging was included and the app did not register for remote
+ notifications.
+
+# 2017-08-25 -- v2.0.2
+- Fixed a startup performance regression, removing a call which was blocking the
+ main thread.
+
+# 2017-08-07 -- v2.0.1
+- Fixed issues with token and app identifier being inaccessible when the device
+ is locked.
+- Fixed a crash if bundle identifier is nil, which is possible in some testing
+ environments.
+- Fixed a small memory leak fetching a new token.
+- Moved to a new and simplified token storage system.
+- Moved to a new queuing system for token fetches and deletes.
+- Simplified logic and code around configuration and logging.
+- Added clarification about the 'apns_sandbox' parameter, in header comments.
+
+# 2017-05-08 -- v2.0.0
+- Introduced an improved interface for Swift 3 developers
+- Deprecated some methods and properties after moving their logic to the
+ Firebase Cloud Messaging SDK
+- Fixed an intermittent stability issue when a debug build of an app was
+ replaced with a release build of the same version
+- Removed swizzling logic that was sometimes resulting in developers receiving
+ a validation notice about enabling push notification capabilities, even though
+ they weren't using push notifications
+- Fixed a notification that would sometimes fire twice in quick succession
+ during the first run of an app
+
+# 2017-03-31 -- v1.0.10
+
+- Improvements to token-fetching logic
+- Fixed some warnings in Instance ID
+- Improved error messages if Instance ID couldn't be initialized properly
+- Improvements to console logging
+
+# 2017-01-31 -- v1.0.9
+
+- Removed an error being mistakenly logged to the console.
+
+# 2016-07-06 -- v1.0.8
+
+- Don't store InstanceID plists in Documents folder.
+
+# 2016-06-19 -- v1.0.7
+
+- Fix remote-notifications warning on app submission.
+
+# 2016-05-16 -- v1.0.6
+
+- Fix CocoaPod linter issues for InstanceID pod.
+
+# 2016-05-13 -- v1.0.5
+
+- Fix Authorization errors for InstanceID tokens.
+
+# 2016-05-11 -- v1.0.4
+
+- Reduce wait for InstanceID token during parallel requests.
+
+# 2016-04-18 -- v1.0.3
+
+- Change flag to disable swizzling to *FirebaseAppDelegateProxyEnabled*.
+- Fix incessant Keychain errors while accessing InstanceID.
+- Fix max retries for fetching IID token.
+
+# 2016-04-18 -- v1.0.2
+
+- Register for remote notifications on iOS8+ in the SDK itself.
diff --git a/iOS/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/FirebaseInstanceID b/iOS/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/FirebaseInstanceID
new file mode 100755
index 0000000..9fbc00b
Binary files /dev/null and b/iOS/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/FirebaseInstanceID differ
diff --git a/iOS/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers/FIRInstanceID.h b/iOS/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers/FIRInstanceID.h
new file mode 100755
index 0000000..97777e1
--- /dev/null
+++ b/iOS/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers/FIRInstanceID.h
@@ -0,0 +1,304 @@
+#import
+
+NS_ASSUME_NONNULL_BEGIN
+
+@class FIRInstanceIDResult;
+/**
+ * @memberof FIRInstanceID
+ *
+ * The scope to be used when fetching/deleting a token for Firebase Messaging.
+ */
+FOUNDATION_EXPORT NSString *const kFIRInstanceIDScopeFirebaseMessaging
+ NS_SWIFT_NAME(InstanceIDScopeFirebaseMessaging);
+
+#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
+/**
+ * Called when the system determines that tokens need to be refreshed.
+ * This method is also called if Instance ID has been reset in which
+ * case, tokens and FCM topic subscriptions also need to be refreshed.
+ *
+ * Instance ID service will throttle the refresh event across all devices
+ * to control the rate of token updates on application servers.
+ */
+FOUNDATION_EXPORT const NSNotificationName kFIRInstanceIDTokenRefreshNotification
+ NS_SWIFT_NAME(InstanceIDTokenRefresh);
+#else
+/**
+ * Called when the system determines that tokens need to be refreshed.
+ * This method is also called if Instance ID has been reset in which
+ * case, tokens and FCM topic subscriptions also need to be refreshed.
+ *
+ * Instance ID service will throttle the refresh event across all devices
+ * to control the rate of token updates on application servers.
+ */
+FOUNDATION_EXPORT NSString *const kFIRInstanceIDTokenRefreshNotification
+ NS_SWIFT_NAME(InstanceIDTokenRefreshNotification);
+#endif // defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
+
+/**
+ * @related FIRInstanceID
+ *
+ * The completion handler invoked when the InstanceID token returns. If
+ * the call fails we return the appropriate `error code` as described below.
+ *
+ * @param token The valid token as returned by InstanceID backend.
+ *
+ * @param error The error describing why generating a new token
+ * failed. See the error codes below for a more detailed
+ * description.
+ */
+typedef void (^FIRInstanceIDTokenHandler)(NSString *__nullable token, NSError *__nullable error)
+ NS_SWIFT_NAME(InstanceIDTokenHandler);
+
+/**
+ * @related FIRInstanceID
+ *
+ * The completion handler invoked when the InstanceID `deleteToken` returns. If
+ * the call fails we return the appropriate `error code` as described below
+ *
+ * @param error The error describing why deleting the token failed.
+ * See the error codes below for a more detailed description.
+ */
+typedef void (^FIRInstanceIDDeleteTokenHandler)(NSError *error)
+ NS_SWIFT_NAME(InstanceIDDeleteTokenHandler);
+
+/**
+ * @related FIRInstanceID
+ *
+ * The completion handler invoked when the app identity is created. If the
+ * identity wasn't created for some reason we return the appropriate error code.
+ *
+ * @param identity A valid identity for the app instance, nil if there was an error
+ * while creating an identity.
+ * @param error The error if fetching the identity fails else nil.
+ */
+typedef void (^FIRInstanceIDHandler)(NSString *__nullable identity, NSError *__nullable error)
+ NS_SWIFT_NAME(InstanceIDHandler);
+
+/**
+ * @related FIRInstanceID
+ *
+ * The completion handler invoked when the app identity and all the tokens associated
+ * with it are deleted. Returns a valid error object in case of failure else nil.
+ *
+ * @param error The error if deleting the identity and all the tokens associated with
+ * it fails else nil.
+ */
+typedef void (^FIRInstanceIDDeleteHandler)(NSError *__nullable error)
+ NS_SWIFT_NAME(InstanceIDDeleteHandler);
+
+/**
+ * @related FIRInstanceID
+ *
+ * The completion handler invoked when the app identity and token are fetched. If the
+ * identity wasn't created for some reason we return the appropriate error code.
+ *
+ * @param result The result containing an identity for the app instance and a valid token,
+ * nil if there was an error while creating the result.
+ * @param error The error if fetching the identity or token fails else nil.
+ */
+typedef void (^FIRInstanceIDResultHandler)(FIRInstanceIDResult *__nullable result,
+ NSError *__nullable error)
+ NS_SWIFT_NAME(InstanceIDResultHandler);
+
+/**
+ * Public errors produced by InstanceID.
+ */
+typedef NS_ENUM(NSUInteger, FIRInstanceIDError) {
+ // Http related errors.
+
+ /// Unknown error.
+ FIRInstanceIDErrorUnknown = 0,
+
+ /// Auth Error -- GCM couldn't validate request from this client.
+ FIRInstanceIDErrorAuthentication = 1,
+
+ /// NoAccess -- InstanceID service cannot be accessed.
+ FIRInstanceIDErrorNoAccess = 2,
+
+ /// Timeout -- Request to InstanceID backend timed out.
+ FIRInstanceIDErrorTimeout = 3,
+
+ /// Network -- No network available to reach the servers.
+ FIRInstanceIDErrorNetwork = 4,
+
+ /// OperationInProgress -- Another similar operation in progress,
+ /// bailing this one.
+ FIRInstanceIDErrorOperationInProgress = 5,
+
+ /// InvalidRequest -- Some parameters of the request were invalid.
+ FIRInstanceIDErrorInvalidRequest = 7,
+} NS_SWIFT_NAME(InstanceIDError);
+
+/**
+ * A class contains the results of InstanceID and token query.
+ */
+NS_SWIFT_NAME(InstanceIDResult)
+@interface FIRInstanceIDResult : NSObject
+
+/**
+ * An instanceID uniquely identifies the app instance.
+ */
+@property(nonatomic, readonly, copy) NSString *instanceID;
+
+/*
+ * Returns a Firebase Messaging scoped token for the firebase app.
+ */
+@property(nonatomic, readonly, copy) NSString *token;
+
+@end
+
+/**
+ * Instance ID provides a unique identifier for each app instance and a mechanism
+ * to authenticate and authorize actions (for example, sending an FCM message).
+ *
+ * Once an InstanceID is generated, the library periodically sends information about the
+ * application and the device where it's running to the Firebase backend. To stop this. see
+ * `[FIRInstanceID deleteIDWithHandler:]`.
+ *
+ * Instance ID is long lived but, may be reset if the device is not used for
+ * a long time or the Instance ID service detects a problem.
+ * If Instance ID is reset, the app will be notified via
+ * `kFIRInstanceIDTokenRefreshNotification`.
+ *
+ * If the Instance ID has become invalid, the app can request a new one and
+ * send it to the app server.
+ * To prove ownership of Instance ID and to allow servers to access data or
+ * services associated with the app, call
+ * `[FIRInstanceID tokenWithAuthorizedEntity:scope:options:handler]`.
+ */
+NS_SWIFT_NAME(InstanceID)
+@interface FIRInstanceID : NSObject
+
+/**
+ * FIRInstanceID.
+ *
+ * @return A shared instance of FIRInstanceID.
+ */
++ (instancetype)instanceID NS_SWIFT_NAME(instanceID());
+
+/**
+ * Unavailable. Use +instanceID instead.
+ */
+- (instancetype)init __attribute__((unavailable("Use +instanceID instead.")));
+
+#pragma mark - Tokens
+
+/**
+ * Returns a result of app instance identifier InstanceID and a Firebase Messaging scoped token.
+ * param handler The callback handler invoked when an app instanceID and a default token
+ * are generated and returned. If instanceID and token fetching fail for some
+ * reason the callback is invoked with nil `result` and the appropriate error.
+ */
+- (void)instanceIDWithHandler:(FIRInstanceIDResultHandler)handler;
+
+/**
+ * Returns a Firebase Messaging scoped token for the firebase app.
+ *
+ * @return Returns the stored token if the device has registered with Firebase Messaging, otherwise
+ * returns nil.
+ */
+- (nullable NSString *)token __deprecated_msg("Use instanceIDWithHandler: instead.");
+
+/**
+ * Returns a token that authorizes an Entity (example: cloud service) to perform
+ * an action on behalf of the application identified by Instance ID.
+ *
+ * This is similar to an OAuth2 token except, it applies to the
+ * application instance instead of a user.
+ *
+ * This is an asynchronous call. If the token fetching fails for some reason
+ * we invoke the completion callback with nil `token` and the appropriate
+ * error.
+ *
+ * This generates an Instance ID if it does not exist yet, which starts periodically sending
+ * information to the Firebase backend (see `[FIRInstanceID getIDWithHandler:]`).
+ *
+ * Note, you can only have one `token` or `deleteToken` call for a given
+ * authorizedEntity and scope at any point of time. Making another such call with the
+ * same authorizedEntity and scope before the last one finishes will result in an
+ * error with code `OperationInProgress`.
+ *
+ * @see FIRInstanceID deleteTokenWithAuthorizedEntity:scope:handler:
+ *
+ * @param authorizedEntity Entity authorized by the token.
+ * @param scope Action authorized for authorizedEntity.
+ * @param options The extra options to be sent with your token request. The
+ * value for the `apns_token` should be the NSData object
+ * passed to the UIApplicationDelegate's
+ * `didRegisterForRemoteNotificationsWithDeviceToken` method.
+ * The value for `apns_sandbox` should be a boolean (or an
+ * NSNumber representing a BOOL in Objective C) set to true if
+ * your app is a debug build, which means that the APNs
+ * device token is for the sandbox environment. It should be
+ * set to false otherwise. If the `apns_sandbox` key is not
+ * provided, an automatically-detected value shall be used.
+ * @param handler The callback handler which is invoked when the token is
+ * successfully fetched. In case of success a valid `token` and
+ * `nil` error are returned. In case of any error the `token`
+ * is nil and a valid `error` is returned. The valid error
+ * codes have been documented above.
+ */
+- (void)tokenWithAuthorizedEntity:(NSString *)authorizedEntity
+ scope:(NSString *)scope
+ options:(nullable NSDictionary *)options
+ handler:(FIRInstanceIDTokenHandler)handler;
+
+/**
+ * Revokes access to a scope (action) for an entity previously
+ * authorized by `[FIRInstanceID tokenWithAuthorizedEntity:scope:options:handler]`.
+ *
+ * This is an asynchronous call. Call this on the main thread since InstanceID lib
+ * is not thread safe. In case token deletion fails for some reason we invoke the
+ * `handler` callback passed in with the appropriate error code.
+ *
+ * Note, you can only have one `token` or `deleteToken` call for a given
+ * authorizedEntity and scope at a point of time. Making another such call with the
+ * same authorizedEntity and scope before the last one finishes will result in an error
+ * with code `OperationInProgress`.
+ *
+ * @param authorizedEntity Entity that must no longer have access.
+ * @param scope Action that entity is no longer authorized to perform.
+ * @param handler The handler that is invoked once the unsubscribe call ends.
+ * In case of error an appropriate error object is returned
+ * else error is nil.
+ */
+- (void)deleteTokenWithAuthorizedEntity:(NSString *)authorizedEntity
+ scope:(NSString *)scope
+ handler:(FIRInstanceIDDeleteTokenHandler)handler;
+
+#pragma mark - Identity
+
+/**
+ * Asynchronously fetch a stable identifier that uniquely identifies the app
+ * instance. If the identifier has been revoked or has expired, this method will
+ * return a new identifier.
+ *
+ * Once an InstanceID is generated, the library periodically sends information about the
+ * application and the device where it's running to the Firebase backend. To stop this. see
+ * `[FIRInstanceID deleteIDWithHandler:]`.
+ *
+ * @param handler The handler to invoke once the identifier has been fetched.
+ * In case of error an appropriate error object is returned else
+ * a valid identifier is returned and a valid identifier for the
+ * application instance.
+ */
+- (void)getIDWithHandler:(FIRInstanceIDHandler)handler NS_SWIFT_NAME(getID(handler:));
+
+/**
+ * Resets Instance ID and revokes all tokens.
+ *
+ * This method also triggers a request to fetch a new Instance ID and Firebase Messaging scope
+ * token. Please listen to kFIRInstanceIDTokenRefreshNotification when the new ID and token are
+ * ready.
+ *
+ * This stops the periodic sending of data to the Firebase backend that began when the Instance ID
+ * was generated. No more data is sent until another library calls Instance ID internally again
+ * (like FCM, RemoteConfig or Analytics) or user explicitly calls Instance ID APIs to get an
+ * Instance ID and token again.
+ */
+- (void)deleteIDWithHandler:(FIRInstanceIDDeleteHandler)handler NS_SWIFT_NAME(deleteID(handler:));
+
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/iOS/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h b/iOS/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h
new file mode 100755
index 0000000..053ec2b
--- /dev/null
+++ b/iOS/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h
@@ -0,0 +1 @@
+#import "FIRInstanceID.h"
diff --git a/iOS/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Modules/module.modulemap b/iOS/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Modules/module.modulemap
new file mode 100755
index 0000000..2058956
--- /dev/null
+++ b/iOS/Pods/FirebaseInstanceID/Frameworks/FirebaseInstanceID.framework/Modules/module.modulemap
@@ -0,0 +1,6 @@
+framework module FirebaseInstanceID {
+ umbrella header "FirebaseInstanceID.h"
+ export *
+ module * { export *}
+ link framework "Security"
+ link framework "SystemConfiguration"}
diff --git a/iOS/Pods/FirebaseInstanceID/README.md b/iOS/Pods/FirebaseInstanceID/README.md
new file mode 100755
index 0000000..25fe219
--- /dev/null
+++ b/iOS/Pods/FirebaseInstanceID/README.md
@@ -0,0 +1,10 @@
+# InstanceID SDK for iOS
+
+Instance ID provides a unique ID per instance of your apps and also provides a
+mechanism to authenticate and authorize actions, like sending messages via
+Firebase Cloud Messaging (FCM).
+
+
+Please visit [our developer
+site](https://developers.google.com/instance-id/) for integration instructions,
+documentation, support information, and terms of service.
diff --git a/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMMessageCode.h b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMMessageCode.h
new file mode 100644
index 0000000..0d7e027
--- /dev/null
+++ b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMMessageCode.h
@@ -0,0 +1,181 @@
+/*
+ * 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
+
+typedef NS_ENUM(NSInteger, FIRMessagingMessageCode) {
+ // FIRMessaging+FIRApp.m
+ kFIRMessagingMessageCodeFIRApp000 = 1000, // I-FCM001000
+ kFIRMessagingMessageCodeFIRApp001 = 1001, // I-FCM001001
+ // FIRMessaging.m
+ kFIRMessagingMessageCodeMessagingPrintLibraryVersion = 2000, // I-FCM002000
+ kFIRMessagingMessageCodeMessaging001 = 2001, // I-FCM002001
+ kFIRMessagingMessageCodeMessaging002 = 2002, // I-FCM002002 - no longer used
+ kFIRMessagingMessageCodeMessaging003 = 2003, // I-FCM002003
+ kFIRMessagingMessageCodeMessaging004 = 2004, // I-FCM002004
+ kFIRMessagingMessageCodeMessaging005 = 2005, // I-FCM002005
+ kFIRMessagingMessageCodeMessaging006 = 2006, // I-FCM002006 - no longer used
+ kFIRMessagingMessageCodeMessaging007 = 2007, // I-FCM002007 - no longer used
+ kFIRMessagingMessageCodeMessaging008 = 2008, // I-FCM002008 - no longer used
+ kFIRMessagingMessageCodeMessaging009 = 2009, // I-FCM002009
+ kFIRMessagingMessageCodeMessaging010 = 2010, // I-FCM002010
+ kFIRMessagingMessageCodeMessaging011 = 2011, // I-FCM002011
+ kFIRMessagingMessageCodeMessaging012 = 2012, // I-FCM002012
+ kFIRMessagingMessageCodeMessaging013 = 2013, // I-FCM002013
+ kFIRMessagingMessageCodeMessaging014 = 2014, // I-FCM002014
+ kFIRMessagingMessageCodeMessaging015 = 2015, // I-FCM002015
+ kFIRMessagingMessageCodeMessaging016 = 2016, // I-FCM002016 - no longer used
+ kFIRMessagingMessageCodeMessaging017 = 2017, // I-FCM002017
+ kFIRMessagingMessageCodeMessaging018 = 2018, // I-FCM002018
+ kFIRMessagingMessageCodeRemoteMessageDelegateMethodNotImplemented = 2019, // I-FCM002019
+ kFIRMessagingMessageCodeSenderIDNotSuppliedForTokenFetch = 2020, // I-FCM002020
+ kFIRMessagingMessageCodeSenderIDNotSuppliedForTokenDelete = 2021, // I-FCM002021
+ kFIRMessagingMessageCodeAPNSTokenNotAvailableDuringTokenFetch = 2022, // I-FCM002022
+ kFIRMessagingMessageCodeTokenDelegateMethodsNotImplemented = 2023, // I-FCM002023
+ kFIRMessagingMessageCodeTopicFormatIsDeprecated = 2024,
+ // FIRMessagingClient.m
+ kFIRMessagingMessageCodeClient000 = 4000, // I-FCM004000
+ kFIRMessagingMessageCodeClient001 = 4001, // I-FCM004001
+ kFIRMessagingMessageCodeClient002 = 4002, // I-FCM004002
+ kFIRMessagingMessageCodeClient003 = 4003, // I-FCM004003
+ kFIRMessagingMessageCodeClient004 = 4004, // I-FCM004004
+ kFIRMessagingMessageCodeClient005 = 4005, // I-FCM004005
+ kFIRMessagingMessageCodeClient006 = 4006, // I-FCM004006
+ kFIRMessagingMessageCodeClient007 = 4007, // I-FCM004007
+ kFIRMessagingMessageCodeClient008 = 4008, // I-FCM004008
+ kFIRMessagingMessageCodeClient009 = 4009, // I-FCM004009
+ kFIRMessagingMessageCodeClient010 = 4010, // I-FCM004010
+ kFIRMessagingMessageCodeClient011 = 4011, // I-FCM004011
+ // FIRMessagingConnection.m
+ kFIRMessagingMessageCodeConnection000 = 5000, // I-FCM005000
+ kFIRMessagingMessageCodeConnection001 = 5001, // I-FCM005001
+ kFIRMessagingMessageCodeConnection002 = 5002, // I-FCM005002
+ kFIRMessagingMessageCodeConnection003 = 5003, // I-FCM005003
+ kFIRMessagingMessageCodeConnection004 = 5004, // I-FCM005004
+ kFIRMessagingMessageCodeConnection005 = 5005, // I-FCM005005
+ kFIRMessagingMessageCodeConnection006 = 5006, // I-FCM005006
+ kFIRMessagingMessageCodeConnection007 = 5007, // I-FCM005007
+ kFIRMessagingMessageCodeConnection008 = 5008, // I-FCM005008
+ kFIRMessagingMessageCodeConnection009 = 5009, // I-FCM005009
+ kFIRMessagingMessageCodeConnection010 = 5010, // I-FCM005010
+ kFIRMessagingMessageCodeConnection011 = 5011, // I-FCM005011
+ kFIRMessagingMessageCodeConnection012 = 5012, // I-FCM005012
+ kFIRMessagingMessageCodeConnection013 = 5013, // I-FCM005013
+ kFIRMessagingMessageCodeConnection014 = 5014, // I-FCM005014
+ kFIRMessagingMessageCodeConnection015 = 5015, // I-FCM005015
+ kFIRMessagingMessageCodeConnection016 = 5016, // I-FCM005016
+ kFIRMessagingMessageCodeConnection017 = 5017, // I-FCM005017
+ kFIRMessagingMessageCodeConnection018 = 5018, // I-FCM005018
+ kFIRMessagingMessageCodeConnection019 = 5019, // I-FCM005019
+ kFIRMessagingMessageCodeConnection020 = 5020, // I-FCM005020
+ kFIRMessagingMessageCodeConnection021 = 5021, // I-FCM005021
+ kFIRMessagingMessageCodeConnection022 = 5022, // I-FCM005022
+ kFIRMessagingMessageCodeConnection023 = 5023, // I-FCM005023
+ // FIRMessagingContextManagerService.m
+ kFIRMessagingMessageCodeContextManagerService000 = 6000, // I-FCM006000
+ kFIRMessagingMessageCodeContextManagerService001 = 6001, // I-FCM006001
+ kFIRMessagingMessageCodeContextManagerService002 = 6002, // I-FCM006002
+ kFIRMessagingMessageCodeContextManagerService003 = 6003, // I-FCM006003
+ kFIRMessagingMessageCodeContextManagerService004 = 6004, // I-FCM006004
+ kFIRMessagingMessageCodeContextManagerService005 = 6005, // I-FCM006005
+ // FIRMessagingDataMessageManager.m
+ kFIRMessagingMessageCodeDataMessageManager000 = 7000, // I-FCM007000
+ kFIRMessagingMessageCodeDataMessageManager001 = 7001, // I-FCM007001
+ kFIRMessagingMessageCodeDataMessageManager002 = 7002, // I-FCM007002
+ kFIRMessagingMessageCodeDataMessageManager003 = 7003, // I-FCM007003
+ kFIRMessagingMessageCodeDataMessageManager004 = 7004, // I-FCM007004
+ kFIRMessagingMessageCodeDataMessageManager005 = 7005, // I-FCM007005
+ kFIRMessagingMessageCodeDataMessageManager006 = 7006, // I-FCM007006
+ kFIRMessagingMessageCodeDataMessageManager007 = 7007, // I-FCM007007
+ kFIRMessagingMessageCodeDataMessageManager008 = 7008, // I-FCM007008
+ kFIRMessagingMessageCodeDataMessageManager009 = 7009, // I-FCM007009
+ kFIRMessagingMessageCodeDataMessageManager010 = 7010, // I-FCM007010
+ kFIRMessagingMessageCodeDataMessageManager011 = 7011, // I-FCM007011
+ kFIRMessagingMessageCodeDataMessageManager012 = 7012, // I-FCM007012
+ // FIRMessagingPendingTopicsList.m
+ kFIRMessagingMessageCodePendingTopicsList000 = 8000, // I-FCM008000
+ // FIRMessagingPubSub.m
+ kFIRMessagingMessageCodePubSub000 = 9000, // I-FCM009000
+ kFIRMessagingMessageCodePubSub001 = 9001, // I-FCM009001
+ kFIRMessagingMessageCodePubSub002 = 9002, // I-FCM009002
+ kFIRMessagingMessageCodePubSub003 = 9003, // I-FCM009003
+ // FIRMessagingReceiver.m
+ kFIRMessagingMessageCodeReceiver000 = 10000, // I-FCM010000
+ kFIRMessagingMessageCodeReceiver001 = 10001, // I-FCM010001
+ kFIRMessagingMessageCodeReceiver002 = 10002, // I-FCM010002
+ kFIRMessagingMessageCodeReceiver003 = 10003, // I-FCM010003
+ kFIRMessagingMessageCodeReceiver004 = 10004, // I-FCM010004 - no longer used
+ kFIRMessagingMessageCodeReceiver005 = 10005, // I-FCM010005
+ // FIRMessagingRegistrar.m
+ kFIRMessagingMessageCodeRegistrar000 = 11000, // I-FCM011000
+ // FIRMessagingRemoteNotificationsProxy.m
+ kFIRMessagingMessageCodeRemoteNotificationsProxy000 = 12000, // I-FCM012000
+ kFIRMessagingMessageCodeRemoteNotificationsProxy001 = 12001, // I-FCM012001
+ kFIRMessagingMessageCodeRemoteNotificationsProxyAPNSFailed = 12002, // I-FCM012002
+ kFIRMessagingMessageCodeRemoteNotificationsProxyMethodNotAdded = 12003, // I-FCM012003
+ // FIRMessagingRmq2PersistentStore.m
+ kFIRMessagingMessageCodeRmq2PersistentStore000 = 13000, // I-FCM013000
+ kFIRMessagingMessageCodeRmq2PersistentStore001 = 13001, // I-FCM013001
+ kFIRMessagingMessageCodeRmq2PersistentStore002 = 13002, // I-FCM013002
+ kFIRMessagingMessageCodeRmq2PersistentStore003 = 13003, // I-FCM013003
+ kFIRMessagingMessageCodeRmq2PersistentStore004 = 13004, // I-FCM013004
+ kFIRMessagingMessageCodeRmq2PersistentStore005 = 13005, // I-FCM013005
+ kFIRMessagingMessageCodeRmq2PersistentStore006 = 13006, // I-FCM013006
+ kFIRMessagingMessageCodeRmq2PersistentStoreErrorCreatingDatabase = 13007, // I-FCM013007
+ kFIRMessagingMessageCodeRmq2PersistentStoreErrorOpeningDatabase = 13008, // I-FCM013008
+ kFIRMessagingMessageCodeRmq2PersistentStoreInvalidRmqDirectory = 13009, // I-FCM013009
+ kFIRMessagingMessageCodeRmq2PersistentStoreErrorCreatingTable = 13010, // I-FCM013010
+ // FIRMessagingRmqManager.m
+ kFIRMessagingMessageCodeRmqManager000 = 14000, // I-FCM014000
+ // FIRMessagingSecureSocket.m
+ kFIRMessagingMessageCodeSecureSocket000 = 15000, // I-FCM015000
+ kFIRMessagingMessageCodeSecureSocket001 = 15001, // I-FCM015001
+ kFIRMessagingMessageCodeSecureSocket002 = 15002, // I-FCM015002
+ kFIRMessagingMessageCodeSecureSocket003 = 15003, // I-FCM015003
+ kFIRMessagingMessageCodeSecureSocket004 = 15004, // I-FCM015004
+ kFIRMessagingMessageCodeSecureSocket005 = 15005, // I-FCM015005
+ kFIRMessagingMessageCodeSecureSocket006 = 15006, // I-FCM015006
+ kFIRMessagingMessageCodeSecureSocket007 = 15007, // I-FCM015007
+ kFIRMessagingMessageCodeSecureSocket008 = 15008, // I-FCM015008
+ kFIRMessagingMessageCodeSecureSocket009 = 15009, // I-FCM015009
+ kFIRMessagingMessageCodeSecureSocket010 = 15010, // I-FCM015010
+ kFIRMessagingMessageCodeSecureSocket011 = 15011, // I-FCM015011
+ kFIRMessagingMessageCodeSecureSocket012 = 15012, // I-FCM015012
+ kFIRMessagingMessageCodeSecureSocket013 = 15013, // I-FCM015013
+ kFIRMessagingMessageCodeSecureSocket014 = 15014, // I-FCM015014
+ kFIRMessagingMessageCodeSecureSocket015 = 15015, // I-FCM015015
+ kFIRMessagingMessageCodeSecureSocket016 = 15016, // I-FCM015016
+ // FIRMessagingSyncMessageManager.m
+ kFIRMessagingMessageCodeSyncMessageManager000 = 16000, // I-FCM016000
+ kFIRMessagingMessageCodeSyncMessageManager001 = 16001, // I-FCM016001
+ kFIRMessagingMessageCodeSyncMessageManager002 = 16002, // I-FCM016002
+ kFIRMessagingMessageCodeSyncMessageManager003 = 16003, // I-FCM016003
+ kFIRMessagingMessageCodeSyncMessageManager004 = 16004, // I-FCM016004
+ kFIRMessagingMessageCodeSyncMessageManager005 = 16005, // I-FCM016005
+ kFIRMessagingMessageCodeSyncMessageManager006 = 16006, // I-FCM016006
+ kFIRMessagingMessageCodeSyncMessageManager007 = 16007, // I-FCM016007
+ kFIRMessagingMessageCodeSyncMessageManager008 = 16008, // I-FCM016008
+ // FIRMessagingTopicOperation.m
+ kFIRMessagingMessageCodeTopicOption000 = 17000, // I-FCM017000
+ kFIRMessagingMessageCodeTopicOption001 = 17001, // I-FCM017001
+ kFIRMessagingMessageCodeTopicOption002 = 17002, // I-FCM017002
+ kFIRMessagingMessageCodeTopicOptionTopicEncodingFailed = 17003, // I-FCM017003
+ kFIRMessagingMessageCodeTopicOperationEmptyResponse = 17004, // I-FCM017004
+ // FIRMessagingUtilities.m
+ kFIRMessagingMessageCodeUtilities000 = 18000, // I-FCM018000
+ kFIRMessagingMessageCodeUtilities001 = 18001, // I-FCM018001
+ kFIRMessagingMessageCodeUtilities002 = 18002, // I-FCM018002
+};
diff --git a/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessaging.m b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessaging.m
new file mode 100644
index 0000000..2da0e60
--- /dev/null
+++ b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessaging.m
@@ -0,0 +1,1191 @@
+/*
+ * 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.
+ */
+
+#if !__has_feature(objc_arc)
+#error FIRMessagingLib should be compiled with ARC.
+#endif
+
+#import "FIRMessaging.h"
+#import "FIRMessaging_Private.h"
+
+#import
+
+#import "FIRMessagingClient.h"
+#import "FIRMessagingConstants.h"
+#import "FIRMessagingContextManagerService.h"
+#import "FIRMessagingDataMessageManager.h"
+#import "FIRMessagingDefines.h"
+#import "FIRMessagingLogger.h"
+#import "FIRMessagingPubSub.h"
+#import "FIRMessagingReceiver.h"
+#import "FIRMessagingRemoteNotificationsProxy.h"
+#import "FIRMessagingRmqManager.h"
+#import "FIRMessagingSyncMessageManager.h"
+#import "FIRMessagingUtilities.h"
+#import "FIRMessagingVersionUtilities.h"
+#import "FIRMessaging_Private.h"
+
+#import
+#import
+#import
+
+#import "NSError+FIRMessaging.h"
+
+static NSString *const kFIRMessagingMessageViaAPNSRootKey = @"aps";
+static NSString *const kFIRMessagingReachabilityHostname = @"www.google.com";
+static NSString *const kFIRMessagingDefaultTokenScope = @"*";
+static NSString *const kFIRMessagingFCMTokenFetchAPNSOption = @"apns_token";
+
+#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
+const NSNotificationName FIRMessagingSendSuccessNotification =
+ @"com.firebase.messaging.notif.send-success";
+const NSNotificationName FIRMessagingSendErrorNotification =
+ @"com.firebase.messaging.notif.send-error";
+const NSNotificationName FIRMessagingMessagesDeletedNotification =
+ @"com.firebase.messaging.notif.messages-deleted";
+const NSNotificationName FIRMessagingConnectionStateChangedNotification =
+ @"com.firebase.messaging.notif.connection-state-changed";
+const NSNotificationName FIRMessagingRegistrationTokenRefreshedNotification =
+ @"com.firebase.messaging.notif.fcm-token-refreshed";
+#else
+NSString *const FIRMessagingSendSuccessNotification =
+ @"com.firebase.messaging.notif.send-success";
+NSString *const FIRMessagingSendErrorNotification =
+ @"com.firebase.messaging.notif.send-error";
+NSString * const FIRMessagingMessagesDeletedNotification =
+ @"com.firebase.messaging.notif.messages-deleted";
+NSString * const FIRMessagingConnectionStateChangedNotification =
+ @"com.firebase.messaging.notif.connection-state-changed";
+NSString * const FIRMessagingRegistrationTokenRefreshedNotification =
+ @"com.firebase.messaging.notif.fcm-token-refreshed";
+#endif // defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
+
+NSString *const kFIRMessagingUserDefaultsKeyAutoInitEnabled =
+ @"com.firebase.messaging.auto-init.enabled"; // Auto Init Enabled key stored in NSUserDefaults
+
+NSString *const kFIRMessagingAPNSTokenType = @"APNSTokenType"; // APNS Token type key stored in user info.
+
+NSString *const kFIRMessagingPlistAutoInitEnabled =
+ @"FirebaseMessagingAutoInitEnabled"; // Auto Init Enabled key stored in Info.plist
+
+@interface FIRMessagingMessageInfo ()
+
+@property(nonatomic, readwrite, assign) FIRMessagingMessageStatus status;
+
+@end
+
+@implementation FIRMessagingMessageInfo
+
+- (instancetype)init {
+ FIRMessagingInvalidateInitializer();
+}
+
+- (instancetype)initWithStatus:(FIRMessagingMessageStatus)status {
+ self = [super init];
+ if (self) {
+ _status = status;
+ }
+ return self;
+}
+
+@end
+
+#pragma mark - for iOS 10 compatibility
+@implementation FIRMessagingRemoteMessage
+
+- (instancetype)init {
+ self = [super init];
+ if (self) {
+ _appData = [[NSMutableDictionary alloc] init];
+ }
+
+ return self;
+}
+
+- (instancetype)initWithMessage:(FIRMessagingRemoteMessage *)message {
+ self = [self init];
+ if (self) {
+ _appData = [message.appData copy];
+ }
+
+ return self;
+}
+
+@end
+
+@interface FIRMessaging ()
+
+// FIRApp properties
+@property(nonatomic, readwrite, strong) NSData *apnsTokenData;
+@property(nonatomic, readwrite, strong) NSString *defaultFcmToken;
+
+@property(nonatomic, readwrite, strong) FIRInstanceID *instanceID;
+
+@property(nonatomic, readwrite, assign) BOOL isClientSetup;
+
+@property(nonatomic, readwrite, strong) FIRMessagingClient *client;
+@property(nonatomic, readwrite, strong) GULReachabilityChecker *reachability;
+@property(nonatomic, readwrite, strong) FIRMessagingDataMessageManager *dataMessageManager;
+@property(nonatomic, readwrite, strong) FIRMessagingPubSub *pubsub;
+@property(nonatomic, readwrite, strong) FIRMessagingRmqManager *rmq2Manager;
+@property(nonatomic, readwrite, strong) FIRMessagingReceiver *receiver;
+@property(nonatomic, readwrite, strong) FIRMessagingSyncMessageManager *syncMessageManager;
+@property(nonatomic, readwrite, strong) NSUserDefaults *messagingUserDefaults;
+
+/// Message ID's logged for analytics. This prevents us from logging the same message twice
+/// which can happen if the user inadvertently calls `appDidReceiveMessage` along with us
+/// calling it implicitly during swizzling.
+@property(nonatomic, readwrite, strong) NSMutableSet *loggedMessageIDs;
+
+- (instancetype)initWithInstanceID:(FIRInstanceID *)instanceID
+ userDefaults:(NSUserDefaults *)defaults NS_DESIGNATED_INITIALIZER;
+
+@end
+
+@implementation FIRMessaging
+
++ (FIRMessaging *)messaging {
+ static FIRMessaging *messaging;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ messaging = [[FIRMessaging alloc] initPrivately];
+ [messaging start];
+ });
+ return messaging;
+}
+
+- (instancetype)initWithInstanceID:(FIRInstanceID *)instanceID
+ userDefaults:(NSUserDefaults *)defaults {
+ self = [super init];
+ if (self != nil) {
+ _loggedMessageIDs = [NSMutableSet set];
+ _instanceID = instanceID;
+ _messagingUserDefaults = defaults;
+ }
+ return self;
+}
+
+- (instancetype)initPrivately {
+ return [self initWithInstanceID:[FIRInstanceID instanceID]
+ userDefaults:[NSUserDefaults standardUserDefaults]];
+}
+
+- (void)dealloc {
+ [self.reachability stop];
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [self teardown];
+}
+
+#pragma mark - Config
+
++ (void)load {
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(didReceiveConfigureSDKNotification:)
+ name:kFIRAppReadyToConfigureSDKNotification
+ object:nil];
+}
+
++ (void)didReceiveConfigureSDKNotification:(NSNotification *)notification {
+ NSDictionary *appInfoDict = notification.userInfo;
+ NSNumber *isDefaultApp = appInfoDict[kFIRAppIsDefaultAppKey];
+ if (![isDefaultApp boolValue]) {
+ // Only configure for the default FIRApp.
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeFIRApp001,
+ @"Firebase Messaging only works with the default app.");
+ return;
+ }
+
+ NSString *appName = appInfoDict[kFIRAppNameKey];
+ FIRApp *app = [FIRApp appNamed:appName];
+ [[FIRMessaging messaging] configureMessaging:app];
+}
+
+- (void)configureMessaging:(FIRApp *)app {
+ // Swizzle remote-notification-related methods (app delegate and UNUserNotificationCenter)
+ if ([FIRMessagingRemoteNotificationsProxy canSwizzleMethods]) {
+ NSString *docsURLString = @"https://firebase.google.com/docs/cloud-messaging/ios/client"
+ @"#method_swizzling_in_firebase_messaging";
+ FIRMessagingLoggerNotice(kFIRMessagingMessageCodeFIRApp000,
+ @"FIRMessaging Remote Notifications proxy enabled, will swizzle "
+ @"remote notification receiver handlers. If you'd prefer to manually "
+ @"integrate Firebase Messaging, add \"%@\" to your Info.plist, "
+ @"and set it to NO. Follow the instructions at:\n%@\nto ensure "
+ @"proper integration.",
+ kFIRMessagingRemoteNotificationsProxyEnabledInfoPlistKey,
+ docsURLString);
+ [FIRMessagingRemoteNotificationsProxy swizzleMethods];
+ }
+}
+
+- (void)start {
+ // Print the library version for logging.
+ NSString *currentLibraryVersion = FIRMessagingCurrentLibraryVersion();
+ FIRMessagingLoggerInfo(kFIRMessagingMessageCodeMessagingPrintLibraryVersion,
+ @"FIRMessaging library version %@",
+ currentLibraryVersion);
+
+ [self setupReceiver];
+
+ NSString *hostname = kFIRMessagingReachabilityHostname;
+ self.reachability = [[GULReachabilityChecker alloc] initWithReachabilityDelegate:self
+ withHost:hostname];
+ [self.reachability start];
+
+ [self setupApplicationSupportSubDirectory];
+ // setup FIRMessaging objects
+ [self setupRmqManager];
+ [self setupClient];
+ [self setupSyncMessageManager];
+ [self setupDataMessageManager];
+ [self setupTopics];
+
+ self.isClientSetup = YES;
+ [self setupNotificationListeners];
+}
+
+- (void)setupApplicationSupportSubDirectory {
+ NSString *messagingSubDirectory = kFIRMessagingApplicationSupportSubDirectory;
+ if (![[self class] hasApplicationSupportSubDirectory:messagingSubDirectory]) {
+ [[self class] createApplicationSupportSubDirectory:messagingSubDirectory];
+ }
+}
+
+- (void)setupNotificationListeners {
+ // To prevent multiple notifications remove self as observer for all events.
+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+ [center removeObserver:self];
+
+ [center addObserver:self
+ selector:@selector(didReceiveDefaultInstanceIDToken:)
+ name:kFIRMessagingFCMTokenNotification
+ object:nil];
+ [center addObserver:self
+ selector:@selector(defaultInstanceIDTokenWasRefreshed:)
+ name:kFIRMessagingRegistrationTokenRefreshNotification
+ object:nil];
+ [center addObserver:self
+ selector:@selector(applicationStateChanged)
+ name:UIApplicationDidBecomeActiveNotification
+ object:nil];
+ [center addObserver:self
+ selector:@selector(applicationStateChanged)
+ name:UIApplicationDidEnterBackgroundNotification
+ object:nil];
+}
+
+- (void)setupReceiver {
+ self.receiver = [[FIRMessagingReceiver alloc] init];
+ self.receiver.delegate = self;
+}
+
+- (void)setupClient {
+ self.client = [[FIRMessagingClient alloc] initWithDelegate:self
+ reachability:self.reachability
+ rmq2Manager:self.rmq2Manager];
+}
+
+- (void)setupDataMessageManager {
+ self.dataMessageManager =
+ [[FIRMessagingDataMessageManager alloc] initWithDelegate:self.receiver
+ client:self.client
+ rmq2Manager:self.rmq2Manager
+ syncMessageManager:self.syncMessageManager];
+
+ [self.dataMessageManager refreshDelayedMessages];
+ [self.client setDataMessageManager:self.dataMessageManager];
+}
+
+- (void)setupRmqManager {
+ self.rmq2Manager = [[FIRMessagingRmqManager alloc] initWithDatabaseName:@"rmq2"];
+ [self.rmq2Manager loadRmqId];
+}
+
+- (void)setupTopics {
+ _FIRMessagingDevAssert(self.client, @"Invalid nil client before init pubsub.");
+ self.pubsub = [[FIRMessagingPubSub alloc] initWithClient:self.client];
+}
+
+- (void)setupSyncMessageManager {
+ self.syncMessageManager =
+ [[FIRMessagingSyncMessageManager alloc] initWithRmqManager:self.rmq2Manager];
+
+ // Delete the expired messages with a delay. We don't want to block startup with a somewhat
+ // expensive db call.
+ FIRMessaging_WEAKIFY(self);
+ dispatch_time_t time = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5.0 * NSEC_PER_SEC));
+ dispatch_after(time, dispatch_get_main_queue(), ^{
+ FIRMessaging_STRONGIFY(self);
+ [self.syncMessageManager removeExpiredSyncMessages];
+ });
+}
+
+- (void)teardown {
+ _FIRMessagingDevAssert([NSThread isMainThread],
+ @"FIRMessaging should be called from main thread only.");
+ [self.client teardown];
+ self.pubsub = nil;
+ self.syncMessageManager = nil;
+ self.rmq2Manager = nil;
+ self.dataMessageManager = nil;
+ self.client = nil;
+ self.isClientSetup = NO;
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeMessaging001, @"Did successfully teardown");
+}
+
+#pragma mark - Messages
+
+- (FIRMessagingMessageInfo *)appDidReceiveMessage:(NSDictionary *)message {
+ if (!message.count) {
+ return [[FIRMessagingMessageInfo alloc] initWithStatus:FIRMessagingMessageStatusUnknown];
+ }
+
+ // For downstream messages that go via MCS we should strip out this key before sending
+ // the message to the device.
+ BOOL isOldMessage = NO;
+ NSString *messageID = message[kFIRMessagingMessageIDKey];
+ if ([messageID length]) {
+ [self.rmq2Manager saveS2dMessageWithRmqId:messageID];
+
+ BOOL isSyncMessage = [[self class] isAPNSSyncMessage:message];
+ if (isSyncMessage) {
+ isOldMessage = [self.syncMessageManager didReceiveAPNSSyncMessage:message];
+ }
+ }
+ // Prevent duplicates by keeping a cache of all the logged messages during each session.
+ // The duplicates only happen when the 3P app calls `appDidReceiveMessage:` along with
+ // us swizzling their implementation to call the same method implicitly.
+ if (!isOldMessage && messageID.length) {
+ isOldMessage = [self.loggedMessageIDs containsObject:messageID];
+ if (!isOldMessage) {
+ [self.loggedMessageIDs addObject:messageID];
+ }
+ }
+
+ if (!isOldMessage) {
+ Class firMessagingLogClass = NSClassFromString(@"FIRMessagingLog");
+ SEL logMessageSelector = NSSelectorFromString(@"logMessage:");
+
+ if ([firMessagingLogClass respondsToSelector:logMessageSelector]) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
+ [firMessagingLogClass performSelector:logMessageSelector
+ withObject:message];
+ }
+#pragma clang diagnostic pop
+ [self handleContextManagerMessage:message];
+ [self handleIncomingLinkIfNeededFromMessage:message];
+ }
+ return [[FIRMessagingMessageInfo alloc] initWithStatus:FIRMessagingMessageStatusNew];
+}
+
+- (BOOL)handleContextManagerMessage:(NSDictionary *)message {
+ if ([FIRMessagingContextManagerService isContextManagerMessage:message]) {
+ return [FIRMessagingContextManagerService handleContextManagerMessage:message];
+ }
+ return NO;
+}
+
++ (BOOL)isAPNSSyncMessage:(NSDictionary *)message {
+ if ([message[kFIRMessagingMessageViaAPNSRootKey] isKindOfClass:[NSDictionary class]]) {
+ NSDictionary *aps = message[kFIRMessagingMessageViaAPNSRootKey];
+ return [aps[kFIRMessagingMessageAPNSContentAvailableKey] boolValue];
+ }
+ return NO;
+}
+
+- (void)handleIncomingLinkIfNeededFromMessage:(NSDictionary *)message {
+ NSURL *url = [self linkURLFromMessage:message];
+ if (url == nil) {
+ return;
+ }
+ if (![NSThread isMainThread]) {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [self handleIncomingLinkIfNeededFromMessage:message];
+
+ });
+ return;
+ }
+ UIApplication *application = FIRMessagingUIApplication();
+ if (!application) {
+ return;
+ }
+ id appDelegate = application.delegate;
+ SEL continueUserActivitySelector =
+ @selector(application:continueUserActivity:restorationHandler:);
+ SEL openURLWithOptionsSelector = @selector(application:openURL:options:);
+ SEL openURLWithSourceApplicationSelector =
+ @selector(application:openURL:sourceApplication:annotation:);
+ SEL handleOpenURLSelector = @selector(application:handleOpenURL:);
+ // Due to FIRAAppDelegateProxy swizzling, this selector will most likely get chosen, whether or
+ // not the actual application has implemented
+ // |application:continueUserActivity:restorationHandler:|. A warning will be displayed to the user
+ // if they haven't implemented it.
+ if ([NSUserActivity class] != nil &&
+ [appDelegate respondsToSelector:continueUserActivitySelector]) {
+ NSUserActivity *userActivity =
+ [[NSUserActivity alloc] initWithActivityType:NSUserActivityTypeBrowsingWeb];
+ userActivity.webpageURL = url;
+ [appDelegate application:application
+ continueUserActivity:userActivity
+ restorationHandler:^(NSArray * _Nullable restorableObjects) {
+ // Do nothing, as we don't support the app calling this block
+ }];
+
+ } else if ([appDelegate respondsToSelector:openURLWithOptionsSelector]) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunguarded-availability"
+ [appDelegate application:application openURL:url options:@{}];
+#pragma clang diagnostic pop
+
+ // Similarly, |application:openURL:sourceApplication:annotation:| will also always be called, due
+ // to the default swizzling done by FIRAAppDelegateProxy in Firebase Analytics
+ } else if ([appDelegate respondsToSelector:openURLWithSourceApplicationSelector]) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ [appDelegate application:application
+ openURL:url
+ sourceApplication:FIRMessagingAppIdentifier()
+ annotation:@{}];
+ } else if ([appDelegate respondsToSelector:handleOpenURLSelector]) {
+ [appDelegate application:application handleOpenURL:url];
+#pragma clang diagnostic pop
+ }
+}
+
+- (NSURL *)linkURLFromMessage:(NSDictionary *)message {
+ NSString *urlString = message[kFIRMessagingMessageLinkKey];
+ if (urlString == nil || ![urlString isKindOfClass:[NSString class]] || urlString.length == 0) {
+ return nil;
+ }
+ NSURL *url = [NSURL URLWithString:urlString];
+ return url;
+}
+
+#pragma mark - APNS
+
+- (NSData *)APNSToken {
+ return self.apnsTokenData;
+}
+
+- (void)setAPNSToken:(NSData *)APNSToken {
+ [self setAPNSToken:APNSToken type:FIRMessagingAPNSTokenTypeUnknown];
+}
+
+- (void)setAPNSToken:(NSData *)apnsToken type:(FIRMessagingAPNSTokenType)type {
+ if ([apnsToken isEqual:self.apnsTokenData]) {
+ return;
+ }
+ self.apnsTokenData = apnsToken;
+
+ // Notify InstanceID that APNS Token has been set.
+ NSDictionary *userInfo = @{kFIRMessagingAPNSTokenType : @(type)};
+ NSNotification *notification =
+ [NSNotification notificationWithName:kFIRMessagingAPNSTokenNotification
+ object:[apnsToken copy]
+ userInfo:userInfo];
+ [[NSNotificationQueue defaultQueue] enqueueNotification:notification postingStyle:NSPostASAP];
+}
+
+#pragma mark - FCM
+
+- (BOOL)isAutoInitEnabled {
+ // Check storage
+ id isAutoInitEnabledObject =
+ [_messagingUserDefaults objectForKey:kFIRMessagingUserDefaultsKeyAutoInitEnabled];
+ if (isAutoInitEnabledObject) {
+ return [isAutoInitEnabledObject boolValue];
+ }
+
+ // Check Info.plist
+ isAutoInitEnabledObject =
+ [[NSBundle mainBundle] objectForInfoDictionaryKey:kFIRMessagingPlistAutoInitEnabled];
+ if (isAutoInitEnabledObject) {
+ return [isAutoInitEnabledObject boolValue];
+ }
+
+ // If none of above exists, we default to the global switch that comes from FIRApp.
+ return [[FIRApp defaultApp] isDataCollectionDefaultEnabled];
+}
+
+- (void)setAutoInitEnabled:(BOOL)autoInitEnabled {
+ BOOL isFCMAutoInitEnabled = [self isAutoInitEnabled];
+ [_messagingUserDefaults setBool:autoInitEnabled
+ forKey:kFIRMessagingUserDefaultsKeyAutoInitEnabled];
+ [_messagingUserDefaults synchronize];
+ if (!isFCMAutoInitEnabled && autoInitEnabled) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ self.defaultFcmToken = self.instanceID.token;
+#pragma clang diagnostic pop
+ }
+}
+
+- (NSString *)FCMToken {
+ NSString *token = self.defaultFcmToken;
+ if (!token) {
+ // We may not have received it from Instance ID yet (via NSNotification), so extract it directly
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ token = self.instanceID.token;
+#pragma clang diagnostic pop
+ }
+ return token;
+}
+
+- (void)retrieveFCMTokenForSenderID:(nonnull NSString *)senderID
+ completion:(nonnull FIRMessagingFCMTokenFetchCompletion)completion {
+ if (!senderID.length) {
+ FIRMessagingLoggerError(kFIRMessagingMessageCodeSenderIDNotSuppliedForTokenFetch,
+ @"Sender ID not supplied. It is required for a token fetch, "
+ @"to identify the sender.");
+ if (completion) {
+ NSString *description = @"Couldn't fetch token because a Sender ID was not supplied. A valid "
+ @"Sender ID is required to fetch an FCM token";
+ NSError *error = [NSError fcm_errorWithCode:FIRMessagingErrorInvalidRequest
+ userInfo:@{NSLocalizedDescriptionKey : description}];
+ completion(nil, error);
+ }
+ return;
+ }
+ NSDictionary *options = nil;
+ if (self.APNSToken) {
+ options = @{kFIRMessagingFCMTokenFetchAPNSOption : self.APNSToken};
+ } else {
+ FIRMessagingLoggerWarn(kFIRMessagingMessageCodeAPNSTokenNotAvailableDuringTokenFetch,
+ @"APNS device token not set before retrieving FCM Token for Sender ID "
+ @"'%@'. Notifications to this FCM Token will not be delivered over APNS."
+ @"Be sure to re-retrieve the FCM token once the APNS device token is "
+ @"set.", senderID);
+ }
+ [self.instanceID tokenWithAuthorizedEntity:senderID
+ scope:kFIRMessagingDefaultTokenScope
+ options:options
+ handler:completion];
+}
+
+- (void)deleteFCMTokenForSenderID:(nonnull NSString *)senderID
+ completion:(nonnull FIRMessagingDeleteFCMTokenCompletion)completion {
+ if (!senderID.length) {
+ FIRMessagingLoggerError(kFIRMessagingMessageCodeSenderIDNotSuppliedForTokenDelete,
+ @"Sender ID not supplied. It is required to delete an FCM token.");
+ if (completion) {
+ NSString *description = @"Couldn't delete token because a Sender ID was not supplied. A "
+ @"valid Sender ID is required to delete an FCM token";
+ NSError *error = [NSError fcm_errorWithCode:FIRMessagingErrorInvalidRequest
+ userInfo:@{NSLocalizedDescriptionKey : description}];
+ completion(error);
+ }
+ return;
+ }
+ [self.instanceID deleteTokenWithAuthorizedEntity:senderID
+ scope:kFIRMessagingDefaultTokenScope
+ handler:completion];
+}
+
+#pragma mark - FIRMessagingDelegate helper methods
+- (void)setDelegate:(id)delegate {
+ _delegate = delegate;
+ [self validateDelegateConformsToTokenAvailabilityMethods];
+}
+
+// Check if the delegate conforms to |didReceiveRegistrationToken:|
+// and display a warning to the developer if not.
+// NOTE: Once |didReceiveRegistrationToken:| can be made a required method, this
+// check can be removed.
+- (void)validateDelegateConformsToTokenAvailabilityMethods {
+ if (self.delegate &&
+ ![self.delegate respondsToSelector:@selector(messaging:didReceiveRegistrationToken:)]) {
+ FIRMessagingLoggerWarn(kFIRMessagingMessageCodeTokenDelegateMethodsNotImplemented,
+ @"The object %@ does not respond to "
+ @"-messaging:didReceiveRegistrationToken:. Please implement "
+ @"-messaging:didReceiveRegistrationToken: to be provided with an FCM "
+ @"token.", self.delegate.description);
+ }
+}
+
+- (void)notifyDelegateOfFCMTokenAvailability {
+ __weak FIRMessaging *weakSelf = self;
+ if (![NSThread isMainThread]) {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [weakSelf notifyDelegateOfFCMTokenAvailability];
+ });
+ return;
+ }
+ if ([self.delegate respondsToSelector:@selector(messaging:didReceiveRegistrationToken:)]) {
+ [self.delegate messaging:self didReceiveRegistrationToken:self.defaultFcmToken];
+ }
+}
+
+#pragma mark - Application State Changes
+
+- (void)applicationStateChanged {
+ if (self.shouldEstablishDirectChannel) {
+ [self updateAutomaticClientConnection];
+ }
+}
+
+#pragma mark - Direct Channel
+
+- (void)setShouldEstablishDirectChannel:(BOOL)shouldEstablishDirectChannel {
+ if (_shouldEstablishDirectChannel == shouldEstablishDirectChannel) {
+ return;
+ }
+ _shouldEstablishDirectChannel = shouldEstablishDirectChannel;
+ [self updateAutomaticClientConnection];
+}
+
+- (BOOL)isDirectChannelEstablished {
+ return self.client.isConnectionActive;
+}
+
+- (BOOL)shouldBeConnectedAutomatically {
+ // We require a token from Instance ID
+ NSString *token = self.defaultFcmToken;
+ // Only on foreground connections
+ UIApplication *application = FIRMessagingUIApplication();
+ if (!application) {
+ return NO;
+ }
+ UIApplicationState applicationState = application.applicationState;
+ BOOL shouldBeConnected = _shouldEstablishDirectChannel &&
+ (token.length > 0) &&
+ applicationState == UIApplicationStateActive;
+ return shouldBeConnected;
+}
+
+- (void)updateAutomaticClientConnection {
+ if (![NSThread isMainThread]) {
+ // Call this method from the main thread
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [self updateAutomaticClientConnection];
+ });
+ return;
+ }
+ BOOL shouldBeConnected = [self shouldBeConnectedAutomatically];
+ if (shouldBeConnected && !self.client.isConnected) {
+ [self.client connectWithHandler:^(NSError *error) {
+ if (!error) {
+ // It means we connected. Fire connection change notification
+ [self notifyOfDirectChannelConnectionChange];
+ }
+ }];
+ } else if (!shouldBeConnected && self.client.isConnected) {
+ [self.client disconnect];
+ [self notifyOfDirectChannelConnectionChange];
+ }
+}
+
+- (void)notifyOfDirectChannelConnectionChange {
+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+ [center postNotificationName:FIRMessagingConnectionStateChangedNotification object:self];
+}
+
+#pragma mark - Connect
+
+- (void)connectWithCompletion:(FIRMessagingConnectCompletion)handler {
+ _FIRMessagingDevAssert([NSThread isMainThread],
+ @"FIRMessaging connect should be called from main thread only.");
+ _FIRMessagingDevAssert(self.isClientSetup, @"FIRMessaging client not setup.");
+ [self.client connectWithHandler:^(NSError *error) {
+ if (handler) {
+ handler(error);
+ }
+ if (!error) {
+ // It means we connected. Fire connection change notification
+ [self notifyOfDirectChannelConnectionChange];
+ }
+ }];
+
+}
+
+- (void)disconnect {
+ _FIRMessagingDevAssert([NSThread isMainThread],
+ @"FIRMessaging should be called from main thread only.");
+ if ([self.client isConnected]) {
+ [self.client disconnect];
+ [self notifyOfDirectChannelConnectionChange];
+ }
+}
+
+#pragma mark - Topics
+
++ (NSString *)normalizeTopic:(NSString *)topic {
+ if (!topic.length) {
+ return nil;
+ }
+ if (![FIRMessagingPubSub hasTopicsPrefix:topic]) {
+ topic = [FIRMessagingPubSub addPrefixToTopic:topic];
+ }
+ if ([FIRMessagingPubSub isValidTopicWithPrefix:topic]) {
+ return [topic copy];
+ }
+ return nil;
+}
+
+- (void)subscribeToTopic:(NSString *)topic {
+ [self subscribeToTopic:topic completion:nil];
+}
+
+- (void)subscribeToTopic:(NSString *)topic
+ completion:(nullable FIRMessagingTopicOperationCompletion)completion {
+ if ([FIRMessagingPubSub hasTopicsPrefix:topic]) {
+ FIRMessagingLoggerWarn(kFIRMessagingMessageCodeTopicFormatIsDeprecated,
+ @"Format '%@' is deprecated. Only '%@' should be used in "
+ @"subscribeToTopic.",
+ topic, [FIRMessagingPubSub removePrefixFromTopic:topic]);
+ }
+ if (!self.defaultFcmToken.length) {
+ FIRMessagingLoggerWarn(kFIRMessagingMessageCodeMessaging010,
+ @"The subscription operation is suspended because you don't have a "
+ @"token. The operation will resume once you get an FCM token.");
+ }
+ NSString *normalizeTopic = [[self class] normalizeTopic:topic];
+ if (normalizeTopic.length) {
+ [self.pubsub subscribeToTopic:normalizeTopic handler:completion];
+ return;
+ }
+ FIRMessagingLoggerError(kFIRMessagingMessageCodeMessaging009,
+ @"Cannot parse topic name %@. Will not subscribe.", topic);
+}
+
+- (void)unsubscribeFromTopic:(NSString *)topic {
+ [self unsubscribeFromTopic:topic completion:nil];
+}
+
+- (void)unsubscribeFromTopic:(NSString *)topic
+ completion:(nullable FIRMessagingTopicOperationCompletion)completion {
+ if ([FIRMessagingPubSub hasTopicsPrefix:topic]) {
+ FIRMessagingLoggerWarn(kFIRMessagingMessageCodeTopicFormatIsDeprecated,
+ @"Format '%@' is deprecated. Only '%@' should be used in "
+ @"unsubscribeFromTopic.",
+ topic, [FIRMessagingPubSub removePrefixFromTopic:topic]);
+ }
+ if (!self.defaultFcmToken.length) {
+ FIRMessagingLoggerWarn(kFIRMessagingMessageCodeMessaging012,
+ @"The unsubscription operation is suspended because you don't have a "
+ @"token. The operation will resume once you get an FCM token.");
+ }
+ NSString *normalizeTopic = [[self class] normalizeTopic:topic];
+ if (normalizeTopic.length) {
+ [self.pubsub unsubscribeFromTopic:normalizeTopic handler:completion];
+ return;
+ }
+ FIRMessagingLoggerError(kFIRMessagingMessageCodeMessaging011,
+ @"Cannot parse topic name %@. Will not unsubscribe.", topic);
+}
+
+#pragma mark - Send
+
+- (void)sendMessage:(NSDictionary *)message
+ to:(NSString *)to
+ withMessageID:(NSString *)messageID
+ timeToLive:(int64_t)ttl {
+ _FIRMessagingDevAssert([to length] != 0, @"Invalid receiver id for FIRMessaging-message");
+
+ NSMutableDictionary *fcmMessage = [[self class] createFIRMessagingMessageWithMessage:message
+ to:to
+ withID:messageID
+ timeToLive:ttl
+ delay:0];
+ FIRMessagingLoggerInfo(kFIRMessagingMessageCodeMessaging013, @"Sending message: %@ with id: %@",
+ message, messageID);
+ [self.dataMessageManager sendDataMessageStanza:fcmMessage];
+}
+
++ (NSMutableDictionary *)createFIRMessagingMessageWithMessage:(NSDictionary *)message
+ to:(NSString *)to
+ withID:(NSString *)msgID
+ timeToLive:(int64_t)ttl
+ delay:(int)delay {
+ NSMutableDictionary *fcmMessage = [NSMutableDictionary dictionary];
+ fcmMessage[kFIRMessagingSendTo] = [to copy];
+ fcmMessage[kFIRMessagingSendMessageID] = msgID ? [msgID copy] : @"";
+ fcmMessage[kFIRMessagingSendTTL] = @(ttl);
+ fcmMessage[kFIRMessagingSendDelay] = @(delay);
+ fcmMessage[KFIRMessagingSendMessageAppData] =
+ [NSMutableDictionary dictionaryWithDictionary:message];
+ return fcmMessage;
+}
+
+#pragma mark - IID dependencies
+
++ (NSString *)FIRMessagingSDKVersion {
+ return FIRMessagingCurrentLibraryVersion();
+}
+
++ (NSString *)FIRMessagingSDKCurrentLocale {
+ return [self currentLocale];
+}
+
+#pragma mark - FIRMessagingReceiverDelegate
+
+- (void)receiver:(FIRMessagingReceiver *)receiver
+ receivedRemoteMessage:(FIRMessagingRemoteMessage *)remoteMessage {
+ if ([self.delegate respondsToSelector:@selector(messaging:didReceiveMessage:)]) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunguarded-availability"
+ [self.delegate messaging:self didReceiveMessage:remoteMessage];
+#pragma pop
+ } else {
+ // Delegate methods weren't implemented, so messages are being dropped, log a warning
+ FIRMessagingLoggerWarn(kFIRMessagingMessageCodeRemoteMessageDelegateMethodNotImplemented,
+ @"FIRMessaging received data-message, but FIRMessagingDelegate's"
+ @"-messaging:didReceiveMessage: not implemented");
+ }
+}
+
+#pragma mark - GULReachabilityDelegate
+
+- (void)reachability:(GULReachabilityChecker *)reachability
+ statusChanged:(GULReachabilityStatus)status {
+ [self onNetworkStatusChanged];
+}
+
+#pragma mark - Network
+
+- (void)onNetworkStatusChanged {
+ if (![self.client isConnected] && [self isNetworkAvailable]) {
+ if (self.client.shouldStayConnected) {
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeMessaging014,
+ @"Attempting to establish direct channel.");
+ [self.client retryConnectionImmediately:YES];
+ }
+ [self.pubsub scheduleSync:YES];
+ }
+}
+
+- (BOOL)isNetworkAvailable {
+ GULReachabilityStatus status = self.reachability.reachabilityStatus;
+ return (status == kGULReachabilityViaCellular || status == kGULReachabilityViaWifi);
+}
+
+- (FIRMessagingNetworkStatus)networkType {
+ GULReachabilityStatus status = self.reachability.reachabilityStatus;
+ if (![self isNetworkAvailable]) {
+ return kFIRMessagingReachabilityNotReachable;
+ } else if (status == kGULReachabilityViaCellular) {
+ return kFIRMessagingReachabilityReachableViaWWAN;
+ } else {
+ return kFIRMessagingReachabilityReachableViaWiFi;
+ }
+}
+
+#pragma mark - Notifications
+
+- (void)didReceiveDefaultInstanceIDToken:(NSNotification *)notification {
+ if (notification.object && ![notification.object isKindOfClass:[NSString class]]) {
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeMessaging015,
+ @"Invalid default FCM token type %@",
+ NSStringFromClass([notification.object class]));
+ return;
+ }
+ NSString *oldToken = self.defaultFcmToken;
+ self.defaultFcmToken = [(NSString *)notification.object copy];
+ if (self.defaultFcmToken && ![self.defaultFcmToken isEqualToString:oldToken]) {
+ [self notifyDelegateOfFCMTokenAvailability];
+ }
+ [self.pubsub scheduleSync:YES];
+ if (self.shouldEstablishDirectChannel) {
+ [self updateAutomaticClientConnection];
+ }
+}
+
+- (void)defaultInstanceIDTokenWasRefreshed:(NSNotification *)notification {
+ // Retrieve the Instance ID default token, and if it is non-nil, post it
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ NSString *token = self.instanceID.token;
+#pragma clang diagnostic pop
+ // Sometimes Instance ID doesn't yet have a token, so wait until the default
+ // token is fetched, and then notify. This ensures that this token should not
+ // be nil when the developer accesses it.
+ if (token != nil) {
+ NSString *oldToken = self.defaultFcmToken;
+ self.defaultFcmToken = [token copy];
+ if (self.defaultFcmToken && ![self.defaultFcmToken isEqualToString:oldToken]) {
+ [self notifyDelegateOfFCMTokenAvailability];
+ }
+ NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
+ [center postNotificationName:FIRMessagingRegistrationTokenRefreshedNotification object:nil];
+ }
+}
+
+#pragma mark - Application Support Directory
+
++ (BOOL)hasApplicationSupportSubDirectory:(NSString *)subDirectoryName {
+ NSString *subDirectoryPath = [self pathForApplicationSupportSubDirectory:subDirectoryName];
+ BOOL isDirectory;
+ if (![[NSFileManager defaultManager] fileExistsAtPath:subDirectoryPath
+ isDirectory:&isDirectory]) {
+ return NO;
+ } else if (!isDirectory) {
+ return NO;
+ }
+ return YES;
+}
+
++ (NSString *)pathForApplicationSupportSubDirectory:(NSString *)subDirectoryName {
+ NSArray *directoryPaths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,
+ NSUserDomainMask, YES);
+ NSString *applicationSupportDirPath = directoryPaths.lastObject;
+ NSArray *components = @[applicationSupportDirPath, subDirectoryName];
+ return [NSString pathWithComponents:components];
+}
+
++ (BOOL)createApplicationSupportSubDirectory:(NSString *)subDirectoryName {
+ NSString *subDirectoryPath = [self pathForApplicationSupportSubDirectory:subDirectoryName];
+ BOOL hasSubDirectory;
+
+ if (![[NSFileManager defaultManager] fileExistsAtPath:subDirectoryPath
+ isDirectory:&hasSubDirectory]) {
+ NSError *error;
+ [[NSFileManager defaultManager] createDirectoryAtPath:subDirectoryPath
+ withIntermediateDirectories:YES
+ attributes:nil
+ error:&error];
+ if (error) {
+ FIRMessagingLoggerError(kFIRMessagingMessageCodeMessaging017,
+ @"Cannot create directory %@, error: %@", subDirectoryPath, error);
+ return NO;
+ }
+ } else {
+ if (!hasSubDirectory) {
+ FIRMessagingLoggerError(kFIRMessagingMessageCodeMessaging018,
+ @"Found file instead of directory at %@", subDirectoryPath);
+ return NO;
+ }
+ }
+ return YES;
+}
+
+#pragma mark - Locales
+
++ (NSString *)currentLocale {
+ NSArray *locales = [self firebaseLocales];
+ NSArray *preferredLocalizations =
+ [NSBundle preferredLocalizationsFromArray:locales
+ forPreferences:[NSLocale preferredLanguages]];
+ NSString *legalDocsLanguage = [preferredLocalizations firstObject];
+ // Use en as the default language
+ return legalDocsLanguage ? legalDocsLanguage : @"en";
+}
+
++ (NSArray *)firebaseLocales {
+ NSMutableArray *locales = [NSMutableArray array];
+ NSDictionary *localesMap = [self firebaselocalesMap];
+ for (NSString *key in localesMap) {
+ [locales addObjectsFromArray:localesMap[key]];
+ }
+ return locales;
+}
+
++ (NSDictionary *)firebaselocalesMap {
+ return @{
+ // Albanian
+ @"sq" : @[ @"sq_AL" ],
+ // Belarusian
+ @"be" : @[ @"be_BY" ],
+ // Bulgarian
+ @"bg" : @[ @"bg_BG" ],
+ // Catalan
+ @"ca" : @[ @"ca", @"ca_ES" ],
+ // Croatian
+ @"hr" : @[ @"hr", @"hr_HR" ],
+ // Czech
+ @"cs" : @[ @"cs", @"cs_CZ" ],
+ // Danish
+ @"da" : @[ @"da", @"da_DK" ],
+ // Estonian
+ @"et" : @[ @"et_EE" ],
+ // Finnish
+ @"fi" : @[ @"fi", @"fi_FI" ],
+ // Hebrew
+ @"he" : @[ @"he", @"iw_IL" ],
+ // Hindi
+ @"hi" : @[ @"hi_IN" ],
+ // Hungarian
+ @"hu" : @[ @"hu", @"hu_HU" ],
+ // Icelandic
+ @"is" : @[ @"is_IS" ],
+ // Indonesian
+ @"id" : @[ @"id", @"in_ID", @"id_ID" ],
+ // Irish
+ @"ga" : @[ @"ga_IE" ],
+ // Korean
+ @"ko" : @[ @"ko", @"ko_KR", @"ko-KR" ],
+ // Latvian
+ @"lv" : @[ @"lv_LV" ],
+ // Lithuanian
+ @"lt" : @[ @"lt_LT" ],
+ // Macedonian
+ @"mk" : @[ @"mk_MK" ],
+ // Malay
+ @"ms" : @[ @"ms_MY" ],
+ // Maltese
+ @"ms" : @[ @"mt_MT" ],
+ // Polish
+ @"pl" : @[ @"pl", @"pl_PL", @"pl-PL" ],
+ // Romanian
+ @"ro" : @[ @"ro", @"ro_RO" ],
+ // Russian
+ @"ru" : @[ @"ru_RU", @"ru", @"ru_BY", @"ru_KZ", @"ru-RU" ],
+ // Slovak
+ @"sk" : @[ @"sk", @"sk_SK" ],
+ // Slovenian
+ @"sl" : @[ @"sl_SI" ],
+ // Swedish
+ @"sv" : @[ @"sv", @"sv_SE", @"sv-SE" ],
+ // Turkish
+ @"tr" : @[ @"tr", @"tr-TR", @"tr_TR" ],
+ // Ukrainian
+ @"uk" : @[ @"uk", @"uk_UA" ],
+ // Vietnamese
+ @"vi" : @[ @"vi", @"vi_VN" ],
+ // The following are groups of locales or locales that sub-divide a
+ // language).
+ // Arabic
+ @"ar" : @[
+ @"ar",
+ @"ar_DZ",
+ @"ar_BH",
+ @"ar_EG",
+ @"ar_IQ",
+ @"ar_JO",
+ @"ar_KW",
+ @"ar_LB",
+ @"ar_LY",
+ @"ar_MA",
+ @"ar_OM",
+ @"ar_QA",
+ @"ar_SA",
+ @"ar_SD",
+ @"ar_SY",
+ @"ar_TN",
+ @"ar_AE",
+ @"ar_YE",
+ @"ar_GB",
+ @"ar-IQ",
+ @"ar_US"
+ ],
+ // Simplified Chinese
+ @"zh_Hans" : @[ @"zh_CN", @"zh_SG", @"zh-Hans" ],
+ // Traditional Chinese
+ @"zh_Hant" : @[ @"zh_HK", @"zh_TW", @"zh-Hant", @"zh-HK", @"zh-TW" ],
+ // Dutch
+ @"nl" : @[ @"nl", @"nl_BE", @"nl_NL", @"nl-NL" ],
+ // English
+ @"en" : @[
+ @"en",
+ @"en_AU",
+ @"en_CA",
+ @"en_IN",
+ @"en_IE",
+ @"en_MT",
+ @"en_NZ",
+ @"en_PH",
+ @"en_SG",
+ @"en_ZA",
+ @"en_GB",
+ @"en_US",
+ @"en_AE",
+ @"en-AE",
+ @"en_AS",
+ @"en-AU",
+ @"en_BD",
+ @"en-CA",
+ @"en_EG",
+ @"en_ES",
+ @"en_GB",
+ @"en-GB",
+ @"en_HK",
+ @"en_ID",
+ @"en-IN",
+ @"en_NG",
+ @"en-PH",
+ @"en_PK",
+ @"en-SG",
+ @"en-US"
+ ],
+ // French
+
+ @"fr" : @[
+ @"fr",
+ @"fr_BE",
+ @"fr_CA",
+ @"fr_FR",
+ @"fr_LU",
+ @"fr_CH",
+ @"fr-CA",
+ @"fr-FR",
+ @"fr_MA"
+ ],
+ // German
+ @"de" : @[ @"de", @"de_AT", @"de_DE", @"de_LU", @"de_CH", @"de-DE" ],
+ // Greek
+ @"el" : @[ @"el", @"el_CY", @"el_GR" ],
+ // Italian
+ @"it" : @[ @"it", @"it_IT", @"it_CH", @"it-IT" ],
+ // Japanese
+ @"ja" : @[ @"ja", @"ja_JP", @"ja_JP_JP", @"ja-JP" ],
+ // Norwegian
+ @"no" : @[ @"nb", @"no_NO", @"no_NO_NY", @"nb_NO" ],
+ // Brazilian Portuguese
+ @"pt_BR" : @[ @"pt_BR", @"pt-BR" ],
+ // European Portuguese
+ @"pt_PT" : @[ @"pt", @"pt_PT", @"pt-PT" ],
+ // Serbian
+ @"sr" : @[
+ @"sr_BA",
+ @"sr_ME",
+ @"sr_RS",
+ @"sr_Latn_BA",
+ @"sr_Latn_ME",
+ @"sr_Latn_RS"
+ ],
+ // European Spanish
+ @"es_ES" : @[ @"es", @"es_ES", @"es-ES" ],
+ // Mexican Spanish
+ @"es_MX" : @[ @"es-MX", @"es_MX", @"es_US", @"es-US" ],
+ // Latin American Spanish
+ @"es_419" : @[
+ @"es_AR",
+ @"es_BO",
+ @"es_CL",
+ @"es_CO",
+ @"es_CR",
+ @"es_DO",
+ @"es_EC",
+ @"es_SV",
+ @"es_GT",
+ @"es_HN",
+ @"es_NI",
+ @"es_PA",
+ @"es_PY",
+ @"es_PE",
+ @"es_PR",
+ @"es_UY",
+ @"es_VE",
+ @"es-AR",
+ @"es-CL",
+ @"es-CO"
+ ],
+ // Thai
+ @"th" : @[ @"th", @"th_TH", @"th_TH_TH" ],
+ };
+}
+
+@end
diff --git a/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingCheckinService.h b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingCheckinService.h
new file mode 100644
index 0000000..155143a
--- /dev/null
+++ b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingCheckinService.h
@@ -0,0 +1,53 @@
+/*
+ * 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
+
+/**
+ * Register the device with Checkin Service and get back the `authID`, `secret token` etc. for the
+ * client. Checkin results are cached in the `FIRMessagingDefaultsManager` and periodically refreshed to
+ * prevent them from being stale. Each client needs to register with checkin before registering
+ * with FIRMessaging.
+ */
+@interface FIRMessagingCheckinService : NSObject
+
+@property(nonatomic, readonly, strong) NSString *deviceAuthID;
+@property(nonatomic, readonly, strong) NSString *secretToken;
+@property(nonatomic, readonly, strong) NSString *versionInfo;
+@property(nonatomic, readonly, assign) BOOL hasValidCheckinInfo;
+
+/**
+ * Verify if valid checkin preferences have been loaded in memory.
+ *
+ * @return YES if valid checkin preferences exist in memory else NO.
+ */
+- (BOOL)hasValidCheckinInfo;
+
+/**
+ * Try to load prefetched checkin preferences from the cache. This supports the use case where
+ * InstanceID library has already obtained a valid checkin and we should be using that.
+ *
+ * This should be used as a last gasp effort to retreive any cached checkin preferences before
+ * hitting the FIRMessaging backend to retrieve new preferences.
+ *
+ * Note this is only required because InstanceID and FIRMessaging both require checkin preferences which
+ * need to be synced with each other.
+ *
+ * @return YES if successfully loaded cached checkin preferences into memory else NO.
+ */
+- (BOOL)tryToLoadPrefetchedCheckinPreferences;
+
+@end
diff --git a/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingCheckinService.m b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingCheckinService.m
new file mode 100644
index 0000000..9dad847
--- /dev/null
+++ b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingCheckinService.m
@@ -0,0 +1,132 @@
+/*
+ * 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 "FIRMessagingCheckinService.h"
+
+#import "FIRMessagingUtilities.h"
+#import "NSError+FIRMessaging.h"
+
+@interface FIRMessagingCheckinService ()
+
+// This property is of type FIRInstanceIDCheckinPreferences, if InstanceID was directly linkable
+@property(nonatomic, readwrite, strong) id checkinPreferences;
+
+@end
+
+@implementation FIRMessagingCheckinService;
+
+#pragma mark - Reflection-Based Getter Functions
+
+// Encapsulates the -hasValidCheckinInfo method of FIRInstanceIDCheckinPreferences
+BOOL FIRMessagingCheckinService_hasValidCheckinInfo(id checkinPreferences) {
+ SEL hasValidCheckinInfoSelector = NSSelectorFromString(@"hasValidCheckinInfo");
+ if (![checkinPreferences respondsToSelector:hasValidCheckinInfoSelector]) {
+ // Can't check hasValidCheckinInfo
+ return NO;
+ }
+
+ // Since hasValidCheckinInfo returns a BOOL, use NSInvocation
+ NSMethodSignature *methodSignature =
+ [[checkinPreferences class] instanceMethodSignatureForSelector:hasValidCheckinInfoSelector];
+ NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:methodSignature];
+ invocation.selector = hasValidCheckinInfoSelector;
+ invocation.target = checkinPreferences;
+ [invocation invoke];
+ BOOL returnValue;
+ [invocation getReturnValue:&returnValue];
+ return returnValue;
+}
+
+// Returns a non-scalar (id) object based on the property name
+id FIRMessagingCheckinService_propertyNamed(id checkinPreferences, NSString *propertyName) {
+ SEL propertyGetterSelector = NSSelectorFromString(propertyName);
+ if ([checkinPreferences respondsToSelector:propertyGetterSelector]) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
+ return [checkinPreferences performSelector:propertyGetterSelector];
+#pragma clang diagnostic pop
+ }
+ return nil;
+}
+
+#pragma mark - Methods
+
+- (BOOL)tryToLoadPrefetchedCheckinPreferences {
+ Class instanceIDClass = NSClassFromString(@"FIRInstanceID");
+ if (!instanceIDClass) {
+ // InstanceID is not linked
+ return NO;
+ }
+
+ // [FIRInstanceID instanceID]
+ SEL instanceIDSelector = NSSelectorFromString(@"instanceID");
+ if (![instanceIDClass respondsToSelector:instanceIDSelector]) {
+ return NO;
+ }
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
+ id instanceID = [instanceIDClass performSelector:instanceIDSelector];
+#pragma clang diagnostic pop
+ if (!instanceID) {
+ // Instance ID singleton not available
+ return NO;
+ }
+
+ // [[FIRInstanceID instanceID] cachedCheckinPreferences]
+ SEL cachedCheckinPrefsSelector = NSSelectorFromString(@"cachedCheckinPreferences");
+ if (![instanceID respondsToSelector:cachedCheckinPrefsSelector]) {
+ // cachedCheckinPreferences is not accessible
+ return NO;
+ }
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
+ id checkinPreferences = [instanceID performSelector:cachedCheckinPrefsSelector];
+#pragma clang diagnostic pop
+ if (!checkinPreferences) {
+ // No cached checkin prefs
+ return NO;
+ }
+
+ BOOL hasValidInfo = FIRMessagingCheckinService_hasValidCheckinInfo(checkinPreferences);
+ if (hasValidInfo) {
+ self.checkinPreferences = checkinPreferences;
+ }
+ return hasValidInfo;
+}
+
+#pragma mark - API
+
+- (NSString *)deviceAuthID {
+ return FIRMessagingCheckinService_propertyNamed(self.checkinPreferences, @"deviceID");
+}
+
+- (NSString *)secretToken {
+ return FIRMessagingCheckinService_propertyNamed(self.checkinPreferences, @"secretToken");
+}
+
+- (NSString *)versionInfo {
+ return FIRMessagingCheckinService_propertyNamed(self.checkinPreferences, @"versionInfo");
+}
+
+- (NSString *)digest {
+ return FIRMessagingCheckinService_propertyNamed(self.checkinPreferences, @"digest");
+}
+
+- (BOOL)hasValidCheckinInfo {
+ return FIRMessagingCheckinService_hasValidCheckinInfo(self.checkinPreferences);
+}
+
+@end
diff --git a/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingClient.h b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingClient.h
new file mode 100644
index 0000000..98337a3
--- /dev/null
+++ b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingClient.h
@@ -0,0 +1,156 @@
+/*
+ * 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 "FIRMessaging.h"
+
+@class GULReachabilityChecker;
+@class GPBMessage;
+
+@class FIRMessagingConnection;
+@class FIRMessagingDataMessageManager;
+@class FIRMessagingRmqManager;
+
+/**
+ * Callback to handle MCS connection requests.
+ *
+ * @param error The error object if any while trying to connect with MCS else nil.
+ */
+typedef void(^FIRMessagingConnectCompletionHandler)(NSError *error);
+
+@protocol FIRMessagingClientDelegate
+
+@end
+
+/**
+ * The client handles the subscribe/unsubscribe for an unregistered senderID
+ * and device. It also manages the FIRMessaging data connection, the exponential backoff
+ * algorithm in case of registration failures, sign in failures and unregister
+ * failures. It also handles the reconnect logic if the FIRMessaging connection is
+ * broken off by some error during an active session.
+ */
+@interface FIRMessagingClient : NSObject
+
+@property(nonatomic, readonly, strong) FIRMessagingConnection *connection;
+@property(nonatomic, readwrite, weak) FIRMessagingDataMessageManager *dataMessageManager;
+
+// Designated initializer
+- (instancetype)initWithDelegate:(id)delegate
+ reachability:(GULReachabilityChecker *)reachability
+ rmq2Manager:(FIRMessagingRmqManager *)rmq2Manager;
+
+- (void)teardown;
+
+- (void)cancelAllRequests;
+
+#pragma mark - FIRMessaging subscribe
+
+/**
+ * Update the subscription associated with the given token and topic.
+ *
+ * For a to-be-created subscription we check if the client is already
+ * subscribed to the topic or not. If subscribed we should have the
+ * subscriptionID in the cache and we return from there itself, else we call
+ * the FIRMessaging backend to create a new subscription for the topic for this client.
+ *
+ * For delete subscription requests we delete the stored subscription in the
+ * client and then invoke the FIRMessaging backend to delete the existing subscription
+ * completely.
+ *
+ * @param token The token associated with the device.
+ * @param topic The topic for which the subscription should be updated.
+ * @param options The options to be passed in to the subscription request.
+ * @param shouldDelete If YES this would delete the subscription from the cache
+ * and also let the FIRMessaging backend know that we need to delete
+ * the subscriptionID associated with this topic.
+ * If NO we try to create a new subscription for the given
+ * token and topic.
+ * @param handler The handler to invoke once the subscription request
+ * finishes.
+ */
+- (void)updateSubscriptionWithToken:(NSString *)token
+ topic:(NSString *)topic
+ options:(NSDictionary *)options
+ shouldDelete:(BOOL)shouldDelete
+ handler:(FIRMessagingTopicOperationCompletion)handler;
+
+#pragma mark - MCS Connection
+
+/**
+ * Create a MCS connection.
+ *
+ * @param handler The handler to be invokend once the connection is setup. If
+ * setting up the connection fails we invoke the handler with
+ * an appropriate error object.
+ */
+- (void)connectWithHandler:(FIRMessagingConnectCompletionHandler)handler;
+
+/**
+ * Disconnect the current MCS connection. If there is no valid connection this
+ * should be a NO-OP.
+ */
+- (void)disconnect;
+
+#pragma mark - MCS Connection State
+
+/**
+ * If we are connected to MCS or not. This doesn't take into account the fact if
+ * the client has been signed in(verified) by MCS.
+ *
+ * @return YES if we are signed in or connecting and trying to sign-in else NO.
+ */
+@property(nonatomic, readonly) BOOL isConnected;
+
+/**
+ * If we have an active MCS connection
+ *
+ * @return YES if we have an active MCS connection else NO.
+ */
+@property(nonatomic, readonly) BOOL isConnectionActive;
+
+/**
+ * If we should be connected to MCS
+ *
+ * @return YES if we have attempted a connection and not requested to disconect.
+ */
+@property(nonatomic, readonly) BOOL shouldStayConnected;
+
+/**
+ * Schedule a retry to connect to MCS. If `immediately` is `YES` try to
+ * schedule a retry now else retry with some delay.
+ *
+ * @param immediately Should retry right now.
+ */
+- (void)retryConnectionImmediately:(BOOL)immediately;
+
+#pragma mark - Messages
+
+/**
+ * Send a message over the MCS connection.
+ *
+ * @param message Message to be sent.
+ */
+- (void)sendMessage:(GPBMessage *)message;
+
+/**
+ * Send message if we have an active MCS connection. If not cache the message
+ * for this session and in case we are able to re-establish the connection try
+ * again else drop it. This should only be used for TTL=0 messages for now.
+ *
+ * @param message Message to be sent.
+ */
+- (void)sendOnConnectOrDrop:(GPBMessage *)message;
+
+@end
diff --git a/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingClient.m b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingClient.m
new file mode 100644
index 0000000..9d8c558
--- /dev/null
+++ b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingClient.m
@@ -0,0 +1,506 @@
+/*
+ * 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 "FIRMessagingClient.h"
+
+#import
+
+#import "FIRMessaging.h"
+#import "FIRMessagingConnection.h"
+#import "FIRMessagingConstants.h"
+#import "FIRMessagingDataMessageManager.h"
+#import "FIRMessagingDefines.h"
+#import "FIRMessagingLogger.h"
+#import "FIRMessagingRegistrar.h"
+#import "FIRMessagingRmqManager.h"
+#import "FIRMessagingTopicsCommon.h"
+#import "FIRMessagingUtilities.h"
+#import "NSError+FIRMessaging.h"
+
+static const NSTimeInterval kConnectTimeoutInterval = 40.0;
+static const NSTimeInterval kReconnectDelayInSeconds = 2 * 60; // 2 minutes
+
+static const NSUInteger kMaxRetryExponent = 10; // 2^10 = 1024 seconds ~= 17 minutes
+
+static NSString *const kFIRMessagingMCSServerHost = @"mtalk.google.com";
+static NSUInteger const kFIRMessagingMCSServerPort = 5228;
+
+// register device with checkin
+typedef void(^FIRMessagingRegisterDeviceHandler)(NSError *error);
+
+static NSString *FIRMessagingServerHost() {
+ static NSString *serverHost = nil;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ NSDictionary *environment = [[NSProcessInfo processInfo] environment];
+ NSString *customServerHostAndPort = environment[@"FCM_MCS_HOST"];
+ NSString *host = [customServerHostAndPort componentsSeparatedByString:@":"].firstObject;
+ if (host) {
+ serverHost = host;
+ } else {
+ serverHost = kFIRMessagingMCSServerHost;
+ }
+ });
+ return serverHost;
+}
+
+static NSUInteger FIRMessagingServerPort() {
+ static NSUInteger serverPort = kFIRMessagingMCSServerPort;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ NSDictionary *environment = [[NSProcessInfo processInfo] environment];
+ NSString *customServerHostAndPort = environment[@"FCM_MCS_HOST"];
+ NSArray *components = [customServerHostAndPort componentsSeparatedByString:@":"];
+ NSUInteger port = (NSUInteger)[components.lastObject integerValue];
+ if (port != 0) {
+ serverPort = port;
+ }
+ });
+ return serverPort;
+}
+
+@interface FIRMessagingClient ()
+
+@property(nonatomic, readwrite, weak) id clientDelegate;
+@property(nonatomic, readwrite, strong) FIRMessagingConnection *connection;
+@property(nonatomic, readwrite, strong) FIRMessagingRegistrar *registrar;
+
+@property(nonatomic, readwrite, strong) NSString *senderId;
+
+// FIRMessagingService owns these instances
+@property(nonatomic, readwrite, weak) FIRMessagingRmqManager *rmq2Manager;
+@property(nonatomic, readwrite, weak) GULReachabilityChecker *reachability;
+
+@property(nonatomic, readwrite, assign) int64_t lastConnectedTimestamp;
+@property(nonatomic, readwrite, assign) int64_t lastDisconnectedTimestamp;
+@property(nonatomic, readwrite, assign) NSUInteger connectRetryCount;
+
+// Should we stay connected to MCS or not. Should be YES throughout the lifetime
+// of a MCS connection. If set to NO it signifies that an existing MCS connection
+// should be disconnected.
+@property(nonatomic, readwrite, assign) BOOL stayConnected;
+@property(nonatomic, readwrite, assign) NSTimeInterval connectionTimeoutInterval;
+
+// Used if the MCS connection suddenly breaksdown in the middle and we want to reconnect
+// with some permissible delay we schedule a reconnect and set it to YES and when it's
+// scheduled this will be set back to NO.
+@property(nonatomic, readwrite, assign) BOOL didScheduleReconnect;
+
+// handlers
+@property(nonatomic, readwrite, copy) FIRMessagingConnectCompletionHandler connectHandler;
+
+@end
+
+@implementation FIRMessagingClient
+
+- (instancetype)init {
+ FIRMessagingInvalidateInitializer();
+}
+
+- (instancetype)initWithDelegate:(id)delegate
+ reachability:(GULReachabilityChecker *)reachability
+ rmq2Manager:(FIRMessagingRmqManager *)rmq2Manager {
+ self = [super init];
+ if (self) {
+ _reachability = reachability;
+ _clientDelegate = delegate;
+ _rmq2Manager = rmq2Manager;
+ _registrar = [[FIRMessagingRegistrar alloc] init];
+ _connectionTimeoutInterval = kConnectTimeoutInterval;
+ // Listen for checkin fetch notifications, as connecting to MCS may have failed due to
+ // missing checkin info (while it was being fetched).
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(checkinFetched:)
+ name:kFIRMessagingCheckinFetchedNotification
+ object:nil];
+ }
+ return self;
+}
+
+- (void)teardown {
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeClient000, @"");
+ self.stayConnected = NO;
+
+ // Clear all the handlers
+ self.connectHandler = nil;
+
+ [self.connection teardown];
+
+ // Stop all subscription requests
+ [self.registrar cancelAllRequests];
+
+ _FIRMessagingDevAssert(self.connection.state == kFIRMessagingConnectionNotConnected, @"Did not disconnect");
+ [NSObject cancelPreviousPerformRequestsWithTarget:self];
+
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
+- (void)cancelAllRequests {
+ // Stop any checkin requests or any subscription requests
+ [self.registrar cancelAllRequests];
+
+ // Stop any future connection requests to MCS
+ if (self.stayConnected && self.isConnected && !self.isConnectionActive) {
+ self.stayConnected = NO;
+ [NSObject cancelPreviousPerformRequestsWithTarget:self];
+ }
+}
+
+#pragma mark - FIRMessaging subscribe
+
+- (void)updateSubscriptionWithToken:(NSString *)token
+ topic:(NSString *)topic
+ options:(NSDictionary *)options
+ shouldDelete:(BOOL)shouldDelete
+ handler:(FIRMessagingTopicOperationCompletion)handler {
+
+ _FIRMessagingDevAssert(handler != nil, @"Invalid handler to FIRMessaging subscribe");
+
+ FIRMessagingTopicOperationCompletion completion = ^void(NSError *error) {
+ if (error) {
+ FIRMessagingLoggerError(kFIRMessagingMessageCodeClient001, @"Failed to subscribe to topic %@",
+ error);
+ } else {
+ if (shouldDelete) {
+ FIRMessagingLoggerInfo(kFIRMessagingMessageCodeClient002,
+ @"Successfully unsubscribed from topic %@", topic);
+ } else {
+ FIRMessagingLoggerInfo(kFIRMessagingMessageCodeClient003,
+ @"Successfully subscribed to topic %@", topic);
+ }
+ }
+ handler(error);
+ };
+
+ [self.registrar updateSubscriptionToTopic:topic
+ withToken:token
+ options:options
+ shouldDelete:shouldDelete
+ handler:completion];
+}
+
+#pragma mark - MCS Connection
+
+- (BOOL)isConnected {
+ return self.stayConnected && self.connection.state != kFIRMessagingConnectionNotConnected;
+}
+
+- (BOOL)isConnectionActive {
+ return self.stayConnected && self.connection.state == kFIRMessagingConnectionSignedIn;
+}
+
+- (BOOL)shouldStayConnected {
+ return self.stayConnected;
+}
+
+- (void)retryConnectionImmediately:(BOOL)immediately {
+ // Do not connect to an invalid host or an invalid port
+ if (!self.stayConnected || !self.connection.host || self.connection.port == 0) {
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeClient004,
+ @"FIRMessaging connection will not reconnect to MCS. "
+ @"Stay connected: %d",
+ self.stayConnected);
+ return;
+ }
+ if (self.isConnectionActive) {
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeClient005,
+ @"FIRMessaging Connection skip retry, active");
+ // already connected and logged in.
+ // Heartbeat alarm is set and will force close the connection
+ return;
+ }
+ if (self.isConnected) {
+ // already connected and logged in.
+ // Heartbeat alarm is set and will force close the connection
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeClient006,
+ @"FIRMessaging Connection skip retry, connected");
+ return;
+ }
+
+ if (immediately) {
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeClient007,
+ @"Try to connect to MCS immediately");
+ [self tryToConnect];
+ } else {
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeClient008, @"Try to connect to MCS lazily");
+ // Avoid all the other logic that we have in other clients, since this would always happen
+ // when the app is in the foreground and since the FIRMessaging connection isn't shared with any other
+ // app we can be more aggressive in reconnections
+ if (!self.didScheduleReconnect) {
+ FIRMessaging_WEAKIFY(self);
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW,
+ (int64_t)(kReconnectDelayInSeconds * NSEC_PER_SEC)),
+ dispatch_get_main_queue(), ^{
+ FIRMessaging_STRONGIFY(self);
+ self.didScheduleReconnect = NO;
+ [self tryToConnect];
+ });
+
+ self.didScheduleReconnect = YES;
+ }
+ }
+}
+
+- (void)connectWithHandler:(FIRMessagingConnectCompletionHandler)handler {
+ if (self.isConnected) {
+ NSError *error = [NSError fcm_errorWithCode:kFIRMessagingErrorCodeAlreadyConnected
+ userInfo:@{
+ NSLocalizedFailureReasonErrorKey: @"FIRMessaging is already connected",
+ }];
+ handler(error);
+ return;
+ }
+ self.lastDisconnectedTimestamp = FIRMessagingCurrentTimestampInMilliseconds();
+ self.connectHandler = handler;
+ [self connect];
+}
+
+- (void)connect {
+ // reset retry counts
+ self.connectRetryCount = 0;
+
+ if (self.isConnected) {
+ return;
+ }
+
+ self.stayConnected = YES;
+ if (![self.registrar tryToLoadValidCheckinInfo]) {
+ // Checkin info is not available. This may be due to the checkin still being fetched.
+ if (self.connectHandler) {
+ NSError *error = [NSError errorWithFCMErrorCode:kFIRMessagingErrorCodeMissingDeviceID];
+ self.connectHandler(error);
+ }
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeClient009,
+ @"Failed to connect to MCS. No deviceID and secret found.");
+ // Return for now. If checkin is, in fact, retrieved, the
+ // |kFIRMessagingCheckinFetchedNotification| will be fired.
+ return;
+ }
+ [self setupConnectionAndConnect];
+}
+
+- (void)disconnect {
+ // user called disconnect
+ // We don't want to connect later even if no network is available.
+ [self disconnectWithTryToConnectLater:NO];
+}
+
+/**
+ * Disconnect the current client connection. Also explicitly stop and connction retries.
+ *
+ * @param tryToConnectLater If YES will try to connect later when sending upstream messages
+ * else if NO do not connect again until user explicitly calls
+ * connect.
+ */
+- (void)disconnectWithTryToConnectLater:(BOOL)tryToConnectLater {
+
+ self.stayConnected = tryToConnectLater;
+ [self.connection signOut];
+ _FIRMessagingDevAssert(self.connection.state == kFIRMessagingConnectionNotConnected,
+ @"FIRMessaging connection did not disconnect");
+
+ // since we can disconnect while still trying to establish the connection it's required to
+ // cancel all performSelectors else the object might be retained
+ [NSObject cancelPreviousPerformRequestsWithTarget:self
+ selector:@selector(tryToConnect)
+ object:nil];
+ [NSObject cancelPreviousPerformRequestsWithTarget:self
+ selector:@selector(didConnectTimeout)
+ object:nil];
+ self.connectHandler = nil;
+}
+
+#pragma mark - Checkin Notification
+- (void)checkinFetched:(NSNotification *)notification {
+ // A failed checkin may have been the reason for the connection failure. Attempt a connection
+ // if the checkin fetched notification is fired.
+ if (self.stayConnected && !self.isConnected) {
+ [self connect];
+ }
+}
+
+#pragma mark - Messages
+
+- (void)sendMessage:(GPBMessage *)message {
+ [self.connection sendProto:message];
+}
+
+- (void)sendOnConnectOrDrop:(GPBMessage *)message {
+ [self.connection sendOnConnectOrDrop:message];
+}
+
+#pragma mark - FIRMessagingConnectionDelegate
+
+- (void)connection:(FIRMessagingConnection *)fcmConnection
+ didCloseForReason:(FIRMessagingConnectionCloseReason)reason {
+
+ self.lastDisconnectedTimestamp = FIRMessagingCurrentTimestampInMilliseconds();
+
+ if (reason == kFIRMessagingConnectionCloseReasonSocketDisconnected) {
+ // Cancel the not-yet-triggered timeout task before rescheduling, in case the previous sign in
+ // failed, due to a connection error caused by bad network.
+ [NSObject cancelPreviousPerformRequestsWithTarget:self
+ selector:@selector(didConnectTimeout)
+ object:nil];
+ }
+ if (self.stayConnected) {
+ [self scheduleConnectRetry];
+ }
+}
+
+- (void)didLoginWithConnection:(FIRMessagingConnection *)fcmConnection {
+ // Cancel the not-yet-triggered timeout task.
+ [NSObject cancelPreviousPerformRequestsWithTarget:self
+ selector:@selector(didConnectTimeout)
+ object:nil];
+ self.connectRetryCount = 0;
+ self.lastConnectedTimestamp = FIRMessagingCurrentTimestampInMilliseconds();
+
+
+ [self.dataMessageManager setDeviceAuthID:self.registrar.deviceAuthID
+ secretToken:self.registrar.secretToken];
+ if (self.connectHandler) {
+ self.connectHandler(nil);
+ // notified the third party app with the registrationId.
+ // we don't want them to know about the connection status and how it changes
+ // so remove this handler
+ self.connectHandler = nil;
+ }
+}
+
+- (void)connectionDidRecieveMessage:(GtalkDataMessageStanza *)message {
+ NSDictionary *parsedMessage = [self.dataMessageManager processPacket:message];
+ if ([parsedMessage count]) {
+ [self.dataMessageManager didReceiveParsedMessage:parsedMessage];
+ }
+}
+
+- (int)connectionDidReceiveAckForRmqIds:(NSArray *)rmqIds {
+ NSSet *rmqIDSet = [NSSet setWithArray:rmqIds];
+ NSMutableArray *messagesSent = [NSMutableArray arrayWithCapacity:rmqIds.count];
+ [self.rmq2Manager scanWithRmqMessageHandler:nil
+ dataMessageHandler:^(int64_t rmqId, GtalkDataMessageStanza *stanza) {
+ NSString *rmqIdString = [NSString stringWithFormat:@"%lld", rmqId];
+ if ([rmqIDSet containsObject:rmqIdString]) {
+ [messagesSent addObject:stanza];
+ }
+ }];
+ for (GtalkDataMessageStanza *message in messagesSent) {
+ [self.dataMessageManager didSendDataMessageStanza:message];
+ }
+ return [self.rmq2Manager removeRmqMessagesWithRmqIds:rmqIds];
+}
+
+#pragma mark - Private
+
+- (void)setupConnectionAndConnect {
+ [self setupConnection];
+ [self tryToConnect];
+}
+
+- (void)setupConnection {
+ NSString *host = FIRMessagingServerHost();
+ NSUInteger port = FIRMessagingServerPort();
+ _FIRMessagingDevAssert([host length] > 0 && port != 0, @"Invalid port or host");
+
+ if (self.connection != nil) {
+ // if there is an old connection, explicitly sign it off.
+ [self.connection signOut];
+ self.connection.delegate = nil;
+ }
+ self.connection = [[FIRMessagingConnection alloc] initWithAuthID:self.registrar.deviceAuthID
+ token:self.registrar.secretToken
+ host:host
+ port:port
+ runLoop:[NSRunLoop mainRunLoop]
+ rmq2Manager:self.rmq2Manager
+ fcmManager:self.dataMessageManager];
+ self.connection.delegate = self;
+}
+
+- (void)tryToConnect {
+ if (!self.stayConnected) {
+ return;
+ }
+
+ // Cancel any other pending signin requests.
+ [NSObject cancelPreviousPerformRequestsWithTarget:self
+ selector:@selector(tryToConnect)
+ object:nil];
+
+ // Do not re-sign in if there is already a connection in progress.
+ if (self.connection.state != kFIRMessagingConnectionNotConnected) {
+ return;
+ }
+
+ _FIRMessagingDevAssert(self.registrar.deviceAuthID.length > 0 &&
+ self.registrar.secretToken.length > 0 &&
+ self.connection != nil,
+ @"Invalid state cannot connect");
+
+ self.connectRetryCount = MIN(kMaxRetryExponent, self.connectRetryCount + 1);
+ [self performSelector:@selector(didConnectTimeout)
+ withObject:nil
+ afterDelay:self.connectionTimeoutInterval];
+ [self.connection signIn];
+}
+
+- (void)didConnectTimeout {
+ _FIRMessagingDevAssert(self.connection.state != kFIRMessagingConnectionSignedIn,
+ @"Invalid state for MCS connection");
+
+ if (self.stayConnected) {
+ [self.connection signOut];
+ [self scheduleConnectRetry];
+ }
+}
+
+#pragma mark - Schedulers
+
+- (void)scheduleConnectRetry {
+ GULReachabilityStatus status = self.reachability.reachabilityStatus;
+ BOOL isReachable = (status == kGULReachabilityViaWifi || status == kGULReachabilityViaCellular);
+ if (!isReachable) {
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeClient010,
+ @"Internet not reachable when signing into MCS during a retry");
+
+ FIRMessagingConnectCompletionHandler handler = [self.connectHandler copy];
+ // disconnect before issuing a callback
+ [self disconnectWithTryToConnectLater:YES];
+ NSError *error =
+ [NSError errorWithDomain:@"No internet available, cannot connect to FIRMessaging"
+ code:kFIRMessagingErrorCodeNetwork
+ userInfo:nil];
+ if (handler) {
+ handler(error);
+ self.connectHandler = nil;
+ }
+ return;
+ }
+
+ NSUInteger retryInterval = [self nextRetryInterval];
+
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeClient011,
+ @"Failed to sign in to MCS, retry in %lu seconds",
+ _FIRMessaging_UL(retryInterval));
+ [self performSelector:@selector(tryToConnect) withObject:nil afterDelay:retryInterval];
+}
+
+- (NSUInteger)nextRetryInterval {
+ return 1u << self.connectRetryCount;
+}
+
+@end
diff --git a/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingCodedInputStream.h b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingCodedInputStream.h
new file mode 100644
index 0000000..8f22290
--- /dev/null
+++ b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingCodedInputStream.h
@@ -0,0 +1,28 @@
+/*
+ * 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
+
+@interface FIRMessagingCodedInputStream : NSObject
+
+@property(nonatomic, readonly, assign) size_t offset;
+
+- (instancetype)initWithData:(NSData *)data;
+- (BOOL)readTag:(int8_t *)tag;
+- (BOOL)readLength:(int32_t *)length;
+- (NSData *)readDataWithLength:(uint32_t)length;
+
+@end
diff --git a/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingCodedInputStream.m b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingCodedInputStream.m
new file mode 100644
index 0000000..82c0677
--- /dev/null
+++ b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingCodedInputStream.m
@@ -0,0 +1,142 @@
+/*
+ * 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 "FIRMessagingCodedInputStream.h"
+#import "FIRMessagingDefines.h"
+
+typedef struct {
+ const void *bytes;
+ size_t bufferSize;
+ size_t bufferPos;
+} BufferState;
+
+static BOOL CheckSize(BufferState *state, size_t size) {
+ size_t newSize = state->bufferPos + size;
+ if (newSize > state->bufferSize) {
+ return NO;
+ }
+ return YES;
+}
+
+static BOOL ReadRawByte(BufferState *state, int8_t *output) {
+ _FIRMessagingDevAssert(output != NULL && state != NULL, @"Invalid parameters");
+
+ if (CheckSize(state, sizeof(int8_t))) {
+ *output = ((int8_t *)state->bytes)[state->bufferPos++];
+ return YES;
+ }
+ return NO;
+}
+
+static BOOL ReadRawVarInt32(BufferState *state, int32_t *output) {
+ _FIRMessagingDevAssert(output != NULL && state != NULL, @"Invalid parameters");
+
+ int8_t tmp = 0;
+ if (!ReadRawByte(state, &tmp)) {
+ return NO;
+ }
+ if (tmp >= 0) {
+ *output = tmp;
+ return YES;
+ }
+ int32_t result = tmp & 0x7f;
+ if (!ReadRawByte(state, &tmp)) {
+ return NO;
+ }
+ if (tmp >= 0) {
+ result |= tmp << 7;
+ } else {
+ result |= (tmp & 0x7f) << 7;
+ if (!ReadRawByte(state, &tmp)) {
+ return NO;
+ }
+ if (tmp >= 0) {
+ result |= tmp << 14;
+ } else {
+ result |= (tmp & 0x7f) << 14;
+ if (!ReadRawByte(state, &tmp)) {
+ return NO;
+ }
+ if (tmp >= 0) {
+ result |= tmp << 21;
+ } else {
+ result |= (tmp & 0x7f) << 21;
+ if (!ReadRawByte(state, &tmp)) {
+ return NO;
+ }
+ result |= tmp << 28;
+ if (tmp < 0) {
+ // Discard upper 32 bits.
+ for (int i = 0; i < 5; ++i) {
+ if (!ReadRawByte(state, &tmp)) {
+ return NO;
+ }
+ if (tmp >= 0) {
+ *output = result;
+ return YES;
+ }
+ }
+ return NO;
+ }
+ }
+ }
+ }
+ *output = result;
+ return YES;
+}
+
+@interface FIRMessagingCodedInputStream()
+
+@property(nonatomic, readwrite, strong) NSData *buffer;
+@property(nonatomic, readwrite, assign) BufferState state;
+
+@end
+
+@implementation FIRMessagingCodedInputStream;
+
+- (instancetype)initWithData:(NSData *)data {
+ self = [super init];
+ if (self) {
+ _buffer = data;
+ _state.bytes = _buffer.bytes;
+ _state.bufferSize = _buffer.length;
+ }
+ return self;
+}
+
+- (size_t)offset {
+ return _state.bufferPos;
+}
+
+- (BOOL)readTag:(int8_t *)tag {
+ return ReadRawByte(&_state, tag);
+}
+
+- (BOOL)readLength:(int32_t *)length {
+ return ReadRawVarInt32(&_state, length);
+}
+
+- (NSData *)readDataWithLength:(uint32_t)length {
+ if (!CheckSize(&_state, length)) {
+ return nil;
+ }
+ const void *bytesToRead = _state.bytes + _state.bufferPos;
+ NSData *result = [NSData dataWithBytes:bytesToRead length:length];
+ _state.bufferPos += length;
+ return result;
+}
+
+@end
diff --git a/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingConnection.h b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingConnection.h
new file mode 100644
index 0000000..25a018c
--- /dev/null
+++ b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingConnection.h
@@ -0,0 +1,106 @@
+/*
+ * 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
+
+@class FIRMessagingConnection;
+@class FIRMessagingDataMessageManager;
+@class FIRMessagingRmqManager;
+
+@class GtalkDataMessageStanza;
+@class GPBMessage;
+
+typedef void (^FIRMessagingMessageHandler)(NSDictionary *);
+
+typedef NS_ENUM(NSUInteger, FIRMessagingConnectionState) {
+ kFIRMessagingConnectionNotConnected = 0,
+ kFIRMessagingConnectionConnecting,
+ kFIRMessagingConnectionConnected,
+ kFIRMessagingConnectionSignedIn,
+};
+
+typedef NS_ENUM(NSUInteger, FIRMessagingConnectionCloseReason) {
+ kFIRMessagingConnectionCloseReasonSocketDisconnected = 0,
+ kFIRMessagingConnectionCloseReasonTimeout,
+ kFIRMessagingConnectionCloseReasonUserDisconnect,
+};
+
+@protocol FIRMessagingConnectionDelegate
+
+- (void)connection:(FIRMessagingConnection *)fcmConnection
+ didCloseForReason:(FIRMessagingConnectionCloseReason)reason;
+- (void)didLoginWithConnection:(FIRMessagingConnection *)fcmConnection;
+- (void)connectionDidRecieveMessage:(GtalkDataMessageStanza *)message;
+/**
+ * Called when a stream ACK or a selective ACK are received - this indicates the
+ * message has been received by MCS.
+ * @return The count of rmqIds deleted from the client RMQ store.
+ */
+- (int)connectionDidReceiveAckForRmqIds:(NSArray *)rmqIds;
+
+@end
+
+
+/**
+ * This class maintains the actual FIRMessaging connection that we use to receive and send messages
+ * while the app is in foreground. Once we have a registrationID from the FIRMessaging backend we
+ * are able to set up this connection which is used for any further communication with FIRMessaging
+ * backend. In case the connection breaks off while the app is still being used we try to rebuild
+ * the connection with an exponential backoff.
+ *
+ * This class also notifies the delegate about the main events happening in the lifcycle of the
+ * FIRMessaging connection (read FIRMessagingConnectionDelegate). All of the `on-the-wire`
+ * interactions with FIRMessaging are channelled through here.
+ */
+@interface FIRMessagingConnection : NSObject
+
+@property(nonatomic, readonly, assign) FIRMessagingConnectionState state;
+@property(nonatomic, readonly, copy) NSString *host;
+@property(nonatomic, readonly, assign) NSUInteger port;
+@property(nonatomic, readwrite, weak) id delegate;
+
+- (instancetype)initWithAuthID:(NSString *)authId
+ token:(NSString *)token
+ host:(NSString *)host
+ port:(NSUInteger)port
+ runLoop:(NSRunLoop *)runLoop
+ rmq2Manager:(FIRMessagingRmqManager *)rmq2Manager
+ fcmManager:(FIRMessagingDataMessageManager *)dataMessageManager;
+
+- (void)signIn; // connect
+- (void)signOut; // disconnect
+
+/**
+ * Teardown the FIRMessaging connection and deallocate the resources being held up by the
+ * connection.
+ */
+- (void)teardown;
+
+/**
+ * Send proto to the wire. The message will be cached before we try to send so that in case of
+ * failure we can send it again later on when we have connection.
+ */
+- (void)sendProto:(GPBMessage *)proto;
+
+/**
+ * Send a message after the currently in progress connection succeeds, otherwise drop it.
+ *
+ * This should be used for TTL=0 messages that force a reconnect. They shouldn't be persisted
+ * in the RMQ, but they should be sent if the reconnect is successful.
+ */
+- (void)sendOnConnectOrDrop:(GPBMessage *)message;
+
+@end
diff --git a/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingConnection.m b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingConnection.m
new file mode 100644
index 0000000..8694326
--- /dev/null
+++ b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingConnection.m
@@ -0,0 +1,708 @@
+/*
+ * 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 "FIRMessagingConnection.h"
+
+#import "Protos/GtalkCore.pbobjc.h"
+#import "Protos/GtalkExtensions.pbobjc.h"
+
+#import "FIRMessaging.h"
+#import "FIRMessagingDataMessageManager.h"
+#import "FIRMessagingDefines.h"
+#import "FIRMessagingLogger.h"
+#import "FIRMessagingRmqManager.h"
+#import "FIRMessagingSecureSocket.h"
+#import "FIRMessagingUtilities.h"
+#import "FIRMessagingVersionUtilities.h"
+#import "FIRMessaging_Private.h"
+
+static NSInteger const kIqSelectiveAck = 12;
+static NSInteger const kIqStreamAck = 13;
+static int const kInvalidStreamId = -1;
+// Threshold for number of messages removed that we will ack, for short lived connections
+static int const kMessageRemoveAckThresholdCount = 5;
+
+static NSTimeInterval const kHeartbeatInterval = 30.0;
+static NSTimeInterval const kConnectionTimeout = 20.0;
+static int32_t const kAckingInterval = 10;
+
+static NSString *const kUnackedS2dIdKey = @"FIRMessagingUnackedS2dIdKey";
+static NSString *const kAckedS2dIdMapKey = @"FIRMessagingAckedS2dIdMapKey";
+
+static NSString *const kRemoteFromAddress = @"from";
+
+@interface FIRMessagingD2SInfo : NSObject
+
+@property(nonatomic, readwrite, assign) int streamId;
+@property(nonatomic, readwrite, strong) NSString *d2sID;
+- (instancetype)initWithStreamId:(int)streamId d2sId:(NSString *)d2sID;
+
+@end
+
+@implementation FIRMessagingD2SInfo
+
+- (instancetype)initWithStreamId:(int)streamId d2sId:(NSString *)d2sID {
+ self = [super init];
+ if (self) {
+ _streamId = streamId;
+ _d2sID = [d2sID copy];
+ }
+ return self;
+}
+
+- (BOOL)isEqual:(id)object {
+ if ([object isKindOfClass:[self class]]) {
+ FIRMessagingD2SInfo *other = (FIRMessagingD2SInfo *)object;
+ return self.streamId == other.streamId && [self.d2sID isEqualToString:other.d2sID];
+ }
+ return NO;
+}
+
+- (NSUInteger)hash {
+ return [self.d2sID hash];
+}
+
+@end
+
+@interface FIRMessagingConnection ()
+
+@property(nonatomic, readwrite, weak) FIRMessagingRmqManager *rmq2Manager;
+@property(nonatomic, readwrite, weak) FIRMessagingDataMessageManager *dataMessageManager;
+
+@property(nonatomic, readwrite, assign) FIRMessagingConnectionState state;
+@property(nonatomic, readwrite, copy) NSString *host;
+@property(nonatomic, readwrite, assign) NSUInteger port;
+
+@property(nonatomic, readwrite, strong) NSString *authId;
+@property(nonatomic, readwrite, strong) NSString *token;
+
+@property(nonatomic, readwrite, strong) FIRMessagingSecureSocket *socket;
+
+@property(nonatomic, readwrite, assign) int64_t lastLoginServerTimestamp;
+@property(nonatomic, readwrite, assign) int lastStreamIdAcked;
+@property(nonatomic, readwrite, assign) int inStreamId;
+@property(nonatomic, readwrite, assign) int outStreamId;
+
+@property(nonatomic, readwrite, strong) NSMutableArray *unackedS2dIds;
+@property(nonatomic, readwrite, strong) NSMutableDictionary *ackedS2dMap;
+@property(nonatomic, readwrite, strong) NSMutableArray *d2sInfos;
+// ttl=0 messages that need to be sent as soon as we establish a connection
+@property(nonatomic, readwrite, strong) NSMutableArray *sendOnConnectMessages;
+
+@property(nonatomic, readwrite, strong) NSRunLoop *runLoop;
+
+@end
+
+
+@implementation FIRMessagingConnection;
+
+- (instancetype)initWithAuthID:(NSString *)authId
+ token:(NSString *)token
+ host:(NSString *)host
+ port:(NSUInteger)port
+ runLoop:(NSRunLoop *)runLoop
+ rmq2Manager:(FIRMessagingRmqManager *)rmq2Manager
+ fcmManager:(FIRMessagingDataMessageManager *)dataMessageManager {
+ self = [super init];
+ if (self) {
+ _authId = [authId copy];
+ _token = [token copy];
+ _host = [host copy];
+ _port = port;
+ _runLoop = runLoop;
+ _rmq2Manager = rmq2Manager;
+ _dataMessageManager = dataMessageManager;
+
+ _d2sInfos = [NSMutableArray array];
+
+ _unackedS2dIds = [NSMutableArray arrayWithArray:[_rmq2Manager unackedS2dRmqIds]];
+ _ackedS2dMap = [NSMutableDictionary dictionary];
+ _sendOnConnectMessages = [NSMutableArray array];
+ }
+ return self;
+}
+
+- (NSString *)description {
+ return [NSString stringWithFormat:@"host: %@, port: %lu, stream id in: %d, stream id out: %d",
+ self.host,
+ _FIRMessaging_UL(self.port),
+ self.inStreamId,
+ self.outStreamId];
+}
+
+- (void)signIn {
+ _FIRMessagingDevAssert(self.state == kFIRMessagingConnectionNotConnected, @"Invalid connection state.");
+ if (self.state != kFIRMessagingConnectionNotConnected) {
+ return;
+ }
+
+ // break it up for testing
+ [self setupConnectionSocket];
+ [self connectToSocket:self.socket];
+}
+
+- (void)setupConnectionSocket {
+ self.socket = [[FIRMessagingSecureSocket alloc] init];
+ self.socket.delegate = self;
+}
+
+- (void)connectToSocket:(FIRMessagingSecureSocket *)socket {
+ self.state = kFIRMessagingConnectionConnecting;
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection000,
+ @"Start connecting to FIRMessaging service.");
+ [socket connectToHost:self.host port:self.port onRunLoop:self.runLoop];
+}
+
+- (void)signOut {
+ // Clear the list of messages to be sent on connect. This will only
+ // have messages in it if an error happened before receiving the LoginResponse.
+ [self.sendOnConnectMessages removeAllObjects];
+
+ if (self.state == kFIRMessagingConnectionSignedIn) {
+ [self sendClose];
+ }
+ if (self.state != kFIRMessagingConnectionNotConnected) {
+ [self disconnect];
+ }
+}
+
+- (void)teardown {
+ if (self.state != kFIRMessagingConnectionNotConnected) {
+ [self disconnect];
+ }
+}
+
+#pragma mark - FIRMessagingSecureSocketDelegate
+
+- (void)secureSocketDidConnect:(FIRMessagingSecureSocket *)socket {
+ self.state = kFIRMessagingConnectionConnected;
+ self.lastStreamIdAcked = 0;
+ self.inStreamId = 0;
+ self.outStreamId = 0;
+
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection001,
+ @"Connected to FIRMessaging service.");
+ [self resetUnconfirmedAcks];
+ [self sendLoginRequest:self.authId token:self.token];
+}
+
+- (void)didDisconnectWithSecureSocket:(FIRMessagingSecureSocket *)socket {
+ _FIRMessagingDevAssert(self.socket == socket, @"Invalid socket");
+ _FIRMessagingDevAssert(self.socket.state == kFIRMessagingSecureSocketClosed, @"Socket already closed");
+
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection002,
+ @"Secure socket disconnected from FIRMessaging service.");
+ [self disconnect];
+ [self.delegate connection:self didCloseForReason:kFIRMessagingConnectionCloseReasonSocketDisconnected];
+}
+
+- (void)secureSocket:(FIRMessagingSecureSocket *)socket
+ didReceiveData:(NSData *)data
+ withTag:(int8_t)tag {
+ if (tag < 0) {
+ // Invalid proto tag
+ return;
+ }
+
+ Class klassForTag = FIRMessagingGetClassForTag((FIRMessagingProtoTag)tag);
+ if ([klassForTag isSubclassOfClass:[NSNull class]]) {
+ FIRMessagingLoggerError(kFIRMessagingMessageCodeConnection003, @"Invalid tag %d for proto",
+ tag);
+ return;
+ }
+
+ GPBMessage *proto = [klassForTag parseFromData:data error:NULL];
+ if (tag == kFIRMessagingProtoTagLoginResponse && self.state != kFIRMessagingConnectionConnected) {
+ FIRMessagingLoggerDebug(
+ kFIRMessagingMessageCodeConnection004,
+ @"Should not receive generated message when the connection is not connected.");
+ return;
+ } else if (tag != kFIRMessagingProtoTagLoginResponse && self.state != kFIRMessagingConnectionSignedIn) {
+ FIRMessagingLoggerDebug(
+ kFIRMessagingMessageCodeConnection005,
+ @"Should not receive generated message when the connection is not signed in.");
+ return;
+ }
+
+ // If traffic is received after a heartbeat it is safe to assume the connection is healthy.
+ [self cancelConnectionTimeoutTask];
+ [self performSelector:@selector(sendHeartbeatPing)
+ withObject:nil
+ afterDelay:kHeartbeatInterval];
+
+ [self willProcessProto:proto];
+ switch (tag) {
+ case kFIRMessagingProtoTagLoginResponse:
+ [self didReceiveLoginResponse:(GtalkLoginResponse *)proto];
+ break;
+ case kFIRMessagingProtoTagDataMessageStanza:
+ [self didReceiveDataMessageStanza:(GtalkDataMessageStanza *)proto];
+ break;
+ case kFIRMessagingProtoTagHeartbeatPing:
+ [self didReceiveHeartbeatPing:(GtalkHeartbeatPing *)proto];
+ break;
+ case kFIRMessagingProtoTagHeartbeatAck:
+ [self didReceiveHeartbeatAck:(GtalkHeartbeatAck *)proto];
+ break;
+ case kFIRMessagingProtoTagClose:
+ [self didReceiveClose:(GtalkClose *)proto];
+ break;
+ case kFIRMessagingProtoTagIqStanza:
+ [self handleIqStanza:(GtalkIqStanza *)proto];
+ break;
+ default:
+ [self didReceiveUnhandledProto:proto];
+ break;
+ }
+}
+
+// Called from secure socket once we have send the proto with given rmqId over the wire
+// since we are mostly concerned with user facing messages which certainly have a rmqId
+// we can retrieve them from the Rmq if necessary to look at stuff but for now we just
+// log it.
+- (void)secureSocket:(FIRMessagingSecureSocket *)socket
+ didSendProtoWithTag:(int8_t)tag
+ rmqId:(NSString *)rmqId {
+ // log the message
+ [self logMessage:rmqId messageType:tag isOut:YES];
+}
+
+#pragma mark - FIRMessagingTestConnection
+
+- (void)sendProto:(GPBMessage *)proto {
+ FIRMessagingProtoTag tag = FIRMessagingGetTagForProto(proto);
+ if (tag == kFIRMessagingProtoTagLoginRequest && self.state != kFIRMessagingConnectionConnected) {
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection006,
+ @"Cannot send generated message when the connection is not connected.");
+ return;
+ } else if (tag != kFIRMessagingProtoTagLoginRequest && self.state != kFIRMessagingConnectionSignedIn) {
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection007,
+ @"Cannot send generated message when the connection is not signed in.");
+ return;
+ }
+
+ _FIRMessagingDevAssert(self.socket != nil, @"Socket shouldn't be nil");
+ if (self.socket == nil) {
+ return;
+ }
+
+ [self willSendProto:proto];
+
+ [self.socket sendData:proto.data withTag:tag rmqId:FIRMessagingGetRmq2Id(proto)];
+}
+
+- (void)sendOnConnectOrDrop:(GPBMessage *)message {
+ if (self.state == kFIRMessagingConnectionSignedIn) {
+ // If a connection has already been established, send normally
+ [self sendProto:message];
+ } else {
+ // Otherwise add them to the list of messages to send after login
+ [self.sendOnConnectMessages addObject:message];
+ }
+}
+
++ (GtalkLoginRequest *)loginRequestWithToken:(NSString *)token authID:(NSString *)authID {
+ GtalkLoginRequest *login = [[GtalkLoginRequest alloc] init];
+ login.accountId = 1000000;
+ login.authService = GtalkLoginRequest_AuthService_AndroidId;
+ login.authToken = token;
+ login.id_p = [NSString stringWithFormat:@"%@-%@", @"ios", FIRMessagingCurrentLibraryVersion()];
+ login.domain = @"mcs.android.com";
+ login.deviceId = [NSString stringWithFormat:@"android-%llx", authID.longLongValue];
+ login.networkType = [self currentNetworkType];
+ login.resource = authID;
+ login.user = authID;
+ login.useRmq2 = YES;
+ login.lastRmqId = 1; // Sending not enabled yet so this stays as 1.
+ return login;
+}
+
++ (int32_t)currentNetworkType {
+ // http://developer.android.com/reference/android/net/ConnectivityManager.html
+ int32_t fcmNetworkType;
+ FIRMessagingNetworkStatus type = [[FIRMessaging messaging] networkType];
+ switch (type) {
+ case kFIRMessagingReachabilityReachableViaWiFi:
+ fcmNetworkType = 1;
+ break;
+
+ case kFIRMessagingReachabilityReachableViaWWAN:
+ fcmNetworkType = 0;
+ break;
+
+ default:
+ fcmNetworkType = -1;
+ break;
+ }
+ return fcmNetworkType;
+}
+
+- (void)sendLoginRequest:(NSString *)authId
+ token:(NSString *)token {
+ GtalkLoginRequest *login = [[self class] loginRequestWithToken:token authID:authId];
+
+ // clear the messages sent during last connection
+ if ([self.d2sInfos count]) {
+ [self.d2sInfos removeAllObjects];
+ }
+
+ if (self.unackedS2dIds.count > 0) {
+ FIRMessagingLoggerDebug(
+ kFIRMessagingMessageCodeConnection008,
+ @"There are unacked persistent Ids in the login request: %@",
+ [self.unackedS2dIds.description stringByReplacingOccurrencesOfString:@"%"
+ withString:@"%%"]);
+ }
+ // Send out acks.
+ for (NSString *unackedPersistentS2dId in self.unackedS2dIds) {
+ [login.receivedPersistentIdArray addObject:unackedPersistentS2dId];
+ }
+
+ GtalkSetting *setting = [[GtalkSetting alloc] init];
+ setting.name = @"new_vc";
+ setting.value = @"1";
+ [login.settingArray addObject:setting];
+
+ [self sendProto:login];
+}
+
+- (void)sendHeartbeatAck {
+ [self sendProto:[[GtalkHeartbeatAck alloc] init]];
+}
+
+- (void)sendHeartbeatPing {
+ // cancel the previous heartbeat request.
+ [NSObject cancelPreviousPerformRequestsWithTarget:self
+ selector:@selector(sendHeartbeatPing)
+ object:nil];
+ [self scheduleConnectionTimeoutTask];
+ [self sendProto:[[GtalkHeartbeatPing alloc] init]];
+}
+
++ (GtalkIqStanza *)createStreamAck {
+ GtalkIqStanza *iq = [[GtalkIqStanza alloc] init];
+ iq.type = GtalkIqStanza_IqType_Set;
+ iq.id_p = @"";
+ GtalkExtension *ext = [[GtalkExtension alloc] init];
+ ext.id_p = kIqStreamAck;
+ ext.data_p = @"";
+ iq.extension = ext;
+ return iq;
+}
+
+- (void)sendStreamAck {
+ GtalkIqStanza *iq = [[self class] createStreamAck];
+ [self sendProto:iq];
+}
+
+- (void)sendClose {
+ [self sendProto:[[GtalkClose alloc] init]];
+}
+
+- (void)handleIqStanza:(GtalkIqStanza *)iq {
+ if (iq.hasExtension) {
+ if (iq.extension.id_p == kIqStreamAck) {
+ [self didReceiveStreamAck:iq];
+ return;
+ }
+ if (iq.extension.id_p == kIqSelectiveAck) {
+ [self didReceiveSelectiveAck:iq];
+ return;
+ }
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection009, @"Unknown ack extension id %d.",
+ iq.extension.id_p);
+ } else {
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection010, @"Ip stanza without extension.");
+ }
+ [self didReceiveUnhandledProto:iq];
+}
+
+- (void)didReceiveLoginResponse:(GtalkLoginResponse *)loginResponse {
+ if (loginResponse.hasError) {
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection011,
+ @"Login error with type: %@, message: %@.", loginResponse.error.type,
+ loginResponse.error.message);
+ return;
+ }
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection012, @"Logged onto MCS service.");
+ // We sent the persisted list of unack'd messages with login so we can assume they have been ack'd
+ // by the server.
+ _FIRMessagingDevAssert(self.unackedS2dIds.count == 0, @"No ids present");
+ _FIRMessagingDevAssert(self.outStreamId == 1, @"Login should be the first stream id");
+
+ self.state = kFIRMessagingConnectionSignedIn;
+ self.lastLoginServerTimestamp = loginResponse.serverTimestamp;
+ [self.delegate didLoginWithConnection:self];
+ [self sendHeartbeatPing];
+
+ // Add all the TTL=0 messages on connect
+ for (GPBMessage *message in self.sendOnConnectMessages) {
+ [self sendProto:message];
+ }
+ [self.sendOnConnectMessages removeAllObjects];
+}
+
+- (void)didReceiveHeartbeatPing:(GtalkHeartbeatPing *)heartbeatPing {
+ [self sendHeartbeatAck];
+}
+
+- (void)didReceiveHeartbeatAck:(GtalkHeartbeatAck *)heartbeatAck {
+}
+
+- (void)didReceiveDataMessageStanza:(GtalkDataMessageStanza *)dataMessageStanza {
+ // TODO: Maybe add support raw data later
+ [self.delegate connectionDidRecieveMessage:dataMessageStanza];
+}
+
+- (void)didReceiveUnhandledProto:(GPBMessage *)proto {
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection013, @"Received unhandled proto");
+}
+
+- (void)didReceiveStreamAck:(GtalkIqStanza *)iq {
+ // Server received some stuff from us we don't really need to do anything special
+}
+
+- (void)didReceiveSelectiveAck:(GtalkIqStanza *)iq {
+ GtalkExtension *extension = iq.extension;
+ if (extension) {
+ int extensionId = extension.id_p;
+ if (extensionId == kIqSelectiveAck) {
+
+ NSString *dataString = extension.data_p;
+ GtalkSelectiveAck *selectiveAck = [[GtalkSelectiveAck alloc] init];
+ [selectiveAck mergeFromData:[dataString dataUsingEncoding:NSUTF8StringEncoding]
+ extensionRegistry:nil];
+
+ NSArray *acks = [selectiveAck idArray];
+
+ // we've received ACK's
+ [self.delegate connectionDidReceiveAckForRmqIds:acks];
+
+ // resend unacked messages
+ [self.dataMessageManager resendMessagesWithConnection:self];
+ }
+ }
+}
+
+- (void)didReceiveClose:(GtalkClose *)close {
+ [self disconnect];
+}
+
+- (void)willProcessProto:(GPBMessage *)proto {
+ self.inStreamId++;
+
+ if ([proto isKindOfClass:GtalkDataMessageStanza.class]) {
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection014,
+ @"RMQ: Receiving %@ with rmq_id: %@ incoming stream Id: %d",
+ proto.class, FIRMessagingGetRmq2Id(proto), self.inStreamId);
+ } else {
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection015,
+ @"RMQ: Receiving %@ with incoming stream Id: %d.", proto.class,
+ self.inStreamId);
+ }
+ int streamId = FIRMessagingGetLastStreamId(proto);
+ if (streamId != kInvalidStreamId) {
+ // confirm the D2S messages that were sent by us
+ [self confirmAckedD2sIdsWithStreamId:streamId];
+
+ // We can now confirm that our ack was received by the server and start our unack'd list fresh
+ // with the proto we just received.
+ [self confirmAckedS2dIdsWithStreamId:streamId];
+ }
+ NSString *rmq2Id = FIRMessagingGetRmq2Id(proto);
+ if (rmq2Id != nil) {
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection016,
+ @"RMQ: Add unacked persistent Id: %@.",
+ [rmq2Id stringByReplacingOccurrencesOfString:@"%" withString:@"%%"]);
+ [self.unackedS2dIds addObject:rmq2Id];
+ [self.rmq2Manager saveS2dMessageWithRmqId:rmq2Id]; // RMQ save
+ }
+ BOOL explicitAck = ([proto isKindOfClass:[GtalkDataMessageStanza class]] &&
+ [(GtalkDataMessageStanza *)proto immediateAck]);
+ // If we have not sent anything and the ack threshold has been reached then explicitly send one
+ // to notify the server that we have received messages.
+ if (self.inStreamId - self.lastStreamIdAcked >= kAckingInterval || explicitAck) {
+ [self sendStreamAck];
+ }
+}
+
+- (void)willSendProto:(GPBMessage *)proto {
+ self.outStreamId++;
+
+ NSString *rmq2Id = FIRMessagingGetRmq2Id(proto);
+ if ([rmq2Id length]) {
+ FIRMessagingD2SInfo *d2sInfo = [[FIRMessagingD2SInfo alloc] initWithStreamId:self.outStreamId d2sId:rmq2Id];
+ [self.d2sInfos addObject:d2sInfo];
+ }
+
+ // each time we send a d2s message, it acks previously received
+ // s2d messages via the last (s2d) stream id received.
+
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection017,
+ @"RMQ: Sending %@ with outgoing stream Id: %d.", proto.class,
+ self.outStreamId);
+ // We have received messages since last time we sent something - send ack info to server.
+ if (self.inStreamId > self.lastStreamIdAcked) {
+ FIRMessagingSetLastStreamId(proto, self.inStreamId);
+ self.lastStreamIdAcked = self.inStreamId;
+ }
+
+ if (self.unackedS2dIds.count > 0) {
+ // Move all 'unack'd' messages to the ack'd map so they can be removed once the
+ // ack is confirmed.
+ NSArray *ackedS2dIds = [NSArray arrayWithArray:self.unackedS2dIds];
+ FIRMessagingLoggerDebug(
+ kFIRMessagingMessageCodeConnection018, @"RMQ: Mark persistent Ids as acked: %@.",
+ [ackedS2dIds.description stringByReplacingOccurrencesOfString:@"%" withString:@"%%"]);
+ [self.unackedS2dIds removeAllObjects];
+ self.ackedS2dMap[[@(self.outStreamId) stringValue]] = ackedS2dIds;
+ }
+}
+
+#pragma mark - Private
+
+/**
+ * This processes the s2d message received in reference to the d2s messages
+ * that we have sent before.
+ */
+- (void)confirmAckedD2sIdsWithStreamId:(int)lastReceivedStreamId {
+ NSMutableArray *d2sIdsAcked = [NSMutableArray array];
+ for (FIRMessagingD2SInfo *d2sInfo in self.d2sInfos) {
+ if (lastReceivedStreamId < d2sInfo.streamId) {
+ break;
+ }
+ [d2sIdsAcked addObject:d2sInfo];
+ }
+
+ NSMutableArray *rmqIds = [NSMutableArray arrayWithCapacity:[d2sIdsAcked count]];
+ // remove ACK'ed messages
+ for (FIRMessagingD2SInfo *d2sInfo in d2sIdsAcked) {
+ if ([d2sInfo.d2sID length]) {
+ [rmqIds addObject:d2sInfo.d2sID];
+ }
+ [self.d2sInfos removeObject:d2sInfo];
+ }
+ [self.delegate connectionDidReceiveAckForRmqIds:rmqIds];
+ int count = [self.delegate connectionDidReceiveAckForRmqIds:rmqIds];
+ if (kMessageRemoveAckThresholdCount > 0 && count >= kMessageRemoveAckThresholdCount) {
+ // For short lived connections, if a large number of messages are removed, send an
+ // ack straight away so the server knows that this message was received.
+ [self sendStreamAck];
+ }
+}
+
+/**
+ * Called when a stream ACK or a selective ACK are received - this indicates the message has
+ * been received by MCS.
+ */
+- (void)didReceiveAckForRmqIds:(NSArray *)rmqIds {
+ // TODO: let the user know that the following messages were received by the server
+}
+
+- (void)confirmAckedS2dIdsWithStreamId:(int)lastReceivedStreamId {
+ // If the server hasn't received the streamId yet.
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection019,
+ @"RMQ: Server last received stream Id: %d.", lastReceivedStreamId);
+ if (lastReceivedStreamId < self.outStreamId) {
+ // TODO: This could be a good indicator that we need to re-send something (acks)?
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection020,
+ @"RMQ: There are unsent messages that should be send...\n"
+ "server received: %d\nlast stream id sent: %d",
+ lastReceivedStreamId, self.outStreamId);
+ }
+
+ NSSet *ackedStreamIds =
+ [self.ackedS2dMap keysOfEntriesPassingTest:^BOOL(id key, id obj, BOOL *stop) {
+ NSString *streamId = key;
+ return streamId.intValue <= lastReceivedStreamId;
+ }];
+ NSMutableArray *s2dIdsToDelete = [NSMutableArray array];
+
+ for (NSString *streamId in ackedStreamIds) {
+ NSArray *ackedS2dIds = self.ackedS2dMap[streamId];
+ if (ackedS2dIds.count > 0) {
+ FIRMessagingLoggerDebug(
+ kFIRMessagingMessageCodeConnection021,
+ @"RMQ: Mark persistent Ids as confirmed by stream id %@: %@.", streamId,
+ [ackedS2dIds.description stringByReplacingOccurrencesOfString:@"%" withString:@"%%"]);
+ [self.ackedS2dMap removeObjectForKey:streamId];
+ }
+
+ [s2dIdsToDelete addObjectsFromArray:ackedS2dIds];
+ }
+
+ // clean up s2d ids that the server knows we've received.
+ // we let the server know via a s2d last stream id received in a
+ // d2s message. the server lets us know it has received our d2s
+ // message via a d2s last stream id received in a s2d message.
+ [self.rmq2Manager removeS2dIds:s2dIdsToDelete];
+}
+
+- (void)resetUnconfirmedAcks {
+ [self.ackedS2dMap enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
+ [self.unackedS2dIds addObjectsFromArray:obj];
+ }];
+ [self.ackedS2dMap removeAllObjects];
+}
+
+- (void)disconnect {
+ _FIRMessagingDevAssert(self.state != kFIRMessagingConnectionNotConnected, @"Connection already not connected");
+ // cancel pending timeout tasks.
+ [self cancelConnectionTimeoutTask];
+ // cancel pending heartbeat.
+ [NSObject cancelPreviousPerformRequestsWithTarget:self
+ selector:@selector(sendHeartbeatPing)
+ object:nil];
+ // Unset the delegate. FIRMessagingConnection will not receive further events from the socket from now on.
+ self.socket.delegate = nil;
+ [self.socket disconnect];
+ self.state = kFIRMessagingConnectionNotConnected;
+}
+
+- (void)connectionTimedOut {
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection022,
+ @"Connection to FIRMessaging service timed out.");
+ [self disconnect];
+ [self.delegate connection:self didCloseForReason:kFIRMessagingConnectionCloseReasonTimeout];
+}
+
+- (void)scheduleConnectionTimeoutTask {
+ // cancel the previous heartbeat timeout event and schedule a new one.
+ [self cancelConnectionTimeoutTask];
+ [self performSelector:@selector(connectionTimedOut)
+ withObject:nil
+ afterDelay:[self connectionTimeoutInterval]];
+}
+
+- (void)cancelConnectionTimeoutTask {
+ // cancel pending timeout tasks.
+ [NSObject cancelPreviousPerformRequestsWithTarget:self
+ selector:@selector(connectionTimedOut)
+ object:nil];
+}
+
+- (void)logMessage:(NSString *)description messageType:(int)messageType isOut:(BOOL)isOut {
+ messageType = isOut ? -messageType : messageType;
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection023,
+ @"Send msg: %@ type: %d inStreamId: %d outStreamId: %d", description,
+ messageType, self.inStreamId, self.outStreamId);
+}
+
+- (NSTimeInterval)connectionTimeoutInterval {
+ return kConnectionTimeout;
+}
+
+@end
diff --git a/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingConstants.h b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingConstants.h
new file mode 100644
index 0000000..ad0d6c9
--- /dev/null
+++ b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingConstants.h
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+/**
+ * Global constants to be put here.
+ *
+ */
+#import
+
+#ifndef _FIRMessaging_CONSTANTS_H
+#define _FIRMessaging_CONSTANTS_H
+
+FOUNDATION_EXPORT NSString *const kFIRMessagingRawDataKey;
+FOUNDATION_EXPORT NSString *const kFIRMessagingCollapseKey;
+FOUNDATION_EXPORT NSString *const kFIRMessagingFromKey;
+
+FOUNDATION_EXPORT NSString *const kFIRMessagingSendTo;
+FOUNDATION_EXPORT NSString *const kFIRMessagingSendTTL;
+FOUNDATION_EXPORT NSString *const kFIRMessagingSendDelay;
+FOUNDATION_EXPORT NSString *const kFIRMessagingSendMessageID;
+FOUNDATION_EXPORT NSString *const KFIRMessagingSendMessageAppData;
+
+FOUNDATION_EXPORT NSString *const kFIRMessagingMessageInternalReservedKeyword;
+FOUNDATION_EXPORT NSString *const kFIRMessagingMessagePersistentIDKey;
+
+FOUNDATION_EXPORT NSString *const kFIRMessagingMessageIDKey;
+FOUNDATION_EXPORT NSString *const kFIRMessagingMessageAPNSContentAvailableKey;
+FOUNDATION_EXPORT NSString *const kFIRMessagingMessageSyncViaMCSKey;
+FOUNDATION_EXPORT NSString *const kFIRMessagingMessageSyncMessageTTLKey;
+FOUNDATION_EXPORT NSString *const kFIRMessagingMessageLinkKey;
+
+FOUNDATION_EXPORT NSString *const kFIRMessagingRemoteNotificationsProxyEnabledInfoPlistKey;
+
+FOUNDATION_EXPORT NSString *const kFIRMessagingApplicationSupportSubDirectory;
+
+// Notifications
+FOUNDATION_EXPORT NSString *const kFIRMessagingCheckinFetchedNotification;
+FOUNDATION_EXPORT NSString *const kFIRMessagingAPNSTokenNotification;
+FOUNDATION_EXPORT NSString *const kFIRMessagingFCMTokenNotification;
+FOUNDATION_EXPORT NSString *const kFIRMessagingInstanceIDTokenRefreshNotification __deprecated_msg("Use kFIRMessagingRegistrationTokenRefreshNotification instead");
+FOUNDATION_EXPORT NSString *const kFIRMessagingRegistrationTokenRefreshNotification;
+
+FOUNDATION_EXPORT const int kFIRMessagingSendTtlDefault; // 24 hours
+
+#endif
diff --git a/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingConstants.m b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingConstants.m
new file mode 100644
index 0000000..8904cc5
--- /dev/null
+++ b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingConstants.m
@@ -0,0 +1,52 @@
+/*
+ * 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 "FIRMessagingConstants.h"
+
+NSString *const kFIRMessagingRawDataKey = @"rawData";
+NSString *const kFIRMessagingCollapseKey = @"collapse_key";
+NSString *const kFIRMessagingFromKey = @"from";
+
+NSString *const kFIRMessagingSendTo = @"google." @"to";
+NSString *const kFIRMessagingSendTTL = @"google." @"ttl";
+NSString *const kFIRMessagingSendDelay = @"google." @"delay";
+NSString *const kFIRMessagingSendMessageID = @"google." @"msg_id";
+NSString *const KFIRMessagingSendMessageAppData = @"google." @"data";
+
+NSString *const kFIRMessagingMessageInternalReservedKeyword = @"gcm.";
+NSString *const kFIRMessagingMessagePersistentIDKey = @"persistent_id";
+
+NSString *const kFIRMessagingMessageIDKey = @"gcm." @"message_id";
+NSString *const kFIRMessagingMessageAPNSContentAvailableKey = @"content-available";
+NSString *const kFIRMessagingMessageSyncViaMCSKey = @"gcm." @"duplex";
+NSString *const kFIRMessagingMessageSyncMessageTTLKey = @"gcm." @"ttl";
+NSString *const kFIRMessagingMessageLinkKey = @"gcm." @"app_link";
+
+NSString *const kFIRMessagingRemoteNotificationsProxyEnabledInfoPlistKey =
+ @"FirebaseAppDelegateProxyEnabled";
+
+NSString *const kFIRMessagingApplicationSupportSubDirectory = @"Google/FirebaseMessaging";
+
+// Notifications
+NSString *const kFIRMessagingCheckinFetchedNotification = @"com.google.gcm.notif-checkin-fetched";
+NSString *const kFIRMessagingAPNSTokenNotification = @"com.firebase.iid.notif.apns-token";
+NSString *const kFIRMessagingFCMTokenNotification = @"com.firebase.iid.notif.fcm-token";
+NSString *const kFIRMessagingInstanceIDTokenRefreshNotification =
+ @"com.firebase.iid.notif.refresh-token";
+NSString *const kFIRMessagingRegistrationTokenRefreshNotification =
+ @"com.firebase.iid.notif.refresh-token";
+
+const int kFIRMessagingSendTtlDefault = 24 * 60 * 60; // 24 hours
diff --git a/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingContextManagerService.h b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingContextManagerService.h
new file mode 100644
index 0000000..83e6444
--- /dev/null
+++ b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingContextManagerService.h
@@ -0,0 +1,44 @@
+/*
+ * 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_EXPORT NSString *const kFIRMessagingContextManagerCategory;
+FOUNDATION_EXPORT NSString *const kFIRMessagingContextManagerLocalTimeStart;
+FOUNDATION_EXPORT NSString *const kFIRMessagingContextManagerLocalTimeEnd;
+FOUNDATION_EXPORT NSString *const kFIRMessagingContextManagerBodyKey;
+
+@interface FIRMessagingContextManagerService : NSObject
+
+/**
+ * Check if the message is a context manager message or not.
+ *
+ * @param message The message to verify.
+ *
+ * @return YES if the message is a context manager message else NO.
+ */
++ (BOOL)isContextManagerMessage:(NSDictionary *)message;
+
+/**
+ * Handle context manager message.
+ *
+ * @param message The message to handle.
+ *
+ * @return YES if the message was handled successfully else NO.
+ */
++ (BOOL)handleContextManagerMessage:(NSDictionary *)message;
+
+@end
diff --git a/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingContextManagerService.m b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingContextManagerService.m
new file mode 100644
index 0000000..b4aac8b
--- /dev/null
+++ b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingContextManagerService.m
@@ -0,0 +1,202 @@
+/*
+ * 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 "FIRMessagingContextManagerService.h"
+
+#import
+
+#import "FIRMessagingDefines.h"
+#import "FIRMessagingLogger.h"
+#import "FIRMessagingUtilities.h"
+
+#define kFIRMessagingContextManagerPrefixKey @"google.c.cm."
+#define kFIRMessagingContextManagerNotificationKeyPrefix @"gcm.notification."
+
+static NSString *const kLogTag = @"FIRMessagingAnalytics";
+
+static NSString *const kLocalTimeFormatString = @"yyyy-MM-dd HH:mm:ss";
+
+static NSString *const kContextManagerPrefixKey = kFIRMessagingContextManagerPrefixKey;
+
+// Local timed messages (format yyyy-mm-dd HH:mm:ss)
+NSString *const kFIRMessagingContextManagerLocalTimeStart = kFIRMessagingContextManagerPrefixKey @"lt_start";
+NSString *const kFIRMessagingContextManagerLocalTimeEnd = kFIRMessagingContextManagerPrefixKey @"lt_end";
+
+// Local Notification Params
+NSString *const kFIRMessagingContextManagerBodyKey = kFIRMessagingContextManagerNotificationKeyPrefix @"body";
+NSString *const kFIRMessagingContextManagerTitleKey = kFIRMessagingContextManagerNotificationKeyPrefix @"title";
+NSString *const kFIRMessagingContextManagerBadgeKey = kFIRMessagingContextManagerNotificationKeyPrefix @"badge";
+NSString *const kFIRMessagingContextManagerCategoryKey =
+ kFIRMessagingContextManagerNotificationKeyPrefix @"click_action";
+NSString *const kFIRMessagingContextManagerSoundKey = kFIRMessagingContextManagerNotificationKeyPrefix @"sound";
+NSString *const kFIRMessagingContextManagerContentAvailableKey =
+ kFIRMessagingContextManagerNotificationKeyPrefix @"content-available";
+
+typedef NS_ENUM(NSUInteger, FIRMessagingContextManagerMessageType) {
+ FIRMessagingContextManagerMessageTypeNone,
+ FIRMessagingContextManagerMessageTypeLocalTime,
+};
+
+@implementation FIRMessagingContextManagerService
+
++ (BOOL)isContextManagerMessage:(NSDictionary *)message {
+ // For now we only support local time in ContextManager.
+ if (![message[kFIRMessagingContextManagerLocalTimeStart] length]) {
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeContextManagerService000,
+ @"Received message missing local start time, dropped.");
+ return NO;
+ }
+
+ return YES;
+}
+
++ (BOOL)handleContextManagerMessage:(NSDictionary *)message {
+ NSString *startTimeString = message[kFIRMessagingContextManagerLocalTimeStart];
+ if (startTimeString.length) {
+ FIRMessagingLoggerDebug(kFIRMessagingMessageCodeContextManagerService001,
+ @"%@ Received context manager message with local time %@", kLogTag,
+ startTimeString);
+ return [self handleContextManagerLocalTimeMessage:message];
+ }
+
+ return NO;
+}
+
++ (BOOL)handleContextManagerLocalTimeMessage:(NSDictionary *)message {
+ NSString *startTimeString = message[kFIRMessagingContextManagerLocalTimeStart];
+ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+ [dateFormatter setDateFormat:kLocalTimeFormatString];
+ NSDate *startDate = [dateFormatter dateFromString:startTimeString];
+
+ _FIRMessagingDevAssert(startDate, @"Invalid local start date format %@", startTimeString);
+ if (!startTimeString) {
+ FIRMessagingLoggerError(kFIRMessagingMessageCodeContextManagerService002,
+ @"Invalid local start date format %@. Message dropped",
+ startTimeString);
+ return NO;
+ }
+
+ NSDate *currentDate = [NSDate date];
+
+ if ([currentDate compare:startDate] == NSOrderedAscending) {
+ [self scheduleLocalNotificationForMessage:message
+ atDate:startDate];
+ } else {
+ // check end time has not passed
+ NSString *endTimeString = message[kFIRMessagingContextManagerLocalTimeEnd];
+ if (!endTimeString) {
+ FIRMessagingLoggerInfo(
+ kFIRMessagingMessageCodeContextManagerService003,
+ @"No end date specified for message, start date elapsed. Message dropped.");
+ return YES;
+ }
+
+ NSDate *endDate = [dateFormatter dateFromString:endTimeString];
+
+ _FIRMessagingDevAssert(endDate, @"Invalid local end date format %@", endTimeString);
+ if (!endTimeString) {
+ FIRMessagingLoggerError(kFIRMessagingMessageCodeContextManagerService004,
+ @"Invalid local end date format %@. Message dropped", endTimeString);
+ return NO;
+ }
+
+ if ([endDate compare:currentDate] == NSOrderedAscending) {
+ // end date has already passed drop the message
+ FIRMessagingLoggerInfo(kFIRMessagingMessageCodeContextManagerService005,
+ @"End date %@ has already passed. Message dropped.", endTimeString);
+ return YES;
+ }
+
+ // schedule message right now (buffer 10s)
+ [self scheduleLocalNotificationForMessage:message
+ atDate:[currentDate dateByAddingTimeInterval:10]];
+ }
+ return YES;
+}
+
++ (void)scheduleLocalNotificationForMessage:(NSDictionary *)message
+ atDate:(NSDate *)date {
+ NSDictionary *apsDictionary = message;
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ UILocalNotification *notification = [[UILocalNotification alloc] init];
+#pragma clang diagnostic pop
+
+ // A great way to understand timezones and UILocalNotifications
+ // http://stackoverflow.com/questions/18424569/understanding-uilocalnotification-timezone
+ notification.timeZone = [NSTimeZone defaultTimeZone];
+ notification.fireDate = date;
+
+ // In the current solution all of the display stuff goes into a special "aps" dictionary
+ // being sent in the message.
+ if ([apsDictionary[kFIRMessagingContextManagerBodyKey] length]) {
+ notification.alertBody = apsDictionary[kFIRMessagingContextManagerBodyKey];
+ }
+ if ([apsDictionary[kFIRMessagingContextManagerTitleKey] length]) {
+ // |alertTitle| is iOS 8.2+, so check if we can set it
+ if ([notification respondsToSelector:@selector(setAlertTitle:)]) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunguarded-availability"
+ notification.alertTitle = apsDictionary[kFIRMessagingContextManagerTitleKey];
+#pragma pop
+ }
+ }
+
+ if (apsDictionary[kFIRMessagingContextManagerSoundKey]) {
+ notification.soundName = apsDictionary[kFIRMessagingContextManagerSoundKey];
+ }
+ if (apsDictionary[kFIRMessagingContextManagerBadgeKey]) {
+ notification.applicationIconBadgeNumber =
+ [apsDictionary[kFIRMessagingContextManagerBadgeKey] integerValue];
+ }
+ if (apsDictionary[kFIRMessagingContextManagerCategoryKey]) {
+ // |category| is iOS 8.0+, so check if we can set it
+ if ([notification respondsToSelector:@selector(setCategory:)]) {
+ notification.category = apsDictionary[kFIRMessagingContextManagerCategoryKey];
+ }
+ }
+
+ NSDictionary *userInfo = [self parseDataFromMessage:message];
+ if (userInfo.count) {
+ notification.userInfo = userInfo;
+ }
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ UIApplication *application = FIRMessagingUIApplication();
+ if (!application) {
+ return;
+ }
+ [application scheduleLocalNotification:notification];
+#pragma clang diagnostic pop
+}
+
++ (NSDictionary *)parseDataFromMessage:(NSDictionary *)message {
+ NSMutableDictionary *data = [NSMutableDictionary dictionary];
+ for (NSObject *key in message) {
+ if ([key isKindOfClass:[NSString class]]) {
+ NSString *keyString = (NSString *)key;
+ if ([keyString isEqualToString:kFIRMessagingContextManagerContentAvailableKey]) {
+ continue;
+ } else if ([keyString hasPrefix:kContextManagerPrefixKey]) {
+ continue;
+ }
+ }
+ data[[key copy]] = message[key];
+ }
+ return [data copy];
+}
+
+@end
diff --git a/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingDataMessageManager.h b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingDataMessageManager.h
new file mode 100644
index 0000000..cf8df74
--- /dev/null
+++ b/iOS/Pods/FirebaseMessaging/Firebase/Messaging/FIRMessagingDataMessageManager.h
@@ -0,0 +1,101 @@
+/*
+ * 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
+
+@class GtalkDataMessageStanza;
+
+@class FIRMessagingClient;
+@class FIRMessagingConnection;
+@class FIRMessagingReceiver;
+@class FIRMessagingRmqManager;
+@class FIRMessagingSyncMessageManager;
+
+@protocol FIRMessagingDataMessageManagerDelegate