From ee9a61dd43c5a55a667a73008e76df94937d3d72 Mon Sep 17 00:00:00 2001 From: anitarua Date: Fri, 16 Aug 2024 15:06:21 -0700 Subject: [PATCH] clean up ios app: readme and configurable api base url --- .../ModeratedChat/TranslationApi.swift | 3 ++- ios/README.md | 25 ++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/ios/ModeratedChat/ModeratedChat/TranslationApi.swift b/ios/ModeratedChat/ModeratedChat/TranslationApi.swift index 29dd67c..6e253e9 100644 --- a/ios/ModeratedChat/ModeratedChat/TranslationApi.swift +++ b/ios/ModeratedChat/ModeratedChat/TranslationApi.swift @@ -5,7 +5,7 @@ import Alamofire @MainActor class TranslationApi: ObservableObject { static let shared = TranslationApi() - private let baseUrl = "https://57zovcekn0.execute-api.us-west-2.amazonaws.com/prod"; + private let baseUrl: String = ProcessInfo.processInfo.environment["API_BASE_URL"]! @Published var selectedLanguageCode: String = "en" @Published var supportedLanguages: [Language] = [] @Published var currentUsername: String = "" @@ -17,6 +17,7 @@ class TranslationApi: ObservableObject { } func createToken() async -> MomentoToken { + do { let user = getUser() currentUsername = user.username diff --git a/ios/README.md b/ios/README.md index 625ba39..a888e5a 100644 --- a/ios/README.md +++ b/ios/README.md @@ -1,6 +1,23 @@ -# Moderated Chat using iOS Client +# iOS Moderated Chat App -## Running the example using the Xcode simulator +This directory contains an iOS client of the Moderated Chat demo. -1. Open the `ios/moderated_chat` directory as an Xcode project. -3. Click Run (in the Product menu). \ No newline at end of file +## Prerequisites + +- [Xcode](https://developer.apple.com/xcode/) + +## Running the demo + +Create an environment variable to specify the base URL for your API endpoints. + +```bash +VITE_API_BASE_URL="https://chat-api.your-chosen-domain-name.com" +``` + +You may also need to specify a variable to enable logging output: + +```bash +IDEPreferLogStreaming=YES +``` + +To run the app using a simulator, simply open the `ios/moderated_chat` directory as an Xcode project and click "Run".