Skip to content

Commit

Permalink
Updating Appboy SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
Wenzhi committed Jul 1, 2015
1 parent d9d9d5e commit 44513d4
Show file tree
Hide file tree
Showing 436 changed files with 2,900 additions and 3,680 deletions.
Binary file modified .DS_Store
Binary file not shown.
58 changes: 58 additions & 0 deletions Appboy-WatchKit/ABWKUser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#import <Foundation/Foundation.h>
/*
* This ABWKUser class is parallel with the ABKUser in the Appboy iOS SDK.
*
* NOTE: Make sure DO NOT pass a nil as a parameter, otherwise the watch SDK will throw an exception
* when trying to parse the data to a dictionary.
*/
@interface ABWKUser : NSObject

+ (void) setFirstName:(NSString *)firstName;

+ (void) setLastName:(NSString *)lastName;

+ (void) setEmail:(NSString *)email;

+ (void) setDateOfBirth:(NSDate *)dateOfBirth;

+ (void) setCountry:(NSString *)country;

+ (void) setHomeCity:(NSString *)homeCity;

+ (void) setBio:(NSString *)bio;

+ (void) setPhone:(NSString *)phone;

+ (void) setAvatarImageURL:(NSString *)avatarImageURL;

+ (void) setCustomAttributeWithKey:(NSString *)key andBOOLValue:(BOOL)value;

+ (void) setCustomAttributeWithKey:(NSString *)key andIntegerValue:(NSInteger)value;

+ (void) setCustomAttributeWithKey:(NSString *)key andDoubleValue:(double)value;

+ (void) setCustomAttributeWithKey:(NSString *)key andStringValue:(NSString *)value;

+ (void) setCustomAttributeWithKey:(NSString *)key andDateValue:(NSDate *)value;

+ (void) unsetCustomAttributeWithKey:(NSString *)key;

+ (void) incrementCustomUserAttribute:(NSString *)key;

+ (void) incrementCustomUserAttribute:(NSString *)key by:(NSInteger)incrementValue;

+ (void) addToCustomAttributeArrayWithKey:(NSString *)key value:(NSString *)value;

+ (void) removeFromCustomAttributeArrayWithKey:(NSString *)key value:(NSString *)value;

+ (void) setCustomAttributeArrayWithKey:(NSString *)key array:(NSArray *)valueArray;

+ (void) setLastKnownLocationWithLatitude:(double)latitude longitude:(double)longitude horizontalAccuracy:(double)horizontalAccuracy;

+ (void) setLastKnownLocationWithLatitude:(double)latitude
longitude:(double)longitude
horizontalAccuracy:(double)horizontalAccuracy
altitude:(double)altitude
verticalAccuracy:(double)verticalAccuracy;

@end
112 changes: 112 additions & 0 deletions Appboy-WatchKit/ABWKUser.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#import "ABWKUser.h"
#import "AppboyWatchKit.h"
#import "AppboyWatchKitKeys.h"

@implementation ABWKUser

+ (void) setFirstName:(NSString *)firstName {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserFirstName infoArray:@[firstName]]];
}

+ (void) setLastName:(NSString *)lastName {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserLastName infoArray:@[lastName]]];
}

+ (void) setEmail:(NSString *)email {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserEmail infoArray:@[email]]];
}

+ (void) setDateOfBirth:(NSDate *)dateOfBirth {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserDateOfBirth infoArray:@[dateOfBirth]]];
}

+ (void) setCountry:(NSString *)country {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserCountry infoArray:@[country]]];
}

+ (void) setHomeCity:(NSString *)homeCity {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserHomeCity infoArray:@[homeCity]]];
}

+ (void) setBio:(NSString *)bio {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserBio infoArray:@[bio]]];
}

+ (void) setPhone:(NSString *)phone {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserPhone infoArray:@[phone]]];
}

+ (void) setAvatarImageURL:(NSString *)avatarImageURL {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserAvatarImageURL infoArray:@[avatarImageURL]]];
}

+ (void) setCustomAttributeWithKey:(NSString *)key andBOOLValue:(BOOL)value {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserCustomAttribute
infoArray:@[ABWKUserBoolCustomAttributeKey, key, @(value)]]];
}

