Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
iOSTeam
/
Majiabao
/
TealiveModule
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
532c3614
authored
Apr 17, 2024
by
pierce
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bugs
parent
63b82f6e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
94 additions
and
56 deletions
LocalPodSpec/GDToolBox/GDToolBox/Classes/Base/Base/BaseModel.swift
LocalPodSpec/GDToolBox/GDToolBox/Classes/GDConfiguration.swift
LocalPodSpec/GDToolBox/GDToolBox/Classes/Tool/VideoTransformer/GDVideoTransformer.swift
Module/GDBaseBussiness/GDBaseBussiness/Application.swift
Module/GDChatMessage/GDChatMessage/Features/FakeMessage/GDFakeMessageCenter.swift
Module/GDPayment/GDPayment/Feature/RechargeView/GDRechargeView.swift
LocalPodSpec/GDToolBox/GDToolBox/Classes/Base/Base/BaseModel.swift
View file @
532c3614
...
@@ -12,7 +12,9 @@ import SwiftyJSON
...
@@ -12,7 +12,9 @@ import SwiftyJSON
import
RxSwift
import
RxSwift
import
RxCocoa
import
RxCocoa
@objcMembers
open
class
BaseModel
:
NSObject
,
YYModel
,
NSCoding
{
@objcMembers
open
class
BaseModel
:
NSObject
,
YYModel
,
NSSecureCoding
{
public
static
var
supportsSecureCoding
:
Bool
=
true
open
func
encode
(
with
coder
:
NSCoder
)
{
open
func
encode
(
with
coder
:
NSCoder
)
{
self
.
modelInit
(
with
:
coder
)
self
.
modelInit
(
with
:
coder
)
...
...
LocalPodSpec/GDToolBox/GDToolBox/Classes/GDConfiguration.swift
View file @
532c3614
...
@@ -89,9 +89,9 @@ public struct DevConfig {
...
@@ -89,9 +89,9 @@ public struct DevConfig {
case
.
release
:
case
.
release
:
return
false
return
false
case
.
testing
:
case
.
testing
:
return
tru
e
return
fals
e
case
.
developing
:
case
.
developing
:
return
tru
e
return
fals
e
}
}
}
}
...
...
LocalPodSpec/GDToolBox/GDToolBox/Classes/Tool/VideoTransformer/GDVideoTransformer.swift
View file @
532c3614
...
@@ -67,6 +67,7 @@ public class GDVideoTransformer: BaseViewModel {
...
@@ -67,6 +67,7 @@ public class GDVideoTransformer: BaseViewModel {
exportSession
.
outputURL
=
mp4Url
exportSession
.
outputURL
=
mp4Url
exportSession
.
shouldOptimizeForNetworkUse
=
true
exportSession
.
shouldOptimizeForNetworkUse
=
true
exportSession
.
outputFileType
=
.
mp4
exportSession
.
outputFileType
=
.
mp4
exportSession
.
videoComposition
=
self
.
getVideoComposition
(
asset
:
avAsset
)
exportSession
.
exportAsynchronously
{
exportSession
.
exportAsynchronously
{
...
@@ -104,4 +105,41 @@ public class GDVideoTransformer: BaseViewModel {
...
@@ -104,4 +105,41 @@ public class GDVideoTransformer: BaseViewModel {
}
}
public
static
func
getVideoComposition
(
asset
:
AVAsset
)
->
AVMutableVideoComposition
?
{
guard
let
videoTrack
=
asset
.
tracks
(
withMediaType
:
.
video
)
.
first
else
{
return
nil
}
let
composition
=
AVMutableComposition
()
let
videoComposition
=
AVMutableVideoComposition
()
var
videoSize
=
videoTrack
.
naturalSize
let
tracks
=
asset
.
tracks
(
withMediaType
:
.
video
)
if
tracks
.
count
>
0
{
let
videoTrack
=
tracks
[
0
]
let
t
=
videoTrack
.
preferredTransform
if
t
.
a
==
0
&&
t
.
b
==
1.0
&&
t
.
c
==
-
1.0
&&
t
.
d
==
0
{
videoSize
=
CGSize
(
width
:
videoSize
.
height
,
height
:
videoSize
.
width
)
}
}
composition
.
naturalSize
=
videoSize
videoComposition
.
renderSize
=
videoSize
videoComposition
.
frameDuration
=
CMTimeMakeWithSeconds
(
1
/
Double
(
videoTrack
.
nominalFrameRate
),
preferredTimescale
:
600
)
let
compositionVideoTrack
=
composition
.
addMutableTrack
(
withMediaType
:
.
video
,
preferredTrackID
:
kCMPersistentTrackID_Invalid
)
try
?
compositionVideoTrack
?
.
insertTimeRange
(
CMTimeRangeMake
(
start
:
.
zero
,
duration
:
asset
.
duration
),
of
:
videoTrack
,
at
:
.
zero
)
let
layerInst
=
AVMutableVideoCompositionLayerInstruction
(
assetTrack
:
videoTrack
)
layerInst
.
setTransform
(
videoTrack
.
preferredTransform
,
at
:
.
zero
)
let
inst
=
AVMutableVideoCompositionInstruction
()
inst
.
timeRange
=
CMTimeRangeMake
(
start
:
.
zero
,
duration
:
asset
.
duration
)
inst
.
layerInstructions
=
[
layerInst
]
videoComposition
.
instructions
=
[
inst
]
return
videoComposition
}
}
}
Module/GDBaseBussiness/GDBaseBussiness/Application.swift
View file @
532c3614
...
@@ -32,7 +32,7 @@ class Application: NSObject {
...
@@ -32,7 +32,7 @@ class Application: NSObject {
private
override
init
()
{
private
override
init
()
{
super
.
init
()
super
.
init
()
let
isVerified
=
(
UserDefaults
.
standard
.
object
(
forKey
:
GDBaseBussinessUDKey
.
isCurrentVersionVerified
)
as?
Bool
)
??
fals
e
let
isVerified
=
(
UserDefaults
.
standard
.
object
(
forKey
:
GDBaseBussinessUDKey
.
isCurrentVersionVerified
)
as?
Bool
)
??
tru
e
isCurrentVersionVerified
.
accept
(
isVerified
)
isCurrentVersionVerified
.
accept
(
isVerified
)
isCurrentVersionVerified
.
distinctUntilChanged
()
.
subscribe
(
onNext
:
{
isVerified
in
isCurrentVersionVerified
.
distinctUntilChanged
()
.
subscribe
(
onNext
:
{
isVerified
in
...
...
Module/GDChatMessage/GDChatMessage/Features/FakeMessage/GDFakeMessageCenter.swift
View file @
532c3614
...
@@ -11,7 +11,7 @@ import GDToolBox
...
@@ -11,7 +11,7 @@ import GDToolBox
import
GDRouter
import
GDRouter
class
GDFakeMessageCenter
:
BaseViewModel
{
class
GDFakeMessageCenter
:
BaseViewModel
{
static
let
shared
=
GDFakeMessageCenter
()
static
let
shared
=
GDFakeMessageCenter
()
var
lastRequestDate
:
String
?
var
lastRequestDate
:
String
?
...
@@ -81,7 +81,7 @@ class GDFakeMessageCenter: BaseViewModel {
...
@@ -81,7 +81,7 @@ class GDFakeMessageCenter: BaseViewModel {
guard
let
self
=
self
else
{
return
}
guard
let
self
=
self
else
{
return
}
if
model
.
roomlist
.
count
==
0
{
if
model
.
roomlist
.
count
==
0
{
// 没有数据
// 没有数据
// self.clean()
// self.clean()
return
return
}
}
...
@@ -181,24 +181,24 @@ class GDFakeMessageCenter: BaseViewModel {
...
@@ -181,24 +181,24 @@ class GDFakeMessageCenter: BaseViewModel {
}
}
for
user
in
userDict
.
values
{
for
user
in
userDict
.
values
{
if
user
.
content
.
msgList
.
count
>
0
{
if
user
.
content
.
msgList
.
count
>
0
{
hadFakeMessage
=
true
hadFakeMessage
=
true
}
else
{
}
else
{
continue
continue
}
}
guard
user
.
launchTime
>
0
else
{
guard
user
.
launchTime
>
0
else
{
// 时间无效
// 时间无效
// userDict.removeValue(forKey: user.uid)
// userDict.removeValue(forKey: user.uid)
// fakeFriendList.accept(userDict.keys.map({ $0 }))
// fakeFriendList.accept(userDict.keys.map({ $0 }))
continue
continue
}
}
if
user
.
launchTime
>
Date
()
.
timeStamp
.
intValue
{
if
user
.
launchTime
>
Date
()
.
timeStamp
.
intValue
{
continue
continue
}
}
if
user
.
unreplayNum
.
value
>=
1
{
if
user
.
unreplayNum
.
value
>=
1
{
continue
continue
}
}
...
@@ -206,9 +206,9 @@ class GDFakeMessageCenter: BaseViewModel {
...
@@ -206,9 +206,9 @@ class GDFakeMessageCenter: BaseViewModel {
if
userList
.
contains
(
user
)
{
if
userList
.
contains
(
user
)
{
continue
continue
}
}
let
messageData
=
user
.
content
.
msgList
.
removeFirst
()
let
messageData
=
user
.
content
.
msgList
.
removeFirst
()
GDlog
.
verbose
(
"[FakeMessage] 假消息发布1"
)
GDlog
.
verbose
(
"[FakeMessage] 假消息发布1"
)
switch
messageData
.
type
{
switch
messageData
.
type
{
...
@@ -219,22 +219,22 @@ class GDFakeMessageCenter: BaseViewModel {
...
@@ -219,22 +219,22 @@ class GDFakeMessageCenter: BaseViewModel {
GDlog
.
verbose
(
"[FakeMessage]
\(
user
.
user
.
nickname
??
""
)
发布
\(
messageData
.
msg
??
""
)
"
)
GDlog
.
verbose
(
"[FakeMessage]
\(
user
.
user
.
nickname
??
""
)
发布
\(
messageData
.
msg
??
""
)
"
)
GDRouter
.
ChatRoom
?
.
addMessage
(
from
:
user
.
uid
,
fromid
:
user
.
uid
,
touid
:
currentUid
,
content
:
messageData
.
msg
??
""
,
failureMsg
:
false
,
ext
:
[
"text_type"
:
"7"
])
GDRouter
.
ChatRoom
?
.
addMessage
(
from
:
user
.
uid
,
fromid
:
user
.
uid
,
touid
:
currentUid
,
content
:
messageData
.
msg
??
""
,
failureMsg
:
false
,
ext
:
[
"text_type"
:
"7"
])
}
}
user
.
unreplayNum
.
accept
(
user
.
unreplayNum
.
value
+
1
)
user
.
unreplayNum
.
accept
(
user
.
unreplayNum
.
value
+
1
)
if
timeNode
.
count
>
0
{
if
timeNode
.
count
>
0
{
let
timeCount
=
timeNode
.
count
let
timeCount
=
timeNode
.
count
if
user
.
unreplayNum
.
value
>
0
&&
user
.
unreplayNum
.
value
<=
timeCount
{
if
user
.
unreplayNum
.
value
>
0
&&
user
.
unreplayNum
.
value
<=
timeCount
{
user
.
launchTime
=
Date
()
.
timeStamp
.
intValue
+
timeNode
[
user
.
unreplayNum
.
value
-
1
]
user
.
launchTime
=
Date
()
.
timeStamp
.
intValue
+
timeNode
[
user
.
unreplayNum
.
value
-
1
]
}
else
{
}
else
{
user
.
launchTime
=
Date
()
.
timeStamp
.
intValue
+
timeNode
[
user
.
unreplayNum
.
value
%
timeCount
]
user
.
launchTime
=
Date
()
.
timeStamp
.
intValue
+
timeNode
[
user
.
unreplayNum
.
value
%
timeCount
]
}
}
}
else
{
}
else
{
user
.
launchTime
=
Date
()
.
timeStamp
.
intValue
+
10
user
.
launchTime
=
Date
()
.
timeStamp
.
intValue
+
10
}
}
}
}
writeLocal
()
writeLocal
()
...
@@ -257,10 +257,10 @@ class GDFakeMessageCenter: BaseViewModel {
...
@@ -257,10 +257,10 @@ class GDFakeMessageCenter: BaseViewModel {
UserDefaults
.
standard
.
set
(
date
,
forKey
:
GDChatMessageUDKeys
.
fakeMsgLastDate
+
currentUid
)
UserDefaults
.
standard
.
set
(
date
,
forKey
:
GDChatMessageUDKeys
.
fakeMsgLastDate
+
currentUid
)
}
}
let
listData
=
try
?
NSKeyedArchiver
.
archivedData
(
withRootObject
:
userList
,
requiringSecureCoding
:
tru
e
)
let
listData
=
try
?
NSKeyedArchiver
.
archivedData
(
withRootObject
:
userList
,
requiringSecureCoding
:
fals
e
)
UserDefaults
.
standard
.
set
(
listData
,
forKey
:
GDChatMessageUDKeys
.
fakeMsgUserList
+
currentUid
)
UserDefaults
.
standard
.
set
(
listData
,
forKey
:
GDChatMessageUDKeys
.
fakeMsgUserList
+
currentUid
)
let
data
=
try
?
NSKeyedArchiver
.
archivedData
(
withRootObject
:
userDict
,
requiringSecureCoding
:
tru
e
)
let
data
=
try
?
NSKeyedArchiver
.
archivedData
(
withRootObject
:
userDict
,
requiringSecureCoding
:
fals
e
)
UserDefaults
.
standard
.
set
(
data
,
forKey
:
GDChatMessageUDKeys
.
fakeMsgContent
+
currentUid
)
UserDefaults
.
standard
.
set
(
data
,
forKey
:
GDChatMessageUDKeys
.
fakeMsgContent
+
currentUid
)
UserDefaults
.
standard
.
set
(
timeNode
,
forKey
:
GDChatMessageUDKeys
.
fakeMsgTimeNode
+
currentUid
)
UserDefaults
.
standard
.
set
(
timeNode
,
forKey
:
GDChatMessageUDKeys
.
fakeMsgTimeNode
+
currentUid
)
...
@@ -281,11 +281,11 @@ class GDFakeMessageCenter: BaseViewModel {
...
@@ -281,11 +281,11 @@ class GDFakeMessageCenter: BaseViewModel {
if
let
userListDict
=
NSKeyedUnarchiver
.
unarchiveObject
(
with
:
userListData
)
as?
[
String
:
GDFakeMessageModel
]
{
if
let
userListDict
=
NSKeyedUnarchiver
.
unarchiveObject
(
with
:
userListData
)
as?
[
String
:
GDFakeMessageModel
]
{
for
(
index
,
user
)
in
userListDict
.
enumerated
()
{
for
(
index
,
user
)
in
userListDict
.
enumerated
()
{
// if index == 0 {
// if index == 0 {
// user.value.launchTime = Date().timeStamp.intValue
// user.value.launchTime = Date().timeStamp.intValue
// } else {
// } else {
user
.
value
.
launchTime
=
0
user
.
value
.
launchTime
=
0
// }
// }
}
}
self
.
userDict
=
userListDict
self
.
userDict
=
userListDict
...
@@ -306,10 +306,10 @@ class GDFakeMessageCenter: BaseViewModel {
...
@@ -306,10 +306,10 @@ class GDFakeMessageCenter: BaseViewModel {
}
}
if
let
timeNode
=
UserDefaults
.
standard
.
object
(
forKey
:
GDChatMessageUDKeys
.
fakeMsgTimeNode
+
currentUid
)
as?
[
Int
]
{
if
let
timeNode
=
UserDefaults
.
standard
.
object
(
forKey
:
GDChatMessageUDKeys
.
fakeMsgTimeNode
+
currentUid
)
as?
[
Int
]
{
self
.
timeNode
=
timeNode
self
.
timeNode
=
timeNode
}
}
fakeFriendList
.
accept
(
userDict
.
keys
.
map
({
$0
}))
fakeFriendList
.
accept
(
userDict
.
keys
.
map
({
$0
}))
}
}
...
@@ -328,7 +328,7 @@ class GDFakeMessageCenter: BaseViewModel {
...
@@ -328,7 +328,7 @@ class GDFakeMessageCenter: BaseViewModel {
let
user
=
userList
.
removeFirst
()
let
user
=
userList
.
removeFirst
()
let
messageData
=
userDict
[
user
.
uid
]?
.
content
.
msgList
.
removeFirst
()
??
.
init
()
let
messageData
=
userDict
[
user
.
uid
]?
.
content
.
msgList
.
removeFirst
()
??
.
init
()
GDlog
.
verbose
(
"[FakeMessage] 假消息发布2"
)
GDlog
.
verbose
(
"[FakeMessage] 假消息发布2"
)
switch
messageData
.
type
{
switch
messageData
.
type
{
...
@@ -362,7 +362,7 @@ class GDFakeMessageCenter: BaseViewModel {
...
@@ -362,7 +362,7 @@ class GDFakeMessageCenter: BaseViewModel {
for
uid
in
userDict
.
keys
{
for
uid
in
userDict
.
keys
{
GDRouter
.
ChatRoom
?
.
deleteMessage
(
with
:
uid
)
GDRouter
.
ChatRoom
?
.
deleteMessage
(
with
:
uid
)
}
}
}
}
func
deleteFakeFriend
(
fid
:
String
)
{
func
deleteFakeFriend
(
fid
:
String
)
{
...
...
Module/GDPayment/GDPayment/Feature/RechargeView/GDRechargeView.swift
View file @
532c3614
...
@@ -10,6 +10,7 @@ import UIKit
...
@@ -10,6 +10,7 @@ import UIKit
import
RxSwift
import
RxSwift
import
RxCocoa
import
RxCocoa
import
GDToolBox
import
GDToolBox
import
GDRouter
class
GDRechargeView
:
BaseView
{
class
GDRechargeView
:
BaseView
{
...
@@ -178,30 +179,27 @@ class GDRechargeView: BaseView {
...
@@ -178,30 +179,27 @@ class GDRechargeView: BaseView {
override
func
bindViewModel
()
{
override
func
bindViewModel
()
{
super
.
bindViewModel
()
super
.
bindViewModel
()
//TODO:Live: added By Pidan
// viewModel.viewController = GDLiveHelper.shared.liveVC
viewModel
.
viewController
=
UIViewController
.
topViewController
()
//
// let confirmAction = confirmBtn.rx.tap
let
confirmAction
=
confirmBtn
.
rx
.
tap
// let selection = collectionView.rx.modelSelected(GDStoreModel.self).map { $0.rid }.asDriver(onErrorJustReturn: nil)
let
selection
=
collectionView
.
rx
.
modelSelected
(
GDStoreModel
.
self
)
.
map
{
$0
.
rid
}
.
asDriver
(
onErrorJustReturn
:
nil
)
//
// let output = viewModel.transform(input: .init(confirmAction: confirmAction, selection: selection))
let
output
=
viewModel
.
transform
(
input
:
.
init
(
confirmAction
:
confirmAction
,
selection
:
selection
))
//
// // 钻石数量
// 钻石数量
// output.diamondNum.drive(diamondNumBtn.rx.title()).disposed(by: disposeBag)
output
.
diamondNum
?
.
drive
(
diamondNumBtn
.
rx
.
title
())
.
disposed
(
by
:
disposeBag
)
//
// // 充值点数据
// 充值点数据
// output.rechargeData.drive(collectionView.rx.items(cellIdentifier: reuseIdentifier, cellType: GDRechargeViewCell.self)) { index, element, cell in
output
.
rechargeData
?
.
drive
(
collectionView
.
rx
.
items
(
cellIdentifier
:
reuseIdentifier
,
cellType
:
GDRechargeViewCell
.
self
))
{
index
,
element
,
cell
in
// cell.setup(element)
cell
.
setup
(
element
)
// output.selectRid.bind(to: cell.selectRid).disposed(by: cell.cellDisposeBag ?? self.disposeBag)
output
.
selectRid
?
.
bind
(
to
:
cell
.
selectRid
)
.
disposed
(
by
:
cell
.
cellDisposeBag
??
self
.
disposeBag
)
// }.disposed(by: disposeBag)
}
.
disposed
(
by
:
disposeBag
)
//
// // 客服按钮点击
// 客服按钮点击
// serviceBtn.rx.tap.subscribe(onNext: {[weak self] (_) in
serviceBtn
.
rx
.
tap
.
subscribe
(
onNext
:
{
(
_
)
in
// self?.viewModel.viewController?.navigationController?.pushViewController(GDServiceController(), animated: true)
GDRouter
.
ChatRoom
?
.
showServiceCharRoom
()
// if GDLiveHelper.shared.liveState.value == .none {
})
.
disposed
(
by
:
disposeBag
)
// self?.dismiss()
// }
// }).disposed(by: disposeBag)
}
}
// MARK: Method
// MARK: Method
...
...
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