Skip to content

Commit

Permalink
Merge pull request #619 from Microsoft/develop
Browse files Browse the repository at this point in the history
Develop -> Master for 0.10.0
  • Loading branch information
Benjamin Scholtysik (Reimold) authored Jun 15, 2017
2 parents ef4dac2 + b783b6d commit a83c516
Show file tree
Hide file tree
Showing 53 changed files with 2,158 additions and 525 deletions.
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Mobile Center SDK for iOS Change Log

## Version 0.10.0

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

### Integration using cocoapods

* **[Breaking]** The subspecs for cocoapods are now called `Analytics`, `Crashes`, `Distribute` and `Push` instead of `MobileCenter{MODULENAME}`.

### MobileCenter

* **[Feature]** It's possible to define custom properties. Custom properties can be used for various purposes, e.g. to segment users for targeted push notifications.

### MobileCenterCrashes

* **[Improvement]** The sdk now logs a warning in case more than two attachments have been attached to a crash.

### MobileCenterDistribute

* **[Bug]** Fix a potential crash that occured in case the request for updates returned a 200 but the data was empty.

## Version 0.9.0

This version has **breaking changes**.
Expand All @@ -9,7 +30,7 @@ It contains improvements and new features.

* **[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
### MobileCenterCrashes

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

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.9.0
module_version: 0.10.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.9.0
module_version: 0.10.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.9.0
module_version: 0.10.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.9.0
module_version: 0.10.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.9.0
module_version: 0.10.0
author: Microsoft Corp
author_url: http://www.microsoft.com

Expand Down
26 changes: 22 additions & 4 deletions Global.xcconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
BUILD_NUMBER = 1
VERSION_STRING = 0.9.0
VERSION_STRING = 0.10.0

SDK_NAME = mobilecenter.ios

Expand Down Expand Up @@ -59,7 +59,7 @@ GCC_PREPROCESSOR_DEFINITIONS = $(inherited) $(XCODEBUILD_GCC_PREPROCESSOR_DEFINI
// We don't want to compile our code for C++98, no need to be warned about incompatibility.

// -auto-import
// Standard ``import`` is used by tons of files and C++ code limits the possibility to use @import so we don't . => Disabled.
// Standard ``import`` is used by tons of files and C++ code limits the possibility to use @import, so we don't. => Disabled.

// -assign-enum
// A lot of api use enums as params but Apple's docs suggest passing in 0 which causes annoying warnings.
Expand All @@ -73,10 +73,28 @@ GCC_PREPROCESSOR_DEFINITIONS = $(inherited) $(XCODEBUILD_GCC_PREPROCESSOR_DEFINI
// -cast-align
// We're not interested in this one as the Mach-O format is itself well-aligned and the original memory allocation
// happens through malloc() and mmap() which always return at least 16byte alignment.
// Reas more about alignment in the c++ reference: http://en.cppreference.com/w/cpp/language/object#Alignment.
// Read more about alignment in the c++ reference: http://en.cppreference.com/w/cpp/language/object#Alignment.

WARNING_CFLAGS = -Weverything -Wno-objc-missing-property-synthesis -Wno-float-equal -Wno-pedantic -Wno-padded -Wno-sign-conversion -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-auto-import -Wno-assign-enum -Wno-exit-time-destructors -Wno-global-constructors -Wno-cast-align
// -reserved-id-macro
// PLCrashReporter uses lots of _-prefixed macros and it's not an issue but enabling -Weveryting being too pedantic.
// https://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier explains
// rules about using an underscore macro pretty well.

// -disabled-macro-expansion
// This silences warnings when consuming PLCrashReporter for macOS. The warning here actualy just complains about regular
// Preprocessor behavior.

// -objc-interface-ivars
// This causes warnings when consuming PLCrashReporter for macOS. It complains about the old way of defining private ivars.
// PLCrashReporter doesn't use ARC, so we cannot just remove the old ivars and be done. Changing PLCrashReporter just
// because of this warning doesn't make any sense.

// -documentation-unknown-command
// This causes 1 warning when consuming PLCrashReporter for macOS. The reason for the warning is that PLCRashReporter
// exposes Doxygen's @internal (it uses Doxygen to generate it's header docs) in a public header. There's no problem
// not knowing @internal, so we just ignore the warning.

WARNING_CFLAGS = -Weverything -Wno-objc-missing-property-synthesis -Wno-float-equal -Wno-pedantic -Wno-padded -Wno-sign-conversion -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-auto-import -Wno-assign-enum -Wno-exit-time-destructors -Wno-global-constructors -Wno-cast-align -Wno-reserved-id-macro -Wno-disabled-macro-expansion -Wno-objc-interface-ivars -Wno-documentation-unknown-command

// These are all partially (but not completely?) independent of WARNING_CFLAGS
// and need to be specified explicitly.
Expand Down
30 changes: 15 additions & 15 deletions 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.9.0'
s.version = '0.10.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 Expand Up @@ -36,38 +36,38 @@ Pod::Spec.new do |s|

s.frameworks = 'Foundation', 'SystemConfiguration', 'UIKit'

s.default_subspecs = 'MobileCenterAnalytics', 'MobileCenterCrashes'
s.default_subspecs = 'Analytics', 'Crashes'

s.subspec 'MobileCenter' do |ss|
ss.frameworks = 'Foundation', 'SystemConfiguration', 'UIKit'
s.subspec 'Core' do |ss|
ss.frameworks = 'Foundation', 'CoreTelephony', 'SystemConfiguration', 'UIKit'
ss.vendored_frameworks = "MobileCenter-SDK-iOS/MobileCenter.framework"
end

s.subspec 'MobileCenterAnalytics' do |ss|
ss.frameworks = 'CoreTelephony', 'Foundation', 'UIKit'
ss.dependency 'MobileCenter/MobileCenter'
s.subspec 'Analytics' do |ss|
ss.frameworks = 'Foundation', 'UIKit'
ss.dependency 'MobileCenter/Core'
ss.vendored_frameworks = "MobileCenter-SDK-iOS/MobileCenterAnalytics.framework"
end

s.subspec 'MobileCenterCrashes' do |ss|
ss.frameworks = 'Foundation', 'UIKit'
s.subspec 'Crashes' do |ss|
ss.frameworks = 'Foundation'
ss.libraries = 'z', 'c++'
ss.dependency 'MobileCenter/MobileCenter'
ss.dependency 'MobileCenter/Core'
ss.vendored_frameworks = "MobileCenter-SDK-iOS/MobileCenterCrashes.framework"
end

s.subspec 'MobileCenterDistribute' do |ss|
ss.frameworks = 'CoreTelephony', 'Foundation', 'UIKit'
s.subspec 'Distribute' do |ss|
ss.frameworks = 'Foundation', 'UIKit'
ss.weak_frameworks = 'SafariServices'
ss.dependency 'MobileCenter/MobileCenter'
ss.dependency 'MobileCenter/Core'
ss.resource_bundle = { 'MobileCenterDistributeResources' => ['MobileCenter-SDK-iOS/MobileCenterDistributeResources.bundle/*.lproj'] }
ss.vendored_frameworks = "MobileCenter-SDK-iOS/MobileCenterDistribute.framework"
end

s.subspec 'MobileCenterPush' do |ss|
s.subspec 'Push' do |ss|
ss.frameworks = 'Foundation', 'UIKit'
ss.weak_frameworks = 'UserNotifications'
ss.dependency 'MobileCenter/MobileCenter'
ss.dependency 'MobileCenter/Core'
ss.vendored_frameworks = "MobileCenter-SDK-iOS/MobileCenterPush.framework"
end

Expand Down
8 changes: 0 additions & 8 deletions MobileCenter/MobileCenter/Internals/MSMobileCenterPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@
*/
+ (void)resetSharedInstance;

/**
* Set the custom properties.
*
* @param customProperties Custom properties object.
*/
// TODO: Move to MSMobileCenter.h when backend is ready.
+ (void)setCustomProperties:(MSCustomProperties *)customProperties;

/**
* Configure the SDK.
*
Expand Down
10 changes: 9 additions & 1 deletion MobileCenter/MobileCenter/MSMobileCenter.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@
*/
+ (void)setWrapperSdk:(MSWrapperSdk *)wrapperSdk;

/**
* Set the custom properties.
*
* @param customProperties Custom properties object.
*/
+ (void)setCustomProperties:(MSCustomProperties *)customProperties;

/**
* Check whether the application delegate forwarder is enabled or not.
*
Expand All @@ -106,7 +113,8 @@
* should be disabled if you or one of your third party SDK is doing message forwarding on the application delegate.
* Message forwarding usually implies the implementation of @see NSObject#forwardingTargetForSelector: or @see
* NSObject#forwardInvocation: methods.
* To disable the application delegate forwarder just add the `MobileCenterAppDelegateForwarderEnabled` tag to your Info.plist
* To disable the application delegate forwarder just add the `MobileCenterAppDelegateForwarderEnabled` tag to your
* Info.plist
* file and set it to `0`. Then you will have to forward any application delegate needed by the SDK manually.
*/
+ (BOOL)isAppDelegateForwarderEnabled;
Expand Down
2 changes: 1 addition & 1 deletion MobileCenter/MobileCenter/Support/MobileCenter.xcconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include "../../../Global.xcconfig"

OTHER_LDFLAGS = $(inherited) -framework Foundation -framework SystemConfiguration -framework UIKit;
OTHER_LDFLAGS = $(inherited) -framework Foundation -framework CoreTelephony -framework SystemConfiguration -framework UIKit;
1 change: 1 addition & 0 deletions MobileCenter/MobileCenter/Support/module.modulemap
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ framework module MobileCenter {
module * { export * }

link framework "Foundation"
link framework "CoreTelephony"
link framework "SystemConfiguration"
link framework "UIKit"
}
10 changes: 6 additions & 4 deletions MobileCenter/MobileCenterTests/MSAppDelegateForwarderTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ - (void)testSwizzleOriginalDelegate {
wasCalled = YES;
return YES;
};
const char *types = method_getTypeEncoding(class_getInstanceMethod(originalAppDelegateClass, selectorToSwizzle));
Method method = class_getInstanceMethod(originalAppDelegateClass, selectorToSwizzle);
const char *types = method_getTypeEncoding(method);
[self addSelector:selectorToSwizzle implementation:selectorImp types:types toClass:originalAppDelegateClass];
originalAppDelegate = [originalAppDelegateClass new];
[MSAppDelegateForwarder addAppDelegateSelectorToSwizzle:selectorToSwizzle];
Expand Down Expand Up @@ -198,8 +199,8 @@ - (void)testSwizzleOriginalDelegate {
id instancesRespondToSelectorImp = ^{
return YES;
};
const char *instancesRespondToSelectorTypes =
method_getTypeEncoding(class_getClassMethod(originalAppDelegateClass, instancesRespondToSelector));
method = class_getClassMethod(originalAppDelegateClass, instancesRespondToSelector);
const char *instancesRespondToSelectorTypes = method_getTypeEncoding(method);

// Adding a class method to a class requires its meta class.
Class originalAppDelegateMetaClass = object_getClass(originalAppDelegateClass);
Expand Down Expand Up @@ -748,7 +749,8 @@ - (Class)createClassConformingToProtocol:(Protocol *)protocol {
- (Class)createClassWithBaseClass:(Class) class andConformItToProtocol:(Protocol *)protocol {

// Generate class name to prevent conflicts in runtime added classes.
Class newClass = objc_allocateClassPair(class, [[self generateClassName] UTF8String], 0);
const char *name = [[self generateClassName] UTF8String];
Class newClass = objc_allocateClassPair(class, name, 0);
if (protocol) {
class_addProtocol(newClass, protocol);
}
Expand Down
10 changes: 8 additions & 2 deletions MobileCenter/MobileCenterTests/MSIngestionSenderTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ - (void)tearDown {
[super tearDown];

[OHHTTPStubs removeAllStubs];

/*
* Setting the variable to nil. We are experiencing test failure on Xcode 9 beta because the instance that was used
* for previous test method is not disposed and still listening to network changes in other tests.
*/
self.sut = nil;
}

- (void)testSendBatchLogs {
Expand Down Expand Up @@ -95,12 +101,12 @@ - (void)testUnrecoverableError {
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"HTTP Response 200"];
id delegateMock = OCMProtocolMock(@protocol(MSSenderDelegate));
[self.sut addDelegate:delegateMock];

// When
[self.sut sendAsync:container
completionHandler:^(NSString *batchId, NSUInteger statusCode, __attribute__((unused)) NSData *data,
NSError *error) {

// Then
XCTAssertEqual(containerId, batchId);
XCTAssertEqual((MSHTTPCodesNo)statusCode, MSHTTPCodesNo404NotFound);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#import "MSUtility+Date.h"
#import "MSSessionTracker.h"
#import "MSStartSessionLog.h"
#import "MSStartServiceLog.h"

static NSTimeInterval const kMSSessionTimeOut = 20;
static NSString *const kMSPastSessionsKey = @"pastSessionsKey";
Expand Down Expand Up @@ -176,8 +177,11 @@ - (void)applicationWillEnterForeground {
- (void)onEnqueuingLog:(id<MSLog>)log withInternalId:(NSString *)internalId {
(void)internalId;

// Start session log is created in this method, therefore, skip in order to avoid infinite loop.
if ([((NSObject *)log) isKindOfClass:[MSStartSessionLog class]])
/*
* Start session log is created in this method, therefore, skip in order to avoid infinite loop.
* Also skip start service log as it's always sent and should not trigger a session.
*/
if ([((NSObject *)log) isKindOfClass:[MSStartSessionLog class]] || [((NSObject *)log) isKindOfClass:[MSStartServiceLog class]])
return;

// Attach corresponding session id.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include "../../../Global.xcconfig"

OTHER_LDFLAGS = $(inherited) -framework Foundation -framework UIKit -framework CoreTelephony;
OTHER_LDFLAGS = $(inherited) -framework Foundation -framework UIKit;
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ framework module MobileCenterAnalytics {
module * { export * }

link framework "Foundation"
link framework "CoreTelephony"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#import "MSSessionTracker.h"
#import "MSSessionTrackerUtil.h"
#import "MSStartSessionLog.h"
#import "MSStartServiceLog.h"

static NSTimeInterval const kMSTestSessionTimeout = 1.5;

Expand Down Expand Up @@ -223,6 +224,51 @@ - (void)testOnProcessingLog {
// Then
XCTAssertEqual(UINT64_MAX, log.toffset.unsignedLongLongValue);
XCTAssertEqual(log.sid, [self.sut.pastSessions lastObject].sessionId);
};
}

- (void)testNoStartSessionWithStartSessionLog {

// When
MSLogWithProperties *log = [MSLogWithProperties new];

// Then
XCTAssertNil(log.sid);
XCTAssertNil(log.toffset);

// When
[self.sut onEnqueuingLog:log withInternalId:nil];

// Then
XCTAssertNil(log.toffset);
XCTAssertEqual(log.sid, self.sut.sessionId);

// If
MSStartSessionLog *sessionLog = [MSStartSessionLog new];

// Then
XCTAssertNil(sessionLog.sid);
XCTAssertNil(sessionLog.toffset);

// When
[self.sut onEnqueuingLog:sessionLog withInternalId:nil];

// Then
XCTAssertNil(sessionLog.toffset);
XCTAssertNil(sessionLog.sid);

// If
MSStartServiceLog *serviceLog = [MSStartServiceLog new];

// Then
XCTAssertNil(serviceLog.sid);
XCTAssertNil(serviceLog.toffset);

// When
[self.sut onEnqueuingLog:serviceLog withInternalId:nil];

// Then
XCTAssertNil(serviceLog.toffset);
XCTAssertNil(serviceLog.sid);
}

@end
Loading

0 comments on commit a83c516

Please sign in to comment.