Skip to content

Commit

Permalink
Merge pull request #568 from Microsoft/develop
Browse files Browse the repository at this point in the history
Merge develop to master
  • Loading branch information
iamclement committed May 19, 2017
2 parents c943542 + c0a1457 commit ef4dac2
Show file tree
Hide file tree
Showing 102 changed files with 2,703 additions and 731 deletions.
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Mobile Center SDK for iOS Change Log

## Version 0.9.0

This version has **breaking changes**.
It contains improvements and new features.

### MobileCenter

* **[Feature]** Mobile Center now automatically forwards your application delegate's methods to the SDK. This is made possible by using method swizzling. It greatly improves the SDK integration but there is a possibility of conflicts with other third party libraries or the application delegate itself. In this case you may want to disable the Mobile Center application delegate forwarder by adding the `MobileCenterAppDelegateForwarderEnabled` tag to your Info.plist file and set it to `0`, doing so will disable application delegate forwarding for all Mobile Center services.

### MobileCenterCrash

* **[Feature]** Crashes can now have attachments.

### MobileCenterDistribute

* **[Breaking]** The `openUrl:` API is renamed `openURL:` and returns `YES` if the URL is intended for Mobile Center Distribute and your application, `NO` otherwise.

* **[Breaking]** The application delegate `openURL` method(s) are now automatically forwarded to the SDK by default. The Mobile Center Distribute `openURL` can be removed from your application delegate's `openURL` method(s). If you decide to keep it then you will have to disable the Mobile Center application delegate forwarder.

### MobileCenterPush

* **[Breaking]** The application delegate `didRegisterForRemoteNotificationsWithDeviceToken`, `didFailToRegisterForRemoteNotificationsWithError`, `didReceiveRemoteNotification` methods are now automatically forwarded to the SDK by default. The corresponding APIs from Mobile Center Push can be removed from your application delegate's methods. If you decide to keep them then you will have to disable the Mobile Center application delegate forwarder.

___

## Version 0.8.1

This version contains a bug fix.
Expand Down
2 changes: 1 addition & 1 deletion Documentation/MobileCenter/.jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sdk: iphonesimulator
theme: ../Themes/apple

module: MobileCenter
module_version: 0.8.1
module_version: 0.9.0
author: Microsoft Corp
author_url: http://www.microsoft.com

Expand Down
2 changes: 1 addition & 1 deletion Documentation/MobileCenterAnalytics/.jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sdk: iphonesimulator
theme: ../Themes/apple

module: MobileCenterAnalytics
module_version: 0.8.1
module_version: 0.9.0
author: Microsoft Corp
author_url: http://www.microsoft.com

Expand Down
2 changes: 1 addition & 1 deletion Documentation/MobileCenterCrashes/.jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sdk: iphonesimulator
theme: ../Themes/apple

module: Crashes
module_version: 0.8.1
module_version: 0.9.0
author: Microsoft Corp
author_url: http://www.microsoft.com

Expand Down
2 changes: 1 addition & 1 deletion Documentation/MobileCenterDistribute/.jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sdk: iphonesimulator
theme: ../Themes/apple

module: Distribute
module_version: 0.8.1
module_version: 0.9.0
author: Microsoft Corp
author_url: http://www.microsoft.com

Expand Down
2 changes: 1 addition & 1 deletion Documentation/MobileCenterPush/.jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sdk: iphonesimulator
theme: ../Themes/apple

module: MobileCenterPush
module_version: 0.8.1
module_version: 0.9.0
author: Microsoft Corp
author_url: http://www.microsoft.com

Expand Down
2 changes: 1 addition & 1 deletion Global.xcconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
BUILD_NUMBER = 1
VERSION_STRING = 0.8.1
VERSION_STRING = 0.9.0

SDK_NAME = mobilecenter.ios

Expand Down
2 changes: 1 addition & 1 deletion MobileCenter.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'MobileCenter'
s.version = '0.8.1'
s.version = '0.9.0'

s.summary = 'Mobile Center is mission control for mobile apps. Get faster release cycles, higher-quality apps, and the insights to build what users want.'
s.description = <<-DESC
Expand Down
114 changes: 85 additions & 29 deletions MobileCenter/MobileCenter.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,6 @@
ReferencedContainer = "container:MobileCenter.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6E171AE01D22F781000DC480"
BuildableName = "MobileCenterCrashes.xctest"
BlueprintName = "MobileCenterCrashesTests"
ReferencedContainer = "container:../MobileCenterCrashes/MobileCenterCrashes.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
Expand Down
94 changes: 94 additions & 0 deletions MobileCenter/MobileCenter/Internals/AppDelegate/MSAppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@class MSAppDelegateForwarder;

/**
* Custom delegate matching `UIApplicationDelegate`.
*
* @discussion Delegates here are using swizzling. Any delegate that can be registered through the notification center
* should not be registered through swizzling. Due to the early registration of swizzling on the original app delegate
* each custom delegate must sign up for selectors to swizzle within the `load` method of a category over
* the @see MSAppDelegateForwarder class.
*/
@protocol MSAppDelegate <NSObject>

@optional

/**
* Asks the delegate to open a resource specified by a URL, and provides a dictionary of launch options.
*
* @param application The singleton app object.
* @param url The URL resource to open. This resource can be a network resource or a file.
* @param sourceApplication The bundle ID of the app that is requesting your app to open the URL (url).
* @param annotation A Property list supplied by the source app to communicate information to the receiving app.
* @param returnedValue Value returned by the original delegate implementation.
*
* @return `YES` if the delegate successfully handled the request or `NO` if the attempt to open the URL resource
* failed.
*/
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(nullable NSString *)sourceApplication
annotation:(id)annotation
returnedValue:(BOOL)returnedValue;

/**
* Asks the delegate to open a resource specified by a URL, and provides a dictionary of launch options.
*
* @param application The singleton app object.
* @param url The URL resource to open. This resource can be a network resource or a file.
* @param options A dictionary of URL handling options.
* For information about the possible keys in this dictionary and how to handle them, @see
* UIApplicationOpenURLOptionsKey. By default, the value of this parameter is an empty dictionary.
* @param returnedValue Value returned by the original delegate implementation.
*
* @return `YES` if the delegate successfully handled the request or `NO` if the attempt to open the URL resource
* failed.
*/
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options
returnedValue:(BOOL)returnedValue;

/**
* Tells the delegate that the app successfully registered with Apple Push Notification service (APNs).
*
* @param application The application that initiated the remote-notification registration process.
* @param deviceToken A token that identifies the device to Apple Push Notification Service (APNS).
* The token is an opaque data type because that is the form that the provider needs to submit to the APNS servers
* when it sends a notification to a device. The APNS servers require a binary format for performance reasons.
* The size of a device token is 32 bytes.
*/
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;

/**
* Sent to the delegate when Apple Push Service cannot successfully complete the registration process.
*
* @param application The application that initiated the remote-notification registration process.
* @param error An NSError object that encapsulates information why registration did not succeed. The application can
* display this information to the user.
*/
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;

/**
* Tells the app that a remote notification arrived that indicates there is data to be fetched.
*
* @param application The singleton app object.
* @param userInfo A dictionary that contains information related to the remote notification, potentially including a
* badge number for the app icon, an alert sound, an alert message to display to the user, a notification identifier,
* and custom data. The provider originates it as a JSON-defined dictionary that iOS converts to an @see NSDictionary
* object; the dictionary may contain only property-list objects plus @see NSNull.
* @param completionHandler The block to execute when the download operation is complete. When calling this block, pass
* in the fetch result value that best describes the results of your download operation. You must call this handler and
* should do so as soon as possible. For a list of possible values, see the @see UIBackgroundFetchResult type.
*/
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#import <Foundation/Foundation.h>

#import "MSAppDelegate.h"

NS_ASSUME_NONNULL_BEGIN

@interface MSAppDelegateForwarder : NSObject <MSAppDelegate>

/**
* Enable/Disable Application forwarding.
*/
@property(nonatomic, class) BOOL enabled;

/**
* Add a delegate. This method is thread safe.
*
* @param delegate A delegate.
*/
+ (void)addDelegate:(id<MSAppDelegate>)delegate;

/**
* Remove a delegate. This method is thread safe.
*
* @param delegate A delegate.
*/
+ (void)removeDelegate:(id<MSAppDelegate>)delegate;

/**
* Add an app delegate selector to swizzle.
*
* @param selector An app delegate selector to swizzle.
*
* @discussion Due to the early registration of swizzling on the original app delegate
* each custom delegate must sign up for selectors to swizzle within the `load` method of a category over
* the @see MSAppDelegateForwarder class.
*/
+ (void)addAppDelegateSelectorToSwizzle:(SEL)selector;

/**
* Flush debugging traces accumulated until now.
* TODO: We should find a way for customers to set the log level in their configuration somehow so that it'll be set at
* the time of the swizzling. This will allow having swizzling traces in real time, in that case we can remove the whole
* trace buffer mechanism.
*/
+ (void)flushTraceBuffer;

@end

NS_ASSUME_NONNULL_END
Loading

0 comments on commit ef4dac2

Please sign in to comment.