Commit 582e0a94 authored by lmj_521aiau@163.com's avatar lmj_521aiau@163.com

goods

parent f016bd75
......@@ -33,6 +33,12 @@
A94DD57024FDF29700B1B5A2 /* XBAudioDataBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = A94DD55F24FDF29700B1B5A2 /* XBAudioDataBuffer.m */; };
A94DD57324FDF9D200B1B5A2 /* SHMp3RecordManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A94DD57224FDF9D200B1B5A2 /* SHMp3RecordManager.m */; };
A94DD57624FDFB4700B1B5A2 /* ExtAudioFileMixer.m in Sources */ = {isa = PBXBuildFile; fileRef = A94DD57524FDFB4700B1B5A2 /* ExtAudioFileMixer.m */; };
A94DD57924FE295300B1B5A2 /* SHMemberUpgradeAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = A94DD57824FE295300B1B5A2 /* SHMemberUpgradeAlertView.m */; };
A94DD57C24FE377100B1B5A2 /* AlertControllerTool.m in Sources */ = {isa = PBXBuildFile; fileRef = A94DD57A24FE377100B1B5A2 /* AlertControllerTool.m */; };
A94DD58124FE37DF00B1B5A2 /* UILabel+FontAppearance.m in Sources */ = {isa = PBXBuildFile; fileRef = A94DD57E24FE37DF00B1B5A2 /* UILabel+FontAppearance.m */; };
A94DD58224FE37DF00B1B5A2 /* UITextField+LimitLength.m in Sources */ = {isa = PBXBuildFile; fileRef = A94DD57F24FE37DF00B1B5A2 /* UITextField+LimitLength.m */; };
A94DD58424FE40E600B1B5A2 /* Goods.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A94DD58324FE40E600B1B5A2 /* Goods.storyboard */; };
A94DD58624FE490E00B1B5A2 /* SHGoodsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A94DD58524FE490E00B1B5A2 /* SHGoodsViewController.swift */; };
A950F5A824F36F55007AB63E /* SHRecordListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A950F5A724F36F55007AB63E /* SHRecordListViewController.swift */; };
A950F5AA24F3727A007AB63E /* SHRecordListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A950F5A924F3727A007AB63E /* SHRecordListCell.swift */; };
A950F5AC24F39EC1007AB63E /* SHRecordShowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A950F5AB24F39EC1007AB63E /* SHRecordShowViewController.swift */; };
......@@ -74,7 +80,6 @@
A95CDFCB24E0EBF10066DAE6 /* Number+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = A95CDFA724E0EBF10066DAE6 /* Number+Extension.swift */; };
A95CDFCC24E0EBF10066DAE6 /* UIView+IBLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = A95CDFA824E0EBF10066DAE6 /* UIView+IBLayer.swift */; };
A95CDFCD24E0EBF10066DAE6 /* UIView+Nib.swift in Sources */ = {isa = PBXBuildFile; fileRef = A95CDFA924E0EBF10066DAE6 /* UIView+Nib.swift */; };
A95CDFD424E0EBF10066DAE6 /* CRMemberIAPViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A95CDFB124E0EBF10066DAE6 /* CRMemberIAPViewController.swift */; };
A95CDFD624E0EBF10066DAE6 /* CRLaunchGuideCell_1.xib in Resources */ = {isa = PBXBuildFile; fileRef = A95CDFB424E0EBF10066DAE6 /* CRLaunchGuideCell_1.xib */; };
A95CDFD724E0EBF10066DAE6 /* CRGuideCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A95CDFB524E0EBF10066DAE6 /* CRGuideCollectionViewCell.swift */; };
A95CDFD824E0EBF10066DAE6 /* CRLaunchGuideCell_1.swift in Sources */ = {isa = PBXBuildFile; fileRef = A95CDFB624E0EBF10066DAE6 /* CRLaunchGuideCell_1.swift */; };
......@@ -91,7 +96,7 @@
A95CE00724E0F42F0066DAE6 /* SHUserAccountManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A95CDFEE24E0F42E0066DAE6 /* SHUserAccountManager.swift */; };
A95CE00924E0F42F0066DAE6 /* CRContactTools.swift in Sources */ = {isa = PBXBuildFile; fileRef = A95CDFF024E0F42F0066DAE6 /* CRContactTools.swift */; };
A95CE00A24E0F42F0066DAE6 /* CRDateFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = A95CDFF124E0F42F0066DAE6 /* CRDateFormatter.swift */; };
A95CE00D24E0F42F0066DAE6 /* CRIAPProductModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A95CDFF624E0F42F0066DAE6 /* CRIAPProductModel.swift */; };
A95CE00D24E0F42F0066DAE6 /* SHAPProductModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A95CDFF624E0F42F0066DAE6 /* SHAPProductModel.swift */; };
A95CE00E24E0F42F0066DAE6 /* CRUserInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A95CDFF724E0F42F0066DAE6 /* CRUserInfoModel.swift */; };
A95CE00F24E0F42F0066DAE6 /* AESCipher.m in Sources */ = {isa = PBXBuildFile; fileRef = A95CDFFA24E0F42F0066DAE6 /* AESCipher.m */; };
A95CE01124E0F42F0066DAE6 /* MBProgressHUD+MJ.m in Sources */ = {isa = PBXBuildFile; fileRef = A95CDFFF24E0F42F0066DAE6 /* MBProgressHUD+MJ.m */; };
......@@ -170,6 +175,16 @@
A94DD57224FDF9D200B1B5A2 /* SHMp3RecordManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SHMp3RecordManager.m; sourceTree = "<group>"; };
A94DD57424FDFB4600B1B5A2 /* ExtAudioFileMixer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtAudioFileMixer.h; sourceTree = "<group>"; };
A94DD57524FDFB4700B1B5A2 /* ExtAudioFileMixer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExtAudioFileMixer.m; sourceTree = "<group>"; };
A94DD57724FE295300B1B5A2 /* SHMemberUpgradeAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SHMemberUpgradeAlertView.h; path = ShorthandMaster/Record/SHMemberUpgradeAlertView.h; sourceTree = SOURCE_ROOT; };
A94DD57824FE295300B1B5A2 /* SHMemberUpgradeAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SHMemberUpgradeAlertView.m; path = ShorthandMaster/Record/SHMemberUpgradeAlertView.m; sourceTree = SOURCE_ROOT; };
A94DD57A24FE377100B1B5A2 /* AlertControllerTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AlertControllerTool.m; sourceTree = "<group>"; };
A94DD57B24FE377100B1B5A2 /* AlertControllerTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AlertControllerTool.h; sourceTree = "<group>"; };
A94DD57D24FE37DF00B1B5A2 /* UILabel+FontAppearance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UILabel+FontAppearance.h"; sourceTree = "<group>"; };
A94DD57E24FE37DF00B1B5A2 /* UILabel+FontAppearance.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+FontAppearance.m"; sourceTree = "<group>"; };
A94DD57F24FE37DF00B1B5A2 /* UITextField+LimitLength.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITextField+LimitLength.m"; sourceTree = "<group>"; };
A94DD58024FE37DF00B1B5A2 /* UITextField+LimitLength.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITextField+LimitLength.h"; sourceTree = "<group>"; };
A94DD58324FE40E600B1B5A2 /* Goods.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Goods.storyboard; sourceTree = "<group>"; };
A94DD58524FE490E00B1B5A2 /* SHGoodsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SHGoodsViewController.swift; sourceTree = "<group>"; };
A950F5A724F36F55007AB63E /* SHRecordListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SHRecordListViewController.swift; sourceTree = "<group>"; };
A950F5A924F3727A007AB63E /* SHRecordListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SHRecordListCell.swift; sourceTree = "<group>"; };
A950F5AB24F39EC1007AB63E /* SHRecordShowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SHRecordShowViewController.swift; sourceTree = "<group>"; };
......@@ -219,7 +234,6 @@
A95CDFA724E0EBF10066DAE6 /* Number+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Number+Extension.swift"; sourceTree = "<group>"; };
A95CDFA824E0EBF10066DAE6 /* UIView+IBLayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+IBLayer.swift"; sourceTree = "<group>"; };
A95CDFA924E0EBF10066DAE6 /* UIView+Nib.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Nib.swift"; sourceTree = "<group>"; };
A95CDFB124E0EBF10066DAE6 /* CRMemberIAPViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CRMemberIAPViewController.swift; sourceTree = "<group>"; };
A95CDFB424E0EBF10066DAE6 /* CRLaunchGuideCell_1.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CRLaunchGuideCell_1.xib; sourceTree = "<group>"; };
A95CDFB524E0EBF10066DAE6 /* CRGuideCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CRGuideCollectionViewCell.swift; sourceTree = "<group>"; };
A95CDFB624E0EBF10066DAE6 /* CRLaunchGuideCell_1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CRLaunchGuideCell_1.swift; sourceTree = "<group>"; };
......@@ -236,7 +250,7 @@
A95CDFEE24E0F42E0066DAE6 /* SHUserAccountManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SHUserAccountManager.swift; sourceTree = "<group>"; };
A95CDFF024E0F42F0066DAE6 /* CRContactTools.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CRContactTools.swift; sourceTree = "<group>"; };
A95CDFF124E0F42F0066DAE6 /* CRDateFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CRDateFormatter.swift; sourceTree = "<group>"; };
A95CDFF624E0F42F0066DAE6 /* CRIAPProductModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CRIAPProductModel.swift; sourceTree = "<group>"; };
A95CDFF624E0F42F0066DAE6 /* SHAPProductModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SHAPProductModel.swift; sourceTree = "<group>"; };
A95CDFF724E0F42F0066DAE6 /* CRUserInfoModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CRUserInfoModel.swift; sourceTree = "<group>"; };
A95CDFFA24E0F42F0066DAE6 /* AESCipher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AESCipher.m; sourceTree = "<group>"; };
A95CDFFB24E0F42F0066DAE6 /* AESCipher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AESCipher.h; sourceTree = "<group>"; };
......@@ -307,6 +321,8 @@
A94D935524F75CE700A886C0 /* Goods */ = {
isa = PBXGroup;
children = (
A94DD58324FE40E600B1B5A2 /* Goods.storyboard */,
A94DD58524FE490E00B1B5A2 /* SHGoodsViewController.swift */,
);
path = Goods;
sourceTree = "<group>";
......@@ -517,7 +533,6 @@
A95CDFE224E0EE1A0066DAE6 /* SHBaseTabBarController.swift */,
A95CDFE424E0EE4B0066DAE6 /* SHBaseNavigationController.swift */,
A95CDFE624E0EE7A0066DAE6 /* SHGuideViewController.swift */,
A95CDFB124E0EBF10066DAE6 /* CRMemberIAPViewController.swift */,
A95CDFB324E0EBF10066DAE6 /* Views */,
);
path = Base;
......@@ -526,9 +541,9 @@
A95CDFB324E0EBF10066DAE6 /* Views */ = {
isa = PBXGroup;
children = (
A95CDFB624E0EBF10066DAE6 /* CRLaunchGuideCell_1.swift */,
A95CDFB424E0EBF10066DAE6 /* CRLaunchGuideCell_1.xib */,
A95CDFB524E0EBF10066DAE6 /* CRGuideCollectionViewCell.swift */,
A95CDFB624E0EBF10066DAE6 /* CRLaunchGuideCell_1.swift */,
);
path = Views;
sourceTree = "<group>";
......@@ -580,7 +595,7 @@
A95CDFF524E0F42F0066DAE6 /* Models */ = {
isa = PBXGroup;
children = (
A95CDFF624E0F42F0066DAE6 /* CRIAPProductModel.swift */,
A95CDFF624E0F42F0066DAE6 /* SHAPProductModel.swift */,
A95CDFF724E0F42F0066DAE6 /* CRUserInfoModel.swift */,
);
path = Models;
......@@ -617,6 +632,10 @@
A95CE02C24E151340066DAE6 /* OC */ = {
isa = PBXGroup;
children = (
A94DD57D24FE37DF00B1B5A2 /* UILabel+FontAppearance.h */,
A94DD57E24FE37DF00B1B5A2 /* UILabel+FontAppearance.m */,
A94DD58024FE37DF00B1B5A2 /* UITextField+LimitLength.h */,
A94DD57F24FE37DF00B1B5A2 /* UITextField+LimitLength.m */,
A950F5B424F4E64A007AB63E /* UIView+CornerRadii.h */,
A950F5B524F4E64A007AB63E /* UIView+CornerRadii.m */,
A95CE02D24E151340066DAE6 /* UIButton+Category.m */,
......@@ -642,6 +661,10 @@
A94D935D24F7AF2300A886C0 /* SHLocationManager.swift */,
A94DD57124FDF9D200B1B5A2 /* SHMp3RecordManager.h */,
A94DD57224FDF9D200B1B5A2 /* SHMp3RecordManager.m */,
A94DD57724FE295300B1B5A2 /* SHMemberUpgradeAlertView.h */,
A94DD57824FE295300B1B5A2 /* SHMemberUpgradeAlertView.m */,
A94DD57B24FE377100B1B5A2 /* AlertControllerTool.h */,
A94DD57A24FE377100B1B5A2 /* AlertControllerTool.m */,
);
path = Record;
sourceTree = "<group>";
......@@ -761,6 +784,7 @@
A94D935424F7503E00A886C0 /* SHRecordExportAlertView.xib in Resources */,
A95CDF6F24E0E8B50066DAE6 /* Main.storyboard in Resources */,
A950F5B124F4E080007AB63E /* Mine.storyboard in Resources */,
A94DD58424FE40E600B1B5A2 /* Goods.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -834,6 +858,7 @@
A95CE01124E0F42F0066DAE6 /* MBProgressHUD+MJ.m in Sources */,
A95CE00924E0F42F0066DAE6 /* CRContactTools.swift in Sources */,
A950F5BE24F4E66B007AB63E /* ActivityTestView.swift in Sources */,
A94DD58124FE37DF00B1B5A2 /* UILabel+FontAppearance.m in Sources */,
A950F5C424F4E796007AB63E /* TitleTableView.swift in Sources */,
A94D935224F7502700A886C0 /* SHRecordExportAlertView.swift in Sources */,
A95CE03824E17BAF0066DAE6 /* SHTimer.swift in Sources */,
......@@ -843,7 +868,10 @@
A94DD56E24FDF29700B1B5A2 /* XBAudioFileDataReader.m in Sources */,
A95CDFC224E0EBF10066DAE6 /* UIView+Extension.swift in Sources */,
A95CDFCD24E0EBF10066DAE6 /* UIView+Nib.swift in Sources */,
A94DD57924FE295300B1B5A2 /* SHMemberUpgradeAlertView.m in Sources */,
A94DD58624FE490E00B1B5A2 /* SHGoodsViewController.swift in Sources */,
A95CE03A24E2AE6A0066DAE6 /* SHRecordModel.swift in Sources */,
A94DD57C24FE377100B1B5A2 /* AlertControllerTool.m in Sources */,
A94D935724F7958500A886C0 /* SHStoreManager.swift in Sources */,
A95CE00E24E0F42F0066DAE6 /* CRUserInfoModel.swift in Sources */,
A95CDFD824E0EBF10066DAE6 /* CRLaunchGuideCell_1.swift in Sources */,
......@@ -853,7 +881,7 @@
A95C2FDC24FCBF5400C685CE /* SHCloudManager.swift in Sources */,
A94DD56624FDF29700B1B5A2 /* XBExtAudioFileRef.m in Sources */,
A95CDFC624E0EBF10066DAE6 /* String+Extension.swift in Sources */,
A95CE00D24E0F42F0066DAE6 /* CRIAPProductModel.swift in Sources */,
A95CE00D24E0F42F0066DAE6 /* SHAPProductModel.swift in Sources */,
A95B3FD224F5261100FABDD1 /* SHRecordGuideView.swift in Sources */,
A95CDFCB24E0EBF10066DAE6 /* Number+Extension.swift in Sources */,
A95CDFC724E0EBF10066DAE6 /* UIStoryboard+Extension.swift in Sources */,
......@@ -876,7 +904,6 @@
A95CE00A24E0F42F0066DAE6 /* CRDateFormatter.swift in Sources */,
A95CDFC024E0EBF10066DAE6 /* Date+Extension.swift in Sources */,
A95CDFC424E0EBF10066DAE6 /* Double+Extension.swift in Sources */,
A95CDFD424E0EBF10066DAE6 /* CRMemberIAPViewController.swift in Sources */,
A95B3FCD24F50B2F00FABDD1 /* SHRecentDeleteCell.swift in Sources */,
A94DD57324FDF9D200B1B5A2 /* SHMp3RecordManager.m in Sources */,
A94DD56D24FDF29700B1B5A2 /* XBAudioUnitMixerTest.m in Sources */,
......@@ -904,6 +931,7 @@
A94DD56424FDF29700B1B5A2 /* XBAudioUnitRecorder.m in Sources */,
A95CDFD724E0EBF10066DAE6 /* CRGuideCollectionViewCell.swift in Sources */,
A95B3FCB24F507A900FABDD1 /* SHDeleteDetailsViewController.swift in Sources */,
A94DD58224FE37DF00B1B5A2 /* UITextField+LimitLength.m in Sources */,
A95B3FD024F525AD00FABDD1 /* SwiftHoledView.swift in Sources */,
A95B3FC924F502DD00FABDD1 /* SHSettingViewController.swift in Sources */,
A95CDFCC24E0EBF10066DAE6 /* UIView+IBLayer.swift in Sources */,
......
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "底框@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "底框@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "形状结合@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "形状结合@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "对号@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "对号@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -5,12 +5,12 @@
"scale" : "1x"
},
{
"filename" : "common_left_icon_me@2x.png",
"filename" : "右上角@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "common_left_icon_me@3x.png",
"filename" : "右上角@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
......
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "quxiao.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "形状@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "形状@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
//
// CRMemberIAPViewController.swift
// CallRecording
//
// Created by Mazy on 2020/7/14.
// Copyright © 2020 Mazy. All rights reserved.
//
import UIKit
enum CallRecorderVipType: String {
case vipWeekly = "call_recorder_vip_weekly"
case vipQuarterly = "call_recorder_vip_quarterly"
case vipYearly = "call_recorder_vip_yearly"
case vipLifetime = "call_recorder_vip_lifetime"
}
class CRMemberIAPViewController: UIViewController {
@IBOutlet weak var checkViewOne: UIImageView!
@IBOutlet weak var checkViewTwo: UIImageView!
@IBOutlet weak var checkViewThree: UIImageView!
@IBOutlet weak var subTitleALabel: UILabel!
@IBOutlet weak var mainTitleALabel: UILabel!
@IBOutlet weak var subTitleBLabel: UILabel!
@IBOutlet weak var mainTitleBLabel: UILabel!
@IBOutlet weak var subTitleCLabel: UILabel!
@IBOutlet weak var mainTitleCLabel: UILabel!
@IBOutlet weak var continueButton: UIButton!
@IBOutlet weak var weekContentView: UIView!
@IBOutlet weak var yearContentView: UIView!
private var pruducts: [Any] = []
private var currentVipType: CallRecorderVipType = .vipYearly
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
getGoodsList()
continueButton.animationHeartbeat(repeatCount: 100)
let tempButton = UIButton()
tempButton.tag = 1002
memberTypeSelectAction(tempButton)
self.weekContentView.layer.borderColor = UIColor.white.withAlphaComponent(0.5).cgColor
}
private func getGoodsList() {
// CMNetworkManager.shared.getRequest(withPath: .getIPAPayConfig) { (json, error) in
// guard error == nil else { return }
// let goodsList = json["result"]["data"]["goodsList"].arrayValue.map({ CRIAPProductModel(json: $0) })
//
// if let lifePru = goodsList.filter({ $0.productId.contains("week") }).first {
// self.subTitleALabel.text = lifePru.name
// self.mainTitleALabel.text = lifePru.payDesc
// }
//
// if let quarterPru = goodsList.filter({ $0.productId.contains("quarter") }).first {
// self.subTitleBLabel.text = quarterPru.name
// self.mainTitleBLabel.text = quarterPru.payDesc
// }
// if let weekPru = goodsList.filter({ $0.productId.contains("year") }).first {
// self.subTitleCLabel.text = weekPru.name
// self.mainTitleCLabel.text = weekPru.payDesc
// }
// self.pruducts = goodsList
//
// }
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.setNavigationBarHidden(true, animated: true)
}
@IBAction func memberTypeSelectAction(_ sender: UIButton) {
switch sender.tag {
case 1000:
checkViewOne.isHidden = false
checkViewTwo.isHidden = true
checkViewThree.isHidden = true
currentVipType = .vipWeekly
case 1001:
checkViewOne.isHidden = true
checkViewTwo.isHidden = false
checkViewThree.isHidden = true
currentVipType = .vipQuarterly
case 1002:
checkViewOne.isHidden = true
checkViewTwo.isHidden = true
checkViewThree.isHidden = false
currentVipType = .vipYearly
default:
break
}
udpateContentUI()
}
private func udpateContentUI() {
let normalColor = UIColor.white
let normalTextColor = UIColor.white.withAlphaComponent(0.9)
let grayColor = UIColor.white.withAlphaComponent(0.5)
switch currentVipType {
case .vipWeekly:
self.subTitleALabel.textColor = normalColor
self.mainTitleALabel.textColor = normalTextColor
self.subTitleBLabel.textColor = grayColor
self.mainTitleBLabel.textColor = grayColor
self.subTitleCLabel.textColor = grayColor
self.mainTitleCLabel.textColor = grayColor
self.yearContentView.layer.borderColor = grayColor.cgColor
self.weekContentView.layer.borderColor = normalColor.cgColor
case .vipQuarterly:
self.subTitleALabel.textColor = grayColor
self.mainTitleALabel.textColor = grayColor
self.subTitleBLabel.textColor = normalColor
self.mainTitleBLabel.textColor = normalColor
self.subTitleCLabel.textColor = grayColor
self.mainTitleCLabel.textColor = grayColor
case .vipYearly:
self.subTitleALabel.textColor = grayColor
self.mainTitleALabel.textColor = grayColor
self.subTitleBLabel.textColor = grayColor
self.mainTitleBLabel.textColor = grayColor
self.subTitleCLabel.textColor = normalColor
self.mainTitleCLabel.textColor = normalTextColor
self.weekContentView.layer.borderColor = grayColor.cgColor
self.yearContentView.layer.borderColor = normalColor.cgColor
default:
break
}
}
@IBAction func dismissAction() {
self.dismiss(animated: true, completion: nil)
}
@IBAction func userTermsAction() {
let webVc = SHWebViewController()
webVc.title = "使用条款"
// webVc.url = SHUserAccountManager.shared.h5_url["user"].stringValue
self.navigationController?.pushViewController(webVc, animated: true)
}
@IBAction func privacyPolicyAction() {
let webVc = SHWebViewController()
webVc.title = "隐私政策"
// webVc.url = SHUserAccountManager.shared.h5_url["privacy"].stringValue
self.navigationController?.pushViewController(webVc, animated: true)
}
// 继续付款
@IBAction func continueAction(_ sender: UIButton) {
// var productId = currentVipType.rawValue
//
// switch currentVipType {
// case .vipWeekly:
// productId = pruducts.filter({ $0.productId.contains("week") }).first?.productId ?? currentVipType.rawValue
// case .vipQuarterly:
// productId = pruducts.filter({ $0.productId.contains("quarter") }).first?.productId ?? currentVipType.rawValue
// case .vipYearly:
// productId = pruducts.filter({ $0.productId.contains("year") }).first?.productId ?? currentVipType.rawValue
// case .vipLifetime:
// productId = pruducts.filter({ $0.productId.contains("life") }).first?.productId ?? currentVipType.rawValue
// }
// CRPurchaseManager.purchaseWithProductId(productId: productId, inView: self.view, success: {
// SHUserAccountManager.shared.getUserInfo({ (model) in
// self.dismiss(animated: true, completion: nil)
// }, failure: {
// self.dismiss(animated: true, completion: nil)
// })
// }, faliure: {
//
// })
}
// 恢复购买
@IBAction func restoreAction(_ sender: UIButton) {
// CRPurchaseManager.restorePurchases(success: {
// SHUserAccountManager.shared.getUserInfo({ (model) in
// self.navigationController?.dismiss(animated: true, completion: nil)
// }, failure: {
// self.navigationController?.dismiss(animated: true, completion: nil)
// })
// }, toView: self.view)
}
}
......@@ -40,6 +40,14 @@ class SHBaseViewController: UIViewController {
self.navigationController?.popViewController(animated: true)
}
@objc public func goGoods(){
let goodsVC = UIStoryboard.init(name: "Goods", bundle: nil).instantiateViewController(withIdentifier: "SHGoodsViewController") as! SHGoodsViewController
let nav = SHBaseNavigationController(rootViewController: goodsVC)
nav.modalPresentationStyle = .fullScreen
self.present(nav, animated: true, completion: nil)
}
deinit {
logWarning("\(#file) deinit")
}
......
//
// UILabel+FontAppearance.h
// Dolphins
//
// Created by 明津李 on 2020/6/10.
// Copyright © 2020 Company. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UILabel(FontAppearance)
@property(nonatomic, copy) UIFont * appearanceFont;
@end
NS_ASSUME_NONNULL_END
//
// UILabel+FontAppearance.m
// Dolphins
//
// Created by 明津李 on 2020/6/10.
// Copyright © 2020 Company. All rights reserved.
//
#import "UILabel+FontAppearance.h"
@implementation UILabel(FontAppearance)
- (void)setAppearanceFont:(UIFont *)font {
if (font){
[self setFont:font];
}
}
- (UIFont *)appearanceFont {
return self.font;
}
@end
//
// UITextField+LimitLength.h
// TextLengthLimitDemo
//
// Created by Su XinDe on 13-4-8.
// Copyright (c) 2013年 Su XinDe. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UITextField (LimitLength)
- (void)limitTextLength:(int)length;
@end
//
// UITextField+LimitLength.m
// TextLengthLimitDemo
//
// Created by Su XinDe on 13-4-8.
// Copyright (c) 2013年 Su XinDe. All rights reserved.
//
#import "UITextField+LimitLength.h"
#import <objc/objc.h>
#import <objc/runtime.h>
@implementation UITextField (LimitLength)
static NSString *kLimitTextLengthKey = @"kLimitTextLengthKey";
- (void)limitTextLength:(int)length
{
objc_setAssociatedObject(self, (__bridge const void *)(kLimitTextLengthKey), [NSNumber numberWithInt:length], OBJC_ASSOCIATION_RETAIN_NONATOMIC);
[self addTarget:self action:@selector(textFieldTextLengthLimit:) forControlEvents:UIControlEventEditingChanged];
}
- (void)textFieldTextLengthLimit:(id)sender
{
NSNumber *lengthNumber = objc_getAssociatedObject(self, (__bridge const void *)(kLimitTextLengthKey));
int length = [lengthNumber intValue];
if(self.text.length > length){
self.text = [self.text substringToIndex:length];
}
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina5_9" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Goods View Controller-->
<scene sceneID="GMF-Se-5NQ">
<objects>
<viewController storyboardIdentifier="SHGoodsViewController" id="isa-JC-LKi" customClass="SHGoodsViewController" customModule="速记大师" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="uFu-xH-wRj">
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="goods_bg" translatesAutoresizingMaskIntoConstraints="NO" id="iye-Iu-Z0h">
<rect key="frame" x="0.0" y="0.0" width="375" height="510"/>
<constraints>
<constraint firstAttribute="width" secondItem="iye-Iu-Z0h" secondAttribute="height" multiplier="375:510" id="P6H-DC-o9o"/>
</constraints>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rdF-tz-yuV">
<rect key="frame" x="331" y="44" width="44" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="44" id="db7-fl-vmX"/>
<constraint firstAttribute="height" constant="44" id="uip-sZ-ZP1"/>
</constraints>
<state key="normal" image="goods_cancel"/>
<connections>
<action selector="cancelBtnClick:" destination="isa-JC-LKi" eventType="touchUpInside" id="B1H-7S-Z6p"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="不是所有实时转写" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ir5-wH-0ZO">
<rect key="frame" x="58.333333333333343" y="104" width="258.33333333333326" height="38.333333333333343"/>
<fontDescription key="fontDescription" type="system" pointSize="32"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="都叫「速记大师」" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="V6v-YE-ucN">
<rect key="frame" x="58.333333333333343" y="152.33333333333334" width="258.33333333333326" height="38.333333333333343"/>
<fontDescription key="fontDescription" type="system" pointSize="32"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="paw-ud-pJv">
<rect key="frame" x="0.0" y="510" width="375" height="268"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7CA-md-1C7">
<rect key="frame" x="56" y="10" width="263" height="64.666666666666671"/>
<color key="backgroundColor" red="0.20784313725490194" green="0.48627450980392156" blue="0.95686274509803915" alpha="0.20000000000000001" colorSpace="calibratedRGB"/>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Soc-NE-Z9a">
<rect key="frame" x="60" y="13.999999999999996" width="255" height="56.666666666666657"/>
<color key="backgroundColor" red="0.20784313730000001" green="0.48627450979999998" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" secondItem="Soc-NE-Z9a" secondAttribute="height" multiplier="247:55" id="lt7-vV-ua9"/>
</constraints>
<state key="normal" title="开始转录"/>
<connections>
<action selector="confirmBtnClick:" destination="isa-JC-LKi" eventType="touchUpInside" id="f53-T9-VeY"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="3天免费试用,之后¥498/年,随时取消" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bYQ-iK-LKQ">
<rect key="frame" x="63.333333333333329" y="92.666666666666629" width="248.66666666666669" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" tag="100" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" hasAttributedTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zdZ-po-8RK">
<rect key="frame" x="56" y="133.66666666666663" width="48" height="25.333333333333343"/>
<state key="normal">
<attributedString key="attributedTitle">
<fragment content="隐私政策">
<attributes>
<color key="NSColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<font key="NSFont" size="12" name=".PingFangSC-Regular"/>
<paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
<integer key="NSUnderline" value="1"/>
</attributes>
</fragment>
</attributedString>
</state>
<connections>
<action selector="bottomBtnClick:" destination="isa-JC-LKi" eventType="touchUpInside" id="wIA-EQ-XBW"/>
</connections>
</button>
<button opaque="NO" tag="101" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" hasAttributedTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8CH-Xu-Rvt">
<rect key="frame" x="163.66666666666666" y="133.66666666666663" width="48" height="25.333333333333343"/>
<state key="normal">
<attributedString key="attributedTitle">
<fragment content="恢复购买">
<attributes>
<color key="NSColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<font key="NSFont" size="12" name=".PingFangSC-Regular"/>
<paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
<integer key="NSUnderline" value="1"/>
</attributes>
</fragment>
</attributedString>
</state>
<connections>
<action selector="bottomBtnClick:" destination="isa-JC-LKi" eventType="touchUpInside" id="QTB-Cu-PmY"/>
</connections>
</button>
<button opaque="NO" tag="102" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" hasAttributedTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="97G-xL-vUR">
<rect key="frame" x="271" y="133.66666666666663" width="48" height="25.333333333333343"/>
<state key="normal">
<attributedString key="attributedTitle">
<fragment content="使用条款">
<attributes>
<color key="NSColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<font key="NSFont" size="12" name=".PingFangSC-Regular"/>
<paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
<integer key="NSUnderline" value="1"/>
</attributes>
</fragment>
</attributedString>
</state>
<connections>
<action selector="bottomBtnClick:" destination="isa-JC-LKi" eventType="touchUpInside" id="ZZc-aR-Uvt"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="Soc-NE-Z9a" firstAttribute="centerX" secondItem="paw-ud-pJv" secondAttribute="centerX" id="9Uh-M8-gZR"/>
<constraint firstItem="zdZ-po-8RK" firstAttribute="leading" secondItem="7CA-md-1C7" secondAttribute="leading" id="AbC-E6-8RL"/>
<constraint firstItem="Soc-NE-Z9a" firstAttribute="width" secondItem="paw-ud-pJv" secondAttribute="width" multiplier="255:375" id="Cyq-cl-QSa"/>
<constraint firstItem="97G-xL-vUR" firstAttribute="centerY" secondItem="zdZ-po-8RK" secondAttribute="centerY" id="FHh-jS-ozY"/>
<constraint firstItem="Soc-NE-Z9a" firstAttribute="top" secondItem="paw-ud-pJv" secondAttribute="top" constant="14" id="IvD-pq-CQ4"/>
<constraint firstItem="97G-xL-vUR" firstAttribute="trailing" secondItem="7CA-md-1C7" secondAttribute="trailing" id="TPF-52-ghN"/>
<constraint firstItem="8CH-Xu-Rvt" firstAttribute="top" secondItem="bYQ-iK-LKQ" secondAttribute="bottom" constant="24" id="Wvv-Sa-rrv"/>
<constraint firstItem="7CA-md-1C7" firstAttribute="trailing" secondItem="Soc-NE-Z9a" secondAttribute="trailing" constant="4" id="XBq-Uu-kGa"/>
<constraint firstItem="7CA-md-1C7" firstAttribute="bottom" secondItem="Soc-NE-Z9a" secondAttribute="bottom" constant="4" id="aDO-9P-UkA"/>
<constraint firstItem="7CA-md-1C7" firstAttribute="leading" secondItem="Soc-NE-Z9a" secondAttribute="leading" constant="-4" id="nGq-Ob-MEL"/>
<constraint firstItem="7CA-md-1C7" firstAttribute="top" secondItem="Soc-NE-Z9a" secondAttribute="top" constant="-4" id="pPX-Zv-PrG"/>
<constraint firstItem="bYQ-iK-LKQ" firstAttribute="centerX" secondItem="paw-ud-pJv" secondAttribute="centerX" id="pZh-VX-H4F"/>
<constraint firstItem="8CH-Xu-Rvt" firstAttribute="centerY" secondItem="zdZ-po-8RK" secondAttribute="centerY" id="yGS-zM-xeG"/>
<constraint firstItem="bYQ-iK-LKQ" firstAttribute="top" secondItem="7CA-md-1C7" secondAttribute="bottom" constant="18" id="yIN-mc-tBR"/>
<constraint firstItem="8CH-Xu-Rvt" firstAttribute="centerX" secondItem="7CA-md-1C7" secondAttribute="centerX" id="zqe-B3-6a0"/>
</constraints>
</view>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" translatesAutoresizingMaskIntoConstraints="NO" id="Da1-ng-YHc">
<rect key="frame" x="38.666666666666657" y="241.66666666666663" width="298" height="180"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QSd-mj-cw3">
<rect key="frame" x="0.0" y="0.0" width="298" height="30"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="goods_check" translatesAutoresizingMaskIntoConstraints="NO" id="xPk-Fw-4dR">
<rect key="frame" x="0.0" y="0.0" width="30" height="30"/>
<constraints>
<constraint firstAttribute="width" secondItem="xPk-Fw-4dR" secondAttribute="height" id="9yC-Bx-uYl"/>
</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="CzC-ph-4jQ">
<rect key="frame" x="30.000000000000014" y="4" width="183.66666666666669" height="21.666666666666668"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="CzC-ph-4jQ" firstAttribute="centerY" secondItem="xPk-Fw-4dR" secondAttribute="centerY" id="3BG-Fs-bqS"/>
<constraint firstItem="xPk-Fw-4dR" firstAttribute="leading" secondItem="QSd-mj-cw3" secondAttribute="leading" id="8fj-V7-q5H"/>
<constraint firstItem="xPk-Fw-4dR" firstAttribute="centerY" secondItem="QSd-mj-cw3" secondAttribute="centerY" id="Wjr-vC-Pp6"/>
<constraint firstItem="CzC-ph-4jQ" firstAttribute="leading" secondItem="xPk-Fw-4dR" secondAttribute="trailing" id="aGg-rh-Yhw"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="CzC-ph-4jQ" secondAttribute="trailing" id="gmT-dF-V8g"/>
<constraint firstItem="xPk-Fw-4dR" firstAttribute="height" secondItem="QSd-mj-cw3" secondAttribute="height" id="xAb-lm-R33"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kdj-vL-NEB">
<rect key="frame" x="0.0" y="30.000000000000028" width="298" height="30"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="goods_check" translatesAutoresizingMaskIntoConstraints="NO" id="Z9b-u8-UjE">
<rect key="frame" x="0.0" y="0.0" width="30" height="30"/>
<constraints>
<constraint firstAttribute="width" secondItem="Z9b-u8-UjE" secondAttribute="height" id="G0s-CY-bqZ"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="强大AI支持,准确率高达98%" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YlN-ec-ALx">
<rect key="frame" x="30.000000000000014" y="4" width="236.33333333333337" height="21.666666666666668"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="Z9b-u8-UjE" firstAttribute="height" secondItem="kdj-vL-NEB" secondAttribute="height" id="IRe-VJ-TvG"/>
<constraint firstItem="Z9b-u8-UjE" firstAttribute="leading" secondItem="kdj-vL-NEB" secondAttribute="leading" id="JrR-wC-6gH"/>
<constraint firstItem="YlN-ec-ALx" firstAttribute="leading" secondItem="Z9b-u8-UjE" secondAttribute="trailing" id="Sw6-Va-aUV"/>
<constraint firstItem="Z9b-u8-UjE" firstAttribute="centerY" secondItem="kdj-vL-NEB" secondAttribute="centerY" id="VMn-Mg-nnF"/>
<constraint firstItem="YlN-ec-ALx" firstAttribute="centerY" secondItem="Z9b-u8-UjE" secondAttribute="centerY" id="Xkr-0c-V4O"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="YlN-ec-ALx" secondAttribute="trailing" id="ky0-ic-Gdh"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HC0-Rf-0yO">
<rect key="frame" x="0.0" y="60.000000000000028" width="298" height="30"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="goods_check" translatesAutoresizingMaskIntoConstraints="NO" id="HaM-TK-2AZ">
<rect key="frame" x="0.0" y="0.0" width="30" height="30"/>
<constraints>
<constraint firstAttribute="width" secondItem="HaM-TK-2AZ" secondAttribute="height" id="pfR-fY-Uyz"/>
</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="9uw-kZ-PiV">
<rect key="frame" x="30.000000000000014" y="4" width="238.66666666666669" height="21.666666666666668"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="9uw-kZ-PiV" firstAttribute="leading" secondItem="HaM-TK-2AZ" secondAttribute="trailing" id="7pj-z9-VRm"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="9uw-kZ-PiV" secondAttribute="trailing" id="Cbo-KS-sQL"/>
<constraint firstItem="9uw-kZ-PiV" firstAttribute="centerY" secondItem="HaM-TK-2AZ" secondAttribute="centerY" id="PYO-Dj-OqH"/>
<constraint firstItem="HaM-TK-2AZ" firstAttribute="centerY" secondItem="HC0-Rf-0yO" secondAttribute="centerY" id="VNq-Zn-dCZ"/>
<constraint firstItem="HaM-TK-2AZ" firstAttribute="height" secondItem="HC0-Rf-0yO" secondAttribute="height" id="Ze2-gm-RuR"/>
<constraint firstItem="HaM-TK-2AZ" firstAttribute="leading" secondItem="HC0-Rf-0yO" secondAttribute="leading" id="dA8-Wv-mo0"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="DKA-fr-80c">
<rect key="frame" x="0.0" y="90.000000000000028" width="298" height="30"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="goods_check" translatesAutoresizingMaskIntoConstraints="NO" id="1ZS-d0-cs1">
<rect key="frame" x="0.0" y="0.0" width="30" height="30"/>
<constraints>
<constraint firstAttribute="width" secondItem="1ZS-d0-cs1" secondAttribute="height" id="lWU-6q-QgW"/>
</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="dQr-Sd-4U0">
<rect key="frame" x="30" y="4" width="147" height="21.666666666666668"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="1ZS-d0-cs1" firstAttribute="centerY" secondItem="DKA-fr-80c" secondAttribute="centerY" id="MtE-dp-hx3"/>
<constraint firstItem="dQr-Sd-4U0" firstAttribute="leading" secondItem="1ZS-d0-cs1" secondAttribute="trailing" id="Rz5-bf-oyY"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="dQr-Sd-4U0" secondAttribute="trailing" id="XKX-Il-V6l"/>
<constraint firstItem="1ZS-d0-cs1" firstAttribute="height" secondItem="DKA-fr-80c" secondAttribute="height" id="cSv-wL-d2c"/>
<constraint firstItem="dQr-Sd-4U0" firstAttribute="centerY" secondItem="1ZS-d0-cs1" secondAttribute="centerY" id="iv3-hK-7oM"/>
<constraint firstItem="1ZS-d0-cs1" firstAttribute="leading" secondItem="DKA-fr-80c" secondAttribute="leading" id="tmi-xU-ffb"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="4J4-GU-x0y">
<rect key="frame" x="0.0" y="120.00000000000003" width="298" height="30"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="goods_check" translatesAutoresizingMaskIntoConstraints="NO" id="3Fs-J0-3hQ">
<rect key="frame" x="0.0" y="0.0" width="30" height="30"/>
<constraints>
<constraint firstAttribute="width" secondItem="3Fs-J0-3hQ" secondAttribute="height" id="H2y-EA-1j1"/>
</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="JaY-kN-uAA">
<rect key="frame" x="30.000000000000007" y="4" width="73.666666666666686" height="21.666666666666668"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="3Fs-J0-3hQ" firstAttribute="height" secondItem="4J4-GU-x0y" secondAttribute="height" id="19U-IP-D0y"/>
<constraint firstItem="3Fs-J0-3hQ" firstAttribute="leading" secondItem="4J4-GU-x0y" secondAttribute="leading" id="701-Ue-j4e"/>
<constraint firstItem="JaY-kN-uAA" firstAttribute="centerY" secondItem="3Fs-J0-3hQ" secondAttribute="centerY" id="J3S-zl-DHR"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="JaY-kN-uAA" secondAttribute="trailing" id="Wxm-FF-e32"/>
<constraint firstItem="3Fs-J0-3hQ" firstAttribute="centerY" secondItem="4J4-GU-x0y" secondAttribute="centerY" id="i4b-V7-Jz6"/>
<constraint firstItem="JaY-kN-uAA" firstAttribute="leading" secondItem="3Fs-J0-3hQ" secondAttribute="trailing" id="vgr-HR-VWz"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LDR-V8-niz">
<rect key="frame" x="0.0" y="150.00000000000003" width="298" height="30"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="goods_check" translatesAutoresizingMaskIntoConstraints="NO" id="m4X-wv-U2B">
<rect key="frame" x="0.0" y="0.0" width="30" height="30"/>
<constraints>
<constraint firstAttribute="width" secondItem="m4X-wv-U2B" secondAttribute="height" id="wtq-J7-REx"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="快速导出PDF" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eht-Pp-tRp">
<rect key="frame" x="30" y="4" width="107" height="21.666666666666668"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="m4X-wv-U2B" firstAttribute="leading" secondItem="LDR-V8-niz" secondAttribute="leading" id="20O-Wv-yPT"/>
<constraint firstItem="m4X-wv-U2B" firstAttribute="height" secondItem="LDR-V8-niz" secondAttribute="height" id="8Kc-y8-pvj"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="eht-Pp-tRp" secondAttribute="trailing" id="XkE-Fb-NO1"/>
<constraint firstItem="eht-Pp-tRp" firstAttribute="leading" secondItem="m4X-wv-U2B" secondAttribute="trailing" id="bJO-s3-IBq"/>
<constraint firstItem="eht-Pp-tRp" firstAttribute="centerY" secondItem="m4X-wv-U2B" secondAttribute="centerY" id="eDw-V8-tGE"/>
<constraint firstItem="m4X-wv-U2B" firstAttribute="centerY" secondItem="LDR-V8-niz" secondAttribute="centerY" id="hRq-z1-0uG"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstAttribute="width" secondItem="Da1-ng-YHc" secondAttribute="height" multiplier="298:180" id="aUD-cK-389"/>
</constraints>
</stackView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="vu7-FC-44s" firstAttribute="trailing" secondItem="paw-ud-pJv" secondAttribute="trailing" id="1FV-EK-IXz"/>
<constraint firstItem="vu7-FC-44s" firstAttribute="trailing" secondItem="rdF-tz-yuV" secondAttribute="trailing" id="1zJ-h7-e5L"/>
<constraint firstItem="V6v-YE-ucN" firstAttribute="centerX" secondItem="uFu-xH-wRj" secondAttribute="centerX" id="2SP-7a-BLX"/>
<constraint firstItem="Da1-ng-YHc" firstAttribute="width" secondItem="uFu-xH-wRj" secondAttribute="width" multiplier="298:375" id="4ZH-2I-TZS"/>
<constraint firstItem="Ir5-wH-0ZO" firstAttribute="centerX" secondItem="uFu-xH-wRj" secondAttribute="centerX" id="6wH-B1-AHt"/>
<constraint firstItem="vu7-FC-44s" firstAttribute="bottom" secondItem="paw-ud-pJv" secondAttribute="bottom" id="8la-jW-R2y"/>
<constraint firstItem="vu7-FC-44s" firstAttribute="trailing" secondItem="iye-Iu-Z0h" secondAttribute="trailing" id="IUM-fu-mvQ"/>
<constraint firstItem="iye-Iu-Z0h" firstAttribute="leading" secondItem="vu7-FC-44s" secondAttribute="leading" id="N8H-0X-ZRn"/>
<constraint firstItem="Da1-ng-YHc" firstAttribute="top" secondItem="V6v-YE-ucN" secondAttribute="bottom" constant="51" id="PYV-Dx-tF0"/>
<constraint firstItem="Da1-ng-YHc" firstAttribute="centerX" secondItem="iye-Iu-Z0h" secondAttribute="centerX" id="Pgo-ST-wlI"/>
<constraint firstItem="iye-Iu-Z0h" firstAttribute="top" secondItem="uFu-xH-wRj" secondAttribute="top" id="XVG-cM-ubs"/>
<constraint firstItem="paw-ud-pJv" firstAttribute="leading" secondItem="vu7-FC-44s" secondAttribute="leading" id="Yho-RY-lwx"/>
<constraint firstItem="V6v-YE-ucN" firstAttribute="top" secondItem="Ir5-wH-0ZO" secondAttribute="bottom" constant="10" id="m6g-uu-L6S"/>
<constraint firstItem="paw-ud-pJv" firstAttribute="top" secondItem="iye-Iu-Z0h" secondAttribute="bottom" id="qzV-Fg-FWp"/>
<constraint firstItem="rdF-tz-yuV" firstAttribute="top" secondItem="vu7-FC-44s" secondAttribute="top" id="sTT-lR-Cih"/>
<constraint firstItem="Da1-ng-YHc" firstAttribute="centerY" secondItem="iye-Iu-Z0h" secondAttribute="centerY" multiplier="1.3" id="tAp-1A-Ixr"/>
</constraints>
<viewLayoutGuide key="safeArea" id="vu7-FC-44s"/>
</view>
<connections>
<outlet property="yearStoreBtn" destination="Soc-NE-Z9a" id="gtO-sc-RfA"/>
<outlet property="yearStoreBtnBgView" destination="7CA-md-1C7" id="6wY-y2-b5j"/>
<outlet property="yearStoreLab" destination="bYQ-iK-LKQ" id="2Sn-TX-2Bt"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Bu3-zQ-jQb" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="60.869565217391312" y="75"/>
</scene>
</scenes>
<resources>
<image name="goods_bg" width="375" height="510"/>
<image name="goods_cancel" width="20" height="20"/>
<image name="goods_check" width="20" height="20"/>
</resources>
</document>
//
// SHGoodsViewController.swift
// ShorthandMaster
//
// Created by 明津李 on 2020/9/1.
// Copyright © 2020 明津李. All rights reserved.
//
import UIKit
class SHGoodsViewController: SHBaseViewController {
@IBOutlet weak var yearStoreLab: UILabel!
@IBOutlet weak var yearStoreBtn: UIButton!
@IBOutlet weak var yearStoreBtnBgView: UIView!
private var pruducts: [SHAPProductModel] = []
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.setNavigationBarHidden(true, animated: true)
}
override func setupUI() {
view.layoutIfNeeded()
view.layoutSubviews()
yearStoreBtnBgView.layer.cornerRadius = yearStoreBtnBgView.frame.size.height/2
yearStoreBtn.layer.cornerRadius = yearStoreBtn.frame.size.height/2
}
func getDataSource(){
CMNetworkManager.shared.getRequest(withPath: .getIPAPayConfig) { (json, error) in
guard error == nil else { return }
let goodsList = json["result"]["data"]["goodsList"].arrayValue.map({ SHAPProductModel(json: $0) })
self.pruducts = goodsList
if let yearVip = goodsList.filter({ $0.productId.contains("year") }).first {
self.yearStoreLab.text = yearVip.name
}
}
}
@objc @IBAction func cancelBtnClick(_ sender: UIButton){
self.navigationController?.dismiss(animated: true, completion: nil)
}
@objc @IBAction func confirmBtnClick(_ sender: UIButton){
let productId = pruducts.filter({ $0.productId.contains("year") }).first?.productId ?? "com.ShorthandMaster.www.subscription.yearly"
SHStoreManager.purchaseWithProductId(productId: productId, inView: self.view, success: {
SHUserAccountManager.shared.getUserInfo({ (model) in
self.dismiss(animated: true, completion: nil)
}, failure: {
self.dismiss(animated: true, completion: nil)
})
}, faliure: { errString in
})
}
@objc @IBAction func bottomBtnClick(_ sender: UIButton){
switch sender.tag {
case 100:
let webVc = SHWebViewController()
webVc.title = "使用条款"
webVc.url = SHUserAccountManager.shared.h5_url["user"].stringValue
self.navigationController?.pushViewController(webVc, animated: true)
break
case 101:
SHStoreManager.restorePurchases(success: {
SHUserAccountManager.shared.getUserInfo({ (model) in
self.navigationController?.dismiss(animated: true, completion: nil)
}, failure: {
self.navigationController?.dismiss(animated: true, completion: nil)
})
}, toView: self.view)
break
case 102:
let webVc = SHWebViewController()
webVc.title = "隐私政策"
webVc.url = SHUserAccountManager.shared.h5_url["privacy"].stringValue
self.navigationController?.pushViewController(webVc, animated: true)
break
default:
break
}
}
}
......@@ -21,15 +21,15 @@
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>3333</string>
<string>App需要您开启定位权限,命名您的文件名称</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>6666</string>
<string>App需要您开启定位权限,命名您的文件名称</string>
<key>NSLocationUsageDescription</key>
<string>44444</string>
<string>App需要您开启定位权限,命名您的文件名称</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>55555</string>
<string>App需要您开启定位权限,命名您的文件名称</string>
<key>NSMicrophoneUsageDescription</key>
<string>App需要访问麦克风,进行录音</string>
<string>App需要访问麦克风,进行录音并保存</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>XXXXXXX</string>
<key>UIBackgroundModes</key>
......
//
// UIAlertController+NSObjct.h
// poinner
//
// Created by cqh on 2016/12/21.
// Copyright © 2016年 QianEn payment technology co., LTD. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef void(^cancelBlock)(void);
typedef void(^confirmBlock)(id);
typedef void(^finishBlock)(void);
@interface AlertControllerTool : NSObject
+ (instancetype)manager;
+ (void)alertControllerWithTitle:(NSString *)tilte message:(NSString *)message cancelTitle:(NSString *)cancelTitle cancelBlock:(cancelBlock)cancelBlock finishBlock:(finishBlock)finishBlock;
+ (void)alertControllerWithTitle:(NSString *)tilte message:(NSString *)message view:(UIView *)currentView cancelTitle:(NSString *)cancelTitle cancelBlock:(cancelBlock)cancelBlock finishBlock:(finishBlock)finishBlock;
+ (void)alertControllerWithTitle:(NSString *)tilte message:(NSString *)message cancelTitle:(NSString *)cancelTitle cancelBlock:(cancelBlock)cancelBlock confirm:(NSString *)confirmTitle confirmBlock:(confirmBlock)confirmBlock finishBlock:(finishBlock)finishBlock;
+ (void)alertControllerWithTitle:(NSString *)tilte message:(NSString *)message view:(UIView *)currentView cancelTitle:(NSString *)cancelTitle cancelBlock:(cancelBlock)cancelBlock confirm:(NSString *)confirmTitle confirmBlock:(confirmBlock)confirmBlock finishBlock:(finishBlock)finishBlock;
+ (void)alertControllerWithTitle:(NSString *)tilte message:(NSString *)message alignment:(NSTextAlignment)alignment cancelTitle:(NSString *)cancelTitle cancelBlock:(cancelBlock)cancelBlock confirm:(NSString *)confirmTitle confirmBlock:(confirmBlock)confirmBlock finishBlock:(finishBlock)finishBlock;
//- (void)alertControllerWithPhoto:(NSString *)imageStr finishBlock:(finishBlock)finishBlock;
+ (UIViewController *)getCurrentVC;
+ (void)alertControllerWithTitle:(NSString *)tilte message:(NSString *)message textField:(NSString *)placeholder cancelTitle:(NSString *)cancelTitle cancelBlock:(cancelBlock)cancelBlock confirm:(NSString *)confirmTitle confirmBlock:(confirmBlock)confirmBlock finishBlock:(finishBlock)finishBlock;
@end
//
// UIAlertController+NSObjct.m
// poinner
//
// Created by cqh on 2016/12/21.
// Copyright © 2016年 QianEn payment technology co., LTD. All rights reserved.
//
#import "AlertControllerTool.h"
#import "UITextField+LimitLength.h"
#import "UILabel+FontAppearance.h"
@interface AlertControllerTool(){
cancelBlock cancal;
confirmBlock confirm;
finishBlock finish;
}
@property (nonatomic, copy) NSString * message;
@property (nonatomic, strong) UIAlertController * alert;
@end
@implementation AlertControllerTool
+ (instancetype)manager{
static AlertControllerTool * manager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
manager = [[AlertControllerTool alloc] init];
});
return manager;
}
- (instancetype)init{
if (self = [super init]) {
}
return self;
}
+ (void)alertControllerWithTitle:(NSString *)tilte message:(NSString *)message cancelTitle:(NSString *)cancelTitle cancelBlock:(cancelBlock)cancelBlock finishBlock:(finishBlock)finishBlock{
[AlertControllerTool alertControllerWithTitle:tilte message:message cancelTitle:cancelTitle cancelBlock:cancelBlock confirm:nil confirmBlock:nil finishBlock:finishBlock];
}
+ (void)alertControllerWithTitle:(NSString *)tilte message:(NSString *)message view:(UIView *)currentView cancelTitle:(NSString *)cancelTitle cancelBlock:(cancelBlock)cancelBlock finishBlock:(finishBlock)finishBlock{
[AlertControllerTool alertControllerWithTitle:tilte message:message view:currentView cancelTitle:cancelTitle cancelBlock:cancelBlock confirm:nil confirmBlock:nil finishBlock:finishBlock];
}
+ (void)alertControllerWithTitle:(NSString *)tilte message:(NSString *)message cancelTitle:(NSString *)cancelTitle cancelBlock:(cancelBlock)cancelBlock confirm:(NSString *)confirmTitle confirmBlock:(confirmBlock)confirmBlock finishBlock:(finishBlock)finishBlock{
[AlertControllerTool alertControllerWithTitle:tilte message:message alignment:NSTextAlignmentCenter cancelTitle:cancelTitle cancelBlock:cancelBlock confirm:confirmTitle confirmBlock:confirmBlock finishBlock:finishBlock];
}
+ (void)alertControllerWithTitle:(NSString *)tilte message:(NSString *)message view:(UIView *)currentView cancelTitle:(NSString *)cancelTitle cancelBlock:(cancelBlock)cancelBlock confirm:(NSString *)confirmTitle confirmBlock:(confirmBlock)confirmBlock finishBlock:(finishBlock)finishBlock{
[AlertControllerTool alertControllerWithTitle:tilte message:message view:currentView alignment:NSTextAlignmentCenter cancelTitle:cancelTitle cancelBlock:cancelBlock confirm:confirmTitle confirmBlock:confirmBlock finishBlock:finishBlock];
}
+ (void)alertControllerWithTitle:(NSString *)tilte message:(NSString *)message alignment:(NSTextAlignment)alignment cancelTitle:(NSString *)cancelTitle cancelBlock:(cancelBlock)cancelBlock confirm:(NSString *)confirmTitle confirmBlock:(confirmBlock)confirmBlock finishBlock:(finishBlock)finishBlock{
[AlertControllerTool alertControllerWithTitle:tilte message:message view:nil alignment:alignment cancelTitle:cancelTitle cancelBlock:cancelBlock confirm:confirmTitle confirmBlock:confirmBlock finishBlock:finishBlock];
}
+ (void)alertControllerWithTitle:(NSString *)tilte message:(NSString *)message view:(UIView *)currentView alignment:(NSTextAlignment)alignment cancelTitle:(NSString *)cancelTitle cancelBlock:(cancelBlock)cancelBlock confirm:(NSString *)confirmTitle confirmBlock:(confirmBlock)confirmBlock finishBlock:(finishBlock)finishBlock{
dispatch_async(dispatch_get_global_queue(0, 0), ^{
dispatch_sync(dispatch_get_main_queue(), ^{
UIAlertController * alert = [UIAlertController alertControllerWithTitle:tilte message:message preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction * cancel = [UIAlertAction actionWithTitle:cancelTitle style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
if (cancelBlock) {
cancelBlock();
}
}];
[alert addAction:cancel];
if (confirmTitle) {
UIAlertAction * confirm = [UIAlertAction actionWithTitle:confirmTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
if (confirmBlock) {
confirmBlock(nil);
}
}];
//修改按钮文字颜色
// if ([cancel valueForKey:@"titleTextColor"]) {
// [cancel setValue:kColorWithRGB(85,141,251) forKey:@"titleTextColor"];
// }
//修改按钮文字颜色
// if ([confirm valueForKey:@"titleTextColor"]) {
// [confirm setValue:kColorWithRGB(0,0,0) forKey:@"titleTextColor"];
// }
[alert addAction:confirm];
}else{
//修改按钮文字颜色
// if ([cancel valueForKey:@"titleTextColor"]) {
// [cancel setValue:kColorWithRGB(41,98,255) forKey:@"titleTextColor"];
// [cancel setValue:kColorWithRGB(85,141,251) forKey:@"titleTextColor"];
// }
}
if(message){
//修改message
NSMutableAttributedString *alertControllerMessageStr = [[NSMutableAttributedString alloc] initWithString:message];
[alertControllerMessageStr addAttribute:NSForegroundColorAttributeName value:kColorWithRGB(51, 51, 51) range:[message rangeOfString:message]];
[alertControllerMessageStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:15] range:[message rangeOfString:message]];
[alert setValue:alertControllerMessageStr forKey:@"attributedMessage"];
NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];
paragraph.alignment = alignment;
paragraph.lineBreakMode = NSLineBreakByCharWrapping;
[alertControllerMessageStr addAttribute:NSParagraphStyleAttributeName value:paragraph range:[message rangeOfString:message]];
[alert setValue:alertControllerMessageStr forKey:@"attributedMessage"];
}
// if (@available(iOS 9.0, *)) {
// UILabel * appearanceLabel = [UILabel appearanceWhenContainedIn:UIAlertController.class, nil];
// [appearanceLabel setAppearanceFont:[UIFont systemFontOfSize:15]];
// }
if (currentView) {
UIViewController *vc = [[UIViewController alloc] init];
vc.view = currentView;
[vc presentViewController:alert animated:YES completion:nil];
// [[AlertControllerTool getCurrentVC].navigationController.view addSubview:vc.view];
}else{
[[AlertControllerTool getCurrentVC].navigationController presentViewController:alert animated:YES completion:nil];
// [[AlertControllerTool getCurrentVC].navigationController presentViewController:alert animated:YES completion:^{
// if (finishBlock) {
// finishBlock();
// }
// }];
}
});
});
}
+ (void)alertControllerWithTitle:(NSString *)tilte message:(NSString *)message textField:(NSString *)placeholder cancelTitle:(NSString *)cancelTitle cancelBlock:(cancelBlock)cancelBlock confirm:(NSString *)confirmTitle confirmBlock:(confirmBlock)confirmBlock finishBlock:(finishBlock)finishBlock{
UIAlertController * alert = [UIAlertController alertControllerWithTitle:tilte message:message preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction * cancel = [UIAlertAction actionWithTitle:cancelTitle style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
if (cancelBlock) {
cancelBlock();
}
}];
[alert addAction:cancel];
if (confirmTitle) {
UIAlertAction * confirm = [UIAlertAction actionWithTitle:confirmTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
NSString * str;
if (placeholder) {
UITextField * envirnmentNameTextField = alert.textFields.firstObject;
// envirnmentNameTextField.keyboardType = UIKeyboardTypeNumberPad;
// [envirnmentNameTextField limitTextLength:6];
str = envirnmentNameTextField.text;
if (str.length == 0) {
// [MBProgressHUD showMessage:@"请输入短信验证码"];
return ;
}
}
if (confirmBlock) {
confirmBlock(str);
}
}];
[alert addAction:confirm];
}
if (placeholder) {
[alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
// [textField limitTextLength:6];
textField.placeholder = placeholder;
// textField.keyboardType = UIKeyboardTypeNumberPad;
}];
}
[[AlertControllerTool getCurrentVC].navigationController presentViewController:alert animated:YES completion:^{
if (finishBlock) {
finishBlock();
}
}];
}
//- (void)alertControllerWithPhoto:(NSString *)imageStr finishBlock:(finishBlock)finishBlock{
//
// finish = finishBlock;
//
// UIView * bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
// bgView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
// [[[self class] getCurrentVC].view.window addSubview:bgView];
//
// UIImageView *imageView = [[UIImageView alloc] init];
// imageView.frame = CGRectMake(0, 0, 300*ScaleW, 381*ScaleW);
// imageView.center = CGPointMake(WIDTH/2, HEIGHT/2);
// imageView.image = [UIImage imageNamed:imageStr];
// imageView.userInteractionEnabled = YES;
// imageView.layer.cornerRadius = 5*ScaleW;
// imageView.clipsToBounds = YES;
// [bgView addSubview:imageView];
//
// UIButton * confirmBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, imageView.frame.size.height-56*ScaleW+1, imageView.frame.size.width, 56*ScaleW-1)];
// [confirmBtn setTitleColor:kColorWithRGB(151, 151, 151) forState:(UIControlStateNormal)];
// confirmBtn.titleLabel.font = [UIFont systemFontOfSize:17*ScaleW];
// [confirmBtn addTarget:self action:@selector(confirmBtnClick:) forControlEvents:(UIControlEventTouchUpInside)];
// [imageView addSubview:confirmBtn];
//
// __block int count = 4;
// confirmBtn.enabled = NO;
// dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0));
// dispatch_source_set_timer(timer, DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC, 0 * NSEC_PER_SEC);
// dispatch_source_set_event_handler(timer, ^{
//
// if (count >= 0) {
// NSString * countStr = [NSString stringWithFormat:@"确认(%ds)",count+1];
// dispatch_async(dispatch_get_main_queue(), ^{
// [confirmBtn setTitle:countStr forState:UIControlStateNormal];
// });
// count--;
// }else{
// dispatch_async(dispatch_get_main_queue(), ^{
// [confirmBtn setTitle:@"确认" forState:UIControlStateNormal];
// [confirmBtn setTitleColor:MassColor forState:(UIControlStateNormal)];
// confirmBtn.selected = YES;
// confirmBtn.enabled = YES;
// });
// dispatch_source_cancel(timer);
// }
// });
// dispatch_resume(timer);
//}
- (void)confirmBtnClick:(UIButton *)sender{
if (sender.selected) {
[sender.superview.superview removeFromSuperview];
if (finish) {
finish();
}
}
}
//获取当前屏幕显示的viewcontroller
+ (UIViewController *)getCurrentVC
{
UIViewController *result = nil;
UIWindow * window = [[UIApplication sharedApplication] keyWindow];
if (window.windowLevel != UIWindowLevelNormal)
{
NSArray *windows = [[UIApplication sharedApplication] windows];
for(UIWindow * tmpWin in windows)
{
if (tmpWin.windowLevel == UIWindowLevelNormal)
{
window = tmpWin;
break;
}
}
}
NSArray * subviews = [window subviews];
UIView *frontView = [subviews objectAtIndex:0];
id nextResponder = [frontView nextResponder];
if ([nextResponder isKindOfClass:[UIViewController class]])
result = nextResponder;
else{
result = window.rootViewController;
}
//如果是present
if (result.presentedViewController) {
result = result.presentedViewController;
if ([result isKindOfClass:[UINavigationController class]]) {
UINavigationController * nav = (UINavigationController *)result;
result = nav.childViewControllers.lastObject;
}
}
//如果是TabBar
if ([result isKindOfClass:[UITabBarController class]]) {
// result = ((UITabBarController *)nextResponder).selectedViewController;
result = ((UITabBarController *)result).selectedViewController;
if ([result isKindOfClass:[UINavigationController class]]) {
UINavigationController * nav = (UINavigationController *)result;
result = nav.childViewControllers.lastObject;
}
}
return result;
}
@end
//
// SHMemberUpgradeAlertView.h
// Dolphins
//
// Created by 明津李 on 2020/6/19.
// Copyright © 2020 Company. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface SHMemberUpgradeAlertView : UIView
@property (nonatomic, copy) void(^callBack)(void);
@end
NS_ASSUME_NONNULL_END
//
// SHMemberUpgradeAlertView.m
// Dolphins
//
// Created by 明津李 on 2020/6/19.
// Copyright © 2020 Company. All rights reserved.
//
#import "SHMemberUpgradeAlertView.h"
@interface SHMemberUpgradeAlertView (){
UIView * bgview;
}
@end
@implementation SHMemberUpgradeAlertView
- (instancetype)init{
if (self = [super initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)]) {
[self setUI];
}
return self;
}
- (void)setUI{
self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.0];
bgview = [[UIView alloc] initWithFrame:CGRectMake(0, KScreenHeight, KScaleWidth(188), KScaleWidth(335))];
bgview.center = CGPointMake(KScreenWidth/2, KScreenHeight/2);
bgview.backgroundColor = kColorWithRGB(247, 247, 247);
bgview.layer.cornerRadius = KScaleWidth(8);
bgview.layer.masksToBounds = YES;
[self addSubview:bgview];
[bgview mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.mas_bottom);
make.centerX.equalTo(self);
make.height.mas_equalTo(KScaleWidth(188));
make.width.mas_equalTo(KScaleWidth(335));
}];
UIButton * titleBtn = [[UIButton alloc] init];
[titleBtn setImage:[UIImage imageNamed:@"upgrade_sign"] forState:UIControlStateNormal];
titleBtn.titleLabel.font = [UIFont systemFontOfSize:KFont(16)];
[titleBtn setTitle:@" 提示" forState:UIControlStateNormal];
[titleBtn setTitleColor:kColorWithRGB(34, 34, 34) forState:UIControlStateNormal];
[bgview addSubview:titleBtn];
[titleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(bgview);
make.top.equalTo(bgview).mas_offset(KScaleWidth(15));
make.size.mas_offset(CGSizeMake(KScaleWidth(200), KScaleWidth(24)));
}];
UILabel * titleLabel = [[UILabel alloc] init];
titleLabel.text = @"实时转写免费时长已用完,购买后可继续使用";
titleLabel.textColor = kColorWithRGB(34, 34, 34);
titleLabel.font = [UIFont systemFontOfSize:KFont(14)];
titleLabel.textAlignment = NSTextAlignmentCenter;
titleLabel.numberOfLines = 0;
titleLabel.lineBreakMode = NSLineBreakByCharWrapping;
[bgview addSubview:titleLabel];
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(titleBtn.mas_bottom).mas_offset(KScaleWidth(20));
make.centerX.equalTo(bgview);
make.size.mas_offset(CGSizeMake(KScaleWidth(280), KScaleWidth(14)));
}];
UILabel * titleLabel2 = [[UILabel alloc] init];
titleLabel2.text = @"目前剩余转写时长00:00 剩余转写次数:0";
titleLabel2.textColor = kColorWithRGB(34, 34, 34);
titleLabel2.font = [UIFont systemFontOfSize:KFont(14)];
titleLabel2.textAlignment = NSTextAlignmentCenter;
titleLabel2.numberOfLines = 0;
titleLabel2.lineBreakMode = NSLineBreakByCharWrapping;
[bgview addSubview:titleLabel2];
[titleLabel2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(titleLabel.mas_bottom).mas_offset(KScaleWidth(10));
make.centerX.equalTo(bgview);
make.size.mas_offset(CGSizeMake(KScaleWidth(280), KScaleWidth(14)));
}];
UIButton * confirmBtn = [[UIButton alloc] init];
[confirmBtn setTitle:@"现在升级" forState:UIControlStateNormal];
[confirmBtn setTitle:@"现在升级" forState:UIControlStateSelected];
[confirmBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[confirmBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
confirmBtn.backgroundColor = kColorWithRGB(255, 105, 110);
confirmBtn.titleLabel.font = [UIFont systemFontOfSize:KFont(16)];
[confirmBtn addTarget:self action:@selector(cancelBtnClick) forControlEvents:UIControlEventTouchUpInside];
confirmBtn.layer.cornerRadius = KScaleWidth(6);
[bgview addSubview:confirmBtn];
[confirmBtn mas_updateConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(bgview.mas_bottom).mas_offset(-KScaleWidth(20));
make.centerX.equalTo(bgview);
make.height.mas_equalTo(KScaleWidth(48));
make.width.mas_equalTo(KScaleWidth(279));
}];
UIButton * cancelBtn = [[UIButton alloc] init];
[cancelBtn setImage:[UIImage imageNamed:@"upgrade_cancel"] forState:UIControlStateNormal];
[cancelBtn addTarget:self action:@selector(confirmBtnClick) forControlEvents:UIControlEventTouchUpInside];
[bgview addSubview:cancelBtn];
[cancelBtn mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(bgview);
make.right.equalTo(bgview);
make.height.mas_equalTo(44);
make.width.mas_equalTo(44);
}];
[self startAnimation];
}
- (void)confirmBtnClick{
[self endAnimation:YES];
}
- (void)cancelBtnClick{
[self endAnimation:NO];
if (self.callBack) {
self.callBack();
}
}
- (void)startAnimation{
[self setNeedsUpdateConstraints];
[UIView animateWithDuration:0.25f animations:^{
self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.4];
[self->bgview mas_updateConstraints:^(MASConstraintMaker *make) {
make.center.equalTo(self);
}];
}];
}
- (void)endAnimation:(BOOL)block{
[self setNeedsUpdateConstraints];
[UIView animateWithDuration:.25f animations:^{
self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.0];
[self->bgview mas_updateConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.frame.size.height-200);
}];
[self layoutIfNeeded];
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
@end
......@@ -15,7 +15,7 @@ class SHRecordListCell: UITableViewCell {
set{
_model = newValue
addressLab?.text = newValue.address.length > 0 ? newValue.address : newValue.pathFile
addressLab?.text = newValue.rename.length > 0 ? newValue.rename : newValue.pathFile
timeLab?.text = newValue.time.format("yyyy-MM-dd HH:mm")
duringLab?.text = self.countSecond(newValue.during)
}
......
......@@ -25,19 +25,39 @@ class SHRecordListViewController: SHBaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.leftBarButtonItem = UIBarButtonItem.init(image: UIImage.init(named: "record_nav_user"), style: .plain, target: self, action: #selector(userCilck))
let leftImage = UIImage.init(named: "record_nav_user")?.withRenderingMode(.alwaysOriginal)
self.navigationItem.leftBarButtonItem = UIBarButtonItem.init(image: leftImage, style: .plain, target: self, action: #selector(userCilck))
setupUI()
SHCloudManager.shared.cheakAccountStatus { (result) in
if result == false{
AlertControllerTool.alertController(withTitle: "iCoiud同步", message: "iCloud云端“速记大师”已关闭,启用iCloud云端“速记大师”将允许您在所有设备上访问和同步录音", cancelTitle: "取消", cancel: {
}, confirm: "启用", confirmBlock: { message in
let url = URL.init(string: UIApplication.openSettingsURLString)
if UIApplication.shared.canOpenURL(url!) {
if #available(iOS 11.0, *) {
UIApplication.shared.open(url!, options: [:], completionHandler: nil)
}else{
UIApplication.shared.openURL(url!)
}
}
}, finish: nil)
}
}
}
func prepareDateSource(){
dataSources = []
let list = CRUserDefaults.recordList
for dic in list ?? []{
let model = SHRecordModel()
model.setValuesForKeys(dic)
if model.delete == false{
dataSources.append(model)
if let list = CRUserDefaults.recordList {
for dic in list.reversed(){
let model = SHRecordModel()
model.setValuesForKeys(dic)
if model.delete == false{
dataSources.append(model)
}
}
}
......@@ -97,6 +117,13 @@ class SHRecordListViewController: SHBaseViewController {
}
@IBAction func goRecord(){
if let list = CRUserDefaults.recordList, list.count > 1{
if SHUserAccountManager.shared.isMember == false{
self.goGoods()
return
}
}
let record = UIStoryboard.init(name: "Record", bundle: nil).instantiateViewController(withIdentifier: "SHRecordViewController") as! SHRecordViewController
self.navigationController?.pushViewController(record, animated: true)
}
......@@ -121,6 +148,7 @@ extension SHRecordListViewController: UITableViewDelegate, UITableViewDataSource
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let show = UIStoryboard.init(name: "Record", bundle: nil).instantiateViewController(withIdentifier: "SHRecordShowViewController") as! SHRecordShowViewController
show.model = dataSources[indexPath.row]
self.navigationController?.pushViewController(show, animated: true)
......
......@@ -13,6 +13,7 @@ class SHRecordModel: NSObject, NSCoding{
@objc var time: Date = Date()
@objc var during: NSInteger = 0
@objc var address: String = ""
@objc var rename: String = ""
@objc var pathFile: String = ""
@objc var pcmPathFile: String = ""
@objc var txt: String = ""
......@@ -27,7 +28,7 @@ class SHRecordModel: NSObject, NSCoding{
}
//构造方法
required init(time:Date=Date(), during:NSInteger=0, address:String="", pathFile:String="", pcmPathFile:String="", txt:String="", delete:Bool=false, deleteDate:Date=Date(), fileData:Data=Data()) {
required init(time:Date=Date(), during:NSInteger=0, address:String="", rename:String="", pathFile:String="", pcmPathFile:String="", txt:String="", delete:Bool=false, deleteDate:Date=Date(), fileData:Data=Data()) {
self.time = time
self.during = during
self.address = address
......@@ -37,6 +38,7 @@ class SHRecordModel: NSObject, NSCoding{
self.delete = delete
self.deleteDate = deleteDate
self.fileData = fileData
self.rename = rename
}
//从object解析回来
......@@ -50,6 +52,7 @@ class SHRecordModel: NSObject, NSCoding{
self.delete = decoder.decodeObject(forKey: "delete") as? Bool ?? false
self.deleteDate = (decoder.decodeObject(forKey: "deleteDate") as? Date)!
self.fileData = (decoder.decodeObject(forKey: "fileData") as? Data)!
self.rename = decoder.decodeObject(forKey: "rename") as? String ?? ""
}
//编码成object
......@@ -63,5 +66,6 @@ class SHRecordModel: NSObject, NSCoding{
coder.encode(delete, forKey:"delete")
coder.encode(deleteDate, forKey:"deleteDate")
coder.encode(fileData, forKey:"fileData")
coder.encode(rename, forKey:"rename")
}
}
......@@ -68,11 +68,18 @@ class SHRecordShowViewController: SHBaseViewController {
setupUI()
play()
prepareRecognition()
// prepareRecognition()
}
deinit {
player?.pause()
player?.stop()
playerTimer?.invalidate()
confirmCilck()
}
override func goback() {
super.goback()
player?.stop()
playerTimer?.invalidate()
confirmCilck()
}
......@@ -109,24 +116,11 @@ class SHRecordShowViewController: SHBaseViewController {
override func setupUI(){
// self.navigationItem.leftBarButtonItem = UIBarButtonItem.init(image: UIImage.init(named: "record_nav_user"), style: .plain, target: self, action: #selector(userCilck))
// self.navigationItem.rightBarButtonItem = UIBarButtonItem.init(image: UIImage.init(named: "record_nav_confirm"), style: .plain, target: self, action: #selector(confirmCilck))
self.navigationItem.rightBarButtonItem = UIBarButtonItem.init(title: "原文", style: .plain, target: self, action: #selector(confirmCilck))
let titleLab = UILabel()
titleLab.frame = CGRect.init(x: 0, y: 0, width: 200, height: 44)
titleLab.text = Date().format("yyyy年MM月dd日")
titleLab.textColor = UIColor.init(r: 17, g: 17, b: 17)
titleLab.font = UIFont.systemFont(ofSize: 16)
titleLab.textAlignment = .center
titleLab.adjustsFontSizeToFitWidth = true
// self.navigationItem.rightBarButtonItem = UIBarButtonItem.init(title: "原文", style: .plain, target: self, action: #selector(confirmCilck))
self.navigationItem.titleView = titleLab
self.setNavTitle(model!.rename)
// recordTextView.attributedText = self.textView_text(model!.txt)
recordTextView?.attributedText = self.textView_text("")
recordTextView?.attributedText = self.textView_text(model!.txt)
recordTextView?.textContainerInset = UIEdgeInsets.init(top: 20, left: 20, bottom: 20, right: 30)
recordTextView?.isEditable = false
......@@ -144,6 +138,41 @@ class SHRecordShowViewController: SHBaseViewController {
progress.addTarget(self, action: #selector(sliderPlayerPlay(_:)), for: .touchUpInside)
}
func setNavTitle(_ title:String){
let titleBtn = UIButton()
titleBtn.frame = CGRect.init(x: 0, y: 0, width: 200, height: 44)
titleBtn.setTitle(title, for: .normal)
titleBtn.setTitleColor(UIColor.init(r: 17, g: 17, b: 17), for: .normal)
titleBtn.titleLabel?.font = UIFont.systemFont(ofSize: 16)
titleBtn.titleLabel?.textAlignment = .center
titleBtn.titleLabel?.adjustsFontSizeToFitWidth = true
titleBtn.addTarget(self, action: #selector(remaneBtnClick), for: .touchUpInside)
self.navigationItem.titleView = titleBtn
}
@objc func remaneBtnClick(){
AlertControllerTool.alertController(withTitle: "文件重命名", message: "", textField: "请输入新文件名", cancelTitle: "取消", cancel: {
}, confirm: "确认", confirmBlock: { message in
if let rename:String = message as? String {
self.model!.rename = rename
self.setNavTitle(self.model!.rename)
var list = CRUserDefaults.recordList
for (index, dic) in list!.enumerated(){
if dic["pathFile"] as! String == self.model!.pathFile{
var subDic = dic
subDic["rename"] = rename
list![index] = subDic
break
}
}
CRUserDefaults.recordList = list
}
}, finish: nil)
}
@objc func sliderPlayerPause(_ sender:UISlider){
self.recorderBtn.isSelected = true
player?.pause()
......@@ -239,11 +268,11 @@ class SHRecordShowViewController: SHBaseViewController {
@objc fileprivate func generatePDF() {
do {
let range: Range = model!.pathFile.range(of: "/record.wav")!
let range: Range = model!.pathFile.range(of: "/record.mp3")!
let location: Int = model!.pathFile.distance(from: model!.pathFile.startIndex, to: range.lowerBound)
let subStr = model!.pathFile.prefix(location)
let documentsFile = (NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first)!+subStr+"/\(subStr).pdf"
let documentsFile = (NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first)!+subStr+"/\(model!.rename).pdf"
try PDFGenerator.generate(self.recordTextView!, to: documentsFile)
//此三方会把传入控件约束移除 需重新添加
......@@ -274,6 +303,8 @@ class SHRecordShowViewController: SHBaseViewController {
@objc fileprivate func generateWav() {
do{
// let manager = FileManager.default
// manager.copyItem(atPath: <#T##String#>, toPath: <#T##String#>)
let documentsFile_wav = (NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first)!.appending(model!.pathFile)
let fileURL_wav = URL.init(fileURLWithPath: documentsFile_wav)
let data_wav = try Data.init(contentsOf: fileURL_wav)
......
......@@ -98,10 +98,6 @@ class SHRecordViewController: SHBaseViewController{
waveView = SHRecordWaveView(frame: waveBgView.bounds, type: .line, capacity: soundMeterCount)
waveBgView.addSubview(waveView)
SHLocationManager.shared.locationStatusService { (address) in
self.currentAddress = address
}
setNavTitleAndConfirmBtn()
}
......@@ -174,7 +170,7 @@ class SHRecordViewController: SHBaseViewController{
if let model = currentModel {
self.removeCurrentRecored(model)
}
// saveContent()
saveContent()
if save == true {
currentTxt = ""
recognitionTaskText = []
......@@ -195,11 +191,26 @@ class SHRecordViewController: SHBaseViewController{
@objc @IBAction func recordBtnClick(_ sender:UIButton){
// setNavTitleAndConfirmBtn()
if seconds >= 3 {
let isMember = self.verityMember()
if isMember == false {
return
}
}
sender.setImage(UIImage.init(named: "record_pause"), for: .normal)
sender.isSelected = !sender.isSelected
if sender.isSelected == true {
SHLocationManager.shared.locationStatusService { (address) in
self.currentAddress = address
if self.recognitionTaskText.count == 0 {
self.recordTextView.attributedText = self.textView_text(self.currentTxt ?? "")
}else{
self.recordTextView.attributedText = self.textView_text(self.recognitionTaskText.first! + "\n" + (self.currentTxt ?? ""))
}
}
self.view.sendSubviewToBack(maskView)
recorder?.record()
recorder_mp3.start()
......@@ -223,6 +234,34 @@ class SHRecordViewController: SHBaseViewController{
}
}
func verityMember()->Bool{
if SHUserAccountManager.shared.isMember == false{
recorderBtn.isSelected = false
recorder?.pause()
recorder_mp3.pause()
start = false
recognitionTask?.cancel()
speechStop()
timerInvalidate()
self.showMemberAlert()
}
return SHUserAccountManager.shared.isMember
}
func showMemberAlert(){
let alert = SHMemberUpgradeAlertView.init()
self.view.window?.addSubview(alert)
alert.callBack = {
self.goGoods()
}
}
private func getRecorder() -> AVAudioRecorder?{
// setting : 录音的设置项
// 录音参数设置(不需要掌握, 一些固定的配置)
......@@ -250,7 +289,6 @@ class SHRecordViewController: SHBaseViewController{
}
}
private func configPathFile(){
let fileManager = FileManager.default
......@@ -405,12 +443,13 @@ class SHRecordViewController: SHBaseViewController{
let model = SHRecordModel()
model.time = Date()
model.address = currentAddress ?? ""
model.rename = currentAddress ?? ""
model.txt = recognitionTaskText.first ?? (self.currentTxt ?? "")
model.pathFile = mp3_file_path!
model.pcmPathFile = pcm_file_path!
model.during = seconds
let dic = ["time":model.time, "address":model.address, "txt":model.txt, "pathFile":model.pathFile, "during":model.during, "delete":model.delete] as [String : Any]
let dic = ["time":model.time, "address":model.address, "txt":model.txt, "pathFile":model.pathFile, "during":model.during, "delete":model.delete, "rename":model.rename] as [String : Any]
var list = CRUserDefaults.recordList
if list == nil {
......@@ -463,7 +502,6 @@ class SHRecordViewController: SHBaseViewController{
// } catch {
//
// }
}
func removeCurrentRecored(_ model:SHRecordModel){
......@@ -508,6 +546,11 @@ extension SHRecordViewController{
let second = (seconds)%60;
let timeString = String(format: "%02lu:%02lu:%02lu", hours, minutes, second)
secondsLabel.text = timeString
saveContent()
if seconds == 3 {
_ = self.verityMember()
}
}
@objc private func updateMeters() {
......@@ -583,7 +626,7 @@ extension SHRecordViewController{
private func generatePDF() {
do {
let range: Range = currentModel!.pathFile.range(of: "/record.wav")!
let range: Range = currentModel!.pathFile.range(of: "/record.map")!
let location: Int = currentModel!.pathFile.distance(from: currentModel!.pathFile.startIndex, to: range.lowerBound)
let subStr = currentModel!.pathFile.prefix(location)
......
......@@ -24,28 +24,28 @@ class SHCloudManager: NSObject {
typealias handler = ((Bool) -> ())
var statusHandler: handler?
// func cheakAccountStatus(_ handler:@escaping handler){
//
// statusHandler = handler
//
// let container = CKContainer.default()
// container.accountStatus { (status, statusError) in
//
// if let error = statusError {
// self.statusHandler?(false)
// print("\(error.localizedDescription)")
// }else{
// switch status {
// case .available:
// self.statusHandler?(true)
// break;
// default:
// self.statusHandler?(false)
// break;
// }
// }
// }
// }
func cheakAccountStatus(_ handler:@escaping handler){
statusHandler = handler
let container = CKContainer.default()
container.accountStatus { (status, statusError) in
if let error = statusError {
self.statusHandler?(false)
print("\(error.localizedDescription)")
}else{
switch status {
case .available:
self.statusHandler?(true)
break;
default:
self.statusHandler?(false)
break;
}
}
}
}
func getAllRecordDataSource(){
......
......@@ -11,191 +11,117 @@ import SwiftyStoreKit
class SHStoreManager: NSObject {
@objc class func purchaseWithProductId(productId: String, inView: UIView, success: @escaping(()->Void) ,faliure: @escaping(()->Void)) {
let productIdentifier = productId
print(productIdentifier)
let hud = MBProgressHUD.showAdded(to: inView, animated: true)
SwiftyStoreKit.purchaseProduct(productId, quantity: 1, atomically: true) { result in
hud.hide(animated: true)
switch result {
case .success(let product):
log("Purchase Success: \(product.productId)")
let appleValidator = AppleReceiptValidator(service: .production, sharedSecret: "a2495c6d266e43fea58fda6c49f12264")
let hud = MBProgressHUD.showAdded(to: inView, animated: true)
SwiftyStoreKit.verifyReceipt(using: appleValidator) { result in
hud.hide(animated: true)
if case .success(let receipt) = result {
let purchaseResult = SwiftyStoreKit.verifySubscription(
ofType: .autoRenewable,
productId: productId,
inReceipt: receipt)
switch purchaseResult {
case .purchased(let expiryDate, _):
print("Product is valid until \(expiryDate)")
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm"
let dateStr = dateFormatter.string(from: expiryDate)
CRUserDefaults.expireInTime = dateStr
if product.needsFinishTransaction {
SwiftyStoreKit.finishTransaction(product.transaction)
}
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.5) {
success()
@objc class func purchaseWithProductId(productId: String, inView: UIView, success: @escaping(()->Void) ,faliure: @escaping((String)->Void)) {
let hud = MBProgressHUD.showAdded(to: inView, animated: true)
SwiftyStoreKit.purchaseProduct(productId, quantity: 1, atomically: true) { result in
hud.hide(animated: true)
switch result {
case .success(let product):
log("Purchase Success: \(product.productId)")
let appleValidator = AppleReceiptValidator(service: .production, sharedSecret: "a2495c6d266e43fea58fda6c49f12264")
let hud1 = MBProgressHUD.showAdded(to: inView, animated: true)
SwiftyStoreKit.verifyReceipt(using: appleValidator) { result in
hud1.hide(animated: true)
if case .success(let receipt) = result {
let purchaseResult = SwiftyStoreKit.verifySubscription(
ofType: .autoRenewable,
productId: productId,
inReceipt: receipt)
switch purchaseResult {
case .purchased(let expiryDate, _):
print("Product is valid until \(expiryDate)")
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm"
let dateStr = dateFormatter.string(from: expiryDate)
CRUserDefaults.expireInTime = dateStr
if product.needsFinishTransaction {
SwiftyStoreKit.finishTransaction(product.transaction)
}
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.5) {
success()
}
case .expired(let expiryDate, _):
MBProgressHUD.showError("订阅已过期,请重新获取", to: inView)
print("Product is expired since \(expiryDate)")
case .notPurchased:
print("This product has never been purchased")
}
case .expired(let expiryDate, _):
MBProgressHUD.showError("订阅已过期,请重新获取", to: inView)
print("Product is expired since \(expiryDate)")
case .notPurchased:
print("This product has never been purchased")
} else {
// receipt verification error
}
} else {
// receipt verification error
}
}
let receiptData = SwiftyStoreKit.localReceiptData
let receiptString = receiptData?.base64EncodedString(options: []) ?? ""
print("receiptString: \(receiptString)")
/*
receipt_data:不传的话 服务器根本没法校验
product_id:这个也不用解释 内购产品编号 你不传的话 服务器不知道你买的哪个订单
transaction_id:这个是交易编号
*/
// 需要验证
let dict = ["productId": product.productId, "transactionId" : (product.transaction.transactionIdentifier ?? ""), "receiptData" : receiptString]
print("productId transactionId receiptData: \(dict)")
// TODO: 服务器验证
let innerHud = MBProgressHUD.showAdded(to: inView, animated: true)
CMNetworkManager.shared.postRequestWithBody(withPath: .iosIPAVerifyReceipt, body: dict) { (json, error) in
innerHud.hide(animated: true)
print("success----iosIPAVerifyReceipt-----------------\(json)------")
let result: Bool = json["result"]["data"]["status"].boolValue
if result {
if product.needsFinishTransaction {
SwiftyStoreKit.finishTransaction(product.transaction)
}
print("Purchase Success: \(product.productId)")
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.5) {
success()
}
} else {
MBProgressHUD.showError("未知错误,请联系客服")
}
}
case .error(let error):
faliure();
hud.hide(animated: true);
switch error.code {
case .unknown:
print("Unknown error. Please contact support")
MBProgressHUD.showError("无法连接到 iTunes Store, 请稍后再试")
case .paymentCancelled:
MBProgressHUD.showError("您已取消购买")
case .paymentInvalid:
MBProgressHUD.showError("无法购买, 请试试其他的")
print("The purchase identifier was invalid")
case .clientInvalid: print("Not allowed to make the payment")
case .paymentNotAllowed: print("The device is not allowed to make the payment")
case .storeProductNotAvailable: print("The product is not available in the current storefront")
case .cloudServicePermissionDenied: print("Access to cloud service information is not allowed")
case .cloudServiceNetworkConnectionFailed:
MBProgressHUD.showError("无法连接到网络")
print("Could not connect to the network")
case .cloudServiceRevoked: print("User has revoked permission to use this cloud service")
default:
print((error as NSError).localizedDescription)
MBProgressHUD.showError((error as NSError).localizedDescription)
}
}
}
}
/// 静态初始化
@objc class func launchWithSwiftyStoreKit() {
SwiftyStoreKit.completeTransactions(atomically: true) { purchases in
let sortedResults = purchases.sorted { (purchase1, purchase2) -> Bool in
if let date1 = purchase1.transaction.transactionDate, let data2 = purchase2.transaction.transactionDate {
return date1.compare(data2) == .orderedAscending
}
return false
}
print("Restore sortedResults: \(sortedResults)")
if let purchase = sortedResults.last {
switch purchase.transaction.transactionState {
case .purchased, .restored:
// Deliver content from server, then:
let receiptData = SwiftyStoreKit.localReceiptData
let receiptString = receiptData?.base64EncodedString(options: []) ?? ""
print("receiptString: \(receiptString)")
print("Purchase Success: \(purchase.productId.description) receiptString: \(receiptString)")
// TODO: 服务器验证
// if purchase.needsFinishTransaction {
// let receiptData = SwiftyStoreKit.localReceiptData
// let receiptString = receiptData?.base64EncodedString(options: []) ?? ""
let dict = ["productId": purchase.productId, "transactionId" : (purchase.transaction.transactionIdentifier ?? ""), "receiptData" : receiptString]
/*
receipt_data:不传的话 服务器根本没法校验
product_id:这个也不用解释 内购产品编号 你不传的话 服务器不知道你买的哪个订单
transaction_id:这个是交易编号
*/
// 需要验证
let dict = ["productId": product.productId, "transactionId" : (product.transaction.transactionIdentifier ?? ""), "receiptData" : receiptString]
print("productId transactionId receiptData: \(dict)")
// TODO: 服务器验证
let innerHud = MBProgressHUD.showAdded(to: inView, animated: true)
CMNetworkManager.shared.postRequestWithBody(withPath: .iosIPAVerifyReceipt, body: dict) { (json, error) in
innerHud.hide(animated: true)
print("success----iosIPAVerifyReceipt-----------------\(json)------")
let result: Bool = json["result"]["data"]["status"].boolValue
if result {
if purchase.needsFinishTransaction {
SwiftyStoreKit.finishTransaction(purchase.transaction)
if product.needsFinishTransaction {
SwiftyStoreKit.finishTransaction(product.transaction)
}
print("Purchase Success: \(product.productId)")
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.5) {
success()
}
print("Purchase Success: \(purchase.productId)")
} else {
// MBProgressHUD.showError("未知错误,请联系客服")
faliure(error?.localizedDescription ?? "未知错误,请联系客服")
MBProgressHUD.showError("未知错误,请联系客服")
}
}
// }
// Unlock content
case .failed, .purchasing, .deferred:
break // do nothing
@unknown default:
break
}
}
}
}
class func forceFetchReceipt(product: PurchaseDetails) {
SwiftyStoreKit.fetchReceipt(forceRefresh: true) { result in
switch result {
case .success(let receiptData):
let encryptedReceipt = receiptData.base64EncodedString(options: [])
print("Fetch receipt success:\n\(encryptedReceipt)")
// fetch content from your server, then:
if product.needsFinishTransaction {
SwiftyStoreKit.finishTransaction(product.transaction)
case .error(let error):
faliure(error.localizedDescription)
hud.hide(animated: true)
switch error.code {
case .unknown:
print("Unknown error. Please contact support")
MBProgressHUD.showError("无法连接到 iTunes Store, 请稍后再试")
case .paymentCancelled:
MBProgressHUD.showError("您已取消购买")
case .paymentInvalid:
MBProgressHUD.showError("无法购买, 请试试其他的")
print("The purchase identifier was invalid")
case .clientInvalid: print("Not allowed to make the payment")
case .paymentNotAllowed: print("The device is not allowed to make the payment")
case .storeProductNotAvailable: print("The product is not available in the current storefront")
case .cloudServicePermissionDenied: print("Access to cloud service information is not allowed")
case .cloudServiceNetworkConnectionFailed:
MBProgressHUD.showError("无法连接到网络")
print("Could not connect to the network")
case .cloudServiceRevoked: print("User has revoked permission to use this cloud service")
default:
print((error as NSError).localizedDescription)
MBProgressHUD.showError((error as NSError).localizedDescription)
}
}
case .error(let error):
print("Fetch receipt failed: \(error)")
}
}
}
// 恢复购买
@objc class func restorePurchases(success: @escaping(()->Void), toView: UIView) {
let hud = MBProgressHUD.showAdded(to: UIApplication.shared.delegate!.window!!, animated: true)
SwiftyStoreKit.restorePurchases(atomically: true) { results in
hud.hide(animated: true);
if results.restoreFailedPurchases.count > 0 {
print("Restore Failed: \(results.restoreFailedPurchases)")
} else if results.restoredPurchases.count > 0 {
let sortedResults = results.restoredPurchases.sorted { (purchase1, purchase2) -> Bool in
/// 静态初始化
@objc class func launchWithSwiftyStoreKit() {
SwiftyStoreKit.completeTransactions(atomically: true) { purchases in
let sortedResults = purchases.sorted { (purchase1, purchase2) -> Bool in
if let date1 = purchase1.transaction.transactionDate, let data2 = purchase2.transaction.transactionDate {
return date1.compare(data2) == .orderedAscending
}
......@@ -203,52 +129,123 @@ class SHStoreManager: NSObject {
}
print("Restore sortedResults: \(sortedResults)")
if let purchase = sortedResults.last {
let appleValidator = AppleReceiptValidator(service: .production, sharedSecret: "a2495c6d266e43fea58fda6c49f12264")
let hud = MBProgressHUD.showAdded(to: UIApplication.shared.delegate!.window!!, animated: true)
SwiftyStoreKit.verifyReceipt(using: appleValidator) { result in
hud.hide(animated: true)
if case .success(let receipt) = result {
let purchaseResult = SwiftyStoreKit.verifySubscription(
ofType: .autoRenewable,
productId: purchase.productId,
inReceipt: receipt)
switch purchase.transaction.transactionState {
case .purchased, .restored:
// Deliver content from server, then:
let receiptData = SwiftyStoreKit.localReceiptData
let receiptString = receiptData?.base64EncodedString(options: []) ?? ""
print("Purchase Success: \(purchase.productId.description) receiptString: \(receiptString)")
// TODO: 服务器验证
// if purchase.needsFinishTransaction {
// let receiptData = SwiftyStoreKit.localReceiptData
// let receiptString = receiptData?.base64EncodedString(options: []) ?? ""
let dict = ["productId": purchase.productId, "transactionId" : (purchase.transaction.transactionIdentifier ?? ""), "receiptData" : receiptString]
print("productId transactionId receiptData: \(dict)")
// TODO: 服务器验证
CMNetworkManager.shared.postRequestWithBody(withPath: .iosIPAVerifyReceipt, body: dict) { (json, error) in
print("success----iosIPAVerifyReceipt-----------------\(json)------")
switch purchaseResult {
case .purchased(let expiryDate, _):
print("Product is valid until \(expiryDate)")
let dateFormatter = DateFormatter()
dateFormatter.locale = Locale(identifier: "en_CN")
dateFormatter.timeZone = TimeZone.current
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm"
let dateStr = dateFormatter.string(from: expiryDate)
CRUserDefaults.expireInTime = dateStr
MBProgressHUD.showSuccess("恢复成功", to: toView)
let result: Bool = json["result"]["data"]["status"].boolValue
if result {
if purchase.needsFinishTransaction {
SwiftyStoreKit.finishTransaction(purchase.transaction)
}
success()
case .expired(let expiryDate, _):
print("Product is expired since \(expiryDate)")
let dateFormatter = DateFormatter()
dateFormatter.locale = Locale(identifier: "en_CN")
dateFormatter.timeZone = TimeZone.current
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm"
let dateStr = dateFormatter.string(from: expiryDate)
CRUserDefaults.expireInTime = dateStr
MBProgressHUD.showError("订阅已过期,请重新获取", to: toView)
case .notPurchased:
print("This product has never been purchased")
print("Purchase Success: \(purchase.productId)")
} else {
// MBProgressHUD.showError("未知错误,请联系客服")
}
}
// }
// Unlock content
case .failed, .purchasing, .deferred:
break // do nothing
@unknown default:
break
}
}
}
}
class func forceFetchReceipt(product: PurchaseDetails) {
SwiftyStoreKit.fetchReceipt(forceRefresh: true) { result in
switch result {
case .success(let receiptData):
let encryptedReceipt = receiptData.base64EncodedString(options: [])
print("Fetch receipt success:\n\(encryptedReceipt)")
// fetch content from your server, then:
if product.needsFinishTransaction {
SwiftyStoreKit.finishTransaction(product.transaction)
}
case .error(let error):
print("Fetch receipt failed: \(error)")
}
}
}
// 恢复购买
@objc class func restorePurchases(success: @escaping(()->Void), toView: UIView) {
let hud = MBProgressHUD.showAdded(to: toView, animated: true)
SwiftyStoreKit.restorePurchases(atomically: true) { results in
hud.hide(animated: true);
if results.restoreFailedPurchases.count > 0 {
print("Restore Failed: \(results.restoreFailedPurchases)")
} else if results.restoredPurchases.count > 0 {
let sortedResults = results.restoredPurchases.sorted { (purchase1, purchase2) -> Bool in
if let date1 = purchase1.transaction.transactionDate, let data2 = purchase2.transaction.transactionDate {
return date1.compare(data2) == .orderedAscending
}
return false
}
print("Restore sortedResults: \(sortedResults)")
if let purchase = sortedResults.last {
let appleValidator = AppleReceiptValidator(service: .production, sharedSecret: "a2495c6d266e43fea58fda6c49f12264")
let hud1 = MBProgressHUD.show(with: toView)
SwiftyStoreKit.verifyReceipt(using: appleValidator) { result in
hud1?.hide(animated: true)
if case .success(let receipt) = result {
let purchaseResult = SwiftyStoreKit.verifySubscription(
ofType: .autoRenewable,
productId: purchase.productId,
inReceipt: receipt)
switch purchaseResult {
case .purchased(let expiryDate, _):
print("Product is valid until \(expiryDate)")
let dateFormatter = DateFormatter()
dateFormatter.locale = Locale(identifier: "en_CN")
dateFormatter.timeZone = TimeZone.current
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm"
let dateStr = dateFormatter.string(from: expiryDate)
CRUserDefaults.expireInTime = dateStr
MBProgressHUD.showSuccess("恢复成功", to: toView)
if purchase.needsFinishTransaction {
SwiftyStoreKit.finishTransaction(purchase.transaction)
}
success()
case .expired(let expiryDate, _):
print("Product is expired since \(expiryDate)")
let dateFormatter = DateFormatter()
dateFormatter.locale = Locale(identifier: "en_CN")
dateFormatter.timeZone = TimeZone.current
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm"
let dateStr = dateFormatter.string(from: expiryDate)
CRUserDefaults.expireInTime = dateStr
MBProgressHUD.showError("订阅已过期,请重新获取", to: toView)
case .notPurchased:
print("This product has never been purchased")
}
} else {
// receipt verification error
}
} else {
// receipt verification error
}
print("Restore Success: \(results.restoredPurchases)")
}
print("Restore Success: \(results.restoredPurchases)")
} else {
MBProgressHUD.showError("没有商品可恢复")
print("Nothing to Restore")
}
} else {
MBProgressHUD.showError("没有商品可恢复")
print("Nothing to Restore")
}
}
}
}
......@@ -34,6 +34,8 @@ import SwiftyJSON
@objc var isMember: Bool {
return true
let dateFormatter = DateFormatter()
dateFormatter.locale = Locale(identifier: "en_CN")
dateFormatter.timeZone = TimeZone.current
......
//
// CRIAPProductModel.swift
// CallRecording
// SHAPProductModel.swift
//
//
// Created by Mazy on 2020/7/16.
// Copyright © 2020 Mazy. All rights reserved.
// Copyright © 2020 . All rights reserved.
//
import Foundation
import SwiftyJSON
struct CRIAPProductModel: Codable {
struct SHAPProductModel: Codable {
let cash: Int
let days: Int
......
......@@ -6,3 +6,5 @@
#import "AESCipher.h"
#import "UIView+CornerRadii.h"
#import "SHMp3RecordManager.h"
#import "SHMemberUpgradeAlertView.h"
#import "AlertControllerTool.h"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment