Settings

final class Settings : Encodable

A (hopefully) thread-safe singleton that provides modifiable global settings.

  • Wraps settings properties, making them thread-safe. All access to the internalValue should be done through the wrapper because of the thread-safety thing.

    See more

    Declaration

    Swift

    @propertyWrapper
    class SettingsValue<T> : Encodable where T : Encodable
  • Wraps settings properties, making them thread-safe. Contains methods for loading/storing values from a Redis hash. Use this for settings that should be database-backed.

    See more

    Declaration

    Swift

    @propertyWrapper
    class StoredSettingsValue<T>: SettingsValue<T>, StoredSetting
    where T: Encodable & RESPValueConvertible
  • The shared instance for this singleton.

    Declaration

    Swift

    static let shared: Settings
  • DispatchQueue to use for thread-safety synchronization.

    Declaration

    Swift

    fileprivate static let settingsQueue: <<error type>>
  • The ID of the blocked user placeholder.

    Declaration

    Swift

    @Settings
    .SettingsValue var blockedUserID: UUID { get set }
  • The ID of the FriendlyFez user placeholder.

    Declaration

    Swift

    @Settings
    .SettingsValue var friendlyFezID: UUID { get set }

Sections / Features / Apps

  • Each key-value pair identifies an application and a set of features disabled for that application. Either the app or the featureset may contain ‘.all’.

    Declaration

    Swift

    @Settings
    .StoredSettingsValue var disabledFeatures: DisabledFeaturesGroup { get set }
  • The name of the onboard Wifi network. Delivered to cients in the notification endpoint.

    Declaration

    Swift

    @Settings
    .StoredSettingsValue var shipWifiSSID: String { get set }
  • The URL to use when checking for automatic schedule updates. Genearlly a sched.com URL of the form https://jococruise2024.sched.com/all.ics Should always point to an URL that returns an iCalendar formatted file.

    Declaration

    Swift

    @Settings
    .StoredSettingsValue var scheduleUpdateURL: String { get set }

Limits

Quarantine

Dates

  • A Date set to midnight on the day the cruise ship leaves port, in the timezone the ship leaves from. Used by the Events Controller for date arithimetic. The default here should get overwritten in configure.swift. This is purely for convenience to set the start date via configure.swift. This setting should not be referenced anywhere. That’s what cruiseStartDate()` below is for. This must align with cruiseStartDayOfWeek set immediately below.

    Declaration

    Swift

    @Settings
    .SettingsValue var cruiseStartDateComponents: DateComponents { get set }
  • The day of week when the cruise embarks, expressed as number as Calendar’s .weekday uses them: Range 1…7, Sunday == 1. Doing DateComponents(year: 2024, month: 3, day: 9).weekday! didnt work here. Hmm….

    Declaration

    Swift

    @Settings
    .SettingsValue var cruiseStartDayOfWeek: Int { get set }
  • The length in days of the cruise, includes partial days. A cruise that embarks on Saturday and returns the next Saturday should have a value of 8.

    Declaration

    Swift

    @Settings
    .SettingsValue var cruiseLengthInDays: Int { get set }
  • TimeZone representative of where we departed port from. This should equal the TZ that Sched.com uses to list Events.

    Declaration

    Swift

    @Settings
    .SettingsValue var portTimeZone: TimeZone { get set }
  • Struct representing a set of TimeZoneChange’s for this cruise. This setting can then be referenced elsewhere in the application.

    Declaration

    Swift

    @Settings
    .SettingsValue var timeZoneChanges: TimeZoneChangeSet { get set }
  • Number of minutes before an event to trigger notifications. Some day this should be set per-user based on their preferences. But since we don’t have the concept of “User Settings” yet we set a sane default instead. This is a StoredSettingsValue so that it can be modified in real time. This is a Double because that’s what most range comparison operations desire. Though it does make this a bit more complex on the Server Settings views and [Site]AdminController because we expose them as Ints to the UI. This is to prevent anyone from using truly whacky values.

    Declaration

    Swift

    @Settings
    .StoredSettingsValue var upcomingEventNotificationSeconds: Double { get set }
  • Number of seconds after an upcoming event starts to no longer consider it happening. The desired default value means 5 minutes after an event starts notifications/banners will stop. However at this time, the AlertController does honor this and cycles the UserNotificationData.nextFollowedEventTime immediately afterward. Until that changes, this should be 0. This also might entirely go away? Here for consistency throughout the app, but possibly irrelevant.

    Declaration

    Swift

    @Settings
    .SettingsValue var upcomingEventPastSeconds: Double { get set }
  • Configuration of the upcoming event notifications.

    Declaration

    Swift

    @Settings
    .StoredSettingsValue var upcomingEventNotificationSetting: EventNotificationSetting { get set }
  • Configuration of the upcoming LFG notifications.

    Declaration

    Swift

    @Settings
    .StoredSettingsValue var upcomingLFGNotificationSetting: EventNotificationSetting { get set }
  • Enable Late Day Flip where the site UI shows the next days schedule after 3:00AM rather than after Midnight. For example, with this setting enabled opening the schedule at 2:00AM on Thursday will show you Wednesday’s schedule by default. If this setting is disabled, at 2:00AM on Thursday you would see Thursdays schedule by default.

    Declaration

    Swift

    @Settings
    .SettingsValue var enableLateDayFlip: Bool { get set }

Images

  • The set of image file types that we can parse with the GD library. I believe GD hard-codes these values on install based on what ./configure finds. If our server app is moved to a new machine after it’s built, the valid input types will likely differ.

    Declaration

    Swift

    @Settings
    .SettingsValue var validImageInputTypes: [String] { get set }
  • The set of image file types that we can create with the GD library. I believe GD hard-codes these values on install based on what ./configure finds. If our server app is moved to a new machine after it’s built, the valid input types will likely differ.

    Declaration

    Swift

    @Settings
    .SettingsValue var validImageOutputTypes: [String] { get set }
  • If FALSE, animated images are converted into static jpegs upon upload. Does not affect already uploaded images.

    Declaration

    Swift

    @Settings
    .StoredSettingsValue var allowAnimatedImages: Bool { get set }
  • Set the size of automatically generated image thumbnails. This is the height value in pixels.

    Declaration

    Swift

    @Settings
    .SettingsValue var imageThumbnailSize: Int { get set }

Directories

  • Root dir for files used by Swiftarr. The front-end’s CSS, JS, static image files, all the Leaf templates are in here, as are all the seeds files used for database migrations by the backend.. The Resources and Seeds dirs get copied into this dir from the root of the git repo by the build system.

    Declaration

    Swift

    @Settings
    .SettingsValue var staticFilesRootPath: URL { get set }
  • User uploaded images will be inside this dir.

    Declaration

    Swift

    @Settings
    .SettingsValue var userImagesRootPath: URL { get set }

URLs