+ (void) setCustomAttributeWithKey:(NSString *)key andIntegerValue:(NSInteger)value {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserCustomAttribute
infoArray:@[ABWKUserIntegerCustomAttributeKey, key, @(value)]]];
}

+ (void) setCustomAttributeWithKey:(NSString *)key andDoubleValue:(double)value {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserCustomAttribute
infoArray:@[ABWKUserDoubleCustomAttributeKey, key, @(value)]]];
}

+ (void) setCustomAttributeWithKey:(NSString *)key andStringValue:(NSString *)value {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserCustomAttribute
infoArray:@[ABWKUserStringCustomAttributeKey, key, value]]];
}

+ (void) setCustomAttributeWithKey:(NSString *)key andDateValue:(NSDate *)value {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserCustomAttribute
infoArray:@[ABWKUserDateCustomAttributeKey, key, value]]];
}

+ (void) unsetCustomAttributeWithKey:(NSString *)key {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserUnsetCustomAttribute infoArray:@[key]]];
}

+ (void) incrementCustomUserAttribute:(NSString *)key {
[self incrementCustomUserAttribute:key by:1];
}

+ (void) incrementCustomUserAttribute:(NSString *)key by:(NSInteger)incrementValue {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserIncrementCustomAttribute infoArray:@[key, @(incrementValue)]]];
}

+ (void) addToCustomAttributeArrayWithKey:(NSString *)key value:(NSString *)value {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserAddToCustomArray infoArray:@[key, value]]];
}

+ (void) removeFromCustomAttributeArrayWithKey:(NSString *)key value:(NSString *)value {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserRemoveFromCustomArray infoArray:@[key, value]]];
}

+ (void) setCustomAttributeArrayWithKey:(NSString *)key array:(NSArray *)valueArray {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserSetCustomArray infoArray:@[key, valueArray]]];
}

+ (void) setLastKnownLocationWithLatitude:(double)latitude longitude:(double)longitude horizontalAccuracy:(double)horizontalAccuracy {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserLocation
infoArray:@[@(latitude), @(longitude), @(horizontalAccuracy)]]];
}

+ (void) setLastKnownLocationWithLatitude:(double)latitude
longitude:(double)longitude
horizontalAccuracy:(double)horizontalAccuracy
altitude:(double)altitude
verticalAccuracy:(double)verticalAccuracy {
[AppboyWatchKit sendToiOSApp:[self userDataDictionaryWithChangeType:ABWKUserLocation
infoArray:@[@(latitude), @(longitude), @(horizontalAccuracy), @(altitude), @(verticalAccuracy)]]];
}

+ (NSDictionary *) userDataDictionaryWithChangeType:(ABWKUserUpdateType)updateType
infoArray:(NSArray *)array {
return @{ABWKKUserKey : @{ABWKKUserUpdateTypeKey : @(updateType),
ABWKUserDataArrayKey : array}};
}

@end
29 changes: 29 additions & 0 deletions Appboy-WatchKit/AppboyWatchKit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#import <Foundation/Foundation.h>
/*
* This ABWKUser class is parallel with the Appboy in the Appboy iOS SDK.
*
* NOTE: Please make sure the passed parameter(s) is not nil, or the watch SDK will throw an exception when trying to
* parse the data to a dictionary.
*/

@interface AppboyWatchKit : NSObject

+ (void) logCustomEvent:(NSString *)eventName;

+ (void) logCustomEvent:(NSString *)eventName withProperties:(NSDictionary *)properties;

+ (void) logPurchase:(NSString *)productIdentifier inCurrency:(NSString *)currencyCode atPrice:(NSDecimalNumber *)price;

+ (void) logPurchase:(NSString *)productIdentifier inCurrency:(NSString *)currencyCode atPrice:(NSDecimalNumber *)price withProperties:properties;

+ (void) logPurchase:(NSString *)productIdentifier inCurrency:(NSString *)currencyCode atPrice:(NSDecimalNumber *)price withQuantity:(NSUInteger)quantity;

+ (void) logPurchase:(NSString *)productIdentifier inCurrency:(NSString *)currencyCode atPrice:(NSDecimalNumber *)price withQuantity:(NSUInteger)quantity andProperties:(NSDictionary *)properties;

+ (void) submitFeedback:(NSString *)replyToEmail message:(NSString *)message isReportingABug:(BOOL)isReportingABug;

+ (void) logActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)remoteNotification;

