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

@@ -14,8 +14,18 @@ class Constants {
static let DEVICE_TOKEN_RECEIVER_TEST_URL: URL = URL(string: "http://localhost:8000/user-info")!
static let MAIN_APP_BUNDLE_IDENTIFIER: String = "com.jb55.damus2"
static let NOTIFICATION_EXTENSION_BUNDLE_IDENTIFIER: String = "com.jb55.damus2.DamusNotificationService"
// MARK: Purple
// API
static let PURPLE_API_LOCAL_TEST_BASE_URL: URL = URL(string: "http://localhost:8989")!
static let PURPLE_API_STAGING_BASE_URL: URL = URL(string: "https://api-staging.damus.io")!
static let PURPLE_API_PRODUCTION_BASE_URL: URL = URL(string: "https://api.damus.io")!
static let PURPLE_API_TEST_BASE_URL: URL = URL(string: "https://api-staging.damus.io")!
static let PURPLE_LANDING_PAGE_TEST_URL: URL = URL(string: "https://staging.damus.io/purple")!
// Purple landing page
static let PURPLE_LANDING_PAGE_LOCAL_TEST_URL: URL = URL(string: "http://localhost:3000")!
static let PURPLE_LANDING_PAGE_STAGING_URL: URL = URL(string: "https://staging.damus.io/purple")!
static let PURPLE_LANDING_PAGE_PRODUCTION_URL: URL = URL(string: "https://damus.io/purple")!
// Website
static let DAMUS_WEBSITE_LOCAL_TEST_URL: URL = URL(string: "http://localhost:3000")!
static let DAMUS_WEBSITE_STAGING_URL: URL = URL(string: "https://staging.damus.io")!
static let DAMUS_WEBSITE_PRODUCTION_URL: URL = URL(string: "https://damus.io")!
}