diff --git a/src/ios/firebase/FirebaseAnalytics.framework/Headers/FIRParameterNames.h b/src/ios/firebase/FirebaseAnalytics.framework/Headers/FIRParameterNames.h
deleted file mode 100644
index 42c0c5e21..000000000
--- a/src/ios/firebase/FirebaseAnalytics.framework/Headers/FIRParameterNames.h
+++ /dev/null
@@ -1,304 +0,0 @@
-/// @file FIRParameterNames.h
-///
-/// Predefined event parameter names.
-///
-/// Params supply information that contextualize Events. You can associate up to 25 unique Params
-/// with each Event type. Some Params are suggested below for certain common Events, but you are
-/// not limited to these. You may supply extra Params for suggested Events or custom Params for
-/// Custom events. Param names can be up to 24 characters long, may only contain alphanumeric
-/// characters and underscores ("_"), and must start with an alphabetic character. Param values can
-/// be up to 36 characters long. The "firebase_" prefix is reserved and should not be used.
-
-/// Game achievement ID (NSString).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterAchievementID : @"10_matches_won",
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterAchievementID = @"achievement_id";
-
-/// Character used in game (NSString).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterCharacter : @"beat_boss",
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterCharacter = @"character";
-
-/// Type of content selected (NSString).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterContentType : @"news article",
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterContentType = @"content_type";
-
-/// Coupon code for a purchasable item (NSString).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterCoupon : @"zz123",
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterCoupon = @"coupon";
-
-/// Purchase currency in 3-letter
-/// ISO_4217 format (NSString).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterCurrency : @"USD",
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterCurrency = @"currency";
-
-/// Flight or Travel destination (NSString).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterDestination : @"Mountain View, CA",
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterDestination = @"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 = @"end_date";
-
-/// Flight number for travel events (NSString).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterFlightNumber : @"ZZ800",
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterFlightNumber = @"flight_number";
-
-/// Group/clan/guild ID (NSString).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterGroupID : @"g1",
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterGroupID = @"group_id";
-
-/// Item category (NSString).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterItemCategory : @"t-shirts",
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterItemCategory = @"item_category";
-
-/// Item ID (NSString).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterItemID : @"p7654",
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterItemID = @"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 = @"item_location_id";
-
-/// Item name (NSString).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterItemName : @"abc",
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterItemName = @"item_name";
-
-/// Level in game (signed 64-bit integer as NSNumber).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterLevel : @(42),
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterLevel = @"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 = @"location";
-
-/// Number of nights staying at hotel (signed 64-bit integer as NSNumber).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterNumberOfNights : @(3),
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterNumberOfNights = @"number_of_nights";
-
-/// Number of passengers traveling (signed 64-bit integer as NSNumber).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterNumberOfPassengers : @(11),
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterNumberOfPassengers = @"number_of_passengers";
-
-/// Number of rooms for travel events (signed 64-bit integer as NSNumber).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterNumberOfRooms : @(2),
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterNumberOfRooms = @"number_of_rooms";
-
-/// Flight or Travel origin (NSString).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterOrigin : @"Mountain View, CA",
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterOrigin = @"origin";
-
-/// Purchase price (double as NSNumber).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterPrice : @(1.0),
-/// kFIRParameterCurrency : @"USD", // e.g. $1.00 USD
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterPrice = @"price";
-
-/// Purchase quantity (signed 64-bit integer as NSNumber).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterQuantity : @(1),
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterQuantity = @"quantity";
-
-/// Score in game (signed 64-bit integer as NSNumber).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterScore : @(4200),
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterScore = @"score";
-
-/// The search string/keywords used (NSString).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterSearchTerm : @"periodic table",
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterSearchTerm = @"search_term";
-
-/// Shipping cost (double as NSNumber).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterShipping : @(9.50),
-/// kFIRParameterCurrency : @"USD", // e.g. $9.50 USD
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterShipping = @"shipping";
-
-/// Sign up method (NSString).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterSignUpMethod : @"google",
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterSignUpMethod = @"sign_up_method";
-
-/// 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 = @"start_date";
-
-/// Tax amount (double as NSNumber).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterTax : @(1.0),
-/// kFIRParameterCurrency : @"USD", // e.g. $1.00 USD
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterTax = @"tax";
-
-/// A single ID for a ecommerce group transaction (NSString).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterTransactionID : @"ab7236dd9823",
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterTransactionID = @"transaction_id";
-
-/// Travel class (NSString).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterTravelClass : @"business",
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterTravelClass = @"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: Currency-related values should be supplied using
-/// double as NSNumber and must be accompanied by a {@link kFIRParameterCurrency} parameter. The
-/// valid range of accumulated values is [-9,223,372,036,854.77, 9,223,372,036,854.77].
-///
-/// NSDictionary *params = @{
-/// kFIRParameterValue : @(3.99),
-/// kFIRParameterCurrency : @"USD", // e.g. $3.99 USD
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterValue = @"value";
-
-/// Name of virtual currency type (NSString).
-///
-/// NSDictionary *params = @{
-/// kFIRParameterVirtualCurrencyName : @"virtual_currency_name",
-/// // ...
-/// };
-///
-static NSString *const kFIRParameterVirtualCurrencyName = @"virtual_currency_name";
diff --git a/src/ios/firebase/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h b/src/ios/firebase/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h
deleted file mode 100644
index 54cf1c201..000000000
--- a/src/ios/firebase/FirebaseAnalytics.framework/Headers/FIRUserPropertyNames.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/// @file FIRUserPropertyNames.h
-///
-/// Predefined user property names.
-///
-/// A UserProperty is an attribute that describes the app-user. By supplying UserProperties, you can
-/// later analyze different behaviors of various segments of your userbase. You may supply up to 25
-/// unique UserProperties per app, and you can use the name and value of your choosing for each one.
-/// UserProperty names can be up to 24 characters long, may only contain alphanumeric characters and
-/// underscores ("_"), and must start with an alphabetic character. UserProperty values can be up to
-/// 36 characters long. The "firebase_" prefix is reserved and should not be used.
-
-/// The method used to sign in. For example, "google", "facebook" or "twitter".
-static NSString *const kFIRUserPropertySignUpMethod = @"sign_up_method";
diff --git a/src/ios/firebase/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h b/src/ios/firebase/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h
deleted file mode 100644
index 02667b303..000000000
--- a/src/ios/firebase/FirebaseAnalytics.framework/Headers/FirebaseAnalytics.h
+++ /dev/null
@@ -1,11 +0,0 @@
-// Generated umbrella header for FirebaseAnalytics.
-
-#import "FIRAnalytics+AppDelegate.h"
-#import "FIRAnalytics.h"
-#import "FIRAnalyticsConfiguration.h"
-#import "FIRApp.h"
-#import "FIRConfiguration.h"
-#import "FIREventNames.h"
-#import "FIROptions.h"
-#import "FIRParameterNames.h"
-#import "FIRUserPropertyNames.h"
diff --git a/src/ios/firebase/FirebaseAnalytics.framework/Modules/module.modulemap b/src/ios/firebase/FirebaseAnalytics.framework/Modules/module.modulemap
deleted file mode 100644
index e54b5eaae..000000000
--- a/src/ios/firebase/FirebaseAnalytics.framework/Modules/module.modulemap
+++ /dev/null
@@ -1,23 +0,0 @@
-framework module FirebaseAnalytics {
-
- export *
-
- umbrella header "FirebaseAnalytics.h"
-
- header "FIRAnalytics+AppDelegate.h"
- header "FIRAnalytics.h"
- header "FIRAnalyticsConfiguration.h"
- header "FIRApp.h"
- header "FIRConfiguration.h"
- header "FIREventNames.h"
- header "FIROptions.h"
- header "FIRParameterNames.h"
- header "FIRUserPropertyNames.h"
-
- link framework "AddressBook"
- link framework "StoreKit"
-
- link "c++"
- link "sqlite3"
- link "z"
-}
diff --git a/src/ios/firebase/FirebaseCore.framework/FirebaseCore b/src/ios/firebase/FirebaseCore.framework/FirebaseCore
deleted file mode 100644
index 5f3dcecff..000000000
Binary files a/src/ios/firebase/FirebaseCore.framework/FirebaseCore and /dev/null differ
diff --git a/src/ios/firebase/FirebaseCore.framework/Headers/FIRAnalyticsConfiguration.h b/src/ios/firebase/FirebaseCore.framework/Headers/FIRAnalyticsConfiguration.h
deleted file mode 100644
index 667d5a4be..000000000
--- a/src/ios/firebase/FirebaseCore.framework/Headers/FIRAnalyticsConfiguration.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#import
-
-/**
- * This class provides configuration fields for Firebase Analytics.
- */
-@interface FIRAnalyticsConfiguration : NSObject
-
-/**
- * Returns the shared instance of FIRAnalyticsConfiguration.
- */
-+ (FIRAnalyticsConfiguration *)sharedInstance;
-
-/**
- * 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;
-
-/**
- * Deprecated. Sets whether measurement and reporting are enabled for this app on this device. By
- * default they are enabled.
- */
-- (void)setIsEnabled:(BOOL)isEnabled
- DEPRECATED_MSG_ATTRIBUTE("Use setAnalyticsCollectionEnabled: instead.");
-
-@end
diff --git a/src/ios/firebase/FirebaseCore.framework/Headers/FIRApp.h b/src/ios/firebase/FirebaseCore.framework/Headers/FIRApp.h
deleted file mode 100644
index 45b238898..000000000
--- a/src/ios/firebase/FirebaseCore.framework/Headers/FIRApp.h
+++ /dev/null
@@ -1,94 +0,0 @@
-#import
-#import
-
-@class FIROptions;
-
-NS_ASSUME_NONNULL_BEGIN
-
-typedef void (^FIRAppVoidBoolCallback)(BOOL success);
-
-/**
- * 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.
- */
-@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.
- */
-+ (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;
-
-/**
- * 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.
- */
-+ (void)configureWithName:(NSString *)name options:(FIROptions *)options;
-
-/**
- * Returns the default app, or nil if the default app does not exist.
- */
-+ (nullable FIRApp *)defaultApp NS_SWIFT_NAME(defaultApp());
-
-/**
- * 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;
-
-/**
- * Returns the set of all extant FIRApp instances, or nil if there is no FIRApp instance. This
- * method is thread safe.
- */
-+ (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 in class level.
- */
-- (void)deleteApp:(FIRAppVoidBoolCallback)completion;
-
-/**
- * FIRFirebaseApp instances should not be initialized directly. Call |FIRApp configure|, or
- * |FIRApp configureWithOptions:|, or |FIRApp configureWithNames:options| directly.
- */
-- (nullable instancetype)init NS_UNAVAILABLE;
-
-/**
- * Gets the name of this app.
- */
-@property(nonatomic, copy, readonly) NSString *name;
-
-/**
- * Gets the options for this app.
- */
-@property(nonatomic, readonly) FIROptions *options;
-
-@end
-
-NS_ASSUME_NONNULL_END
diff --git a/src/ios/firebase/FirebaseCore.framework/Headers/FIRConfiguration.h b/src/ios/firebase/FirebaseCore.framework/Headers/FIRConfiguration.h
deleted file mode 100644
index e85ea8bc8..000000000
--- a/src/ios/firebase/FirebaseCore.framework/Headers/FIRConfiguration.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#import
-
-#import "FIRAnalyticsConfiguration.h"
-
-/**
- * The log levels used by FIRConfiguration.
- */
-typedef NS_ENUM(NSInteger, FIRLogLevel) {
- kFIRLogLevelError __deprecated = 0,
- kFIRLogLevelWarning __deprecated,
- kFIRLogLevelInfo __deprecated,
- kFIRLogLevelDebug __deprecated,
- kFIRLogLevelAssert __deprecated,
- kFIRLogLevelMax __deprecated = kFIRLogLevelAssert
-} DEPRECATED_MSG_ATTRIBUTE(
- "Use -FIRDebugEnabled and -FIRDebugDisabled. See FIRApp.h for more details.");
-
-/**
- * This interface provides global level properties that the developer can tweak, and the singleton
- * of the Firebase Analytics configuration class.
- */
-@interface FIRConfiguration : NSObject
-
-+ (FIRConfiguration *)sharedInstance;
-
-// The configuration class for Firebase Analytics.
-@property(nonatomic, readwrite) FIRAnalyticsConfiguration *analyticsConfiguration;
-
-// Global log level. Defaults to kFIRLogLevelError.
-@property(nonatomic, readwrite, assign) FIRLogLevel logLevel DEPRECATED_MSG_ATTRIBUTE(
- "Use -FIRDebugEnabled and -FIRDebugDisabled. See FIRApp.h for more details.");
-
-@end
diff --git a/src/ios/firebase/FirebaseCore.framework/Headers/FIROptions.h b/src/ios/firebase/FirebaseCore.framework/Headers/FIROptions.h
deleted file mode 100644
index 5ab20c69b..000000000
--- a/src/ios/firebase/FirebaseCore.framework/Headers/FIROptions.h
+++ /dev/null
@@ -1,87 +0,0 @@
-#import
-
-/**
- * This class provides constant fields of Google APIs.
- */
-@interface FIROptions : NSObject
-
-/**
- * Returns the default options.
- */
-+ (FIROptions *)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, readonly, copy) NSString *APIKey;
-
-/**
- * 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, readonly, copy) NSString *clientID;
-
-/**
- * The tracking ID for Google Analytics, e.g. @"UA-12345678-1", used to configure Google Analytics.
- */
-@property(nonatomic, readonly, copy) NSString *trackingID;
-
-/**
- * The Project Number from the Google Developer's console, for example @"012345678901", used to
- * configure Google Cloud Messaging.
- */
-@property(nonatomic, readonly, copy) NSString *GCMSenderID;
-
-/**
- * The Android client ID used in Google AppInvite when an iOS app has its Android version, for
- * example @"12345.apps.googleusercontent.com".
- */
-@property(nonatomic, readonly, copy) NSString *androidClientID;
-
-/**
- * The Google App ID that is used to uniquely identify an instance of an app.
- */
-@property(nonatomic, readonly, copy) NSString *googleAppID;
-
-/**
- * The database root URL, e.g. @"http://abc-xyz-123.firebaseio.com".
- */
-@property(nonatomic, readonly, copy) NSString *databaseURL;
-
-/**
- * The URL scheme used to set up Durable Deep Link service.
- */
-@property(nonatomic, readwrite, copy) NSString *deepLinkURLScheme;
-
-/**
- * The Google Cloud Storage bucket name, e.g. @"abc-xyz-123.storage.firebase.com".
- */
-@property(nonatomic, readonly, copy) NSString *storageBucket;
-
-/**
- * Initializes a customized instance of FIROptions with keys. googleAppID, bundleID and GCMSenderID
- * are required. Other keys may required for configuring specific services.
- */
-- (instancetype)initWithGoogleAppID:(NSString *)googleAppID
- bundleID:(NSString *)bundleID
- GCMSenderID:(NSString *)GCMSenderID
- APIKey:(NSString *)APIKey
- clientID:(NSString *)clientID
- trackingID:(NSString *)trackingID
- androidClientID:(NSString *)androidClientID
- databaseURL:(NSString *)databaseURL
- storageBucket:(NSString *)storageBucket
- deepLinkURLScheme:(NSString *)deepLinkURLScheme;
-
-/**
- * Initializes a customized instance of FIROptions from the file at the given plist file path.
- * 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.
- */
-- (instancetype)initWithContentsOfFile:(NSString *)plistPath;
-
-@end
diff --git a/src/ios/firebase/FirebaseCore.framework/Headers/FirebaseCore.h b/src/ios/firebase/FirebaseCore.framework/Headers/FirebaseCore.h
deleted file mode 100644
index d144758d7..000000000
--- a/src/ios/firebase/FirebaseCore.framework/Headers/FirebaseCore.h
+++ /dev/null
@@ -1,6 +0,0 @@
-// Generated umbrella header for FirebaseCore.
-
-#import "FIRAnalyticsConfiguration.h"
-#import "FIRApp.h"
-#import "FIRConfiguration.h"
-#import "FIROptions.h"
diff --git a/src/ios/firebase/FirebaseCore.framework/Modules/module.modulemap b/src/ios/firebase/FirebaseCore.framework/Modules/module.modulemap
deleted file mode 100644
index 82d14eb6d..000000000
--- a/src/ios/firebase/FirebaseCore.framework/Modules/module.modulemap
+++ /dev/null
@@ -1,15 +0,0 @@
-framework module FirebaseCore {
-
- export *
-
- umbrella header "FirebaseCore.h"
-
- header "FIRAnalyticsConfiguration.h"
- header "FIRApp.h"
- header "FIRConfiguration.h"
- header "FIROptions.h"
-
- link framework "SystemConfiguration"
-
- link "c++"
-}
diff --git a/src/ios/firebase/FirebaseInstanceID.framework/FirebaseInstanceID b/src/ios/firebase/FirebaseInstanceID.framework/FirebaseInstanceID
deleted file mode 100644
index 5d67d055e..000000000
Binary files a/src/ios/firebase/FirebaseInstanceID.framework/FirebaseInstanceID and /dev/null differ
diff --git a/src/ios/firebase/FirebaseInstanceID.framework/Headers/FIRInstanceID.h b/src/ios/firebase/FirebaseInstanceID.framework/Headers/FIRInstanceID.h
deleted file mode 100644
index 717e290aa..000000000
--- a/src/ios/firebase/FirebaseInstanceID.framework/Headers/FIRInstanceID.h
+++ /dev/null
@@ -1,245 +0,0 @@
-#import
-
-/**
- * @memberof FIRInstanceID
- *
- * The scope to be used when fetching/deleting a token for Firebase Messaging.
- */
-FOUNDATION_EXPORT NSString * __nonnull const kFIRInstanceIDScopeFirebaseMessaging;
-
-/**
- * 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 * __nonnull const kFIRInstanceIDTokenRefreshNotification;
-
-/**
- * @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);
-
-
-/**
- * @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 * __nullable error);
-
-/**
- * @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);
-
-/**
- * @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);
-
-/**
- * @enum FIRInstanceIDError
- */
-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,
-};
-
-/**
- * The APNS token type for the app. If the token type is set to `UNKNOWN`
- * InstanceID will implicitly try to figure out what the actual token type
- * is from the provisioning profile.
- */
-typedef NS_ENUM(NSInteger, FIRInstanceIDAPNSTokenType) {
- /// Unknown token type.
- FIRInstanceIDAPNSTokenTypeUnknown,
- /// Sandbox token type.
- FIRInstanceIDAPNSTokenTypeSandbox,
- /// Production token type.
- FIRInstanceIDAPNSTokenTypeProd,
-};
-
-/**
- * Instance ID provides a unique identifier for each app instance and a mechanism
- * to authenticate and authorize actions (for example, sending a GCM message).
- *
- * 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 with a `com.firebase.iid.token-refresh`
- * notification.
- *
- * 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]`.
- */
-@interface FIRInstanceID : NSObject
-
-/**
- * FIRInstanceID.
- *
- * @return A shared instance of FIRInstanceID.
- */
-+ (nonnull instancetype)instanceID NS_SWIFT_NAME(instanceID());
-
-/**
- * Unavailable. Use +instanceID instead.
- */
-- (nonnull instancetype)init __attribute__((unavailable("Use +instanceID instead.")));
-
-/**
- * Set APNS token for the application. This APNS token will be used to register
- * with Firebase Messaging using `token` or
- * `tokenWithAuthorizedEntity:scope:options:handler`. If the token type is set to
- * `FIRInstanceIDAPNSTokenTypeUnknown` InstanceID will read the provisioning profile
- * to find out the token type.
- *
- * @param token The APNS token for the application.
- * @param type The APNS token type for the above token.
- */
-- (void)setAPNSToken:(nonnull NSData *)token
- type:(FIRInstanceIDAPNSTokenType)type;
-
-#pragma mark - Tokens
-
-/**
- * Returns a Firebase Messaging scoped token for the firebase app.
- *
- * @return Null Returns null if the device has not yet been registerd with
- * Firebase Message else returns a valid token.
- */
-- (nullable NSString *)token;
-
-/**
- * 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.
- *
- * 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 UIApplication's
- * `didRegisterForRemoteNotificationsWithDeviceToken` method.
- * All other keys and values in the options dict need to be
- * instances of NSString or else they will be discarded. Bundle
- * keys starting with 'GCM.' and 'GOOGLE.' are reserved.
- * @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:(nonnull NSString *)authorizedEntity
- scope:(nonnull NSString *)scope
- options:(nullable NSDictionary *)options
- handler:(nonnull 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:(nonnull NSString *)authorizedEntity
- scope:(nonnull NSString *)scope
- handler:(nonnull 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.
- *
- *
- * @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:(nonnull FIRInstanceIDHandler)handler;
-
-/**
- * Resets Instance ID and revokes all tokens.
- */
-- (void)deleteIDWithHandler:(nonnull FIRInstanceIDDeleteHandler)handler;
-
-@end
diff --git a/src/ios/firebase/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h b/src/ios/firebase/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h
deleted file mode 100644
index 053ec2b1c..000000000
--- a/src/ios/firebase/FirebaseInstanceID.framework/Headers/FirebaseInstanceID.h
+++ /dev/null
@@ -1 +0,0 @@
-#import "FIRInstanceID.h"
diff --git a/src/ios/firebase/FirebaseInstanceID.framework/Modules/module.modulemap b/src/ios/firebase/FirebaseInstanceID.framework/Modules/module.modulemap
deleted file mode 100644
index b4a5b5e39..000000000
--- a/src/ios/firebase/FirebaseInstanceID.framework/Modules/module.modulemap
+++ /dev/null
@@ -1,8 +0,0 @@
-framework module FirebaseInstanceID {
-
- export *
-
- umbrella header "FirebaseInstanceID.h"
-
- header "FIRInstanceID.h"
-}
diff --git a/src/ios/firebase/FirebaseMessaging.framework/FirebaseMessaging b/src/ios/firebase/FirebaseMessaging.framework/FirebaseMessaging
deleted file mode 100644
index de753660e..000000000
Binary files a/src/ios/firebase/FirebaseMessaging.framework/FirebaseMessaging and /dev/null differ
diff --git a/src/ios/firebase/FirebaseMessaging.framework/Headers/FIRMessaging.h b/src/ios/firebase/FirebaseMessaging.framework/Headers/FIRMessaging.h
deleted file mode 100644
index 04ea927ff..000000000
--- a/src/ios/firebase/FirebaseMessaging.framework/Headers/FIRMessaging.h
+++ /dev/null
@@ -1,236 +0,0 @@
-#import
-
-/**
- * The completion handler invoked once the data connection with FIRMessaging is
- * established. The data connection is used to send a continous stream of
- * data and all the FIRMessaging data notifications arrive through this connection.
- * Once the connection is established we invoke the callback with `nil` error.
- * Correspondingly if we get an error while trying to establish a connection
- * we invoke the handler with an appropriate error object and do an
- * exponential backoff to try and connect again unless successful.
- *
- * @param error The error object if any describing why the data connection
- * to FIRMessaging failed.
- */
-typedef void(^FIRMessagingConnectCompletion)(NSError * __nullable error);
-
-/**
- * Notification sent when the upstream message has been delivered
- * successfully to the server. The notification object will be the messageID
- * of the successfully delivered message.
- */
-FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingSendSuccessNotification;
-
-/**
- * Notification sent when the upstream message was failed to be sent to the
- * server. The notification object will be the messageID of the failed
- * message. The userInfo dictionary will contain the relevant error
- * information for the failure.
- */
-FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingSendErrorNotification;
-
-/**
- * Notification sent when the Firebase messaging server deletes pending
- * messages due to exceeded storage limits. This may occur, for example, when
- * the device cannot be reached for an extended period of time.
- *
- * It is recommended to retrieve any missing messages directly from the
- * server.
- */
-FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingMessagesDeletedNotification;
-
-/**
- * @enum FIRMessagingError
- */
-typedef NS_ENUM(NSUInteger, FIRMessagingError) {
- // Unknown error.
- FIRMessagingErrorUnknown = 0,
-
- // Auth Error -- FIRMessaging couldn't validate request from this client.
- FIRMessagingErrorAuthentication = 1,
-
- // NoAccess -- InstanceID service cannot be accessed.
- FIRMessagingErrorNoAccess = 2,
-
- // Timeout -- Request to InstanceID backend timed out.
- FIRMessagingErrorTimeout = 3,
-
- // Network -- No network available to reach the servers.
- FIRMessagingErrorNetwork = 4,
-
- // OperationInProgress -- Another similar operation in progress,
- // bailing this one.
- FIRMessagingErrorOperationInProgress = 5,
-
- // InvalidRequest -- Some parameters of the request were invalid.
- FIRMessagingErrorInvalidRequest = 7,
-};
-
-/// Status for the downstream message received by the app.
-typedef NS_ENUM(NSInteger, FIRMessagingMessageStatus) {
- FIRMessagingMessageStatusUnknown,
- /// New downstream message received by the app.
- FIRMessagingMessageStatusNew,
-};
-
-/// Information about a downstream message received by the app.
-@interface FIRMessagingMessageInfo : NSObject
-
-@property(nonatomic, readonly, assign) FIRMessagingMessageStatus status;
-
-@end
-
-/**
- * A remote data message received by the app via FCM (not just the APNs interface).
- *
- * This is only for devices running iOS 10 or above. To support devices running iOS 9 or below, use
- * the local and remote notifications handlers defined in UIApplicationDelegate protocol.
- */
-@interface FIRMessagingRemoteMessage : NSObject
-
-/// The downstream message received by the application.
-@property(nonatomic, readonly, strong, nonnull) NSDictionary *appData;
-
-@end
-
-/**
- * A protocol to receive data message via FCM for devices running iOS 10 or above.
- *
- * To support devices running iOS 9 or below, use the local and remote notifications handlers
- * defined in UIApplicationDelegate protocol.
- */
-@protocol FIRMessagingDelegate
-
-/// The callback to handle data message received via FCM for devices running iOS 10 or above.
-- (void)applicationReceivedRemoteMessage:(nonnull FIRMessagingRemoteMessage *)remoteMessage;
-
-@end
-
-/**
- * Firebase Messaging enables apps to communicate with their app servers
- * using simple messages.
- *
- * To send or receive messages, the app must get a
- * registration token from GGLInstanceID, which authorizes an
- * app server to send messages to an app instance. Pass your sender ID and
- * `kGGLInstanceIDScopeFIRMessaging` as parameters to the method.
- *
- * A sender ID is a project number created when you configure your API project.
- * It is labeled "Project Number" in the Google Developers Console.
- *
- * In order to receive FIRMessaging messages, declare application:didReceiveRemoteNotification:
- *
- * Client apps can send upstream messages back to the app server using the XMPP-based
- * Cloud Connection Server,
- *
- */
-@interface FIRMessaging : NSObject
-
-/**
- * Delegate to handle remote data messages received via FCM for devices running iOS 10 or above.
- */
-@property(nonatomic, weak, nullable) id remoteMessageDelegate;
-
-/**
- * FIRMessaging
- *
- * @return An instance of FIRMessaging.
- */
-+ (nonnull instancetype)messaging NS_SWIFT_NAME(messaging());
-
-/**
- * Unavailable. Use +messaging instead.
- */
-- (nonnull instancetype)init __attribute__((unavailable("Use +messaging instead.")));
-
-#pragma mark - Connect
-
-/**
- * Create a FIRMessaging data connection which will be used to send the data notifications
- * send by your server. It will also be used to send ACKS and other messages based
- * on the FIRMessaging ACKS and other messages based on the FIRMessaging protocol.
- *
- * Use the `disconnect` method to disconnect the connection.
- *
- * @see FIRMessagingService disconnect
- *
- * @param handler The handler to be invoked once the connection is established.
- * If the connection fails we invoke the handler with an
- * appropriate error code letting you know why it failed. At
- * the same time, FIRMessaging performs exponential backoff to retry
- * establishing a connection and invoke the handler when successful.
- */
-- (void)connectWithCompletion:(nonnull FIRMessagingConnectCompletion)handler;
-
-/**
- * Disconnect the current FIRMessaging data connection. This stops any attempts to
- * connect to FIRMessaging. Calling this on an already disconnected client is a no-op.
- *
- * Call this before `teardown` when your app is going to the background.
- * Since the FIRMessaging connection won't be allowed to live when in background it is
- * prudent to close the connection.
- */
-- (void)disconnect;
-
-#pragma mark - Topics
-
-/**
- * Asynchronously subscribes to a topic.
- *
- * @param topic The name of the topic, for example @"sports".
- */
-- (void)subscribeToTopic:(nonnull NSString *)topic;
-
-/**
- * Asynchronously unsubscribe to a topic.
- *
- * @param topic The name of the topic, for example @"sports".
- */
-- (void)unsubscribeFromTopic:(nonnull NSString *)topic;
-
-#pragma mark - Upstream
-
-/**
- * Sends an upstream ("device to cloud") message.
- *
- * The message will be queued if we don't have an active connection.
- * You can only use the upstream feature if your GCM implementation
- * uses the XMPP-based Cloud Connection Server.
- *
- * @param message Key/Value pairs to be sent. Values must be String, any
- * other type will be ignored.
- * @param to A string identifying the receiver of the message. For GCM
- * project IDs the value is `SENDER_ID@gcm.googleapis.com`.
- * @param messageID The ID of the message. This is generated by the application. It
- * must be unique for each message generated by this application.
- * It allows error callbacks and debugging, to uniquely identify
- * each message.
- * @param ttl The time to live for the message. In case we aren't able to
- * send the message before the TTL expires we will send you a
- * callback. If 0, we'll attempt to send immediately and return
- * an error if we're not connected. Otherwise, the message will
- * be queued. As for server-side messages, we don't return an error
- * if the message has been dropped because of TTL; this can happen
- * on the server side, and it would require extra communication.
- */
-- (void)sendMessage:(nonnull NSDictionary *)message
- to:(nonnull NSString *)receiver
- withMessageID:(nonnull NSString *)messageID
- timeToLive:(int64_t)ttl;
-
-#pragma mark - Analytics
-
-/**
- * Call this when the app received a downstream message. Used to track message
- * delivery and analytics for messages. You don't need to call this if you
- * don't set the `FIRMessagingAutoSetupEnabled` flag in your Info.plist. In the
- * latter case the library will call this implicitly to track relevant
- * messages.
- *
- * @param message The downstream message received by the application.
- *
- * @return Information about the downstream message.
- */
-- (nonnull FIRMessagingMessageInfo *)appDidReceiveMessage:(nonnull NSDictionary *)message;
-
-@end
diff --git a/src/ios/firebase/FirebaseMessaging.framework/Headers/FirebaseMessaging.h b/src/ios/firebase/FirebaseMessaging.framework/Headers/FirebaseMessaging.h
deleted file mode 100644
index ef49e7ff7..000000000
--- a/src/ios/firebase/FirebaseMessaging.framework/Headers/FirebaseMessaging.h
+++ /dev/null
@@ -1 +0,0 @@
-#import "FIRMessaging.h"
diff --git a/src/ios/firebase/FirebaseMessaging.framework/Modules/module.modulemap b/src/ios/firebase/FirebaseMessaging.framework/Modules/module.modulemap
deleted file mode 100644
index a390f119d..000000000
--- a/src/ios/firebase/FirebaseMessaging.framework/Modules/module.modulemap
+++ /dev/null
@@ -1,13 +0,0 @@
-framework module FirebaseMessaging {
-
- export *
-
- umbrella header "FirebaseMessaging.h"
-
- header "FIRMessaging.h"
-
- link framework "AddressBook"
- link framework "SystemConfiguration"
-
- link "sqlite3"
-}
diff --git a/src/ios/firebase/GoogleIPhoneUtilities.framework/GoogleIPhoneUtilities b/src/ios/firebase/GoogleIPhoneUtilities.framework/GoogleIPhoneUtilities
deleted file mode 100644
index 7ab2cf260..000000000
Binary files a/src/ios/firebase/GoogleIPhoneUtilities.framework/GoogleIPhoneUtilities and /dev/null differ
diff --git a/src/ios/firebase/GoogleInterchangeUtilities.framework/GoogleInterchangeUtilities b/src/ios/firebase/GoogleInterchangeUtilities.framework/GoogleInterchangeUtilities
deleted file mode 100644
index de4042474..000000000
Binary files a/src/ios/firebase/GoogleInterchangeUtilities.framework/GoogleInterchangeUtilities and /dev/null differ
diff --git a/src/ios/firebase/GoogleSymbolUtilities.framework/GoogleSymbolUtilities b/src/ios/firebase/GoogleSymbolUtilities.framework/GoogleSymbolUtilities
deleted file mode 100644
index 408a00262..000000000
Binary files a/src/ios/firebase/GoogleSymbolUtilities.framework/GoogleSymbolUtilities and /dev/null differ
diff --git a/src/ios/firebase/GoogleUtilities.framework/GoogleUtilities b/src/ios/firebase/GoogleUtilities.framework/GoogleUtilities
deleted file mode 100644
index 0fd17b65b..000000000
Binary files a/src/ios/firebase/GoogleUtilities.framework/GoogleUtilities and /dev/null differ
diff --git a/src/www/FCMPlugin.ts b/src/www/FCMPlugin.ts
new file mode 100644
index 000000000..c97049534
--- /dev/null
+++ b/src/www/FCMPlugin.ts
@@ -0,0 +1,194 @@
+import type { IChannelConfiguration } from './IChannelConfiguration'
+import type { IRequestPushPermissionOptions } from './IRequestPushPermissionOptions'
+import type { INotificationPayload } from './INotificationPayload'
+import type { IDisposable } from './IDisposable'
+import { execAsPromise } from './execAsPromise'
+import { asDisposableListener } from './eventAsDisposable'
+import { bridgeNativeEvents } from './bridgeNativeEvents'
+declare var window: {
+ cordova: {
+ platformId: string
+ }
+}
+
+/**
+ * @name FCM
+ * @description
+ * Easy plug&play push notification for Google Firebase FCM.
+ *
+ * @interfaces
+ * INotificationPayload
+ * IChannelConfiguration
+ * IRequestPushPermissionOptions
+ */
+export class FCMPlugin {
+ /**
+ * EventTarget for native-sourced custom events.
+ *
+ * @event notification
+ * @type {INotificationPayload}
+ *
+ * @event tokenRefresh
+ * @type {string}
+ *
+ */
+ public readonly eventTarget: EventTarget
+
+ constructor() {
+ // EventTarget is not fully supported on iOS and older Android
+ this.eventTarget = document.createElement('div')
+ execAsPromise('ready')
+ .catch((error: Error) => console.log('FCM: Ready error: ', error))
+ .then(() => {
+ console.log('FCM: Ready!')
+ bridgeNativeEvents(this.eventTarget)
+ })
+ console.log('FCM: has been created')
+ }
+
+ /**
+ * Removes existing push notifications from the notifications center
+ *
+ * @returns {Promise} Async call to native implementation
+ */
+ public clearAllNotifications(): Promise {
+ return execAsPromise('clearAllNotifications')
+ }
+
+ /**
+ * For Android, some notification properties are only defined programmatically.
+ * Channel can define the default behavior for notifications on Android 8.0+.
+ * Once a channel is created, it stays unchangeable until the user uninstalls the app.
+ *
+ * @param {IChannelConfiguration} channelConfig The parmeters of the new channel
+ *
+ * @returns {Promise} Async call to native implementation
+ */
+ public createNotificationChannel(channelConfig: IChannelConfiguration): Promise {
+ if (window.cordova.platformId !== 'android') {
+ return Promise.resolve()
+ }
+
+ return execAsPromise('createNotificationChannel', [channelConfig])
+ }
+
+ /**
+ * This method deletes the InstanceId, revoking all tokens.
+ *
+ * @returns {Promise} Async call to native implementation
+ */
+ public deleteInstanceId(): Promise {
+ return execAsPromise('deleteInstanceId')
+ }
+
+ /**
+ * Gets ios device's current APNS token
+ *
+ * @returns {Promise} Returns a Promise that resolves with the APNS token
+ */
+ public getAPNSToken(): Promise {
+ return window.cordova.platformId !== 'ios'
+ ? Promise.resolve('')
+ : execAsPromise('getAPNSToken')
+ }
+
+ /**
+ * Retrieves the message that, on tap, opened the app
+ *
+ * @private
+ *
+ * @returns {Promise} Async call to native implementation
+ */
+ public getInitialPushPayload(): Promise {
+ return execAsPromise('getInitialPushPayload')
+ }
+
+ /**
+ * Gets device's current registration id
+ *
+ * @returns {Promise} Returns a Promise that resolves with the registration id token
+ */
+ public getToken(): Promise {
+ return execAsPromise('getToken')
+ }
+
+ /**
+ * Checking for permissions.
+ *
+ * @returns {Promise} Returns a Promise of:
+ * - true: push was allowed (or platform is android)
+ * - false: push will not be available
+ * - null: still not answered, recommended checking again later.
+ */
+ public hasPermission(): Promise {
+ return window.cordova.platformId === 'ios'
+ ? execAsPromise('hasPermission')
+ : execAsPromise('hasPermission').then((value) => !!value)
+ }
+
+ /**
+ * Callback firing when receiving new notifications
+ *
+ * @argument {(payload: INotificationPayload) => void} callback function to be called when event is triggered
+ * @argument {{ once?: boolean }} options once defines if the listener is only trigger once
+ * @returns {IDisposable} object of which can request the listener's disposal
+ */
+ public onNotification(
+ callback: (payload: INotificationPayload) => void,
+ options?: { once?: boolean }
+ ): IDisposable {
+ return asDisposableListener(this.eventTarget, 'notification', callback, options)
+ }
+
+ /**
+ * Callback firing when receiving a new Firebase token
+ *
+ * @argument {(token: string) => void} callback function to be called when event is triggered
+ * @argument {{ once?: boolean }} options once defines if the listener is only trigger once
+ * @returns {IDisposable} object of which can request the listener's disposal
+ */
+ public onTokenRefresh(
+ callback: (token: string) => void,
+ options?: { once?: boolean }
+ ): IDisposable {
+ return asDisposableListener(this.eventTarget, 'tokenRefresh', callback, options)
+ }
+
+ /**
+ * Request push notification permission, alerting the user if it not have yet decided
+ *
+ * @param {IRequestPushPermissionOptions} options Options for push request
+ * @returns {Promise} Returns a Promise that resolves with the permission status
+ */
+ public requestPushPermission(options?: IRequestPushPermissionOptions): Promise {
+ if (window.cordova.platformId !== 'ios') {
+ return Promise.resolve(true)
+ }
+ const ios9SupportTimeout = options?.ios9Support?.timeout ?? 10
+ const ios9SupportInterval = options?.ios9Support?.interval ?? 0.3
+
+ return execAsPromise('requestPushPermission', [ios9SupportTimeout, ios9SupportInterval])
+ }
+
+ /**
+ * Subscribes you to a [topic](https://firebase.google.com/docs/notifications/android/console-topics)
+ *
+ * @param {string} topic Topic to be subscribed to
+ *
+ * @returns {Promise} Async call to native implementation
+ */
+ public subscribeToTopic(topic: string): Promise {
+ return execAsPromise('subscribeToTopic', [topic])
+ }
+
+ /**
+ * Unsubscribes you from a [topic](https://firebase.google.com/docs/notifications/android/console-topics)
+ *
+ * @param {string} topic Topic to be unsubscribed from
+ *
+ * @returns {Promise} Async call to native implementation
+ */
+ public unsubscribeFromTopic(topic: string): Promise {
+ return execAsPromise('unsubscribeFromTopic', [topic])
+ }
+}
diff --git a/src/www/IChannelConfiguration.d.ts b/src/www/IChannelConfiguration.d.ts
new file mode 100644
index 000000000..1962da6d1
--- /dev/null
+++ b/src/www/IChannelConfiguration.d.ts
@@ -0,0 +1,37 @@
+export interface IChannelConfiguration {
+ /**
+ * Channel id, used in the android_channel_id push payload key
+ */
+ id: string
+ /**
+ * Channel name, visible for the user
+ */
+ name: string
+ /**
+ * Channel description, visible for the user
+ */
+ description?: string
+ /**
+ * Importance for notifications of this channel
+ * https://developer.android.com/guide/topics/ui/notifiers/notifications#importance
+ */
+ importance?: 'none' | 'min' | 'low' | 'default' | 'high'
+ /**
+ * Visibility for notifications of this channel
+ * https://developer.android.com/training/notify-user/build-notification#lockscreenNotification
+ */
+ visibility?: 'public' | 'private' | 'secret'
+ /**
+ * Default sound resource for notifications of this channel
+ * The file should located as resources/raw/[resource name].mp3
+ */
+ sound?: string
+ /**
+ * Enable lights for notifications of this channel
+ */
+ lights?: boolean
+ /**
+ * Enable vibration for notifications of this channel
+ */
+ vibration?: boolean
+}
diff --git a/src/www/IDisposable.d.ts b/src/www/IDisposable.d.ts
new file mode 100644
index 000000000..9ab8767bd
--- /dev/null
+++ b/src/www/IDisposable.d.ts
@@ -0,0 +1,8 @@
+export interface IDisposable {
+ /**
+ * Method of which disposes listener
+ *
+ * @returns {void}
+ */
+ dispose(): void
+}
diff --git a/src/www/INotificationPayload.d.ts b/src/www/INotificationPayload.d.ts
new file mode 100644
index 000000000..28398750a
--- /dev/null
+++ b/src/www/INotificationPayload.d.ts
@@ -0,0 +1,10 @@
+export interface INotificationPayload {
+ /**
+ * Determines whether the notification was tapped or not
+ */
+ wasTapped: boolean
+ /**
+ * FCM notification data hash item
+ */
+ [others: string]: any
+}
diff --git a/src/www/IRequestPushPermissionOptions.d.ts b/src/www/IRequestPushPermissionOptions.d.ts
new file mode 100644
index 000000000..544cbd3fa
--- /dev/null
+++ b/src/www/IRequestPushPermissionOptions.d.ts
@@ -0,0 +1,20 @@
+export interface IRequestPushPermissionOptions {
+ /**
+ * Options exclusive for iOS 9 support
+ */
+ ios9Support?: {
+ /**
+ * How long it will wait for a decision from the user before returning `false`
+ *
+ * @default 10
+ */
+ timeout?: number
+
+ /**
+ * How long between each permission verification
+ *
+ * @default 0.3
+ */
+ interval?: number
+ }
+}
diff --git a/src/www/bridgeNativeEvents.ts b/src/www/bridgeNativeEvents.ts
new file mode 100644
index 000000000..56284268c
--- /dev/null
+++ b/src/www/bridgeNativeEvents.ts
@@ -0,0 +1,25 @@
+declare var window: {
+ cordova: {
+ exec: Function
+ }
+}
+
+/**
+ * This is a simple helper to Promisify the calls to cordova
+ *
+ * @param {eventTarget} EventTarget EventTarget for native-sourced custom events.
+ *
+ * @returns {void}
+ */
+export const bridgeNativeEvents = (eventTarget: EventTarget): void => {
+ const onError = (error: Error) => console.log('FCM: Error listening to native events', error)
+ const onEvent = (data: string) => {
+ try {
+ const [eventName, eventData] = JSON.parse(data)
+ eventTarget.dispatchEvent(new CustomEvent(eventName, { detail: eventData }))
+ } catch (error) {
+ console.log('FCM: Error parsing native event data', error)
+ }
+ }
+ window.cordova.exec(onEvent, onError, 'FCMPlugin', 'startJsEventBridge', [])
+}
diff --git a/src/www/eventAsDisposable.ts b/src/www/eventAsDisposable.ts
new file mode 100644
index 000000000..15a1c3ea9
--- /dev/null
+++ b/src/www/eventAsDisposable.ts
@@ -0,0 +1,25 @@
+import type { IDisposable } from './IDisposable'
+
+/**
+ * This is a simple helper to wrapp the event handler into a IDisposable
+ *
+ * @param {EventTarget} eventTarget EventTarget for native-sourced custom events
+ * @param {string} eventName Event name to listen to
+ * @param {(data: any) => void} callback Event handler
+ * @param {{ once?: boolean }} options once defines if the listener is only trigger once
+ * @returns {IDisposable} object of which can request the listener's disposal
+ */
+export const asDisposableListener = (
+ eventTarget: EventTarget,
+ eventName: string,
+ callback: (data: R) => void,
+ options: { once?: boolean } = {}
+): IDisposable => {
+ const { once } = options
+ const handler = (event: CustomEvent) => callback(event.detail)
+ eventTarget.addEventListener(eventName, handler, { passive: true, once })
+
+ return {
+ dispose: () => eventTarget.removeEventListener(eventName, handler),
+ }
+}
diff --git a/src/www/execAsPromise.ts b/src/www/execAsPromise.ts
new file mode 100644
index 000000000..0eca38289
--- /dev/null
+++ b/src/www/execAsPromise.ts
@@ -0,0 +1,20 @@
+declare var window: {
+ cordova: {
+ exec: Function
+ }
+}
+
+/**
+ * This is a simple helper to Promisify the calls to cordova
+ *
+ * @param {string} command The native cordova implementation command
+ * @param {unknown[]} args The native cordova implementation expected arguments
+ *
+ * @returns {Promise} Returns from the async native call the type expected
+ */
+export const execAsPromise = (command: string, args: unknown[] = []): Promise =>
+ new Promise(
+ (resolve: (value: R | PromiseLike) => void, reject: (reason?: any) => void) => {
+ window.cordova.exec(resolve, reject, 'FCMPlugin', command, args)
+ }
+ )
diff --git a/src/www/index.ts b/src/www/index.ts
new file mode 100644
index 000000000..d2b2d878b
--- /dev/null
+++ b/src/www/index.ts
@@ -0,0 +1,13 @@
+export type { IChannelConfiguration } from './IChannelConfiguration'
+export type { IRequestPushPermissionOptions } from './IRequestPushPermissionOptions'
+export type { INotificationPayload } from './INotificationPayload'
+export type { IDisposable } from './IDisposable'
+import { FCMPlugin } from './FCMPlugin'
+
+interface Window {
+ FCM: FCMPlugin
+}
+
+export const FCM = new FCMPlugin()
+export { FCMPlugin }
+export default FCM
diff --git a/src/www/package-lock.json b/src/www/package-lock.json
new file mode 100644
index 000000000..938b99504
--- /dev/null
+++ b/src/www/package-lock.json
@@ -0,0 +1,149 @@
+{
+ "name": "cordova-plugin-fcm-with-dependecy-updated",
+ "version": "7.8.0",
+ "lockfileVersion": 1,
+ "requires": true,
+ "dependencies": {
+ "@types/cordova": {
+ "version": "0.0.34",
+ "resolved": "https://registry.npmjs.org/@types/cordova/-/cordova-0.0.34.tgz",
+ "integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ=",
+ "dev": true
+ },
+ "@types/estree": {
+ "version": "0.0.44",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.44.tgz",
+ "integrity": "sha512-iaIVzr+w2ZJ5HkidlZ3EJM8VTZb2MJLCjw3V+505yVts0gRC4UMvjw0d1HPtGqI/HQC/KdsYtayfzl+AXY2R8g==",
+ "dev": true
+ },
+ "@types/node": {
+ "version": "14.14.12",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.12.tgz",
+ "integrity": "sha512-ASH8OPHMNlkdjrEdmoILmzFfsJICvhBsFfAum4aKZ/9U4B6M6tTmTPh+f3ttWdD74CEGV5XvXWkbyfSdXaTd7g==",
+ "dev": true
+ },
+ "@types/resolve": {
+ "version": "0.0.8",
+ "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz",
+ "integrity": "sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==",
+ "dev": true,
+ "requires": {
+ "@types/node": "*"
+ }
+ },
+ "builtin-modules": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz",
+ "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==",
+ "dev": true
+ },
+ "estree-walker": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz",
+ "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==",
+ "dev": true
+ },
+ "fsevents": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz",
+ "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==",
+ "dev": true,
+ "optional": true
+ },
+ "is-module": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz",
+ "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=",
+ "dev": true
+ },
+ "is-reference": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.0.tgz",
+ "integrity": "sha512-ZVxq+5TkOx6GQdnoMm2aRdCKADdcrOWXLGzGT+vIA8DMpqEJaRk5AL1bS80zJ2bjHunVmjdzfCt0e4BymIEqKQ==",
+ "dev": true,
+ "requires": {
+ "@types/estree": "0.0.44"
+ }
+ },
+ "magic-string": {
+ "version": "0.25.7",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz",
+ "integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==",
+ "dev": true,
+ "requires": {
+ "sourcemap-codec": "^1.4.4"
+ }
+ },
+ "path-parse": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
+ "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
+ "dev": true
+ },
+ "resolve": {
+ "version": "1.17.0",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
+ "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==",
+ "dev": true,
+ "requires": {
+ "path-parse": "^1.0.6"
+ }
+ },
+ "rollup": {
+ "version": "2.34.2",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.34.2.tgz",
+ "integrity": "sha512-mvtQLqu3cNeoctS+kZ09iOPxrc1P1/Bt1z15enuQ5feyKOdM3MJAVFjjsygurDpSWn530xB4AlA83TWIzRstXA==",
+ "dev": true,
+ "requires": {
+ "fsevents": "~2.1.2"
+ }
+ },
+ "rollup-plugin-commonjs": {
+ "version": "10.1.0",
+ "resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.1.0.tgz",
+ "integrity": "sha512-jlXbjZSQg8EIeAAvepNwhJj++qJWNJw1Cl0YnOqKtP5Djx+fFGkp3WRh+W0ASCaFG5w1jhmzDxgu3SJuVxPF4Q==",
+ "dev": true,
+ "requires": {
+ "estree-walker": "^0.6.1",
+ "is-reference": "^1.1.2",
+ "magic-string": "^0.25.2",
+ "resolve": "^1.11.0",
+ "rollup-pluginutils": "^2.8.1"
+ }
+ },
+ "rollup-plugin-node-resolve": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz",
+ "integrity": "sha512-jUlyaDXts7TW2CqQ4GaO5VJ4PwwaV8VUGA7+km3n6k6xtOEacf61u0VXwN80phY/evMcaS+9eIeJ9MOyDxt5Zw==",
+ "dev": true,
+ "requires": {
+ "@types/resolve": "0.0.8",
+ "builtin-modules": "^3.1.0",
+ "is-module": "^1.0.0",
+ "resolve": "^1.11.1",
+ "rollup-pluginutils": "^2.8.1"
+ }
+ },
+ "rollup-pluginutils": {
+ "version": "2.8.2",
+ "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz",
+ "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==",
+ "dev": true,
+ "requires": {
+ "estree-walker": "^0.6.1"
+ }
+ },
+ "sourcemap-codec": {
+ "version": "1.4.8",
+ "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
+ "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==",
+ "dev": true
+ },
+ "typescript": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.2.tgz",
+ "integrity": "sha512-thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhRQ==",
+ "dev": true
+ }
+ }
+}
diff --git a/src/www/package.json b/src/www/package.json
new file mode 100644
index 000000000..82ff04dcd
--- /dev/null
+++ b/src/www/package.json
@@ -0,0 +1,50 @@
+{
+ "version": "7.8.0",
+ "name": "cordova-plugin-fcm-with-dependecy-updated",
+ "cordova_name": "Cordova FCM Push Plugin",
+ "description": "Google Firebase Cloud Messaging Cordova Push Plugin fork with dependecy updated",
+ "license": "MIT",
+ "main": "www/FCMPlugin.js",
+ "typings": "typings/index.d.ts",
+ "repo": "https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated",
+ "issue": "https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated/issues",
+ "author": "André Augusto Tissot",
+ "scripts": {
+ "build": "npm run build:before;npm run build:dts;npm run build:js;npm run build:after",
+ "build:before": "rm -rf ../../www;mkdir -p ../../www",
+ "build:js": "npx tsc -p .;npx rollup -c rollup.config.js;npm run build:js:rm-exports;npm run build:js:add-default-export",
+ "build:js:rm-exports": "cd ../../www;cat FCMPlugin.js | grep -v exports > FCMPlugin.tmp.js;mv FCMPlugin.tmp.js FCMPlugin.js",
+ "build:js:add-default-export": "cd ../../www;echo 'module.exports = FCM;' >> FCMPlugin.js",
+ "build:dts": "./scripts/build.dts.sh",
+ "build:after": "rm -rf ../../www/tmp",
+ "tsc": "npx tsc -p . --noEmit"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated"
+ },
+ "keywords": [
+ "ecosystem:cordova",
+ "cordova-android",
+ "cordova-ios",
+ "notifications",
+ "push",
+ "firebase",
+ "fcm",
+ "ios",
+ "android",
+ "cordova"
+ ],
+ "platforms": [
+ "android",
+ "ios"
+ ],
+ "englishdoc": "",
+ "devDependencies": {
+ "@types/cordova": "0.0.34",
+ "rollup": "^2.34.2",
+ "rollup-plugin-commonjs": "^10.1.0",
+ "rollup-plugin-node-resolve": "^5.2.0",
+ "typescript": "^4.1.2"
+ }
+}
diff --git a/src/www/rollup.config.js b/src/www/rollup.config.js
new file mode 100644
index 000000000..50789b02f
--- /dev/null
+++ b/src/www/rollup.config.js
@@ -0,0 +1,19 @@
+const nodeResolve = require('rollup-plugin-node-resolve')
+const commonjs = require('rollup-plugin-commonjs')
+
+export default {
+ input: '../../www/tmp/index.js',
+ output: {
+ file: '../../www/FCMPlugin.js',
+ format: 'cjs',
+ name: 'FCM',
+ globals: {}
+ },
+ plugins: [
+ commonjs({
+ include: 'node_modules/**'
+ }),
+ nodeResolve({ browser: true })
+ ],
+ external: []
+}
diff --git a/src/www/scripts/build.dts.sh b/src/www/scripts/build.dts.sh
new file mode 100755
index 000000000..87e3342a0
--- /dev/null
+++ b/src/www/scripts/build.dts.sh
@@ -0,0 +1,14 @@
+## Generate .d.ts files
+cp ./*.d.ts ../../typings
+tsc -p . --declaration true --declarationDir ../../typings --removeComments false
+
+## Simplify imports
+simplifyImports() {
+ importOrExport="$1"
+ filePath="$2"
+ sed "s/$importOrExport type /$importOrExport /g" "$filePath" > "$filePath.tmp"
+ mv "$filePath.tmp" "$filePath"
+}
+simplifyImports import ../../typings/FCMPlugin.d.ts
+simplifyImports import ../../typings/eventAsDisposable.d.ts
+simplifyImports export ../../typings/index.d.ts
\ No newline at end of file
diff --git a/src/www/tsconfig.json b/src/www/tsconfig.json
new file mode 100644
index 000000000..df6be3a96
--- /dev/null
+++ b/src/www/tsconfig.json
@@ -0,0 +1,21 @@
+{
+ "compilerOptions": {
+ "alwaysStrict": true,
+ "baseUrl": ".",
+ "esModuleInterop": true,
+ "lib": ["dom", "es5", "es2015.promise"],
+ "module": "es2015",
+ "outDir": "../../www/tmp",
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "removeComments": true,
+ "moduleResolution": "node",
+ "resolveJsonModule": true,
+ "sourceMap": false,
+ "strictNullChecks": true,
+ "strictPropertyInitialization": true,
+ "target": "es5"
+ },
+ "include": ["./*.ts"],
+ "exclude": ["node_modules"]
+}
diff --git a/tslint.json b/tslint.json
new file mode 100644
index 000000000..b7ea434f1
--- /dev/null
+++ b/tslint.json
@@ -0,0 +1,36 @@
+{
+ "defaultSeverity": "warning",
+ "extends": ["tslint:recommended"],
+ "rules": {
+ "semicolon": [true, "never"],
+ "arrow-parens": [true, "always"],
+ "typedef": [
+ true,
+ "call-signature",
+ "parameter",
+ "arrow-parameter",
+ "property-declaration",
+ "member-variable-declaration"
+ ],
+ "align": [true, "elements", "members", "parameters", "statements"],
+ "trailing-comma": [
+ true,
+ {
+ "multiline": {
+ "objects": "always",
+ "arrays": "always",
+ "functions": "never",
+ "typeLiterals": "ignore"
+ },
+ "esSpecCompliant": true
+ }
+ ],
+ "newline-before-return": true,
+ "no-relative-imports": false,
+ "no-inner-html": false,
+ "prefer-type-cast": false,
+ "no-console": [true, ["warning", "error"]],
+ "no-namespace": false
+ },
+ "rulesDirectory": ["node_modules/tslint-microsoft-contrib"]
+}
diff --git a/typings/FCMPlugin.d.ts b/typings/FCMPlugin.d.ts
new file mode 100644
index 000000000..390c04b2a
--- /dev/null
+++ b/typings/FCMPlugin.d.ts
@@ -0,0 +1,122 @@
+import { IChannelConfiguration } from './IChannelConfiguration';
+import { IRequestPushPermissionOptions } from './IRequestPushPermissionOptions';
+import { INotificationPayload } from './INotificationPayload';
+import { IDisposable } from './IDisposable';
+/**
+ * @name FCM
+ * @description
+ * Easy plug&play push notification for Google Firebase FCM.
+ *
+ * @interfaces
+ * INotificationPayload
+ * IChannelConfiguration
+ * IRequestPushPermissionOptions
+ */
+export declare class FCMPlugin {
+ /**
+ * EventTarget for native-sourced custom events.
+ *
+ * @event notification
+ * @type {INotificationPayload}
+ *
+ * @event tokenRefresh
+ * @type {string}
+ *
+ */
+ readonly eventTarget: EventTarget;
+ constructor();
+ /**
+ * Removes existing push notifications from the notifications center
+ *
+ * @returns {Promise} Async call to native implementation
+ */
+ clearAllNotifications(): Promise;
+ /**
+ * For Android, some notification properties are only defined programmatically.
+ * Channel can define the default behavior for notifications on Android 8.0+.
+ * Once a channel is created, it stays unchangeable until the user uninstalls the app.
+ *
+ * @param {IChannelConfiguration} channelConfig The parmeters of the new channel
+ *
+ * @returns {Promise} Async call to native implementation
+ */
+ createNotificationChannel(channelConfig: IChannelConfiguration): Promise;
+ /**
+ * This method deletes the InstanceId, revoking all tokens.
+ *
+ * @returns {Promise} Async call to native implementation
+ */
+ deleteInstanceId(): Promise;
+ /**
+ * Gets ios device's current APNS token
+ *
+ * @returns {Promise} Returns a Promise that resolves with the APNS token
+ */
+ getAPNSToken(): Promise;
+ /**
+ * Retrieves the message that, on tap, opened the app
+ *
+ * @private
+ *
+ * @returns {Promise} Async call to native implementation
+ */
+ getInitialPushPayload(): Promise;
+ /**
+ * Gets device's current registration id
+ *
+ * @returns {Promise} Returns a Promise that resolves with the registration id token
+ */
+ getToken(): Promise;
+ /**
+ * Checking for permissions.
+ *
+ * @returns {Promise} Returns a Promise of:
+ * - true: push was allowed (or platform is android)
+ * - false: push will not be available
+ * - null: still not answered, recommended checking again later.
+ */
+ hasPermission(): Promise;
+ /**
+ * Callback firing when receiving new notifications
+ *
+ * @argument {(payload: INotificationPayload) => void} callback function to be called when event is triggered
+ * @argument {{ once?: boolean }} options once defines if the listener is only trigger once
+ * @returns {IDisposable} object of which can request the listener's disposal
+ */
+ onNotification(callback: (payload: INotificationPayload) => void, options?: {
+ once?: boolean;
+ }): IDisposable;
+ /**
+ * Callback firing when receiving a new Firebase token
+ *
+ * @argument {(token: string) => void} callback function to be called when event is triggered
+ * @argument {{ once?: boolean }} options once defines if the listener is only trigger once
+ * @returns {IDisposable} object of which can request the listener's disposal
+ */
+ onTokenRefresh(callback: (token: string) => void, options?: {
+ once?: boolean;
+ }): IDisposable;
+ /**
+ * Request push notification permission, alerting the user if it not have yet decided
+ *
+ * @param {IRequestPushPermissionOptions} options Options for push request
+ * @returns {Promise} Returns a Promise that resolves with the permission status
+ */
+ requestPushPermission(options?: IRequestPushPermissionOptions): Promise;
+ /**
+ * Subscribes you to a [topic](https://firebase.google.com/docs/notifications/android/console-topics)
+ *
+ * @param {string} topic Topic to be subscribed to
+ *
+ * @returns {Promise} Async call to native implementation
+ */
+ subscribeToTopic(topic: string): Promise;
+ /**
+ * Unsubscribes you from a [topic](https://firebase.google.com/docs/notifications/android/console-topics)
+ *
+ * @param {string} topic Topic to be unsubscribed from
+ *
+ * @returns {Promise} Async call to native implementation
+ */
+ unsubscribeFromTopic(topic: string): Promise;
+}
diff --git a/typings/IChannelConfiguration.d.ts b/typings/IChannelConfiguration.d.ts
new file mode 100644
index 000000000..1962da6d1
--- /dev/null
+++ b/typings/IChannelConfiguration.d.ts
@@ -0,0 +1,37 @@
+export interface IChannelConfiguration {
+ /**
+ * Channel id, used in the android_channel_id push payload key
+ */
+ id: string
+ /**
+ * Channel name, visible for the user
+ */
+ name: string
+ /**
+ * Channel description, visible for the user
+ */
+ description?: string
+ /**
+ * Importance for notifications of this channel
+ * https://developer.android.com/guide/topics/ui/notifiers/notifications#importance
+ */
+ importance?: 'none' | 'min' | 'low' | 'default' | 'high'
+ /**
+ * Visibility for notifications of this channel
+ * https://developer.android.com/training/notify-user/build-notification#lockscreenNotification
+ */
+ visibility?: 'public' | 'private' | 'secret'
+ /**
+ * Default sound resource for notifications of this channel
+ * The file should located as resources/raw/[resource name].mp3
+ */
+ sound?: string
+ /**
+ * Enable lights for notifications of this channel
+ */
+ lights?: boolean
+ /**
+ * Enable vibration for notifications of this channel
+ */
+ vibration?: boolean
+}
diff --git a/typings/IDisposable.d.ts b/typings/IDisposable.d.ts
new file mode 100644
index 000000000..9ab8767bd
--- /dev/null
+++ b/typings/IDisposable.d.ts
@@ -0,0 +1,8 @@
+export interface IDisposable {
+ /**
+ * Method of which disposes listener
+ *
+ * @returns {void}
+ */
+ dispose(): void
+}
diff --git a/typings/INotificationPayload.d.ts b/typings/INotificationPayload.d.ts
new file mode 100644
index 000000000..28398750a
--- /dev/null
+++ b/typings/INotificationPayload.d.ts
@@ -0,0 +1,10 @@
+export interface INotificationPayload {
+ /**
+ * Determines whether the notification was tapped or not
+ */
+ wasTapped: boolean
+ /**
+ * FCM notification data hash item
+ */
+ [others: string]: any
+}
diff --git a/typings/IRequestPushPermissionOptions.d.ts b/typings/IRequestPushPermissionOptions.d.ts
new file mode 100644
index 000000000..544cbd3fa
--- /dev/null
+++ b/typings/IRequestPushPermissionOptions.d.ts
@@ -0,0 +1,20 @@
+export interface IRequestPushPermissionOptions {
+ /**
+ * Options exclusive for iOS 9 support
+ */
+ ios9Support?: {
+ /**
+ * How long it will wait for a decision from the user before returning `false`
+ *
+ * @default 10
+ */
+ timeout?: number
+
+ /**
+ * How long between each permission verification
+ *
+ * @default 0.3
+ */
+ interval?: number
+ }
+}
diff --git a/typings/bridgeNativeEvents.d.ts b/typings/bridgeNativeEvents.d.ts
new file mode 100644
index 000000000..56a9589d5
--- /dev/null
+++ b/typings/bridgeNativeEvents.d.ts
@@ -0,0 +1,8 @@
+/**
+ * This is a simple helper to Promisify the calls to cordova
+ *
+ * @param {eventTarget} EventTarget EventTarget for native-sourced custom events.
+ *
+ * @returns {void}
+ */
+export declare const bridgeNativeEvents: (eventTarget: EventTarget) => void;
diff --git a/typings/eventAsDisposable.d.ts b/typings/eventAsDisposable.d.ts
new file mode 100644
index 000000000..1e56068fb
--- /dev/null
+++ b/typings/eventAsDisposable.d.ts
@@ -0,0 +1,13 @@
+import { IDisposable } from './IDisposable';
+/**
+ * This is a simple helper to wrapp the event handler into a IDisposable
+ *
+ * @param {EventTarget} eventTarget EventTarget for native-sourced custom events
+ * @param {string} eventName Event name to listen to
+ * @param {(data: any) => void} callback Event handler
+ * @param {{ once?: boolean }} options once defines if the listener is only trigger once
+ * @returns {IDisposable} object of which can request the listener's disposal
+ */
+export declare const asDisposableListener: (eventTarget: EventTarget, eventName: string, callback: (data: R) => void, options?: {
+ once?: boolean | undefined;
+}) => IDisposable;
diff --git a/typings/execAsPromise.d.ts b/typings/execAsPromise.d.ts
new file mode 100644
index 000000000..037224907
--- /dev/null
+++ b/typings/execAsPromise.d.ts
@@ -0,0 +1,9 @@
+/**
+ * This is a simple helper to Promisify the calls to cordova
+ *
+ * @param {string} command The native cordova implementation command
+ * @param {unknown[]} args The native cordova implementation expected arguments
+ *
+ * @returns {Promise} Returns from the async native call the type expected
+ */
+export declare const execAsPromise: (command: string, args?: unknown[]) => Promise;
diff --git a/typings/index.d.ts b/typings/index.d.ts
new file mode 100644
index 000000000..e8c34d65b
--- /dev/null
+++ b/typings/index.d.ts
@@ -0,0 +1,8 @@
+export { IChannelConfiguration } from './IChannelConfiguration';
+export { IRequestPushPermissionOptions } from './IRequestPushPermissionOptions';
+export { INotificationPayload } from './INotificationPayload';
+export { IDisposable } from './IDisposable';
+import { FCMPlugin } from './FCMPlugin';
+export declare const FCM: FCMPlugin;
+export { FCMPlugin };
+export default FCM;
diff --git a/www/FCMPlugin.js b/www/FCMPlugin.js
index 149ad5303..a921cf406 100644
--- a/www/FCMPlugin.js
+++ b/www/FCMPlugin.js
@@ -1,47 +1,101 @@
-var exec = require('cordova/exec');
+'use strict';
-function FCMPlugin() {
- console.log("FCMPlugin.js: is created");
-}
-// SUBSCRIBE TO TOPIC //
-FCMPlugin.prototype.subscribeToTopic = function( topic, success, error ){
- exec(success, error, "FCMPlugin", 'subscribeToTopic', [topic]);
-}
-// UNSUBSCRIBE FROM TOPIC //
-FCMPlugin.prototype.unsubscribeFromTopic = function( topic, success, error ){
- exec(success, error, "FCMPlugin", 'unsubscribeFromTopic', [topic]);
-}
-// NOTIFICATION CALLBACK //
-FCMPlugin.prototype.onNotification = function( callback, success, error ){
- FCMPlugin.prototype.onNotificationReceived = callback;
- exec(success, error, "FCMPlugin", 'registerNotification',[]);
-}
-// TOKEN REFRESH CALLBACK //
-FCMPlugin.prototype.onTokenRefresh = function( callback ){
- FCMPlugin.prototype.onTokenRefreshReceived = callback;
-}
-// GET TOKEN //
-FCMPlugin.prototype.getToken = function( success, error ){
- exec(success, error, "FCMPlugin", 'getToken', []);
-}
+var execAsPromise = function (command, args) {
+ if (args === void 0) { args = []; }
+ return new Promise(function (resolve, reject) {
+ window.cordova.exec(resolve, reject, 'FCMPlugin', command, args);
+ });
+};
-// DEFAULT NOTIFICATION CALLBACK //
-FCMPlugin.prototype.onNotificationReceived = function(payload){
- console.log("Received push notification")
- console.log(payload)
-}
-// DEFAULT TOKEN REFRESH CALLBACK //
-FCMPlugin.prototype.onTokenRefreshReceived = function(token){
- console.log("Received token refresh")
- console.log(token)
-}
-// FIRE READY //
-exec(function(result){ console.log("FCMPlugin Ready OK") }, function(result){ console.log("FCMPlugin Ready ERROR") }, "FCMPlugin",'ready',[]);
+var asDisposableListener = function (eventTarget, eventName, callback, options) {
+ if (options === void 0) { options = {}; }
+ var once = options.once;
+ var handler = function (event) { return callback(event.detail); };
+ eventTarget.addEventListener(eventName, handler, { passive: true, once: once });
+ return {
+ dispose: function () { return eventTarget.removeEventListener(eventName, handler); },
+ };
+};
+var bridgeNativeEvents = function (eventTarget) {
+ var onError = function (error) { return console.log('FCM: Error listening to native events', error); };
+ var onEvent = function (data) {
+ try {
+ var _a = JSON.parse(data), eventName = _a[0], eventData = _a[1];
+ eventTarget.dispatchEvent(new CustomEvent(eventName, { detail: eventData }));
+ }
+ catch (error) {
+ console.log('FCM: Error parsing native event data', error);
+ }
+ };
+ window.cordova.exec(onEvent, onError, 'FCMPlugin', 'startJsEventBridge', []);
+};
+var FCMPlugin = (function () {
+ function FCMPlugin() {
+ var _this = this;
+ this.eventTarget = document.createElement('div');
+ execAsPromise('ready')
+ .catch(function (error) { return console.log('FCM: Ready error: ', error); })
+ .then(function () {
+ console.log('FCM: Ready!');
+ bridgeNativeEvents(_this.eventTarget);
+ });
+ console.log('FCM: has been created');
+ }
+ FCMPlugin.prototype.clearAllNotifications = function () {
+ return execAsPromise('clearAllNotifications');
+ };
+ FCMPlugin.prototype.createNotificationChannel = function (channelConfig) {
+ if (window.cordova.platformId !== 'android') {
+ return Promise.resolve();
+ }
+ return execAsPromise('createNotificationChannel', [channelConfig]);
+ };
+ FCMPlugin.prototype.deleteInstanceId = function () {
+ return execAsPromise('deleteInstanceId');
+ };
+ FCMPlugin.prototype.getAPNSToken = function () {
+ return window.cordova.platformId !== 'ios'
+ ? Promise.resolve('')
+ : execAsPromise('getAPNSToken');
+ };
+ FCMPlugin.prototype.getInitialPushPayload = function () {
+ return execAsPromise('getInitialPushPayload');
+ };
+ FCMPlugin.prototype.getToken = function () {
+ return execAsPromise('getToken');
+ };
+ FCMPlugin.prototype.hasPermission = function () {
+ return window.cordova.platformId === 'ios'
+ ? execAsPromise('hasPermission')
+ : execAsPromise('hasPermission').then(function (value) { return !!value; });
+ };
+ FCMPlugin.prototype.onNotification = function (callback, options) {
+ return asDisposableListener(this.eventTarget, 'notification', callback, options);
+ };
+ FCMPlugin.prototype.onTokenRefresh = function (callback, options) {
+ return asDisposableListener(this.eventTarget, 'tokenRefresh', callback, options);
+ };
+ FCMPlugin.prototype.requestPushPermission = function (options) {
+ var _a, _b, _c, _d;
+ if (window.cordova.platformId !== 'ios') {
+ return Promise.resolve(true);
+ }
+ var ios9SupportTimeout = (_b = (_a = options === null || options === void 0 ? void 0 : options.ios9Support) === null || _a === void 0 ? void 0 : _a.timeout) !== null && _b !== void 0 ? _b : 10;
+ var ios9SupportInterval = (_d = (_c = options === null || options === void 0 ? void 0 : options.ios9Support) === null || _c === void 0 ? void 0 : _c.interval) !== null && _d !== void 0 ? _d : 0.3;
+ return execAsPromise('requestPushPermission', [ios9SupportTimeout, ios9SupportInterval]);
+ };
+ FCMPlugin.prototype.subscribeToTopic = function (topic) {
+ return execAsPromise('subscribeToTopic', [topic]);
+ };
+ FCMPlugin.prototype.unsubscribeFromTopic = function (topic) {
+ return execAsPromise('unsubscribeFromTopic', [topic]);
+ };
+ return FCMPlugin;
+}());
+var FCM = new FCMPlugin();
-
-var fcmPlugin = new FCMPlugin();
-module.exports = fcmPlugin;
+module.exports = FCM;