Skip to content

Commit

Permalink
Pushwoosh Inbox UI 6.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins CI committed Jul 2, 2021
1 parent 6e02005 commit 414075d
Show file tree
Hide file tree
Showing 21 changed files with 61 additions and 5 deletions.
Binary file modified Framework/PushwooshInboxBundle.bundle/Info.plist
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.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ typedef NSString * (^PWIDateFormatterBlock)(NSDate *date, NSObject *owner);
//! The default text color
@property (nonatomic, readwrite) UIColor *defaultTextColor;

//! The text color of a read notification
@property (nonatomic, readwrite) UIColor *readTextColor;

//! The default background color
@property (nonatomic, readwrite) UIColor *backgroundColor;

Expand Down Expand Up @@ -53,6 +56,9 @@ typedef NSString * (^PWIDateFormatterBlock)(NSDate *date, NSObject *owner);
//! The color of message titles
@property (nonatomic, readwrite) UIColor *titleColor;

//! The title color for read notifications
@property (nonatomic, readwrite) UIColor *readTitleColor;

//! The color of messages descriptions
@property (nonatomic, readwrite) UIColor *descriptionColor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,9 @@
*/
+ (PWIInboxViewController *)createInboxControllerWithStyle:(PWIInboxStyle *)style;

/**
@return PWIInboxViewController with a specified style and height of table view
*/
+ (PWIInboxViewController *)createInboxControllerWithStyle:(PWIInboxStyle *)style andContentHeight:(CGFloat)contentHeight;

@end
Binary file not shown.
2 changes: 1 addition & 1 deletion PushwooshInboxUI.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Pod::Spec.new do |s|
s.summary = "Pushwoosh Inbox UI library by Pushwoosh."
s.platform = :ios
s.ios.deployment_target = '8.0'
s.version = "6.0.0"
s.version = "6.0.1"
s.description = "Pushwoosh Inbox UI library by Pushwoosh. " \
"http://www.pushwoosh.com "

Expand Down
4 changes: 2 additions & 2 deletions PushwooshInboxUI/PushwooshInboxUI/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>6.0.0</string>
<string>6.0.1</string>
<key>CFBundleVersion</key>
<string>6.0.0</string>
<string>6.0.1</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
6 changes: 6 additions & 0 deletions PushwooshInboxUI/PushwooshInboxUI/Public/PWIInboxStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ typedef NSString * (^PWIDateFormatterBlock)(NSDate *date, NSObject *owner);
//! The default text color
@property (nonatomic, readwrite) UIColor *defaultTextColor;

//! The text color of a read notification
@property (nonatomic, readwrite) UIColor *readTextColor;

//! The default background color
@property (nonatomic, readwrite) UIColor *backgroundColor;

Expand Down Expand Up @@ -53,6 +56,9 @@ typedef NSString * (^PWIDateFormatterBlock)(NSDate *date, NSObject *owner);
//! The color of message titles
@property (nonatomic, readwrite) UIColor *titleColor;

//! The title color for read notifications
@property (nonatomic, readwrite) UIColor *readTitleColor;

//! The color of messages descriptions
@property (nonatomic, readwrite) UIColor *descriptionColor;

Expand Down
5 changes: 5 additions & 0 deletions PushwooshInboxUI/PushwooshInboxUI/Public/PWIInboxUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,9 @@
*/
+ (PWIInboxViewController *)createInboxControllerWithStyle:(PWIInboxStyle *)style;

/**
@return PWIInboxViewController with a specified style and height of table view
*/
+ (PWIInboxViewController *)createInboxControllerWithStyle:(PWIInboxStyle *)style andContentHeight:(CGFloat)contentHeight;

@end
5 changes: 5 additions & 0 deletions PushwooshInboxUI/PushwooshInboxUI/Public/PWIInboxUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@ + (UIViewController *)createInboxControllerWithStyle:(PWIInboxStyle *)style {
return inboxViewController;
}

+ (UIViewController *)createInboxControllerWithStyle:(PWIInboxStyle *)style andContentHeight:(CGFloat)contentHeight {
PWIInboxViewController *inboxViewController = [[PWIInboxViewController alloc] initWithStyle:style andContentHeight:contentHeight];
return inboxViewController;
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ - (void)updateStyle:(PWIInboxStyle *)style {
- (void)updateMessage:(NSObject<PWInboxMessageProtocol> *)message {
_message = message;
_titleLabel.attributedText = [self titleAttributedStringForMessage:message];
_messageLabel.text = message.message;
_messageLabel.attributedText = [self textAttributedStringForMessage:message];
[_inboxImageView pwi_loadImageFromUrl:message.imageUrl callback:nil];
if (!message.imageUrl.length) {
_inboxImageView.image = _style.defaultImageIcon;
Expand Down Expand Up @@ -87,7 +87,11 @@ - (NSAttributedString *)titleAttributedStringForMessage:(NSObject<PWInboxMessage
}

if (message.title) {
[string appendAttributedString:[[NSAttributedString alloc] initWithString:message.title]];
if (message.isRead && _style.readTitleColor) {
[string appendAttributedString:[[NSAttributedString alloc] initWithString:message.title attributes:@{NSForegroundColorAttributeName : _style.readTitleColor}]];
} else {
[string appendAttributedString:[[NSAttributedString alloc] initWithString:message.title]];
}
}

if (message.sendDate) {
Expand All @@ -102,6 +106,16 @@ - (NSAttributedString *)titleAttributedStringForMessage:(NSObject<PWInboxMessage
return string;
}

- (NSAttributedString *)textAttributedStringForMessage:(NSObject<PWInboxMessageProtocol> *)message {
return (message.isRead && _style.readTextColor) ? [self textMessage:message.message textColor:_style.readTextColor] : [self textMessage:message.message textColor:_style.defaultTextColor];
}

- (NSMutableAttributedString *)textMessage:(NSString *)message textColor:(UIColor *)color {
NSMutableAttributedString *modifiedMessage = [[NSMutableAttributedString alloc] init];
[modifiedMessage appendAttributedString:[[NSAttributedString alloc] initWithString:message attributes:@{NSForegroundColorAttributeName : color}]];
return modifiedMessage;
}

- (IBAction)attachmentButtonTapped:(id)sender {
_inboxAttachmentTappedCallback(_inboxAttachmentImageView, _message.attachmentUrl);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
@interface PWIInboxViewController (Internal)

- (instancetype)initWithStyle:(PWIInboxStyle *)style;
- (instancetype)initWithStyle:(PWIInboxStyle *)style andContentHeight:(CGFloat)contentHeight;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ @interface PWIInboxViewController () <UITableViewDelegate, UITableViewDataSource
@property (weak, nonatomic) UIRefreshControl *refreshControl;
@property (weak, nonatomic) NSObject *observer;
@property (nonatomic) BOOL isLoading;
@property (nonatomic) CGFloat tableViewHeight;

@end

Expand All @@ -46,6 +47,16 @@ - (instancetype)initWithStyle:(PWIInboxStyle *)style {
return self;
}

- (instancetype)initWithStyle:(PWIInboxStyle *)style andContentHeight:(CGFloat)contentHeight {
NSString *stringName = self.nibName;
if (self = [super initWithNibName:stringName bundle:[NSBundle pwi_bundleForClass:self.class]]) {
_style = style;
_tableViewHeight = contentHeight;
self.title = NSLocalizedString(@"Inbox",);
}
return self;
}

- (NSString *)nibName {
return @"PWIInboxViewController";
}
Expand Down Expand Up @@ -138,6 +149,9 @@ - (void)viewDidLoad {

- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];

_tableView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height-self.tableViewHeight);

if (self.navigationController.navigationBar.translucent) {
CGRect navigationBarRect = self.navigationController.navigationBar.frame;
float insetsY = navigationBarRect.size.height + navigationBarRect.origin.y;
Expand Down

0 comments on commit 414075d

Please sign in to comment.