Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
enzevalos_iphone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
enzevalos
enzevalos_iphone
Commits
e2332adb
Commit
e2332adb
authored
4 years ago
by
Aylin
Browse files
Options
Downloads
Patches
Plain Diff
Finished?
parent
8f01b38a
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!79
Resolve "Add comments to: AttachmentViewMain.swift"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
enzevalos_iphone/SwiftUI/Read/Tabbed Views/AttachmentsViewMain.swift
+20
-9
20 additions, 9 deletions
...phone/SwiftUI/Read/Tabbed Views/AttachmentsViewMain.swift
with
20 additions
and
9 deletions
enzevalos_iphone/SwiftUI/Read/Tabbed Views/AttachmentsViewMain.swift
+
20
−
9
View file @
e2332adb
...
@@ -93,8 +93,10 @@ struct AttPrev:View{
...
@@ -93,8 +93,10 @@ struct AttPrev:View{
// by default false
// by default false
var
shouldBeDownloaded
=
false
var
shouldBeDownloaded
=
false
// whether this attachment is downloaded to the documents directory
// whether this attachment is
already
downloaded to the documents directory
@State
var
isDownloaded
:
Bool
=
false
@State
var
isDownloaded
:
Bool
=
false
// used togehter with 'open' button to
// open a fullScreenView of a file
@State
var
isFullScreen
:
Bool
=
false
@State
var
isFullScreen
:
Bool
=
false
/// a func to find the documents directory
/// a func to find the documents directory
...
@@ -124,16 +126,23 @@ struct AttPrev:View{
...
@@ -124,16 +126,23 @@ struct AttPrev:View{
}
}
var
body
:
some
View
{
var
body
:
some
View
{
if
shouldBeDownloaded
{
self
.
download
()}
if
shouldBeDownloaded
{
self
.
download
()
}
//this QuickLookView has to be defined here so it reloads on every state-change
// QuickLookView creates the preview of the file
// it has to be defined here to update correctly
let
QLV
=
QuickLookView
(
name
:
self
.
attachment
.
myName
,
data
:
self
.
attachment
.
myData
,
shallDL
:
self
.
isDownloaded
)
let
QLV
=
QuickLookView
(
name
:
self
.
attachment
.
myName
,
data
:
self
.
attachment
.
myData
,
shallDL
:
self
.
isDownloaded
)
return
VStack
{
return
VStack
{
Group
{
Group
{
CardV
(
title
:
self
.
attachment
.
myName
,
CardV
(
title
:
self
.
attachment
.
myName
,
//these buttons are visable under the clicked preview
//these buttons are visable under the preview
// when users click on the preview
actions
:
self
.
isDownloaded
||
self
.
shouldBeDownloaded
?
actions
:
self
.
isDownloaded
||
self
.
shouldBeDownloaded
?
// different combination of buttons
// according to downloading status
[
[
// anyViewDeleteButton
// anyViewDeleteButton
anyViewOpenButton
,
anyViewOpenButton
,
...
@@ -147,19 +156,20 @@ struct AttPrev:View{
...
@@ -147,19 +156,20 @@ struct AttPrev:View{
AnyView
(
EmptyView
()),
AnyView
(
EmptyView
()),
AnyView
(
EmptyView
())
AnyView
(
EmptyView
())
]
]
){
){
QLV
/*TODO:
QLV
/*TODO:
.allowsHitTesting(false).disabled(true)*/
//this should make the whole view scrollable averywhere not just on the title
.allowsHitTesting(false).disabled(true)*/
//this should make the whole view scrollable averywhere not just on the title
}
}
}
}
// preview resemble the look of A4 format
// preview
should
resemble the look of A4 format
.
aspectRatio
(
100
/
141
,
contentMode
:
.
fit
)
.
aspectRatio
(
100
/
141
,
contentMode
:
.
fit
)
.
frame
(
width
:
UIScreen
.
main
.
bounds
.
width
*
2
/3)//
,
maxHeight
:
500
)
.
frame
(
width
:
UIScreen
.
main
.
bounds
.
width
*
2
/3)//
,
maxHeight
:
500
)
//an invisable NavigationLink to open the preview in fullscreen
//a hidden NavigationLink to open the preview in fullscreen
NavigationLink
(
destination
:
QuickLookView
(
name
:
self
.
attachment
.
myName
,
data
:
self
.
attachment
.
myData
)
// seems not to work currently
.
navigationBarItems
(
trailing
:
shareButton
),
isActive
:
self
.
$isFullScreen
){
Text
(
"loi"
)}
.
hidden
()
NavigationLink
(
destination
:
QuickLookView
(
name
:
self
.
attachment
.
myName
,
data
:
self
.
attachment
.
myData
)
.
navigationBarItems
(
trailing
:
shareButton
),
isActive
:
self
.
$isFullScreen
){
Text
(
"loi"
)}
.
hidden
()
}
}
.
onAppear
(
perform
:
{
.
onAppear
(
perform
:
{
...
@@ -168,6 +178,7 @@ struct AttPrev:View{
...
@@ -168,6 +178,7 @@ struct AttPrev:View{
//download all functionality
//download all functionality
if
self
.
shouldBeDownloaded
{
self
.
isDownloaded
=
true
;
self
.
download
()}
if
self
.
shouldBeDownloaded
{
self
.
isDownloaded
=
true
;
self
.
download
()}
})
})
// remove file from documents directory
.
onDisappear
(
perform
:
{
.
onDisappear
(
perform
:
{
let
filename
=
getDocumentsDirectory
()
.
appendingPathComponent
(
self
.
attachment
.
myName
)
let
filename
=
getDocumentsDirectory
()
.
appendingPathComponent
(
self
.
attachment
.
myName
)
...
...
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