Skip to content

Commit

Permalink
Merge develop uwazi (#111)
Browse files Browse the repository at this point in the history
* Conflict resolved

* Merged with dev and implemented the new way of navigation

* Localization added for Language selection screen

* projectURL changed to serverURL

* Integration till language save and save server

* Added a new method in WebRespository to give back the httpresponse header fields

* Saving the token to the viewModel

* Add server completed
Code clean up

* Creating a table for storing a language of each Uwazi server connection
CRUD operation for language storing of language associated with uwazi server connection
Code refactor

* Comment and todo added for future reference

* wip add server type

* edit flow

* server migration completed for servertype

* add a method for parsing the dictionary to Codable Type

* delete code related to migration testing

* Added TODO for future and made some variable as private to restrict unnecessary access

* add uwazi card in home view

* added some tweaks

* add new logo

* update the language selected when editing the server

* remove unwanted code of alter table

* - Removing unused code
- Rename the new call method which returns the header for Uwazi integration

* Feature/uwazi integration (#70)

* Conflict resolved

* Merged with dev and implemented the new way of navigation

* Localization added for Language selection screen

* projectURL changed to serverURL

* Integration till language save and save server

* Added a new method in WebRespository to give back the httpresponse header fields

* Saving the token to the viewModel

* Add server completed
Code clean up

* Creating a table for storing a language of each Uwazi server connection
CRUD operation for language storing of language associated with uwazi server connection
Code refactor

* Comment and todo added for future reference

* Uwazi/clean up (#80)

* Refactoring the uwazi server connection views

* UwaziLoginView clean up
Print statement removed

* replace print with  debugLog

* Removed unnecessary files and codes

* Removed unwanted project from the objects

* Remove unused code

* changed serverViewModel to much suitable name of uwaziServerViewModel
Changed print statement to debuglog

* Localization file conflict resolved

* fix deletion of videos when importing (#75)

* fix deletion of videos when importing

* add completion instead of files and referenceURL

* Conflict resolved

* Build 1.3.0(50)

* URLRequest.swift conflict resolved

* Language conflict resolved

* Feature/fix bugs (#82)

* Bug on canceling an import

* Fix bug on importing to a folder

* Hide camera view after reducing the app to background

* Remove unused code

* Update Kurdish code

* Build 1.3.0(51)

* Conflict resolved

* conflict resolved

* Conflict resolved

* Conflict resolved

* TellaDatabase conflict resolved

* TellaDatabase conflict resolved

* TellaDatabase conflict resolved

* conflict resolved

* Conflict resolved

* conflict resolved

* Conflict resolved

* Conflict resolved

* Conflict resolved

* Removed unnecessary files and codes

* conflict resolve

* DTO for UwaziLanguageRow done
Logic for token extraction for uwazi connection moved from view model to UwaziServerRepositories
CustomErrorMessage added for invalid username and password
Error codes are centralized to avoid hardcoded values

* Requested changes in the PR
Change the copyright message to mention HORIZONTAL instead of INTERNEWS
Added a new method for debugLog any object

* Change the Uwazi data layer to DTO pattern

* Removing error handling from view models

* Replace ServerTokenType to String?

* Remove unused code
Remove credentials

* UwaziLanguageSelectionView refactor

* Remove deadcode

* Removed unused codes
Cleaning the code

* TellaApp saveApp method refactor

---------

Co-authored-by: Gustavo Valbuena <[email protected]>
Co-authored-by: Dhekra Rouatbi <[email protected]>
Co-authored-by: dhekra-rouatbi <[email protected]>

* Removed the Domain models to seperate files

* issue with video and photo picker not working fixed (#93)

* Character limit in Uwazi login screen fields (#88)

* Added validator for uwazi username and password validation
Added new enum uwaziUsername and uwaziPassword for validation
Change the fieldType of username and password to uwaziUsername and uwaziPassword

* Combined Uwazi login username and password validator into one function

* used the text validator instead of username and password
Remove uwaziLoginValidtor

* removed validateWithRegex

* Handle no internet connection (#89)

* Handle the condition of no internet connection

* change configuration.waitsForConnectivity to false

* Initiated the NetworkMonitor in MainAppModel

* Crash issue fixed

* add translation for No internet connection

* Replaced  Fail<(Value,[AnyHashable:Any]?), APIError>(error: APIError.noInternetConnection) to Fail(error: APIError.noInternetConnection)
                    .eraseToAnyPublisher()

* Moved the NetworkMonitor.shared to AppViewState
isLoading added in CheckURL method

* refactored

* solve the issue with uwazi and reports both showing while only one of them is added (#87)

* If wrong server url is entered the app stays  looping  (#86)

* Handle the issue with invalid Server URL looping issue

* removed unnecessary handling

* Handled 404 error and remove mapError

* Localized the error for incorrect server url

* Handled the case for other url issues

* new enum value badServer add to handle the issue with invalid URL while using checkURL api call

* removed error case in APIError

* changed custom error to "Unexpected response from the server"

* UWAZI - list templates (#74)

* add pageview for both uwazi and reports

* get template list and populate template items

* remove unused files

* fix previews

* add yellow button

* download template view

* add provisory logic to download template

* pass uwaziReportsViewModel as environment object

* Zip of 4 api call completed

* creating db

* Saving the templates to db and other CRUD operations for template in db

* Code comment and improvements

* replace print with dump

* Code refactor and completed the TODO works

* fix some issues while scrolling template view

* Code improvements

* general fixes

* add localizable strings

* add localizables in all languages

* fix typo

* add server uwazi localizable strings

* DTO patterns added
Used getAPIResponse method
Handle try catch in other place not in view model
Remove some throws from methods

* Refactor the handleTemplate method
Removing unused code or dead code
Removing throws that are not necessary

* Removed unwanted button from TemplateItemView and TemplateCardView

* Resolve empty spaces

* Move UwaziServerLanguageProtocol and UwaziTemplateProtocol protocols to new file and move to new folder
Remove spaces and refactoring

* removed template_ from the database

* Move template, language, report and server to different files for better readability
Make a extension of JSONDecoder for decoding from database to Codable

* made database non optional in TellaData

* Change the file name
Combined the method of language and template into one file

* added translation of Uwazi for Kurdish

* fix UI issues in add templatesView

* change reports to connections in general component group

* remove unused fromHashToValue methods

* move template action type to uwazi

* change naming of uwaziReportModel to uwaziTemplateViewModel

* guard let instead of if let
database changes

* removed serverURL from UwaziTemplateViewModel

* Removed toDomain from unnecessary DTOs
Move the part of converting of UwaziTemplateRow to CollectedTemplate into view model
Started implementing pure MVVM structure

* add uwaziViewModel and move page view logic there

* rollback connection pageview items

* fix comment in UwaziTemplateViewModel

* more folder re-structure

* Update TemplateCardViewModel and TemplateItemViewModel

* Fixed the errors  introduced while implement new MVVM pattern
Moved showtemplateActionBottomSheet and showDeleteTemplateConfirmationView to TemplateCardView from TemplateListView

* Update TemplateCardViewModel and TemplateItemViewModel

* Deleted the DeleteTemplateConfirmationViewModel and DeleteTemplateConfirmationView

* Fix template list

* Update Page component

* divide responsabilities in UwaziTemplateViewModel

* remove templateViewModel

* Fixed the issue with download template flow broken

* removed unwanted codes

* Moved toast from view model to view

* moved Toast after action

---------

Co-authored-by: Robert Shrestha <[email protected]>
Co-authored-by: Dhekra Rouatbi <[email protected]>

* Solve the issue with uwazi server showing in new report of tella web (#92)

* Fix Uwazi languages crash (#95)

* Uwazi edit flow login button issue (#96)

* validation for login issue fixed

* Rename fillReportVM to fillUwaziServerVM
handled the login button issue in fillUwaziServerVM

* fillUwaziServerVM seperated into fillUwaziServer and fillUwaziCredentials
Handled filling of data in each view rather than at once

* added comment for future confusion

* remove unwanted function

* Uwazi/entity creation (#79)

* Zip of 4 api call completed

* creating db

* Saving the templates to db and other CRUD operations for template in db

* Code comment and improvements

* add pageview for both uwazi and reports

* get template list and populate template items

* fix previews

* download template view

* add provisory logic to download template

* pass uwaziReportsViewModel as environment object

* Code refactor and completed the TODO works

* fix some issues while scrolling template view

* add localizable strings

* add CreateENtityView and reusable header component

* add switch to render diferent property types

* add draft view model

* Changed UwaziConstants to UwaziEntityPropertyType

* isolate RenderPropertyComponent

* fix in renderPropertyComponent

* change change propertyValues to Any type

* fix select values parsing

* Core logic for Entity UI components done
Adding GenericEntityView have common components
Refactoring the TextWidget for entity

* made variable fileprivate
moved the handleMandatoryProperties to viewmodel

* remove bindingForLabel method

* remove unused variables

* add geometryReader in draft view

* Conflict resolved

* Folder Restructure
Handle UwaziEntryPrompt methods to new class UwaziEntityParser
Handle the isMandotary error in GenericEntityWidget from  other widgets
Code refactor

* Refactored

* Removed unwanted codes

* Refactor the handleTemplate method
Removing unused code or dead code
Removing throws that are not necessary

* CreateDraftHeaderView refactor
Remove empty spaces
Remove magic numbers

* Added divider entity view between supported file entity and properties entities

* Adding a new view for button that can be used for all the entity view

* Move template, language, report and server to different files for better readability
Make a extension of JSONDecoder for decoding from database to Codable

* Change the file name
Combined the method of language and template into one file

* Localization for entity for uwazi

* Uwazi entity translation added to Kurdish

* change reports to connections in general component group

* Removed toDomain from unnecessary DTOs
Move the part of converting of UwaziTemplateRow to CollectedTemplate into view model
Started implementing pure MVVM structure

* add uwaziViewModel and move page view logic there

* rollback connection pageview items

* more folder re-structure

* fix merge conflicts and some general refactor

* add entity folder inside uwazi views

* add localizable strings

* add rest of the localizable strings

* fix mandatory values logic

* add name to entity parser

* remove template from TemplateCardModel, add getTemplate method and move UwaziEntityParser initialization to VM

---------

Co-authored-by: Robert Shrestha <[email protected]>

* add submitEntity method

* fix types of entity payload

* add cookie and xRequestedWith to enum

* add select component

* some fixes in select dropdown

* add first UI of file selector in uwazi

* fix typo in imageDatePicker

* divide supporting and primary documents and add logic to add files

* first approach to send data as multipart/formdata

* refactor multipartBody creation

* add attachment parser in entityVM

* send images to uwazi remote server

* add file item dropdown in supporting files

* add camera and recorder view

* add file picker in uwaziEntity view

* send primary documents

* refactor multipartbody creation

* add document items inside primary documents

* refactor entityViewModel

* first step to isolate multipart uwazi body logic

* move uwazi multipart logic from server repository

* add documents and atachments

* comment unused UI

* call submit function only when mandatory fields are populated

* add summary submit page

* fix response from api and add Toast when response is success

* add localizable strings for entity

* overall UI fixes

* navigate to uwaziView after sending entity

* add UwaziServer table

* implement uwaziServer model in entity

* implement uwaziServer in template view models

* add locale to uwaziServer table and move cookie as a computed property

* remove locale from addTemplateVM

* remove locale from uwazi database

* add update server to uwazi

* add delete uwazi server

* add uwazi empty state

* some fixes on uwazi view model

* show clear button in entity component

* add onClear action

* add clear action in select

* fix draft header

* fix typo

* add failed error message

* Handle no internet connection issue in download template

* remove unwanted async throw

* remove async try unwanted

* removed spacer

* fix merge conflicts

* UI fixes

* add link in template add view

* remove unused code

* uncomment deleteVaultFile

* fix missing lang keys

* fix some comments

* fix delay time unused variable

* fix bug when user does not select any language

* first draft of datePicker component

* finish UI of datePicker

* last details of date picker

* add markdown to uwazi entities

* submit public entities

* adapt entityCreationClass for public template

* ui fixes in entity section

* remove unused constants

* fix pageview

* add default condition in reports switch block

* remove server type from database

* rollback previews

* change alterTable function name

* change database version and remove comments

* inherit server props on uwaziServer class

* create tellaServer class

* integrate tellaServer class with the rest of the codebase

* rmeove duplicate files

* remove unused template files

* change column name on uwazi server database

* remove unsued fields in server class

* add date extensions

* remove serverName from template

---------

Co-authored-by: Robert Shrestha <[email protected]>
Co-authored-by: rob-horizontal-iOS <[email protected]>
Co-authored-by: Dhekra Rouatbi <[email protected]>
Co-authored-by: dhekra-rouatbi <[email protected]>
Co-authored-by: gus valbuena <[email protected]>
  • Loading branch information
6 people authored Jan 18, 2024
1 parent ae386a2 commit 38bb0db
Show file tree
Hide file tree
Showing 192 changed files with 7,759 additions and 493 deletions.
615 changes: 587 additions & 28 deletions Tella.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Tella/Application/TellaApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct TellaApp: App {
private var appViewState = AppViewState()
@Environment(\.scenePhase) var scenePhase
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
let delayTimeInSecond = 1.0

var body: some Scene {
WindowGroup {
Expand All @@ -40,7 +41,7 @@ struct TellaApp: App {
}
}
}

func saveData(lockApptype:LockApptype) {


Expand All @@ -56,14 +57,13 @@ struct TellaApp: App {
if shouldResetApp && !hasFileOnBackground {

appViewState.homeViewModel.shouldSaveCurrentData = true
DispatchQueue.main.asyncAfter(deadline: .now() + 1, execute: {
DispatchQueue.main.asyncAfter(deadline: .now() + delayTimeInSecond, execute: {
appViewState.homeViewModel.vaultManager.clearTmpDirectory() // TO FIX for server doesn't allow upload in Background
appViewState.resetApp()
})
appViewState.homeViewModel.shouldSaveCurrentData = false
}
}

func resetApp() {
let hasFileOnBackground = UploadService.shared.hasFilesToUploadOnBackground
let appEnterInBackground = appViewState.homeViewModel.appEnterInBackground
Expand Down
10 changes: 2 additions & 8 deletions Tella/Components/BottomSheet/ConfirmBottomSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,27 @@ struct ConfirmBottomSheet : View {
}

var contentView: some View {

VStack(alignment: .leading, spacing: 9) {

Text(self.titleText)
.foregroundColor(.white)
.font(Font.custom(Styles.Fonts.semiBoldFontName, size: 17))

.lineLimit(nil)
.fixedSize(horizontal: false, vertical: true)
Text(self.msgText)
.foregroundColor(.white)
.font(Font.custom(Styles.Fonts.regularFontName, size: 14))
.lineLimit(nil)
.fixedSize(horizontal: false, vertical: true)
Spacer()
HStack(alignment: .lastTextBaseline ){

Spacer()

Button(action: {
didCancelAction?()
sheetManager.hide()

}){
Text(self.cancelText)
}.buttonStyle(ButtonSheetStyle())


if let discardText = discardText {
Spacer()
.frame(width: 10)
Expand All @@ -63,7 +58,6 @@ struct ConfirmBottomSheet : View {
}.buttonStyle(ButtonSheetStyle())

}

Spacer()
.frame(width: 10)

Expand Down
2 changes: 1 addition & 1 deletion Tella/Components/ConfirmationBottomSheet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Tella
//
// Created by Gustavo on 16/03/2023.
// Copyright © 2023 INTERNEWS. All rights reserved.
// Copyright © 2023 HORIZONTAL. All rights reserved.
//

import SwiftUI
Expand Down
33 changes: 33 additions & 0 deletions Tella/Components/Connections/Card/ConnectionCardDetail.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// ConnectionCardDetail.swift
// Tella
//
// Created by Gustavo on 02/08/2023.
// Copyright © 2023 HORIZONTAL. All rights reserved.
//

import SwiftUI

struct ConnectionCardDetail: View {
var title : String
var subtitle: String
var body: some View {
VStack(alignment: .leading, spacing: 6) {

Text(title)
.font(.custom(Styles.Fonts.semiBoldFontName, size: 14))
.foregroundColor(.white)
.lineLimit(1)

Text(subtitle)
.font(.custom(Styles.Fonts.regularFontName, size: 12))
.foregroundColor(.white)
}
}
}

struct ReportCardDetail_Previews: PreviewProvider {
static var previews: some View {
ConnectionCardDetail(title: "", subtitle: "")
}
}
28 changes: 28 additions & 0 deletions Tella/Components/Connections/Card/MoreButtonView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// MoreButtonView.swift
// Tella
//
// Created by Gustavo on 02/08/2023.
// Copyright © 2023 HORIZONTAL. All rights reserved.
//

import SwiftUI

struct MoreButtonView: View {
var imageName : String
var action : () -> Void
var body: some View {
Button {
action()
} label: {
Image(imageName)
.padding()
}
}
}

struct MoreButtonView_Previews: PreviewProvider {
static var previews: some View {
MoreButtonView(imageName: "", action: {})
}
}
2 changes: 1 addition & 1 deletion Tella/Components/CustomNavigation.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright © 2023 INTERNEWS. All rights reserved.
// Copyright © 2023 HORIZONTAL. All rights reserved.
//

import SwiftUI
Expand Down
37 changes: 0 additions & 37 deletions Tella/Components/Tabs/PageViewCellNotification.swift

This file was deleted.

13 changes: 12 additions & 1 deletion Tella/Components/Tabs/Pages.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//
// Copyright © 2021 INTERNEWS. All rights reserved.
// Pages.swift
// Tella
//
// Created by gus valbuena on 1/11/24.
// Copyright © 2024 HORIZONTAL. All rights reserved.
//

import Foundation
Expand All @@ -9,6 +13,7 @@ public enum Pages: Hashable {
case draft
case outbox
case submitted
case template

var title: String {
switch self {
Expand All @@ -19,6 +24,8 @@ public enum Pages: Hashable {
return "Outbox"
case .submitted:
return "Submitted"
case .template:
return "Template"
}
}

Expand All @@ -30,6 +37,8 @@ public enum Pages: Hashable {
return 1
case .submitted:
return 2
case .template:
return 3
}
}

Expand All @@ -41,6 +50,8 @@ public enum Pages: Hashable {
return .outbox
case 2:
return .submitted
case 3:
return .template
default:
return .draft
}
Expand Down
5 changes: 4 additions & 1 deletion Tella/Components/TellaButton/TellaButtonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ struct TellaButtonView<Destination:View> : View {
var title : String
var nextButtonAction : NextButtonAction
var buttonType : ButtonType = .clear
var isOverlay: Bool = false

var destination : Destination?
@Binding var isValid : Bool
Expand All @@ -18,7 +19,6 @@ struct TellaButtonView<Destination:View> : View {


var buttonStyle : TellaButtonStyleProtocol {

switch buttonType {
case .yellow:
return YellowButtonStyle()
Expand Down Expand Up @@ -47,6 +47,9 @@ struct TellaButtonView<Destination:View> : View {
}.cornerRadius(20)
.buttonStyle(TellaButtonStyle(buttonStyle: buttonStyle, isValid: isValid))
.disabled(isValid == false)
.overlay(self.isOverlay ?
RoundedRectangle(cornerRadius: 20)
.stroke(.white, lineWidth: 4) : nil)
}
}

Expand Down
30 changes: 19 additions & 11 deletions Tella/Components/TextfieldView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@

import SwiftUI
import Combine

enum FieldType {
case url
case username
case text
case password
case code
}
struct TextfieldView : View {

@Binding var fieldContent : String
Expand All @@ -19,6 +25,7 @@ struct TextfieldView : View {
var placeholder : String = ""
var shouldShowTitle : Bool = false
var onCommit : (() -> Void)? = ({})
var keyboardType: UIKeyboardType = .default

@State private var shouldShowPassword : Bool = false

Expand All @@ -35,6 +42,7 @@ struct TextfieldView : View {
.font(.custom(Styles.Fonts.regularFontName, size: 14))
.frame(maxWidth: .infinity,alignment: .leading)
.contentShape(Rectangle())

.foregroundColor(fieldContent.isEmpty ? .white : .white.opacity(0.8))
.scaleEffect(fieldContent.isEmpty ? 1 : 0.88, anchor: .leading)
.transaction { transaction in
Expand All @@ -46,7 +54,7 @@ struct TextfieldView : View {
}

// Textfield
if fieldType == .password {
if fieldType == .password || fieldType == .code {
passwordTextfieldView
} else {
textfieldView
Expand All @@ -67,9 +75,13 @@ struct TextfieldView : View {

var textfieldView : some View {

TextField("", text: $fieldContent,onCommit: {
TextField("",
text: $fieldContent,
onCommit: {
self.onCommit?()
}).onChange(of: fieldContent, perform: { value in
})
.keyboardType(keyboardType)
.onChange(of: fieldContent, perform: { value in
validateField(value: value)
self.pfieldContent = value
})
Expand All @@ -91,6 +103,7 @@ struct TextfieldView : View {
self.onCommit?()
})
}}
.keyboardType(keyboardType)
.textFieldStyle(TextfieldStyle(shouldShowError: shouldShowError))
.onChange(of: fieldContent, perform: { value in
validateField(value: value)
Expand Down Expand Up @@ -142,6 +155,8 @@ struct TextfieldView : View {
case .password:
self.isValid = value.passwordValidator()

case .code:
self.isValid = value.codeValidator()
}
self.shouldShowError = false
}
Expand Down Expand Up @@ -171,10 +186,3 @@ struct TextfieldView_Previews: PreviewProvider {
}
}


enum FieldType {
case url
case username
case text
case password
}
Loading

0 comments on commit 38bb0db

Please sign in to comment.