Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
memri
iOS client for Memri
Commits
8490b893
Commit
8490b893
authored
Aug 12, 2021
by
Amirjanyan
Browse files
Merge branch 'full-screen' into 'main'
#24
Photo | Full screen See merge request
!47
parents
b2d8f55d
af720653
Pipeline
#3392
failed with stage
in 19 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
MemriApp/Controllers/SceneController.swift
View file @
8490b893
...
...
@@ -12,6 +12,8 @@ import GRDB
/// The scene controller is specific to a particular `window` of the app. On the iPhone there is usually only one. There may be multiple eg. if multitasking on iPad or multiple windows on mac
class
SceneController
:
ObservableObject
{
@Published
var
isFullScreen
:
Bool
=
false
let
appController
:
AppController
=
.
shared
private(set)
var
topMostContext
:
ViewContextController
?
let
navigationController
=
MemriUINavigationController
()
...
...
MemriApp/UI/Chrome/TopBarView.swift
View file @
8490b893
...
...
@@ -14,64 +14,68 @@ struct TopBarView: View {
@ViewBuilder
var
body
:
some
View
{
VStack
(
spacing
:
0
)
{
HStack
(
spacing
:
4
)
{
HStack
{
Button
(
action
:
{
withAnimation
{
sceneController
.
navigationIsVisible
.
toggle
()
}
})
{
Image
(
systemName
:
"line.horizontal.3"
)
.
rotationEffect
(
sceneController
.
navigationIsVisible
?
Angle
(
degrees
:
90
)
:
.
zero
)
.
padding
(
10
)
.
contentShape
(
Rectangle
())
}
if
sceneController
.
canNavigateBack
{
if
sceneController
.
isFullScreen
{
EmptyView
()
}
else
{
VStack
(
spacing
:
0
)
{
HStack
(
spacing
:
4
)
{
HStack
{
Button
(
action
:
{
sceneController
.
isInEditMode
=
false
sceneController
.
navigateBack
()
withAnimation
{
sceneController
.
navigationIsVisible
.
toggle
()
}
})
{
Image
(
systemName
:
"
chevron.backward.circle.fill
"
)
Image
(
systemName
:
"
line.horizontal.3
"
)
.
rotationEffect
(
sceneController
.
navigationIsVisible
?
Angle
(
degrees
:
90
)
:
.
zero
)
.
padding
(
10
)
.
contentShape
(
Rectangle
())
}
if
sceneController
.
canNavigateBack
{
Button
(
action
:
{
sceneController
.
isInEditMode
=
false
sceneController
.
navigateBack
()
})
{
Image
(
systemName
:
"chevron.backward.circle.fill"
)
.
rotationEffect
(
sceneController
.
navigationIsVisible
?
Angle
(
degrees
:
90
)
:
.
zero
)
.
padding
(
10
)
.
contentShape
(
Rectangle
())
}
}
}
}
.
frame
(
minWidth
:
100
,
alignment
:
.
leading
)
if
let
context
=
sceneController
.
topMostContext
,
let
title
=
context
.
viewDefinitionPropertyResolver
.
string
(
"title"
)
??
(
context
.
focusedItem
!=
nil
?
context
.
itemPropertyResolver
?
.
string
(
"title"
)
:
""
)
{
Text
(
title
)
.
font
(
.
headline
)
.
frame
(
maxWidth
:
.
infinity
)
}
else
{
Spacer
()
}
HStack
{
.
frame
(
minWidth
:
100
,
alignment
:
.
leading
)
if
let
context
=
sceneController
.
topMostContext
,
let
editAction
=
sceneController
.
topMostContext
?
.
viewDefinitionPropertyResolver
.
stringArray
(
"editActionButton"
)
.
first
,
showEditButton
{
if
let
action
=
cvuAction
(
named
:
editAction
)
{
ActionButton
(
action
:
action
.
init
(
vars
:
[
"icon"
:
.
constant
(
.
string
(
"pencil"
))]),
context
:
context
.
getCVUContext
())
}
let
title
=
context
.
viewDefinitionPropertyResolver
.
string
(
"title"
)
??
(
context
.
focusedItem
!=
nil
?
context
.
itemPropertyResolver
?
.
string
(
"title"
)
:
""
)
{
Text
(
title
)
.
font
(
.
headline
)
.
frame
(
maxWidth
:
.
infinity
)
}
else
{
Spacer
()
}
HStack
{
if
let
context
=
sceneController
.
topMostContext
,
let
editAction
=
sceneController
.
topMostContext
?
.
viewDefinitionPropertyResolver
.
stringArray
(
"editActionButton"
)
.
first
,
showEditButton
{
if
let
action
=
cvuAction
(
named
:
editAction
)
{
ActionButton
(
action
:
action
.
init
(
vars
:
[
"icon"
:
.
constant
(
.
string
(
"pencil"
))]),
context
:
context
.
getCVUContext
())
}
}
if
let
context
=
sceneController
.
topMostContext
,
let
actions
=
context
.
viewDefinitionPropertyResolver
.
actions
(
key
:
"actionButton"
)
{
ForEach
(
actions
,
id
:
\
.
id
)
{
action
in
ActionButton
(
action
:
action
,
context
:
context
.
getCVUContext
())
if
let
context
=
sceneController
.
topMostContext
,
let
actions
=
context
.
viewDefinitionPropertyResolver
.
actions
(
key
:
"actionButton"
)
{
ForEach
(
actions
,
id
:
\
.
id
)
{
action
in
ActionButton
(
action
:
action
,
context
:
context
.
getCVUContext
())
}
}
}
}
.
frame
(
minWidth
:
100
,
alignment
:
.
trailing
)
}
.
padding
(
.
horizontal
,
10
)
.
font
(
Font
.
system
(
size
:
20
,
weight
:
.
medium
)
)
.
frame
(
minHeight
:
48
)
.
background
(
Color
(
.
secondarySystemBackground
)
.
edgesIgnoringSafeArea
(
.
top
))
Divider
()
.
frame
(
minWidth
:
100
,
alignment
:
.
trailing
)
}
.
padding
(
.
horizontal
,
10
)
.
font
(
Font
.
system
(
size
:
20
,
weight
:
.
medium
)
)
.
frame
(
minHeight
:
48
)
.
background
(
Color
(
.
secondarySystemBackground
)
.
edgesIgnoringSafeArea
(
.
top
)
)
Divider
()
}
}
}
}
MemriApp/UI/Renderers/FileRenderer.swift
View file @
8490b893
...
...
@@ -11,6 +11,7 @@ import SwiftUI
/// Optionally the CVU for ItemType > FileViewer {...} can define an `itemTitle` expression
struct
FileRendererView
:
View
{
@ObservedObject
var
viewContext
:
ViewContextController
@EnvironmentObject
var
sceneController
:
SceneController
var
files
:
[
FileViewerItem
]
{
viewContext
.
items
.
compactMap
{
item
->
FileViewerItem
?
in
...
...
@@ -28,6 +29,7 @@ struct FileRendererView: View {
viewContext
?
.
isFullScreen
??
false
},
set
:
{
[
weak
viewContext
]
in
viewContext
?
.
isFullScreen
=
$0
sceneController
.
isFullScreen
=
$0
}
)
}
...
...
MemriApp/UI/Renderers/PhotoViewerRenderer.swift
View file @
8490b893
...
...
@@ -10,7 +10,7 @@ import SwiftUI
/// The CVU for ItemType > map {...} must define a `file` expression pointing to a `File` item
struct
PhotoViewerRendererView
:
View
{
@ObservedObject
var
viewContext
:
ViewContextController
@EnvironmentObject
var
sceneController
:
SceneController
func
photoItemProvider
(
forIndex
index
:
Int
)
->
PhotoViewerController
.
PhotoItem
?
{
guard
let
item
=
viewContext
.
items
[
safe
:
index
],
...
...
@@ -34,7 +34,10 @@ struct PhotoViewerRendererView: View {
var
isFullScreen
:
Bool
{
get
{
viewContext
.
isFullScreen
}
nonmutating
set
{
viewContext
.
isFullScreen
=
newValue
}
nonmutating
set
{
viewContext
.
isFullScreen
=
newValue
sceneController
.
isFullScreen
=
newValue
}
}
var
body
:
some
View
{
...
...
MemriApp/UI/SceneContentView.swift
View file @
8490b893
...
...
@@ -51,10 +51,16 @@ struct SceneContentView: View {
}
var
showContextualBottomBar
:
Bool
{
if
sceneController
.
isFullScreen
{
return
false
}
return
context
.
viewDefinitionPropertyResolver
.
bool
(
"showContextualBottomBar"
)
??
true
}
var
showBottomBar
:
Bool
{
if
sceneController
.
isFullScreen
{
return
false
}
return
context
.
viewDefinitionPropertyResolver
.
bool
(
"showBottomBar"
)
??
true
}
...
...
MemriApp/UI/SceneView.swift
View file @
8490b893
...
...
@@ -63,6 +63,7 @@ struct SceneView: View {
}
}
.
statusBar
(
hidden
:
sceneController
.
isFullScreen
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment