Skip to content

Commit

Permalink
Merge pull request #16 from CleverTap/3.3.0
Browse files Browse the repository at this point in the history
3.3.0
  • Loading branch information
Aditi3 authored Oct 26, 2018
2 parents 2dadd50 + eed5a7e commit 9defdb2
Show file tree
Hide file tree
Showing 91 changed files with 7,423 additions and 901 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGE LOG

## Version 3.3.0 (October 26, 2018)
* Adds support for Native InApp Notifications

## Version 3.2.2 (September 26, 2018)
* Update Build Info

## Version 3.2.1 (September 26, 2018)
* Fix method swizzling issue

Expand Down
6 changes: 3 additions & 3 deletions CleverTap-iOS-SDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "CleverTap-iOS-SDK"
s.version = "3.2.2"
s.version = "3.3.0"
s.summary = "The CleverTap iOS SDK for App Analytics and Engagement."
s.homepage = "https://github.com/CleverTap/clevertap-ios-sdk"
s.license = { :type => "MIT" }
Expand All @@ -9,11 +9,11 @@ s.source = { :git => "https://github.com/CleverTap/clevertap-
s.requires_arc = true
s.module_name = 'CleverTapSDK'
s.resources = 'CleverTapSDK/*.crt'
s.ios.resources = 'CleverTapSDK/**/*.{png,xib}'
s.ios.deployment_target = '8.0'
s.ios.source_files = 'CleverTapSDK/*.{h,m}'
s.ios.source_files = 'CleverTapSDK/**/*.{h,m}'
s.ios.public_header_files = 'CleverTapSDK/CleverTap.h', 'CleverTapSDK/CleverTap+SSLPinning.h', 'CleverTapSDK/CleverTapInstanceConfig.h', 'CleverTapSDK/CleverTapBuildInfo.h', 'CleverTapSDK/CleverTapEventDetail.h', 'CleverTapSDK/CleverTapInAppNotificationDelegate.h', 'CleverTapSDK/CleverTapSyncDelegate.h', 'CleverTapSDK/CleverTapTrackedViewController.h', 'CleverTapSDK/CleverTapUTMDetail.h'
s.tvos.deployment_target = '9.0'
s.tvos.source_files = 'CleverTapSDK/*.{h,m}'
s.tvos.exclude_files = 'CleverTapSDK/CTInAppHTMLViewController.{h,m}'
s.tvos.public_header_files = 'CleverTapSDK/CleverTap.h', 'CleverTapSDK/CleverTap+SSLPinning.h', 'CleverTapSDK/CleverTapInstanceConfig.h', 'CleverTapSDK/CleverTapBuildInfo.h', 'CleverTapSDK/CleverTapEventDetail.h', 'CleverTapSDK/CleverTapSyncDelegate.h', 'CleverTapSDK/CleverTapTrackedViewController.h', 'CleverTapSDK/CleverTapUTMDetail.h'
end
442 changes: 366 additions & 76 deletions CleverTapSDK.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions CleverTapSDK/CTEventBuilder.m
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ + (void)buildChargedEventWithDetails:(NSDictionary *)chargeDetails andItems:(NSA
return;
}

if (((int) [items count]) > 15) {
if (((int) [items count]) > 50) {
CTValidationResult *error = [[CTValidationResult alloc] init];
[error setErrorCode:522];
[error setErrorDesc:@"Charged event contained more than 15 items."];
CleverTapLogStaticDebug(@"Charged event contained more than 15 items.");
[error setErrorDesc:@"Charged event contained more than 50 items."];
CleverTapLogStaticDebug(@"Charged event contained more than 50 items.");
[errors addObject:error];
}
NSMutableDictionary *evtData = [[NSMutableDictionary alloc] init];
Expand Down
66 changes: 66 additions & 0 deletions CleverTapSDK/CTInAppDisplayViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ - (instancetype)initWithNotification:(CTInAppNotification *)notification {
return self;
}

#if !(TARGET_OS_TV)
- (BOOL)shouldAutorotate {
return NO;
}
#endif

#if !(TARGET_OS_TV)
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return (UIInterfaceOrientationPortrait | UIInterfaceOrientationPortraitUpsideDown);
}
#endif

-(void)show:(BOOL)animated {
NSAssert(false, @"Override in sub-class");
}
Expand Down Expand Up @@ -100,10 +112,64 @@ - (void)viewWillPassThroughTouch {
[self hide:NO];
}

#pragma mark - Setup Buttons

- (UIButton*)setupViewForButton:(UIButton *)buttonView withData:(CTNotificationButton *)button withIndex:(NSInteger)index {
[buttonView setTag: index];
buttonView.titleLabel.adjustsFontSizeToFitWidth = YES;
buttonView.hidden = NO;
if (_notification.inAppType != CTInAppTypeHeader && _notification.inAppType != CTInAppTypeFooter) {
buttonView.layer.borderWidth = 1.0f;
buttonView.layer.cornerRadius = [button.borderRadius floatValue];
buttonView.layer.borderColor = [[CTInAppUtils ct_colorWithHexString:button.borderColor] CGColor];
}

[buttonView setBackgroundColor:[CTInAppUtils ct_colorWithHexString:button.backgroundColor]];
[buttonView setTitleColor:[CTInAppUtils ct_colorWithHexString:button.textColor] forState:UIControlStateNormal];
[buttonView addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside];
[buttonView setTitle:button.text forState:UIControlStateNormal];
return buttonView;
}

#pragma mark - Actions

- (void)tappedDismiss {
[self hide:YES];
}

- (void)buttonTapped:(UIButton*)button {
[self handleButtonClickFromIndex:(int)button.tag];
[self hide:YES];
}

- (void)handleButtonClickFromIndex:(int)index {
CTNotificationButton *button = self.notification.buttons[index];
NSURL *buttonCTA = button.actionURL;
NSString *buttonText = button.text;
NSString *campaignId = self.notification.campaignId;

if (campaignId == nil) {
campaignId = @"";
}

if (self.delegate && [self.delegate respondsToSelector:@selector(handleNotificationCTA:forNotification:fromViewController:withExtras:)]) {
[self.delegate handleNotificationCTA:buttonCTA forNotification:self.notification fromViewController:self withExtras:@{@"wzrk_id":campaignId, @"wzrk_c2a": buttonText}];
}
}

- (void)handleImageTapGesture{
CTNotificationButton *button = self.notification.buttons[0];
NSURL *buttonCTA = button.actionURL;
NSString *buttonText = @"image";
NSString *campaignId = self.notification.campaignId;

if (campaignId == nil) {
campaignId = @"";
}

if (self.delegate && [self.delegate respondsToSelector:@selector(handleNotificationCTA:forNotification:fromViewController:withExtras:)]) {
[self.delegate handleNotificationCTA:buttonCTA forNotification:self.notification fromViewController:self withExtras:@{@"wzrk_id":campaignId, @"wzrk_c2a": buttonText}];
}
}

@end
7 changes: 6 additions & 1 deletion CleverTapSDK/CTInAppDisplayViewControllerPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@
@interface CTInAppDisplayViewController () <CTInAppPassThroughViewDelegate> {
}


@property (nonatomic, strong) UIWindow *window;
@property (nonatomic, strong, readwrite) CTInAppNotification *notification;
@property(nonatomic, assign) BOOL shouldPassThroughTouches;
@property (nonatomic, assign) BOOL shouldPassThroughTouches;

-(void)showFromWindow:(BOOL)animated;
-(void)hideFromWindow:(BOOL)animated;

-(void)tappedDismiss;
-(void)buttonTapped:(UIButton*)button;
-(void)handleButtonClickFromIndex:(int)index;
-(void)handleImageTapGesture;
-(UIButton*)setupViewForButton:(UIButton *)buttonView withData:(CTNotificationButton *)button withIndex:(NSInteger)index;

@end
26 changes: 24 additions & 2 deletions CleverTapSDK/CTInAppNotification.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "CTInAppUtils.h"
#import "CTNotificationButton.h"

@interface CTInAppNotification : NSObject

@property (nonatomic, readonly) NSString* Id;
@property (nonatomic, readonly) NSString* campaignId;
@property (nonatomic, readonly) NSString *Id;
@property (nonatomic, readonly) NSString *campaignId;
@property (nonatomic, copy, readonly) NSString *type;
@property (nonatomic, readonly) CTInAppType inAppType;

@property (nonatomic, copy, readonly) NSString *html;
@property (nonatomic, readonly) BOOL excludeFromCaps;
@property (nonatomic, readonly) BOOL showClose;
Expand All @@ -21,6 +24,25 @@
@property (nonatomic, assign, readonly) float width;
@property (nonatomic, assign, readonly) float widthPercent;

@property (nonatomic, readonly) NSData *image;
@property (nonatomic, copy, readonly) NSString *contentType;
@property (nonatomic, copy, readonly) NSString *mediaUrl;
@property (nonatomic, readonly, assign) BOOL mediaIsVideo;
@property (nonatomic, readonly, assign) BOOL mediaIsAudio;
@property (nonatomic, readonly, assign) BOOL mediaIsImage;
@property (nonatomic, readonly, assign) BOOL mediaIsGif;

@property (nonatomic, copy, readonly) NSString *title;
@property (nonatomic, copy, readonly) NSString *titleColor;
@property (nonatomic, copy, readonly) NSString *message;
@property (nonatomic, copy, readonly) NSString *messageColor;
@property (nonatomic, copy, readonly) NSString *backgroundColor;

@property (nonatomic, readonly, assign) BOOL showCloseButton;
@property (nonatomic, readonly, assign) BOOL tablet;

@property (nonatomic, readonly) NSArray<CTNotificationButton *> *buttons;

@property (nonatomic, copy, readonly) NSDictionary *jsonDescription;
@property (nonatomic, readonly) NSString *error;

Expand Down
Loading

0 comments on commit 9defdb2

Please sign in to comment.