diff --git a/Shared/Localization/en.lproj/Localizable.strings b/Shared/Localization/en.lproj/Localizable.strings index 84b943e..28a7e71 100644 --- a/Shared/Localization/en.lproj/Localizable.strings +++ b/Shared/Localization/en.lproj/Localizable.strings @@ -185,7 +185,7 @@ "Tap any conversation to paste, then try any reply style~" = "Tap any conversation to paste, then try any reply style~"; "What are you doing?" = "What are you doing?"; "I'm going to take a shower." = "I'm going to take a shower."; -"🎉 If you run into any other issues, tap Online Support to get help~" = "🎉 If you run into any other issues, tap Online Support to get help~"; +"Welcome to use the [key of love] keyboard" = "Welcome to use the [key of love] keyboard"; "👋 Welcome to Key of Love Keyboard" = "👋 Welcome to Key of Love Keyboard"; // Payment & IAP diff --git a/keyBoard/Class/Guard/V/KBGuideKFCell.m b/keyBoard/Class/Guard/V/KBGuideKFCell.m index a6b5938..1925e35 100644 --- a/keyBoard/Class/Guard/V/KBGuideKFCell.m +++ b/keyBoard/Class/Guard/V/KBGuideKFCell.m @@ -6,7 +6,7 @@ #import "KBGuideKFCell.h" @interface KBGuideKFCell () -@property (nonatomic, strong) UIView *avatarView; // 左侧头像 +@property (nonatomic, strong) UIImageView *avatarImageView; // 左侧头像 @property (nonatomic, strong) UIView *bubbleView; // 气泡 @property (nonatomic, strong) UILabel *contentLabel; // 文案 @end @@ -16,8 +16,8 @@ - (void)setupUI { self.contentView.backgroundColor = [UIColor colorWithWhite:0.96 alpha:1.0]; - [self.contentView addSubview:self.avatarView]; - [self.avatarView mas_makeConstraints:^(MASConstraintMaker *make) { + [self.contentView addSubview:self.avatarImageView]; + [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.contentView).offset(16); make.top.equalTo(self.contentView).offset(10); make.width.height.mas_equalTo(36); @@ -25,7 +25,7 @@ [self.contentView addSubview:self.bubbleView]; [self.bubbleView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(self.avatarView.mas_right).offset(8); + make.left.equalTo(self.avatarImageView.mas_right).offset(8); make.top.equalTo(self.contentView).offset(8); make.right.lessThanOrEqualTo(self.contentView).offset(-80); make.bottom.equalTo(self.contentView).offset(-8); @@ -43,14 +43,14 @@ #pragma mark - Lazy -- (UIView *)avatarView { - if (!_avatarView) { - _avatarView = [UIView new]; - _avatarView.backgroundColor = [UIColor colorWithRed:0.23 green:0.47 blue:0.96 alpha:1.0]; - _avatarView.layer.cornerRadius = 18; - _avatarView.layer.masksToBounds = YES; +- (UIImageView *)avatarImageView { + if (!_avatarImageView) { + _avatarImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"App_icon"]]; + _avatarImageView.contentMode = UIViewContentModeScaleAspectFill; + _avatarImageView.layer.cornerRadius = 18; + _avatarImageView.layer.masksToBounds = YES; } - return _avatarView; + return _avatarImageView; } - (UIView *)bubbleView { @@ -74,4 +74,3 @@ } @end - diff --git a/keyBoard/Class/Guard/V/KBGuideTopCell.m b/keyBoard/Class/Guard/V/KBGuideTopCell.m index fb7f7a1..4b0e28d 100644 --- a/keyBoard/Class/Guard/V/KBGuideTopCell.m +++ b/keyBoard/Class/Guard/V/KBGuideTopCell.m @@ -7,8 +7,8 @@ @interface KBGuideTopCell () -// 左侧头像(占位色块代替图片) -@property (nonatomic, strong) UIView *avatarView; +// 左侧头像(使用 App_icon 素材) +@property (nonatomic, strong) UIImageView *avatarImageView; // 白色卡片容器 @property (nonatomic, strong) UIView *cardView; // 卡片标题/正文 @@ -27,8 +27,8 @@ self.contentView.backgroundColor = [UIColor clearColor]; // 头像 - [self.contentView addSubview:self.avatarView]; - [self.avatarView mas_makeConstraints:^(MASConstraintMaker *make) { + [self.contentView addSubview:self.avatarImageView]; + [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.contentView).offset(16); make.top.equalTo(self.contentView).offset(12); make.width.height.mas_equalTo(36); @@ -37,7 +37,7 @@ // 卡片 [self.contentView addSubview:self.cardView]; [self.cardView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(self.avatarView.mas_right).offset(8); + make.left.equalTo(self.avatarImageView.mas_right).offset(8); make.right.lessThanOrEqualTo(self.contentView).offset(-32); make.top.equalTo(self.contentView).offset(8); make.bottom.equalTo(self.contentView).offset(-8); @@ -77,14 +77,14 @@ #pragma mark - Lazy -- (UIView *)avatarView { - if (!_avatarView) { - _avatarView = [UIView new]; - _avatarView.backgroundColor = [UIColor colorWithRed:0.23 green:0.47 blue:0.96 alpha:1.0]; - _avatarView.layer.cornerRadius = 18; - _avatarView.layer.masksToBounds = YES; +- (UIImageView *)avatarImageView { + if (!_avatarImageView) { + _avatarImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"App_icon"]]; + _avatarImageView.contentMode = UIViewContentModeScaleAspectFill; + _avatarImageView.layer.cornerRadius = 18; + _avatarImageView.layer.masksToBounds = YES; } - return _avatarView; + return _avatarImageView; } - (UIView *)cardView { diff --git a/keyBoard/Class/Guard/V/KBGuideUserCell.m b/keyBoard/Class/Guard/V/KBGuideUserCell.m index b856b50..e6277cb 100644 --- a/keyBoard/Class/Guard/V/KBGuideUserCell.m +++ b/keyBoard/Class/Guard/V/KBGuideUserCell.m @@ -4,8 +4,11 @@ // #import "KBGuideUserCell.h" +#import "KBUserSessionManager.h" +#import "KBUser.h" @interface KBGuideUserCell () +@property (nonatomic, strong) UIImageView *avatarImageView; // 右侧用户头像 @property (nonatomic, strong) UIView *bubbleView; // 右侧紫色气泡 @property (nonatomic, strong) UILabel *contentLabel; @end @@ -15,9 +18,16 @@ - (void)setupUI { self.contentView.backgroundColor = [UIColor colorWithWhite:0.96 alpha:1.0]; + [self.contentView addSubview:self.avatarImageView]; + [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.equalTo(self.contentView).offset(-16); + make.top.equalTo(self.contentView).offset(10); + make.width.height.mas_equalTo(36); + }]; + [self.contentView addSubview:self.bubbleView]; [self.bubbleView mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.equalTo(self.contentView).offset(-16); + make.right.equalTo(self.avatarImageView.mas_left).offset(-8); make.top.equalTo(self.contentView).offset(8); make.left.greaterThanOrEqualTo(self.contentView).offset(80); make.bottom.equalTo(self.contentView).offset(-8); @@ -31,14 +41,50 @@ - (void)configText:(NSString *)text { self.contentLabel.text = text; + self.avatarImageView.image = [self kb_resolvedAvatarImage]; +} + +#pragma mark - Helpers + +- (UIImage *)kb_resolvedAvatarImage { + UIImage *placeholder = [UIImage imageNamed:@"placeholder_icon"]; + + KBUserSessionManager *session = [KBUserSessionManager shared]; + if (![session isLoggedIn]) { + return placeholder; + } + + KBUser *user = session.currentUser; + if (!user) { + return placeholder; + } + + switch (user.gender) { + case UserSexMan: + return [UIImage imageNamed:@"message_man_icon"] ?: placeholder; + case UserSexWeman: + return [UIImage imageNamed:@"message_nv_icon"] ?: placeholder; + default: + return placeholder; + } } #pragma mark - Lazy +- (UIImageView *)avatarImageView { + if (!_avatarImageView) { + _avatarImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"placeholder_icon"]]; + _avatarImageView.contentMode = UIViewContentModeScaleAspectFill; + _avatarImageView.layer.cornerRadius = 18; + _avatarImageView.layer.masksToBounds = YES; + } + return _avatarImageView; +} + - (UIView *)bubbleView { if (!_bubbleView) { _bubbleView = [UIView new]; - _bubbleView.backgroundColor = [UIColor colorWithRed:0.42 green:0.45 blue:0.98 alpha:1.0]; + _bubbleView.backgroundColor = [UIColor colorWithHex:KBColorValue]; _bubbleView.layer.cornerRadius = 12; _bubbleView.layer.masksToBounds = YES; } @@ -57,4 +103,3 @@ } @end - diff --git a/keyBoard/Class/Guard/VC/KBGuideVC.m b/keyBoard/Class/Guard/VC/KBGuideVC.m index 2210484..2bbbb46 100644 --- a/keyBoard/Class/Guard/VC/KBGuideVC.m +++ b/keyBoard/Class/Guard/VC/KBGuideVC.m @@ -191,7 +191,7 @@ typedef NS_ENUM(NSInteger, KBGuideItemType) { // 1. 插入我方消息 [self.items addObject:@{ @"type": @(KBGuideItemTypeUser), @"text": text ?: @"" }]; // 2. 紧跟一条固定客服消息 - NSString *reply = KBLocalized(@"🎉 If you run into any other issues, tap Online Support to get help~"); + NSString *reply = KBLocalized(@"Welcome to use the [key of love] keyboard"); [self.items addObject:@{ @"type": @(KBGuideItemTypeKF), @"text": reply }]; // 刷新并滚动到底部