field_ios

In-the-field app for Radroots on iOS
git clone https://radroots.dev/git/field_ios.git
Log | Files | Refs | README | LICENSE

AppEntry.swift (1527B)


      1 import SwiftUI
      2 
      3 public enum TeraAppRelease: Sendable {
      4   public static let version = "0.1.0-alpha"
      5 }
      6 
      7 public struct TeraAppView: View {
      8   public init() {}
      9 
     10   public var body: some View {
     11     TeraProvider {
     12       AppEntry()
     13     }
     14   }
     15 }
     16 
     17 struct AppEntry: View {
     18   @EnvironmentObject private var appModel: TeraAppModel
     19 
     20   var body: some View {
     21     #if DEBUG
     22       if ProcessInfo.processInfo.environment["TERA_IOS_UI_TEST_SHELL"] == "1",
     23         ProcessInfo.processInfo.environment["TERA_IOS_UI_TEST_ACCESSIBILITY"] != nil
     24       {
     25         TeraAccessibilityUITestSurface()
     26       } else {
     27         product
     28       }
     29     #else
     30       product
     31     #endif
     32   }
     33 
     34   private var product: some View {
     35     Group {
     36       if case let .running(snapshot) = appModel.phase {
     37         TeraRootShell(
     38           snapshot: snapshot,
     39           stores: appModel.productStores
     40         )
     41       } else {
     42         RuntimeStatusView(
     43           phase: appModel.phase,
     44           retry: { Task { await appModel.retry() } },
     45           createIdentity: { Task { await appModel.createIdentity() } },
     46           importIdentity: { material in
     47             Task { await appModel.importIdentity(material) }
     48           },
     49           unlockIdentity: { Task { await appModel.unlockIdentity() } },
     50           recoverIdentity: { Task { await appModel.recoverIdentity() } },
     51           applyConfigurationReconfiguration: {
     52             Task { await appModel.applyConfigurationReconfiguration() }
     53           }
     54         )
     55       }
     56     }
     57     .accessibilityIdentifier("radroots.app_entry")
     58   }
     59 }