+ (void) sendToiOSApp:(NSDictionary *)dictionary;

@end
84 changes: 84 additions & 0 deletions Appboy-WatchKit/AppboyWatchKit.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#import "AppboyWatchKit.h"
#import "AppboywatchKitKeys.h"
#import <WatchKit/WatchKit.h>

static CGFloat const AppleWatch38mmWidth = 136.0;
static CGFloat const AppleWatch42mmWidth = 156.0;

@implementation AppboyWatchKit

+ (void) logCustomEvent:(NSString *)eventName {
[self logCustomEvent:eventName withProperties:nil];
}

+ (void) logCustomEvent:(NSString *)eventName withProperties:(NSDictionary *)properties {
if (properties != nil && properties.count > 0) {
[self sendToiOSApp:@{ABWKCustomEventKey : @{ABWKCustomEventNameKey : eventName,
ABWKCustomEventPropertiesKey : properties}}];
} else {
[self sendToiOSApp:@{ABWKCustomEventKey : @{ABWKCustomEventNameKey : eventName}}];
}
}

+ (void) logPurchase:(NSString *)productIdentifier inCurrency:(NSString *)currencyCode atPrice:(NSDecimalNumber *)price {
[self logPurchase:productIdentifier inCurrency:currencyCode atPrice:price withQuantity:1 andProperties:nil];
}

+ (void) logPurchase:(NSString *)productIdentifier inCurrency:(NSString *)currencyCode atPrice:(NSDecimalNumber *)price withProperties:properties {
[self logPurchase:productIdentifier inCurrency:currencyCode atPrice:price withQuantity:1 andProperties:properties];
}

+ (void) logPurchase:(NSString *)productIdentifier inCurrency:(NSString *)currencyCode atPrice:(NSDecimalNumber *)price withQuantity:(NSUInteger)quantity {
[self logPurchase:productIdentifier inCurrency:currencyCode atPrice:price withQuantity:quantity andProperties:nil];
}

+ (void) logPurchase:(NSString *)productIdentifier inCurrency:(NSString *)currencyCode atPrice:(NSDecimalNumber *)price withQuantity:(NSUInteger)quantity andProperties:(NSDictionary *)properties {
if (properties != nil && properties.count > 0) {
[self sendToiOSApp:@{ABWKPurchaseKey : @{ABWKPurchaseProductIdKey : productIdentifier,
ABWKPurchaseCurrencyKey : currencyCode,
// NSDecimalNumber is translated into NSNumber in the iOS SDK, so we parse the NSDeicmalNumber's value to a string to avoid errors.
ABWKPurchasePriceKey : [NSString stringWithFormat:@"%f", [price doubleValue]],
ABWKPurchaseQuantityKey : @(quantity),
ABWKPurchasePropertiesKey : properties}}];
} else {
[self sendToiOSApp:@{ABWKPurchaseKey : @{ABWKPurchaseProductIdKey : productIdentifier,
ABWKPurchaseCurrencyKey : currencyCode,
// NSDecimalNumber is translated into NSNumber in the iOS SDK, so we parse the NSDeicmalNumber's value to a string to avoid errors.
ABWKPurchasePriceKey : [NSString stringWithFormat:@"%f", [price doubleValue]],
ABWKPurchaseQuantityKey : @(quantity)}}];
}
}

+ (void) submitFeedback:(NSString *)replyToEmail message:(NSString *)message isReportingABug:(BOOL)isReportingABug {
[self sendToiOSApp:@{ABWKSubmitFeedbackKey : @{ABWKSubmitFeedbackEmailKey : replyToEmail,
ABWKSubmitFeedbackMessageKey : message,
ABWKSubmitFeedbackIsBugKey : @(isReportingABug)}}];
}

+ (void) logActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)remoteNotification {
if (identifier != nil && identifier.length > 0) {
[self sendToiOSApp:@{ABWKWatchPushOpenKey : remoteNotification,
ABWKWatchPushOpenActionIdentifierKey : identifier}];
} else {
[self sendToiOSApp:@{ABWKWatchPushOpenKey : remoteNotification}];
}
}

+ (void) sendToiOSApp:(NSDictionary *)dictionary {
[WKInterfaceController openParentApplication:@{AppboyWatchKitDataKey : dictionary,
AppboyWatchKitDeviceModelKey : [self getWatchModel]}
reply:nil];
}

+ (NSString *) getWatchModel {
CGFloat watchWidth = [WKInterfaceDevice currentDevice].screenBounds.size.width;
NSString *deviceModel = ABKWKDeviceModel;
if (watchWidth == AppleWatch38mmWidth) {
deviceModel = ABKWKDeviceModel38mm;
} else if (watchWidth == AppleWatch42mmWidth) {
deviceModel = ABKWKDeviceModel42mm;
}
return deviceModel;
}

@end
51 changes: 51 additions & 0 deletions Appboy-WatchKit/AppboyWatchKitKeys.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#import <Foundation/Foundation.h>

static NSString *const AppboyWatchKitDataKey = @"AppboyWatchKitData";
static NSString *const AppboyWatchKitDeviceModelKey = @"AppboyWatchKitDeviceModel";

static NSString *const ABKWKDeviceModel38mm = @"Apple Watch 38mm";
static NSString *const ABKWKDeviceModel42mm = @"Apple Watch 42mm";
static NSString *const ABKWKDeviceModel = @"Apple Watch";

typedef NS_ENUM(NSInteger , ABWKUserUpdateType) {
ABWKUserFirstName,
ABWKUserLastName,
ABWKUserEmail,
ABWKUserDateOfBirth,
ABWKUserCountry,
ABWKUserHomeCity,
ABWKUserBio,
ABWKUserPhone,
ABWKUserAvatarImageURL,
ABWKUserCustomAttribute,
ABWKUserUnsetCustomAttribute,
ABWKUserIncrementCustomAttribute,
ABWKUserAddToCustomArray,
ABWKUserRemoveFromCustomArray,
ABWKUserSetCustomArray,
ABWKUserLocation
};
static NSString *const ABWKKUserKey = @"ABWKUser";
static NSString *const ABWKKUserUpdateTypeKey = @"ABWKUserUpdateType";
static NSString *const ABWKUserDataArrayKey = @"ABWKUserDataArray";
static NSString *const ABWKUserBoolCustomAttributeKey = @"ABWKUserBoolCustomAttribute";
static NSString *const ABWKUserIntegerCustomAttributeKey = @"ABWKUserIntegerCustomAttribute";
static NSString *const ABWKUserDoubleCustomAttributeKey = @"ABWKUserDoubleCustomAttribute";
static NSString *const ABWKUserStringCustomAttributeKey = @"ABWKUserStringCustomAttribute";
static NSString *const ABWKUserDateCustomAttributeKey = @"ABWKUserDateCustomAttribute";

