修正 bugs
This commit is contained in:
eggmanQQQ
2024-07-04 15:40:58 +08:00
parent 0544a6b8d0
commit 5026542a09
9 changed files with 113 additions and 64 deletions

View File

@@ -72,7 +72,7 @@
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -48,7 +48,7 @@ NSString * const kFreeGiftCountdownNotification = @"kFreeGiftCountdownNotificati
///
NSString * const KeyWithType(Pi_KeyType type) {
BOOL isRelase = NO;
BOOL isRelase = YES;
#ifdef DEBUG
NSString *isProduction = [[NSUserDefaults standardUserDefaults]valueForKey:@"kIsProductionEnvironment"];
if([isProduction isEqualToString:@"YES"]){

View File

@@ -21,6 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, weak) IBOutlet UILabel *title_3;
@property (nonatomic, weak) IBOutlet UILabel *title_4;
@property (nonatomic, weak) IBOutlet UICollectionViewFlowLayout *typeCollectionLayout;
@property (nonatomic, weak) IBOutlet UICollectionView *typeCollectionView;
@property (nonatomic, weak) IBOutlet UITextView *feedbackTextView;
@@ -33,8 +34,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, weak) IBOutlet UITextField *contactTextField;
@property (nonatomic, weak) IBOutlet UIButton *submitButton;
@end
NS_ASSUME_NONNULL_END

View File

@@ -26,16 +26,25 @@
_content = [UILabel labelInitWithText:@""
font:[UIFont systemFontOfSize:16 weight:UIFontWeightBold]
textColor:UIColorFromRGB(0x333333)];
_icon = [[UIImageView alloc] initWithImage:kImage(@"user_card_copy_id1")];
[self.contentView addSubview:_content];
[self.contentView addSubview:_icon];
[_content mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.mas_equalTo(0);
if (isMSRTL()) {
make.top.right.mas_equalTo(0);
} else {
make.top.left.mas_equalTo(0);
}
}];
[_icon mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(12);
make.centerY.mas_equalTo(self.content);
make.left.mas_equalTo(self.content.mas_right).offset(2);
if (isMSRTL()) {
make.right.mas_equalTo(self.content.mas_left).offset(-2);
} else {
make.left.mas_equalTo(self.content.mas_right).offset(2);
}
}];
}
return self;
@@ -174,18 +183,19 @@
self = [super initWithFrame:frame];
if (self) {
self.contentView.userInteractionEnabled = YES;
self.contentView.layer.cornerRadius = 15.5;
self.contentView.layer.masksToBounds = YES;
self.contentView.backgroundColor = UIColorFromRGB(0xf3f5fa);
_titleLabel = [UILabel labelInitWithText:@""
font:[UIFont systemFontOfSize:14 weight:UIFontWeightMedium] textColor:UIColorFromRGB(0x22252c)];
_titleLabel.layer.cornerRadius = 15.5;
_titleLabel.layer.masksToBounds = YES;
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.backgroundColor = UIColorFromRGB(0xf3f5fa);
_titleLabel.userInteractionEnabled = NO;
_titleLabel.minimumScaleFactor = 0.7;
_titleLabel.numberOfLines = 2;
// _titleLabel.minimumScaleFactor = 0.7;
_titleLabel.numberOfLines = 1;
[self.contentView addSubview:_titleLabel];
[_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.contentView);
make.edges.mas_equalTo(self.contentView).insets(UIEdgeInsetsMake(9, 10, 9, 10));
}];
}
return self;
@@ -193,9 +203,9 @@
- (void)setSelected:(BOOL)selected {
if (selected) {
self.titleLabel.backgroundColor = UIColorFromRGB(0x85f6d3);
self.contentView.backgroundColor = UIColorFromRGB(0x85f6d3);
} else {
self.titleLabel.backgroundColor = UIColorFromRGB(0xf3f5fa);
self.contentView.backgroundColor = UIColorFromRGB(0xf3f5fa);
}
}
@@ -203,11 +213,13 @@
@interface FeedBackViewController ()<UITextViewDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
@property (nonatomic, strong) UIButton *submitButton;
@property (nonatomic, strong) UIView *fakeTopBar;
@property (nonatomic, copy) NSString *uploadPhotoURLString;
@property (nonatomic, strong) UIImage *selectedImage;
@property (nonatomic, strong) FeedBackConfigModel *configModel;
@property (nonatomic, strong) FeedBackTypeModel *selectTypeModel;
@property (nonatomic, strong) NSLayoutConstraint *collectionViewHeightConstraint;
@end
@@ -231,6 +243,15 @@
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
// [self.submitButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xa5eec8),UIColorFromRGB(0xabf5e3)]
// gradientType:GradientTypeTopToBottom
// imgSize:CGSizeMake(300, 50)]
// forState:UIControlStateNormal];
// [self.submitButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x57e193),UIColorFromRGB(0x1402a6)]
// gradientType:GradientTypeTopToBottom
// imgSize:CGSizeMake(300, 50)]
// forState:UIControlStateSelected];
}
- (LoginPresenter *)createPresenter {
@@ -248,6 +269,8 @@
[self setupFakeTopBar];
[self.closeKeyboardButton setTitle:@"" forState:UIControlStateNormal];
// self.typeCollectionLayout.estimatedItemSize = UICollectionViewFlowLayoutAutomaticSize;
self.typeCollectionView.delegate = self;
self.typeCollectionView.dataSource = self;
@@ -262,7 +285,7 @@
self.title_3.textColor = [UIColor blackColor];
self.title_4.textColor = [UIColor blackColor];
self.title_2.text = YMLocalizedString(@"FeedBackViewController2");
self.title_3.text = YMLocalizedString(@"FeedBackViewController2");
NSAttributedString *redMark = [[NSAttributedString alloc] initWithString:@"* "
attributes:@{NSForegroundColorAttributeName: UIColorFromRGB(0xeb5c2c),
@@ -286,6 +309,7 @@
self.feedbackCharCountLabel.textAlignment = NSTextAlignmentRight;
self.feedbackCharLimitLabel.textAlignment = NSTextAlignmentRight;
self.feedbackCharLimitLabel.text = @"300/";
self.typeCollectionView.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
} else {
self.feedbackCharCountLabel.textAlignment = NSTextAlignmentLeft;
self.feedbackCharLimitLabel.textAlignment = NSTextAlignmentLeft ;
@@ -298,15 +322,21 @@
self.contactTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:YMLocalizedString(@"FeedBackViewController5")
attributes:@{NSForegroundColorAttributeName: placeholderColor}];
self.submitButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.submitButton addTarget:self action:@selector(didTapSubmitButton:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:self.submitButton];
[self.submitButton setTitle:YMLocalizedString(@"LoginForgetPasswordViewController6") forState:UIControlStateNormal];
[self.submitButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xa5eec8),UIColorFromRGB(0xabf5e3)]
gradientType:GradientTypeTopToBottom
imgSize:CGSizeMake(300, 50)]
forState:UIControlStateNormal];
[self.submitButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorRGBAlpha(0x57e193, 0.5),UIColorRGBAlpha(0x1402a6, 0.5)]
gradientType:GradientTypeTopToBottom
imgSize:CGSizeMake(300, 50)]
forState:UIControlStateSelected];
[self.submitButton setTitle:YMLocalizedString(@"LoginForgetPasswordViewController6") forState:UIControlStateDisabled];
[self.submitButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
UIImage *nextImage = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x57e193), UIColorFromRGB(0x14D2a6)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(KScreenWidth-36*2, 48)];
UIImage *disableImage = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xa5eec8), UIColorFromRGB(0xabf5e3)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(KScreenWidth-36*2, 48)];
[self.submitButton setBackgroundImage:nextImage forState:UIControlStateNormal];
[self.submitButton setBackgroundImage:disableImage forState:UIControlStateDisabled];
self.submitButton.layer.cornerRadius = 48/2;
self.submitButton.layer.masksToBounds = YES;
self.submitButton.enabled = NO;
}
- (void)setupFakeTopBar {
@@ -377,7 +407,7 @@
make.bottom.mas_equalTo(self.view).offset(-40);
make.left.mas_equalTo(36);
make.right.mas_equalTo(-36);
make.height.mas_equalTo(49);
make.height.mas_equalTo(48);
}];
[self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -403,9 +433,11 @@
make.top.mas_equalTo(self.title_1.mas_bottom).offset(18);
make.left.mas_equalTo(self.scrollContentView).offset(16);
make.right.mas_equalTo(self.scrollContentView).offset(-16);
make.height.mas_equalTo(31);
make.height.mas_greaterThanOrEqualTo(31);
make.width.mas_equalTo(KScreenWidth - 32);
}];
// self.collectionViewHeightConstraint = [self.typeCollectionView.heightAnchor constraintEqualToConstant:1];
// self.collectionViewHeightConstraint.active = YES;
[self.closeKeyboardButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.typeCollectionView.mas_bottom);
@@ -499,13 +531,13 @@
- (void)updateSubmitButtonStatus {
if (self.selectTypeModel == nil) {
[self.submitButton setSelected:NO];
self.submitButton.enabled = NO;
} else if(self.feedbackTextView.text.length == 0) {
[self.submitButton setSelected:NO];
self.submitButton.enabled = NO;
} else if(self.contactTextField.text.length == 0) {
[self.submitButton setSelected:NO];
self.submitButton.enabled = NO;
} else {
[self.submitButton setSelected:YES];
self.submitButton.enabled = YES;
}
}
@@ -605,11 +637,11 @@
} failure:^(NSString * _Nonnull errorMessage) {
@kStrongify(self);
[self hideHUD];
[TTPopup alertWithMessage:errorMessage confirmHandler:^{
} cancelHandler:^{
}];
if (errorMessage.length > 0) {
[TTPopup alertWithMessage:errorMessage confirmHandler:^{
} cancelHandler:^{
}];
}
}];
}
@@ -653,7 +685,10 @@
photoURLString:self.uploadPhotoURLString
contact:self.contactTextField.text];
});
}
- (IBAction)contactDidChange:(UITextField *)sender {
[self updateSubmitButtonStatus];
}
#pragma mark - UICollectionView Delegate & DataSource
@@ -661,8 +696,13 @@
[self.typeCollectionView layoutIfNeeded];
CGSize contentSize = self.typeCollectionView.collectionViewLayout.collectionViewContentSize;
[self.typeCollectionView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(contentSize.height);
make.height.mas_greaterThanOrEqualTo(contentSize.height);
}];
// [self.typeCollectionView layoutIfNeeded];
//
// self.collectionViewHeightConstraint.constant = self.typeCollectionView.contentSize.height;
}
// section item
@@ -673,11 +713,19 @@
- (CGSize)collectionView:(UICollectionView *)collectionView
layout:(UICollectionViewLayout*)collectionViewLayout
sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
CGFloat padding = 24.0;
CGFloat totalPadding = padding * 2 + padding * 2; // +
CGFloat availableWidth = collectionView.frame.size.width - totalPadding;
CGFloat itemWidth = availableWidth / 3;
return CGSizeMake(itemWidth, 31);
// return UICollectionViewFlowLayoutAutomaticSize;
// CGFloat padding = 24.0;
// CGFloat totalPadding = padding * 2 + padding * 2; // +
// CGFloat availableWidth = collectionView.frame.size.width - totalPadding;
// CGFloat itemWidth = availableWidth / 3;
FeedBackTypeModel *model = [self.configModel.typeEnumList xpSafeObjectAtIndex:indexPath.row];
UILabel *label = [UILabel labelInitWithText:model.desc
font:[UIFont systemFontOfSize:14 weight:UIFontWeightMedium] textColor:UIColorFromRGB(0x22252c)];;
CGSize maxSize = CGSizeMake(CGFLOAT_MAX, 31);
CGSize requiredSize = [label sizeThatFits:maxSize];
return CGSizeMake(MAX(90, requiredSize.width + 20), 31);
}
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
@@ -685,7 +733,7 @@
}
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
return 24.0;
return 14.0;
}
// cell
@@ -764,7 +812,7 @@
[self updateSubmitButtonStatus];
if (newText.length > 300) {
if (newText.length >= 300) {
return NO;
}

View File

@@ -18,11 +18,11 @@
<outlet property="feedbackTextView" destination="YGp-Kx-326" id="Xf1-Ua-ntM"/>
<outlet property="scrollContentView" destination="TUB-kp-u7C" id="egi-HU-3QE"/>
<outlet property="scrollView" destination="X79-6C-RwG" id="v1E-AO-hDK"/>
<outlet property="submitButton" destination="Hcn-lY-KSw" id="oDJ-Nx-q2c"/>
<outlet property="title_1" destination="lZI-L0-Qej" id="VVs-Js-70L"/>
<outlet property="title_2" destination="2Xf-Na-4Rp" id="4rH-8E-n8G"/>
<outlet property="title_3" destination="uUv-rc-eS9" id="ec1-Wq-YPq"/>
<outlet property="title_4" destination="coA-sV-qbQ" id="Jrj-zU-XsM"/>
<outlet property="typeCollectionLayout" destination="oac-gt-EMe" id="3LS-K7-uCt"/>
<outlet property="typeCollectionView" destination="dW4-hu-tVt" id="z0i-uB-f1O"/>
<outlet property="uploadImageButton" destination="E5N-xB-GCN" id="du5-p5-kiN"/>
<outlet property="uploadImageView" destination="c7Q-Mf-HYy" id="Wsm-eG-pCC"/>
@@ -58,6 +58,9 @@
<color key="textColor" red="0.13333333333333333" green="0.14509803921568626" blue="0.17254901960784313" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<connections>
<action selector="contactDidChange:" destination="-1" eventType="valueChanged" id="xLq-5F-K3Y"/>
</connections>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="问题描述" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="2Xf-Na-4Rp">
<rect key="frame" x="14" y="411" width="361" height="21"/>
@@ -168,22 +171,6 @@
<viewLayoutGuide key="contentLayoutGuide" id="4zX-dN-GkU"/>
<viewLayoutGuide key="frameLayoutGuide" id="8LH-Ya-NsS"/>
</scrollView>
<button opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="Hcn-lY-KSw">
<rect key="frame" x="43" y="397" width="303" height="49"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="25"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="didTapSubmitButton:" destination="-1" eventType="touchUpInside" id="tuh-v2-tJm"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<gestureRecognizers/>

View File

@@ -258,6 +258,8 @@ NS_ASSUME_NONNULL_BEGIN
/// 包含emoji
+ (BOOL)stringContainsEmoji:(NSString *)string;
/// 是否 email
+ (BOOL)isEmail:(NSString *)string;
///去除字符串两端的空格和换行符
- (NSString *)RW_stringByTrimmingCharacters;

View File

@@ -397,6 +397,13 @@
}
/// email
+ (BOOL)isEmail:(NSString *)string{
NSString *pattern = @"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,}$";
NSPredicate *regexTest = [NSPredicate predicateWithFormat:@"SELF MATCHES[c] %@", pattern];
return [regexTest evaluateWithObject:string];
}
+ (BOOL)isChineseCharacter:(NSString*)source {
NSString *regex = @"^[\\u4E00-\\u9FEA]+$";

View File

@@ -23,7 +23,7 @@
//
#define MAX_STARWORDS_LENGTH 300
@interface XPRoomSendTextView ()
@interface XPRoomSendTextView () <NIMChatManagerDelegate>
///
@property (nonatomic, strong) MSBaseTextField *editTextFiled;
@@ -53,6 +53,7 @@
self = [super initWithFrame:CGRectMake(0, KScreenHeight - 60, KScreenWidth, 60)];
if (self) {
self.delegate = delegate;
[[NIMSDK sharedSDK].chatManager addDelegate:self];
[self addNotification];
[self initSubViews];
[self initSubViewConstraints];
@@ -61,6 +62,10 @@
return self;
}
- (void)sendMessage:(NIMMessage *)message didCompleteWithError:(NSError *)error {
}
#pragma mark - Response
- (void)sendButtonDidClick:(UIButton *)sender {
@@ -117,6 +122,7 @@
NIMAntiSpamOption *option = [[NIMAntiSpamOption alloc]init];
option.yidunEnabled = YES;
option.businessId = KeyWithType(keyType_YiDunBussinessId);
option.content = [NSString stringWithFormat:@"{\"type\": 1, \"data\": \"\"}"];
message.antiSpamOption = option;
NSString *publicChatRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[userInfo.partitionId]];
NSString * sessionId = [self.delegate getPublicScreenType] == 0 ? [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].roomId]:publicChatRoomId;

View File

@@ -3653,9 +3653,9 @@
"XPRoomTypeSelectionViewController4" = "Room type";
"XPRoomTypeSelectionViewController5" = "Using";
"FeedBackViewController0" = "choose the problem type";
"FeedBackViewController1" = "describe the problem";
"FeedBackViewController2" = "upload screenshot";
"FeedBackViewController3" = "contact information";
"FeedBackViewController0" = "Choose the problem type";
"FeedBackViewController1" = "Describe the problem";
"FeedBackViewController2" = "Upload screenshot";
"FeedBackViewController3" = "Contact information";
"FeedBackViewController4" = "Please enter...";
"FeedBackViewController5" = "Mobile phone number or email";