Skip to content
Snippets Groups Projects
Select Git revision
  • 6e16c76ecec05dbb434d464b9f777095e14b8c35
  • dev default protected
  • 316-tracking-estimator
  • Thesis_hannes_merge_ready_versuch1
  • InboxWithNewOverview
  • 298-missing-backend-features-connections-for-ui
  • 293-integrate-attachment-functionality-in-new-composeview
  • 299-add-pull-to-refresh-to-maillistview
  • 290+Dev
  • 290-redesign-the-ContactView
  • 291-add-research-face-prototype
  • 292-add-comments-to-attachmentviewmain-swift
  • 302-fix-bug-attachment-previews-of-incoming-mails
  • 288-make-folders-list-slide-in-from-the-left-instead-of-from-the-right
  • 295-inboxview-maillistview-improvements
  • 294-fix-bugs-in-new-composeview
  • 287-redesign-composeview
  • updatePGP
  • 282-Implement-missing-functions-in-reply-button
  • 286-update-openssl
  • ThesisHannesV2_
  • runnable
  • optional_UI_change
  • dep
  • NoTestCase
25 results

ReadMainView.swift

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    ReadMainView.swift 2.66 KiB
    //
    //  ReadMainView.swift
    //  enzevalos_iphone
    //
    //  This program is free software: you can redistribute it and/or modify
    //  it under the terms of the GNU General Public License as published by
    //  the Free Software Foundation, either version 3 of the License, or
    //  (at your option) any later version.
    //
    //  This program is distributed in the hope that it will be useful,
    //  but WITHOUT ANY WARRANTY; without even the implied warranty of
    //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    //  GNU General Public License for more details.
    //
    //  You should have received a copy of the GNU General Public License
    //  along with this program.  If not, see <https://www.gnu.org/licenses/>.
    
    import SwiftUI
    
    struct ReadMainView <M: DisplayMail>: View {
        
        public var mail: M
                
        var body: some View {
            TabView{
                ForEach(Tabs, id: \.id ){ tab in
                    tab.content
                        .tabItem {
                            tab.image
                            Text(tab.description)
                    }
                }
            }
        }
        
        //TODO: not use AnyView-workaround
        var Tabs:[Tab] {
            get {
                return [
                    Tab(
                        image: Image(systemName: "shield"),
                        description: "security",
                        content:AnyView(SecurityBriefingView(mail: mail))
                    ),
                    Tab(
                        image: Image(systemName: "person.fill"),
                        description: "sender",
                        content: AnyView(SenderViewMain<M>(mail: mail))
                    ),
                    Tab(
                        image: Image(systemName: "text.bubble.fill"),
                        description: "message",
                        content: AnyView(MessageViewMain<M>(mail: mail))
                    ),
                    Tab(
                        image: Image(systemName: "rectangle.and.paperclip"),
                        description: "attachments",
                        content: AnyView(AttachmentsViewMain(attachments: mail.displayAttachments, dlAll: true))
                    )                
                ]
            }
        }
    }
    
    
    struct Tab {
        let id = UUID()
        
        var image       : Image         = Image(systemName: "tag.fill")
        var description : String        = "---"
        var content     : AnyView       = AnyView(Text("Still in development"))
    }
    
    
    #if DEBUG
    struct Layout_Previews: PreviewProvider {
        static let simulator = Simulators<ReadMainView<ProxyMail>>()
        static let deviceNames: [String] = [
            "iPhone SE",
            "iPhone 11 Pro Max"
        ]
        
      static var previews: some View {
            simulator.previews(view: ReadMainView(mail: ProxyData.SecureMail))
       }
    }
    #endif