diff --git a/enzevalos_iphone/SwiftUI/Compose/ComposeView.swift b/enzevalos_iphone/SwiftUI/Compose/ComposeView.swift index aaf80ce345ea97ded34e4211cf6c4c91b59125b1..4cdfdbbdd252b990ccda21715830db811bdac467 100644 --- a/enzevalos_iphone/SwiftUI/Compose/ComposeView.swift +++ b/enzevalos_iphone/SwiftUI/Compose/ComposeView.swift @@ -18,35 +18,39 @@ struct ComposeView: View { } var body: some View { - VStack { - // Top bar with Cancel and Send button - ComposeViewHeader(model: model) - - Divider() - - // "To" recipients - RecipientField(model: model.recipientsModel.toModel) - - Divider() - - // "Cc/Bcc" recipients - CcAndBccFields(model: model.recipientsModel) - - // Subject - HStack { - Text("Subject") - .foregroundColor(Color(UIColor.tertiaryLabel)) - TextField("", text: $model.subject) - .autocapitalization(.none) + GeometryReader { geometry in + VStack { + // Top bar with Cancel and Send button + ComposeViewHeader(model: model) + + Divider() + + // "To" recipients + RecipientField(model: model.recipientsModel.toModel, + composeViewHeight: geometry.size.height) + + Divider() + + // "Cc/Bcc" recipients + CcAndBccFields(model: model.recipientsModel, + composeViewHeight: geometry.size.height) + + // Subject + HStack { + Text("Subject") + .foregroundColor(Color(UIColor.tertiaryLabel)) + TextField("", text: $model.subject) + .autocapitalization(.none) + } + + Divider() + + // Email body + TextEditor(text: $model.body) } - - Divider() - - // Email body - TextEditor(text: $model.body) + .padding() + .animation(.easeInOut) } - .padding() - .animation(.easeInOut) } } @@ -55,6 +59,7 @@ struct RecipientField: View { @ObservedObject var model: RecipientFieldModel @State private var showList = false @State private var indexOfSelected: Int? + var composeViewHeight: CGFloat var body: some View { VStack { @@ -86,6 +91,7 @@ struct RecipientField: View { Divider() RecipientListView() .environmentObject(model) + .frame(height: composeViewHeight * 0.55) } } } @@ -134,15 +140,18 @@ struct RecipientField: View { /// A view that shows either a single "Cc/Bcc" field or separate "Cc" and "Bcc" fields. struct CcAndBccFields: View { @ObservedObject var model: RecipientsModel + var composeViewHeight: CGFloat var body: some View { VStack { - RecipientField(model: model.ccModel) + RecipientField(model: model.ccModel, + composeViewHeight: composeViewHeight) Divider() if model.showBccField { - RecipientField(model: model.bccModel) + RecipientField(model: model.bccModel, + composeViewHeight: composeViewHeight) Divider() } } diff --git a/enzevalos_iphone/SwiftUI/Inbox/MailListView.swift b/enzevalos_iphone/SwiftUI/Inbox/MailListView.swift index 64c402fa62a4fa531abb48282daeb81935b10f8e..5f94da0062405ef84e904d97c1abf76c614dba4d 100644 --- a/enzevalos_iphone/SwiftUI/Inbox/MailListView.swift +++ b/enzevalos_iphone/SwiftUI/Inbox/MailListView.swift @@ -34,7 +34,6 @@ struct MailListView: View { var body: some View { mainView .navigationBarTitle(name, displayMode: .inline) - .onAppear { self.updateMails() } diff --git a/enzevalos_iphone/SwiftUI/Read/ReadMainView.swift b/enzevalos_iphone/SwiftUI/Read/ReadMainView.swift index 18f403310708ab18dd55e675eb9fd8dc251a7f0d..d4ee8746db78cfc3f8f9697e7a13941b78d39cf2 100644 --- a/enzevalos_iphone/SwiftUI/Read/ReadMainView.swift +++ b/enzevalos_iphone/SwiftUI/Read/ReadMainView.swift @@ -21,7 +21,7 @@ struct ReadMainView <M: DisplayMail>: View { @ObservedObject var model: ReadModel<M> var body: some View { - TabView(selection: $model.currentTab){ + TabView(selection: $model.currentTab) { ForEach(Tabs, id: \.id ){ tab in tab.content .tabItem { diff --git a/enzevalos_iphone/SwiftUI/Read/Tabbed Views/MessageViewMain.swift b/enzevalos_iphone/SwiftUI/Read/Tabbed Views/MessageViewMain.swift index 279655cb7e8a5bda991fff04dcc884e6d1b67a70..ba80bae93e6bcbd138e6cc8ea85e89ba89b0d2f0 100644 --- a/enzevalos_iphone/SwiftUI/Read/Tabbed Views/MessageViewMain.swift +++ b/enzevalos_iphone/SwiftUI/Read/Tabbed Views/MessageViewMain.swift @@ -8,7 +8,6 @@ import SwiftUI - struct MessageViewMain <M: DisplayMail>: View { @EnvironmentObject var model: ReadModel<M> @Environment(\.presentationMode) var presentationMode: Binding<PresentationMode> @@ -16,16 +15,16 @@ struct MessageViewMain <M: DisplayMail>: View { let innerPadding: CGFloat = 20 // button radius let outerPadding: CGFloat = 5 let extraButtonFactor: CGFloat = 0.8 - + @State var showExtraButtons: Bool = false @State var newMail: PreMailData? var body: some View { ZStack{ MessageBody.padding(.horizontal) - .onTapGesture { - self.showExtraButtons = false - } + .onTapGesture { + self.showExtraButtons = false + } FloatingReplyButtons }.onAppear(perform: {self.model.mail.markAsRead(isRead: true)}) .sheet(item: $newMail, content: {mail in ComposeView(preData: mail)}) @@ -47,7 +46,7 @@ struct MessageViewMain <M: DisplayMail>: View { } } } - + var MessageBody : some View { GeometryReader {geometry in @@ -61,11 +60,11 @@ struct MessageViewMain <M: DisplayMail>: View { } var FloatingReplyButtons: some View{ - return VStack{ - Spacer() - HStack{ - Spacer() - ZStack{ + return VStack{ + Spacer() + HStack{ + Spacer() + ZStack{ if model.mail.folderType == FolderType.Archive { forwardButton.offset(y: showExtraButtons ? -innerPadding*9 : 0) replyAllButton.offset(y: showExtraButtons ? -innerPadding*4.5 : 0) @@ -95,28 +94,28 @@ struct MessageViewMain <M: DisplayMail>: View { deleteButton.offset(x: showExtraButtons ? -innerPadding*9 : 0) archiveButton.offset(x: showExtraButtons ? -innerPadding*13.5 : 0) } - //options - FloatingActionButton( - //radius: innerPadding, - onShortPress: {self.showExtraButtons.toggle()} - /*TODO: fill in stuff*/ - ){ - VStack{ - Image(systemName: "arrowshape.turn.up.left.fill") - Text("options").font(.system(size: 7)).fontWeight(.none) - } - }.opacity(showExtraButtons ? 0 : 1) - }.animation(.easeInOut(duration: 0.2)) - }.padding(outerPadding) - }.padding(outerPadding) - } + //options + FloatingActionButton( + //radius: innerPadding, + onShortPress: {self.showExtraButtons.toggle()} + /*TODO: fill in stuff*/ + ){ + VStack{ + Image(systemName: "arrowshape.turn.up.left.fill") + Text("options").font(.system(size: 7)).fontWeight(.none) + } + }.opacity(showExtraButtons ? 0 : 1) + }.animation(.easeInOut(duration: 0.2)) + }.padding(outerPadding) + }.padding(outerPadding) + } var forwardButton: some View { FloatingActionButton( radius: innerPadding*extraButtonFactor, onShortPress: { newMail = model.newUserAction(action: .Forward) - } + } ){ VStack{ Image(systemName: "arrowshape.turn.up.right.fill") @@ -131,7 +130,7 @@ struct MessageViewMain <M: DisplayMail>: View { radius: innerPadding*extraButtonFactor, onShortPress: { newMail = model.newUserAction(action: .ReplyAll) - } + } ){ VStack{ Image(systemName: "arrowshape.turn.up.left.2.fill") @@ -142,10 +141,10 @@ struct MessageViewMain <M: DisplayMail>: View { var unreadButton: some View{ FloatingActionButton( - radius: innerPadding*extraButtonFactor, - onShortPress: { - newMail = model.newUserAction(action: .Unread) - } + radius: innerPadding*extraButtonFactor, + onShortPress: { + newMail = model.newUserAction(action: .Unread) + } ){ VStack{ Image(systemName: "envelope.badge") @@ -156,24 +155,23 @@ struct MessageViewMain <M: DisplayMail>: View { var deleteButton: some View{ FloatingActionButton( - radius: innerPadding*extraButtonFactor, - onShortPress: { - newMail = model.newUserAction(action: .Delete) - }){ + radius: innerPadding*extraButtonFactor, + onShortPress: { + newMail = model.newUserAction(action: .Delete) + }){ VStack{ Image(systemName: "trash") Text("delete").font(.system(size: 7)).fontWeight(.none) } } - } var archiveButton: some View { FloatingActionButton( - radius: innerPadding*extraButtonFactor, - onShortPress: { - newMail = model.newUserAction(action: .Archive) - }){ + radius: innerPadding*extraButtonFactor, + onShortPress: { + newMail = model.newUserAction(action: .Archive) + }){ VStack{ Image(systemName: "folder") Text("archive").font(.system(size: 7)).fontWeight(.none) @@ -185,7 +183,7 @@ struct MessageViewMain <M: DisplayMail>: View { FloatingActionButton( onShortPress: { newMail = model.newUserAction(action: .Reply) - } + } ){ VStack{ Image(systemName: "arrowshape.turn.up.left.fill") diff --git a/enzevalos_iphone/de.lproj/Localizable.strings b/enzevalos_iphone/de.lproj/Localizable.strings index dd12413601e5e878a630412d2da52cc062b53e75..d2d4ee71864dd49b301d5678d875a4388b3c2b86 100644 --- a/enzevalos_iphone/de.lproj/Localizable.strings +++ b/enzevalos_iphone/de.lproj/Localizable.strings @@ -15,6 +15,11 @@ "Archive" = "Archiv"; "Address" = "Adresse"; "Addressbook" = "Adressbuch"; +"AddressRecord.lastHeardFrom.recently" = "kürzlich"; +"AddressRecord.lastHeardFrom.lastWeek" = "letzte Woche"; +"AddressRecord.lastHeardFrom.lastMonth" = "letzten Monat"; +"AddressRecord.lastHeardFrom.LongTimeAgo" = "vor langer Zeit"; +"AddressRecord.lastHeardFrom.Never" = "noch nie"; "Attach" = "Anhängen"; "Attachment" = "Anhang"; "Authentification" = "Authentifizierung"; diff --git a/enzevalos_iphone/en.lproj/Localizable.strings b/enzevalos_iphone/en.lproj/Localizable.strings index 4f6c447df0fc14dfe755ad33e3e6229676c3d270..c27a527def77c96f864fa41f3d550ad25ec34b75 100644 --- a/enzevalos_iphone/en.lproj/Localizable.strings +++ b/enzevalos_iphone/en.lproj/Localizable.strings @@ -11,10 +11,15 @@ "Permission.Notification.Description" = "Letterbox wants to notify you. You can change it anytime in Settings -> Notifications -> Letterbox"; "Permission.AccessContacts.Title" = "Access Contacts"; "Permission.AccessContacts.Description" = "Letterbox needs to access your contacts to work properly. Your data would be safe and not accessible by third parties or shared on the internet."; -"AccessNotGranted" = "Please allow access to contacts in settings, if you want the app to work properly."; // TODO +"AccessNotGranted" = "Please allow access to contacts in settings, if you want the app to work properly."; "Archive" = "Archive"; "Address" = "Address"; "Addressbook" = "Contracts"; +"AddressRecord.lastHeardFrom.recently" = "recently"; +"AddressRecord.lastHeardFrom.lastWeek" = "last week"; +"AddressRecord.lastHeardFrom.lastMonth" = "last month"; +"AddressRecord.lastHeardFrom.LongTimeAgo" = "a long time ago"; +"AddressRecord.lastHeardFrom.Never" = "never"; "Attach" = "Attach"; "Attachment" = "Attachment"; "Authentification" = "Authentification"; diff --git a/enzevalos_iphone/persistentData/AddressRecord.swift b/enzevalos_iphone/persistentData/AddressRecord.swift index 5b7e1ab194ac6a5febe65e429009dc127e26349a..416e9a54b7eb34e7d446344cdd827bdadabba75f 100644 --- a/enzevalos_iphone/persistentData/AddressRecord.swift +++ b/enzevalos_iphone/persistentData/AddressRecord.swift @@ -189,21 +189,21 @@ extension AddressRecord: DisplayContact { } /// Casual string for recency of correspondence. - var lastHeardFrom: String { + var lastHeardFrom: LocalizedStringKey { if let lastHeard = last { let now = Date() switch now.timeIntervalSince(lastHeard) { case 0..<259200: - return "recently" + return "AddressRecord.lastHeardFrom.recently" case 259200..<604800: - return "last week" + return "AddressRecord.lastHeardFrom.lastWeek" case 259200..<2592000: - return "last month" + return "AddressRecord.lastHeardFrom.lastMonth" default: - return "a long time ago" + return "AddressRecord.lastHeardFrom.LongTimeAgo" } } else { - return "never" + return "AddressRecord.lastHeardFrom.Never" } } }