field_ios

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

TeraGeneratedTodayPage.swift (735B)


      1 import Foundation
      2 import TeraKitBindings
      3 
      4 extension FfiTodayPageRecord {
      5   func appValue() throws -> TeraTodayPage {
      6     let viewer = try calendar.appValue()
      7     guard schemaVersion == 2, viewer.asOfUnixSeconds == asOfUnixS else {
      8       throw TeraCalendarTiming.unsupported
      9     }
     10     return try TeraTodayPage(
     11       asOfUnixSeconds: asOfUnixS, items: items.map { try $0.appValue() },
     12       nextCursor: nextCursor, projectionGeneration: projectionGeneration, calendar: viewer
     13     )
     14   }
     15 }
     16 
     17 extension FfiTodayCardType {
     18   var appValue: TeraTodayCardType {
     19     switch self {
     20     case .update: .update
     21     case .photoUpdate: .photoUpdate
     22     case .ask: .ask
     23     case .event: .event
     24     case .foodAvailability: .foodAvailability
     25     }
     26   }
     27 }