优化项目

This commit is contained in:
liyuhua
2023-09-28 16:48:57 +08:00
parent 1f7d6e472b
commit 15c4fc3871
10 changed files with 101 additions and 115 deletions

View File

@@ -72,7 +72,7 @@
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.avatarImageView.mas_right).offset((10));
make.right.mas_lessThanOrEqualTo(self.findButton.mas_left).mas_offset(-(10));
make.right.mas_lessThanOrEqualTo(self.findButton.mas_left).mas_offset(-0);
make.height.mas_equalTo(((20)));
make.top.equalTo(self.avatarImageView.mas_top).mas_offset((3));
}];
@@ -111,6 +111,9 @@
_fansInfo = fansInfo;
if (_fansInfo) {
self.avatarImageView.imageUrl = _fansInfo.avatar;
if(_fansInfo.nick.length > 5){
_fansInfo.nick = [NSString stringWithFormat:@"%@...",[_fansInfo.nick substringToIndex:5]];
}
self.nickLabel.text = _fansInfo.nick;
self.signLabel.text = _fansInfo.userDesc && _fansInfo.userDesc.length > 0? _fansInfo.userDesc : YMLocalizedString(@"XPMineAttentionTableViewCell0");
if (_fansInfo.useingType != ContactUseingType_In_Room && _fansInfo.useingType != ContactUseingType_Share) {

View File

@@ -73,7 +73,7 @@
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.avatarImageView.mas_right).offset((10));
make.right.mas_lessThanOrEqualTo(self.attentionButton.mas_left).mas_offset(-(10));
make.right.mas_lessThanOrEqualTo(self.attentionButton.mas_left).mas_offset(-0);
make.height.mas_equalTo(20);
make.top.equalTo(self.avatarImageView.mas_top).mas_offset((3));
}];
@@ -112,7 +112,9 @@
_fansInfo = fansInfo;
if (_fansInfo) {
self.avatarImageView.imageUrl = _fansInfo.avatar;
if(_fansInfo.nick.length > 5){
_fansInfo.nick = [NSString stringWithFormat:@"%@...",[_fansInfo.nick substringToIndex:5]];
}
self.nickLabel.text = _fansInfo.nick;
self.signLabel.text = _fansInfo.userDesc && _fansInfo.userDesc.length > 0? _fansInfo.userDesc : YMLocalizedString(@"XPMineFansTableViewCell0");
if (_fansInfo.useingType != ContactUseingType_In_Room && _fansInfo.useingType != ContactUseingType_Share) {

View File

@@ -104,19 +104,19 @@
make.width.mas_equalTo(28);
}];
[self.experImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(28);
make.height.mas_equalTo(14);
}];
CGFloat width = 28 * 20 / 14;
[self.experImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(20);
make.width.mas_equalTo(width);
}];
[self.charmImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(28);
make.height.mas_equalTo(14);
make.height.mas_equalTo(20);
make.width.mas_equalTo(width);
}];
[self.nickStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.avatarImageView.mas_right).offset(6);
make.height.mas_equalTo(14);
make.height.mas_equalTo(20);
make.bottom.mas_equalTo(self.avatarImageView.mas_centerY).offset(-3);
}];
@@ -163,21 +163,13 @@
if (_memberInfo.experUrl) {
if (self.experImageView.state == NetImageStateLoaded) {
self.experImageView.imageUrl = _memberInfo.experUrl;
CGFloat kImageScale = self.experImageView.image.size.width / self.experImageView.image.size.height;
CGFloat imageWidth = 20 * kImageScale;
[self.experImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(imageWidth);
}];
} else {
@kWeakify(self);
[self.experImageView loadImageWithUrl:_memberInfo.experUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
@kStrongify(self);
self.experImageView.image = image;
CGFloat kImageScale = image.size.width / image.size.height;
CGFloat imageWidth = 20 * kImageScale;
[self.experImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(imageWidth);
}];
}];
}
}
@@ -186,21 +178,13 @@
if (_memberInfo.charmUrl) {
if (self.charmImageView.state == NetImageStateLoaded) {
self.charmImageView.imageUrl = _memberInfo.charmUrl;
CGFloat kImageScale = self.charmImageView.image.size.width / self.charmImageView.image.size.height;
CGFloat imageWidth = 20 * kImageScale;
[self.charmImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(imageWidth);
}];
} else {
@kWeakify(self);
[self.charmImageView loadImageWithUrl:_memberInfo.charmUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) {
@kStrongify(self);
self.charmImageView.image = image;
CGFloat kImageScale = image.size.width / image.size.height;
CGFloat imageWidth = 20 * kImageScale;
[self.charmImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(imageWidth);
}];
}];
}
}
@@ -391,7 +375,7 @@
_nickStackView = [[UIStackView alloc] init];
_nickStackView.axis = UILayoutConstraintAxisHorizontal;
_nickStackView.distribution = UIStackViewDistributionFill;
_nickStackView.alignment = UIStackViewAlignmentFill;
_nickStackView.alignment = UIStackViewAlignmentCenter;
_nickStackView.spacing = 2;
}
return _nickStackView;
@@ -429,7 +413,7 @@
_experImageView = [[NetImageView alloc] initWithConfig:config];
_experImageView.userInteractionEnabled = YES;
_experImageView.hidden = YES;
_experImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _experImageView;
}
@@ -442,7 +426,7 @@
_charmImageView = [[NetImageView alloc] initWithConfig:config];
_charmImageView.userInteractionEnabled = YES;
_charmImageView.hidden = YES;
_charmImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _charmImageView;
}

View File

@@ -326,17 +326,17 @@
self.orderId = orderId;
if (@available(iOS 15.0, *)) {
PIIAPManagers *iap = [PIIAPManagers shared];
[iap requestBuyProductWithProductId:chargeProdId uuid:uuid completionHandler:^(NSError * _Nullable error) {
PIIAPRegulate *iap = [PIIAPRegulate shared];
[iap demandShopedThingWithProductId:chargeProdId uuid:uuid completionHandler:^(NSError * _Nullable error) {
}];
@kWeakify(self);
iap.stateBlock = ^(enum StoreStateResult state, NSDictionary<NSString *,id> * _Nullable result) {
iap.ConditionBlock = ^(enum StoreConditionResult state, NSDictionary<NSString *,id> * _Nullable result) {
@kStrongify(self);
[self rechargeNewProcessStatus:state];
switch (state) {
case StoreStateResultVerifiedServer:
case StoreConditionResultVerifiedServer:
{
NSString *transactionId = result[@"transactionId"];
@@ -405,8 +405,8 @@
- (void)checkReceiptSuccess:(NSString *)transcationId {
[XNDJTDDLoadingTool hideOnlyView:kWindow];
if (@available(iOS 15.0, *)) {
PIIAPManagers *iap = [PIIAPManagers shared];
[iap transactionFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
PIIAPRegulate *iap = [PIIAPRegulate shared];
[iap verifyBusinessFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
}];
}
@@ -424,8 +424,8 @@
[XNDJTDDLoadingTool hideOnlyView:kWindow];
if(code == 1444){
if (@available(iOS 15.0, *)) {
PIIAPManagers *iap = [PIIAPManagers shared];
[iap transactionFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
PIIAPRegulate *iap = [PIIAPRegulate shared];
[iap verifyBusinessFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
}];
}
@@ -452,12 +452,12 @@
}
#pragma mark - XPIAPHelperDelegate
///
- (void)rechargeNewProcessStatus:(StoreStateResult)status {
- (void)rechargeNewProcessStatus:(StoreConditionResult)status {
if (status == StoreStateResultPay || status == StoreStateResultStart || status == StoreStateResultVerifiedServer) {
if (status == StoreConditionResultPay || status == StoreConditionResultStart || status == StoreConditionResultVerifiedServer) {
}else if (status == StoreStateResultUnowned) {
}else if (status == StoreConditionResultUnowned) {
[XNDJTDDLoadingTool hideOnlyView:kWindow];
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController1")];
}else{

View File

@@ -263,7 +263,7 @@
// }
// if(list.count > 0){
// if (@available(iOS 15.0, *)) {
// PIIAPManagers *iap = [PIIAPManagers shared];
// PIIAPRegulate *iap = [PIIAPRegulate shared];
// [iap allTransactionWithList:list completionHandler:^{
//
// }];
@@ -312,12 +312,12 @@
#pragma mark - XPIAPHelperDelegate
///
- (void)rechargeNewProcessStatus:(StoreStateResult)status {
- (void)rechargeNewProcessStatus:(StoreConditionResult)status {
if (status == StoreStateResultPay || status == StoreStateResultStart || status == StoreStateResultVerifiedServer) {
if (status == StoreConditionResultPay || status == StoreConditionResultStart || status == StoreConditionResultVerifiedServer) {
}else if (status == StoreStateResultUnowned) {
}else if (status == StoreConditionResultUnowned) {
[XNDJTDDLoadingTool hideHUDInView:kWindow];
[self showErrorToast:YMLocalizedString(@"XPIAPRechargeViewController1")];
}else{
@@ -347,17 +347,17 @@
self.orderId = orderId;
if (@available(iOS 15.0, *)) {
PIIAPManagers *iap = [PIIAPManagers shared];
[iap requestBuyProductWithProductId:chargeProdId uuid:uuid completionHandler:^(NSError * _Nullable error) {
PIIAPRegulate *iap = [PIIAPRegulate shared];
[iap demandShopedThingWithProductId:chargeProdId uuid:uuid completionHandler:^(NSError * _Nullable error) {
}];
@kWeakify(self);
iap.stateBlock = ^(enum StoreStateResult state, NSDictionary<NSString *,id> * _Nullable result) {
iap.ConditionBlock = ^(enum StoreConditionResult state, NSDictionary<NSString *,id> * _Nullable result) {
@kStrongify(self);
[self rechargeNewProcessStatus:state];
switch (state) {
case StoreStateResultVerifiedServer:
case StoreConditionResultVerifiedServer:
{
NSString *transactionId = result[@"transactionId"];
@@ -422,8 +422,8 @@
- (void)checkReceiptSuccess:(NSString *)transcationId {
[XNDJTDDLoadingTool hideHUDInView:kWindow];
if (@available(iOS 15.0, *)) {
PIIAPManagers *iap = [PIIAPManagers shared];
[iap transactionFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
PIIAPRegulate *iap = [PIIAPRegulate shared];
[iap verifyBusinessFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
}];
}
@@ -440,8 +440,8 @@
[XNDJTDDLoadingTool hideHUDInView:kWindow];
if(code == 1444){
if (@available(iOS 15.0, *)) {
PIIAPManagers *iap = [PIIAPManagers shared];
[iap transactionFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
PIIAPRegulate *iap = [PIIAPRegulate shared];
[iap verifyBusinessFinishWithTransaction:[NSString stringWithFormat:@"%@",transcationId] completionHandler:^{
}];
}