首页UI首页UI

This commit is contained in:
liyuhua
2024-03-01 21:03:59 +08:00
parent c8072c650b
commit 268a80f27b
53 changed files with 1179 additions and 53 deletions

View File

@@ -26,6 +26,14 @@
2311D6C42B917619001C70AB /* HomeVoiceRecordView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2311D6C32B917619001C70AB /* HomeVoiceRecordView.swift */; };
2311D6C62B917949001C70AB /* HomeVoiceRecordBtnView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2311D6C52B917949001C70AB /* HomeVoiceRecordBtnView.swift */; };
2311D6CB2B91BBF2001C70AB /* RecordVoiceManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 2311D6CA2B91BBF2001C70AB /* RecordVoiceManager.m */; };
2311D6CF2B91D35E001C70AB /* UserPayViewItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2311D6CE2B91D35E001C70AB /* UserPayViewItemView.swift */; };
2311D6D12B91DDDF001C70AB /* UserPayViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2311D6D02B91DDDF001C70AB /* UserPayViewModel.swift */; };
2311D6D52B91E732001C70AB /* UserPayViewManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2311D6D42B91E732001C70AB /* UserPayViewManager.swift */; };
2311D6D72B91EF62001C70AB /* PlanetStarPopUpView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2311D6D62B91EF62001C70AB /* PlanetStarPopUpView.swift */; };
2311D6D92B920442001C70AB /* yinLogo.png in Resources */ = {isa = PBXBuildFile; fileRef = 2311D6D82B920442001C70AB /* yinLogo.png */; };
2311D6DB2B920478001C70AB /* textLogo.png in Resources */ = {isa = PBXBuildFile; fileRef = 2311D6DA2B920478001C70AB /* textLogo.png */; };
2311D6DD2B9204EF001C70AB /* logoBg.png in Resources */ = {isa = PBXBuildFile; fileRef = 2311D6DC2B9204EF001C70AB /* logoBg.png */; };
2311D6DF2B9207AA001C70AB /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2311D6DE2B9207AA001C70AB /* StoreKit.framework */; };
233E515B2B8C849600582F9C /* PlanetStarClickItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 233E515A2B8C849600582F9C /* PlanetStarClickItemView.swift */; };
25C63BC8F805551E8754E409 /* Pods_yinmeng_ios.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2F175918AD0811681497739 /* Pods_yinmeng_ios.framework */; };
E81A7BAE2B885B20009E736E /* Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = E81A7BAA2B885B20009E736E /* Base64.m */; };
@@ -118,6 +126,14 @@
2311D6C52B917949001C70AB /* HomeVoiceRecordBtnView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeVoiceRecordBtnView.swift; sourceTree = "<group>"; };
2311D6C92B91BBF2001C70AB /* RecordVoiceManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RecordVoiceManager.h; sourceTree = "<group>"; };
2311D6CA2B91BBF2001C70AB /* RecordVoiceManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RecordVoiceManager.m; sourceTree = "<group>"; };
2311D6CE2B91D35E001C70AB /* UserPayViewItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserPayViewItemView.swift; sourceTree = "<group>"; };
2311D6D02B91DDDF001C70AB /* UserPayViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserPayViewModel.swift; sourceTree = "<group>"; };
2311D6D42B91E732001C70AB /* UserPayViewManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserPayViewManager.swift; sourceTree = "<group>"; };
2311D6D62B91EF62001C70AB /* PlanetStarPopUpView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlanetStarPopUpView.swift; sourceTree = "<group>"; };
2311D6D82B920442001C70AB /* yinLogo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = yinLogo.png; sourceTree = "<group>"; };
2311D6DA2B920478001C70AB /* textLogo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = textLogo.png; sourceTree = "<group>"; };
2311D6DC2B9204EF001C70AB /* logoBg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = logoBg.png; sourceTree = "<group>"; };
2311D6DE2B9207AA001C70AB /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; };
233E515A2B8C849600582F9C /* PlanetStarClickItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlanetStarClickItemView.swift; sourceTree = "<group>"; };
A9FB906EB4D17C552C15A2B3 /* Pods-yinmeng-ios.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-yinmeng-ios.debug.xcconfig"; path = "Target Support Files/Pods-yinmeng-ios/Pods-yinmeng-ios.debug.xcconfig"; sourceTree = "<group>"; };
B2F175918AD0811681497739 /* Pods_yinmeng_ios.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_yinmeng_ios.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -203,6 +219,7 @@
buildActionMask = 2147483647;
files = (
25C63BC8F805551E8754E409 /* Pods_yinmeng_ios.framework in Frameworks */,
2311D6DF2B9207AA001C70AB /* StoreKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -212,7 +229,10 @@
2311D6B82B908CDB001C70AB /* Pay */ = {
isa = PBXGroup;
children = (
2311D6D42B91E732001C70AB /* UserPayViewManager.swift */,
2311D6B92B908D01001C70AB /* UserPayViewController.swift */,
2311D6CE2B91D35E001C70AB /* UserPayViewItemView.swift */,
2311D6D02B91DDDF001C70AB /* UserPayViewModel.swift */,
);
path = Pay;
sourceTree = "<group>";
@@ -229,6 +249,7 @@
7F3805D681FD5B5B4DC3C5F5 /* Frameworks */ = {
isa = PBXGroup;
children = (
2311D6DE2B9207AA001C70AB /* StoreKit.framework */,
B2F175918AD0811681497739 /* Pods_yinmeng_ios.framework */,
);
name = Frameworks;
@@ -451,6 +472,9 @@
E86A43A72B85DF7A0084C04D /* Base */,
E884E85E2B6900C500ADE6EE /* AppDelegate.swift */,
E884E8642B6900C500ADE6EE /* Main.storyboard */,
2311D6DC2B9204EF001C70AB /* logoBg.png */,
2311D6D82B920442001C70AB /* yinLogo.png */,
2311D6DA2B920478001C70AB /* textLogo.png */,
2311D6BF2B90A221001C70AB /* RecordPlayer.svga */,
2311D6BD2B90A1E9001C70AB /* PublishVoice.svga */,
2311D6A02B8DD649001C70AB /* StarIcon.svga */,
@@ -507,6 +531,7 @@
E8D15AB22B8B000400369467 /* PlanetStarVC.swift */,
2311D69C2B8DC311001C70AB /* PlanetStarModel.swift */,
233E515A2B8C849600582F9C /* PlanetStarClickItemView.swift */,
2311D6D62B91EF62001C70AB /* PlanetStarPopUpView.swift */,
);
path = Star;
sourceTree = "<group>";
@@ -677,12 +702,15 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2311D6D92B920442001C70AB /* yinLogo.png in Resources */,
E884E86B2B6900C600ADE6EE /* LaunchScreen.storyboard in Resources */,
2311D6BE2B90A1E9001C70AB /* PublishVoice.svga in Resources */,
2311D6A52B8F0E06001C70AB /* StarGift.svga in Resources */,
E884E8682B6900C600ADE6EE /* Assets.xcassets in Resources */,
2311D6C02B90A221001C70AB /* RecordPlayer.svga in Resources */,
E884E8662B6900C500ADE6EE /* Main.storyboard in Resources */,
2311D6DD2B9204EF001C70AB /* logoBg.png in Resources */,
2311D6DB2B920478001C70AB /* textLogo.png in Resources */,
2311D6A12B8DD649001C70AB /* StarIcon.svga in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -744,6 +772,7 @@
E89F19AF2B91C00F0098E797 /* BindMobileVC.swift in Sources */,
E86A43B02B85E11B0084C04D /* BaseNavigationViewController.swift in Sources */,
E86A43E82B884C5E0084C04D /* String+.swift in Sources */,
2311D6D12B91DDDF001C70AB /* UserPayViewModel.swift in Sources */,
2311D6B12B9062A3001C70AB /* HomeVoiceFollowCell.swift in Sources */,
E8D15AA32B89B03D00369467 /* Deserialized.swift in Sources */,
E8E4AAB72B8F95CA0096D77C /* AuthAppleManager.swift in Sources */,
@@ -756,6 +785,7 @@
2311D6AB2B9024A9001C70AB /* HomeVoicePlayMusicItemView.swift in Sources */,
E8D15AA62B89B0C600369467 /* List+.swift in Sources */,
E81A7BAE2B885B20009E736E /* Base64.m in Sources */,
2311D6D72B91EF62001C70AB /* PlanetStarPopUpView.swift in Sources */,
E8479E462B8DD5BF009AF878 /* Date+.swift in Sources */,
E81A7BB22B886299009E736E /* HUDTool.swift in Sources */,
E8E4AAB52B8F8E3A0096D77C /* AuthItmeButton.swift in Sources */,
@@ -806,8 +836,10 @@
2311D6A72B8F2CFA001C70AB /* HomeVoiceChooseItemVeiw.swift in Sources */,
E8D15AB02B8AFFCE00369467 /* HomeVoiceVC.swift in Sources */,
E8E4AB282B902A9C0096D77C /* ChatListCell.swift in Sources */,
2311D6D52B91E732001C70AB /* UserPayViewManager.swift in Sources */,
E86A43D52B8774B70084C04D /* AuthViewModel.swift in Sources */,
E89F19472B9197090098E797 /* ChatTimeCell.swift in Sources */,
2311D6CF2B91D35E001C70AB /* UserPayViewItemView.swift in Sources */,
E8D15AB32B8B000400369467 /* PlanetStarVC.swift in Sources */,
E8FF28B62B90ED6C005D2BE7 /* ChatNavView.swift in Sources */,
E8D15A9D2B899E1500369467 /* YMNetworkHelper.swift in Sources */,
@@ -971,13 +1003,14 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 7684Q29X5F;
DEVELOPMENT_TEAM = 48UCG35Q9W;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "yinmeng-ios/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = "音萌";
INFOPLIST_KEY_NSCameraUsageDescription = "“音萌”需要您的同意,才可以访问进行拍照,才可以在聊天中分享图片给他人查看,或上传图片以更新头像";
INFOPLIST_KEY_NSMicrophoneUsageDescription = "\"音萌\"需要您的同意,才可以进行语音聊天";
INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "“音萌”需要您的同意,才可以存储相片到相册";
INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "“音萌”需要您的同意,才可以访问相册并选择图片,然后在聊天中分享图片给他人查看,或上传图片以更新头像";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
@@ -989,7 +1022,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = "yinmeng.yinmeng-ios";
PRODUCT_BUNDLE_IDENTIFIER = "linyudan.yinmeng-ios";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "yinmeng-ios/Base/Security/yinmeng-ios-Bridging-Header.h";
@@ -1010,13 +1043,14 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 7684Q29X5F;
DEVELOPMENT_TEAM = 48UCG35Q9W;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "yinmeng-ios/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = "音萌";
INFOPLIST_KEY_NSCameraUsageDescription = "“音萌”需要您的同意,才可以访问进行拍照,才可以在聊天中分享图片给他人查看,或上传图片以更新头像";
INFOPLIST_KEY_NSMicrophoneUsageDescription = "\"音萌\"需要您的同意,才可以进行语音聊天";
INFOPLIST_KEY_NSPhotoLibraryAddUsageDescription = "“音萌”需要您的同意,才可以存储相片到相册";
INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "“音萌”需要您的同意,才可以访问相册并选择图片,然后在聊天中分享图片给他人查看,或上传图片以更新头像";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
@@ -1028,7 +1062,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = "yinmeng.yinmeng-ios";
PRODUCT_BUNDLE_IDENTIFIER = "linyudan.yinmeng-ios";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "yinmeng-ios/Base/Security/yinmeng-ios-Bridging-Header.h";

View File

@@ -1,11 +0,0 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

View File

@@ -1,6 +1,7 @@
{
"images" : [
{
"filename" : "1024 3.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 940 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 710 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 734 B

After

Width:  |  Height:  |  Size: 733 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
@@ -11,15 +14,60 @@
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="logoBg.png" translatesAutoresizingMaskIntoConstraints="NO" id="P32-ym-lLx">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="yinLogo.png" translatesAutoresizingMaskIntoConstraints="NO" id="wew-at-6Gy">
<rect key="frame" x="150.33333333333334" y="218.33333333333334" width="92.333333333333343" height="101.33333333333334"/>
<constraints>
<constraint firstAttribute="width" secondItem="wew-at-6Gy" secondAttribute="height" multiplier="10:11" id="Dey-fH-IHd"/>
</constraints>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="textLogo.png" translatesAutoresizingMaskIntoConstraints="NO" id="yDg-LF-18t">
<rect key="frame" x="66.666666666666686" y="394.66666666666669" width="259.99999999999994" height="23"/>
<constraints>
<constraint firstAttribute="height" constant="23" id="Hri-I0-bSi"/>
<constraint firstAttribute="width" constant="260" id="W9f-o8-Ce0"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="音萌" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZzI-AV-XXl">
<rect key="frame" x="160.33333333333334" y="331.66666666666669" width="72.666666666666657" height="43"/>
<fontDescription key="fontDescription" type="system" weight="heavy" pointSize="36"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="ZzI-AV-XXl" firstAttribute="top" secondItem="wew-at-6Gy" secondAttribute="bottom" constant="12" id="2Aa-PR-QFQ"/>
<constraint firstItem="P32-ym-lLx" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="A1t-Sc-PLp"/>
<constraint firstAttribute="bottom" secondItem="P32-ym-lLx" secondAttribute="bottom" id="CHT-z3-yq3"/>
<constraint firstItem="yDg-LF-18t" firstAttribute="top" secondItem="ZzI-AV-XXl" secondAttribute="bottom" constant="20" id="GwY-92-4j9"/>
<constraint firstItem="wew-at-6Gy" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="Hgt-J0-vRD"/>
<constraint firstItem="yDg-LF-18t" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="IRV-Aw-i4Y"/>
<constraint firstItem="wew-at-6Gy" firstAttribute="width" secondItem="Ze5-6b-2t3" secondAttribute="width" multiplier="88/375" id="JzU-U9-l48"/>
<constraint firstItem="P32-ym-lLx" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="Te1-6K-LKS"/>
<constraint firstItem="ZzI-AV-XXl" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="fLz-b0-u7S"/>
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="P32-ym-lLx" secondAttribute="trailing" id="n4y-6G-Atm"/>
<constraint firstItem="wew-at-6Gy" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="208/812" id="vNC-Os-z8z"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
<point key="canvasLocation" x="52.671755725190835" y="374.64788732394368"/>
</scene>
</scenes>
<resources>
<image name="logoBg.png" width="1125" height="2436"/>
<image name="textLogo.png" width="780" height="69"/>
<image name="yinLogo.png" width="264" height="264"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>

View File

@@ -11,4 +11,5 @@ enum H5Utils:String {
case privacy = "modules/rule/privacy-wap.html"
case user = "modules/rule/protocol.html"
case logoff = "modules/logout/index.html"
case pay = "mew/modules/rule/rechargeAgreement.html"
}

View File

@@ -2,14 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPhotoLibraryUsageDescription</key>
<string>“音萌”需要您的同意,才可以访问相册并选择图片,然后在聊天中分享图片给他人查看,或上传图片以更新头像</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>“音萌”需要您的同意,才可以存储相片到相册</string>
<key>NSMicrophoneUsageDescription</key>
<string>&quot;音萌&quot;需要您的同意,才可以进行语音聊天</string>
<key>NSCameraUsageDescription</key>
<string>“音萌”需要您的同意,才可以访问进行拍照,才可以在聊天中分享图片给他人查看,或上传图片以更新头像</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>

View File

@@ -15,9 +15,73 @@ class HomeVoiceGuideView: UIView {
}
func setUILayout(){
backgroundColor = UIColor.init(white: 0, alpha: 0.5)
addSubview(imageView)
addSubview(arrowVeiw)
addSubview(bgTextVeiw)
bgTextVeiw.addSubview(textView)
addSubview(clickBtn)
imageView.snp.makeConstraints { make in
make.width.equalTo(124)
make.height.equalTo(106)
make.left.equalTo(64)
make.top.equalTo(480)
}
arrowVeiw.snp.makeConstraints { make in
make.width.equalTo(26)
make.height.equalTo(66)
make.left.equalTo(153)
make.top.equalTo(self.imageView.snp.bottom).offset(15)
}
bgTextVeiw.snp.makeConstraints { make in
make.centerY.equalTo(self.arrowVeiw)
make.left.equalTo(self.arrowVeiw.snp.right)
make.width.equalTo(148)
make.height.equalTo(66)
}
textView.snp.makeConstraints { make in
make.top.equalTo(2)
make.left.right.bottom.equalTo(self.bgTextVeiw)
}
clickBtn.snp.makeConstraints { make in
make.edges.equalTo(self)
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
@objc func clickBtnAction(){
self.removeFromSuperview()
}
var clickBtn:UIButton = {
let _clickBtn = UIButton()
_clickBtn.addTarget(self, action: #selector(clickBtnAction), for: .touchUpInside)
return _clickBtn
}()
var imageView:UIImageView = {
let _imageView = UIImageView()
_imageView.image = UIImage(named: "yin_home_voice_guide_icon")
return _imageView
}()
var arrowVeiw:UIImageView = {
let _arrowVeiw = UIImageView()
_arrowVeiw.image = UIImage(named: "yin_home_voice_guide_arrow")
return _arrowVeiw
}()
var bgTextVeiw:UIImageView = {
let _bgTextVeiw = UIImageView()
let image = UIImage.image(color: ThemeColor(hexStr: "#6A60FF"), size: CGSize(width: 148, height: 66), corners: [.topRight,.bottomRight], radius: 10)
_bgTextVeiw.image = image
return _bgTextVeiw
}()
var textView:UILabel = {
let _textView = UILabel()
_textView.numberOfLines = 2
_textView.textColor = .white
_textView.text = "选择感兴趣的声音\n拖动至唱片机播放"
_textView.font = UIFont.systemFont(ofSize: 14, weight: .medium)
return _textView
}()
}

View File

@@ -17,6 +17,10 @@ class HomeVoiceVC: BaseViewController,HiddenNavigationBarProtocol {
requestData()
requsetFansListData()
userInfoBtn.addTarget(self, action: #selector(userInfoBtnAction), for: .touchUpInside)
if (UserDefaults.standard.value(forKey:"kIsShowGuide") != nil){return}
UserDefaults.standard.setValue("yes", forKey: "kIsShowGuide")
let guideVeiw = HomeVoiceGuideView.init(frame: CGRect(x: 0, y: 0, width: ScreenWidth, height: ScreenHeight))
UIApplication.shared.keyWindow?.addSubview(guideVeiw)
}
@objc func userInfoBtnAction(){
let userInfoView:HomeVoiceUserInfoView = HomeVoiceUserInfoView.init(frame: .zero)

View File

@@ -6,16 +6,333 @@
//
import UIKit
import MBProgressHUD
class UserPayViewController: BaseViewController, HiddenNavigationBarProtocol{
var chooseModel:UserPayViewModel?
var orderId = ""
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
setUILayout()
requestData()
NotificationCenter.default.addObserver(self, selector: #selector(receiveInitiatePaymentNot(not:)), name: NSNotification.Name(rawValue: "kInitiatePayment"), object: nil)
}
@objc func receiveInitiatePaymentNot(not:Notification) async{
if let _data = not.userInfo,let transactionId = _data["transactionId"] as? String{
if #available(iOS 15.0, *) {
try? await UserPayViewManager.shared._verifyBusinessAccomplish(transaction: transactionId)
}
self.orderId = ""
RequestGet(path: "purse/query", parma: ["channelType":"8"]) { data in
if let model = Deserialized<UserPayViewModel>.toModel(with: data) {
self.pricView.text = model.diamonds
}
} fail: { code, data in
print(code)
}
return
}
if let _data = not.userInfo,let recordId = _data["recordId"] as? String,let appAccountToken = _data["appAccountToken"] as? String{
try? await self.initiatePaymentAction(recordId: recordId, appAccountToken: appAccountToken)
}
}
func requestData(){
RequestGet(path: "chargeprod/list", parma: ["channelType":"8"]) { data in
if let list = Deserialized<UserPayViewModel>.toArray(with: data) {
for (i,view) in self.viewList.enumerated() {
if i < list.count{
view.model = list[i]
self.chooseModel = list[0]
view.isHidden = false
}else{
view.isHidden = true
}
}
}
} fail: { code, data in
print(code)
}
RequestGet(path: "purse/query", parma: ["channelType":"8"]) { data in
if let model = Deserialized<UserPayViewModel>.toModel(with: data) {
self.pricView.text = model.diamonds
}
} fail: { code, data in
print(code)
}
}
@objc func clickPriceItemAction(tap:UITapGestureRecognizer){
for view in viewList {
if tap.view == view{
view.layer.borderWidth = 2
self.chooseModel = view.model
}else{
view.layer.borderWidth = 0
}
}
}
@objc func lookUpTap(){
let web = WebViewController(url: "/\(H5Utils.pay.rawValue)")
self.navigationController?.pushViewController(web, animated: true)
}
func setUILayout(){
view.addSubview(backgroundView)
view.addSubview(scrollView)
view.addSubview(backBtn)
scrollView.addSubview(headBgView)
headBgView.addSubview(iconView)
headBgView.addSubview(textVeiw)
headBgView.addSubview(pricView)
scrollView.addSubview(itemVeiw1)
scrollView.addSubview(itemVeiw2)
scrollView.addSubview(itemVeiw3)
scrollView.addSubview(itemVeiw4)
scrollView.addSubview(payAgreement)
scrollView.addSubview(publishBtn)
viewList.append(itemVeiw1)
viewList.append(itemVeiw2)
viewList.append(itemVeiw3)
viewList.append(itemVeiw4)
for (i,view) in viewList.enumerated() {
view.tag = i + 100
let tap = UITapGestureRecognizer.init(target: self, action: #selector(clickPriceItemAction(tap:)))
view.addGestureRecognizer(tap)
}
let lookUpTap = UITapGestureRecognizer.init(target: self, action: #selector(lookUpTap))
payAgreement.addGestureRecognizer(lookUpTap)
scrollView.snp.makeConstraints { make in
make.edges.equalTo(self.view)
}
backgroundView.snp.makeConstraints { make in
make.edges.equalTo(self.view)
}
backBtn.snp.makeConstraints { make in
make.width.height.equalTo(30)
make.left.equalTo(16)
make.top.equalTo(StatusBarHeight + 12)
}
headBgView.snp.makeConstraints { make in
make.top.equalTo(self.backBtn.snp.bottom).offset(41)
make.width.equalTo(337)
make.centerX.equalTo(self.view)
make.height.equalTo(124)
}
iconView.snp.makeConstraints { make in
make.centerX.equalTo(self.headBgView).offset(-11)
make.width.height.equalTo(22)
make.top.equalTo(27)
}
textVeiw.snp.makeConstraints { make in
make.left.equalTo(self.iconView.snp.right).offset(6)
make.centerY.equalTo(self.iconView)
}
pricView.snp.makeConstraints { make in
make.top.equalTo(51)
make.centerX.equalTo(self.view)
}
itemVeiw1.snp.makeConstraints { make in
make.left.equalTo(self.headBgView.snp.left).offset(13)
make.width.equalTo(144)
make.height.equalTo(83)
make.top.equalTo(self.headBgView.snp.bottom).offset(19)
}
itemVeiw2.snp.makeConstraints { make in
make.left.equalTo(self.itemVeiw1.snp.right).offset(23)
make.width.equalTo(144)
make.height.equalTo(83)
make.top.equalTo(self.headBgView.snp.bottom).offset(19)
}
itemVeiw3.snp.makeConstraints { make in
make.left.equalTo(self.headBgView.snp.left).offset(13)
make.width.equalTo(144)
make.height.equalTo(83)
make.top.equalTo(self.itemVeiw1.snp.bottom).offset(20)
}
itemVeiw4.snp.makeConstraints { make in
make.left.equalTo(self.itemVeiw2)
make.width.equalTo(144)
make.height.equalTo(83)
make.top.equalTo(self.itemVeiw1.snp.bottom).offset(20)
}
payAgreement.snp.makeConstraints { make in
make.left.right.equalTo(self.view)
make.top.equalTo(self.itemVeiw4.snp.bottom).offset(40)
}
publishBtn.snp.makeConstraints { make in
make.width.equalTo(296)
make.height.equalTo(48)
make.centerX.equalTo(self.view)
make.top.equalTo(self.payAgreement.snp.bottom).offset(161)
}
publishBtn.superview?.layoutIfNeeded()
let y = publishBtn.y + publishBtn.frame.height
self.scrollView.contentSize = CGSize(width: ScreenWidth, height: y)
}
@objc func publishBtnAction(){
guard let chargeProdId = self.chooseModel?.chargeProdId else{
return
}
MBProgressHUD.showAdded(to: self.view, animated: true)
let uid = "\(AuthManager.userUid)"
let ticket = AuthManager.ticket
let deviceInfo = UIDevice.current.identifierForVendor?.uuidString ?? ""
let clientIp = "0.0.0.0"
RequestPost(path: "storeKitV2/placeOrder", parma: ["chargeProdId":chargeProdId,"uid":uid,"ticket":ticket,"deviceInfo":deviceInfo]) { data in
if let _data = data as? [String : Any]{
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "kInitiatePayment"), object: nil, userInfo: _data)
}
} fail: { code, data in
MBProgressHUD.hide(for: self.view, animated: true)
}
}
deinit{
NotificationCenter.default.removeObserver(self)
}
func initiatePaymentAction(recordId:String,appAccountToken:String)async throws{
self.orderId = recordId
if #available(iOS 15.0, *) {
try await UserPayViewManager.shared._demandCommodityThing(productId: recordId, uuid: appAccountToken)
UserPayViewManager.shared._ConditionBlock = {[weak self] (state , result) in
if state == .Pay || state == .Start || state == .VerifiedServer{
}else if state == .Unowned{
HUDTool.show(with: "出现未知错误,请重新尝试")
}else{
HUDTool.show(with: "购买失败")
}
if state == .VerifiedServer{
if let transactionId = result?["transactionId"] as? String{
self?.paySuccess(transactionId: transactionId)
}
}
}
} else {
HUDTool.show(with: "充值失败。当前仅支持运行iOS15及以上系统的手机进行充值请升级系统版本后重试。")
}
}
func paySuccess(transactionId:String){
let uid = "\(AuthManager.userUid)"
let ticket = AuthManager.ticket
RequestPost(path: "storeKitV2/verifyOrder", parma: ["chooseEnv":"true","uid":uid,"ticket":ticket,"transcationId":transactionId]) { data in
MBProgressHUD.hide(for: self.view, animated: true)
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "kInitiatePayment"), object: nil, userInfo: ["transactionId":transactionId])
} fail: { code, data in
if code == 1444{
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "kInitiatePayment"), object: nil, userInfo: ["transactionId":transactionId])
}
MBProgressHUD.hide(for: self.view, animated: true)
}
}
@objc func backBtnAction(){
self.navigationController?.popViewController(animated: true)
}
var scrollView:UIScrollView = {
let _scrollView = UIScrollView()
_scrollView.backgroundColor = .clear
return _scrollView
}()
var backBtn:UIButton = {
let _backBtn = UIButton()
_backBtn.setImage(UIImage(named: "yin_user_pay_arrow"), for: .normal)
_backBtn.addTarget(self, action: #selector(backBtnAction), for: .touchUpInside)
return _backBtn
}()
private lazy var backgroundView:UIImageView = {
let _backgroundView = UIImageView()
_backgroundView.image = UIImage(named: "yin_user_pay_bg")
_backgroundView.isUserInteractionEnabled = true
return _backgroundView
}()
var headBgView:UIImageView = {
let _headBgView = UIImageView()
_headBgView.image = UIImage(named: "yin_user_pay_head_bg")
return _headBgView
}()
var iconView:UIImageView = {
let _iconView = UIImageView()
_iconView.image = UIImage(named: "yin_user_pay_icon")
return _iconView
}()
var textVeiw:UILabel = {
let _textVeiw = UILabel()
_textVeiw.text = "余额"
_textVeiw.font = UIFont.systemFont(ofSize: 18, weight: .regular)
_textVeiw.textColor = .white
return _textVeiw
}()
var pricView: UILabel = {
let _pricView = UILabel()
_pricView.text = "0"
_pricView.textColor = .white
_pricView.font = UIFont.systemFont(ofSize: 34, weight: .semibold)
return _pricView
}()
var viewList:[UserPayViewItemView] = []
var itemVeiw1:UserPayViewItemView = {
let _itemVeiw1 = UserPayViewItemView.init(frame:.zero)
_itemVeiw1.layer.borderWidth = 2
return _itemVeiw1
}()
var itemVeiw2:UserPayViewItemView = {
let _itemVeiw2 = UserPayViewItemView.init(frame:.zero)
return _itemVeiw2
}()
var itemVeiw3:UserPayViewItemView = {
let _itemVeiw3 = UserPayViewItemView.init(frame:.zero)
return _itemVeiw3
}()
var itemVeiw4:UserPayViewItemView = {
let _itemVeiw4 = UserPayViewItemView.init(frame:.zero)
return _itemVeiw4
}()
var payAgreement:UILabel = {
let _payAgreement = UILabel()
let text = "已阅读并同意《用户充值协议》\n如有任何问题请咨询客服"
let attText = NSMutableAttributedString.init(string: text, attributes: [.foregroundColor:ThemeColor(hexStr: "#FFFFFF",alpha: 0.8),.font:UIFont.systemFont(ofSize: 13, weight: .regular)])
attText.addAttributes([.foregroundColor:ThemeColor(hexStr: "#5DA4F5"),.font:UIFont.systemFont(ofSize: 13, weight: .regular)], range: NSRange(location: 6, length: 8))
_payAgreement.textAlignment = .center
_payAgreement.attributedText = attText
_payAgreement.numberOfLines = 2
_payAgreement.isUserInteractionEnabled = true
return _payAgreement
}()
var publishBtn:UIButton = {
let _publishBtn = UIButton()
_publishBtn.setBackgroundImage(UIImage(named: "yin_hoem_voice_record_publish_btn"), for: .normal)
_publishBtn.setTitle("立即充值", for: .normal)
_publishBtn.setTitleColor(.white, for: .normal)
_publishBtn.titleLabel?.font = UIFont.systemFont(ofSize: 16, weight: .semibold)
_publishBtn.addTarget(self, action: #selector(publishBtnAction), for: .touchUpInside)
return _publishBtn
}()
}

View File

@@ -0,0 +1,77 @@
//
// UserPayViewItemView.swift
// yinmeng-ios
//
// Created by duoban on 2024/3/1.
//
import UIKit
class UserPayViewItemView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
setUILayout()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
var model:UserPayViewModel? = nil {
didSet{
guard let _model = model else{return}
numVeiw.text = _model.prodName
priceView.text = "\(_model.money)"
}
}
func setUILayout(){
self.layer.cornerRadius = 8
self.backgroundColor = ThemeColor(hexStr: "#525566", alpha: 0.8)
self.layer.masksToBounds = true
self.layer.borderColor = ThemeColor(hexStr: "9552FF").cgColor
addSubview(iconView)
addSubview(numVeiw)
addSubview(priceView)
iconView.snp.makeConstraints { make in
make.width.height.equalTo(20)
make.left.equalTo(24)
make.top.equalTo(16)
}
numVeiw.snp.makeConstraints { make in
make.left.equalTo(50)
make.top.equalTo(14)
}
priceView.snp.makeConstraints { make in
make.top.equalTo(49)
make.left.right.equalTo(self)
}
}
var iconView:UIImageView = {
let _iconView = UIImageView()
_iconView.image = UIImage(named: "yin_user_pay_icon")
return _iconView
}()
var numVeiw:UILabel = {
let _numVeiw = UILabel()
_numVeiw.text = "0钻石"
_numVeiw.textColor = .white
_numVeiw.font = UIFont.systemFont(ofSize: 18, weight: .medium)
return _numVeiw
}()
var priceView:UILabel = {
let _priceView = UILabel()
_priceView.textColor = ThemeColor(hexStr: "#FFFFFF")
_priceView.text = "0元"
_priceView.font = UIFont.systemFont(ofSize: 14, weight: .regular)
_priceView.textAlignment = .center
return _priceView
}()
}

View File

@@ -0,0 +1,247 @@
//
// UserPayViewManager.swift
// yinmeng-ios
//
// Created by duoban on 2024/3/1.
//
import UIKit
import StoreKit
@available(iOS 15.0, *)
typealias Transaction = StoreKit.Transaction
@available(iOS 15.0, *)
typealias RenewalInfo = StoreKit.Product.SubscriptionInfo.RenewalInfo
@available(iOS 15.0, *)
typealias RenewalState = StoreKit.Product.SubscriptionInfo.RenewalState
enum StoreError: Error {
//
case FailedVerification
case NoProduct
}
@objc public enum StoreConditionResult: Int64 { //
case Start //
case Pay //
case VerifiedServer //
case UserCancelled //
case Pending //
case Unowned
case NoProduct //
case FailedVerification //
}
@available(iOS 15.0, *)
public class UserPayViewManager: NSObject {
public typealias _KConditionBlock = (_ state :StoreConditionResult,_ param:Dictionary<String,Any>?) ->()
@objc public var _ConditionBlock: _KConditionBlock! //
var _updateListenerTask: Task<Void, Error>? = nil //
var _transactionMap :[String:Transaction] // Idmap
var _name: String = "" //
@objc public static let shared = {
let instance = UserPayViewManager()
return instance
}()
private override init() { // private
_transactionMap = [:] //
super.init()
Task {
_updateListenerTask = _listenForTransactions()
}
}
//
@objc public func _demandCommodityThing(productId:String, uuid: String) async throws {
if(_ConditionBlock != nil ){
_ConditionBlock(StoreConditionResult.Start,nil)
}
do {
let list:[String] = [productId]
let storeProducts = try await Product.products(for: Set.init(list))
if storeProducts.count > 0 {
try await _purchase(storeProducts[0],uuid)
}else {
print("iap: no found product")
if(_ConditionBlock != nil ){
_ConditionBlock(StoreConditionResult.NoProduct,nil)
}
throw StoreError.NoProduct //
}
} catch {
print("Failed product request from the App Store server: \(error)")
if(_ConditionBlock != nil ){
_ConditionBlock(StoreConditionResult.NoProduct,nil)
}
throw StoreError.NoProduct //
}
}
//
private func _purchase(_ product: Product, _ uuid: String) async throws -> Transaction? {
if(_ConditionBlock != nil ){
_ConditionBlock(StoreConditionResult.Pay,nil)
}
guard let curUUID = UUID.init(uuidString: uuid) else{
if(_ConditionBlock != nil ){
_ConditionBlock(StoreConditionResult.FailedVerification,nil)
}
return nil
}
let getUUID = Product.PurchaseOption.appAccountToken(curUUID)
let result = try await product.purchase(options: [getUUID])
switch result {
case .success(let verification): //
let transaction = try await _verifiedAndAccomplish(verification)
return transaction
case .userCancelled: //
if(_ConditionBlock != nil ){
_ConditionBlock(StoreConditionResult.UserCancelled,nil)
}
return nil
case .pending: //
if(_ConditionBlock != nil ){
_ConditionBlock(StoreConditionResult.Pending,nil)
}
return nil
default:
if(_ConditionBlock != nil ){
_ConditionBlock(StoreConditionResult.Unowned,nil)
}
return nil
}
}
//
func _checkVerified<T>(_ result: VerificationResult<T>) throws -> T {
//Check whether the JWS passes StoreKit verification.
switch result {
case .unverified:
//StoreKit parses the JWS, but it fails verification.
if(_ConditionBlock != nil ){
_ConditionBlock(StoreConditionResult.FailedVerification,nil)
}
throw StoreError.FailedVerification
case .verified(let safe):
//The result is verified. Return the unwrapped value.
print("iap: verified success")
return safe
}
}
// &
func _verifiedAndAccomplish(_ verification:VerificationResult<Transaction>) async throws -> Transaction?{
//Check whether the transaction is verified. If it isn't,
//this function rethrows the verification error.
let transaction = try _checkVerified(verification)
// ~~~
let transactionId = try verification.payloadValue.id
// map
let key = String(transactionId)
_transactionMap[key] = transaction
await _uploadServer(for: transactionId)
//
await transaction.finish()
print("iap: finish")
return transaction
}
/*All transactions
Latest transactions
Current entitlements
*/
func _getAllBusiness(transactionId:String) async {
let transactionIntId = UInt64(transactionId)
for await result in Transaction.all {
do {
let tran = try _checkVerified(result)
let resultId = try result.payloadValue.id
if transactionIntId == resultId {
await tran.finish()
break
}
} catch let error {
print("error:----\(error)")
}
}
//Transaction.latest(for: "pid")
}
//
@objc public func _verifyBusinessAccomplish(transaction:String) async{
if(_transactionMap[transaction] != nil){
await _transactionMap[transaction]!.finish()
_transactionMap.removeValue(forKey: transaction)
print("verifyBusinessFinish end")
}else {
await _getAllBusiness(transactionId: transaction)
}
}
@MainActor
func _uploadServer(for transactionId:UInt64) async {
let dic :Dictionary<String,Any> = ["transactionId":transactionId]
if(_ConditionBlock != nil ){
_ConditionBlock(StoreConditionResult.VerifiedServer,dic)
}
}
//
func _listenForTransactions() -> Task<Void, Error> {
return Task.detached {
//Iterate through any transactions that don't come from a direct call to `purchase()`.
// update unfinished?
for await result in Transaction.updates { //
do {
print("iap: updates")
print("result:\(result)")
try await self._verifiedAndAccomplish(result)
} catch {
//StoreKit has a transaction that fails verification. Don't deliver content to the user.
print("Transaction failed verification")
}
}
}
}
//
deinit {
_updateListenerTask?.cancel()
}
}

View File

@@ -0,0 +1,19 @@
//
// UserPayViewModel.swift
// yinmeng-ios
//
// Created by duoban on 2024/3/1.
//
import Foundation
import HandyJSON
struct UserPayViewModel: HandyJSON, Codable {
var chargeProdId = ""
var prodName = ""
var prodDesc = ""
var money = 0
var giftGoldNum = 0
var channel = ""
var diamonds = ""
}

View File

@@ -0,0 +1,160 @@
//
// PlanetStarPopUpView.swift
// yinmeng-ios
//
// Created by duoban on 2024/3/1.
//
import UIKit
typealias ClickSendBlcok = ()->Void
class PlanetStarPopUpView: UIView {
var clickSendBlcok:ClickSendBlcok?
override init(frame: CGRect) {
super.init(frame: frame)
setUILayout()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setUILayout(){
backgroundColor = UIColor.init(white: 0, alpha: 0.6)
addSubview(bgWhiteView)
bgWhiteView.addSubview(textView)
bgWhiteView.addSubview(cancelView)
bgWhiteView.addSubview(senderView)
bgWhiteView.addSubview(pointTextView)
bgWhiteView.addSubview(bgPointView)
bgPointView.addSubview(pointView)
bgWhiteView.addSubview(pointBtn)
bgWhiteView.snp.makeConstraints { make in
make.center.equalTo(self)
make.width.equalTo(319)
make.height.equalTo(200)
}
textView.snp.makeConstraints { make in
make.top.equalTo(35)
make.left.right.equalTo(self.bgWhiteView).inset(50)
}
cancelView.snp.makeConstraints { make in
make.width.equalTo(124)
make.height.equalTo(42)
make.top.equalTo(100)
make.left.equalTo(28)
}
senderView.snp.makeConstraints { make in
make.width.equalTo(124)
make.height.equalTo(42)
make.top.equalTo(100)
make.left.equalTo(self.cancelView.snp.right).offset(15)
}
pointTextView.snp.makeConstraints { make in
make.centerY.equalTo(self.bgPointView)
make.centerX.equalTo(self.bgWhiteView).offset(10)
}
bgPointView.snp.makeConstraints { make in
make.width.height.equalTo(12)
make.right.equalTo(self.pointTextView.snp.left).offset(-8)
make.top.equalTo(self.cancelView.snp.bottom).offset(27)
}
pointView.snp.makeConstraints { make in
make.width.height.equalTo(8)
make.center.equalTo(self.bgPointView)
}
pointBtn.snp.makeConstraints { make in
make.width.height.equalTo(30)
make.center.equalTo(self.bgPointView)
}
}
@objc func cancelViewAction(){
self.removeFromSuperview()
}
@objc func senderViewAction(){
cancelViewAction()
if let _clickSendBlcok = self.clickSendBlcok{
_clickSendBlcok()
}
}
@objc func pointBtnAction(){
self.pointView.isHidden = !self.pointView.isHidden
if self.pointBtn.isHidden == false{
UserDefaults.standard.setValue("YES", forKey: "kIsShowPopUp")
}else{
UserDefaults.standard.removeObject(forKey: "kIsShowPopUp")
}
}
var bgWhiteView:UIView = {
let _bgWhiteView = UIView()
_bgWhiteView.layer.cornerRadius = 22
_bgWhiteView.layer.masksToBounds = true
_bgWhiteView.backgroundColor = .white
return _bgWhiteView
}()
var textView:UILabel = {
let _textView = UILabel()
_textView.font = UIFont.systemFont(ofSize: 16, weight: .regular)
_textView.textColor = ThemeColor(hexStr: "#1F1B4F")
_textView.numberOfLines = 0
_textView.textAlignment = .center
return _textView
}()
var cancelView:UIButton = {
let _cancelView = UIButton()
_cancelView.setTitle("取消", for: .normal)
_cancelView.backgroundColor = ThemeColor(hexStr: "#D2D4D6")
_cancelView.titleLabel?.font = UIFont.systemFont(ofSize: 16, weight: .medium)
_cancelView.setTitleColor(.white, for: .normal)
_cancelView.layer.cornerRadius = 21
_cancelView.layer.masksToBounds = true
_cancelView.addTarget(self, action: #selector(cancelViewAction), for: .touchUpInside)
return _cancelView
}()
var senderView:UIButton = {
let _senderView = UIButton()
_senderView.setTitle("赠送", for: .normal)
_senderView.setBackgroundImage(UIImage(named: "yin_hoem_voice_record_publish_btn"), for: .normal)
_senderView.titleLabel?.font = UIFont.systemFont(ofSize: 16, weight: .medium)
_senderView.setTitleColor(.white, for: .normal)
_senderView.addTarget(self, action: #selector(senderViewAction), for: .touchUpInside)
_senderView.layer.cornerRadius = 21
_senderView.layer.masksToBounds = true
return _senderView
}()
var bgPointView:UIView = {
let _bgPointView = UIView()
_bgPointView.backgroundColor = ThemeColor(hexStr: "#9D9FA3")
_bgPointView.layer.cornerRadius = 6;
_bgPointView.layer.masksToBounds = true
return _bgPointView
}()
var pointView:UIView = {
let _pointView = UIView()
_pointView.backgroundColor = ThemeColor(hexStr: "#718CFF")
_pointView.layer.cornerRadius = 4;
_pointView.layer.masksToBounds = true
_pointView.layer.borderColor = UIColor.white.cgColor
_pointView.layer.borderWidth = 1
_pointView.isHidden = true
return _pointView
}()
var pointBtn:UIButton = {
let _pointBtn = UIButton()
_pointBtn.addTarget(self, action: #selector(pointBtnAction), for: .touchUpInside)
return _pointBtn
}()
var pointTextView:UILabel = {
let _pointTextView = UILabel()
_pointTextView.text = "今日不再提示"
_pointTextView.textColor = ThemeColor(hexStr: "#9D9FA3")
_pointTextView.font = UIFont.systemFont(ofSize: 12, weight: .regular)
return _pointTextView
}()
}

View File

@@ -89,11 +89,44 @@ class PlanetStarVC: BaseViewController,HiddenNavigationBarProtocol {
let giftName = self?.giftModel?.giftName ?? ""
let giftNum = self?.giftModel?.goldPrice ?? "0"
let text = "确认赠送 \(giftName)\(giftNum)钻石)给\(name)"
let alert = UIAlertController.init(title: "提示", message:text , preferredStyle: .alert)
alert.addAction(UIAlertAction.init(title: "取消", style: .cancel, handler: { action in
}))
alert.addAction(UIAlertAction.init(title: "确认", style: .default, handler: {[weak self] action in
guard UserDefaults.standard.value(forKey: "kIsShowPopUp") == nil else{
RequestGet(path: "special/gift/get", parma: ["targetId":_uid]) { data in
self?.activityView.removeFromSuperview()
if let _ = Deserialized<PlanetStarModel>.toModel(with: data) {
HUDTool.show(with: "送礼成功")
let imageView = UIImageView(frame: CGRect(x: ScreenWidth/2-50, y: -100, width: 0, height: 0))
Nuke.loadImage(with: self?.giftModel?.picUrl ?? "", into: imageView)
self?.view.addSubview(imageView)
UIView.animate(withDuration: 2) {
imageView.frame = CGRect(x: ScreenWidth/2-50, y: ScreenHeight/3 * 2, width: 100, height: 100)
}completion: { isC in
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
UIView.animate(withDuration: 1) {
let x = self?.bgRadiusView.imageView.frame.origin.x ?? 0
let y = self?.bgRadiusView.imageView.frame.origin.y ?? 0
imageView.frame = CGRect(x: x + 50, y: y + 50, width: 10, height: 10)
}completion: { isC in
imageView.removeFromSuperview()
}
}
}
}
} fail: { code, data in
self?.activityView.removeFromSuperview()
if code == 31005{
self?.showPayVC()
}
}
return
}
let popUpView = PlanetStarPopUpView.init(frame: CGRect(x: 0, y: 0, width: ScreenWidth, height: ScreenHeight))
self?.view.addSubview(popUpView)
popUpView.textView.text = text
popUpView.clickSendBlcok = {[weak self] in
self?.view.addSubview(self!.activityView)
RequestGet(path: "special/gift/get", parma: ["targetId":_uid]) { data in
self?.activityView.removeFromSuperview()
@@ -122,24 +155,31 @@ class PlanetStarVC: BaseViewController,HiddenNavigationBarProtocol {
} fail: { code, data in
self?.activityView.removeFromSuperview()
if code == 31005{
let alert = UIAlertController.init(title: "提示", message:"钻石余额不足" , preferredStyle: .alert)
alert.addAction(UIAlertAction.init(title: "取消", style: .cancel, handler: { action in
}))
alert.addAction(UIAlertAction.init(title: "确认", style: .default, handler: {[weak self] action in
let vc = UserPayViewController()
self?.navigationController?.pushViewController(vc, animated: true)
}))
self?.present(alert, animated: true)
self?.showPayVC()
}
}
}))
self?.present(alert, animated: true)
}
}
}
}
func showPayVC(){
let popUpView = PlanetStarPopUpView.init(frame: CGRect(x: 0, y: 0, width: ScreenWidth, height: ScreenHeight))
self.view.addSubview(popUpView)
popUpView.textView.text = "钻石余额不足"
popUpView.senderView.setTitle("去充值", for: .normal)
popUpView.bgPointView.isHidden = true
popUpView.pointTextView.isHidden = true
popUpView.clickSendBlcok = {[weak self] in
let vc = UserPayViewController()
self?.navigationController?.pushViewController(vc, animated: true)
}
}
let activityView:UIActivityIndicatorView = UIActivityIndicatorView(style: .medium)
var giftModel:PlanetStarModel?
private lazy var backgroundView:UIImageView = {

View File

@@ -165,7 +165,8 @@ extension UserInfoVC: UserFunctionViewProtocol{
func didClickItem(type: UserFunctionType) {
switch type {
case .recharge:
//TODO:
let vc = UserPayViewController()
self.navigationController?.pushViewController(vc, animated: true)
print("aaa")
case .mobile:
if self.info?.isBindPhone == true {

BIN
yinmeng-ios/logoBg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

BIN
yinmeng-ios/textLogo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
yinmeng-ios/yinLogo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB