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
a501620a
Commit
a501620a
authored
2 years ago
by
Dariusz Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
Add GroupChatProcessor callback
parent
2342343e
No related branches found
No related tags found
2 merge requests
!102
Release 1.0.0
,
!24
Update Bindings
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Sources/ElixxirDAppsSDK/Callbacks/GroupChatProcessor.swift
+93
-0
93 additions, 0 deletions
Sources/ElixxirDAppsSDK/Callbacks/GroupChatProcessor.swift
with
93 additions
and
0 deletions
Sources/ElixxirDAppsSDK/Callbacks/GroupChatProcessor.swift
0 → 100644
+
93
−
0
View file @
a501620a
import
Bindings
import
XCTestDynamicOverlay
public
struct
GroupChatProcessor
{
public
struct
Callback
:
Equatable
{
public
init
(
decryptedMessage
:
Result
<
Data
,
NSError
>
,
msg
:
Data
,
receptionId
:
Data
,
ephemeralId
:
Int64
,
roundId
:
Int64
)
{
self
.
decryptedMessage
=
decryptedMessage
self
.
msg
=
msg
self
.
receptionId
=
receptionId
self
.
ephemeralId
=
ephemeralId
self
.
roundId
=
roundId
}
public
var
decryptedMessage
:
Result
<
Data
,
NSError
>
public
var
msg
:
Data
public
var
receptionId
:
Data
public
var
ephemeralId
:
Int64
public
var
roundId
:
Int64
}
public
init
(
name
:
String
=
"GroupChatProcessor"
,
handle
:
@escaping
(
Callback
)
->
Void
)
{
self
.
name
=
name
self
.
handle
=
handle
}
public
var
name
:
String
public
var
handle
:
(
Callback
)
->
Void
}
extension
GroupChatProcessor
{
public
static
let
unimplemented
=
GroupChatProcessor
(
name
:
"GroupChatProcessor.unimplemented"
,
handle
:
XCTUnimplemented
(
"
\(
Self
.
self
)
"
)
)
}
extension
GroupChatProcessor
{
func
makeBindingsGroupChatProcessor
()
->
BindingsGroupChatProcessorProtocol
{
class
CallbackObject
:
NSObject
,
BindingsGroupChatProcessorProtocol
{
init
(
_
callback
:
GroupChatProcessor
)
{
self
.
callback
=
callback
}
let
callback
:
GroupChatProcessor
func
process
(
_
decryptedMessage
:
Data
?,
msg
:
Data
?,
receptionId
:
Data
?,
ephemeralId
:
Int64
,
roundId
:
Int64
,
err
:
Error
?
)
{
guard
let
msg
=
msg
else
{
fatalError
(
"BindingsGroupChatProcessor received `nil` msg"
)
}
guard
let
receptionId
=
receptionId
else
{
fatalError
(
"BindingsGroupChatProcessor received `nil` receptionId"
)
}
let
decryptedMessageResult
:
Result
<
Data
,
NSError
>
if
let
err
=
err
{
decryptedMessageResult
=
.
failure
(
err
as
NSError
)
}
else
if
let
decryptedMessage
=
decryptedMessage
{
decryptedMessageResult
=
.
success
(
decryptedMessage
)
}
else
{
fatalError
(
"BindingsGroupChatProcessor received `nil` decryptedMessage and `nil` error"
)
}
callback
.
handle
(
.
init
(
decryptedMessage
:
decryptedMessageResult
,
msg
:
msg
,
receptionId
:
receptionId
,
ephemeralId
:
ephemeralId
,
roundId
:
roundId
))
}
func
string
()
->
String
{
callback
.
name
}
}
return
CallbackObject
(
self
)
}
}
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