Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/v1.0-beta.4'
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
  • Loading branch information
lumaxis committed Jun 23, 2015
2 parents 899c367 + 39e4407 commit a306f26
Show file tree
Hide file tree
Showing 140 changed files with 2,030 additions and 1,103 deletions.
48 changes: 37 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,43 @@
language: objective-c
osx_image: beta-xcode6.3

env:
global:
- PROJECT="Support/ApplicationInsights.xcodeproj"
- SDK="iphonesimulator8.3"

matrix:
- SCHEME="ApplicationInsights" DESTINATION="OS=7.1,name=iPad 2" CONFIGURATION="Debug" RUN_TESTS="YES" POD_LINT="NO" XCODEBUILD_GCC_PREPROCESSOR_DEFINITIONS="CI=1"
- SCHEME="ApplicationInsights" DESTINATION="OS=7.1,name=iPhone 5" CONFIGURATION="Debug" RUN_TESTS="YES" POD_LINT="NO" XCODEBUILD_GCC_PREPROCESSOR_DEFINITIONS="CI=1"
- SCHEME="ApplicationInsights" DESTINATION="OS=8.2,name=iPhone 6" CONFIGURATION="Debug" RUN_TESTS="YES" POD_LINT="NO" XCODEBUILD_GCC_PREPROCESSOR_DEFINITIONS="CI=1"
- SCHEME="ApplicationInsights" DESTINATION="OS=8.3,name=iPhone 6 Plus" CONFIGURATION="Debug" RUN_TESTS="YES" POD_LINT="NO" XCODEBUILD_GCC_PREPROCESSOR_DEFINITIONS="CI=1"
- SCHEME="ApplicationInsights Framework" CONFIGURATION="Release" RUN_TESTS="NO" POD_LINT="NO" XCODEBUILD_GCC_PREPROCESSOR_DEFINITIONS="MSAI_FEATURE_TELEMETRY=0 MSAI_FEATURE_CRASH_REPORTER=0"
- SCHEME="ApplicationInsights Framework" CONFIGURATION="Release" RUN_TESTS="NO" POD_LINT="NO" XCODEBUILD_GCC_PREPROCESSOR_DEFINITIONS="MSAI_FEATURE_TELEMETRY=1 MSAI_FEATURE_CRASH_REPORTER=0"
- SCHEME="ApplicationInsights Framework" CONFIGURATION="Release" RUN_TESTS="NO" POD_LINT="NO" XCODEBUILD_GCC_PREPROCESSOR_DEFINITIONS="MSAI_FEATURE_TELEMETRY=0 MSAI_FEATURE_CRASH_REPORTER=1"
- SCHEME="ApplicationInsights Framework" CONFIGURATION="Release" RUN_TESTS="NO" POD_LINT="YES"

before_install:
- gem install xcpretty -N cocoapods
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
- brew tap homebrew/versions
- brew install appledoc22
- brew link --force appledoc22

notifications:
slack:
secure: dCzA1+dtjKkHk2PK6RWBSE0Obgf0CvIejhXXH4Aba29zfVQg5Bv0yWJ34YHnPMFPA7+eyFrW2TqGqI7gA7L7Ju0RWHwu9Z0XayCcMpOCZVKTOSf/7SrAvtODKNzAT/S55HZOaj8yxK6l5a0cMGXfGM7j+NLdkjyba7ypQKsn0ug=
on_success: change
on_failure: always

script:
- set -o pipefail
- cd Support
- xcodebuild -project ApplicationInsights.xcodeproj -scheme "ApplicationInsights" -sdk iphonesimulator
-configuration Debug -destination "platform=iOS Simulator,name=iPhone 6" test |
xcpretty -c
- xcodebuild -project ApplicationInsights.xcodeproj -scheme "ApplicationInsights Framework" -sdk iphonesimulator
-configuration Release | xcpretty -c
- cd ..
- cp -R Products/ApplicationInsights ApplicationInsights
- pod lib lint
- set -o pipefail
- COMMAND="xcodebuild -project '$PROJECT' -scheme '$SCHEME' -sdk '$SDK' -configuration '$CONFIGURATION' XCODEBUILD_GCC_PREPROCESSOR_DEFINITIONS='$XCODEBUILD_GCC_PREPROCESSOR_DEFINITIONS'"
- if [ $RUN_TESTS == "YES" ]; then
COMMAND+=" -destination '$DESTINATION' clean test";
fi
- COMMAND+=" | xcpretty -c"
- eval $COMMAND
- if [ $POD_LINT == "YES" ]; then
cp -R Products/ApplicationInsights ApplicationInsights;
pod lib lint;
fi
7 changes: 3 additions & 4 deletions ApplicationInsights.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "ApplicationInsights"
s.version = "1.0-beta.3"
s.version = "1.0-beta.4"
s.summary = "Microsoft Application Insights SDK for iOS"
s.description = <<-DESC
Application Insights is a service that allows developers to keep their applications available, performant, and successful.
Expand All @@ -15,9 +15,8 @@ Pod::Spec.new do |s|
s.platform = :ios, '6.0'
s.requires_arc = true

