Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
184 commits
Select commit Hold shift + click to select a range
e2fdccd
Implement p2p main view
dhekra-rouatbi Feb 3, 2025
329a35b
Add Wifi connection Screen and permessions
Rimktarii Feb 5, 2025
f6723b2
Update WifiConnectionView
Rimktarii Feb 5, 2025
85d73f0
Add RegularTextView and Create ConnectToDeviceView Screen
Rimktarii Feb 5, 2025
f58bd4c
Create ConnectToDeviceView
Rimktarii Feb 5, 2025
300808a
Create ConnectToDeviceManuallyView
Rimktarii Feb 6, 2025
bf8e496
Add Nearby Sharing to connections
Rimktarii Feb 6, 2025
0d96043
Create secondary Tella button type
Rimktarii Feb 7, 2025
03e71ac
Rename Classes
Rimktarii Feb 7, 2025
af2532e
Update Views names and Add New Sender classes
Rimktarii Feb 10, 2025
ed30885
Add RecipientConnectToDeviceManuallyView
Rimktarii Feb 10, 2025
ff0e204
Fix PeerToPeer design and update the destination
Rimktarii Feb 11, 2025
696c024
Handle navigation
Rimktarii Feb 11, 2025
7ced0bd
Add waiting screen and adapt TellaButtonView
Rimktarii Feb 14, 2025
898c431
Create RecipientFilesRequestView screen
Rimktarii Feb 14, 2025
e6d2d68
Implement QRCodeScanner and QRCodeGenerator
dhekra-rouatbi Feb 14, 2025
947c52d
Validate fields in SenderConnectToDeviceManuallyView
Rimktarii Feb 25, 2025
0c72b28
Delete Tella/Components/WifiConnexionView.swift
Rimktarii Feb 25, 2025
695d815
Fix TellaButtonView height
Rimktarii Feb 25, 2025
52f5654
Create a generic AddFileView ( AddFileBottomSheetView and AddFileGrid…
Rimktarii Feb 26, 2025
9893903
Refactor Add Files in draftviews
Rimktarii Feb 27, 2025
18bad86
Fix add file in uwazi (Refacor)
Rimktarii Feb 28, 2025
38d91d4
Generate QR code with device ip address and sha256 of generated certi…
dhekra-rouatbi Mar 11, 2025
2738a76
Implement Register API
dhekra-rouatbi Apr 1, 2025
8886fce
Implement Connection failed, Handle server errors, update p2p main vi…
dhekra-rouatbi Apr 3, 2025
967825a
Update strings, organise files and update design
dhekra-rouatbi Apr 3, 2025
47a6e54
Improve code and start working on prepare upload API
dhekra-rouatbi Apr 7, 2025
623fc5e
Update Prepare upload models
dhekra-rouatbi Apr 7, 2025
d7cc8b6
Working on Prepare upload
dhekra-rouatbi Apr 8, 2025
3405aee
Fix register API issue
dhekra-rouatbi Apr 8, 2025
d036517
Fix register API issue
dhekra-rouatbi Apr 9, 2025
912d30b
Fix crash
dhekra-rouatbi Apr 10, 2025
aebac5e
Fix certificate
dhekra-rouatbi Apr 10, 2025
6500e5c
Working on certificate
dhekra-rouatbi Apr 10, 2025
3879f42
Fix server response
dhekra-rouatbi Apr 11, 2025
bb0b29e
Fix server response
dhekra-rouatbi Apr 11, 2025
25fd9dc
Fix server response
dhekra-rouatbi Apr 14, 2025
f8fa161
Refactor certificate generator
dhekra-rouatbi Apr 14, 2025
22ea67b
Code improvement
dhekra-rouatbi Apr 15, 2025
4fcec25
Code improvement
dhekra-rouatbi Apr 15, 2025
dbe53d6
Update Algorithm to RSA
dhekra-rouatbi Apr 15, 2025
9c35f11
Code improvement
dhekra-rouatbi Apr 15, 2025
48b41c7
Implement manually connection
dhekra-rouatbi Apr 17, 2025
b07c50e
Integrate typography styles into P2P views
dhekra-rouatbi Apr 23, 2025
54a6d60
Integrate typography styles into P2P views
dhekra-rouatbi Apr 23, 2025
f5ec596
Integrate typography styles into P2P views and Code improvement
dhekra-rouatbi Apr 23, 2025
6b192a3
Update hash format
dhekra-rouatbi Apr 23, 2025
999c976
Update QRCode size and Fix arrows orientation in Tips to connect view
dhekra-rouatbi Apr 24, 2025
c68ccb2
Fix conflict
dhekra-rouatbi Apr 30, 2025
2a52f2d
Update connect manually scenario
dhekra-rouatbi May 13, 2025
9b417cc
Implement prepare upload: API, server response and UI
dhekra-rouatbi May 16, 2025
f00aa42
Improve code
dhekra-rouatbi May 16, 2025
62ee776
Improve code
dhekra-rouatbi May 16, 2025
e12fff4
Handle errors in prepare upload
dhekra-rouatbi May 19, 2025
dcf1402
Update forbidden error message
dhekra-rouatbi May 19, 2025
17057aa
Refactor the P2P server class and handle the sender's discard respons…
dhekra-rouatbi May 19, 2025
302aecc
Handle discard and start over action
dhekra-rouatbi May 20, 2025
3e6ec47
Handle close connection API and generate server response
dhekra-rouatbi May 20, 2025
81c3123
Handle back button actions
dhekra-rouatbi May 21, 2025
1e01e02
Refactor PeertoPeerServer
dhekra-rouatbi May 22, 2025
62fcde6
Update the manual connection process
dhekra-rouatbi May 30, 2025
b589548
remove unused code
dhekra-rouatbi Jun 2, 2025
ef80d73
Update PeerToPeerRepository class name
dhekra-rouatbi Jun 2, 2025
213bdae
Refactor HTTP request parsing on the server to use the llhttp library
dhekra-rouatbi Jun 3, 2025
a6b6bbf
Refactor HTTP Response Builder
dhekra-rouatbi Jun 3, 2025
eda5a00
Add AnyView to some View
dhekra-rouatbi Jun 4, 2025
97ed7f0
Working on p2p
dhekra-rouatbi Jun 4, 2025
cac3410
Add ping endpoint
dhekra-rouatbi Jun 9, 2025
9d9ec5c
Add constants
dhekra-rouatbi Jun 9, 2025
5562c12
delete unnecessary debugs
dhekra-rouatbi Jun 9, 2025
8f3d749
unwrap the clientIdentity with a guard statement
dhekra-rouatbi Jun 9, 2025
0bb2075
Throw an error if there is an error on parsing: llhttp_execute
dhekra-rouatbi Jun 9, 2025
f4c4c02
Working on upload files and manual connection
dhekra-rouatbi Jun 23, 2025
70563fd
Update certificate hash text alignment
dhekra-rouatbi Jun 23, 2025
482c216
Refactor the server parameters into distinct classes
dhekra-rouatbi Jun 25, 2025
efe0f34
WIP on handle File Upload
dhekra-rouatbi Jun 26, 2025
7877802
handle File Upload : Working on the parser
dhekra-rouatbi Jun 27, 2025
d214b63
Delete unused code
dhekra-rouatbi Jun 30, 2025
45b031c
handle File Upload : Working on the parser
dhekra-rouatbi Jun 30, 2025
c0d2eaf
Update hash
dhekra-rouatbi Jun 30, 2025
f19a1c1
generate hash of the entire certificate instead of hashing only the p…
ValbuenaG Jun 30, 2025
891c062
Update hash
dhekra-rouatbi Jul 1, 2025
512c941
Working on receiving files and display the progress
dhekra-rouatbi Jul 9, 2025
43991e1
Improvement
dhekra-rouatbi Jul 9, 2025
a5a7063
Code improvement
dhekra-rouatbi Jul 9, 2025
b3501e2
Saving the received files
dhekra-rouatbi Jul 9, 2025
b4019dc
Progress flow and results view
dhekra-rouatbi Jul 16, 2025
44337de
Update design
dhekra-rouatbi Jul 16, 2025
32c9e6b
Remove back buttons
dhekra-rouatbi Jul 16, 2025
4f0744e
Update typography
dhekra-rouatbi Jul 16, 2025
4df7b9f
Fix styles
dhekra-rouatbi Jul 17, 2025
bb98851
Add missing title to sender progress view
dhekra-rouatbi Jul 17, 2025
5a59c4d
Fix back actions
dhekra-rouatbi Jul 17, 2025
98d4a56
Fix back actions
dhekra-rouatbi Jul 17, 2025
fdedce5
Update p2pLearnMore link
dhekra-rouatbi Jul 17, 2025
3ba43ba
Update parser
dhekra-rouatbi Jul 17, 2025
adc1286
Fix parser
dhekra-rouatbi Jul 17, 2025
5369d6d
Stop the server listener after finishing transfer
dhekra-rouatbi Jul 21, 2025
94e40bf
Centralise the server instance and improve code
dhekra-rouatbi Jul 23, 2025
7dbf325
update listener?.cancel() with stopListening
dhekra-rouatbi Jul 23, 2025
8292979
clean code
dhekra-rouatbi Jul 23, 2025
d0b12d9
Add status icon and server initialisation
dhekra-rouatbi Jul 24, 2025
50e0651
Improve code
dhekra-rouatbi Jul 24, 2025
b0f138e
Move PeerToPeerEvent to another class
dhekra-rouatbi Jul 25, 2025
01ad56a
Show the QRCode only if the server started
dhekra-rouatbi Jul 25, 2025
17e1a14
Improve code
dhekra-rouatbi Jul 25, 2025
b13c627
Improve code
dhekra-rouatbi Jul 25, 2025
288495d
WIP cancel receiving files
dhekra-rouatbi Jul 26, 2025
da7e555
Add scroll to Sender prepare file transfer view
dhekra-rouatbi Jul 27, 2025
58bd433
Fix fields validation
dhekra-rouatbi Jul 27, 2025
2a671bb
Fix closeConnection issue
dhekra-rouatbi Jul 28, 2025
e66091b
Improve NetworkManager
dhekra-rouatbi Jul 29, 2025
23a7c3d
Improvements
dhekra-rouatbi Jul 29, 2025
f1d9ddc
Improve NetworkManager
dhekra-rouatbi Jul 29, 2025
2e32798
Add connections queue
dhekra-rouatbi Jul 29, 2025
752ea96
update the completion with async/await
dhekra-rouatbi Jul 29, 2025
77eb4cc
Revert "update the completion with async/await"
dhekra-rouatbi Jul 29, 2025
e353f45
Revert "Add connections queue"
dhekra-rouatbi Jul 29, 2025
8659661
Update p2p learn more link
dhekra-rouatbi Jul 30, 2025
1462c58
Fix the QRCode initialisation
dhekra-rouatbi Jul 30, 2025
f2004c9
update the completion with async/await
dhekra-rouatbi Jul 30, 2025
f438b75
update the completion with async/await
dhekra-rouatbi Jul 30, 2025
875abd8
update the completion with async/await
dhekra-rouatbi Jul 31, 2025
e5ce3f5
Merge branch 'release/1.16.0(97)' into feature/p2p
dhekra-rouatbi Aug 1, 2025
7ec5a1e
Add the "Add button" to home view
dhekra-rouatbi Aug 1, 2025
bf33855
Update p2p settings design
dhekra-rouatbi Aug 1, 2025
2e9c9f6
Merge branch 'develop' into feature/p2p
dhekra-rouatbi Aug 5, 2025
699a6e7
Convert data to base64EncodedString in request body
dhekra-rouatbi Aug 5, 2025
dd56a8c
Connect manually: Remove shouldValidateOnChange: true
dhekra-rouatbi Aug 5, 2025
58b0995
Update design
dhekra-rouatbi Aug 5, 2025
fb6cbe5
Disable the check button when there is no connection
dhekra-rouatbi Aug 6, 2025
72c5fd3
Stop the server when the app enters the background
dhekra-rouatbi Aug 6, 2025
12b87f0
Fix the next iteration of scanning a Code
dhekra-rouatbi Aug 6, 2025
2f1710a
Fix cancel receiving action
dhekra-rouatbi Aug 6, 2025
06e7f8e
Update data encode
dhekra-rouatbi Aug 6, 2025
dbb57f2
Update prepare upload data encode
dhekra-rouatbi Aug 6, 2025
0a3e577
Update the file name if it exists in the database
dhekra-rouatbi Aug 6, 2025
a6723b9
Update previews
dhekra-rouatbi Aug 6, 2025
ac023c1
Implement view files
dhekra-rouatbi Aug 8, 2025
328bdc5
Replace peer to peer with nearby sharing
dhekra-rouatbi Aug 8, 2025
fad1849
Replace peer to peer with nearby sharing
dhekra-rouatbi Aug 8, 2025
7e0f512
Replace peer to peer with nearby sharing
dhekra-rouatbi Aug 8, 2025
642a2da
Update prepare upload data encode
dhekra-rouatbi Aug 8, 2025
42565d8
Revert "Update prepare upload data encode"
dhekra-rouatbi Aug 8, 2025
1767732
Hide add button in received files
dhekra-rouatbi Aug 8, 2025
8313238
Replace peer to peer with nearby sharing
dhekra-rouatbi Aug 8, 2025
eeef8b4
Release 3.0.0(99)
dhekra-rouatbi Aug 8, 2025
c1d5d8e
Move NearbySharingState into an actor to prevent concurrent access
dhekra-rouatbi Aug 13, 2025
9d254c8
Move NetworkManager into an actor to prevent concurrent access
dhekra-rouatbi Aug 14, 2025
d200661
Add connection Changed Toast
dhekra-rouatbi Aug 15, 2025
e7c8e1c
receive eventPublisher on main thread
dhekra-rouatbi Aug 15, 2025
46fe426
Fix file transfer
dhekra-rouatbi Aug 15, 2025
7eec88b
Fix file transfer
dhekra-rouatbi Aug 16, 2025
b8b7bac
Fix file transfer
dhekra-rouatbi Aug 16, 2025
42fe3f2
Fix file transfer
dhekra-rouatbi Aug 17, 2025
1ff66e7
Fix file transfer : Avoid duplicated files
dhekra-rouatbi Aug 17, 2025
e871023
Fix file transfer : Avoid duplicated files
dhekra-rouatbi Aug 17, 2025
bda5fb9
Fix file transfer
dhekra-rouatbi Aug 18, 2025
6ef16ea
update the run queue
dhekra-rouatbi Aug 19, 2025
37dde69
generate qrImage in the view model
dhekra-rouatbi Aug 19, 2025
a9b2b6d
Add observeNetworkChanges to sender view
dhekra-rouatbi Aug 19, 2025
5e8a5db
set preserve metadata to true
dhekra-rouatbi Aug 19, 2025
b94866e
Fix file transfer
dhekra-rouatbi Aug 19, 2025
02eeeb4
delete unused code
dhekra-rouatbi Aug 19, 2025
353552d
Remove the file extension adding in prepare upload
dhekra-rouatbi Aug 19, 2025
279592b
Refactor Receiving and encrypting files design
dhekra-rouatbi Aug 21, 2025
efe9818
Refactor Receiving and encrypting files design
dhekra-rouatbi Aug 21, 2025
ecb4226
Refactor Receiving and encrypting files design
dhekra-rouatbi Aug 21, 2025
9f690eb
Refactor Receiving and encrypting files design
dhekra-rouatbi Aug 21, 2025
5c1ee1f
Refactor Receiving and encrypting files design
dhekra-rouatbi Aug 21, 2025
9d018d9
Add other custom errors strings and refactor the code to support that
dhekra-rouatbi Aug 27, 2025
ad78116
Remove redundant code
dhekra-rouatbi Aug 28, 2025
a5dd67f
Add Transfer Already Completed error
dhekra-rouatbi Aug 28, 2025
8b65ff5
Remove the sha256 from NearbySharingFile
dhekra-rouatbi Aug 29, 2025
05feef7
Disable the listeners when the view disappear
dhekra-rouatbi Sep 3, 2025
f2b158d
Clear the Temp Directory when the app will terminate
dhekra-rouatbi Sep 3, 2025
85a1823
Fix: if Android cancel , you should not show "An error has occured" …
dhekra-rouatbi Sep 8, 2025
ed959f3
Update Wi-Fi screen design
dhekra-rouatbi Sep 9, 2025
efc89dd
Update Icon Text Button component
dhekra-rouatbi Sep 10, 2025
0fddee9
update TipsToConnectButton title
dhekra-rouatbi Sep 10, 2025
36c6ed9
Update verification screen
dhekra-rouatbi Sep 12, 2025
3f33824
Update observers
dhekra-rouatbi Sep 12, 2025
540dd04
Update version 104
dhekra-rouatbi Sep 12, 2025
fbca67a
Update verification screen
dhekra-rouatbi Sep 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
544 changes: 522 additions & 22 deletions Tella.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion Tella/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class AppDelegate: NSObject, UIApplicationDelegate {
var backgroundSessionCompletionHandler: (() -> Void)?
static private(set) var instance: AppDelegate! = nil
@Published var shouldHandleTimeout : Bool = false

@Published var appWillTerminate : Bool = false

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
AppDelegate.instance = self

Expand All @@ -24,6 +25,10 @@ class AppDelegate: NSObject, UIApplicationDelegate {
return true
}

func applicationWillTerminate(_ application: UIApplication) {
appWillTerminate = true
}

func application(
_ application: UIApplication,
handleEventsForBackgroundURLSession
Expand Down
26 changes: 18 additions & 8 deletions Tella/Application/TellaApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// TellaApp.swift
// Tella
//
//
//
// Copyright © 2021 HORIZONTAL.
// Licensed under MIT (https://github.com/Horizontal-org/Tella-iOS/blob/develop/LICENSE)
//
Expand All @@ -27,6 +27,10 @@ struct TellaApp: App {
if value {
self.saveData(lockApptype: .finishBackgroundTasks)
}
}.onReceive(appDelegate.$appWillTerminate) { willTerminate in
if willTerminate {
clearTmpDirectory()
}
}

}.onChange(of: scenePhase) { phase in
Expand All @@ -43,10 +47,9 @@ struct TellaApp: App {
}
}
}

func saveData(lockApptype:LockApptype) {



appViewState.homeViewModel.saveLockTimeoutStartDate()

UploadService.shared.cancelTasksIfNeeded()
Expand All @@ -57,10 +60,11 @@ struct TellaApp: App {
let hasFileOnBackground = lockApptype == .enterInBackground ? UploadService.shared.hasFilesToUploadOnBackground : false

if shouldResetApp && !hasFileOnBackground {
appViewState.homeViewModel.nearbySharingServer?.resetFullServerState()

appViewState.homeViewModel.shouldSaveCurrentData = true
DispatchQueue.main.asyncAfter(deadline: .now() + delayTimeInSecond, execute: {
appViewState.homeViewModel.vaultManager.clearTmpDirectory() // TO FIX for server doesn't allow upload in Background
clearTmpDirectory() // TO FIX for server doesn't allow upload in Background
appViewState.resetApp()
})
appViewState.homeViewModel.shouldSaveCurrentData = false
Expand All @@ -70,20 +74,26 @@ struct TellaApp: App {
let hasFileOnBackground = UploadService.shared.hasFilesToUploadOnBackground
let appEnterInBackground = appViewState.homeViewModel.appEnterInBackground
let shouldResetApp = appViewState.homeViewModel.shouldResetApp()

if shouldResetApp && appEnterInBackground && !hasFileOnBackground {
UIApplication.getTopViewController()?.dismiss(animated: false)


appViewState.homeViewModel.nearbySharingServer?.resetFullServerState()

DispatchQueue.main.async {
appViewState.shouldHidePresentedView = true
appViewState.resetApp()
appViewState.shouldHidePresentedView = false
}
appViewState.homeViewModel.vaultManager.clearTmpDirectory()
clearTmpDirectory()
}
appViewState.homeViewModel.appEnterInBackground = false
appViewState.homeViewModel.shouldShowSecurityScreen = false
}

func clearTmpDirectory() {
appViewState.homeViewModel.vaultManager.clearTmpDirectory()
}
}

enum LockApptype {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
//
// AddFileBottomSheetView.swift
// Tella
//
// Created by RIMA on 26.02.25.
// Copyright © 2025 HORIZONTAL.
// Licensed under MIT (https://github.com/Horizontal-org/Tella-iOS/blob/develop/LICENSE)
//

import SwiftUI

struct AddFileBottomSheetView<Content: View>: View {

@ObservedObject var viewModel: AddFilesViewModel
@EnvironmentObject var sheetManager: SheetManager
var content: () -> Content
var moreAction: (() -> ())? = nil

init(viewModel: AddFilesViewModel, content: @escaping () -> Content, moreAction: (() -> ())? = nil ) {
self.viewModel = viewModel
self.content = content
self.moreAction = moreAction
}
var body: some View {
Button {
UIApplication.shared.endEditing()
moreAction?()
showAddFileSheet()
} label: {
content()
}
}

func showAddFileSheet() {
sheetManager.showBottomSheet(modalHeight: CGFloat(viewModel.bottomSheetItems.count * 50 + 90), content: {
ActionListBottomSheet(items: viewModel.bottomSheetItems,
headerTitle: LocalizableVault.manageFilesSheetTitle.localized,
action: { item in
self.handleActions(item: item)
})
})
}

private func handleActions(item: ListActionSheetItem) {
guard let type = item.type as? ManageFileType else { return }

switch type {
case .camera:
viewModel.showingCamera = true

case .recorder:
viewModel.showingRecordView = true

case .fromDevice:
showAddPhotoVideoSheet()

case .tellaFile:
navigateTo(destination: fileListView)

default:
break
}
sheetManager.hide()
}

func showAddPhotoVideoSheet() {
viewModel.showingImagePicker = true
}

var fileListView: some View {
FileListView(appModel: viewModel.mainAppModel,
filterType: viewModel.shouldShowDocumentsOnly ? .documents : .audioPhotoVideo,
title: LocalizableReport.selectFiles.localized,
fileListType: .selectFiles,
resultFile: $viewModel.resultFile)
}
}
24 changes: 24 additions & 0 deletions Tella/Components/AddFileGridViewComponent/AddFileCameraView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// AddFileCameraView.swift
// Tella
//
// Created by RIMA on 26.02.25.
// Copyright © 2025 HORIZONTAL.
// Licensed under MIT (https://github.com/Horizontal-org/Tella-iOS/blob/develop/LICENSE)
//

import SwiftUI
struct AddFileCameraView: View {
@ObservedObject var viewModel: AddFilesViewModel

var sourceView = SourceView.addFile

var body: some View {
viewModel.showingCamera ?
CameraView(sourceView: sourceView,
showingCameraView: $viewModel.showingCamera,
resultFile: $viewModel.resultFile,
mainAppModel: viewModel.mainAppModel) : nil
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//
// AddFileGridItemView.swift
// Tella
//
// Created by RIMA on 26.02.25.
// Copyright © 2025 HORIZONTAL.
// Licensed under MIT (https://github.com/Horizontal-org/Tella-iOS/blob/develop/LICENSE)
//

import SwiftUI

struct AddFileGridItemView: View {

var file: VaultFileDB

@StateObject var viewModel: AddFilesViewModel

var body: some View {
gridItemView
.overlay(deleteButton, alignment: .topTrailing)
}

var gridItemView : some View {
ZStack {
file.gridImage
self.fileNameText
}
}

var deleteButton : some View {
Button {
viewModel.deleteFile(fileId: file.id)
} label: {
Image("delete.cross.icon")
.padding(.all, 10)
}
}

@ViewBuilder
var fileNameText: some View {

if self.file.tellaFileType != .image || self.file.tellaFileType != .video {
VStack {
Spacer()
CustomText(self.file.name,
style: .body3Style)
.lineLimit(1)
Spacer()
.frame(height: 6)
}.padding(EdgeInsets(top: 0, leading: 5, bottom: 0, trailing: 5))
}
}
}

50 changes: 50 additions & 0 deletions Tella/Components/AddFileGridViewComponent/AddFileGridView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//
// AddFileGridView.swift
// Tella
//
// Created by RIMA on 26.02.25.
// Copyright © 2025 HORIZONTAL.
// Licensed under MIT (https://github.com/Horizontal-org/Tella-iOS/blob/develop/LICENSE)
//

import SwiftUI

struct AddFileGridView: View {

private let gridLayout: [GridItem] = [GridItem(spacing: 12),
GridItem(spacing: 12),
GridItem(spacing: 12)]

private let gridItemHeight = (UIScreen.screenWidth - 64.0) / 3

@ObservedObject var viewModel: AddFilesViewModel

var titleText: String

var body: some View {
VStack(alignment: .leading, spacing: 12) {

attachFilesTextView

itemsGridView

AddFileBottomSheetView(viewModel: viewModel) {
Image("add.file.icon")
}
}
}


var attachFilesTextView: some View {
CustomText(titleText, style: .body1Style)
}

var itemsGridView: some View {
LazyVGrid(columns: gridLayout, alignment: .center, spacing: 12) {
ForEach(viewModel.files.sorted{$0.created < $1.created}, id: \.id) { file in
AddFileGridItemView(file: file, viewModel: viewModel)
.frame(height: gridItemHeight)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// AddFilePhotoVideoPickerView.swift
// Tella
//
// Created by RIMA on 26.02.25.
// Copyright © 2025 HORIZONTAL.
// Licensed under MIT (https://github.com/Horizontal-org/Tella-iOS/blob/develop/LICENSE)
//

import SwiftUI

struct AddFilePhotoVideoPickerView: View {

@ObservedObject var viewModel: AddFilesViewModel

var body: some View {
PhotoVideoPickerView(showingImagePicker: $viewModel.showingImagePicker,
showingImportDocumentPicker: $viewModel.showingImportDocumentPicker,
appModel: viewModel.mainAppModel,
resultFile: $viewModel.resultFile)

}
}
23 changes: 23 additions & 0 deletions Tella/Components/AddFileGridViewComponent/AddFileRecordView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// AddFileRecordView.swift
// Tella
//
// Created by RIMA on 26.02.25.
// Copyright © 2025 HORIZONTAL.
// Licensed under MIT (https://github.com/Horizontal-org/Tella-iOS/blob/develop/LICENSE)
//

import SwiftUI
struct AddFileRecordView: View {

@ObservedObject var viewModel: AddFilesViewModel

var body: some View {
viewModel.showingRecordView ?
RecordView(appModel: viewModel.mainAppModel,
sourceView: .addReportFile,
showingRecoredrView: $viewModel.showingRecordView,
resultFile: $viewModel.resultFile) : nil

}
}
Loading