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
86fa1b84
Commit
86fa1b84
authored
2 years ago
by
Dariusz Rybicki
Browse files
Options
Downloads
Patches
Plain Diff
Use MakeAppScreenshot in SingleChatController
parent
157b033e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
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
+1
-0
1 addition, 0 deletions
Package.swift
Sources/ChatFeature/Controllers/SingleChatController.swift
+12
-37
12 additions, 37 deletions
Sources/ChatFeature/Controllers/SingleChatController.swift
with
13 additions
and
37 deletions
Package.swift
+
1
−
0
View file @
86fa1b84
...
...
@@ -464,6 +464,7 @@ let package = Package(
.
target
(
name
:
"Presentation"
),
.
target
(
name
:
"DrawerFeature"
),
.
target
(
name
:
"ChatInputFeature"
),
.
target
(
name
:
"ReportingFeature"
),
.
target
(
name
:
"DependencyInjection"
),
.
product
(
name
:
"ChatLayout"
,
package
:
"ChatLayout"
),
.
product
(
name
:
"DifferenceKit"
,
package
:
"DifferenceKit"
),
...
...
This diff is collapsed.
Click to expand it.
Sources/ChatFeature/Controllers/SingleChatController.swift
+
12
−
37
View file @
86fa1b84
...
...
@@ -12,6 +12,7 @@ import ChatLayout
import
DrawerFeature
import
DifferenceKit
import
ChatInputFeature
import
ReportingFeature
import
DependencyInjection
import
ScrollViewController
...
...
@@ -28,6 +29,7 @@ public final class SingleChatController: UIViewController {
@Dependency
private
var
logger
:
XXLogger
@Dependency
private
var
voxophone
:
Voxophone
@Dependency
private
var
coordinator
:
ChatCoordinating
@Dependency
private
var
makeAppScreenshot
:
MakeAppScreenshot
@Dependency
private
var
statusBarController
:
StatusBarStyleControlling
lazy
private
var
infoView
=
UIControl
()
...
...
@@ -430,7 +432,7 @@ public final class SingleChatController: UIViewController {
drawer
.
dismiss
(
animated
:
true
)
{
[
weak
self
]
in
guard
let
self
=
self
else
{
return
}
self
.
drawerCancellables
.
removeAll
()
self
.
viewModel
.
proceeedWithReport
(
screenshot
:
self
.
t
akeAppScreenshot
())
{
self
.
viewModel
.
proceeedWithReport
(
screenshot
:
try!
self
.
m
akeAppScreenshot
())
{
self
.
navigationController
?
.
popViewController
(
animated
:
true
)
}
}
...
...
@@ -447,26 +449,6 @@ public final class SingleChatController: UIViewController {
coordinator
.
toDrawer
(
drawer
,
from
:
self
)
}
func
takeAppScreenshot
()
->
UIImage
{
guard
let
foregroundWindowScene
=
foregroundWindowScene
else
{
fatalError
(
"[takeAppScreenshot]: Unable to get foreground window scene"
)
}
let
keyWindow
=
getKeyWindow
(
foregroundWindowScene
)
let
rendererFormat
=
UIGraphicsImageRendererFormat
()
rendererFormat
.
scale
=
foregroundWindowScene
.
screen
.
scale
let
renderer
=
UIGraphicsImageRenderer
(
bounds
:
keyWindow
.
bounds
,
format
:
rendererFormat
)
return
renderer
.
image
{
ctx
in
keyWindow
.
layer
.
render
(
in
:
ctx
.
cgContext
)
}
}
private
func
presentDeleteAllDrawer
()
{
let
clearButton
=
CapsuleButton
()
clearButton
.
setStyle
(
.
red
)
...
...
@@ -596,11 +578,17 @@ extension SingleChatController: KeyboardListenerDelegate {
}
func
keyboardWillChangeFrame
(
info
:
KeyboardInfo
)
{
guard
let
scene
=
foregroundWindowScene
else
{
fatalError
(
"[keyboardWillChangeFrame]: Couldn't get foregroundWindowScene"
)
let
keyWindow
:
UIWindow
?
=
UIApplication
.
shared
.
connectedScenes
.
filter
{
$0
.
activationState
==
.
foregroundActive
}
.
compactMap
{
$0
as?
UIWindowScene
}
.
first
?
.
windows
.
first
(
where
:
\
.
isKeyWindow
)
guard
let
keyWindow
=
keyWindow
else
{
fatalError
(
"[keyboardWillChangeFrame]: Couldn't get key window"
)
}
let
keyWindow
=
getKeyWindow
(
scene
)
let
keyboardFrame
=
keyWindow
.
convert
(
info
.
frameEnd
,
to
:
view
)
guard
!
currentInterfaceActions
.
options
.
contains
(
.
changingFrameSize
),
...
...
@@ -764,16 +752,3 @@ extension SingleChatController: QLPreviewControllerDelegate {
fileURL
=
nil
}
}
let
foregroundWindowScene
:
UIWindowScene
?
=
UIApplication
.
shared
.
connectedScenes
.
filter
{
$0
.
activationState
==
.
foregroundActive
}
.
compactMap
{
$0
as?
UIWindowScene
}
.
first
func
getKeyWindow
(
_
scene
:
UIWindowScene
)
->
UIWindow
{
guard
let
keyWindow
=
scene
.
windows
.
first
(
where
:
\
.
isKeyWindow
)
else
{
fatalError
(
"Unable to get key window"
)
}
return
keyWindow
}
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