open-remora

Open Remora, a free secondary dive computer for Apple Watch Ultra
git clone https://git.schurger.org/open-remora.git
Log | Files | Refs | README | LICENSE

PhoneSync.swift (1945B)


      1 // SPDX-License-Identifier: GPL-2.0-only
      2 import Foundation
      3 import RemoraDeco
      4 import RemoraUI
      5 
      6 /// What the watch sends to the iPhone (WatchConnectivity). The watch is the only source:
      7 /// the iPhone shows the settings and stores the dives, it sends nothing back.
      8 enum PhoneSync {
      9     /// Application context (latest state, replaced at every send): settings and send date.
     10     static let settingsKey = "settings"
     11     static let sentAtKey = "sentAt"
     12     /// Metadata of a transferred file: one dive (`DiveLog` as JSON).
     13     static let kindKey = "kind"
     14     static let diveKind = "dive"
     15 
     16     static let encoder: JSONEncoder = {
     17         let e = JSONEncoder()
     18         e.dateEncodingStrategy = .iso8601
     19         e.outputFormatting = [.sortedKeys]
     20         return e
     21     }()
     22 
     23     static let decoder: JSONDecoder = {
     24         let d = JSONDecoder()
     25         d.dateDecodingStrategy = .iso8601
     26         return d
     27     }()
     28 }
     29 
     30 /// Folder shared with Sub Rascasse (app group of the team). See `docs/SHARING.md`.
     31 enum SharedFolder {
     32     static let appGroup = "group.org.schurger.dive"
     33     /// Open Rémora dives waiting to be imported: one `<id>.json` (DiveLog) and one `<id>.uddf` per dive.
     34     /// Sub Rascasse deletes them once imported. The folder name is part of the contract: do not rename it.
     35     static let outboxPath = "OpenRemora/Plongees"
     36 }
     37 
     38 /// Warning to accept at first launch, on the watch as on the iPhone (text and view come from RemoraUI).
     39 /// Changing `version` makes the user accept it again.
     40 enum AppTerms {
     41     static let link = URL(string: "https://agora.schurger.org/open-remora/")!
     42     static let privacy = URL(string: "https://agora.schurger.org/open-remora/confidentialite/")!
     43     static let terms = Terms(version: 1, acceptedKey: "termsAcceptedVersion", appName: "Open Rémora",
     44                              devicePoint: String(localized: "The watch can fail or measure wrongly during the dive."),
     45                              link: link)
     46 }