purple: improve environment handling

This commit improves the handling of different Purple environments:

- 3 environments were added (test, staging, production) to fulfill all
  testing needs

- Damus website constants were also added (This will become important
  for the next few commits)

- Toggle settings were replaced with a picker, where the user can select
  one of the 3 environments (test, staging, production)

- Damus purple page and website address links can now be obtained
  directly from the DamusPurple struct, which improves flexibility and
  reduces complexity for code that consumes these constants.

Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
Daniel D’Aquino
2024-01-30 07:41:38 +00:00
committed by William Casarin
parent 992b0f2eba
commit dd240899cf
7 changed files with 104 additions and 29 deletions

View File

@@ -205,8 +205,8 @@ class UserSettingsStore: ObservableObject {
@Setting(key: "enable_experimental_purple_api", default_value: false)
var enable_experimental_purple_api: Bool
@Setting(key: "purple_api_staging", default_value: false)
var purple_api_staging: Bool
@StringSetting(key: "purple_environment", default_value: .production)
var purple_enviroment: DamusPurpleEnvironment
@Setting(key: "emoji_reactions", default_value: default_emoji_reactions)
var emoji_reactions: [String]