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
1ab5963f
Commit
1ab5963f
authored
2 years ago
by
Dariusz Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
Add MakeReportDrawer functor
parent
28b07dfd
No related branches found
Branches containing commit
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
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Package.swift
+2
-0
2 additions, 0 deletions
Package.swift
Sources/ReportingFeature/MakeReportDrawer.swift
+86
-0
86 additions, 0 deletions
Sources/ReportingFeature/MakeReportDrawer.swift
with
88 additions
and
0 deletions
Package.swift
+
2
−
0
View file @
1ab5963f
...
...
@@ -749,6 +749,8 @@ let package = Package(
.
target
(
name
:
"ReportingFeature"
,
dependencies
:
[
.
target
(
name
:
"DrawerFeature"
),
.
target
(
name
:
"Shared"
),
.
product
(
name
:
"SwiftCSV"
,
package
:
"SwiftCSV"
),
.
product
(
name
:
"XCTestDynamicOverlay"
,
package
:
"xctest-dynamic-overlay"
),
],
...
...
This diff is collapsed.
Click to expand it.
Sources/ReportingFeature/MakeReportDrawer.swift
0 → 100644
+
86
−
0
View file @
1ab5963f
import
DrawerFeature
import
Shared
import
UIKit
import
XCTestDynamicOverlay
public
struct
MakeReportDrawer
{
public
struct
Config
{
public
init
(
onReport
:
@escaping
()
->
Void
=
{},
onCancel
:
@escaping
()
->
Void
=
{}
)
{
self
.
onReport
=
onReport
self
.
onCancel
=
onCancel
}
public
var
onReport
:
()
->
Void
public
var
onCancel
:
()
->
Void
}
public
var
run
:
(
Config
)
->
UIViewController
public
func
callAsFunction
(
_
config
:
Config
)
->
UIViewController
{
run
(
config
)
}
}
extension
MakeReportDrawer
{
public
static
let
live
=
MakeReportDrawer
{
config
in
let
cancelButton
=
CapsuleButton
()
cancelButton
.
setStyle
(
.
seeThrough
)
cancelButton
.
setTitle
(
Localized
.
Chat
.
Report
.
cancel
,
for
:
.
normal
)
let
reportButton
=
CapsuleButton
()
reportButton
.
setStyle
(
.
red
)
reportButton
.
setTitle
(
Localized
.
Chat
.
Report
.
action
,
for
:
.
normal
)
let
drawer
=
DrawerController
(
with
:
[
DrawerImage
(
image
:
Asset
.
drawerNegative
.
image
),
DrawerText
(
font
:
Fonts
.
Mulish
.
semiBold
.
font
(
size
:
18.0
),
text
:
Localized
.
Chat
.
Report
.
title
,
color
:
Asset
.
neutralActive
.
color
),
DrawerText
(
font
:
Fonts
.
Mulish
.
semiBold
.
font
(
size
:
14.0
),
text
:
Localized
.
Chat
.
Report
.
subtitle
,
color
:
Asset
.
neutralWeak
.
color
,
lineHeightMultiple
:
1.35
,
spacingAfter
:
25
),
DrawerStack
(
axis
:
.
vertical
,
spacing
:
20.0
,
views
:
[
reportButton
,
cancelButton
]
)
])
reportButton
.
publisher
(
for
:
.
touchUpInside
)
.
receive
(
on
:
DispatchQueue
.
main
)
.
sink
{
[
unowned
drawer
]
in
drawer
.
dismiss
(
animated
:
true
)
{
config
.
onReport
()
}
}
.
store
(
in
:
&
drawer
.
cancellables
)
cancelButton
.
publisher
(
for
:
.
touchUpInside
)
.
receive
(
on
:
DispatchQueue
.
main
)
.
sink
{
[
unowned
drawer
]
in
drawer
.
dismiss
(
animated
:
true
)
{
config
.
onCancel
()
}
}
.
store
(
in
:
&
drawer
.
cancellables
)
return
drawer
}
}
extension
MakeReportDrawer
{
public
static
let
unimplemented
=
MakeReportDrawer
(
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