2.4.0版本代码提交

This commit is contained in:
CYH 2023-07-31 09:33:00 +08:00
parent b08ef84ab1
commit f30140a3d7
48 changed files with 889 additions and 50 deletions

View File

@ -145,6 +145,8 @@
return;
}
[_delegate inputBar:self didSendText:self.inputTextView.text];
[self clearInput];

View File

@ -11,6 +11,10 @@
5FF295EA8835717BF58B93F6 /* Pods_HoleNotification.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 74C6371F8879CD5C14B77D4D /* Pods_HoleNotification.framework */; };
8110E00B2A724EEC0050F3E0 /* THLVTipView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8110E00A2A724EEC0050F3E0 /* THLVTipView.m */; };
8110E00D2A724EF80050F3E0 /* THLVTipView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8110E00C2A724EF80050F3E0 /* THLVTipView.xib */; };
8110E0102A7352050050F3E0 /* THMineHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8110E00F2A7352040050F3E0 /* THMineHeaderView.m */; };
8110E0122A7352260050F3E0 /* THMineHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8110E0112A7352260050F3E0 /* THMineHeaderView.xib */; };
8110E0152A736DAE0050F3E0 /* THMineTypeNavView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8110E0142A736DAE0050F3E0 /* THMineTypeNavView.m */; };
8110E0172A736DC30050F3E0 /* THMineTypeNavView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8110E0162A736DC30050F3E0 /* THMineTypeNavView.xib */; };
8117270729D67CAB00259C1B /* THLanternAnimationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8117255729D67CAA00259C1B /* THLanternAnimationController.m */; };
8117270829D67CAB00259C1B /* THHomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8117255A29D67CAA00259C1B /* THHomeViewController.m */; };
8117270929D67CAB00259C1B /* THBottleModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8117255D29D67CAA00259C1B /* THBottleModel.m */; };
@ -467,6 +471,12 @@
8110E0092A724EEC0050F3E0 /* THLVTipView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = THLVTipView.h; sourceTree = "<group>"; };
8110E00A2A724EEC0050F3E0 /* THLVTipView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = THLVTipView.m; sourceTree = "<group>"; };
8110E00C2A724EF80050F3E0 /* THLVTipView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = THLVTipView.xib; sourceTree = "<group>"; };
8110E00E2A7352040050F3E0 /* THMineHeaderView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = THMineHeaderView.h; sourceTree = "<group>"; };
8110E00F2A7352040050F3E0 /* THMineHeaderView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = THMineHeaderView.m; sourceTree = "<group>"; };
8110E0112A7352260050F3E0 /* THMineHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = THMineHeaderView.xib; sourceTree = "<group>"; };
8110E0132A736DAE0050F3E0 /* THMineTypeNavView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = THMineTypeNavView.h; sourceTree = "<group>"; };
8110E0142A736DAE0050F3E0 /* THMineTypeNavView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = THMineTypeNavView.m; sourceTree = "<group>"; };
8110E0162A736DC30050F3E0 /* THMineTypeNavView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = THMineTypeNavView.xib; sourceTree = "<group>"; };
8117255729D67CAA00259C1B /* THLanternAnimationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = THLanternAnimationController.m; sourceTree = "<group>"; };
8117255829D67CAA00259C1B /* THHomeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = THHomeViewController.h; sourceTree = "<group>"; };
8117255929D67CAA00259C1B /* THLanternAnimationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = THLanternAnimationController.h; sourceTree = "<group>"; };
@ -3099,6 +3109,12 @@
B0842D3428AD2BB40096ADEF /* GenderPickerView.m */,
D93C3B752925E3AE00E840FD /* BigUserImgAlertView.h */,
D93C3B762925E3AE00E840FD /* BigUserImgAlertView.m */,
8110E00E2A7352040050F3E0 /* THMineHeaderView.h */,
8110E00F2A7352040050F3E0 /* THMineHeaderView.m */,
8110E0112A7352260050F3E0 /* THMineHeaderView.xib */,
8110E0132A736DAE0050F3E0 /* THMineTypeNavView.h */,
8110E0142A736DAE0050F3E0 /* THMineTypeNavView.m */,
8110E0162A736DC30050F3E0 /* THMineTypeNavView.xib */,
);
path = View;
sourceTree = "<group>";
@ -3523,12 +3539,14 @@
8117271429D67CAB00259C1B /* ProvinceCityArea.geojson in Resources */,
B0DB7A8D28293A15002A5170 /* TH_login_enter.png in Resources */,
B012AA6D282CF37500BBACA2 /* LaunchScreen.storyboard in Resources */,
8110E0172A736DC30050F3E0 /* THMineTypeNavView.xib in Resources */,
8110E00D2A724EF80050F3E0 /* THLVTipView.xib in Resources */,
B07834BA284A41DC0031FB16 /* README.md in Resources */,
8117271B29D67CAB00259C1B /* Images.xcassets in Resources */,
B038497E28141AD200F47C18 /* province.json in Resources */,
B00FC7C628839E08002D2FA7 /* ZZCircleProgress.bundle in Resources */,
FC8C57ED2935A3F6006E5110 /* BRAddressPickerView.bundle in Resources */,
8110E0122A7352260050F3E0 /* THMineHeaderView.xib in Resources */,
B038477828141A4200F47C18 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -3647,6 +3665,7 @@
811727AA29D67CAB00259C1B /* NSURL+QMUI.m in Sources */,
B038493B28141AD200F47C18 /* PYThemeButton.m in Sources */,
B03849D628141AD200F47C18 /* SetAvatarViewController.m in Sources */,
8110E0152A736DAE0050F3E0 /* THMineTypeNavView.m in Sources */,
B038494528141AD200F47C18 /* PYHUD.m in Sources */,
8117279829D67CAB00259C1B /* UIBlurEffect+QMUI.m in Sources */,
B038495F28141AD200F47C18 /* NSDictionary+BlocksKit.m in Sources */,
@ -3751,6 +3770,7 @@
8117273329D67CAB00259C1B /* QMUIEmotionInputManager.m in Sources */,
B07834D6284A49310031FB16 /* KSPhotoView.m in Sources */,
8117270A29D67CAB00259C1B /* THBottleInfoModel.m in Sources */,
8110E0102A7352050050F3E0 /* THMineHeaderView.m in Sources */,
B038494E28141AD200F47C18 /* UIImage+PHAsset.m in Sources */,
B038497828141AD200F47C18 /* UITextField+MTLimit.m in Sources */,
D9FD6AC12920A95F00923069 /* ShareInviteCodeAlertView.m in Sources */,
@ -4266,12 +4286,10 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = TreeHole/TreeHole.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = Y797QLF5AW;
DEVELOPMENT_TEAM = C39VUKAY2Z;
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "$(inherited)";
FRAMEWORK_SEARCH_PATHS = (
@ -4302,10 +4320,9 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.4.0;
PRODUCT_BUNDLE_IDENTIFIER = com.zncdts.app;
PRODUCT_BUNDLE_IDENTIFIER = com.zncdts.app123;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = app1;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
@ -4326,12 +4343,10 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = TreeHole/TreeHole.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = Y797QLF5AW;
DEVELOPMENT_TEAM = C39VUKAY2Z;
ENABLE_BITCODE = NO;
EXCLUDED_ARCHS = "";
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "$(inherited)";
@ -4363,10 +4378,9 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.4.0;
PRODUCT_BUNDLE_IDENTIFIER = com.zncdts.app;
PRODUCT_BUNDLE_IDENTIFIER = com.zncdts.app123;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = app1;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;

View File

@ -1,7 +1,6 @@
{
"images" : [
{
"filename" : "Slice 364.png",
"idiom" : "universal",
"scale" : "1x"
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -1,7 +1,6 @@
{
"images" : [
{
"filename" : "Slice 154.png",
"idiom" : "universal",
"scale" : "1x"
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 KiB

After

Width:  |  Height:  |  Size: 471 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 458 KiB

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@ -1,7 +1,6 @@
{
"images" : [
{
"filename" : "Slice 154.png",
"idiom" : "universal",
"scale" : "1x"
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 215 KiB

After

Width:  |  Height:  |  Size: 469 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 445 KiB

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@ -1,17 +1,16 @@
{
"images" : [
{
"filename" : "Slice 362.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Slice 362@2x.png",
"filename" : "邀请有奖@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Slice 362@3x.png",
"filename" : "邀请有奖@3x.png",
"idiom" : "universal",
"scale" : "3x"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Frame 2041@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Frame 2041@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Frame@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Frame@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "set_icon@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "set_icon@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "版本更新@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "版本更新@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "附近隐身@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "附近隐身@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -22,18 +22,18 @@ typedef enum : NSUInteger {
#if IS_DEBUG
#define PYHttpBaseUrl @"http://192.168.3.55:8890/v1/"
//#define PYHttpBaseUrl @"http://192.168.3.55:8890/v1/"
///正式
//#define PYHttpBaseUrl @"https://xidi.iquanpai.com/app-service/v1/"
#define PYHttpBaseUrl @"https://xidi.iquanpai.com/app-service/v1/"
#else
//本地
#define PYHttpBaseUrl @"http://192.168.3.55:8890/v1/"
//#define PYHttpBaseUrl @"http://192.168.3.55:8890/v1/"
///正式
//#define PYHttpBaseUrl @"https://xidi.iquanpai.com/app-service/v1/"
#define PYHttpBaseUrl @"https://xidi.iquanpai.com/app-service/v1/"
#endif

View File

@ -162,7 +162,7 @@
[ud synchronize];
self.city = user.city;
self.nextPage = 1;
@ -442,7 +442,7 @@
[PYHTTPManager postWithPath:@"usernearby1" params:_nearbyParamDict callback:^(id _Nullable rsp, NSError * _Nullable error) {
// NSLog(@"是的rsp : %@==%@",rsp[@"isRecommend"],error);
if (!error) {
self.city = city;
[[NSUserDefaults standardUserDefaults]setObject:rsp[@"isRecommend"] forKey:@"isRecommend"];
[[NSUserDefaults standardUserDefaults] synchronize];
@ -477,9 +477,23 @@
}
_blockSelf.tableMDataArray = newArray;
[_blockSelf.contentTableView reloadData];
} else {
NSString *code = [NSString stringWithFormat:@"%@",error.userInfo[@"code"]];
if(code.intValue == 1300) {
NSString *msg = error.userInfo[@"message"];
[MTAlertView showWithSetupBlcok:^(MTAlertViewConfig *config) {
config.message = msg;
config.otherTitle = @"去开通会员";
config.cancelTitle = @"取消";
config.otherHandler = ^(MTAlertButton *button) {
[PYAppService showVipVC:@"vip_page"];
};
}];
}
}
[_blockSelf.contentTableView reloadData];
[_blockSelf.contentTableView.mj_header endRefreshing];
[_blockSelf.contentTableView.mj_footer endRefreshing];
}];

View File

@ -65,11 +65,16 @@
config.title = @"聊天提示";
if ([msg containsString:@"需要互关/VIP才能聊天才能发送图片和语音"]) {
config.message = [msg stringByReplacingOccurrencesOfString:@"互关/" withString:@""];
config.otherTitle = @"去开通会员";
config.otherHandler = ^(MTAlertButton *button) {
[PYAppService showVipVC:@"vip_page"];
};
} else {
config.message = msg;
config.otherTitle = @"OK";
}
config.otherTitle = @"OK";
}];
}else{
[self patch_makeToastError:error msg:msg];

View File

@ -12,6 +12,7 @@
+ (NSDictionary*)decodeJWTToken:(NSString*)jwtToken
{
if (jwtToken.length == 0) return @{};
NSArray* segments = [jwtToken componentsSeparatedByString:@"."];
NSString* base64String = [segments objectAtIndex:1]; // (Header, Payload, Signature)

View File

@ -0,0 +1,18 @@
//
// THMineHeaderView.h
// TreeHole
//
// Created by iOS on 2023/7/28.
// Copyright © 2023 CYH. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface THMineHeaderView : UIView
@property (weak, nonatomic) IBOutlet UILabel *descLbl;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,50 @@
//
// THMineHeaderView.m
// TreeHole
//
// Created by iOS on 2023/7/28.
// Copyright © 2023 CYH. All rights reserved.
//
#import "THMineHeaderView.h"
#import "PYAppService.h"
#import "FeedbackViewController.h"
#import "SettingsViewController.h"
#import "EditProfileViewController.h"
@implementation THMineHeaderView
- (void)layoutSubviews {
[super layoutSubviews];
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:self.descLbl.text];
NSRange range = [self.descLbl.text rangeOfString:@"去完善"];
//
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:254/255.0 green:209/255.0 blue:164/255.0 alpha:1.0] range:range];
self.descLbl.attributedText = attributedString;
self.descLbl.superview.layer.cornerRadius = 5;
self.descLbl.superview.layer.borderWidth = 1;
self.descLbl.superview.layer.borderColor = [UIColor colorWithRed:254/255.0 green:209/255.0 blue:164/255.0 alpha:0.3].CGColor;
[self.descLbl.superview addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(setInfo)]];
}
- (void)setInfo {
EditProfileViewController *VC = [EditProfileViewController new];
[PYAppService pushViewControllerAnimated:VC];
}
- (IBAction)settingAction:(id)sender {
[PYAppService pushViewControllerAnimated:[SettingsViewController new]];
}
- (IBAction)qaAction:(id)sender {
[PYAppService pushViewControllerAnimated:[FeedbackViewController new]];
}
@end

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="THMineHeaderView">
<rect key="frame" x="0.0" y="0.0" width="393" height="40"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="wOa-gv-dIt">
<rect key="frame" x="354" y="8" width="24" height="24"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="set_icon"/>
<connections>
<action selector="settingAction:" destination="iN0-l3-epB" eventType="touchUpInside" id="cmR-7F-Wpn"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="OjY-mx-iXQ">
<rect key="frame" x="320" y="8" width="24" height="24"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" image="qa"/>
<connections>
<action selector="qaAction:" destination="iN0-l3-epB" eventType="touchUpInside" id="1uI-vM-MiS"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9wH-hp-Q87">
<rect key="frame" x="15" y="7" width="240" height="26"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="完善个人形象交友成功率提高80% 去完善" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="i6a-bZ-DmM">
<rect key="frame" x="20.666666666666657" y="7" width="199" height="12"/>
<fontDescription key="fontDescription" type="system" pointSize="10"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="0.20000000000000001" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="i6a-bZ-DmM" firstAttribute="centerX" secondItem="9wH-hp-Q87" secondAttribute="centerX" id="7aD-34-nW0"/>
<constraint firstItem="i6a-bZ-DmM" firstAttribute="centerY" secondItem="9wH-hp-Q87" secondAttribute="centerY" id="WHl-hb-OWB"/>
<constraint firstAttribute="width" constant="240" id="aYG-Ma-77x"/>
<constraint firstAttribute="height" constant="26" id="n1t-bJ-2Bv"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.0" green="0.46000000000000002" blue="0.89000000000000001" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="9wH-hp-Q87" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="15" id="ABm-Ao-8LL"/>
<constraint firstItem="OjY-mx-iXQ" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="DnS-bz-lzp"/>
<constraint firstItem="9wH-hp-Q87" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="P3P-dL-czg"/>
<constraint firstAttribute="trailing" secondItem="wOa-gv-dIt" secondAttribute="trailing" constant="15" id="Tsp-5s-bsG"/>
<constraint firstItem="wOa-gv-dIt" firstAttribute="leading" secondItem="OjY-mx-iXQ" secondAttribute="trailing" constant="10" id="m0y-g2-Xeq"/>
<constraint firstItem="wOa-gv-dIt" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="xhM-oH-fUl"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="descLbl" destination="i6a-bZ-DmM" id="2lM-Ax-jsW"/>
</connections>
<point key="canvasLocation" x="52.671755725190835" y="-11.267605633802818"/>
</view>
</objects>
<resources>
<image name="qa" width="24" height="24"/>
<image name="set_icon" width="24" height="24"/>
</resources>
</document>

View File

@ -0,0 +1,19 @@
//
// THMineTypeNavView.h
// TreeHole
//
// Created by iOS on 2023/7/28.
// Copyright © 2023 CYH. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface THMineTypeNavView : UIView
@property (weak, nonatomic) IBOutlet UIView *bgView;
@property (weak, nonatomic) IBOutlet UIButton *upBtn;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,40 @@
//
// THMineTypeNavView.m
// TreeHole
//
// Created by iOS on 2023/7/28.
// Copyright © 2023 CYH. All rights reserved.
//
#import "THMineTypeNavView.h"
@implementation THMineTypeNavView
- (void)layoutSubviews {
[super layoutSubviews];
//
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.frame = self.bgView.bounds;
//
UIColor *startColor = [UIColor colorWithRed:255/255.0 green:186/255.0 blue:139/255.0 alpha:1.0];
UIColor *endColor = [UIColor colorWithRed:233/255.0 green:202/255.0 blue:171/255.0 alpha:1.0];
gradientLayer.colors = @[(__bridge id)startColor.CGColor, (__bridge id)endColor.CGColor];
gradientLayer.startPoint = CGPointMake(0.59, 0.52);
gradientLayer.endPoint = CGPointMake(0.38, 0.52);
//
[self.bgView.layer addSublayer:gradientLayer];
self.bgView.layer.cornerRadius = self.bgView.size.height/2;
self.bgView.clipsToBounds = true;
}
@end

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="THMineTypeNavView">
<rect key="frame" x="0.0" y="0.0" width="393" height="40"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ahX-kq-PX7">
<rect key="frame" x="15" y="3" width="56" height="34"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="形象照">
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
</button>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="line" translatesAutoresizingMaskIntoConstraints="NO" id="vTX-Vu-C7Q">
<rect key="frame" x="24.666666666666671" y="38" width="37" height="2"/>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="fhu-gN-RqV">
<rect key="frame" x="274" y="6.6666666666666679" width="104" height="27.000000000000004"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="CZf-VZ-cGb">
<rect key="frame" x="274" y="6.6666666666666679" width="104" height="27.000000000000004"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="27" id="QcD-YV-cbP"/>
<constraint firstAttribute="width" constant="104" id="phY-4y-xcq"/>
</constraints>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="12"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="上传形象照">
<color key="titleColor" red="0.086274509803921567" green="0.066666666666666666" blue="0.18431372549019609" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
</button>
</subviews>
<color key="backgroundColor" red="0.0" green="0.46000000000000002" blue="0.89000000000000001" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="CZf-VZ-cGb" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="054-gf-hwZ"/>
<constraint firstItem="fhu-gN-RqV" firstAttribute="height" secondItem="CZf-VZ-cGb" secondAttribute="height" id="4cw-Eg-Dan"/>
<constraint firstItem="ahX-kq-PX7" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="15" id="LlQ-cI-K6l"/>
<constraint firstItem="vTX-Vu-C7Q" firstAttribute="centerX" secondItem="ahX-kq-PX7" secondAttribute="centerX" id="Ydq-B5-AB1"/>
<constraint firstItem="ahX-kq-PX7" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="a6y-3B-xh6"/>
<constraint firstItem="fhu-gN-RqV" firstAttribute="width" secondItem="CZf-VZ-cGb" secondAttribute="width" id="ao3-wP-YWb"/>
<constraint firstAttribute="trailing" secondItem="CZf-VZ-cGb" secondAttribute="trailing" constant="15" id="bDB-C4-N47"/>
<constraint firstItem="fhu-gN-RqV" firstAttribute="centerY" secondItem="CZf-VZ-cGb" secondAttribute="centerY" id="hbA-Sp-jSO"/>
<constraint firstAttribute="bottom" secondItem="vTX-Vu-C7Q" secondAttribute="bottom" id="ix8-uU-XBQ"/>
<constraint firstItem="fhu-gN-RqV" firstAttribute="centerX" secondItem="CZf-VZ-cGb" secondAttribute="centerX" id="tNW-Mz-Nnm"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="bgView" destination="fhu-gN-RqV" id="ftc-wY-kgo"/>
<outlet property="upBtn" destination="CZf-VZ-cGb" id="4Cn-zK-aEV"/>
</connections>
<point key="canvasLocation" x="53" y="-11"/>
</view>
</objects>
<resources>
<image name="line" width="37" height="2"/>
</resources>
</document>

View File

@ -13,14 +13,24 @@
#import "InviteCodeViewController.h"//
#import "SettingsViewController.h"//
#import "FeedbackViewController.h"//
#import "TZImagePickerController+MTImagePicker.h"
#import "THMineHeaderView.h"
#import "THMineTypeNavView.h"
#import "ProfilePhotoCell.h"
#import "MTActionSheet.h"
#import "VIPCardInfo.h"
static NSString * const DidActionScoreKey = @"DidActionScoreKey";
static NSString * const DidActionFollowPublicAccountKey = @"DidActionFollowPublicAccountKey";
@interface MineViewController ()
@interface MineViewController ()<UICollectionViewDataSource, UICollectionViewDelegate, KSPhotoBrowserDelegate>
@property (nonatomic, strong)User* userModel;//
@property (nonatomic, strong)UIView* userView;
@property (nonatomic, strong)UIView* nianVipView;
@property (nonatomic, strong)UILabel* nianVipLab;
@property (nonatomic, strong) UIView *emptyTipsView;
@property (nonatomic, strong) UICollectionView *collectionView;
@property (nonatomic, strong)UIButton* openVipBtn;
@property (nonatomic, strong)UILabel* openVipLab;
@ -28,6 +38,13 @@ static NSString * const DidActionFollowPublicAccountKey = @"DidActionFollowPubli
@property (nonatomic,strong) NSMutableArray *infoArray;
@property (nonatomic, strong) NSMutableArray<ProfilePhoto *> *photosM;
@property (nonatomic, strong) MTActionSheet *moreSheet;
@property (nonatomic, strong) MTActionSheet *photoSheet;
@property (nonatomic, strong) ProfilePhoto *actionSheetPhoto;
@property (nonatomic, strong) KSPhotoBrowser *browser;
@end
@implementation MineViewController
@ -51,20 +68,82 @@ static NSString * const DidActionFollowPublicAccountKey = @"DidActionFollowPubli
}else{
_nianVipLab.text = @"VIP";
}
}else{
_nianVipView.hidden = YES;
_openVipLab.hidden = YES;
}
[UserService getUserInfoWithCompletion:^(User * _Nonnull user) {
[self getNoticeCount];
[self loadPhotosData];
[self refreshVIPInfo];
}];
self.navigationController.navigationBar.hidden = true;
}
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
self.navigationController.navigationBar.hidden = false;
}
- (void)refreshVIPInfo {
[PYHTTPManager postWithPath:@"myvipcard" params:nil callback:^(id _Nullable rsp, NSError * _Nullable error) {
VIPCardInfo *info = [VIPCardInfo mj_objectWithKeyValues:rsp];
if (info.vipcard.vip_exp_date.length > 0) {
self.openVipLab.text = info.vipcard.vip_exp_date;
}
}];
}
- (void)loadPhotosData {
[UserService getUserPhotosWithUserID:[UserService currentUserID] completion:^(NSArray<ProfilePhoto *> * _Nonnull photos) {
self.photosM = [photos mutableCopy];
if (self.photosM.count == 0) {
self.emptyTipsView.hidden = false;
self.collectionView.hidden = true;
self.contentScrollView.contentSize = CGSizeMake(SCREEN_WIDTH,TAB_BAR_HEIGHT + self.emptyTipsView.qmui_bottom + 30);
} else {
self.emptyTipsView.hidden = true;
self.collectionView.hidden = false;
self.contentScrollView.contentSize = CGSizeMake(SCREEN_WIDTH,TAB_BAR_HEIGHT + self.collectionView.qmui_bottom);
[self.collectionView reloadData];
}
}];
}
- (void)upLoadAction {
if(self.photosM.count >= 9){
[SVProgressHUD showErrorWithStatus:@"为了让形象照质量更高,目前只允许上传9张~"];
return;
}
TZImagePickerController *picker = [TZImagePickerController mt_imagePickerWithMaxImagesCount:9 - self.photosM.count didFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
dispatch_async(dispatch_get_main_queue(), ^{
[SVProgressHUD showWithStatus:nil];
});
[UserService uploadUserPhotoWithImages:photos completion:^(id _Nullable rsp, NSError * _Nullable error) {
if (error) {
[SVProgressHUD showErrorWithStatus:@"上传失败,请稍后重试"];
} else {
[SVProgressHUD dismiss];
[self loadPhotosData];
}
}];
}];
[self.navigationController presentViewController:picker animated:YES completion:nil];
}
-(void)getNoticeCount
@ -75,9 +154,18 @@ static NSString * const DidActionFollowPublicAccountKey = @"DidActionFollowPubli
[view removeFromSuperview];
}
_userView= [[UIView alloc]initWithFrame:CGRectMake(0, STATUS_BAR_HEIGHT + FIX_SIZE(12), SCREEN_WIDTH, FIX_SIZE(182))];
_userView= [[UIView alloc]initWithFrame:CGRectMake(0, STATUS_BAR_HEIGHT + FIX_SIZE(12), SCREEN_WIDTH, FIX_SIZE(212))];
[self.contentScrollView addSubview:self.userView];
UIImageView* userImgV = [[UIImageView alloc]initWithFrame:CGRectMake(FIX_SIZE(20), FIX_SIZE(20), FIX_SIZE(68), FIX_SIZE(68))];
NSArray * xibArray = [[NSBundle mainBundle]loadNibNamed:NSStringFromClass(THMineHeaderView.class) owner:nil options:nil] ;
THMineHeaderView *headerView = xibArray.firstObject;
headerView.frame = CGRectMake(0, 0, SCREEN_WIDTH, 30);
[_userView addSubview:headerView];
UIImageView* userImgV = [[UIImageView alloc]initWithFrame:CGRectMake(FIX_SIZE(20), FIX_SIZE(40), FIX_SIZE(68), FIX_SIZE(68))];
userImgV.contentMode = UIViewContentModeScaleToFill;
userImgV.layer.cornerRadius = userImgV.width/2.0;
userImgV.layer.masksToBounds = YES;
@ -253,8 +341,58 @@ static NSString * const DidActionFollowPublicAccountKey = @"DidActionFollowPubli
}
[self.contentScrollView addSubview:self.openVipBtn];
[self.contentScrollView addSubview:self.contentTableView];
self.contentScrollView.contentSize = CGSizeMake(SCREEN_WIDTH, _contentTableView.bottom + TAB_BAR_HEIGHT + FIX_SIZE(12));
NSArray * newxibArray = [[NSBundle mainBundle]loadNibNamed:NSStringFromClass(THMineTypeNavView.class) owner:nil options:nil] ;
THMineTypeNavView *navView = newxibArray.firstObject;
navView.frame = CGRectMake(0, self.openVipBtn.qmui_bottom + 20,SCREEN_WIDTH, 40);
[navView.upBtn addTarget:self action:@selector(upLoadAction) forControlEvents:UIControlEventTouchUpInside];
[self.contentScrollView addSubview:navView];
UIView *emptyTipsView = [[UIView alloc] init];
emptyTipsView.backgroundColor = [UIColor clearColor];
emptyTipsView.width = SCREEN_WIDTH;
UIImageView *emptyIconView = [[UIImageView alloc] initWithImage:ImageNamed(@"TH_pro_photo_icon")];
emptyIconView.size = CGSizeMake(FIX_SIZE(49), FIX_SIZE(49));
emptyIconView.centerX = emptyTipsView.width * 0.5;
emptyIconView.y = FIX_SIZE(30);
[emptyTipsView addSubview:emptyIconView];
UILabel *emptyTipsLabel = [UILabel mt_titleLabelWithText:@"上传你的照片\n让别人了解你"];
emptyTipsLabel.font = NORMAL_FONT;
[emptyTipsLabel sizeToFit];
emptyTipsLabel.centerX = emptyIconView.centerX;
emptyTipsLabel.y = emptyIconView.bottom + FIX_SIZE(6);
[emptyTipsView addSubview:emptyTipsLabel];
emptyTipsView.height = emptyTipsLabel.bottom;
emptyTipsView.y = navView.bottom + FIX_SIZE(3);
self.emptyTipsView = emptyTipsView;
[self.contentScrollView addSubview:self.emptyTipsView];
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.minimumLineSpacing = 1;
layout.minimumInteritemSpacing = 1;
CGFloat itemWidth = (self.view.width - 3) / 3.0;
CGFloat itemHeight = itemWidth * 165.0 / 125.0;
layout.itemSize = CGSizeMake(itemWidth, itemHeight);
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, navView.qmui_bottom + 10, SCREEN_WIDTH, 170 * 3) collectionViewLayout:layout];
[self.collectionView registerClass:ProfilePhotoCell.class forCellWithReuseIdentifier:ProfilePhotoCellID];
[self.view addSubview:self.collectionView];
self.collectionView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
self.collectionView.alwaysBounceVertical = YES;
self.collectionView.delegate = self;
self.collectionView.dataSource = self;
self.collectionView.backgroundColor = [UIColor clearColor];
[self.contentScrollView addSubview:self.collectionView];
// [self.contentScrollView addSubview:self.contentTableView];
// self.contentScrollView.contentSize = CGSizeMake(SCREEN_WIDTH,TAB_BAR_HEIGHT + self.collectionView.qmui_bottom);
}
@ -289,21 +427,22 @@ static NSString * const DidActionFollowPublicAccountKey = @"DidActionFollowPubli
-(UIButton *)openVipBtn{
if (!_openVipBtn) {
_openVipBtn = [[UIButton alloc]initWithFrame:CGRectMake(FIX_SIZE(22), _userView.bottom, SCREEN_WIDTH - FIX_SIZE(44), (SCREEN_WIDTH - FIX_SIZE(44))*0.468)];
_openVipLab = [[UILabel alloc]initWithFrame:CGRectMake(FIX_SIZE(80), FIX_SIZE(47), FIX_SIZE(160), FIX_SIZE(17))];
_openVipLab.text = _userModel.vip_time?[NSString stringWithFormat:@"会员到期:%@",_userModel.vip_time]:@"";
_openVipBtn = [[UIButton alloc]initWithFrame:CGRectMake(FIX_SIZE(22), _userView.bottom, SCREEN_WIDTH - FIX_SIZE(44), 339)];
_openVipLab = [[UILabel alloc]initWithFrame:CGRectMake(FIX_SIZE(80), FIX_SIZE(40), FIX_SIZE(160), FIX_SIZE(17))];
_openVipLab.textColor = HEX_COLOR(0xFFFFFF);
_openVipLab.font = FONT_SIZE(12);
[_openVipBtn addSubview:_openVipLab];
_openVipLab.text = @"二十种专属特权等你领取";
}
if (_userModel.isVIP) {
[_openVipBtn setBackgroundImage:[UIImage imageNamed:@"TH_pro_vip_card_content_S"] forState:UIControlStateNormal];
_openVipLab.hidden = NO;
}else{
[_openVipBtn setBackgroundImage:[UIImage imageNamed:@"TH_pro_vip_card_content_N"] forState:UIControlStateNormal];
_openVipLab.hidden = YES;
// _openVipLab.hidden = YES;
}
[_openVipBtn addTarget:self action:@selector(openVipBtnClick:) forControlEvents:UIControlEventTouchUpInside];
}
return _openVipBtn;
}
@ -466,4 +605,63 @@ static NSString * const DidActionFollowPublicAccountKey = @"DidActionFollowPubli
[[ZcqVender theTopviewControler].view addSubview:alertView];
}
#pragma mark - UICollectionViewDataSource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
self.emptyTipsView.hidden = self.photosM.count > 0;
return self.photosM.count;
}
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
return 1;
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
ProfilePhotoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ProfilePhotoCellID forIndexPath:indexPath];
cell.photo = self.photosM[indexPath.item];
return cell;
}
#pragma mark - UICollectionDelegate
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
ProfilePhotoCell *cell = (ProfilePhotoCell *)[collectionView cellForItemAtIndexPath:indexPath];
NSMutableArray *items = @[].mutableCopy;
for (int i = 0; i < self.photosM.count; i++) {
KSPhotoItem *item = [KSPhotoItem itemWithSourceView:indexPath.item == i ? cell.imageView : nil imageUrl:[NSURL URLWithString:self.photosM[i].url ?: @""]];
[items addObject:item];
}
KSPhotoBrowser *browser = [KSPhotoBrowser browserWithPhotoItems:items selectedIndex:indexPath.item];
browser.delegate = self;
browser.pageindicatorStyle = KSPhotoBrowserPageIndicatorStyleText;
browser.backgroundStyle = KSPhotoBrowserBackgroundStyleBlack;
[KSPhotoBrowser setImageViewBackgroundColor:[UIColor clearColor]];
browser.dismissalStyle = KSPhotoBrowserInteractiveDismissalStyleScale;
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:browser];
self.browser = browser;
nav.modalPresentationStyle = UIModalPresentationOverFullScreen;
[self.navigationController presentViewController:nav animated:NO completion:nil];
}
#pragma mark -KSPhotoBrowserDelegate
- (void)ks_photoBrowser:(KSPhotoBrowser *)browser didLongPressItem:(KSPhotoItem *)item atIndex:(NSUInteger)index {
if (index < self.photosM.count) {
ProfilePhoto *photo = self.photosM[index];
self.actionSheetPhoto = photo;
if (photo.is_top) {
self.photoSheet = [[MTActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"取消置顶", @"删除", nil];
} else {
self.photoSheet = [[MTActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"置顶", @"删除", nil];
}
[self.photoSheet showInView:browser.navigationController.view];
}
}
- (void)ks_photoBrowserDidDismiss:(KSPhotoBrowser *)browser {
self.browser = nil;
}
@end

View File

@ -10,12 +10,13 @@
#import "ChangePhoneViewController.h"
#import "BlackListViewController.h"
#import "PrivacySettingsViewController.h"
#import "InviteCodeViewController.h"
#import "FeedbackViewController.h"
#import "AlertInputView.h"
#import "MTCacheManager.h"
@interface SettingsViewController ()
@property (nonatomic, copy) NSString *statusStr;
@end
@implementation SettingsViewController
@ -74,23 +75,171 @@
[self.view addSubview:logoutItem];
self.tableView.contentSize = CGSizeMake(0, logoutItem.bottom);
[self getUserstatData];
}
- (void)getUserstatData {
[PYHTTPManager postWithPath:@"userstat" params:nil callback:^(id _Nullable rsp, NSError * _Nullable error) {
if (error == nil) {
self.statusStr = [NSString stringWithFormat:@"%@",rsp];
[self reloadData];
}
}];
}
- (void)showAppUpdateAlertViewWithVersion:(NSString *)version content:(NSString *)content isForce:(BOOL)isForce andDownLoadAddress:(NSString *)app_urlStr{
UIView *customView = [[UIView alloc] init];
customView.width = FIX_SIZE(270);
customView.height = FIX_SIZE(494);
customView.backgroundColor = COLOR_WITH_RGB(0x222436);
customView.layer.cornerRadius = FIX_SIZE(10);
customView.clipsToBounds = YES;
MTAlertView *alerView = [MTAlertView showWithSetupBlcok:^(MTAlertViewConfig *config) {
config.customView = customView;
}];
UIImageView *iconView = [[UIImageView alloc] init];
iconView.width = customView.width;
iconView.height = FIX_SIZE(160);
iconView.image = ImageNamed(@"TH_app_update_img");
[customView addSubview:iconView];
UILabel *versionLabel = [[UILabel alloc] init];
versionLabel.text = version;
versionLabel.font = MT_FONT_REGULAR_SIZE(12);
versionLabel.textColor = [UIColor whiteColor];
[versionLabel sizeToFit];
versionLabel.x = FIX_SIZE(25);
versionLabel.centerY = iconView.height * 0.5;
[iconView addSubview:versionLabel];
UIButton *nextButton = [[UIButton alloc] init];
[nextButton setTitle:@"稍后更新" forState:UIControlStateNormal];
[nextButton setTitleColor:CONTENT_COLOR forState:UIControlStateNormal];
[nextButton sizeToFit];
nextButton.width += 10;
nextButton.height = FIX_SIZE(30);
nextButton.titleLabel.font = MT_FONT_REGULAR_SIZE(13);
nextButton.centerX = customView.width * 0.5;
nextButton.bottom = customView.height - FIX_SIZE(15);
nextButton.hidden = isForce;
[customView addSubview:nextButton];
PYThemeButton *button = [PYThemeButton buttonWithTitle:@"立即更新" action:^(UIButton * _Nonnull button) {
// [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"itms-apps://itunes.apple.com/cn/app/qq/%@?mt=8", APPSTORE_APPID]] options:@{} completionHandler:^(BOOL success) {
//// NSLog(@"to App Store");
// }];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:app_urlStr] options:@{} completionHandler:^(BOOL success) {
// NSLog(@"to App Store");
}];
}];
[nextButton addTouchUpInsideWithAction:^(UIButton * _Nullable button) {
[alerView dismiss];
}];
button.width = FIX_SIZE(180);
button.centerX = customView.width * 0.5;
button.bottom = isForce ? customView.height - FIX_SIZE(20) : nextButton.y - FIX_SIZE(8);
[customView addSubview:button];
UITextView *textView = [[UITextView alloc] init];
textView.x = FIX_SIZE(20);
textView.text = content;
textView.backgroundColor = [UIColor clearColor];
textView.width = customView.width - textView.x * 2;
textView.y = iconView.bottom + FIX_SIZE(20);
textView.height = button.y - FIX_SIZE(20) - textView.y;
textView.textColor = [UIColor whiteColor];
textView.font = MT_FONT_REGULAR_SIZE(15);
[customView addSubview:textView];
}
- (MTCommonListTableConfig *)tableConfigForTableViewContorller
{
MTCommonListTableConfig *config = [MTCommonListTableConfig defaultConfigWithCellStyle:MTCommonListTableCellStyleDisclosureIndicator rowsCountForSections:@[@(2), @(2), @(2)]];
config.cellTitles = @[@"修改手机号", @"修改密码锁", @"黑名单", @"隐私设置", @"意见反馈", @"清理缓存"];
MTCommonListTableConfig *config = [MTCommonListTableConfig defaultConfigWithCellStyle:MTCommonListTableCellStyleDisclosureIndicator rowsCountForSections:@[@(6), @(2), @(2)]];
//
config.cellTitles = @[@"版本更新",@"邀请有奖", @"隐身",@"设置密码锁",@"修改密码锁", @"修改手机号",@"黑名单", @"隐私设置", @"意见反馈", @"清理缓存"];
config.cellImageNames = @[@"TH_pro_set_phone_icon", @"TH_pro_set_password_icon", @"TH_pro_set_blacklist_icon", @"TH_pro_set_privacy_icon", @"TH_pro_set_opinion_icon", @"TH_pro_set_icon_dump"];
config.cellImageNames = @[@"version",@"TH_pro_yqyj",@"yin",@"TH_pro_mms",@"TH_pro_set_password_icon",@"TH_pro_set_phone_icon", @"TH_pro_set_blacklist_icon", @"TH_pro_set_privacy_icon", @"TH_pro_set_opinion_icon", @"TH_pro_set_icon_dump"];
config.tableTitle = @"更多";
User *user = [UserService currentUser];
[config resetCellConfigForSection:0 row:0 config:^(MTCommonListTableCellConfig *cellConfig) {
cellConfig.cellAction = ^(MTCommonListTableViewController *tableViewController, NSIndexPath *indexPath, MTCommonListTableCellConfig *cellConfig) {
[PYAppService pushViewControllerAnimated:[ChangePhoneViewController new]];
[PYHTTPManager postWithPath:@"checkappupdate" params:nil callback:^(id _Nullable rsp, NSError * _Nullable error) {
if (!error) {
NSString *type = rsp[@"update_type"];
NSString *version = rsp[@"new_version"];
NSString *content = rsp[@"update_content"];
NSString *app_urlStr = rsp[@"app_url"];
// NSLog(@"type:%@\napp_urlStr:%@",type,app_urlStr);
// NSString *type = @"force_update";
// NSString *content = @"https://sourl.cn/9KSTN6";
// NSString *app_urlStr = @"https://sourl.cn/9KSTN6";
if ([type isEqualToString:@"update_remind"]) { //
[self showAppUpdateAlertViewWithVersion:version content:content isForce:NO andDownLoadAddress:app_urlStr];
return;
}
if ([type isEqualToString:@"force_update"]) { //
[self showAppUpdateAlertViewWithVersion:version content:content isForce:YES andDownLoadAddress:app_urlStr];
return;
} else {
[SVProgressHUD showInfoWithStatus:@"当前已经是最新版本了"];
}
}
}];
// [PYAppService pushViewControllerAnimated:[ChangePhoneViewController new]];
};
}];
MJWeakSelf
[config resetCellConfigForSection:0 row:2 config:^(MTCommonListTableCellConfig *cellConfig) {
cellConfig.accessoryTitle = weakSelf.statusStr.intValue == 1 ? @"已开启": @"未开启";
cellConfig.cellAction = ^(MTCommonListTableViewController *tableViewController, NSIndexPath *indexPath, MTCommonListTableCellConfig *cellConfig) {
if ([cellConfig.accessoryTitle isEqualToString:@"未开启"]){
if([UserService currentUser].vip_kind == 10){
[PYHTTPManager postWithPath:@"updatesecurity" params:@{@"state":@1} callback:^(id _Nullable rsp, NSError * _Nullable error) {
if (error == nil) {
self.statusStr = @"1";
[self reloadData];
}
}];
} else {
[MTAlertView showWithSetupBlcok:^(MTAlertViewConfig *config) {
config.message = @"";
config.title = @"开通年VIP才能使用隐身功能";
config.otherTitle = @"去开通";
config.cancelTitle = @"取消";
config.otherHandler = ^(MTAlertButton *button) {
[PYAppService showVipVC:@"vip_page"];
};
}];
}
} else {
[PYHTTPManager postWithPath:@"updatesecurity" params:@{@"state":@0} callback:^(id _Nullable rsp, NSError * _Nullable error) {
if (error == nil) {
self.statusStr = @"0";
[self reloadData];
}
}];
}
};
}];
[config resetCellConfigForSection:0 row:1 config:^(MTCommonListTableCellConfig *cellConfig) {
cellConfig.cellAction = ^(MTCommonListTableViewController *tableViewController, NSIndexPath *indexPath, MTCommonListTableCellConfig *cellConfig) {
[PYAppService pushViewControllerAnimated:[InviteCodeViewController new]];
};
}];
WeakSelf(self);
[config resetCellConfigForSection:0 row:1 config:^(MTCommonListTableCellConfig *cellConfig) {
[config resetCellConfigForSection:0 row:4 config:^(MTCommonListTableCellConfig *cellConfig) {
cellConfig.accessoryTitle = user.security_code.length == SecurityCodeLength ? [NSString stringWithFormat:@"****%@", [user.security_code substringFromIndex:4]] : @"未设置";
cellConfig.cellAction = ^(MTCommonListTableViewController *tableViewController, NSIndexPath *indexPath, MTCommonListTableCellConfig *cellConfig) {
@ -148,6 +297,88 @@
}];
};
}];
[config resetCellConfigForSection:0 row:3 config:^(MTCommonListTableCellConfig *cellConfig) {
BOOL canOpen = [UserService isSecurityCodeOpen];
cellConfig.accessoryTitle = canOpen ? @"已开启": @"未开启";
cellConfig.cellAction = ^(MTCommonListTableViewController *tableViewController, NSIndexPath *indexPath, MTCommonListTableCellConfig *cellConfig) {
if ([cellConfig.accessoryTitle isEqualToString:@"未开启"]) {
if ([UserService currentUser].security_code.length != SecurityCodeLength) {
// [sender setOn:NO animated:NO];
[AlertInputView showWithTitle:@"设置密码" content:nil maxLength:SecurityCodeLength action:^BOOL(NSString * _Nonnull content) {
if (content.length != SecurityCodeLength) {
[ToastUtil showToast:[NSString stringWithFormat:@"请输入%lu位数字", (unsigned long)SecurityCodeLength] position:CSToastPositionTop];
return NO;
}
[UserService updateUserSecurityToRemote:@{
@"security_code" : content ?: @"",
@"is_security_on" : @(1),
} completion:^(id _Nullable rsp, NSError * _Nullable error) {
if (error) {
// [sender setOn:NO animated:YES];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[SVProgressHUD showErrorWithStatus:[error.userInfo objectForKey:@"message"]];
});
return;
} else { //
// [sender setOn:YES animated:YES];
[UserService currentUser].security_code = content;
[UserService currentUser].is_security_on = 1;
[self reloadData];
}
}];
return YES;
}];
return;
}else{
// [sender setOn:NO animated:NO];
[UserService updateUserSecurityToRemote:@{
@"security_code" : [UserService currentUser].security_code,
@"is_security_on" : @(1),
} completion:^(id _Nullable rsp, NSError * _Nullable error) {
if (error) {
// [sender setOn:NO animated:YES];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[SVProgressHUD showErrorWithStatus:[error.userInfo objectForKey:@"message"]];
});
return;
} else { //
[UserService currentUser].is_security_on = 1;
int status2 = [UserService currentUser].is_security_on;
[self reloadData];
// [sender setOn:YES animated:YES];
}
}];
}
} else {
[UserService updateUserSecurityToRemote:@{
@"security_code" : [UserService currentUser].security_code,
@"is_security_on" : @(0),
} completion:^(id _Nullable rsp, NSError * _Nullable error) {
if (error) {
// [sender setOn:YES animated:YES];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[SVProgressHUD showErrorWithStatus:[error.userInfo objectForKey:@"message"]];
});
return;
} else { //
[UserService currentUser].is_security_on = 0;
[self reloadData];
// [sender setOn:NO animated:YES];
}
}];
}
};
}];
[config resetCellConfigForSection:0 row:5 config:^(MTCommonListTableCellConfig *cellConfig) {
cellConfig.cellAction = ^(MTCommonListTableViewController *tableViewController, NSIndexPath *indexPath, MTCommonListTableCellConfig *cellConfig) {
[PYAppService pushViewControllerAnimated:[ChangePhoneViewController new]];
};
}];
[config resetCellConfigForSection:1 row:0 config:^(MTCommonListTableCellConfig *cellConfig) {
cellConfig.cellAction = ^(MTCommonListTableViewController *tableViewController, NSIndexPath *indexPath, MTCommonListTableCellConfig *cellConfig) {
[PYAppService pushViewControllerAnimated:[BlackListViewController new]];

View File

@ -75,6 +75,7 @@ typedef NS_ENUM(int, VIPKind) {
@property (nonatomic, copy) NSString *intro;
@property (nonatomic, copy) NSString *vip_time;
@property (nonatomic, copy) NSString *cover_img;
@property (nonatomic, copy) NSString *vip_exp_date;
@property (nonatomic, copy) NSString *nickname;
@property (nonatomic, copy) NSString *phone;
@property (nonatomic, copy) NSString *province;