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
c5feba56
Commit
c5feba56
authored
Aug 28, 2020
by
lmj_521aiau@163.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
player slider
parent
07452738
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
210 additions
and
30 deletions
+210
-30
project.pbxproj
ShorthandMaster.xcodeproj/project.pbxproj
+4
-0
Contents.json
...ssets.xcassets/Record/slider_point.imageset/Contents.json
+21
-0
ziyuan-2.png
...Assets.xcassets/Record/slider_point.imageset/ziyuan-2.png
+0
-0
Info.plist
ShorthandMaster/Info.plist
+8
-0
Record.storyboard
ShorthandMaster/Record/Record.storyboard
+12
-15
SHLocationManager.swift
ShorthandMaster/Record/SHLocationManager.swift
+78
-0
SHRecordListCell.swift
ShorthandMaster/Record/SHRecordListCell.swift
+1
-1
SHRecordShowViewController.swift
ShorthandMaster/Record/SHRecordShowViewController.swift
+40
-7
SHRecordViewController.swift
ShorthandMaster/Record/SHRecordViewController.swift
+46
-7
No files found.
ShorthandMaster.xcodeproj/project.pbxproj
View file @
c5feba56
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
A94D935724F7958500A886C0
/* SHStoreManager.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A94D935624F7958500A886C0
/* SHStoreManager.swift */
;
};
A94D935724F7958500A886C0
/* SHStoreManager.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A94D935624F7958500A886C0
/* SHStoreManager.swift */
;
};
A94D935924F7969600A886C0
/* CMNetworkManager.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A94D935824F7969600A886C0
/* CMNetworkManager.swift */
;
};
A94D935924F7969600A886C0
/* CMNetworkManager.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A94D935824F7969600A886C0
/* CMNetworkManager.swift */
;
};
A94D935B24F7977400A886C0
/* PhoneSystemKit.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A94D935A24F7977400A886C0
/* PhoneSystemKit.swift */
;
};
A94D935B24F7977400A886C0
/* PhoneSystemKit.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A94D935A24F7977400A886C0
/* PhoneSystemKit.swift */
;
};
A94D935E24F7AF2300A886C0
/* SHLocationManager.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A94D935D24F7AF2300A886C0
/* SHLocationManager.swift */
;
};
A950F5A824F36F55007AB63E
/* SHRecordListViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A950F5A724F36F55007AB63E
/* SHRecordListViewController.swift */
;
};
A950F5A824F36F55007AB63E
/* SHRecordListViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A950F5A724F36F55007AB63E
/* SHRecordListViewController.swift */
;
};
A950F5AA24F3727A007AB63E
/* SHRecordListCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A950F5A924F3727A007AB63E
/* SHRecordListCell.swift */
;
};
A950F5AA24F3727A007AB63E
/* SHRecordListCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A950F5A924F3727A007AB63E
/* SHRecordListCell.swift */
;
};
A950F5AC24F39EC1007AB63E
/* SHRecordShowViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A950F5AB24F39EC1007AB63E
/* SHRecordShowViewController.swift */
;
};
A950F5AC24F39EC1007AB63E
/* SHRecordShowViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
A950F5AB24F39EC1007AB63E
/* SHRecordShowViewController.swift */
;
};
...
@@ -107,6 +108,7 @@
...
@@ -107,6 +108,7 @@
A94D935624F7958500A886C0
/* SHStoreManager.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
SHStoreManager.swift
;
sourceTree
=
"<group>"
;
};
A94D935624F7958500A886C0
/* SHStoreManager.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
SHStoreManager.swift
;
sourceTree
=
"<group>"
;
};
A94D935824F7969600A886C0
/* CMNetworkManager.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CMNetworkManager.swift
;
sourceTree
=
"<group>"
;
};
A94D935824F7969600A886C0
/* CMNetworkManager.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CMNetworkManager.swift
;
sourceTree
=
"<group>"
;
};
A94D935A24F7977400A886C0
/* PhoneSystemKit.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PhoneSystemKit.swift
;
sourceTree
=
"<group>"
;
};
A94D935A24F7977400A886C0
/* PhoneSystemKit.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
PhoneSystemKit.swift
;
sourceTree
=
"<group>"
;
};
A94D935D24F7AF2300A886C0
/* SHLocationManager.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
SHLocationManager.swift
;
sourceTree
=
"<group>"
;
};
A950F5A724F36F55007AB63E
/* SHRecordListViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
SHRecordListViewController.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>"
;
};
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>"
;
};
A950F5AB24F39EC1007AB63E
/* SHRecordShowViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
SHRecordShowViewController.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -496,6 +498,7 @@
...
@@ -496,6 +498,7 @@
A95B3FD124F5261100FABDD1
/* SHRecordGuideView.swift */
,
A95B3FD124F5261100FABDD1
/* SHRecordGuideView.swift */
,
A94D935124F7502700A886C0
/* SHRecordExportAlertView.swift */
,
A94D935124F7502700A886C0
/* SHRecordExportAlertView.swift */
,
A94D935324F7503E00A886C0
/* SHRecordExportAlertView.xib */
,
A94D935324F7503E00A886C0
/* SHRecordExportAlertView.xib */
,
A94D935D24F7AF2300A886C0
/* SHLocationManager.swift */
,
);
);
path
=
Record
;
path
=
Record
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -682,6 +685,7 @@
...
@@ -682,6 +685,7 @@
buildActionMask
=
2147483647
;
buildActionMask
=
2147483647
;
files
=
(
files
=
(
A950F5A824F36F55007AB63E
/* SHRecordListViewController.swift in Sources */
,
A950F5A824F36F55007AB63E
/* SHRecordListViewController.swift in Sources */
,
A94D935E24F7AF2300A886C0
/* SHLocationManager.swift in Sources */
,
A95CDFDA24E0EBF10066DAE6
/* CRSnippetCode.swift in Sources */
,
A95CDFDA24E0EBF10066DAE6
/* CRSnippetCode.swift in Sources */
,
A95CE01124E0F42F0066DAE6
/* MBProgressHUD+MJ.m in Sources */
,
A95CE01124E0F42F0066DAE6
/* MBProgressHUD+MJ.m in Sources */
,
A95CE00924E0F42F0066DAE6
/* CRContactTools.swift in Sources */
,
A95CE00924E0F42F0066DAE6
/* CRContactTools.swift in Sources */
,
...
...
ShorthandMaster/Assets.xcassets/Record/slider_point.imageset/Contents.json
0 → 100644
View file @
c5feba56
{
"images"
:
[
{
"idiom"
:
"universal"
,
"scale"
:
"1x"
},
{
"idiom"
:
"universal"
,
"scale"
:
"2x"
},
{
"filename"
:
"ziyuan-2.png"
,
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
ShorthandMaster/Assets.xcassets/Record/slider_point.imageset/ziyuan-2.png
0 → 100644
View file @
c5feba56
1.57 KB
ShorthandMaster/Info.plist
View file @
c5feba56
...
@@ -20,6 +20,14 @@
...
@@ -20,6 +20,14 @@
<
string
>
1
<
/string
>
<
string
>
1
<
/string
>
<
k
e
y
>
LSRequiresIPhoneOS
<
/k
e
y
>
<
k
e
y
>
LSRequiresIPhoneOS
<
/k
e
y
>
<
tru
e
/
>
<
tru
e
/
>
<
k
e
y
>
NSLocationAlwaysAndWhenInUseUsageDescription
<
/k
e
y
>
<
string
>
3333
<
/string
>
<
k
e
y
>
NSLocationAlwaysUsageDescription
<
/k
e
y
>
<
string
>
6666
<
/string
>
<
k
e
y
>
NSLocationUsageDescription
<
/k
e
y
>
<
string
>
44444
<
/string
>
<
k
e
y
>
NSLocationWhenInUseUsageDescription
<
/k
e
y
>
<
string
>
55555
<
/string
>
<
k
e
y
>
NSMicrophoneUsageDescription
<
/k
e
y
>
<
k
e
y
>
NSMicrophoneUsageDescription
<
/k
e
y
>
<
string
>
App
需要访问麦克风,进行录音
<
/string
>
<
string
>
App
需要访问麦克风,进行录音
<
/string
>
<
k
e
y
>
NSSpeechRecognitionUsageDescription
<
/k
e
y
>
<
k
e
y
>
NSSpeechRecognitionUsageDescription
<
/k
e
y
>
...
...
ShorthandMaster/Record/Record.storyboard
View file @
c5feba56
...
@@ -228,33 +228,30 @@
...
@@ -228,33 +228,30 @@
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"NI3-qi-5Ka"
>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"NI3-qi-5Ka"
>
<rect
key=
"frame"
x=
"0.0"
y=
"80"
width=
"414"
height=
"80"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"80"
width=
"414"
height=
"80"
/>
<subviews>
<subviews>
<slider
opaque=
"NO"
contentMode=
"scaleToFill"
contentHorizontalAlignment=
"center"
contentVerticalAlignment=
"center"
minValue=
"0.0"
maxValue=
"1"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"KhT-4g-A2i"
>
<rect
key=
"frame"
x=
"18"
y=
"8"
width=
"378"
height=
"31"
/>
</slider>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"00:00"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"IzE-RZ-GuS"
>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"00:00"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"IzE-RZ-GuS"
>
<rect
key=
"frame"
x=
"20"
y=
"
28
"
width=
"39"
height=
"17"
/>
<rect
key=
"frame"
x=
"20"
y=
"
46
"
width=
"39"
height=
"17"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"14"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"14"
/>
<color
key=
"textColor"
red=
"0.40000000000000002"
green=
"0.40000000000000002"
blue=
"0.40000000000000002"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<color
key=
"textColor"
red=
"0.40000000000000002"
green=
"0.40000000000000002"
blue=
"0.40000000000000002"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<nil
key=
"highlightedColor"
/>
<nil
key=
"highlightedColor"
/>
</label>
</label>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"00:00"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"ngv-W0-Sw4"
>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"00:00"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"ngv-W0-Sw4"
>
<rect
key=
"frame"
x=
"355"
y=
"
28
"
width=
"39"
height=
"17"
/>
<rect
key=
"frame"
x=
"355"
y=
"
46
"
width=
"39"
height=
"17"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"14"
/>
<fontDescription
key=
"fontDescription"
type=
"system"
pointSize=
"14"
/>
<color
key=
"textColor"
red=
"0.40000000000000002"
green=
"0.40000000000000002"
blue=
"0.40000000000000002"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<color
key=
"textColor"
red=
"0.40000000000000002"
green=
"0.40000000000000002"
blue=
"0.40000000000000002"
alpha=
"1"
colorSpace=
"calibratedRGB"
/>
<nil
key=
"highlightedColor"
/>
<nil
key=
"highlightedColor"
/>
</label>
</label>
<progressView
opaque=
"NO"
contentMode=
"scaleToFill"
verticalHuggingPriority=
"750"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"9Af-DH-jgW"
>
<rect
key=
"frame"
x=
"20"
y=
"10"
width=
"374"
height=
"6"
/>
<constraints>
<constraint
firstAttribute=
"height"
constant=
"6"
id=
"Ngl-CJ-tRg"
/>
</constraints>
</progressView>
</subviews>
</subviews>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
cocoaTouchSystemColor=
"whiteColor"
/>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
cocoaTouchSystemColor=
"whiteColor"
/>
<constraints>
<constraints>
<constraint
firstItem=
"
9Af-DH-jgW"
firstAttribute=
"leading"
secondItem=
"NI3-qi-5Ka"
secondAttribute=
"leading"
constant=
"20"
id=
"4B9-gu-2S5
"
/>
<constraint
firstItem=
"
KhT-4g-A2i"
firstAttribute=
"leading"
secondItem=
"NI3-qi-5Ka"
secondAttribute=
"leading"
constant=
"20"
id=
"2x0-8y-aNd
"
/>
<constraint
firstItem=
"
9Af-DH-jgW"
firstAttribute=
"top"
secondItem=
"NI3-qi-5Ka"
secondAttribute=
"top"
constant=
"10"
id=
"E2I-rV-YqU
"
/>
<constraint
firstItem=
"
IzE-RZ-GuS"
firstAttribute=
"top"
secondItem=
"KhT-4g-A2i"
secondAttribute=
"bottom"
constant=
"8"
id=
"3N7-hA-ij6
"
/>
<constraint
firstItem=
"
ngv-W0-Sw4"
firstAttribute=
"trailing"
secondItem=
"9Af-DH-jgW"
secondAttribute=
"trailing"
id=
"EDH-4t-ywN
"
/>
<constraint
firstItem=
"
KhT-4g-A2i"
firstAttribute=
"top"
secondItem=
"NI3-qi-5Ka"
secondAttribute=
"top"
constant=
"8"
id=
"43v-Ty-mK6
"
/>
<constraint
first
Attribute=
"trailing"
secondItem=
"9Af-DH-jgW"
secondAttribute=
"trailing"
constant=
"20"
id=
"clK-fh-Oj8
"
/>
<constraint
first
Item=
"ngv-W0-Sw4"
firstAttribute=
"trailing"
secondItem=
"KhT-4g-A2i"
secondAttribute=
"trailing"
id=
"Rlr-0B-a4q
"
/>
<constraint
firstItem=
"IzE-RZ-GuS"
firstAttribute=
"leading"
secondItem=
"
9Af-DH-jgW"
secondAttribute=
"leading"
id=
"p1Z-Pw-6Q
1"
/>
<constraint
firstItem=
"IzE-RZ-GuS"
firstAttribute=
"leading"
secondItem=
"
KhT-4g-A2i"
secondAttribute=
"leading"
id=
"fgl-gZ-ZJ
1"
/>
<constraint
first
Item=
"IzE-RZ-GuS"
firstAttribute=
"top"
secondItem=
"9Af-DH-jgW"
secondAttribute=
"bottom"
constant=
"12"
id=
"vy2-wP-243
"
/>
<constraint
first
Attribute=
"trailing"
secondItem=
"KhT-4g-A2i"
secondAttribute=
"trailing"
constant=
"20"
id=
"hEp-u8-SS5
"
/>
<constraint
firstItem=
"ngv-W0-Sw4"
firstAttribute=
"centerY"
secondItem=
"IzE-RZ-GuS"
secondAttribute=
"centerY"
id=
"ysh-gr-ZbZ"
/>
<constraint
firstItem=
"ngv-W0-Sw4"
firstAttribute=
"centerY"
secondItem=
"IzE-RZ-GuS"
secondAttribute=
"centerY"
id=
"ysh-gr-ZbZ"
/>
</constraints>
</constraints>
</view>
</view>
...
@@ -296,7 +293,7 @@
...
@@ -296,7 +293,7 @@
<outlet
property=
"bottomBgView"
destination=
"GiR-He-K55"
id=
"zJV-E1-DoM"
/>
<outlet
property=
"bottomBgView"
destination=
"GiR-He-K55"
id=
"zJV-E1-DoM"
/>
<outlet
property=
"copyBtn"
destination=
"USQ-ud-9iV"
id=
"BBB-GX-Kav"
/>
<outlet
property=
"copyBtn"
destination=
"USQ-ud-9iV"
id=
"BBB-GX-Kav"
/>
<outlet
property=
"playingTimeLab"
destination=
"IzE-RZ-GuS"
id=
"2cb-6o-2hc"
/>
<outlet
property=
"playingTimeLab"
destination=
"IzE-RZ-GuS"
id=
"2cb-6o-2hc"
/>
<outlet
property=
"progress"
destination=
"
9Af-DH-jgW"
id=
"UUC-v8-ORw
"
/>
<outlet
property=
"progress"
destination=
"
KhT-4g-A2i"
id=
"qXn-Eb-iQq
"
/>
<outlet
property=
"recordTextView"
destination=
"pPa-OG-ooa"
id=
"O5P-zy-7nF"
/>
<outlet
property=
"recordTextView"
destination=
"pPa-OG-ooa"
id=
"O5P-zy-7nF"
/>
<outlet
property=
"recorderBtn"
destination=
"yBJ-eO-4Dd"
id=
"N74-6y-EgL"
/>
<outlet
property=
"recorderBtn"
destination=
"yBJ-eO-4Dd"
id=
"N74-6y-EgL"
/>
<outlet
property=
"totalTimeLab"
destination=
"ngv-W0-Sw4"
id=
"Vax-Ac-WYI"
/>
<outlet
property=
"totalTimeLab"
destination=
"ngv-W0-Sw4"
id=
"Vax-Ac-WYI"
/>
...
...
ShorthandMaster/Record/SHLocationManager.swift
0 → 100644
View file @
c5feba56
//
// SHLocationManager.swift
// ShorthandMaster
//
// Created by 明津李 on 2020/8/27.
// Copyright © 2020 明津李. All rights reserved.
//
import
UIKit
import
CoreLocation
class
SHLocationManager
:
NSObject
,
CLLocationManagerDelegate
{
static
let
shared
=
SHLocationManager
()
private
override
init
()
{}
private
lazy
var
locationManager
:
CLLocationManager
=
{
let
locationManager
=
CLLocationManager
.
init
()
locationManager
.
delegate
=
self
locationManager
.
distanceFilter
=
kCLDistanceFilterNone
locationManager
.
desiredAccuracy
=
kCLLocationAccuracyBest
;
// locationManager.allowsBackgroundLocationUpdates = true;
return
locationManager
}()
typealias
locationHandler
=
((
String
)
->
Void
)
var
addressHandler
:
locationHandler
?
func
locationStatusService
(
_
handler
:
@escaping
locationHandler
){
addressHandler
=
handler
if
CLLocationManager
.
locationServicesEnabled
()
==
true
{
locationManager
.
startUpdatingLocation
()
switch
CLLocationManager
.
authorizationStatus
()
{
case
.
notDetermined
:
locationManager
.
requestWhenInUseAuthorization
()
break
case
.
restricted
:
break
case
.
denied
:
break
case
.
authorizedAlways
:
break
case
.
authorizedWhenInUse
:
break
@unknown
default
:
break
}
}
else
{
self
.
addressHandler
?(
"未知"
)
//alert setting location
}
}
func
locationManager
(
_
manager
:
CLLocationManager
,
didUpdateLocations
locations
:
[
CLLocation
])
{
if
let
location
=
locations
.
first
{
let
geocoder
=
CLGeocoder
.
init
()
geocoder
.
reverseGeocodeLocation
(
location
)
{
(
placemarks
,
error
)
in
if
let
placemark
=
placemarks
?
.
first
{
// var city = placemark.locality
// if city == nil {
// city = placemark.administrativeArea
// }
let
address
=
(
placemark
.
subLocality
??
""
)
+
(
placemark
.
thoroughfare
??
""
)
+
(
placemark
.
subThoroughfare
??
""
)
self
.
addressHandler
?(
address
)
}
else
{
self
.
addressHandler
?(
"未知"
)
}
}
}
else
{
self
.
addressHandler
?(
"未知"
)
}
manager
.
stopUpdatingLocation
()
}
}
ShorthandMaster/Record/SHRecordListCell.swift
View file @
c5feba56
...
@@ -16,7 +16,7 @@ class SHRecordListCell: UITableViewCell {
...
@@ -16,7 +16,7 @@ class SHRecordListCell: UITableViewCell {
_model
=
newValue
_model
=
newValue
addressLab
?
.
text
=
newValue
.
address
.
length
>
0
?
newValue
.
address
:
newValue
.
pathFile
addressLab
?
.
text
=
newValue
.
address
.
length
>
0
?
newValue
.
address
:
newValue
.
pathFile
timeLab
?
.
text
=
newValue
.
time
.
format
(
"HH:mm"
)
timeLab
?
.
text
=
newValue
.
time
.
format
(
"
yyyy-MM-dd
HH:mm"
)
duringLab
?
.
text
=
self
.
countSecond
(
newValue
.
during
)
duringLab
?
.
text
=
self
.
countSecond
(
newValue
.
during
)
}
}
get
{
get
{
...
...
ShorthandMaster/Record/SHRecordShowViewController.swift
View file @
c5feba56
...
@@ -32,7 +32,8 @@ class SHRecordShowViewController: SHBaseViewController {
...
@@ -32,7 +32,8 @@ class SHRecordShowViewController: SHBaseViewController {
@IBOutlet
var
copyBtn
:
UIButton
!
@IBOutlet
var
copyBtn
:
UIButton
!
@IBOutlet
var
transmitBtn
:
UIButton
!
@IBOutlet
var
transmitBtn
:
UIButton
!
@IBOutlet
var
progress
:
UIProgressView
!
// @IBOutlet var progress: UIProgressView!
@IBOutlet
var
progress
:
UISlider
!
@IBOutlet
var
playingTimeLab
:
UILabel
!
@IBOutlet
var
playingTimeLab
:
UILabel
!
@IBOutlet
var
totalTimeLab
:
UILabel
!
@IBOutlet
var
totalTimeLab
:
UILabel
!
...
@@ -74,6 +75,8 @@ class SHRecordShowViewController: SHBaseViewController {
...
@@ -74,6 +75,8 @@ class SHRecordShowViewController: SHBaseViewController {
let
documentsFile
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!.
appending
(
model
!.
pathFile
)
let
documentsFile
=
(
NSSearchPathForDirectoriesInDomains
(
.
documentDirectory
,
.
userDomainMask
,
true
)
.
first
)
!.
appending
(
model
!.
pathFile
)
// let s = FileManager.default.fileExists(atPath: documentsFile)
// 初始化RecognitionRequest,在后边我们会用它将录音数据转发给苹果服务器
// 初始化RecognitionRequest,在后边我们会用它将录音数据转发给苹果服务器
recognitionRequest
=
SFSpeechURLRecognitionRequest
.
init
(
url
:
URL
(
fileURLWithPath
:
documentsFile
))
recognitionRequest
=
SFSpeechURLRecognitionRequest
.
init
(
url
:
URL
(
fileURLWithPath
:
documentsFile
))
// 在用户说话的同时,将识别结果分批次返回
// 在用户说话的同时,将识别结果分批次返回
...
@@ -93,6 +96,7 @@ class SHRecordShowViewController: SHBaseViewController {
...
@@ -93,6 +96,7 @@ class SHRecordShowViewController: SHBaseViewController {
// 如果没有错误发生,或者 result 已经结束,停止audioEngine 录音,终止 recognitionRequest 和 recognitionTask
// 如果没有错误发生,或者 result 已经结束,停止audioEngine 录音,终止 recognitionRequest 和 recognitionTask
if
error
!=
nil
||
isFinal
{
if
error
!=
nil
||
isFinal
{
MBProgressHUD
.
showMessage
(
"实时翻译终止,请查看原文记录"
,
to
:
self
.
view
)
MBProgressHUD
.
showMessage
(
"实时翻译终止,请查看原文记录"
,
to
:
self
.
view
)
// self.recordTextView?.attributedText = self.textView_text(self.model!.txt)
}
}
})
})
}
}
...
@@ -101,7 +105,9 @@ class SHRecordShowViewController: SHBaseViewController {
...
@@ -101,7 +105,9 @@ class SHRecordShowViewController: SHBaseViewController {
self
.
navigationItem
.
leftBarButtonItem
=
UIBarButtonItem
.
init
(
image
:
UIImage
.
init
(
named
:
"record_nav_user"
),
style
:
.
plain
,
target
:
self
,
action
:
#selector(
userCilck
)
)
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(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
()
let
titleLab
=
UILabel
()
titleLab
.
frame
=
CGRect
.
init
(
x
:
0
,
y
:
0
,
width
:
200
,
height
:
44
)
titleLab
.
frame
=
CGRect
.
init
(
x
:
0
,
y
:
0
,
width
:
200
,
height
:
44
)
...
@@ -120,11 +126,37 @@ class SHRecordShowViewController: SHBaseViewController {
...
@@ -120,11 +126,37 @@ class SHRecordShowViewController: SHBaseViewController {
view
.
layoutIfNeeded
()
view
.
layoutIfNeeded
()
view
.
layoutSubviews
()
view
.
layoutSubviews
()
progress
.
layer
.
cornerRadius
=
progress
.
frame
.
size
.
height
/
2
//
progress.layer.cornerRadius = progress.frame.size.height/2
progress
.
layer
.
masksToBounds
=
true
//
progress.layer.masksToBounds = true
totalTimeLab
.
text
=
self
.
countSecond
(
model
!.
during
)
totalTimeLab
.
text
=
self
.
countSecond
(
model
!.
during
)
progress
.
value
=
0
progress
.
minimumValue
=
0
progress
.
maximumValue
=
Float
(
model
?
.
during
??
0
)
progress
.
setThumbImage
(
UIImage
.
init
(
named
:
"slider_point"
),
for
:
.
normal
)
progress
.
addTarget
(
self
,
action
:
#selector(
sliderPlayerPause(_:)
)
,
for
:
.
touchDown
)
progress
.
addTarget
(
self
,
action
:
#selector(
sliderPlayerPlay(_:)
)
,
for
:
.
touchUpInside
)
}
@objc
func
sliderPlayerPause
(
_
sender
:
UISlider
){
self
.
recorderBtn
.
isSelected
=
true
player
?
.
pause
()
playerTimer
?
.
invalidate
()
confirmCilck
()
}
}
@objc
func
sliderPlayerPlay
(
_
sender
:
UISlider
){
progress
.
value
=
roundf
(
sender
.
value
)
print
(
"
\(
progress
.
value
)
"
)
self
.
recorderBtn
.
isSelected
=
false
player
?
.
currentTime
=
TimeInterval
(
progress
.
value
)
player
?
.
play
()
playerTimeCount
=
Int
(
progress
.
value
)
playingTimeLab
.
text
=
self
.
countSecond
(
playerTimeCount
)
playerTimer
?
=
SHTimer
.
scheduledTimer
(
timeInterval
:
1.0
,
target
:
self
,
selector
:
#selector(
updateMeters
)
,
userInfo
:
nil
,
repeats
:
true
)
}
//播放
//播放
func
play
()
{
func
play
()
{
//设置外放模式,不然录音会用听筒模式播放,就很小声
//设置外放模式,不然录音会用听筒模式播放,就很小声
...
@@ -153,10 +185,10 @@ class SHRecordShowViewController: SHBaseViewController {
...
@@ -153,10 +185,10 @@ class SHRecordShowViewController: SHBaseViewController {
playerTimeCount
+=
1
playerTimeCount
+=
1
playingTimeLab
.
text
=
self
.
countSecond
(
playerTimeCount
)
playingTimeLab
.
text
=
self
.
countSecond
(
playerTimeCount
)
progress
.
progress
=
Float
(
playerTimeCount
)
/
Float
(
model
!.
during
)
progress
.
value
=
Float
(
playerTimeCount
)
if
playerTimeCount
>=
model
!.
during
{
if
playerTimeCount
>=
model
!.
during
{
playerTimer
?
.
invalidate
()
playerTimer
?
.
invalidate
()
progress
.
progress
=
1.0
progress
.
value
=
1.0
recorderBtn
.
isSelected
=
true
recorderBtn
.
isSelected
=
true
playerTimeCount
=
0
playerTimeCount
=
0
}
}
...
@@ -180,6 +212,7 @@ class SHRecordShowViewController: SHBaseViewController {
...
@@ -180,6 +212,7 @@ class SHRecordShowViewController: SHBaseViewController {
if
sender
.
isSelected
==
true
{
if
sender
.
isSelected
==
true
{
player
?
.
pause
()
player
?
.
pause
()
playerTimer
?
.
invalidate
()
playerTimer
?
.
invalidate
()
confirmCilck
()
}
else
{
}
else
{
player
?
.
play
()
player
?
.
play
()
playerTimer
?
=
SHTimer
.
scheduledTimer
(
timeInterval
:
1.0
,
target
:
self
,
selector
:
#selector(
updateMeters
)
,
userInfo
:
nil
,
repeats
:
true
)
playerTimer
?
=
SHTimer
.
scheduledTimer
(
timeInterval
:
1.0
,
target
:
self
,
selector
:
#selector(
updateMeters
)
,
userInfo
:
nil
,
repeats
:
true
)
...
...
ShorthandMaster/Record/SHRecordViewController.swift
View file @
c5feba56
...
@@ -23,6 +23,7 @@ class SHRecordViewController: SHBaseViewController {
...
@@ -23,6 +23,7 @@ class SHRecordViewController: SHBaseViewController {
private
var
currentModel
:
SHRecordModel
?
private
var
currentModel
:
SHRecordModel
?
private
var
currentTxt
:
String
?
private
var
currentTxt
:
String
?
private
var
currentAddress
:
String
?
private
var
start
:
Bool
=
false
private
var
start
:
Bool
=
false
private
var
save
:
Bool
=
false
private
var
save
:
Bool
=
false
...
@@ -94,6 +95,10 @@ class SHRecordViewController: SHBaseViewController {
...
@@ -94,6 +95,10 @@ class SHRecordViewController: SHBaseViewController {
waveView
=
SHRecordWaveView
(
frame
:
waveBgView
.
bounds
,
type
:
.
line
,
capacity
:
soundMeterCount
)
waveView
=
SHRecordWaveView
(
frame
:
waveBgView
.
bounds
,
type
:
.
line
,
capacity
:
soundMeterCount
)
waveBgView
.
addSubview
(
waveView
)
waveBgView
.
addSubview
(
waveView
)
SHLocationManager
.
shared
.
locationStatusService
{
(
address
)
in
self
.
currentAddress
=
address
}
}
}
func
setNavTitleAndConfirmBtn
(){
func
setNavTitleAndConfirmBtn
(){
...
@@ -161,6 +166,10 @@ class SHRecordViewController: SHBaseViewController {
...
@@ -161,6 +166,10 @@ class SHRecordViewController: SHBaseViewController {
stopRecord
()
stopRecord
()
save
=
true
save
=
true
if
let
model
=
currentModel
{
self
.
removeCurrentRecored
(
model
)
}
// saveContent()
if
save
==
true
{
if
save
==
true
{
currentTxt
=
""
currentTxt
=
""
recognitionTaskText
=
[]
recognitionTaskText
=
[]
...
@@ -315,7 +324,7 @@ class SHRecordViewController: SHBaseViewController {
...
@@ -315,7 +324,7 @@ class SHRecordViewController: SHBaseViewController {
if
self
.
recognitionTaskText
.
count
==
0
{
if
self
.
recognitionTaskText
.
count
==
0
{
self
.
recordTextView
.
attributedText
=
self
.
textView_text
(
result
?
.
bestTranscription
.
formattedString
??
""
)
self
.
recordTextView
.
attributedText
=
self
.
textView_text
(
result
?
.
bestTranscription
.
formattedString
??
""
)
}
else
{
}
else
{
self
.
recordTextView
.
attributedText
=
self
.
textView_text
(
self
.
recognitionTaskText
.
first
!
+
(
result
?
.
bestTranscription
.
formattedString
)
!
)
self
.
recordTextView
.
attributedText
=
self
.
textView_text
(
self
.
recognitionTaskText
.
first
!
+
"
\n
"
+
(
result
?
.
bestTranscription
.
formattedString
)
!
)
}
}
// 如果 result 是最终,将 isFinal 设置为 true
// 如果 result 是最终,将 isFinal 设置为 true
isFinal
=
(
result
?
.
isFinal
)
!
isFinal
=
(
result
?
.
isFinal
)
!
...
@@ -329,7 +338,7 @@ class SHRecordViewController: SHBaseViewController {
...
@@ -329,7 +338,7 @@ class SHRecordViewController: SHBaseViewController {
}
else
{
}
else
{
var
s
=
""
var
s
=
""
if
let
text
=
self
.
currentTxt
,
text
.
length
>
0
{
if
let
text
=
self
.
currentTxt
,
text
.
length
>
0
{
s
=
self
.
recognitionTaskText
.
first
!
+
text
+
"
\n
"
s
=
self
.
recognitionTaskText
.
first
!
+
"
\n
"
+
text
+
"
\n
"
}
else
{
}
else
{
s
=
self
.
recognitionTaskText
.
first
!
s
=
self
.
recognitionTaskText
.
first
!
}
}
...
@@ -381,11 +390,15 @@ class SHRecordViewController: SHBaseViewController {
...
@@ -381,11 +390,15 @@ class SHRecordViewController: SHBaseViewController {
}
}
func
saveContent
(){
func
saveContent
(){
if
let
txt
=
recognitionTaskText
.
first
,
txt
.
length
==
0
{
return
}
let
model
=
SHRecordModel
()
let
model
=
SHRecordModel
()
model
.
time
=
Date
()
model
.
time
=
Date
()
model
.
address
=
""
model
.
address
=
currentAddress
??
""
model
.
txt
=
recognitionTaskText
.
first
??
""
model
.
txt
=
recognitionTaskText
.
first
??
(
self
.
currentTxt
??
""
)
model
.
pathFile
=
postfix_wav_file_path
model
.
pathFile
=
postfix_wav_file_path
model
.
during
=
seconds
model
.
during
=
seconds
...
@@ -395,13 +408,35 @@ class SHRecordViewController: SHBaseViewController {
...
@@ -395,13 +408,35 @@ class SHRecordViewController: SHBaseViewController {
if
list
==
nil
{
if
list
==
nil
{
list
=
[
dic
]
list
=
[
dic
]
}
else
{
}
else
{
list
?
.
append
(
dic
)
var
contains
=
false
for
(
index
,
subDic
)
in
list
!.
enumerated
(){
if
(
subDic
[
"pathFile"
]
as!
String
)
==
model
.
pathFile
{
contains
=
true
list
!
[
index
]
=
dic
break
}
}
if
contains
==
false
{
list
?
.
append
(
dic
)
}
}
}
CRUserDefaults
.
recordList
=
list
CRUserDefaults
.
recordList
=
list
currentModel
=
model
currentModel
=
model
}
}
func
removeCurrentRecored
(
_
model
:
SHRecordModel
){
var
list
=
CRUserDefaults
.
recordList
for
(
index
,
subDic
)
in
list
!.
enumerated
(){
if
(
subDic
[
"pathFile"
]
as!
String
)
==
model
.
pathFile
{
list
?
.
remove
(
at
:
index
)
break
}
}
CRUserDefaults
.
recordList
=
list
}
func
timerInvalidate
(){
func
timerInvalidate
(){
waveTimer
?
.
invalidate
()
waveTimer
?
.
invalidate
()
secondTimer
?
.
invalidate
()
secondTimer
?
.
invalidate
()
...
@@ -451,6 +486,10 @@ extension SHRecordViewController{
...
@@ -451,6 +486,10 @@ extension SHRecordViewController{
let
second
=
(
seconds
)
%
60
;
let
second
=
(
seconds
)
%
60
;
let
timeString
=
String
(
format
:
"%02lu:%02lu:%02lu"
,
hours
,
minutes
,
second
)
let
timeString
=
String
(
format
:
"%02lu:%02lu:%02lu"
,
hours
,
minutes
,
second
)
secondsLabel
.
text
=
timeString
secondsLabel
.
text
=
timeString
if
seconds
%
2
==
0
{
saveContent
()
}
}
}
@objc
private
func
updateMeters
()
{
@objc
private
func
updateMeters
()
{
...
@@ -502,7 +541,7 @@ extension SHRecordViewController{
...
@@ -502,7 +541,7 @@ extension SHRecordViewController{
}
}
func
textView_text
(
_
text
:
String
)
->
NSAttributedString
{
func
textView_text
(
_
text
:
String
)
->
NSAttributedString
{
let
address
=
"地点: "
let
address
=
"地点: "
+
(
self
.
currentAddress
??
""
)
let
content
=
address
+
"
\n
\n
"
+
text
let
content
=
address
+
"
\n
\n
"
+
text
...
...
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