Skip to content

Commit

Permalink
feat: Add view changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BaptGrv committed Nov 1, 2024
1 parent 188fc5a commit 23b8a43
Show file tree
Hide file tree
Showing 9 changed files with 281 additions and 14 deletions.
17 changes: 14 additions & 3 deletions Mail/Views/Alerts/CreateFolderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ struct CreateFolderView: View {
@State private var folderName = ""
@State private var error: FolderError?
@State private var isModifyView = false
@State private var isInitialName = false

@FocusState private var isFocused

Expand Down Expand Up @@ -81,7 +82,8 @@ struct CreateFolderView: View {

var body: some View {
VStack(alignment: .leading, spacing: 0) {
Text(isModifyView ? "Renommer le dossier" : MailResourcesStrings.Localizable.newFolderDialogTitle)
Text(isModifyView ? MailResourcesStrings.Localizable.renameFolder : MailResourcesStrings.Localizable
.newFolderDialogTitle)
.textStyle(.bodyMedium)
.padding(.bottom, IKPadding.alertTitleBottom)

Expand All @@ -90,7 +92,8 @@ struct CreateFolderView: View {
.padding(value: .intermediate)
.overlay(
RoundedRectangle(cornerRadius: 4)
.stroke(isModifyView || error == nil ? MailResourcesAsset.textFieldBorder.swiftUIColor : MailResourcesAsset.redColor
.stroke(isInitialName || error == nil ? MailResourcesAsset.textFieldBorder
.swiftUIColor : MailResourcesAsset.redColor
.swiftUIColor)
.animation(.easeInOut, value: error)
)
Expand All @@ -100,7 +103,7 @@ struct CreateFolderView: View {
Text(error?.errorDescription ?? "")
.textStyle(.labelError)
.padding(.top, value: .extraSmall)
.opacity(isModifyView || error == nil ? 0 : 1)
.opacity(isInitialName || error == nil ? 0 : 1)
.padding(.bottom, value: .small)

ModalButtonsView(primaryButtonTitle: mode.buttonTitle, primaryButtonEnabled: isButtonEnabled) {
Expand Down Expand Up @@ -147,6 +150,14 @@ struct CreateFolderView: View {
return
}

if folder != nil {
if folderName == folder!.name {
isInitialName = true
} else {
isInitialName = false
}
}

withAnimation {
if trimmedName.count >= Constants.maxFolderNameLength {
error = .nameTooLong
Expand Down
6 changes: 3 additions & 3 deletions Mail/Views/Menu Drawer/Folders/FoldersListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ struct FoldersListView: View {
currentFolderId: mainViewState.selectedFolder.remoteId,
canCollapseSubFolders: hasSubFolders,
matomoCategory: .menuDrawer)
.background(RoundedRectangle(cornerRadius: 10).fill(MailResourcesAsset.backgroundSecondaryColor.swiftUIColor))
.contextMenu {
if isUserFoldersList {
Button {
currentFolder = folder.frozenContent
isShowingCreateFolderAlert.toggle()
} label: {
Label {
Text("Renommer")
Text(MailResourcesStrings.Localizable.actionRename)
} icon: {
MailResourcesAsset.pencilPlain.swiftUIImage
}

}
Button {
Task {
Expand All @@ -74,7 +74,7 @@ struct FoldersListView: View {
}
} label: {
Label {
Text("Supprimer")
Text(MailResourcesStrings.Localizable.actionDelete)
} icon: {
MailResourcesAsset.bin.swiftUIImage
}
Expand Down
2 changes: 1 addition & 1 deletion MailCore/API/MailApiFetcher/MailApiFetcher+Common.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public extension MailApiFetcher {
}

@discardableResult
func modify(mailbox: Mailbox, folder: Folder, name: String) async throws -> Empty? {
func modify(mailbox: Mailbox, folder: Folder, name: String) async throws -> Folder {
let newName = ModifyFolder(name: name)
return try await perform(request: authenticatedRequest(
.modifyFolder(mailboxUuid: mailbox.uuid, folderId: folder.remoteId),
Expand Down
5 changes: 3 additions & 2 deletions MailCore/Cache/MailboxManager/MailboxManager+Folders.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ public extension MailboxManager {
}

func modifyFolder(name: String, folder: Folder) async throws {
try await apiFetcher.modify(mailbox: mailbox, folder: folder, name: name)
let modifiedFolder = try await apiFetcher.modify(mailbox: mailbox, folder: folder, name: name)
guard let liveFolder = folder.thaw() else { return }
try writeTransaction { writableRealm in
writableRealm.add(liveFolder, update: .modified)
writableRealm.delete(liveFolder)
writableRealm.add(modifiedFolder, update: .modified)
}
}

Expand Down
53 changes: 52 additions & 1 deletion MailResources/Localizable/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Locale: de, German
* Tagged: ios
* Exported by: Baptiste Griva
* Exported at: Mon, 28 Oct 2024 14:20:08 +0100
* Exported at: Fri, 01 Nov 2024 08:03:40 +0100
*/

/* loco:62bb154d7513e127cb2e9c94 */
Expand Down Expand Up @@ -58,6 +58,9 @@
/* loco:629f0f8232570829c53e38e2 */
"actionPrint" = "Drucken";

/* loco:67247bd43e094b31a70e2272 */
"actionRename" = "Umbenennen";

/* loco:6284fd413d98060ac31f76d2 */
"actionReply" = "Antwort";

Expand Down Expand Up @@ -379,6 +382,9 @@
/* loco:62b1c0de630e5a572542c032 */
"buttonCreateFolder" = "Einen Ordner hinzufügen";

/* loco:6723a4468cf8e4d10e094606 */
"buttonCustomSchedule" = "Benutzerdefinierter Zeitplan";

/* loco:64abb7007886284b68017193 */
"buttonDetachMailbox" = "adresse abtrennen";

Expand Down Expand Up @@ -430,6 +436,9 @@
/* loco:65855b1bac34d439fd02e7e2 */
"buttonMaybe" = "Vielleicht";

/* loco:6723a53b28105b82c404e163 */
"buttonModify" = "ändern";

/* loco:6284fd623d98060ac31f76d5 */
"buttonMore" = "Mehr";

Expand Down Expand Up @@ -460,12 +469,18 @@
/* loco:64a2b7a35386a9ec49013e42 */
"buttonRequestPassword" = "Passwort anfordern";

/* loco:6723a9568fe8ffe07203af72 */
"buttonReschedule" = "Neu planen";

/* loco:62567b81c34ca7494235e273 */
"buttonRestoreEmails" = "E-Mails wiederherstellen";

/* loco:62b2e4a24486732cbc2f04d3 */
"buttonSchedule" = "Planen Sie den Versand von E-Mails für einen späteren Zeitpunkt";

/* loco:6723a2a5f3c615913002d152 */
"buttonScheduleTitle" = "Zeitplan";

/* loco:65957d479527393708069ee2 */
"buttonSee" = "Siehe";

Expand Down Expand Up @@ -655,6 +670,9 @@
/* loco:62b1c1491ea473352a4fb205 */
"createFolderParent" = "Übergeordneter Ordner";

/* loco:6723a25570ccbbb9b709fb62 */
"datePickerTitle" = "Wählen Sie ein Datum und eine Uhrzeit";

/* loco:6294648c19755a1ae9494462 */
"dateTitle" = "Datum:";

Expand All @@ -667,6 +685,12 @@
/* loco:6364d5ac2e2f281d52389ee2 */
"draftPrefix" = "(Entwurf)";

/* loco:6723aa01f9685843aa0de8a3 */
"editSendDescription" = "Programmierung abgebrochen. Diese Nachricht wird in Ihre Entwürfe verschoben, damit Sie sie senden können, wann immer Sie möchten.";

/* loco:6723a9b2b22031bf3701ae62 */
"editSendTitle" = "Senden bearbeiten";

/* loco:64243b4a9a9a1f26302e33f3 */
"emailWithoutSubjectDescription" = "Sie sind dabei, eine Nachricht ohne Betreff zu senden. Möchten Sie fortfahren?";

Expand Down Expand Up @@ -895,6 +919,9 @@
/* loco:627a3c64f10f5f31f53e1c02 */
"inboxFolder" = "Posteingang";

/* loco:672398789bd6d8d56802d212 */
"lastSelectedSchedule" = "Zuletzt ausgewählter Zeitplan";

/* loco:62c427c7ad522f1ff078a162 */
"loadingText" = "Laden…";

Expand Down Expand Up @@ -1003,6 +1030,12 @@
/* loco:6266655afabeeb6bc774c932 */
"newMessagePlaceholderTitle" = "Geben Sie Ihre Nachricht ein";

/* loco:6723980d4062e74f78028152 */
"nextMondayAfternoon" = "Montagnachmittag";

/* loco:67238d29fe561f9d0a0f5732 */
"nextMondayMorning" = "Nächsten Montag";

/* loco:62fb875a6743ac5a237b07e3 */
"noBodyTitle" = "Diese Nachricht ist leer.";

Expand Down Expand Up @@ -1111,6 +1144,9 @@
/* loco:62baabfc07e6a001ca19e535 */
"refreshTokenError" = "Sie wurden abgemeldet";

/* loco:67247c6c7e4e57666a017942 */
"renameFolder" = "Benennen Sie den Ordner um";

/* loco:62cd640724b16d271d296bc2 */
"reportDisplayProblemDescription" = "Sind Sie damit einverstanden, Ihre Daten mit unseren Entwicklern zu teilen, damit diese Ihnen bei Ihrem Problem helfen können?";

Expand Down Expand Up @@ -1141,6 +1177,12 @@
/* loco:66e2826251d88f0bdc097c12 */
"saveMailInkDrive" = "Speichern im kDrive";

/* loco:6723a3818bedb42b0805f613 */
"scheduleSendingTitle" = "Planen Sie den Versand";

/* loco:6723a770a20911146d083622 */
"scheduledEmailHeader" = "Diese E-Mail wird an diesem Datum gesendet: %@";

/* loco:62a9db4ae45f1e29371ff802 */
"scheduledMessagesFolder" = "Geplante Nachrichten";

Expand Down Expand Up @@ -1615,6 +1657,12 @@
/* loco:651ec8814a88e40c620a2f32 */
"syncTutorialStepCount" = "%1$d von %2$d";

/* loco:672386513ba28533830dc293 */
"thisAfternoon" = "Heute Nachmittag";

/* loco:67238c432a68eb6c2600fc52 */
"thisEvening" = "Heute Abend";

/* loco:63f380d5d0a8f81b511bf704 */
"threadListDeletionConfirmationAlertDescription" = "Sind Sie sicher, dass Sie diese Nachricht endgültig löschen wollen?";

Expand Down Expand Up @@ -1687,6 +1735,9 @@
/* loco:62665fa13789aa7e8353ad62 */
"toTitle" = "An:";

/* loco:67238cec47b13a82520c0245 */
"tomorrowMorning" = "Morgen früh";

/* loco:641db88f88b1f63cb05aad52 */
"tooManyRecipients" = "Sie können diese Adresse nicht hinzufügen, da Sie die Höchstzahl an Empfängern erreicht haben";

Expand Down
Loading

0 comments on commit 23b8a43

Please sign in to comment.