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
cf51ed3a
Commit
cf51ed3a
authored
4 years ago
by
Aylin
Browse files
Options
Downloads
Patches
Plain Diff
file previews work again!
parent
0fbcbef2
Branches
Branches containing commit
No related tags found
1 merge request
!83
Resolve "Integrate attachment functionality in new ComposeView"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
enzevalos_iphone/SwiftUI/Compose/AddAttachmentsModel.swift
+15
-0
15 additions, 0 deletions
enzevalos_iphone/SwiftUI/Compose/AddAttachmentsModel.swift
enzevalos_iphone/SwiftUI/Compose/AddAttachmentsView.swift
+4
-0
4 additions, 0 deletions
enzevalos_iphone/SwiftUI/Compose/AddAttachmentsView.swift
with
19 additions
and
0 deletions
enzevalos_iphone/SwiftUI/Compose/AddAttachmentsModel.swift
+
15
−
0
View file @
cf51ed3a
...
...
@@ -22,6 +22,21 @@ struct Attachment: DisplayAttachment, Equatable {
myID
=
UUID
()
}
/// download calling attachment into the documents diectory
func
download
(){
func
getDocumentsDirectory
()
->
URL
{
let
paths
=
FileManager
.
default
.
urls
(
for
:
.
documentDirectory
,
in
:
.
userDomainMask
)
return
paths
[
0
]
}
let
filename
=
getDocumentsDirectory
()
.
appendingPathComponent
(
self
.
myName
)
do
{
try
self
.
myData
.
write
(
to
:
filename
)
}
catch
let
error
as
NSError
{
print
(
"Error:
\(
error
)
"
)
}
}
/// a func that returns the size of the calling attachment file as a string
func
countData
()
->
String
{
// size in byte
...
...
This diff is collapsed.
Click to expand it.
enzevalos_iphone/SwiftUI/Compose/AddAttachmentsView.swift
+
4
−
0
View file @
cf51ed3a
...
...
@@ -113,6 +113,10 @@ struct AddAttachmentsView: View {
// create Attachment and add in to the attachments list
let
newAttachment
=
Attachment
(
fileName
:
fileName
,
fileData
:
fileData
)
model
.
attachments
.
append
(
newAttachment
)
// download the file into the documents directory
// this is necessary, because the QuickLookView later uses that data
// to create a preview
newAttachment
.
download
()
}
catch
{
// Error while loading file
print
(
"Error while importing file."
)
...
...
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