static NSString *const ABWKCustomEventKey = @"ABWKCustomEvent";
static NSString *const ABWKCustomEventNameKey = @"ABWKCustomEventName";
static NSString *const ABWKCustomEventPropertiesKey = @"ABWKCustomEventProperties";
static NSString *const ABWKPurchaseKey = @"ABWKPurchase";
static NSString *const ABWKPurchaseProductIdKey = @"ABWKPurchaseProductId";
static NSString *const ABWKPurchaseCurrencyKey = @"ABWKPurchaseCurrency";
static NSString *const ABWKPurchasePriceKey = @"ABWKPurchasePrice";
static NSString *const ABWKPurchaseQuantityKey = @"ABWKPurchaseQuantity";
static NSString *const ABWKPurchasePropertiesKey = @"ABWKPurchaseProperties";
static NSString *const ABWKSubmitFeedbackKey = @"ABWKSubmitFeedback";
static NSString *const ABWKSubmitFeedbackEmailKey = @"ABWKSubmitFeedbackEmail";
static NSString *const ABWKSubmitFeedbackMessageKey = @"ABWKSubmitFeedbackMessage";
static NSString *const ABWKSubmitFeedbackIsBugKey = @"ABWKSubmitFeedbackIsBug";
static NSString *const ABWKWatchPushOpenKey = @"ABWKWatchPushOpen";
static NSString *const ABWKWatchPushOpenActionIdentifierKey = @"ABWKWatchPushOpenActionIdentifier";
2 changes: 1 addition & 1 deletion Appboy-iOS-SDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Appboy-iOS-SDK"
s.version = "2.12.0"
s.version = "2.12.1"
s.summary = "This is the Appboy iOS SDK for Mobile Marketing Automation"
s.homepage = "http://www.appboy.com"
s.license = { :type => 'Commercial', :text => 'Please refer to https://github.com/Appboy/appboy-ios-sdk/blob/master/LICENSE'}
Expand Down
1 change: 0 additions & 1 deletion AppboyKit/ABKIdentifierForAdvertisingProvider.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ + (NSNumber *) getIsAdvertisingTrackingEnabledAsNSNumber {
* against AdSupport framework).
*/
+ (ASIdentifierManager *) getASIdentifierManager {
NSLog(@"[APPBOY] %@", @"ASI code block enabled.");
Class ASIdentifierManagerClass = NSClassFromString(@"ASIdentifierManager");
if (ASIdentifierManagerClass) {
// Don't use [ASIdentifierManager sharedManager] here so this method doesn't require that the host app link against
Expand Down
Binary file modified AppboyKit/Appboy.bundle/ABKBannerCardCell.nib/objects-8.0+.nib
Binary file not shown.
Binary file modified AppboyKit/Appboy.bundle/ABKBannerCardCell.nib/objects.nib
Binary file not shown.
Binary file modified AppboyKit/Appboy.bundle/ABKBannerCardCell.nib/runtime.nib
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified AppboyKit/Appboy.bundle/ABKFeedNoConnectionView.nib/objects.nib
Binary file not shown.
Binary file modified AppboyKit/Appboy.bundle/ABKFeedNoConnectionView.nib/runtime.nib
Binary file not shown.
Binary file not shown.
Binary file modified AppboyKit/Appboy.bundle/ABKFeedbackContentView.nib/objects.nib
Binary file not shown.
Binary file modified AppboyKit/Appboy.bundle/ABKFeedbackContentView.nib/runtime.nib
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified AppboyKit/Appboy.bundle/ABKFeedbackNavBar.nib/objects-8.0+.nib
Binary file not shown.
Binary file modified AppboyKit/Appboy.bundle/ABKFeedbackNavBar.nib/objects.nib
Binary file not shown.
Binary file modified AppboyKit/Appboy.bundle/ABKFeedbackNavBar.nib/runtime.nib
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified AppboyKit/Appboy.bundle/ABKSpinnerView.nib/objects-8.0+.nib
Binary file not shown.
Binary file modified AppboyKit/Appboy.bundle/ABKSpinnerView.nib/objects.nib
Binary file not shown.
Binary file modified AppboyKit/Appboy.bundle/ABKSpinnerView.nib/runtime.nib
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion AppboyKit/headers/AppboyKitLibrary/Appboy.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#import <UIKit/UIKit.h>

#ifndef APPBOY_SDK_VERSION
#define APPBOY_SDK_VERSION @"2.12.0"
#define APPBOY_SDK_VERSION @"2.12.1"
#endif

@class ABKInAppMessageController;
Expand Down
Binary file modified AppboyKit/libAppboyKitLibrary.a
Binary file not shown.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.12.1
- Fixes news feed issue where no news feed cards resulted in the loading spinner remaining on screen.
- Adds font and font size customization to all in-app message's header and message text through NUI. You can customize in-app message's font by adding `ABKInAppMessageSlideupMessageLabel`, `ABKInAppMessageeModalHeaderLabel`,`ABKInAppMessageModalMessageLabel`, `ABKInAppMessageFullHeaderLabel`, `ABKInAppMessageFullMessageLabel` to your NUI nss style sheet.
- Cleans up the console logging in Class ABKIdentifierForAdvertisingProvider.

## 2.12.0
- Removes the subspecs from the podspec. This fixes the duplicate symbol error https://github.com/Appboy/appboy-ios-sdk/issues/24. If you are still using subspec like `pod 'Appboy-iOS-SDK/AppboyKit'` in your podfile, please make sure to change it to `pod 'Appboy-iOS-SDK'`.
- Fixes the incorrect path runtime error for users who integrate our pod as a dynamic framework. For SDK versions before 2.12, when you intergrate Appboy with `use_frameworks!` in the Podfile, the library is integrated as a dynamic framework and the Appboy.bundle is stored in a different path.
Expand Down
Binary file modified Example/.DS_Store
Binary file not shown.
6 changes: 4 additions & 2 deletions Example/.idea/Stopwatch.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 44513d4

Please sign in to comment.