Skip to content

Instantly share code, notes, and snippets.

@nparsons08

nparsons08/Account.swift Secret

Created May 4, 2020
Embed
What would you like to do?
// ios/TheStream/Account.swift:100
private func setupFeed() {
Alamofire
.request("\(apiRoot)/v1/stream-feed-credentials",
method: .post,
headers: ["Authorization" : "Bearer \(authToken!)"])
.responseJSON { [weak self] response in
let body = response.value as! NSDictionary
let feedToken = body["token"]! as! String
let appId = body["appId"] as! String
let apiKey = body["apiKey"] as! String
if let user = self?.user {
GetStream.Client.config = .init(apiKey: apiKey,
appId: appId)
GetStream.Client.shared.setupUser(
GetStreamActivityFeed.User(name: user,
id: user),
token: feedToken
) { [weak self] (result) in
self?.userFeed = Client.shared.flatFeed(feedSlug: "user")
self?.timelineFeed = Client.shared.flatFeed(feedSlug: "timeline")
self?.setupChat()
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.