Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
S
ShorthandMaster
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lmj
ShorthandMaster
Commits
7b34ae43
Commit
7b34ae43
authored
Sep 29, 2020
by
lmj_521aiau@163.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
4f12f443
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
155 additions
and
125 deletions
+155
-125
Contents.json
...s/recordDetails_bottom_ microphone.imageset/Contents.json
+22
-0
编组 5@2x.png
...ils/recordDetails_bottom_ microphone.imageset/编组 5@2x.png
+0
-0
编组 5@3x.png
...ils/recordDetails_bottom_ microphone.imageset/编组 5@3x.png
+0
-0
Contents.json
...dDetails/recordDetails_bottom_note.imageset/Contents.json
+22
-0
编组 3@2x.png
...ordDetails/recordDetails_bottom_note.imageset/编组 3@2x.png
+0
-0
编组 3@3x.png
...ordDetails/recordDetails_bottom_note.imageset/编组 3@3x.png
+0
-0
Goods.storyboard
ShorthandMaster/Goods/Goods.storyboard
+48
-22
SHMineViewController.swift
ShorthandMaster/Mine/SHMineViewController.swift
+2
-2
SHSettingViewController.swift
ShorthandMaster/Mine/SHSettingViewController.swift
+2
-2
Record.storyboard
ShorthandMaster/Record/Record.storyboard
+8
-6
SHRecordDetailsVC.swift
ShorthandMaster/Record/SHRecordDetailsVC.swift
+13
-3
SHRecordListViewController.swift
ShorthandMaster/Record/SHRecordListViewController.swift
+8
-73
SHRecordViewController.swift
ShorthandMaster/Record/SHRecordViewController.swift
+12
-5
SHRecordRenameAlertView.xib
ShorthandMaster/Record/View/SHRecordRenameAlertView.xib
+2
-2
SHAVAudioManager.swift
ShorthandMaster/Share/Managers/SHAVAudioManager.swift
+15
-9
SHUserAccountManager.swift
ShorthandMaster/Share/Managers/SHUserAccountManager.swift
+1
-1
No files found.
ShorthandMaster/Assets.xcassets/RecordDetails/recordDetails_bottom_ microphone.imageset/Contents.json
0 → 100644
View file @
7b34ae43
{
"images"
:
[
{
"idiom"
:
"universal"
,
"scale"
:
"1x"
},
{
"filename"
:
"编组 5@2x.png"
,
"idiom"
:
"universal"
,
"scale"
:
"2x"
},
{
"filename"
:
"编组 5@3x.png"
,
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
ShorthandMaster/Assets.xcassets/RecordDetails/recordDetails_bottom_ microphone.imageset/编组 5@2x.png
0 → 100644
View file @
7b34ae43
1.64 KB
ShorthandMaster/Assets.xcassets/RecordDetails/recordDetails_bottom_ microphone.imageset/编组 5@3x.png
0 → 100644
View file @
7b34ae43
2.42 KB
ShorthandMaster/Assets.xcassets/RecordDetails/recordDetails_bottom_note.imageset/Contents.json
0 → 100644
View file @
7b34ae43
{
"images"
:
[
{
"idiom"
:
"universal"
,
"scale"
:
"1x"
},
{
"filename"
:
"编组 3@2x.png"
,
"idiom"
:
"universal"
,
"scale"
:
"2x"
},
{
"filename"
:
"编组 3@3x.png"
,
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
ShorthandMaster/Assets.xcassets/RecordDetails/recordDetails_bottom_note.imageset/编组 3@2x.png
0 → 100644
View file @
7b34ae43
1.35 KB
ShorthandMaster/Assets.xcassets/RecordDetails/recordDetails_bottom_note.imageset/编组 3@3x.png
0 → 100644
View file @
7b34ae43
1.6 KB
ShorthandMaster/Goods/Goods.storyboard
View file @
7b34ae43
This diff is collapsed.
Click to expand it.
ShorthandMaster/Mine/SHMineViewController.swift
View file @
7b34ae43
...
...
@@ -61,7 +61,7 @@ class SHMineViewController: SHBaseViewController {
@objc
func
memberBtnClick
(
_
sender
:
UIButton
){
if
SHUserAccountManager
.
shared
.
isMember
==
false
{
self
.
goGoods
(
"
home_pop
"
)
self
.
goGoods
(
"
setting_vip_unlock
"
)
}
}
...
...
@@ -173,7 +173,7 @@ extension SHMineViewController:UITableViewDelegate, UITableViewDataSource{
case
2
:
let
webView
=
SHWebViewController
()
webView
.
url
=
SHUserAccountManager
.
shared
.
h5_urlDic
[
"FeedBackuUrl"
]
as?
String
webView
.
title
=
"
联系客服
"
webView
.
title
=
"
用户反馈
"
self
.
navigationController
?
.
pushViewController
(
webView
,
animated
:
true
)
break
case
3
:
...
...
ShorthandMaster/Mine/SHSettingViewController.swift
View file @
7b34ae43
...
...
@@ -12,7 +12,7 @@ class SHSettingViewController: SHBaseViewController {
@IBOutlet
var
tableView
:
UITableView
!
var
dataSource
:
[
String
]
=
[
"用户协议"
,
"隐私政策"
,
"付费用户协议"
,
"
联系客服
"
]
var
dataSource
:
[
String
]
=
[
"用户协议"
,
"隐私政策"
,
"付费用户协议"
,
"
用户反馈
"
]
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
...
...
@@ -77,7 +77,7 @@ extension SHSettingViewController:UITableViewDelegate, UITableViewDataSource{
case
3
:
let
webView
=
SHWebViewController
()
webView
.
url
=
SHUserAccountManager
.
shared
.
h5_urlDic
[
"FeedBackuUrl"
]
as?
String
webView
.
title
=
"
联系客服
"
webView
.
title
=
"
用户反馈
"
self
.
navigationController
?
.
pushViewController
(
webView
,
animated
:
true
)
break
default
:
...
...
ShorthandMaster/Record/Record.storyboard
View file @
7b34ae43
...
...
@@ -430,8 +430,8 @@
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"5xA-Fr-3XN"
>
<rect
key=
"frame"
x=
"0.0"
y=
"44"
width=
"414"
height=
"758"
/>
<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"
>
<rect
key=
"frame"
x=
"1
06"
y=
"368.5"
width=
"202
"
height=
"21.5"
/>
<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=
"1
24.5"
y=
"368.5"
width=
"165.5
"
height=
"21.5"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"18"
/>
<color
key=
"textColor"
red=
"0.40000000000000002"
green=
"0.40000000000000002"
blue=
"0.40000000000000002"
alpha=
"0.84705882349999995"
colorSpace=
"calibratedRGB"
/>
<nil
key=
"highlightedColor"
/>
...
...
@@ -567,7 +567,7 @@
<constraints>
<constraint
firstAttribute=
"height"
constant=
"50"
id=
"2Sc-NO-FDk"
/>
</constraints>
<state
key=
"normal"
title=
"新建笔记"
>
<state
key=
"normal"
title=
"新建笔记"
image=
"recordDetails_bottom_note"
>
<color
key=
"titleColor"
red=
"0.25490196079999999"
green=
"0.51372549020000002"
blue=
"0.95686274510000002"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
</state>
<userDefinedRuntimeAttributes>
...
...
@@ -581,12 +581,12 @@
</button>
<button
opaque=
"NO"
tag=
"201"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"d2L-Yp-ObA"
>
<rect
key=
"frame"
x=
"212"
y=
"5"
width=
"184"
height=
"50"
/>
<color
key=
"backgroundColor"
red=
"0.
98039215686274506"
green=
"0.85882352941176465"
blue=
"0.85882352941176465
"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<color
key=
"backgroundColor"
red=
"0.
80392156862745101"
green=
"0.97254901960784312"
blue=
"0.81568627450980391
"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<constraints>
<constraint
firstAttribute=
"height"
constant=
"50"
id=
"2vZ-UX-KJh"
/>
</constraints>
<state
key=
"normal"
title=
"新建语音笔记"
>
<color
key=
"titleColor"
red=
"0.
95686274509803915"
green=
"0.25490196078431371"
blue=
"0.25490196078431371
"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<state
key=
"normal"
title=
"新建语音笔记"
image=
"recordDetails_bottom_ microphone"
>
<color
key=
"titleColor"
red=
"0.
22745098039215686"
green=
"0.73725490196078436"
blue=
"0.2627450980392157
"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute
type=
"number"
keyPath=
"layer.cornerRadius"
>
...
...
@@ -797,7 +797,9 @@
</scene>
</scenes>
<resources>
<image
name=
"recordDetails_bottom_ microphone"
width=
"34"
height=
"34"
/>
<image
name=
"recordDetails_bottom_mask"
width=
"375"
height=
"8"
/>
<image
name=
"recordDetails_bottom_note"
width=
"34"
height=
"34"
/>
<image
name=
"recordDetails_icloud"
width=
"16"
height=
"16"
/>
<image
name=
"recordDetails_icloud_selected"
width=
"16"
height=
"16"
/>
<image
name=
"recordDetails_select"
width=
"20"
height=
"20"
/>
...
...
ShorthandMaster/Record/SHRecordDetailsVC.swift
View file @
7b34ae43
...
...
@@ -345,10 +345,20 @@ extension SHRecordDetailsVC {
self
.
markAlertViewShow
(
false
)
bottomView
?
.
cancel
=
true
if
SHUserAccountManager
.
shared
.
isMember
==
false
&&
self
.
currentModel
.
dataSources
.
count
>
0
{
self
.
goGoods
(
"home_record"
)
if
SHUserAccountManager
.
shared
.
isMember
==
false
{
let
voice
=
self
.
currentModel
.
dataSources
.
filter
({
$0
.
recordingType
==
0
})
let
note
=
self
.
currentModel
.
dataSources
.
filter
({
$0
.
recordingType
==
1
})
if
voice
.
count
>
0
&&
sender
.
tag
==
201
{
self
.
goGoods
(
"new_note_card_voice_note"
)
return
}
if
note
.
count
>
0
&&
sender
.
tag
==
200
{
self
.
goGoods
(
"new_note_card_note"
)
return
}
}
switch
sender
.
tag
{
case
200
:
...
...
ShorthandMaster/Record/SHRecordListViewController.swift
View file @
7b34ae43
...
...
@@ -8,6 +8,7 @@
import
UIKit
import
CloudKit
import
IQKeyboardManagerSwift
class
SHRecordListViewController
:
SHBaseViewController
{
...
...
@@ -111,7 +112,6 @@ class SHRecordListViewController: SHBaseViewController {
tableView
?
.
estimatedRowHeight
=
44
tableView
?
.
rowHeight
=
UITableView
.
automaticDimension
// tableView?.separatorStyle = .none
}
func
prepareDateSource
(){
...
...
@@ -192,7 +192,7 @@ class SHRecordListViewController: SHBaseViewController {
tableView
?
.
reloadData
()
maskHintLab
?
.
text
=
"点击
上面
右上角添加笔记本"
maskHintLab
?
.
text
=
"点击右上角添加笔记本"
maskHintImv
?
.
image
=
UIImage
.
init
(
named
:
"recordlist_no_data"
)
if
dataSources
.
count
==
0
{
self
.
view
.
bringSubviewToFront
(
maskView
)
...
...
@@ -211,7 +211,7 @@ class SHRecordListViewController: SHBaseViewController {
@objc
func
userCilck
(){
if
SHUserAccountManager
.
shared
.
isMember
==
false
&&
self
.
dataSources
.
count
>
0
{
self
.
goGoods
(
"
home_recor
d"
)
self
.
goGoods
(
"
new_notebook_ad
d"
)
return
}
...
...
@@ -221,29 +221,17 @@ class SHRecordListViewController: SHBaseViewController {
@objc
func
preposeMember
(){
SHUserAccountManager
.
shared
.
getNovelInfo
{
(
json
)
in
if
SHUserAccountManager
.
shared
.
isMember
==
false
&&
SHUserAccountManager
.
shared
.
isStartFront
==
true
{
self
.
goGoods
(
"home_p
ay
"
)
self
.
goGoods
(
"home_p
op
"
)
}
}
}
@IBAction
func
advertBtnClick
(){
if
SHUserAccountManager
.
shared
.
isMember
==
false
{
self
.
goGoods
(
"home_record"
)
return
}
}
@IBAction
func
goRecord
(){
if
CRUserDefaults
.
isFirstRecord
==
true
{
if
SHUserAccountManager
.
shared
.
isMember
==
false
{
self
.
goGoods
(
"home_record"
)
self
.
goGoods
(
"home_pay"
)
return
}
}
let
record
=
UIStoryboard
.
init
(
name
:
"Record"
,
bundle
:
nil
)
.
instantiateViewController
(
withIdentifier
:
"SHRecordViewController"
)
as!
SHRecordViewController
self
.
navigationController
?
.
pushViewController
(
record
,
animated
:
true
)
}
}
//MARK: 删、重命名、置顶、添加 文件夹
...
...
@@ -265,19 +253,6 @@ extension SHRecordListViewController {
CRUserDefaults
.
recordList
=
list
}
// let list = self.keyValueStore.object(forKey: "Folderlist") as? [Dictionary<String, Any>]
//
// if var list = list {
// for (index, dic) in list.enumerated(){
// if dic["id"] as! String == deleteModel.id{
// list.remove(at: index)
// break
// }
// }
// self.keyValueStore.set(list, forKey: "Folderlist")
// self.keyValueStore.synchronize()
// }
self
.
dataSources
.
remove
(
at
:
indexPath
.
row
)
self
.
tableView
?
.
beginUpdates
()
self
.
tableView
?
.
deleteRows
(
at
:
[
indexPath
],
with
:
.
left
)
...
...
@@ -317,21 +292,6 @@ extension SHRecordListViewController {
CRUserDefaults
.
recordList
=
list
}
// let list = self.keyValueStore.object(forKey: "Folderlist") as? [Dictionary<String, Any>]
//
// if var list = list {
// for (index, dic) in list.enumerated(){
// if dic["id"] as! String == selectModel.id{
// var subDic = dic
// subDic["name"] = renameStr
// list[index] = subDic
// break
// }
// }
// self.keyValueStore.set(list, forKey: "Folderlist")
// self.keyValueStore.synchronize()
// }
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
.
now
()
+
.
milliseconds
(
333
))
{
self
.
prepareDateSource
()
}
...
...
@@ -356,21 +316,6 @@ extension SHRecordListViewController {
CRUserDefaults
.
recordList
=
list
}
// let list = keyValueStore.object(forKey: "Folderlist") as? [Dictionary<String, Any>]
//
// if var list = list {
// for (index, dic) in list.enumerated(){
// if dic["id"] as! String == deleteModel.id{
// var subDic = dic
// subDic["top"] = !deleteModel.top
// list[index] = subDic
// break
// }
// }
// keyValueStore.set(list, forKey: "Folderlist")
// keyValueStore.synchronize()
// }
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
.
now
()
+
.
milliseconds
(
333
))
{
self
.
prepareDateSource
()
}
...
...
@@ -404,18 +349,6 @@ extension SHRecordListViewController {
CRUserDefaults
.
recordList
=
list
}
// let list = self.keyValueStore.object(forKey: "Folderlist") as? [Dictionary<String, Any>]
//
// if var list = list {
// list.append(modelDict)
// self.keyValueStore.set(list, forKey: "Folderlist")
// self.keyValueStore.synchronize()
// }else{
// let list = [modelDict]
// self.keyValueStore.set(list, forKey: "Folderlist")
// self.keyValueStore.synchronize()
// }
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
.
now
()
+
.
milliseconds
(
333
))
{
self
.
prepareDateSource
()
}
...
...
@@ -649,7 +582,7 @@ extension SHRecordListViewController: UISearchResultsUpdating, UISearchBarDelega
}
else
{
self
.
view
.
sendSubviewToBack
(
maskView
)
}
markCountLab
?
.
text
=
"笔记本总数:
\(
searchDataSource
.
count
)
"
markCountLab
?
.
text
=
"笔记本总数:
\(
folderSearchArr
.
count
)
"
}
}
}
...
...
@@ -657,6 +590,7 @@ extension SHRecordListViewController: UISearchResultsUpdating, UISearchBarDelega
//MARK: searchController delegate
extension
SHRecordListViewController
:
UISearchControllerDelegate
{
func
willPresentSearchController
(
_
searchController
:
UISearchController
){
IQKeyboardManager
.
shared
.
enable
=
false
UIView
.
animate
(
withDuration
:
0.25
)
{
self
.
searchView
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
SCREEN_WIDTH
,
height
:
56
)
...
...
@@ -671,6 +605,7 @@ extension SHRecordListViewController: UISearchControllerDelegate{
}
func
willDismissSearchController
(
_
searchController
:
UISearchController
){
IQKeyboardManager
.
shared
.
enable
=
true
UIView
.
animate
(
withDuration
:
0.25
)
{
self
.
searchView
.
frame
=
CGRect
(
x
:
8
,
y
:
0
,
width
:
SCREEN_WIDTH
-
16
,
height
:
56
)
}
completion
:
{
(
result
)
in
...
...
ShorthandMaster/Record/SHRecordViewController.swift
View file @
7b34ae43
...
...
@@ -26,7 +26,7 @@ class SHRecordViewController: SHBaseViewController{
private
var
currentModel
:
SHRecordModel
?
private
var
currentTxt
:
String
?
private
var
currentAddress
:
String
?
private
var
currentAddress
:
String
=
""
private
var
start
:
Bool
=
false
private
var
save
:
Bool
=
false
...
...
@@ -49,6 +49,7 @@ class SHRecordViewController: SHBaseViewController{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
self
.
navigationController
?
.
interactivePopGestureRecognizer
?
.
isEnabled
=
false
setupUI
()
configPathFile
()
...
...
@@ -66,6 +67,8 @@ class SHRecordViewController: SHBaseViewController{
}
override
func
viewDidDisappear
(
_
animated
:
Bool
)
{
super
.
viewDidDisappear
(
animated
)
self
.
navigationController
?
.
interactivePopGestureRecognizer
?
.
isEnabled
=
true
NotificationCenter
.
default
.
removeObserver
(
self
)
}
...
...
@@ -77,6 +80,9 @@ class SHRecordViewController: SHBaseViewController{
override
func
goback
()
{
super
.
goback
()
saveContent
()
self
.
recorder_mp3
.
stop
()
self
.
recorderManager
.
stop
()
saveSuccessCallBack
?(
folderModel
)
}
...
...
@@ -156,6 +162,7 @@ class SHRecordViewController: SHBaseViewController{
self
.
secondsLabel
.
text
=
"00:00:00"
self
.
seconds
=
0
self
.
save
=
false
self
.
recorder_mp3
.
stop
()
self
.
recorderManager
.
stop
()
}
DispatchQueue
.
main
.
asyncAfter
(
deadline
:
.
now
()
+
0.5
)
{
...
...
@@ -268,8 +275,8 @@ class SHRecordViewController: SHBaseViewController{
model
.
recordingType
=
0
model
.
createDate
=
nowDate
model
.
modifyDate
=
nowDate
model
.
address
=
currentAddress
??
"
"
model
.
rename
=
currentAddress
??
"
"
model
.
address
=
(
currentAddress
.
length
!=
0
)
?
currentAddress
:
"未知位置
"
model
.
rename
=
(
currentAddress
.
length
!=
0
)
?
currentAddress
:
"未知位置
"
model
.
txt
=
"
\n
"
+
(
currentTxt
??
""
)
model
.
pathFile
=
mp3_file_path
model
.
pcmPathFile
=
pcm_file_path
...
...
@@ -391,7 +398,7 @@ extension SHRecordViewController{
}
func
textView_text
(
_
text
:
String
)
->
NSAttributedString
{
let
address
=
"地点: "
+
(
self
.
currentAddress
??
""
)
let
address
=
"地点: "
+
self
.
currentAddress
let
content
=
address
+
"
\n
\n
"
+
text
...
...
ShorthandMaster/Record/View/SHRecordRenameAlertView.xib
View file @
7b34ae43
...
...
@@ -29,10 +29,10 @@
<subviews>
<textField
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"left"
contentVerticalAlignment=
"center"
placeholder=
"这是一个旧的笔记本"
textAlignment=
"natural"
minimumFontSize=
"17"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"4On-7k-axI"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"246"
height=
"24"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"1
4
"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"1
6
"
/>
<textInputTraits
key=
"textInputTraits"
/>
</textField>
<button
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"MPy-Fs-pk7"
>
<button
hidden=
"YES"
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
lineBreakMode=
"middleTruncation"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"MPy-Fs-pk7"
>
<rect
key=
"frame"
x=
"246"
y=
"0.0"
width=
"32"
height=
"24"
/>
<constraints>
<constraint
firstAttribute=
"width"
secondItem=
"MPy-Fs-pk7"
secondAttribute=
"height"
multiplier=
"24:18"
id=
"By7-tv-lrR"
/>
...
...
ShorthandMaster/Share/Managers/SHAVAudioManager.swift
View file @
7b34ae43
...
...
@@ -83,12 +83,14 @@ class SHAVAudioManager: NSObject {
var
decibelsCallBack
:((
Float
)
->
Void
)?
var
state
=
SHRecordState
.
prepare
private
func
configRecorder
(){
private
func
configRecorder
(
_
result
:((
Bool
)
->
Void
)?
){
speechRecognizer
?
.
delegate
=
self
AVAudioSession
.
sharedInstance
()
.
requestRecordPermission
{
(
allowed
)
in
if
!
allowed
{
return
}
else
{
result
?(
true
)
}
}
let
session
:
AVAudioSession
=
AVAudioSession
.
sharedInstance
()
...
...
@@ -173,12 +175,14 @@ class SHAVAudioManager: NSObject {
self
.
monitor
?
.
updateMeters
()
// 获得0声道的音量,完全没有声音-160.0,0是最大音量
let
decibels
=
(
self
.
monitor
?
.
peakPower
(
forChannel
:
0
))
!
// let hehe = (self.monitor?.averagePower(forChannel: 0))!
let
lowPassResults
=
pow
(
10
,
(
0.05
*
(
self
.
monitor
?
.
peakPower
(
forChannel
:
0
))
!
));
decibelsCallBack
?(
lowPassResults
)
// print("lowPassResults == \(lowPassResults)")
// print("decibels == \(decibels)")
// print("hehe == \(hehe)")
if
decibels
>
-
44
{
if
recognitionTask
?
.
isCancelled
==
true
&&
self
.
state
==
SHRecordState
.
start
{
start
()
...
...
@@ -197,13 +201,15 @@ class SHAVAudioManager: NSObject {
func
start
(){
self
.
state
=
SHRecordState
.
start
self
.
configRecorder
()
self
.
configRecorder
{
result
in
self
.
configSpeechTask
()
self
.
monitor
?
.
record
()
startTime
=
CACurrentMediaTime
()
if
recorderTimer
==
nil
{
recorderTimer
=
SHTimer
.
scheduledTimer
(
timeInterval
:
0.1
,
target
:
self
,
selector
:
#selector(
updateMeters
)
,
userInfo
:
nil
,
repeats
:
true
)
self
.
startTime
=
CACurrentMediaTime
()
if
self
.
recorderTimer
==
nil
{
self
.
recorderTimer
=
SHTimer
.
scheduledTimer
(
timeInterval
:
0.1
,
target
:
self
,
selector
:
#selector(
self.updateMeters
)
,
userInfo
:
nil
,
repeats
:
true
)
}
}
}
...
...
ShorthandMaster/Share/Managers/SHUserAccountManager.swift
View file @
7b34ae43
...
...
@@ -34,7 +34,7 @@ import SwiftyJSON
@objc
var
isMember
:
Bool
{
//
return true
return
true
let
dateFormatter
=
DateFormatter
()
dateFormatter
.
locale
=
Locale
(
identifier
:
"en_CN"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment