SPB Git

Repository Public

ExtensionSupport.swift 1.3 KB 27 lines swift

1// Author: Simon-Pierre Boucher — contact@spboucher.ai2// File: Sources/ExtensionShared/ExtensionSupport.swift3// Description: What SP Mail's extensions (widgets, share extension, notification service) have in common: the brand colours without the4// app's design system, and the server address. Extensions read the shared store only; none of them opens the mail database.5import SPMailCore6import SPMailSystem7import SwiftUI89enum ExtColor {10    /// The app's accent (SPColor.accent), light and dark.11    static func accent(_ scheme: ColorScheme) -> Color { scheme == .dark ? Color(red: 0x7c / 255, green: 0xc4 / 255, blue: 0xae / 255) : Color(red: 0x2c / 255, green: 0x5b / 255, blue: 0x4d / 255) }12}1314enum ExtConfig {15    static let productionURL = URL(string: "https://mail.spboucher.ai")!16    /// The server the extension calls. A Release build only ever talks to the production server, whatever the shared state says: the17    /// session token is never sent to an address read from a file. Development builds follow the dev app (local backend).18    static func baseURL(_ state: ExtensionState?) -> URL {19        #if DEBUG20        return state.flatMap { URL(string: $0.baseURL) } ?? productionURL21        #else22        return productionURL23        #endif24    }25    static var isFrench: Bool { (Bundle.main.preferredLocalizations.first ?? "fr").hasPrefix("fr") }26}27
Files main
Menu

Theme