Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
xx messenger iOS
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
xx messenger iOS
Commits
fd9ae729
Commit
fd9ae729
authored
2 years ago
by
Dariusz Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
Add FetchBannedList functor
parent
8ced6ec0
No related branches found
No related tags found
3 merge requests
!71
Releasing v1.1.5 (214)
,
!69
Implemented filtering for banned/blocked users and reporting
,
!67
v1.1.5 b(203)
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Sources/ReportingFeature/FetchBannedList.swift
+45
-0
45 additions, 0 deletions
Sources/ReportingFeature/FetchBannedList.swift
with
45 additions
and
0 deletions
Sources/ReportingFeature/FetchBannedList.swift
0 → 100644
+
45
−
0
View file @
fd9ae729
import
Foundation
import
XCTestDynamicOverlay
public
struct
FetchBannedList
{
public
enum
Error
:
Swift
.
Error
,
Equatable
{
case
network
(
URLError
)
case
invalidResponse
}
public
typealias
Completion
=
(
Result
<
Data
,
Error
>
)
->
Void
public
var
run
:
(
@escaping
Completion
)
->
Void
public
func
callAsFunction
(
completion
:
@escaping
Completion
)
{
run
(
completion
)
}
}
extension
FetchBannedList
{
public
static
let
live
=
FetchBannedList
{
completion
in
let
url
=
URL
(
string
:
"https://elixxir-bins.s3.us-west-1.amazonaws.com/client/bannedUsers/bannedTesting.csv"
)
!
let
session
=
URLSession
.
shared
let
task
=
session
.
dataTask
(
with
:
url
)
{
data
,
response
,
error
in
if
let
error
=
error
{
completion
(
.
failure
(
.
network
(
error
as!
URLError
)))
return
}
guard
let
response
=
response
as?
HTTPURLResponse
,
(
200
..<
300
)
.
contains
(
response
.
statusCode
),
let
data
=
data
else
{
completion
(
.
failure
(
.
invalidResponse
))
return
}
completion
(
.
success
(
data
))
}
task
.
resume
()
}
}
extension
FetchBannedList
{
public
static
let
unimplemented
=
FetchBannedList
(
run
:
XCTUnimplemented
(
"
\(
Self
.
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