From cee26a4c25875203d24b81a02e108479b56c135e Mon Sep 17 00:00:00 2001 From: liyuhua <15626451870@163.com> Date: Tue, 14 Nov 2023 17:00:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E9=80=A0=E7=A4=BC=E7=89=A9=E9=9D=A2?= =?UTF-8?q?=E6=9D=BFbug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YuMi.xcodeproj/project.pbxproj | 4 + .../View/PIGiftInfoSegmentedView.m | 102 ++++++++++++++---- .../View/SendGiftView/View/XPGiftInfoView.h | 6 +- YuMi/Tools/YYUtility/YYUtility+App.m | 30 +++++- YuMi/Tools/YYUtility/YYUtility.h | 11 +- 5 files changed, 125 insertions(+), 28 deletions(-) diff --git a/YuMi.xcodeproj/project.pbxproj b/YuMi.xcodeproj/project.pbxproj index 6fa7fd7f..291dc1ec 100644 --- a/YuMi.xcodeproj/project.pbxproj +++ b/YuMi.xcodeproj/project.pbxproj @@ -343,6 +343,7 @@ 23D321E82ADFED10006B259C /* PIRoomSendRedPacketItemVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 23D321E72ADFED0F006B259C /* PIRoomSendRedPacketItemVC.m */; }; 23D8DEF22AC5633300644637 /* PIIAPRegulate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23D8DEF12AC5633300644637 /* PIIAPRegulate.swift */; }; 23E45C052AC2B0A200D88BCA /* SessionDiscoverNewTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 23E45C042AC2B0A200D88BCA /* SessionDiscoverNewTableViewCell.m */; }; + 23E56B3C2B03564B00C8DAC9 /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23E56B3B2B03564B00C8DAC9 /* CoreTelephony.framework */; }; 23E9E9972A80C3A100B792F2 /* XPMineGuildPersonalBillRecordVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 23E9E9942A80C39F00B792F2 /* XPMineGuildPersonalBillRecordVC.m */; }; 23E9E9982A80C3A100B792F2 /* XPMineGuildPersonalBillStatisVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 23E9E9962A80C3A100B792F2 /* XPMineGuildPersonalBillStatisVC.m */; }; 23E9E99B2A80C40000B792F2 /* XPMineGuildPersonalBillRecordHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23E9E9992A80C3FF00B792F2 /* XPMineGuildPersonalBillRecordHeadView.m */; }; @@ -2139,6 +2140,7 @@ 23D8DEF12AC5633300644637 /* PIIAPRegulate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PIIAPRegulate.swift; sourceTree = ""; }; 23E45C032AC2B0A200D88BCA /* SessionDiscoverNewTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SessionDiscoverNewTableViewCell.h; sourceTree = ""; }; 23E45C042AC2B0A200D88BCA /* SessionDiscoverNewTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SessionDiscoverNewTableViewCell.m; sourceTree = ""; }; + 23E56B3B2B03564B00C8DAC9 /* CoreTelephony.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreTelephony.framework; path = System/Library/Frameworks/CoreTelephony.framework; sourceTree = SDKROOT; }; 23E9E9932A80C39E00B792F2 /* XPMineGuildPersonalBillStatisVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPMineGuildPersonalBillStatisVC.h; sourceTree = ""; }; 23E9E9942A80C39F00B792F2 /* XPMineGuildPersonalBillRecordVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPMineGuildPersonalBillRecordVC.m; sourceTree = ""; }; 23E9E9952A80C3A000B792F2 /* XPMineGuildPersonalBillRecordVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPMineGuildPersonalBillRecordVC.h; sourceTree = ""; }; @@ -4199,6 +4201,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 23E56B3C2B03564B00C8DAC9 /* CoreTelephony.framework in Frameworks */, 234489082AC3C5DA0070E5D5 /* SudMGP.framework in Frameworks */, 73FFADDC93E195344047A2EC /* Pods_YuMi.framework in Frameworks */, 186A531926FC592100D67B2C /* libresolv.tbd in Frameworks */, @@ -6549,6 +6552,7 @@ BFB922F5D81845AC32D1E1ED /* Frameworks */ = { isa = PBXGroup; children = ( + 23E56B3B2B03564B00C8DAC9 /* CoreTelephony.framework */, E87888F32738C30E00BF1D57 /* StoreKit.framework */, 186A531826FC591100D67B2C /* libresolv.tbd */, CACF623970097D653132D69A /* Pods_YuMi.framework */, diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/PIGiftInfoSegmentedView.m b/YuMi/Modules/YMRoom/View/SendGiftView/View/PIGiftInfoSegmentedView.m index c2d32465..4cfab297 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/PIGiftInfoSegmentedView.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/PIGiftInfoSegmentedView.m @@ -32,8 +32,17 @@ @property (nonatomic,strong) GiftInfoModel *lastSelectGift; ///当前展示的数据的类型 @property (nonatomic,assign) GiftSegmentType segmentType; -///控制器容器 -@property(nonatomic,strong) NSMutableArray *vcList; + +///普通 +@property (nonatomic,strong)XPGiftInfoView *normalVC; +///幸运 +@property (nonatomic,strong)XPGiftInfoView *luckyVC; +///周星 +@property (nonatomic,strong)XPGiftInfoView *weekStarVC; +///贵族 +@property (nonatomic,strong)XPGiftInfoView *nobleVC; +///人气 +@property (nonatomic,strong)XPGiftInfoView *anchorVC; @end @implementation PIGiftInfoSegmentedView @@ -94,8 +103,8 @@ - (id)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index { - XPGiftInfoView *vc = [self.vcList safeObjectAtIndex1:index]; - if(index == 3){ + XPGiftInfoView *vc = [self getListVC:index]; + if(vc.segmentType == GiftSegmentType_Noble){ vc.curUserNobleLevel = self.curUserNobleLevel; } vc.usingplaceType = self.usingplaceType; @@ -107,13 +116,40 @@ self.pi_containerView.hidden = NO; self.packGiftView.hidden = YES; self.totalValueLabel.hidden = YES; - XPGiftInfoView *vc = [self.vcList safeObjectAtIndex1:index]; + XPGiftInfoView *vc = [self getListVC:index]; self.segmentType = vc.segmentType; if(self.delegate && [self.delegate respondsToSelector:@selector(pIGiftInfoSegmentedView:didClickSegment:)]){ [self.delegate pIGiftInfoSegmentedView:self didClickSegment:self.segmentType]; } +} +-(XPGiftInfoView *)getListVC:(NSInteger)index{ + + if(self.usingplaceType == SendGiftType_User){ + return [@[self.normalVC,self.weekStarVC,self.nobleVC] safeObjectAtIndex1:index]; + } + if(self.roomType == RoomType_Anchor){ + return [@[self.normalVC,self.luckyVC,self.weekStarVC,self.nobleVC,self.anchorVC] safeObjectAtIndex1:index]; + } + return [@[self.normalVC,self.luckyVC,self.weekStarVC,self.nobleVC] safeObjectAtIndex1:index]; +} +-(NSInteger)getIndex{ + if(self.usingplaceType == SendGiftType_User){ + if(self.segmentType == GiftSegmentType_Normal){ + return 0; + }else if (self.segmentType == GiftSegmentType_WeekStar){ + return 1; + }else{ + return 2; + } + } + if(self.roomType == RoomType_Anchor){ + NSString *index = [@[@"0",@"1",@"2",@"3",@"4"] safeObjectAtIndex1:self.segmentType]; + return index.integerValue; + } + NSString *index = [@[@"0",@"1",@"2",@"3"] safeObjectAtIndex1:self.segmentType]; + return index.integerValue; } -(void)didClickGiftSegmentAction:(UIButton *)sender{ self.packGiftView.hidden = NO; @@ -182,6 +218,7 @@ if (self.usingplaceType == SendGiftType_User) { _giftList = [[NSMutableArray alloc]initWithArray:@[normaleArray,weekStarArray,nobleArray]]; }else{ + _giftList = [[NSMutableArray alloc]initWithArray:@[normaleArray,luckyArray,weekStarArray,nobleArray,anchorArray]]; } @@ -242,7 +279,8 @@ if(_segmentType == GiftSegmentType_Pack){ return _packGiftView.lastSelectGift; } - XPGiftInfoView *vc = [self.vcList safeObjectAtIndex1:self.segmentType-1]; + + XPGiftInfoView *vc = [self getListVC:[self getIndex]]; return vc.lastSelectGift; } @@ -324,29 +362,49 @@ } return _segmentBgView; } -- (NSMutableArray *)vcList{ - if(!_vcList){ - XPGiftInfoView *normalVC = [[XPGiftInfoView alloc]init]; - normalVC.delegate = self; - normalVC.segmentType = GiftSegmentType_Normal; +- (XPGiftInfoView *)normalVC{ + if(!_normalVC){ + _normalVC = [[XPGiftInfoView alloc]init]; + _normalVC.delegate = self; + _normalVC.segmentType = GiftSegmentType_Normal; + } + return _normalVC;; +} + +- (XPGiftInfoView *)luckyVC{ + if(!_luckyVC){ XPGiftInfoView *luckyVC = [[XPGiftInfoView alloc]init]; - normalVC.delegate = self; - luckyVC.segmentType = GiftSegmentType_Lucky; - XPGiftInfoView *weekStarVC = [[XPGiftInfoView alloc]init]; luckyVC.delegate = self; - weekStarVC.segmentType = GiftSegmentType_WeekStar; - XPGiftInfoView *nobleVC = [[XPGiftInfoView alloc]init]; + luckyVC.segmentType = GiftSegmentType_Lucky; + _luckyVC = luckyVC; + } + return _luckyVC; +} +- (XPGiftInfoView *)weekStarVC{ + if(!_weekStarVC){ + XPGiftInfoView *weekStarVC = [[XPGiftInfoView alloc]init]; weekStarVC.delegate = self; - nobleVC.segmentType = GiftSegmentType_Noble; + weekStarVC.segmentType = GiftSegmentType_WeekStar; + _weekStarVC = weekStarVC; + } + return _weekStarVC; +} +- (XPGiftInfoView *)nobleVC{ + if(!_nobleVC){ + XPGiftInfoView *nobleVC = [[XPGiftInfoView alloc]init]; nobleVC.delegate = self; - + nobleVC.segmentType = GiftSegmentType_Noble; + _nobleVC = nobleVC; + } + return _nobleVC; +} +-(XPGiftInfoView *)anchorVC{ + if(!_anchorVC){ XPGiftInfoView *anchorVC = [[XPGiftInfoView alloc]init]; anchorVC.delegate = self; anchorVC.segmentType = GiftSegmentType_Anchor; - - _vcList = [[NSMutableArray alloc]initWithArray:@[normalVC,luckyVC,weekStarVC,nobleVC,anchorVC]]; - + _anchorVC = anchorVC; } - return _vcList; + return _anchorVC;; } @end diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftInfoView.h b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftInfoView.h index 1f86d118..b99e07a7 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftInfoView.h +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftInfoView.h @@ -13,13 +13,13 @@ NS_ASSUME_NONNULL_BEGIN typedef NS_ENUM(NSInteger, GiftSegmentType) { - GiftSegmentType_Normal = 1, ///普通的礼物 + GiftSegmentType_Normal = 0, ///普通的礼物 GiftSegmentType_Lucky,///幸运礼物 - GiftSegmentType_Noble,///贵族礼物 GiftSegmentType_WeekStar, ///周星礼物 + GiftSegmentType_Noble,///贵族礼物 + GiftSegmentType_Anchor,///个播 GiftSegmentType_Pack,///背包礼物 GiftSegmentType_Graffiti,///涂鸦礼物 - GiftSegmentType_Anchor,///个播 GiftSegmentType_Punish,///惩罚礼物 }; diff --git a/YuMi/Tools/YYUtility/YYUtility+App.m b/YuMi/Tools/YYUtility/YYUtility+App.m index a9b330f4..c9a85b34 100644 --- a/YuMi/Tools/YYUtility/YYUtility+App.m +++ b/YuMi/Tools/YYUtility/YYUtility+App.m @@ -7,6 +7,11 @@ // #import "YYUtility.h" +#import //为判断网络制式的主要文件 +#import //添加获取客户端运营商 支持 + + + @implementation YYUtility (App) @@ -151,5 +156,28 @@ static NSString *_from = nil; temp = [temp stringByReplacingOccurrencesOfString:@"\n" withString:@""]; return temp; } - +/// 获取运营商信息 ++ (YYUtilityTelephonType)getOperatorInfomation { + CTTelephonyNetworkInfo *info = [[CTTelephonyNetworkInfo alloc] init]; + //NSLog(@"info = %@", info); + CTCarrier *carrier = [info subscriberCellularProvider]; + //NSLog(@"carrier = %@", carrier); + if (carrier == nil) { + return YYUtilityTelephonType_Link_Unknown; + } + NSString *code = [carrier mobileNetworkCode]; + if (code == nil) { + return YYUtilityTelephonType_Link_Unknown; + } + if ([code isEqualToString:@"00"] || [code isEqualToString:@"02"] || [code isEqualToString:@"07"]) { + return YYUtilityTelephonType_Move; + } else if ([code isEqualToString:@"01"] || [code isEqualToString:@"06"]) { + return YYUtilityTelephonType_Link_Together; + } else if ([code isEqualToString:@"03"] || [code isEqualToString:@"05"]) { + return YYUtilityTelephonType_Link_Telegraphy; + } else if ([code isEqualToString:@"20"]) { + return YYUtilityTelephonType_Link_Tietong; + } + return YYUtilityTelephonType_Link_Unknown; +} @end diff --git a/YuMi/Tools/YYUtility/YYUtility.h b/YuMi/Tools/YYUtility/YYUtility.h index 2ae4cb10..ead95a5a 100644 --- a/YuMi/Tools/YYUtility/YYUtility.h +++ b/YuMi/Tools/YYUtility/YYUtility.h @@ -7,7 +7,13 @@ // #import - +typedef enum : NSUInteger { + YYUtilityTelephonType_Move,///移动 + YYUtilityTelephonType_Link_Together,///联通 + YYUtilityTelephonType_Link_Telegraphy,///电信 + YYUtilityTelephonType_Link_Tietong,///铁通 + YYUtilityTelephonType_Link_Unknown,///不知道的运营商 +} YYUtilityTelephonType; @class CTCarrier; @interface YYUtility : NSObject @@ -85,7 +91,8 @@ * 是否来自appstore */ + (BOOL)isFromAppStore; - +/// 获取运营商信息 ++ (YYUtilityTelephonType)getOperatorInfomation; @end /*==============================*/