Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI Customization #279

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions Pod/Classes/TSMessageView.m
Expand Up @@ -48,6 +48,7 @@ @interface TSMessageView () <UIGestureRecognizerDelegate>

@property (nonatomic, assign) CGFloat textSpaceLeft;
@property (nonatomic, assign) CGFloat textSpaceRight;
@property (nonatomic, assign) CGFloat minimumPadding;

@property (copy) void (^callback)();
@property (copy) void (^buttonCallback)();
Expand Down Expand Up @@ -178,7 +179,8 @@ + (void)addNotificationDesignFromFile:(NSString *)filename
- (CGFloat)padding
{
// Adds 10 padding to to cover navigation bar
return self.messagePosition == TSMessageNotificationPositionNavBarOverlay ? TSMessageViewMinimumPadding + 10.0f : TSMessageViewMinimumPadding;
return self.messagePosition == TSMessageNotificationPositionNavBarOverlay ? self.minimumPadding + 10.0f
: self.minimumPadding;
}

- (id)initWithTitle:(NSString *)title
Expand Down Expand Up @@ -207,7 +209,6 @@ - (id)initWithTitle:(NSString *)title
self.buttonCallback = buttonCallback;

CGFloat screenWidth = self.viewController.view.bounds.size.width;
CGFloat padding = [self padding];

NSDictionary *current;
NSString *currentString;
Expand Down Expand Up @@ -241,6 +242,13 @@ - (id)initWithTitle:(NSString *)title

current = [notificationDesign valueForKey:currentString];

if (current[@"minimumPadding"] != nil) {
self.minimumPadding = [current[@"minimumPadding"] floatValue];
} else {
self.minimumPadding = TSMessageViewMinimumPadding;
}

CGFloat padding = [self padding];

if (!image && [[current valueForKey:@"imageName"] length])
{
Expand Down Expand Up @@ -269,6 +277,7 @@ - (id)initWithTitle:(NSString *)title
_backgroundBlurView = [[TSBlurView alloc] init];
self.backgroundBlurView.autoresizingMask = (UIViewAutoresizingFlexibleWidth);
self.backgroundBlurView.blurTintColor = [UIColor colorWithHexString:current[@"backgroundColor"]];
self.backgroundBlurView.alpha = CGColorGetAlpha(self.backgroundBlurView.blurTintColor.CGColor);
[self addSubview:self.backgroundBlurView];
}

Expand Down