Commit d799b1bc authored by Libin Lu's avatar Libin Lu

update example for 4.0.0

parent 32c3ce4f
......@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
......
#Fri Jan 06 16:34:59 EST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
......@@ -9,7 +9,7 @@
#import "AppDelegate.h"
#import "RCTBundleURLProvider.h"
#import <React/RCTBundleURLProvider.h>
#import "RCTRootView.h"
#import "RNFIRMessaging.h"
......@@ -35,34 +35,31 @@
[self.window makeKeyAndVisible];
[FIRApp configure];
#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
[[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];
#endif
return YES;
}
#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler
{
[[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self userInfo:notification.request.content.userInfo];
if([[notification.request.content.userInfo valueForKey:@"show_in_foreground"] isEqual:@YES]) {
if([[notification.request.content.userInfo valueForKey:@"show_in_foreground"] isEqual:@YES]){
completionHandler(UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge | UNNotificationPresentationOptionSound);
} else {
}else{
completionHandler(UNNotificationPresentationOptionNone);
}
}
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler {
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler
{
NSDictionary* userInfo = [[NSMutableDictionary alloc] initWithDictionary: response.notification.request.content.userInfo];
[userInfo setValue:@YES forKey:@"opened_from_tray"];
[[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self userInfo:userInfo];
}
#else
//You can skip this method if you don't want to use local notification
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
[[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self + userInfo:notification.userInfo];
-(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
[[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self userInfo:notification.userInfo];
}
#endif
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
[[NSNotificationCenter defaultCenter] postNotificationName:FCMNotificationReceived object:self userInfo:userInfo];
......
......@@ -30,17 +30,17 @@
/// <li>user_engagement</li>
/// </ul>
///
/// @param name The name of the event. Should contain 1 to 32 alphanumeric characters or
/// @param name The name of the event. Should contain 1 to 40 alphanumeric characters or
/// underscores. The name must start with an alphabetic character. Some event names are
/// reserved. See FIREventNames.h for the list of reserved event names. The "firebase_" prefix
/// is reserved and should not be used. Note that event names are case-sensitive and that
/// logging two events whose names differ only in case will result in two distinct events.
/// @param parameters The dictionary of event parameters. Passing nil indicates that the event has
/// no parameters. Parameter names can be up to 24 characters long and must start with an
/// no parameters. Parameter names can be up to 40 characters long and must start with an
/// alphabetic character and contain only alphanumeric characters and underscores. Only NSString
/// and NSNumber (signed 64-bit integer and 64-bit floating-point number) parameter types are
/// supported. NSString parameter values can be up to 36 characters long. The "firebase_" prefix
/// is reserved and should not be used for parameter names.
/// supported. NSString parameter values can be up to 100 characters long. The "firebase_"
/// prefix is reserved and should not be used for parameter names.
+ (void)logEventWithName:(nonnull NSString *)name
parameters:(nullable NSDictionary<NSString *, NSObject *> *)parameters;
......@@ -68,4 +68,28 @@
/// non-empty and no more than 36 characters long. Setting userID to nil removes the user ID.
+ (void)setUserID:(nullable NSString *)userID;
/// Sets the current screen name, which specifies the current visual context in your app. This helps
/// identify the areas in your app where users spend their time and how they interact with your app.
///
/// Note that screen reporting is enabled automatically and records the class name of the current
/// UIViewController for you without requiring you to call this method. If you implement
/// viewDidAppear in your UIViewController but do not call [super viewDidAppear:], that screen class
/// will not be automatically tracked. The class name can optionally be overridden by calling this
/// method in the viewDidAppear callback of your UIViewController and specifying the
/// screenClassOverride parameter.
///
/// If your app does not use a distinct UIViewController for each screen, you should call this
/// method and specify a distinct screenName each time a new screen is presented to the user.
///
/// The screen name and screen class remain in effect until the current UIViewController changes or
/// a new call to setScreenName:screenClass: is made.
///
/// @param screenName The name of the current screen. Should contain 1 to 100 characters. Set to nil
/// to clear the current screen name.
/// @param screenClassOverride The name of the screen class. Should contain 1 to 100 characters. By
/// default this is the class name of the current UIViewController. Set to nil to revert to the
/// default class name.
+ (void)setScreenName:(nullable NSString *)screenName
screenClass:(nullable NSString *)screenClassOverride;
@end
......@@ -5,9 +5,9 @@
/// 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
/// Custom events. Param names can be up to 40 characters long, may only contain alphanumeric
/// characters and underscores ("_"), and must start with an alphabetic character. Param values can
/// be up to 36 characters long. The "firebase_" prefix is reserved and should not be used.
/// be up to 100 characters long. The "firebase_" prefix is reserved and should not be used.
/// Game achievement ID (NSString).
/// <pre>
......@@ -283,8 +283,8 @@ static NSString *const kFIRParameterTravelClass = @"travel_class";
/// 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].
/// 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].
/// <pre>
/// NSDictionary *params = @{
/// kFIRParameterValue : @(3.99),
......
......@@ -14,7 +14,6 @@ framework module FirebaseAnalytics {
header "FIRParameterNames.h"
header "FIRUserPropertyNames.h"
link framework "AddressBook"
link framework "StoreKit"
link "c++"
......
......@@ -5,13 +5,14 @@
NS_ASSUME_NONNULL_BEGIN
/** A block that takes a BOOL and has no return value. */
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.
* 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
......@@ -62,22 +63,22 @@ typedef void (^FIRAppVoidBoolCallback)(BOOL success);
+ (nullable FIRApp *)appNamed:(NSString *)name;
/**
* Returns the set of all extant FIRApp instances, or nil if there is no FIRApp instance. This
* Returns the set of all extant FIRApp instances, or nil if there are no FIRApp instances. 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.
* future use. This method is thread safe.
*/
- (void)deleteApp:(FIRAppVoidBoolCallback)completion;
/**
* FIRFirebaseApp instances should not be initialized directly. Call |FIRApp configure|, or
* |FIRApp configureWithOptions:|, or |FIRApp configureWithNames:options| directly.
* FIRApp instances should not be initialized directly. Call +[FIRApp configure],
* +[FIRApp configureWithOptions:], or +[FIRApp configureWithNames:options:] directly.
*/
- (nullable instancetype)init NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
/**
* Gets the name of this app.
......
......@@ -6,11 +6,17 @@
* The log levels used by FIRConfiguration.
*/
typedef NS_ENUM(NSInteger, FIRLogLevel) {
/** Error */
kFIRLogLevelError __deprecated = 0,
/** Warning */
kFIRLogLevelWarning __deprecated,
/** Info */
kFIRLogLevelInfo __deprecated,
/** Debug */
kFIRLogLevelDebug __deprecated,
/** Assert */
kFIRLogLevelAssert __deprecated,
/** Max */
kFIRLogLevelMax __deprecated = kFIRLogLevelAssert
} DEPRECATED_MSG_ATTRIBUTE(
"Use -FIRDebugEnabled and -FIRDebugDisabled. See FIRApp.h for more details.");
......@@ -21,12 +27,13 @@ typedef NS_ENUM(NSInteger, FIRLogLevel) {
*/
@interface FIRConfiguration : NSObject
/** Returns the shared configuration object. */
+ (FIRConfiguration *)sharedInstance;
// The configuration class for Firebase Analytics.
/** The configuration class for Firebase Analytics. */
@property(nonatomic, readwrite) FIRAnalyticsConfiguration *analyticsConfiguration;
// Global log level. Defaults to kFIRLogLevelError.
/** 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.");
......
......@@ -43,31 +43,31 @@ FOUNDATION_EXPORT NSString * __nonnull const FIRMessagingMessagesDeletedNotifica
* @enum FIRMessagingError
*/
typedef NS_ENUM(NSUInteger, FIRMessagingError) {
// Unknown error.
/// Unknown error.
FIRMessagingErrorUnknown = 0,
// Auth Error -- FIRMessaging couldn't validate request from this client.
/// FIRMessaging couldn't validate request from this client.
FIRMessagingErrorAuthentication = 1,
// NoAccess -- InstanceID service cannot be accessed.
/// InstanceID service cannot be accessed.
FIRMessagingErrorNoAccess = 2,
// Timeout -- Request to InstanceID backend timed out.
/// Request to InstanceID backend timed out.
FIRMessagingErrorTimeout = 3,
// Network -- No network available to reach the servers.
/// No network available to reach the servers.
FIRMessagingErrorNetwork = 4,
// OperationInProgress -- Another similar operation in progress,
// bailing this one.
/// Another similar operation in progress, bailing this one.
FIRMessagingErrorOperationInProgress = 5,
// InvalidRequest -- Some parameters of the request were invalid.
/// Some parameters of the request were invalid.
FIRMessagingErrorInvalidRequest = 7,
};
/// Status for the downstream message received by the app.
typedef NS_ENUM(NSInteger, FIRMessagingMessageStatus) {
/// Unknown status.
FIRMessagingMessageStatusUnknown,
/// New downstream message received by the app.
FIRMessagingMessageStatusNew,
......@@ -76,6 +76,7 @@ typedef NS_ENUM(NSInteger, FIRMessagingMessageStatus) {
/// Information about a downstream message received by the app.
@interface FIRMessagingMessageInfo : NSObject
/// The status of the downstream message
@property(nonatomic, readonly, assign) FIRMessagingMessageStatus status;
@end
......@@ -121,7 +122,7 @@ typedef NS_ENUM(NSInteger, FIRMessagingMessageStatus) {
* In order to receive FIRMessaging messages, declare application:didReceiveRemoteNotification:
*
* Client apps can send upstream messages back to the app server using the XMPP-based
* <a href="http://developers.google.com/cloud-messaging/ccs.html">Cloud Connection Server</a>,
* <a href="https://developers.google.com/cloud-messaging/ccs.html">Cloud Connection Server</a>
*
*/
@interface FIRMessaging : NSObject
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -7,7 +7,7 @@
<key>RNFIRMessaging.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>5</integer>
<integer>7</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment