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
Merge requests
!151
[Messenger example] join group
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
[Messenger example] join group
feature/messenger-example-join-group
into
development
Overview
0
Commits
4
Pipelines
0
Changes
5
Merged
Dariusz Rybicki
requested to merge
feature/messenger-example-join-group
into
development
2 years ago
Overview
0
Commits
4
Pipelines
0
Changes
5
Expand
xx-messenger example
Display group details
Accept pending group invitations (join group)
Edited
2 years ago
by
Dariusz Rybicki
0
0
Merge request reports
Viewing commit
dd822557
Prev
Next
Show latest version
5 files
+
158
−
38
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
dd822557
Fetch and display group details
· dd822557
Dariusz Rybicki
authored
2 years ago
Examples/xx-messenger/Sources/GroupFeature/GroupComponent.swift
+
27
−
3
Options
import
AppCore
import
ComposableArchitecture
import
ComposableArchitecture
import
Foundation
import
XXModels
import
XXModels
public
struct
GroupComponent
:
ReducerProtocol
{
public
struct
GroupComponent
:
ReducerProtocol
{
public
struct
State
:
Equatable
{
public
struct
State
:
Equatable
{
public
init
(
public
init
(
group
:
XXModels
.
Group
groupId
:
XXModels
.
Group
.
ID
,
groupInfo
:
XXModels
.
GroupInfo
?
=
nil
)
{
)
{
self
.
group
=
group
self
.
groupId
=
groupId
self
.
groupInfo
=
groupInfo
}
}
public
var
group
:
XXModels
.
Group
public
var
groupId
:
XXModels
.
Group
.
ID
public
var
groupInfo
:
XXModels
.
GroupInfo
?
}
}
public
enum
Action
:
Equatable
{
public
enum
Action
:
Equatable
{
case
start
case
start
case
didFetchGroupInfo
(
XXModels
.
GroupInfo
?)
}
}
public
init
()
{}
public
init
()
{}
@Dependency
(\
.
app
.
dbManager
.
getDB
)
var
db
:
DBManagerGetDB
@Dependency
(\
.
app
.
mainQueue
)
var
mainQueue
:
AnySchedulerOf
<
DispatchQueue
>
@Dependency
(\
.
app
.
bgQueue
)
var
bgQueue
:
AnySchedulerOf
<
DispatchQueue
>
public
var
body
:
some
ReducerProtocol
<
State
,
Action
>
{
public
var
body
:
some
ReducerProtocol
<
State
,
Action
>
{
Reduce
{
state
,
action
in
Reduce
{
state
,
action
in
switch
action
{
switch
action
{
case
.
start
:
case
.
start
:
return
Effect
.
catching
{
try
db
()
}
.
flatMap
{
[
state
]
in
let
query
=
GroupInfo
.
Query
(
groupId
:
state
.
groupId
)
return
$0
.
fetchGroupInfosPublisher
(
query
)
.
map
(\
.
first
)
}
.
assertNoFailure
()
.
map
(
Action
.
didFetchGroupInfo
)
.
subscribe
(
on
:
bgQueue
)
.
receive
(
on
:
mainQueue
)
.
eraseToEffect
()
case
.
didFetchGroupInfo
(
let
groupInfo
):
state
.
groupInfo
=
groupInfo
return
.
none
return
.
none
}
}
}
}
Loading