Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Elixxir dApps SDK Swift
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile
iOS
Elixxir dApps SDK Swift
Commits
cca27ff1
Commit
cca27ff1
authored
2 years ago
by
Dariusz Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
Start group chat handlers in AppComponent
parent
21c6725c
No related branches found
No related tags found
2 merge requests
!153
Release 1.1.0
,
!148
[Messenger Example] Setup group chat
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Examples/xx-messenger/Sources/AppFeature/AppComponent.swift
+8
-1
8 additions, 1 deletion
Examples/xx-messenger/Sources/AppFeature/AppComponent.swift
Examples/xx-messenger/Tests/AppFeatureTests/AppComponentTests.swift
+84
-0
84 additions, 0 deletions
...x-messenger/Tests/AppFeatureTests/AppComponentTests.swift
with
92 additions
and
1 deletion
Examples/xx-messenger/Sources/AppFeature/AppComponent.swift
+
8
−
1
View file @
cca27ff1
...
@@ -41,6 +41,8 @@ struct AppComponent: ReducerProtocol {
...
@@ -41,6 +41,8 @@ struct AppComponent: ReducerProtocol {
@Dependency
(\
.
app
.
log
)
var
log
:
Logger
@Dependency
(\
.
app
.
log
)
var
log
:
Logger
@Dependency
(\
.
app
.
mainQueue
)
var
mainQueue
:
AnySchedulerOf
<
DispatchQueue
>
@Dependency
(\
.
app
.
mainQueue
)
var
mainQueue
:
AnySchedulerOf
<
DispatchQueue
>
@Dependency
(\
.
app
.
bgQueue
)
var
bgQueue
:
AnySchedulerOf
<
DispatchQueue
>
@Dependency
(\
.
app
.
bgQueue
)
var
bgQueue
:
AnySchedulerOf
<
DispatchQueue
>
@Dependency
(\
.
app
.
groupRequestHandler
)
var
groupRequestHandler
:
GroupRequestHandler
@Dependency
(\
.
app
.
groupMessageHandler
)
var
groupMessageHandler
:
GroupMessageHandler
var
body
:
some
ReducerProtocol
<
State
,
Action
>
{
var
body
:
some
ReducerProtocol
<
State
,
Action
>
{
BindingReducer
()
BindingReducer
()
...
@@ -80,7 +82,12 @@ struct AppComponent: ReducerProtocol {
...
@@ -80,7 +82,12 @@ struct AppComponent: ReducerProtocol {
cancellables
.
append
(
receiveFileHandler
(
onError
:
{
error
in
cancellables
.
append
(
receiveFileHandler
(
onError
:
{
error
in
log
(
.
error
(
error
as
NSError
))
log
(
.
error
(
error
as
NSError
))
}))
}))
cancellables
.
append
(
groupRequestHandler
(
onError
:
{
error
in
log
(
.
error
(
error
as
NSError
))
}))
cancellables
.
append
(
groupMessageHandler
(
onError
:
{
error
in
log
(
.
error
(
error
as
NSError
))
}))
cancellables
.
append
(
messenger
.
registerBackupCallback
(
.
init
{
data
in
cancellables
.
append
(
messenger
.
registerBackupCallback
(
.
init
{
data
in
try
?
backupStorage
.
store
(
data
)
try
?
backupStorage
.
store
(
data
)
}))
}))
...
...
This diff is collapsed.
Click to expand it.
Examples/xx-messenger/Tests/AppFeatureTests/AppComponentTests.swift
+
84
−
0
View file @
cca27ff1
...
@@ -64,6 +64,14 @@ final class AppComponentTests: XCTestCase {
...
@@ -64,6 +64,14 @@ final class AppComponentTests: XCTestCase {
actions
.
append
(
.
didRegisterBackupCallback
)
actions
.
append
(
.
didRegisterBackupCallback
)
return
Cancellable
{}
return
Cancellable
{}
}
}
store
.
dependencies
.
app
.
groupRequestHandler
.
run
=
{
_
in
actions
.
append
(
.
didStartGroupRequestHandler
)
return
Cancellable
{}
}
store
.
dependencies
.
app
.
groupMessageHandler
.
run
=
{
_
in
actions
.
append
(
.
didStartGroupMessageHandler
)
return
Cancellable
{}
}
actions
=
[]
actions
=
[]
store
.
send
(
.
start
)
store
.
send
(
.
start
)
...
@@ -76,6 +84,8 @@ final class AppComponentTests: XCTestCase {
...
@@ -76,6 +84,8 @@ final class AppComponentTests: XCTestCase {
.
didStartAuthHandler
,
.
didStartAuthHandler
,
.
didStartMessageListener
,
.
didStartMessageListener
,
.
didStartReceiveFileHandler
,
.
didStartReceiveFileHandler
,
.
didStartGroupRequestHandler
,
.
didStartGroupMessageHandler
,
.
didRegisterBackupCallback
,
.
didRegisterBackupCallback
,
])
])
...
@@ -117,6 +127,14 @@ final class AppComponentTests: XCTestCase {
...
@@ -117,6 +127,14 @@ final class AppComponentTests: XCTestCase {
actions
.
append
(
.
didRegisterBackupCallback
)
actions
.
append
(
.
didRegisterBackupCallback
)
return
Cancellable
{}
return
Cancellable
{}
}
}
store
.
dependencies
.
app
.
groupRequestHandler
.
run
=
{
_
in
actions
.
append
(
.
didStartGroupRequestHandler
)
return
Cancellable
{}
}
store
.
dependencies
.
app
.
groupMessageHandler
.
run
=
{
_
in
actions
.
append
(
.
didStartGroupMessageHandler
)
return
Cancellable
{}
}
actions
=
[]
actions
=
[]
store
.
send
(
.
start
)
store
.
send
(
.
start
)
...
@@ -129,6 +147,8 @@ final class AppComponentTests: XCTestCase {
...
@@ -129,6 +147,8 @@ final class AppComponentTests: XCTestCase {
.
didStartAuthHandler
,
.
didStartAuthHandler
,
.
didStartMessageListener
,
.
didStartMessageListener
,
.
didStartReceiveFileHandler
,
.
didStartReceiveFileHandler
,
.
didStartGroupRequestHandler
,
.
didStartGroupMessageHandler
,
.
didRegisterBackupCallback
,
.
didRegisterBackupCallback
,
.
didLoadMessenger
,
.
didLoadMessenger
,
])
])
...
@@ -170,6 +190,14 @@ final class AppComponentTests: XCTestCase {
...
@@ -170,6 +190,14 @@ final class AppComponentTests: XCTestCase {
actions
.
append
(
.
didRegisterBackupCallback
)
actions
.
append
(
.
didRegisterBackupCallback
)
return
Cancellable
{}
return
Cancellable
{}
}
}
store
.
dependencies
.
app
.
groupRequestHandler
.
run
=
{
_
in
actions
.
append
(
.
didStartGroupRequestHandler
)
return
Cancellable
{}
}
store
.
dependencies
.
app
.
groupMessageHandler
.
run
=
{
_
in
actions
.
append
(
.
didStartGroupMessageHandler
)
return
Cancellable
{}
}
actions
=
[]
actions
=
[]
store
.
send
(
.
welcome
(
.
finished
))
{
store
.
send
(
.
welcome
(
.
finished
))
{
...
@@ -183,6 +211,8 @@ final class AppComponentTests: XCTestCase {
...
@@ -183,6 +211,8 @@ final class AppComponentTests: XCTestCase {
.
didStartAuthHandler
,
.
didStartAuthHandler
,
.
didStartMessageListener
,
.
didStartMessageListener
,
.
didStartReceiveFileHandler
,
.
didStartReceiveFileHandler
,
.
didStartGroupRequestHandler
,
.
didStartGroupMessageHandler
,
.
didRegisterBackupCallback
,
.
didRegisterBackupCallback
,
.
didLoadMessenger
,
.
didLoadMessenger
,
])
])
...
@@ -224,6 +254,14 @@ final class AppComponentTests: XCTestCase {
...
@@ -224,6 +254,14 @@ final class AppComponentTests: XCTestCase {
actions
.
append
(
.
didRegisterBackupCallback
)
actions
.
append
(
.
didRegisterBackupCallback
)
return
Cancellable
{}
return
Cancellable
{}
}
}
store
.
dependencies
.
app
.
groupRequestHandler
.
run
=
{
_
in
actions
.
append
(
.
didStartGroupRequestHandler
)
return
Cancellable
{}
}
store
.
dependencies
.
app
.
groupMessageHandler
.
run
=
{
_
in
actions
.
append
(
.
didStartGroupMessageHandler
)
return
Cancellable
{}
}
actions
=
[]
actions
=
[]
store
.
send
(
.
restore
(
.
finished
))
{
store
.
send
(
.
restore
(
.
finished
))
{
...
@@ -237,6 +275,8 @@ final class AppComponentTests: XCTestCase {
...
@@ -237,6 +275,8 @@ final class AppComponentTests: XCTestCase {
.
didStartAuthHandler
,
.
didStartAuthHandler
,
.
didStartMessageListener
,
.
didStartMessageListener
,
.
didStartReceiveFileHandler
,
.
didStartReceiveFileHandler
,
.
didStartGroupRequestHandler
,
.
didStartGroupMessageHandler
,
.
didRegisterBackupCallback
,
.
didRegisterBackupCallback
,
.
didLoadMessenger
,
.
didLoadMessenger
,
])
])
...
@@ -275,6 +315,14 @@ final class AppComponentTests: XCTestCase {
...
@@ -275,6 +315,14 @@ final class AppComponentTests: XCTestCase {
actions
.
append
(
.
didRegisterBackupCallback
)
actions
.
append
(
.
didRegisterBackupCallback
)
return
Cancellable
{}
return
Cancellable
{}
}
}
store
.
dependencies
.
app
.
groupRequestHandler
.
run
=
{
_
in
actions
.
append
(
.
didStartGroupRequestHandler
)
return
Cancellable
{}
}
store
.
dependencies
.
app
.
groupMessageHandler
.
run
=
{
_
in
actions
.
append
(
.
didStartGroupMessageHandler
)
return
Cancellable
{}
}
actions
=
[]
actions
=
[]
store
.
send
(
.
home
(
.
deleteAccount
(
.
success
)))
{
store
.
send
(
.
home
(
.
deleteAccount
(
.
success
)))
{
...
@@ -288,6 +336,8 @@ final class AppComponentTests: XCTestCase {
...
@@ -288,6 +336,8 @@ final class AppComponentTests: XCTestCase {
.
didStartAuthHandler
,
.
didStartAuthHandler
,
.
didStartMessageListener
,
.
didStartMessageListener
,
.
didStartReceiveFileHandler
,
.
didStartReceiveFileHandler
,
.
didStartGroupRequestHandler
,
.
didStartGroupMessageHandler
,
.
didRegisterBackupCallback
,
.
didRegisterBackupCallback
,
])
])
...
@@ -378,6 +428,14 @@ final class AppComponentTests: XCTestCase {
...
@@ -378,6 +428,14 @@ final class AppComponentTests: XCTestCase {
actions
.
append
(
.
didRegisterBackupCallback
)
actions
.
append
(
.
didRegisterBackupCallback
)
return
Cancellable
{}
return
Cancellable
{}
}
}
store
.
dependencies
.
app
.
groupRequestHandler
.
run
=
{
_
in
actions
.
append
(
.
didStartGroupRequestHandler
)
return
Cancellable
{}
}
store
.
dependencies
.
app
.
groupMessageHandler
.
run
=
{
_
in
actions
.
append
(
.
didStartGroupMessageHandler
)
return
Cancellable
{}
}
actions
=
[]
actions
=
[]
store
.
send
(
.
start
)
store
.
send
(
.
start
)
...
@@ -390,6 +448,8 @@ final class AppComponentTests: XCTestCase {
...
@@ -390,6 +448,8 @@ final class AppComponentTests: XCTestCase {
.
didStartAuthHandler
,
.
didStartAuthHandler
,
.
didStartMessageListener
,
.
didStartMessageListener
,
.
didStartReceiveFileHandler
,
.
didStartReceiveFileHandler
,
.
didStartGroupRequestHandler
,
.
didStartGroupMessageHandler
,
.
didRegisterBackupCallback
,
.
didRegisterBackupCallback
,
])
])
...
@@ -447,6 +507,18 @@ final class AppComponentTests: XCTestCase {
...
@@ -447,6 +507,18 @@ final class AppComponentTests: XCTestCase {
store
.
dependencies
.
app
.
backupStorage
.
store
=
{
data
in
store
.
dependencies
.
app
.
backupStorage
.
store
=
{
data
in
actions
.
append
(
.
didStoreBackup
(
data
))
actions
.
append
(
.
didStoreBackup
(
data
))
}
}
store
.
dependencies
.
app
.
groupRequestHandler
.
run
=
{
_
in
actions
.
append
(
.
didStartGroupRequestHandler
)
return
Cancellable
{
actions
.
append
(
.
didCancelGroupRequestHandler
)
}
}
store
.
dependencies
.
app
.
groupMessageHandler
.
run
=
{
_
in
actions
.
append
(
.
didStartGroupMessageHandler
)
return
Cancellable
{
actions
.
append
(
.
didCancelGroupMessageHandler
)
}
}
actions
=
[]
actions
=
[]
store
.
send
(
.
start
)
store
.
send
(
.
start
)
...
@@ -458,6 +530,8 @@ final class AppComponentTests: XCTestCase {
...
@@ -458,6 +530,8 @@ final class AppComponentTests: XCTestCase {
.
didStartAuthHandler
,
.
didStartAuthHandler
,
.
didStartMessageListener
,
.
didStartMessageListener
,
.
didStartReceiveFileHandler
,
.
didStartReceiveFileHandler
,
.
didStartGroupRequestHandler
,
.
didStartGroupMessageHandler
,
.
didRegisterBackupCallback
,
.
didRegisterBackupCallback
,
])
])
...
@@ -473,10 +547,14 @@ final class AppComponentTests: XCTestCase {
...
@@ -473,10 +547,14 @@ final class AppComponentTests: XCTestCase {
.
didCancelAuthHandler
,
.
didCancelAuthHandler
,
.
didCancelMessageListener
,
.
didCancelMessageListener
,
.
didCancelReceiveFileHandler
,
.
didCancelReceiveFileHandler
,
.
didCancelGroupRequestHandler
,
.
didCancelGroupMessageHandler
,
.
didCancelBackupCallback
,
.
didCancelBackupCallback
,
.
didStartAuthHandler
,
.
didStartAuthHandler
,
.
didStartMessageListener
,
.
didStartMessageListener
,
.
didStartReceiveFileHandler
,
.
didStartReceiveFileHandler
,
.
didStartGroupRequestHandler
,
.
didStartGroupMessageHandler
,
.
didRegisterBackupCallback
,
.
didRegisterBackupCallback
,
])
])
...
@@ -519,6 +597,8 @@ final class AppComponentTests: XCTestCase {
...
@@ -519,6 +597,8 @@ final class AppComponentTests: XCTestCase {
.
didCancelAuthHandler
,
.
didCancelAuthHandler
,
.
didCancelMessageListener
,
.
didCancelMessageListener
,
.
didCancelReceiveFileHandler
,
.
didCancelReceiveFileHandler
,
.
didCancelGroupRequestHandler
,
.
didCancelGroupMessageHandler
,
.
didCancelBackupCallback
,
.
didCancelBackupCallback
,
])
])
}
}
...
@@ -539,4 +619,8 @@ private enum Action: Equatable {
...
@@ -539,4 +619,8 @@ private enum Action: Equatable {
case
didStoreBackup
(
Data
)
case
didStoreBackup
(
Data
)
case
didSetLogLevel
(
LogLevel
)
case
didSetLogLevel
(
LogLevel
)
case
didStartLogging
case
didStartLogging
case
didStartGroupRequestHandler
case
didCancelGroupRequestHandler
case
didStartGroupMessageHandler
case
didCancelGroupMessageHandler
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment