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
ba635e83
Commit
ba635e83
authored
Sep 29, 2020
by
lmj_521aiau@163.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix UI
parent
7b34ae43
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
16 deletions
+79
-16
Record.storyboard
ShorthandMaster/Record/Record.storyboard
+2
-1
SHRecordDetailsVC.swift
ShorthandMaster/Record/SHRecordDetailsVC.swift
+11
-4
SHRecordListViewController.swift
ShorthandMaster/Record/SHRecordListViewController.swift
+19
-1
SHRecordViewController.swift
ShorthandMaster/Record/SHRecordViewController.swift
+2
-2
SHAVAudioManager.swift
ShorthandMaster/Share/Managers/SHAVAudioManager.swift
+15
-4
SHCloudManager.swift
ShorthandMaster/Share/Managers/SHCloudManager.swift
+30
-4
No files found.
ShorthandMaster/Record/Record.storyboard
View file @
ba635e83
...
...
@@ -280,7 +280,7 @@
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
<constraints>
<constraint
firstAttribute=
"height"
constant=
"84"
id=
"4Se-eO-OOC"
/>
<constraint
firstItem=
"
d2Q-zE-Eh0"
firstAttribute=
"top"
secondItem=
"K8n-Fw-lyi"
secondAttribute=
"bottom"
constant=
"15"
id=
"RXT-If-QHi
"
/>
<constraint
firstItem=
"
K8n-Fw-lyi"
firstAttribute=
"top"
secondItem=
"p7U-Qp-CMD"
secondAttribute=
"top"
constant=
"10"
id=
"MFD-od-QxM
"
/>
<constraint
firstItem=
"K8n-Fw-lyi"
firstAttribute=
"centerX"
secondItem=
"d2Q-zE-Eh0"
secondAttribute=
"centerX"
id=
"X30-Jt-BfP"
/>
<constraint
firstItem=
"d2Q-zE-Eh0"
firstAttribute=
"centerX"
secondItem=
"p7U-Qp-CMD"
secondAttribute=
"centerX"
id=
"ePL-2z-UdM"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"d2Q-zE-Eh0"
secondAttribute=
"bottom"
constant=
"18"
id=
"fAj-Gz-Zce"
/>
...
...
@@ -336,6 +336,7 @@
</view>
<connections>
<outlet
property=
"advertBtn"
destination=
"d2Q-zE-Eh0"
id=
"7fC-x0-0eI"
/>
<outlet
property=
"bottomHeight"
destination=
"4Se-eO-OOC"
id=
"VGg-UG-2t1"
/>
<outlet
property=
"markCountLab"
destination=
"K8n-Fw-lyi"
id=
"jzA-iM-cv4"
/>
<outlet
property=
"maskHintImv"
destination=
"1ji-L1-Qj7"
id=
"GYK-2e-UIt"
/>
<outlet
property=
"maskHintLab"
destination=
"JlT-EC-bWg"
id=
"vQ9-KM-nah"
/>
...
...
ShorthandMaster/Record/SHRecordDetailsVC.swift
View file @
ba635e83
...
...
@@ -44,8 +44,11 @@ class SHRecordDetailsVC: SHBaseViewController {
self
.
navigationItem
.
title
=
currentModel
.
name
self
.
navigationItem
.
rightBarButtonItem
=
UIBarButtonItem
.
init
(
title
:
"编辑"
,
style
:
.
done
,
target
:
self
,
action
:
#selector(
editClick
)
)
self
.
navigationItem
.
rightBarButtonItem
?
.
tintColor
=
UIColor
.
init
(
hexStr
:
"4183F4"
)
if
currentModel
.
dataSources
.
count
==
0
{
self
.
navigationItem
.
rightBarButtonItem
?
.
tintColor
=
UIColor
.
init
(
hexStr
:
"999999"
)
}
else
{
self
.
navigationItem
.
rightBarButtonItem
?
.
tintColor
=
UIColor
.
init
(
hexStr
:
"4183F4"
)
}
tableView
?
.
estimatedRowHeight
=
44
tableView
?
.
rowHeight
=
UITableView
.
automaticDimension
tableView
?
.
separatorStyle
=
.
none
...
...
@@ -147,19 +150,23 @@ class SHRecordDetailsVC: SHBaseViewController {
self
.
selectRecordModels
=
[]
self
.
navigationItem
.
rightBarButtonItem
=
UIBarButtonItem
.
init
(
title
:
"完成"
,
style
:
.
done
,
target
:
self
,
action
:
#selector(
editClick
)
)
self
.
navigationItem
.
rightBarButtonItem
?
.
tintColor
=
UIColor
.
init
(
hexStr
:
"4183F4"
)
UIView
.
animate
(
withDuration
:
0.25
)
{
self
.
bottomView
?
.
frame
=
CGRect
.
init
(
x
:
0
,
y
:
0
,
width
:
self
.
tableFooterView
!.
frame
.
width
*
2
,
height
:
self
.
tableFooterView
!.
frame
.
height
)
}
}
else
{
self
.
navigationItem
.
rightBarButtonItem
=
UIBarButtonItem
.
init
(
title
:
"编辑"
,
style
:
.
done
,
target
:
self
,
action
:
#selector(
editClick
)
)
if
currentModel
.
dataSources
.
count
==
0
{
self
.
navigationItem
.
rightBarButtonItem
?
.
tintColor
=
UIColor
.
init
(
hexStr
:
"999999"
)
}
else
{
self
.
navigationItem
.
rightBarButtonItem
?
.
tintColor
=
UIColor
.
init
(
hexStr
:
"4183F4"
)
}
UIView
.
animate
(
withDuration
:
0.25
)
{
self
.
bottomView
?
.
frame
=
CGRect
.
init
(
x
:
-
self
.
tableFooterView
!.
frame
.
width
,
y
:
0
,
width
:
self
.
tableFooterView
!.
frame
.
width
*
2
,
height
:
self
.
tableFooterView
!.
frame
.
height
)
}
self
.
bottomView
?
.
deleteSelected
=
false
}
self
.
navigationItem
.
rightBarButtonItem
?
.
tintColor
=
UIColor
.
init
(
hexStr
:
"4183F4"
)
self
.
tableView
?
.
reloadData
()
}
}
...
...
ShorthandMaster/Record/SHRecordListViewController.swift
View file @
ba635e83
...
...
@@ -21,6 +21,7 @@ class SHRecordListViewController: SHBaseViewController {
@IBOutlet
weak
var
markCountLab
:
UILabel
?
@IBOutlet
weak
var
advertBtn
:
UIButton
?
@IBOutlet
weak
var
bottomHeight
:
NSLayoutConstraint
?
let
keyValueStore
=
NSUbiquitousKeyValueStore
.
default
var
dataSources
:
Array
<
SHRecordFolderModel
>
=
[]
...
...
@@ -50,6 +51,7 @@ class SHRecordListViewController: SHBaseViewController {
self
.
tableView
?
.
reloadData
()
advertBtn
?
.
isHidden
=
SHUserAccountManager
.
shared
.
isMember
bottomHeight
?
.
constant
=
SHUserAccountManager
.
shared
.
isMember
?
44
:
84
}
override
func
viewDidDisappear
(
_
animated
:
Bool
)
{
...
...
@@ -582,7 +584,23 @@ extension SHRecordListViewController: UISearchResultsUpdating, UISearchBarDelega
}
else
{
self
.
view
.
sendSubviewToBack
(
maskView
)
}
markCountLab
?
.
text
=
"笔记本总数:
\(
folderSearchArr
.
count
)
"
if
self
.
searchBarVC
.
searchBar
.
text
?
.
length
==
0
{
markCountLab
?
.
text
=
"笔记本总数:
\(
dataSources
.
count
)
"
}
else
{
markCountLab
?
.
text
=
"笔记本总数:
\(
folderSearchArr
.
count
)
"
}
}
}
}
extension
SHRecordListViewController
:
UIScrollViewDelegate
{
func
scrollViewDidScroll
(
_
scrollView
:
UIScrollView
)
{
if
self
.
searchBarVC
.
isActive
{
if
#available(iOS 13.0, *)
{
self
.
searchBarVC
.
searchBar
.
searchTextField
.
resignFirstResponder
()
}
else
{
self
.
view
.
endEditing
(
true
)
}
}
}
}
...
...
ShorthandMaster/Record/SHRecordViewController.swift
View file @
ba635e83
...
...
@@ -140,6 +140,8 @@ class SHRecordViewController: SHBaseViewController{
self
.
saveContent
()
self
.
saveSuccessCallBack
?(
folderModel
)
self
.
timerInvalidate
()
self
.
recorder_mp3
.
stop
()
self
.
recorderManager
.
stop
()
let
export
=
SHRecordExportAlertView
.
loadFromNibAndClass
(
SHRecordExportAlertView
.
self
)
!
export
.
frame
=
UIApplication
.
shared
.
keyWindow
!.
bounds
...
...
@@ -162,8 +164,6 @@ 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
)
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
...
...
ShorthandMaster/Share/Managers/SHAVAudioManager.swift
View file @
ba635e83
...
...
@@ -175,15 +175,26 @@ 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
decibels
= (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
{
print
(
"decibels ==
\(
decibels
)
"
)
let
route
=
AVAudioSession
.
sharedInstance
()
.
currentRoute
let
headphones
=
route
.
outputs
.
contains
(
where
:
{
$0
.
portType
==
.
headphones
})
var
decibelsFloat
=
0
if
headphones
{
decibelsFloat
=
-
44
}
else
{
decibelsFloat
=
-
24
}
if
Int
(
decibels
)
>
decibelsFloat
{
if
recognitionTask
?
.
isCancelled
==
true
&&
self
.
state
==
SHRecordState
.
start
{
start
()
}
...
...
ShorthandMaster/Share/Managers/SHCloudManager.swift
View file @
ba635e83
...
...
@@ -89,6 +89,9 @@ class SHCloudManager: NSObject {
}
}
}
else
{
DispatchQueue
.
main
.
async
{
MBProgressHUD
.
showError
(
"获取icloud数据失败, 请稍后再试"
)
}
self
.
completionHandler
?(
false
,
[])
}
}
...
...
@@ -116,6 +119,9 @@ class SHCloudManager: NSObject {
}
}
}
else
{
DispatchQueue
.
main
.
async
{
MBProgressHUD
.
showError
(
"获取icloud数据失败, 请稍后再试"
)
}
self
.
completionHandler
?(
false
,
[])
}
}
...
...
@@ -225,6 +231,9 @@ class SHCloudManager: NSObject {
if
result
==
true
{
self
.
dateBase
.
save
(
folderRecord
)
{
(
subscription
,
saveError
)
in
if
let
error
=
saveError
{
DispatchQueue
.
main
.
async
{
MBProgressHUD
.
showError
(
"icloud连接失败, 请稍后再试"
)
}
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
}
else
{
...
...
@@ -283,6 +292,9 @@ class SHCloudManager: NSObject {
if
result
==
true
{
self
.
dateBase
.
save
(
record
)
{
(
subscription
,
saveError
)
in
if
let
error
=
saveError
{
DispatchQueue
.
main
.
async
{
MBProgressHUD
.
showError
(
"icloud连接失败, 请稍后再试"
)
}
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
}
else
{
...
...
@@ -322,6 +334,9 @@ class SHCloudManager: NSObject {
if
result
==
true
{
self
.
dateBase
.
fetch
(
withRecordID
:
folderRecord
!.
recordID
)
{
(
record
,
fetchError
)
in
if
let
error
=
fetchError
{
DispatchQueue
.
main
.
async
{
MBProgressHUD
.
showError
(
"icloud连接失败, 请稍后再试"
)
}
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
}
else
{
...
...
@@ -331,6 +346,9 @@ class SHCloudManager: NSObject {
self
.
dateBase
.
save
(
record
!
)
{
(
saveRecord
,
saveError
)
in
if
let
error
=
saveError
{
DispatchQueue
.
main
.
async
{
MBProgressHUD
.
showError
(
"icloud保存失败, 请稍后再试"
)
}
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
}
else
{
...
...
@@ -363,17 +381,20 @@ class SHCloudManager: NSObject {
if
result
==
true
{
self
.
dateBase
.
fetch
(
withRecordID
:
recording
!.
recordID
)
{
(
record
,
fetchError
)
in
if
let
error
=
fetchError
{
DispatchQueue
.
main
.
async
{
MBProgressHUD
.
showError
(
"icloud连接失败, 请稍后再试"
)
}
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
}
else
{
let
nowDate
=
Date
()
record
?
.
setValue
(
nowDate
,
forKey
:
"modifyDate"
)
self
.
dateBase
.
save
(
record
!
)
{
(
saveRecord
,
saveError
)
in
if
let
error
=
saveError
{
DispatchQueue
.
main
.
async
{
MBProgressHUD
.
showError
(
"icloud保存失败, 请稍后再试"
)
}
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
}
else
{
...
...
@@ -410,8 +431,10 @@ class SHCloudManager: NSObject {
self
.
cheakAccountStatus
{
result
in
if
result
==
true
{
self
.
dateBase
.
delete
(
withRecordID
:
folderRecord
!.
recordID
)
{
(
recordID
,
deleteError
)
in
if
let
error
=
deleteError
{
DispatchQueue
.
main
.
async
{
MBProgressHUD
.
showError
(
"icloud连接失败, 请稍后再试"
)
}
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
}
else
{
...
...
@@ -446,6 +469,9 @@ class SHCloudManager: NSObject {
if
result
==
true
{
self
.
dateBase
.
delete
(
withRecordID
:
record
!.
recordID
)
{
(
recordID
,
deleteError
)
in
if
let
error
=
deleteError
{
DispatchQueue
.
main
.
async
{
MBProgressHUD
.
showError
(
"icloud连接失败, 请稍后再试"
)
}
print
(
"
\(
error
.
localizedDescription
)
"
)
self
.
completionHandler
?(
false
,
[])
}
else
{
...
...
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