Skip to content

Commit

Permalink
Updated fetch url
Browse files Browse the repository at this point in the history
  • Loading branch information
Mcrich23 committed Nov 26, 2023
1 parent 18899b7 commit f5773a2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Seattle Bridge Tracker/Content View/ContentViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class ContentViewModel: ObservableObject {
let noImage = URL(string: "https://st4.depositphotos.com/14953852/22772/v/600/depositphotos_227725020-stock-illustration-image-available-icon-flat-vector.jpg")!

func fetchData(repeatFetch: Bool) {
Task(priority: .background) {
Task {
await self.fetchDataInternal()
try await Task.sleep(nanoseconds: 2_000_000_000) // Wait 2 seconds
if repeatFetch {
Expand Down
18 changes: 11 additions & 7 deletions Seattle Bridge Tracker/Fetch Data.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import Foundation
import Firebase
import HTTPStatusCodes

enum HttpError: Error {
Expand All @@ -14,15 +15,18 @@ enum HttpError: Error {
}

class TwitterFetch {
private var url: URL? {
if Utilities.appType == .AppStore {
guard let urlString = Utilities.remoteConfig["fetchUrl"].stringValue else { return nil }
return URL(string: urlString)
} else {
guard let urlString = Utilities.remoteConfig["betaFetchUrl"].stringValue else { return nil }
return URL(string: urlString)
}
}

func fetchTweet(errorHandler: @escaping (HTTPStatusCode) -> Void, completion: @escaping ([Response]) -> Void) {
do {
var url: URL? {
if Utilities.appType == .AppStore {
return URL(string: "http://mc.mcrich23.com/bridges/")
} else {
return URL(string: "http://mc.mcrich23.com/beta/bridges/")
}
}

guard let url else { return }

Expand Down
4 changes: 4 additions & 0 deletions Seattle Bridge Tracker/RemoteConfigDefaults.plist
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@
<true/>
<key>revenueCatApiKey</key>
<string>appl_XnjQYrhRdrIQdPtXGGXrzkaUpmc</string>
<key>fetchUrl</key>
<string>https://backend.mcrich23.com/bridges</string>
<key>betaFetchUrl</key>
<string>https://backend.mcrich23.com/beta/bridges</string>
</dict>
</plist>

0 comments on commit f5773a2

Please sign in to comment.