Commit 7ceb0c54 authored by zhangzhe's avatar zhangzhe

Merge branch 'branch_1.0.1' of gitlab.huolea.com:lmi/shorthandmaster into branch_1.0.1

parents 92f0fb20 5bd78a98
...@@ -232,6 +232,8 @@ ...@@ -232,6 +232,8 @@
A950F5B024F4E080007AB63E /* Mine.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Mine.storyboard; sourceTree = "<group>"; }; A950F5B024F4E080007AB63E /* Mine.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Mine.storyboard; sourceTree = "<group>"; };
A950F5B424F4E64A007AB63E /* UIView+CornerRadii.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+CornerRadii.h"; sourceTree = "<group>"; }; A950F5B424F4E64A007AB63E /* UIView+CornerRadii.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+CornerRadii.h"; sourceTree = "<group>"; };
A950F5B524F4E64A007AB63E /* UIView+CornerRadii.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+CornerRadii.m"; sourceTree = "<group>"; }; A950F5B524F4E64A007AB63E /* UIView+CornerRadii.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+CornerRadii.m"; sourceTree = "<group>"; };
A954DD9125222C4600C2DDB6 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Main.strings"; sourceTree = "<group>"; };
A954DD9225222C4600C2DDB6 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/LaunchScreen.strings"; sourceTree = "<group>"; };
A95A76832521D70F003B4E1C /* DDSoundWaveView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDSoundWaveView.h; sourceTree = "<group>"; }; A95A76832521D70F003B4E1C /* DDSoundWaveView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDSoundWaveView.h; sourceTree = "<group>"; };
A95A76842521D70F003B4E1C /* UIView+LayoutMethods.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+LayoutMethods.m"; sourceTree = "<group>"; }; A95A76842521D70F003B4E1C /* UIView+LayoutMethods.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+LayoutMethods.m"; sourceTree = "<group>"; };
A95A76852521D70F003B4E1C /* DDSoundWaveView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDSoundWaveView.m; sourceTree = "<group>"; }; A95A76852521D70F003B4E1C /* DDSoundWaveView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DDSoundWaveView.m; sourceTree = "<group>"; };
...@@ -968,6 +970,7 @@ ...@@ -968,6 +970,7 @@
knownRegions = ( knownRegions = (
en, en,
Base, Base,
"zh-Hans",
); );
mainGroup = A95CDF5B24E0E8B50066DAE6; mainGroup = A95CDF5B24E0E8B50066DAE6;
productRefGroup = A95CDF6524E0E8B50066DAE6 /* Products */; productRefGroup = A95CDF6524E0E8B50066DAE6 /* Products */;
...@@ -1219,6 +1222,7 @@ ...@@ -1219,6 +1222,7 @@
isa = PBXVariantGroup; isa = PBXVariantGroup;
children = ( children = (
A95CDF6E24E0E8B50066DAE6 /* Base */, A95CDF6E24E0E8B50066DAE6 /* Base */,
A954DD9125222C4600C2DDB6 /* zh-Hans */,
); );
name = Main.storyboard; name = Main.storyboard;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -1227,6 +1231,7 @@ ...@@ -1227,6 +1231,7 @@
isa = PBXVariantGroup; isa = PBXVariantGroup;
children = ( children = (
A95CDF7324E0E8B80066DAE6 /* Base */, A95CDF7324E0E8B80066DAE6 /* Base */,
A954DD9225222C4600C2DDB6 /* zh-Hans */,
); );
name = LaunchScreen.storyboard; name = LaunchScreen.storyboard;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -1238,6 +1243,7 @@ ...@@ -1238,6 +1243,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
...@@ -1298,6 +1304,7 @@ ...@@ -1298,6 +1304,7 @@
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO; ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
...@@ -1354,9 +1361,9 @@ ...@@ -1354,9 +1361,9 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "ShorthandMaster/速记大师.entitlements"; CODE_SIGN_ENTITLEMENTS = "ShorthandMaster/速记大师.entitlements";
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2; CURRENT_PROJECT_VERSION = 3;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 8F4PP38DC3; DEVELOPMENT_TEAM = 8F4PP38DC3;
GCC_INPUT_FILETYPE = automatic; GCC_INPUT_FILETYPE = automatic;
...@@ -1371,10 +1378,10 @@ ...@@ -1371,10 +1378,10 @@
"$(PROJECT_DIR)/ShorthandMaster/Other/Lame", "$(PROJECT_DIR)/ShorthandMaster/Other/Lame",
"$(PROJECT_DIR)/ShorthandMaster/Other/lame", "$(PROJECT_DIR)/ShorthandMaster/Other/lame",
); );
MARKETING_VERSION = 1.0.0; MARKETING_VERSION = 1.0.1;
PRODUCT_BUNDLE_IDENTIFIER = com.ShorthandMaster.www; PRODUCT_BUNDLE_IDENTIFIER = com.ShorthandMaster.www;
PRODUCT_NAME = "速记大师"; PRODUCT_NAME = "速记大师";
PROVISIONING_PROFILE_SPECIFIER = ShorthandMasterDevProfile; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/ShorthandMaster/ShorthandMaster-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/ShorthandMaster/ShorthandMaster-Bridging-Header.h";
SWIFT_OBJC_INTERFACE_HEADER_NAME = "ShorthandMaster-Swift.h"; SWIFT_OBJC_INTERFACE_HEADER_NAME = "ShorthandMaster-Swift.h";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
...@@ -1388,9 +1395,9 @@ ...@@ -1388,9 +1395,9 @@
buildSettings = { buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "ShorthandMaster/速记大师.entitlements"; CODE_SIGN_ENTITLEMENTS = "ShorthandMaster/速记大师.entitlements";
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2; CURRENT_PROJECT_VERSION = 3;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 8F4PP38DC3; DEVELOPMENT_TEAM = 8F4PP38DC3;
GCC_INPUT_FILETYPE = automatic; GCC_INPUT_FILETYPE = automatic;
...@@ -1405,10 +1412,10 @@ ...@@ -1405,10 +1412,10 @@
"$(PROJECT_DIR)/ShorthandMaster/Other/Lame", "$(PROJECT_DIR)/ShorthandMaster/Other/Lame",
"$(PROJECT_DIR)/ShorthandMaster/Other/lame", "$(PROJECT_DIR)/ShorthandMaster/Other/lame",
); );
MARKETING_VERSION = 1.0.0; MARKETING_VERSION = 1.0.1;
PRODUCT_BUNDLE_IDENTIFIER = com.ShorthandMaster.www; PRODUCT_BUNDLE_IDENTIFIER = com.ShorthandMaster.www;
PRODUCT_NAME = "速记大师"; PRODUCT_NAME = "速记大师";
PROVISIONING_PROFILE_SPECIFIER = ShorthandMasterDevProfile; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/ShorthandMaster/ShorthandMaster-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/ShorthandMaster/ShorthandMaster-Bridging-Header.h";
SWIFT_OBJC_INTERFACE_HEADER_NAME = "ShorthandMaster-Swift.h"; SWIFT_OBJC_INTERFACE_HEADER_NAME = "ShorthandMaster-Swift.h";
SWIFT_VERSION = 5.0; SWIFT_VERSION = 5.0;
......
...@@ -27,7 +27,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -27,7 +27,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
MobClick.event("app_start") MobClick.event("app_start")
SHUserAccountManager.shared.logCollection(with: .appStart) SHUserAccountManager.shared.logCollection(with: .appStart)
// IQKeyboardManager.shared.enable = true IQKeyboardManager.shared.enable = true
self.window = UIWindow(frame: UIScreen.main.bounds) self.window = UIWindow(frame: UIScreen.main.bounds)
......
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>NSPhotoLibraryUsageDescription</key>
<string></string>
<key>NSCameraUsageDescription</key>
<string></string>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string> <string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
...@@ -29,6 +25,8 @@ ...@@ -29,6 +25,8 @@
<key>NSAllowsArbitraryLoads</key> <key>NSAllowsArbitraryLoads</key>
<true/> <true/>
</dict> </dict>
<key>NSCameraUsageDescription</key>
<string></string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key> <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>App需要您开启定位权限,命名您的文件名称</string> <string>App需要您开启定位权限,命名您的文件名称</string>
<key>NSLocationAlwaysUsageDescription</key> <key>NSLocationAlwaysUsageDescription</key>
...@@ -39,6 +37,8 @@ ...@@ -39,6 +37,8 @@
<string>App需要您开启定位权限,命名您的文件名称</string> <string>App需要您开启定位权限,命名您的文件名称</string>
<key>NSMicrophoneUsageDescription</key> <key>NSMicrophoneUsageDescription</key>
<string>App需要访问麦克风,进行录音并保存</string> <string>App需要访问麦克风,进行录音并保存</string>
<key>NSPhotoLibraryUsageDescription</key>
<string></string>
<key>NSSpeechRecognitionUsageDescription</key> <key>NSSpeechRecognitionUsageDescription</key>
<string>App需要您允许以使用语音识别进行语音转译</string> <string>App需要您允许以使用语音识别进行语音转译</string>
<key>UIBackgroundModes</key> <key>UIBackgroundModes</key>
......
...@@ -73,7 +73,7 @@ class SHMineViewController: SHBaseViewController { ...@@ -73,7 +73,7 @@ class SHMineViewController: SHBaseViewController {
} }
func sortType(){ func sortType(){
UIAlertController.showActionSheet(withTitle: "", message: "", cancelBtnTitle: "取消", otherBtnTitles: sortTypes) { (index) in UIAlertController.showActionSheet(withTitle: nil, message: nil, cancelBtnTitle: "取消", otherBtnTitles: sortTypes) { (index) in
if index == 0{ if index == 0{
return return
} }
...@@ -107,7 +107,7 @@ extension SHMineViewController:UITableViewDelegate, UITableViewDataSource{ ...@@ -107,7 +107,7 @@ extension SHMineViewController:UITableViewDelegate, UITableViewDataSource{
if indexPath.section == 0 { if indexPath.section == 0 {
cell?.detailTextLabel?.text = currentSortType cell?.detailTextLabel?.text = currentSortType
cell?.detailTextLabel?.font = UIFont.systemFont(ofSize: 12) cell?.detailTextLabel?.font = UIFont.systemFont(ofSize: 16)
} }
cell?.accessoryType = .disclosureIndicator cell?.accessoryType = .disclosureIndicator
...@@ -153,6 +153,7 @@ extension SHMineViewController:UITableViewDelegate, UITableViewDataSource{ ...@@ -153,6 +153,7 @@ extension SHMineViewController:UITableViewDelegate, UITableViewDataSource{
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
switch indexPath.section { switch indexPath.section {
case 0: case 0:
sortType() sortType()
...@@ -178,7 +179,18 @@ extension SHMineViewController:UITableViewDelegate, UITableViewDataSource{ ...@@ -178,7 +179,18 @@ extension SHMineViewController:UITableViewDelegate, UITableViewDataSource{
self.navigationController?.pushViewController(webView, animated: true) self.navigationController?.pushViewController(webView, animated: true)
break break
case 3: case 3:
SHStoreManager.restorePurchases(success: {
SHUserAccountManager.shared.getUserInfo({ (model) in
if model.isMember{
self.getUserInfo()
MBProgressHUD.showSuccess("恢复成功")
}else{
MBProgressHUD.showError("恢复失败,请稍后再试")
}
}, failure: {
MBProgressHUD.showError("恢复失败,请稍后再试")
})
}, toView: self.view)
break break
default: default:
break break
...@@ -188,13 +200,5 @@ extension SHMineViewController:UITableViewDelegate, UITableViewDataSource{ ...@@ -188,13 +200,5 @@ extension SHMineViewController:UITableViewDelegate, UITableViewDataSource{
default: default:
break break
} }
// let webView = SHWebViewController()
// webView.url = SHUserAccountManager.shared.h5_urlDic["user"] as? String
// webView.title = "付费用户协议"
// self.navigationController?.pushViewController(webView, animated: true)
// let delete = UIStoryboard.init(name: "Mine", bundle: nil).instantiateViewController(withIdentifier: "SHDeleteDetailsViewController") as! SHDeleteDetailsViewController
// self.navigationController?.pushViewController(delete, animated: true)
} }
} }
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
NSString *type; NSString *type;
if (ary.count <= 0) { if (ary.count <= 0) {
[UIAlertController showAlertViewWithTitle:@"提示" Message:@"数据源不能为空" BtnTitles:@[@"确定"] ClickBtn:nil]; // [UIAlertController showAlertViewWithTitle:@"提示" Message:@"数据源不能为空" BtnTitles:@[@"确定"] ClickBtn:nil];
return sortDic; return sortDic;
} }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
NSString * type; NSString * type;
if(originalArray.count <= 0){ if(originalArray.count <= 0){
UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"提示" message:@"数据源不能为空" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles: nil]; UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"提示" message:@"数据源不能为空" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles: nil];
[alert show]; // [alert show];
return originalArray; return originalArray;
} }
else{ else{
......
...@@ -32,6 +32,7 @@ class SHRecordModel: NSObject{ ...@@ -32,6 +32,7 @@ class SHRecordModel: NSObject{
@objc var selected: Bool = false @objc var selected: Bool = false
@objc var icloud: Bool = false @objc var icloud: Bool = false
@objc var processing: Bool = false
override func setValue(_ value: Any?, forUndefinedKey key: String) { override func setValue(_ value: Any?, forUndefinedKey key: String) {
......
...@@ -193,13 +193,13 @@ ...@@ -193,13 +193,13 @@
<rect key="frame" x="0.0" y="100" width="414" height="678"/> <rect key="frame" x="0.0" y="100" width="414" height="678"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="点击右上角添加笔记" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JlT-EC-bWg"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="点击右上角添加笔记" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JlT-EC-bWg">
<rect key="frame" x="115.5" y="395" width="183.5" height="24"/> <rect key="frame" x="124.5" y="396" width="165.5" height="21.5"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/> <fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="0.84705882349999995" colorSpace="calibratedRGB"/> <color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="0.84705882349999995" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="recordlist_no_data" translatesAutoresizingMaskIntoConstraints="NO" id="1ji-L1-Qj7"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="recordlist_no_data" translatesAutoresizingMaskIntoConstraints="NO" id="1ji-L1-Qj7">
<rect key="frame" x="123.5" y="272" width="167" height="103"/> <rect key="frame" x="123.5" y="273" width="167" height="103"/>
</imageView> </imageView>
</subviews> </subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
...@@ -334,13 +334,13 @@ ...@@ -334,13 +334,13 @@
<rect key="frame" x="0.0" y="44" width="414" height="758"/> <rect key="frame" x="0.0" y="44" width="414" height="758"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="这个笔记本里还没有笔记" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QYS-Yf-f9g"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="这个笔记本里还没有笔记" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QYS-Yf-f9g">
<rect key="frame" x="95" y="367" width="224.5" height="24"/> <rect key="frame" x="106" y="368.5" width="202" height="21.5"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/> <fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="0.84705882349999995" colorSpace="calibratedRGB"/> <color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="0.84705882349999995" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="recordlist_no_data" translatesAutoresizingMaskIntoConstraints="NO" id="QrU-uf-U0R"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="recordlist_no_data" translatesAutoresizingMaskIntoConstraints="NO" id="QrU-uf-U0R">
<rect key="frame" x="123.5" y="244" width="167" height="103"/> <rect key="frame" x="123.5" y="245.5" width="167" height="103"/>
</imageView> </imageView>
</subviews> </subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/>
......
...@@ -50,6 +50,9 @@ class SHRecordDetailsVC: SHBaseViewController { ...@@ -50,6 +50,9 @@ class SHRecordDetailsVC: SHBaseViewController {
tableView?.rowHeight = UITableView.automaticDimension tableView?.rowHeight = UITableView.automaticDimension
tableView?.separatorStyle = .none tableView?.separatorStyle = .none
self.view.layoutIfNeeded()
self.view.layoutSubviews()
bottomView?.frame = CGRect.init(x: -tableFooterView!.frame.width, y: 0, width: tableFooterView!.frame.width*2, height: tableFooterView!.frame.height) bottomView?.frame = CGRect.init(x: -tableFooterView!.frame.width, y: 0, width: tableFooterView!.frame.width*2, height: tableFooterView!.frame.height)
tableFooterAlertBgView?.addSubview(bottomView!) tableFooterAlertBgView?.addSubview(bottomView!)
...@@ -125,11 +128,12 @@ class SHRecordDetailsVC: SHBaseViewController { ...@@ -125,11 +128,12 @@ class SHRecordDetailsVC: SHBaseViewController {
@objc func editClick(_ restore:Bool){ @objc func editClick(_ restore:Bool){
self.markAlertViewShow(false)
self.bottomView?.cancel = true
if restore == false{ if restore == false{
if currentModel.dataSources.count == 0 { if currentModel.dataSources.count == 0 {
return return
} }
edit = !edit edit = !edit
}else { }else {
edit = false edit = false
...@@ -207,7 +211,9 @@ extension SHRecordDetailsVC { ...@@ -207,7 +211,9 @@ extension SHRecordDetailsVC {
//MARK:icloud上传Models //MARK:icloud上传Models
func icloundUpload(_ index:NSInteger){ func icloundUpload(_ index:NSInteger){
let model = currentModel.dataSources[index] let model = currentModel.dataSources[index]
if model.processing == true {
return
}
var contains = false var contains = false
for folderModel in SHCloudManager.shared.icloudFolderModels { for folderModel in SHCloudManager.shared.icloudFolderModels {
if currentModel.id == folderModel.id { if currentModel.id == folderModel.id {
...@@ -216,10 +222,12 @@ extension SHRecordDetailsVC { ...@@ -216,10 +222,12 @@ extension SHRecordDetailsVC {
} }
} }
model.processing = true
if contains { if contains {
SHCloudManager.shared.addNewRecord(model) { (result, models) in SHCloudManager.shared.addNewRecord(model) { (result, models) in
if result { if result {
model.icloud = true model.icloud = true
model.processing = false
SHCloudManager.shared.modifyFolder(self.currentModel) { (result, models) in SHCloudManager.shared.modifyFolder(self.currentModel) { (result, models) in
if result { if result {
self.updateocloudUI() self.updateocloudUI()
...@@ -231,6 +239,7 @@ extension SHRecordDetailsVC { ...@@ -231,6 +239,7 @@ extension SHRecordDetailsVC {
SHCloudManager.shared.addNewRecord(model) { (result, models) in SHCloudManager.shared.addNewRecord(model) { (result, models) in
if result { if result {
model.icloud = true model.icloud = true
model.processing = false
SHCloudManager.shared.addNewFolder(self.currentModel) { (result, models) in SHCloudManager.shared.addNewFolder(self.currentModel) { (result, models) in
if result { if result {
self.updateocloudUI() self.updateocloudUI()
...@@ -241,15 +250,17 @@ extension SHRecordDetailsVC { ...@@ -241,15 +250,17 @@ extension SHRecordDetailsVC {
} }
} }
//MARK:icloud 移除 Models //MARK:icloud 移除 Models
func icloundRemove(_ index:NSInteger){ func icloudRemove(_ index:NSInteger){
let model = currentModel.dataSources[index] let model = currentModel.dataSources[index]
SHCloudManager.shared.deleteRecord(model) { (result, models) in SHCloudManager.shared.deleteRecord(model) { (result, models) in
if result { if result {
model.icloud = false model.icloud = false
SHCloudManager.shared.modifyFolder(self.currentModel) { (result, models) in if let _ = SHCloudManager.shared.icloudFolderModels.filter({ $0.id == self.currentModel.id }).first{
if result { SHCloudManager.shared.modifyFolder(self.currentModel) { (result, models) in
self.updateocloudUI() if result {
self.updateocloudUI()
}
} }
} }
} }
...@@ -294,19 +305,19 @@ extension SHRecordDetailsVC { ...@@ -294,19 +305,19 @@ extension SHRecordDetailsVC {
} }
} }
} }
SHCloudManager.shared.modifyFolder(self.currentModel) { (result, models) in
if result { if let _ = SHCloudManager.shared.icloudFolderModels.filter({ $0.id == self.currentModel.id }).first{
self.updateocloudUI() SHCloudManager.shared.modifyFolder(self.currentModel) { (result, models) in
if result {
self.updateocloudUI()
}
} }
} }
if self.currentModel.dataSources.count == 0 { if self.currentModel.dataSources.count == 0 {
self.editClick(true) self.editClick(true)
self.markAlertViewShow(false)
self.bottomView?.cancel = true
} }
self.selectRecordModels = [] self.selectRecordModels = []
// edit = false
DispatchQueue.main.async { DispatchQueue.main.async {
self.tableView?.reloadData() self.tableView?.reloadData()
} }
...@@ -388,7 +399,7 @@ extension SHRecordDetailsVC: UITableViewDelegate, UITableViewDataSource{ ...@@ -388,7 +399,7 @@ extension SHRecordDetailsVC: UITableViewDelegate, UITableViewDataSource{
if model.icloud == false{ if model.icloud == false{
self.icloundUpload(indexPath.row) self.icloundUpload(indexPath.row)
}else{ }else{
self.icloundRemove(indexPath.row) self.icloudRemove(indexPath.row)
} }
} }
} }
......
...@@ -55,10 +55,7 @@ class SHRecordListViewController: SHBaseViewController { ...@@ -55,10 +55,7 @@ class SHRecordListViewController: SHBaseViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
let url = FileManager.default.url(forUbiquityContainerIdentifier: nil)
print(url as Any)
SHCloudManager.shared.getAllFolderDataSource { (result, models) in SHCloudManager.shared.getAllFolderDataSource { (result, models) in
if result{ if result{
...@@ -158,93 +155,23 @@ class SHRecordListViewController: SHBaseViewController { ...@@ -158,93 +155,23 @@ class SHRecordListViewController: SHBaseViewController {
} }
} }
var list = keyValueStore.object(forKey: "Folderlist") as? [Dictionary<String, Any>] switch CRUserDefaults.sortType {
if list == nil { case 0:
list = keyValueStore.object(forKey: "list") as? [Dictionary<String, Any>] dataSources.sort { (model0, model1) -> Bool in
} return model0.createDate.compare(model1.createDate) == ComparisonResult.orderedDescending
list = nil
if let list = list {
var folderModel = SHRecordFolderModel()
if let sub = list.first{
folderModel = getDataDictWith(dict: sub)
if folderModel.id.length == 0 {
folderModel.createDate = nowDate
folderModel.modifyDate = nowDate
folderModel.name = "未知";
folderModel.id = nowDate.milliStamp
for dic in list.reversed(){
var model = SHRecordModel()
model = getDataDictWith(dict: dic)
folderModel.dataSources.append(model)
}
let modifyDateSortDataSources = folderModel.dataSources.sorted { (model0, model1) -> Bool in
return model0.modifyDate.compare(model1.modifyDate) == ComparisonResult.orderedDescending
}
folderModel.modifyDate = modifyDateSortDataSources.first?.modifyDate ?? nowDate
let modelDict = getDictWith(obj: folderModel)
keyValueStore.set([modelDict], forKey: "Folderlist")
keyValueStore.synchronize()
print("synchronize === \(keyValueStore.synchronize())")
}
} }
topDataSources.sort { (model0, model1) -> Bool in
// let modityList = keyValueStore.object(forKey: "Folderlist") as? [Dictionary<String, Any>] return model0.createDate.compare(model1.createDate) == ComparisonResult.orderedDescending
// if let list = modityList {
// for dict in list.reversed(){
// var model = SHRecordFolderModel()
// model = getDataDictWith(dict: dict)
// if model.top == true {
// topDataSources.append(model)
// }else{
// dataSources.append(model)
// }
// }
// }
dataSources = dataSources.filterDuplicates({$0.id})
topDataSources = topDataSources.filterDuplicates({$0.id})
switch CRUserDefaults.sortType {
case 0:
dataSources.sort { (model0, model1) -> Bool in
return model0.createDate.compare(model1.createDate) == ComparisonResult.orderedDescending
}
topDataSources.sort { (model0, model1) -> Bool in
return model0.createDate.compare(model1.createDate) == ComparisonResult.orderedDescending
}
break
default:
dataSources.sort { (model0, model1) -> Bool in
return model0.modifyDate.compare(model1.modifyDate) == ComparisonResult.orderedDescending
}
topDataSources.sort { (model0, model1) -> Bool in
return model0.modifyDate.compare(model1.modifyDate) == ComparisonResult.orderedDescending
}
break
} }
}else{ break
switch CRUserDefaults.sortType { default:
case 0: dataSources.sort { (model0, model1) -> Bool in
dataSources.sort { (model0, model1) -> Bool in return model0.modifyDate.compare(model1.modifyDate) == ComparisonResult.orderedDescending
return model0.createDate.compare(model1.createDate) == ComparisonResult.orderedDescending }
} topDataSources.sort { (model0, model1) -> Bool in
topDataSources.sort { (model0, model1) -> Bool in return model0.modifyDate.compare(model1.modifyDate) == ComparisonResult.orderedDescending
return model0.createDate.compare(model1.createDate) == ComparisonResult.orderedDescending
}
break
default:
dataSources.sort { (model0, model1) -> Bool in
return model0.modifyDate.compare(model1.modifyDate) == ComparisonResult.orderedDescending
}
topDataSources.sort { (model0, model1) -> Bool in
return model0.modifyDate.compare(model1.modifyDate) == ComparisonResult.orderedDescending
}
break
} }
break
} }
dataSources = topDataSources+dataSources dataSources = topDataSources+dataSources
...@@ -260,7 +187,6 @@ class SHRecordListViewController: SHBaseViewController { ...@@ -260,7 +187,6 @@ class SHRecordListViewController: SHBaseViewController {
self.view.sendSubviewToBack(maskView) self.view.sendSubviewToBack(maskView)
} }
markCountLab?.text = "笔记本总数:\(dataSources.count)" markCountLab?.text = "笔记本总数:\(dataSources.count)"
} }
@objc func mineCilck(){ @objc func mineCilck(){
...@@ -429,10 +355,11 @@ extension SHRecordListViewController { ...@@ -429,10 +355,11 @@ extension SHRecordListViewController {
@objc func addModel(){ @objc func addModel(){
let newFolder = SHRecordRenameAlertView.loadFromNibAndClass(SHRecordRenameAlertView.self)! let newFolder = SHRecordRenameAlertView.loadFromNibAndClass(SHRecordRenameAlertView.self)!
newFolder.placeHolder = "这是一个新的笔记本名称" newFolder.placeHolder = "笔记本名称"
newFolder.title = "新笔记本" newFolder.title = "新笔记本"
newFolder.frame = UIApplication.shared.keyWindow!.bounds newFolder.frame = self.view.window?.bounds ?? CGRect.zero
UIApplication.shared.keyWindow!.addSubview(newFolder) // self.view.addSubview(newFolder)
self.navigationController?.view.addSubview(newFolder)
newFolder.confirmCallBack = { newFolderStr in newFolder.confirmCallBack = { newFolderStr in
...@@ -540,7 +467,7 @@ extension SHRecordListViewController: UITableViewDelegate, UITableViewDataSource ...@@ -540,7 +467,7 @@ extension SHRecordListViewController: UITableViewDelegate, UITableViewDataSource
self.removeModel(indexPath) self.removeModel(indexPath)
completionHandler(true) completionHandler(false)
} }
deleteAction.image = UIImage.init(named: "recordlist_delete") deleteAction.image = UIImage.init(named: "recordlist_delete")
deleteAction.backgroundColor = UIColor.init(hexStr: "E93425") deleteAction.backgroundColor = UIColor.init(hexStr: "E93425")
...@@ -549,7 +476,7 @@ extension SHRecordListViewController: UITableViewDelegate, UITableViewDataSource ...@@ -549,7 +476,7 @@ extension SHRecordListViewController: UITableViewDelegate, UITableViewDataSource
self.renameModel(indexPath) self.renameModel(indexPath)
completionHandler(true) completionHandler(false)
} }
renameAction.image = UIImage.init(named: "recordlist_rename") renameAction.image = UIImage.init(named: "recordlist_rename")
renameAction.backgroundColor = UIColor.init(hexStr: "BCBCBC") renameAction.backgroundColor = UIColor.init(hexStr: "BCBCBC")
......
...@@ -103,7 +103,7 @@ class SHRecordMoveFileVC: SHBaseViewController { ...@@ -103,7 +103,7 @@ class SHRecordMoveFileVC: SHBaseViewController {
//MARK:添加新笔记 //MARK:添加新笔记
@objc func addModel(){ @objc func addModel(){
let newFolder = SHRecordRenameAlertView.loadFromNibAndClass(SHRecordRenameAlertView.self)! let newFolder = SHRecordRenameAlertView.loadFromNibAndClass(SHRecordRenameAlertView.self)!
newFolder.placeHolder = "这是一个新的笔记本名称" newFolder.placeHolder = "笔记本名称"
newFolder.title = "新笔记本" newFolder.title = "新笔记本"
newFolder.frame = UIApplication.shared.keyWindow!.bounds newFolder.frame = UIApplication.shared.keyWindow!.bounds
UIApplication.shared.keyWindow!.addSubview(newFolder) UIApplication.shared.keyWindow!.addSubview(newFolder)
...@@ -151,7 +151,7 @@ class SHRecordMoveFileVC: SHBaseViewController { ...@@ -151,7 +151,7 @@ class SHRecordMoveFileVC: SHBaseViewController {
} }
} }
} }
MBProgressHUD.show("正在处理中,请稍后...", view: nil) MBProgressHUD.show("正在转移中,请稍后...", view: nil)
let list = CRUserDefaults.recordList let list = CRUserDefaults.recordList
if var recordList = list{ if var recordList = list{
//增 //增
...@@ -183,32 +183,43 @@ class SHRecordMoveFileVC: SHBaseViewController { ...@@ -183,32 +183,43 @@ class SHRecordMoveFileVC: SHBaseViewController {
} }
SHCloudManager.shared.modifyFolder(self.currentModel) { (result, models) in SHCloudManager.shared.modifyFolder(self.currentModel) { (result, models) in
if result {
var contains = false var contains = false
for folderModel in SHCloudManager.shared.icloudFolderModels { let folderRecord = SHCloudManager.shared.icloudFolderModels.filter({ $0.id == targetModel.id
if targetModel.id == folderModel.id { }).first
contains = true
break if folderRecord != nil {
contains = true
}
if contains {
SHCloudManager.shared.modifyFolder(targetModel) { (result, models) in
if result {
self.saveSuccessCallBack?(self.currentModel)
DispatchQueue.main.async {
MBProgressHUD.hide()
self.navigationController?.dismiss(animated: true, completion: nil)
}
} }
} }
if contains { } else {
SHCloudManager.shared.modifyFolder(targetModel) { (result, models) in
if result { let folderRecord = targetModel.dataSources.filter({ $0.icloud == true
self.saveSuccessCallBack?(self.currentModel) }).first
DispatchQueue.main.async { if folderRecord == nil {
MBProgressHUD.hide() self.saveSuccessCallBack?(self.currentModel)
self.navigationController?.dismiss(animated: true, completion: nil) DispatchQueue.main.async {
} MBProgressHUD.hide()
} self.navigationController?.dismiss(animated: true, completion: nil)
} }
} else { return
SHCloudManager.shared.addNewFolder(targetModel) { (result, models) in }
if result { SHCloudManager.shared.addNewFolder(targetModel) { (result, models) in
self.saveSuccessCallBack?(self.currentModel) if result {
DispatchQueue.main.async { self.saveSuccessCallBack?(self.currentModel)
MBProgressHUD.hide() DispatchQueue.main.async {
self.navigationController?.dismiss(animated: true, completion: nil) MBProgressHUD.hide()
} self.navigationController?.dismiss(animated: true, completion: nil)
} }
} }
} }
......
...@@ -70,7 +70,9 @@ class SHRecordViewController: SHBaseViewController{ ...@@ -70,7 +70,9 @@ class SHRecordViewController: SHBaseViewController{
} }
@objc func backGroundAlive(){ @objc func backGroundAlive(){
recorderManager.start() if recorderManager.state == .start{
recorderManager.start()
}
} }
override func goback() { override func goback() {
...@@ -123,10 +125,15 @@ class SHRecordViewController: SHBaseViewController{ ...@@ -123,10 +125,15 @@ class SHRecordViewController: SHBaseViewController{
return return
} }
// if let model = currentModel {
// self.removeCurrentRecored(model)
// }
self.recorderManager.stop() self.recorderManager.stop()
self.save = true self.save = true
self.saveContent() self.saveContent()
self.saveSuccessCallBack?(folderModel) self.saveSuccessCallBack?(folderModel)
self.timerInvalidate()
let export = SHRecordExportAlertView.loadFromNibAndClass(SHRecordExportAlertView.self)! let export = SHRecordExportAlertView.loadFromNibAndClass(SHRecordExportAlertView.self)!
export.frame = UIApplication.shared.keyWindow!.bounds export.frame = UIApplication.shared.keyWindow!.bounds
...@@ -158,35 +165,6 @@ class SHRecordViewController: SHBaseViewController{ ...@@ -158,35 +165,6 @@ class SHRecordViewController: SHBaseViewController{
} }
} }
@objc func userCilck(){
if currentTxt?.length == 0{
return
}
self.recorderManager.stop()
self.save = true
if let model = currentModel {
self.removeCurrentRecored(model)
}
saveContent()
if save == true {
self.currentTxt = ""
self.recorderBtn.setImage(UIImage.init(named: "record_start"), for: .normal)
self.recordTextView.attributedText = self.textView_text("")
self.configPathFile()
self.recorderBtn.isSelected = false
self.secondsLabel.text = "00:00:00"
self.seconds = 0
self.save = false
self.recorderManager.stop()
}
let mine = UIStoryboard.init(name: "Mine", bundle: nil).instantiateViewController(withIdentifier: "SHMineViewController") as! SHMineViewController
self.navigationController?.pushViewController(mine, animated: true)
}
@objc @IBAction func recordBtnClick(_ sender:UIButton){ @objc @IBAction func recordBtnClick(_ sender:UIButton){
if seconds >= non_member_limit_seconds { if seconds >= non_member_limit_seconds {
...@@ -285,10 +263,6 @@ class SHRecordViewController: SHBaseViewController{ ...@@ -285,10 +263,6 @@ class SHRecordViewController: SHBaseViewController{
func saveContent(){ func saveContent(){
if currentTxt?.length == 0 {
return
}
let nowDate = Date() let nowDate = Date()
let model = SHRecordModel() let model = SHRecordModel()
model.recordingType = 0 model.recordingType = 0
...@@ -301,17 +275,17 @@ class SHRecordViewController: SHBaseViewController{ ...@@ -301,17 +275,17 @@ class SHRecordViewController: SHBaseViewController{
model.pcmPathFile = pcm_file_path model.pcmPathFile = pcm_file_path
model.during = seconds model.during = seconds
image_file_paths = [] // image_file_paths = []
image_indexs = [] // image_indexs = []
let images = ["recordlist_no_data_search", "recordlist_no_data"] // let images = ["recordlist_no_data_search", "recordlist_no_data"]
for (index, imageStr) in images.enumerated(){ // for (index, imageStr) in images.enumerated(){
let image = UIImage.init(named: imageStr) // let image = UIImage.init(named: imageStr)
let filePath = DocumentPath+image_file_path+"\(index).jpeg" // let filePath = DocumentPath+image_file_path+"\(index).jpeg"
let imageData = image!.jpegData(compressionQuality: 1) // let imageData = image!.jpegData(compressionQuality: 1)
try? imageData?.write(to: URL(fileURLWithPath: filePath)) // try? imageData?.write(to: URL(fileURLWithPath: filePath))
image_file_paths.append(image_file_path+"\(index).jpeg") // image_file_paths.append(image_file_path+"\(index).jpeg")
image_indexs.append(index) // image_indexs.append(index)
} // }
model.imagesPath = [] model.imagesPath = []
model.imagesIndex = [] model.imagesIndex = []
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// //
import UIKit import UIKit
import IQKeyboardManagerSwift
class SHRecordRenameAlertView: UIView { class SHRecordRenameAlertView: UIView {
...@@ -42,9 +43,10 @@ class SHRecordRenameAlertView: UIView { ...@@ -42,9 +43,10 @@ class SHRecordRenameAlertView: UIView {
override func awakeFromNib() { override func awakeFromNib() {
super.awakeFromNib() super.awakeFromNib()
self.backgroundColor = UIColor.init(red: 0, green: 0, blue: 0, alpha: 0.3) self.backgroundColor = UIColor.init(red: 0, green: 0, blue: 0, alpha: 0.3)
bgView?.layer.cornerRadius = 8 bgView?.layer.cornerRadius = 8
self.textField?.becomeFirstResponder()
self.textField?.keyboardToolbar.doneBarButton.setTarget(self, action: #selector(self.doneButtonClicked(_:)))
} }
@objc @IBAction func cleanBtnClick(_ sender:UIButton){ @objc @IBAction func cleanBtnClick(_ sender:UIButton){
...@@ -62,5 +64,18 @@ class SHRecordRenameAlertView: UIView { ...@@ -62,5 +64,18 @@ class SHRecordRenameAlertView: UIView {
self.removeFromSuperview() self.removeFromSuperview()
} }
} }
@objc func doneButtonClicked(_ sender: Any) {
if let text = textField?.text, text.length > 0{
confirmCallBack?(textField?.text ?? "")
self.removeFromSuperview()
}else{
self.textField?.becomeFirstResponder()
}
}
deinit {
// IQKeyboardManager.shared.enable = false
}
} }
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qte-rS-SOz"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qte-rS-SOz">
<rect key="frame" x="44" y="359.5" width="326" height="177"/> <rect key="frame" x="44" y="188.5" width="326" height="176.5"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="重命名" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2Yi-xr-CGL"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="重命名" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2Yi-xr-CGL">
<rect key="frame" x="135.5" y="16" width="55.5" height="21.5"/> <rect key="frame" x="135.5" y="16" width="55.5" height="21.5"/>
...@@ -111,7 +111,7 @@ ...@@ -111,7 +111,7 @@
<constraint firstItem="qte-rS-SOz" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" multiplier="295:375" id="2PD-LC-trJ"/> <constraint firstItem="qte-rS-SOz" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" multiplier="295:375" id="2PD-LC-trJ"/>
<constraint firstItem="qte-rS-SOz" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="CA5-u5-70k"/> <constraint firstItem="qte-rS-SOz" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="CA5-u5-70k"/>
<constraint firstItem="qte-rS-SOz" firstAttribute="width" secondItem="qte-rS-SOz" secondAttribute="height" multiplier="295:160" id="R7v-tq-gOF"/> <constraint firstItem="qte-rS-SOz" firstAttribute="width" secondItem="qte-rS-SOz" secondAttribute="height" multiplier="295:160" id="R7v-tq-gOF"/>
<constraint firstItem="qte-rS-SOz" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="nKY-Te-wSH"/> <constraint firstItem="qte-rS-SOz" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" multiplier="0.618" id="nKY-Te-wSH"/>
</constraints> </constraints>
<connections> <connections>
<outlet property="bgView" destination="qte-rS-SOz" id="DBx-na-7o1"/> <outlet property="bgView" destination="qte-rS-SOz" id="DBx-na-7o1"/>
......
...@@ -11,6 +11,7 @@ import AVFoundation ...@@ -11,6 +11,7 @@ import AVFoundation
import Speech import Speech
enum SHRecordState { enum SHRecordState {
case prepare
case start case start
case pause case pause
case stop case stop
...@@ -80,7 +81,7 @@ class SHAVAudioManager: NSObject { ...@@ -80,7 +81,7 @@ class SHAVAudioManager: NSObject {
var startTime: CFTimeInterval = CACurrentMediaTime() var startTime: CFTimeInterval = CACurrentMediaTime()
var recoderResiltCallBack:((String)->Void)? var recoderResiltCallBack:((String)->Void)?
var decibelsCallBack:((Float)->Void)? var decibelsCallBack:((Float)->Void)?
var state = SHRecordState.start var state = SHRecordState.prepare
private func configRecorder(){ private func configRecorder(){
...@@ -176,6 +177,7 @@ class SHAVAudioManager: NSObject { ...@@ -176,6 +177,7 @@ class SHAVAudioManager: NSObject {
let lowPassResults = pow(10, (0.05 * (self.monitor?.peakPower(forChannel: 0))!)); let lowPassResults = pow(10, (0.05 * (self.monitor?.peakPower(forChannel: 0))!));
decibelsCallBack?(lowPassResults) decibelsCallBack?(lowPassResults)
// print("lowPassResults == \(lowPassResults)")
// print("decibels == \(decibels)") // print("decibels == \(decibels)")
if decibels > -44 { if decibels > -44 {
if recognitionTask?.isCancelled == true && self.state == SHRecordState.start{ if recognitionTask?.isCancelled == true && self.state == SHRecordState.start{
...@@ -193,9 +195,7 @@ class SHAVAudioManager: NSObject { ...@@ -193,9 +195,7 @@ class SHAVAudioManager: NSObject {
} }
func start(){ func start(){
if audioEngine.isRunning {
return
}
self.state = SHRecordState.start self.state = SHRecordState.start
self.configRecorder() self.configRecorder()
self.configSpeechTask() self.configSpeechTask()
...@@ -261,7 +261,7 @@ class SHAVAudioManager: NSObject { ...@@ -261,7 +261,7 @@ class SHAVAudioManager: NSObject {
return $0 + " " + $1 return $0 + " " + $1
}} }}
) )
if recorderResult.hasSuffix("\n") { if recorderResult.hasSuffix("\n") || recorderResult.length == 0 {
recorderResult = recorderResult + processStr recorderResult = recorderResult + processStr
}else{ }else{
recorderResult = recorderResult + " " + processStr recorderResult = recorderResult + " " + processStr
......
/* Class = "UILabel"; text = "速记大师"; ObjectID = "Zf1-FF-KGd"; */
"Zf1-FF-KGd.text" = "速记大师";
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