s.frameworks = 'UIKit', 'Foundation', 'SystemConfiguration', 'Security'
s.libraries = 'z'
s.weak_framework = 'CoreTelephony'
s.frameworks = 'UIKit', 'Foundation', 'SystemConfiguration', 'Security', 'CoreTelephony'
s.libraries = 'z', 'c++'

s.ios.vendored_frameworks = 'ApplicationInsights/ApplicationInsights.framework'
s.preserve_path = 'ApplicationInsights/README.md'
Expand Down
20 changes: 1 addition & 19 deletions Classes/ApplicationInsights.h
Original file line number Diff line number Diff line change
@@ -1,30 +1,14 @@
#ifndef MSAI_h
#define MSAI_h

// Define nullability fallback for backwards compatibility
#if !__has_feature(nullability)
#define NS_ASSUME_NONNULL_BEGIN
#define NS_ASSUME_NONNULL_END
#define nullable
#define nonnull
#define null_unspecified
#define null_resettable
#define __nullable
#define __nonnull
#define __null_unspecified
#endif

#import "ApplicationInsightsFeatureConfig.h"
#import "MSAINullability.h"
#import "MSAIApplicationInsights.h"

#if MSAI_FEATURE_CRASH_REPORTER
#import "MSAICrashManager.h"
#import "MSAICrashManagerDelegate.h"
#import "MSAICrashDetails.h"
#endif /* MSAI_FEATURE_CRASH_REPORTER */

#if MSAI_FEATURE_TELEMETRY
#import "MSAICategoryContainer.h"
#import "MSAITelemetryManager.h"
#endif /* MSAI_FEATURE_TELEMETRY */

Expand Down Expand Up @@ -72,5 +56,3 @@ extern NSString *const __unused kMSAIErrorDomain;
NS_ASSUME_NONNULL_END

#endif /* MSAI_FEATURE_CRASH_REPORTER */

#endif /* MSAI_h */
1 change: 0 additions & 1 deletion Classes/ApplicationInsightsPrivate.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@
NSString *const kMSAICrashErrorDomain = @"MSAICrashReporterErrorDomain";
NSString *const kMSAIErrorDomain = @"MSAIErrorDomain";

NSString *const kMSAIIntegrationflowTimestamp = @"MSAIIntegrationFlowStartTimestamp";
13 changes: 8 additions & 5 deletions Classes/MSAIAppClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,25 @@ NS_ASSUME_NONNULL_BEGIN
- (NSMutableURLRequest *)requestWithMethod:(NSString*)method
path:(nullable NSString *)path
parameters:(nullable NSDictionary *)params;

/**
* Creates an operation for the given NSURLRequest
*
* @param request the request that should be handled
* @param queue Queue on which the completion block will be executed.
* @param completion completionBlock that is called once the operation finished
*
* @return operation, which can be queued via enqueueHTTPOperation:
*/
- (MSAIHTTPOperation *) operationWithURLRequest:(NSURLRequest*)request
completion:(nullable MSAINetworkCompletionBlock)completion;
- (MSAIHTTPOperation *)operationWithURLRequest:(NSURLRequest *)request queue:(dispatch_queue_t)queue completion:(nullable MSAINetworkCompletionBlock)completion;

/**
* Creates an operation for the given path, and enqueues it
*
* @param path the request path to check
* @param params parameters for the request
* @param completion completionBlock that is called once the operation finished
* @param completion completionBlock that is called once the operation finished.
* The block is executed on the main queue.
*
*/
- (void)getPath:(NSString*)path
Expand All @@ -60,7 +62,8 @@ NS_ASSUME_NONNULL_BEGIN
*
* @param path the request path to check
* @param params parameters for the request
* @param completion completionBlock that is called once the operation finished
* @param completion completionBlock that is called once the operation finished.
* The block is executed on the main queue
*
*/
- (void)postPath:(NSString*)path
Expand All @@ -71,7 +74,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* @param operation operation to add
*/
- (void)enqeueHTTPOperation:(MSAIHTTPOperation *)operation;
- (void)enqueueHTTPOperation:(MSAIHTTPOperation *)operation;

/**
* cancels the specified operations
Expand Down
26 changes: 11 additions & 15 deletions Classes/MSAIAppClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ - (NSMutableURLRequest *)requestWithMethod:(NSString*)method
NSString *appenderFormat = [path rangeOfString:@"?"].location == NSNotFound ? @"?%@" : @"&%@";

endpoint = [NSURL URLWithString:[absoluteURLString stringByAppendingFormat:appenderFormat,
[self.class queryStringFromParameters:params withEncoding:NSUTF8StringEncoding]]];
[self.class queryStringFromParameters:params]]];
[request setURL:endpoint];
} else {
//TODO: Boundary should be the same as the one in appendData
Expand Down Expand Up @@ -64,7 +64,7 @@ + (NSData *)dataWithPostValue:(NSData *)value forKey:(NSString *)key contentType

[postBody appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];

// There's certainly a better way to check if we are supposed to send binary data here.
// There's certainly a better way to check if we are supposed to send binary data here.
if (filename){
[postBody appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"; filename=\"%@\"\r\n", key, filename] dataUsingEncoding:NSUTF8StringEncoding]];
[postBody appendData:[[NSString stringWithFormat:@"Content-Type: %@\r\n", contentType] dataUsingEncoding:NSUTF8StringEncoding]];
Expand All @@ -81,7 +81,7 @@ + (NSData *)dataWithPostValue:(NSData *)value forKey:(NSString *)key contentType
}


+ (NSString *) queryStringFromParameters:(NSDictionary *) params withEncoding:(NSStringEncoding) encoding {
+ (NSString *)queryStringFromParameters:(NSDictionary *)params {
NSMutableString *queryString = [NSMutableString new];
[params enumerateKeysAndObjectsUsingBlock:^(NSString* key, NSString* value, BOOL *stop) {
NSAssert([key isKindOfClass:[NSString class]], @"Query parameters can only be string-string pairs");
Expand All @@ -92,30 +92,26 @@ + (NSString *) queryStringFromParameters:(NSDictionary *) params withEncoding:(N
return queryString;
}

- (MSAIHTTPOperation *) operationWithURLRequest:(NSURLRequest*) request
completion:(MSAINetworkCompletionBlock) completion {
MSAIHTTPOperation *operation = [MSAIHTTPOperation operationWithRequest:request
];
[operation setCompletion:completion];
- (MSAIHTTPOperation *)operationWithURLRequest:(NSURLRequest *)request queue:(dispatch_queue_t)queue completion:(nullable MSAINetworkCompletionBlock)completion {
MSAIHTTPOperation *operation = [MSAIHTTPOperation operationWithRequest:request];
[operation setCompletion:completion onQueue:queue];

return operation;
}

- (void)getPath:(NSString *)path parameters:(NSDictionary *)params completion:(MSAINetworkCompletionBlock)completion {
NSURLRequest *request = [self requestWithMethod:@"GET" path:path parameters:params];
MSAIHTTPOperation *op = [self operationWithURLRequest:request
completion:completion];
[self enqeueHTTPOperation:op];
MSAIHTTPOperation *op = [self operationWithURLRequest:request queue:dispatch_get_main_queue() completion:completion];
[self enqueueHTTPOperation:op];
}

- (void)postPath:(NSString *)path parameters:(NSDictionary *)params completion:(MSAINetworkCompletionBlock)completion {
NSURLRequest *request = [self requestWithMethod:@"POST" path:path parameters:params];
MSAIHTTPOperation *op = [self operationWithURLRequest:request
completion:completion];
[self enqeueHTTPOperation:op];
MSAIHTTPOperation *op = [self operationWithURLRequest:request queue:dispatch_get_main_queue() completion:completion];
[self enqueueHTTPOperation:op];
}

- (void)enqeueHTTPOperation:(MSAIHTTPOperation *)operation {
- (void)enqueueHTTPOperation:(MSAIHTTPOperation *)operation {
[self.operationQueue addOperation:operation];
}

Expand Down
4 changes: 1 addition & 3 deletions Classes/MSAIApplication.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#import "MSAIObject.h"
#import "MSAITelemetryData.h"
#import "MSAIDomain.h"

@interface MSAIApplication : MSAIObject <NSCoding>

@property (nonatomic, strong) NSString *version;

- (id)initWithCoder:(NSCoder *)coder;
- (instancetype)initWithCoder:(NSCoder *)coder;

- (void)encodeWithCoder:(NSCoder *)coder;

Expand Down
4 changes: 3 additions & 1 deletion Classes/MSAIApplication.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#import "MSAIApplication.h"
#import "MSAIOrderedDictionary.h"

/// Data contract class for type Application.
@implementation MSAIApplication

Expand All @@ -23,7 +25,7 @@ - (MSAIOrderedDictionary *)serializeToDictionary {

#pragma mark - NSCoding

- (id)initWithCoder:(NSCoder *)coder {
- (instancetype)initWithCoder:(NSCoder *)coder {
self = [super init];
if(self) {
self.version = [coder decodeObjectForKey:@"self.version"];
Expand Down
54 changes: 23 additions & 31 deletions Classes/MSAIApplicationInsights.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import <Foundation/Foundation.h>
#import "ApplicationInsights.h"
#import "ApplicationInsights.h"
#import "MSAINullability.h"
#import "MSAIUser.h"

NS_ASSUME_NONNULL_BEGIN
/**
Expand Down Expand Up @@ -79,7 +79,7 @@ NS_ASSUME_NONNULL_BEGIN
* Defines the server URL to send data to or request data from. By default this is set
* to the Application Insights servers and there rarely should be a need to modify that.
* If you set your custom server URL, make sure you set the full URL (e.g. https://yourdomain.com/track/)
* @warning This property needs to be set before calling `startManager`.
* @warning This property needs to be set before calling `start`.
*/
@property (nonatomic, strong) NSString *serverURL;

Expand Down Expand Up @@ -142,6 +142,8 @@ NS_ASSUME_NONNULL_BEGIN
*/
+ (void)setAutoPageViewTrackingDisabled:(BOOL)autoPageViewTrackingDisabled;

#endif /* MSAI_FEATURE_TELEMETRY */

/**
* Flag that determines whether sessions will automatically be renewed when the app starts and goes to the background for more than 20 seconds.
* If YES, sessions are not automatically renewed and the developer has to manually trigger a session renewal or set a specific session ID.
Expand All @@ -166,15 +168,31 @@ NS_ASSUME_NONNULL_BEGIN
*
* @param userId The string which will be used as the current user's ID.
*/
+ (void)setUserId:(NSString *)userId;
+ (void)setUserId:(NSString *)userId __deprecated_msg("Use setUserWithConfigurationBlock: instead!");

/**
* Manually set the current user ID. This ID will automatically be persisted and attached to all appropriate telemetry and crash events.
* The user ID will stay the same until it is changed.
*
* @param userId The string which will be used as the current user's ID.
*/
- (void)setUserId:(NSString *)userId;
- (void)setUserId:(NSString *)userId __deprecated_msg("Use setUserWithConfigurationBlock: instead!");

/**
* Use this method to configure the current user's context.
*
* @param userConfigurationBlock This block gets the current user as an input.
* Within the block you can update the user object's values to up-to-date.
*/
+ (void)setUserWithConfigurationBlock:(void (^)(MSAIUser *user))userConfigurationBlock;

/**
* Use this method to configure the current user's context.
*
* @param userConfigurationBlock This block gets the current user as an input.
* Within the block you can update the user object's values to up-to-date.
*/
- (void)setUserWithConfigurationBlock:(void (^)(MSAIUser *user))userConfigurationBlock;

/**
* Manually trigger a new session start.
Expand Down Expand Up @@ -222,8 +240,6 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)renewSessionWithId:(NSString *)sessionId;

#endif /* MSAI_FEATURE_TELEMETRY */

///-----------------------------------------------------------------------------
/// @name Environment
///-----------------------------------------------------------------------------
Expand All @@ -249,30 +265,6 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (nonatomic, assign, getter=isDebugLogEnabled) BOOL debugLogEnabled;

///-----------------------------------------------------------------------------
/// @name Testing integration
///-----------------------------------------------------------------------------

/**
* Pings the server with the Application Insights app identifiers used for initialization.
* Call this method once for debugging purposes to test if your SDK setup code
* reaches the server successfully.
* Once invoked, check the apps page on Application Insights for a verification.
* If you setup the SDK with a beta and live identifier, a call to both app IDs will be done.
* This call is ignored if the app is running in the App Store!.
*/
+ (void)testIdentifier;

/**
* Pings the server with the Application Insights app identifiers used for initialization.
* Call this method once for debugging purposes to test if your SDK setup code
* reaches the server successfully.
* Once invoked, check the apps page on Application Insights for a verification.
* If you setup the SDK with a beta and live identifier, a call to both app IDs will be done.
* This call is ignored if the app is running in the App Store!.
*/
- (void)testIdentifier;

///-----------------------------------------------------------------------------
/// @name Getting SDK meta data
///-----------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit a306f26

Please sign in to comment.