Skip to content
Snippets Groups Projects
Select Git revision
  • d3510f7772f8be21a2325ef680b7d40c13d4180d
  • release default
  • master protected
  • XX-4441
  • Jakub/rootless-CI
  • Anne/CI-Test
  • waitingRoundsRewrite
  • quantumSecure
  • fullRateLimit
  • XX-3564/TlsCipherSuite
  • hotfix/groupNotification
  • Josh/RateLimiting
  • debug/sourceOfErrors
  • XX-3540/TestCert
  • f76/error
  • notls
  • url-repo-rename
  • feature/dynamicAuthRemoval
  • jono/yaml
  • version-2_5_3
  • hotfix/signing
  • v3.13.0
  • v3.11.0
  • v3.10.0
  • v3.9.0
  • v3.7.0
  • v3.6.0
  • v3.5.0
  • v3.1.0
  • v2.2.8
  • v2.2.7
  • v2.1.0
  • v2.0.0
  • v1.7.0
  • v1.6.0
  • v1.5.0
  • v1.4.2
  • v1.4.1
  • v1.4.0
  • v1.3.2
  • v1.3.1
41 results

benchmark.go

Blame
  • ResetAuthView.swift 1.84 KiB
    import AppCore
    import ComposableArchitecture
    import SwiftUI
    
    public struct ResetAuthView: View {
      public init(store: Store<ResetAuthState, ResetAuthAction>) {
        self.store = store
      }
    
      let store: Store<ResetAuthState, ResetAuthAction>
    
      struct ViewState: Equatable {
        init(state: ResetAuthState) {
          contactID = try? state.partner.getId()
          isResetting = state.isResetting
          failure = state.failure
          didReset = state.didReset
        }
    
        var contactID: Data?
        var isResetting: Bool
        var failure: String?
        var didReset: Bool
      }
    
      public var body: some View {
        WithViewStore(store, observe: ViewState.init) { viewStore in
          Form {
            Section {
              Text(viewStore.contactID?.hexString() ?? "")
                .font(.footnote.monospaced())
                .textSelection(.enabled)
            } header: {
              Label("ID", systemImage: "number")
            }
    
            Button {
              viewStore.send(.resetTapped)
            } label: {
              HStack {
                Text("Reset authenticated channel")
                Spacer()
                if viewStore.isResetting {
                  ProgressView()
                } else if viewStore.didReset {
                  Image(systemName: "checkmark")
                    .foregroundColor(.green)
                }
              }
            }
            .disabled(viewStore.isResetting)
    
            if let failure = viewStore.failure {
              Section {
                Text(failure)
              } header: {
                Text("Error")
              }
            }
          }
          .navigationTitle("Reset auth")
        }
      }
    }
    
    #if DEBUG
    public struct ResetAuthView_Previews: PreviewProvider {
      public static var previews: some View {
        NavigationView {
          ResetAuthView(store: Store(
            initialState: ResetAuthState(
              partner: .unimplemented(Data())
            ),
            reducer: .empty,
            environment: ()
          ))
        }
      }
    }
    #endif