Skip to content

Commit

Permalink
fix up the ios side
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Sep 14, 2023
1 parent 43c5b0a commit d1aac76
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ios/Wrappers/DecodedMessageWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ struct ContentJson {
} else if let reaction = obj["reaction"] as? [String: Any] {
return ContentJson(type: ContentTypeReaction, content: Reaction(
reference: reaction["reference"] as? String ?? "",
action: ReactionAction(rawValue: reaction["action"] as? String ?? "") ?? .added,
action: ReactionAction(rawValue: reaction["action"] as? String ?? "") ,
content: reaction["content"] as? String ?? "",
schema: ReactionSchema(rawValue: reaction["schema"] as? String ?? "") ?? .unicode
schema: ReactionSchema(rawValue: reaction["schema"] as? String ?? "")
))
} else if let reply = obj["reply"] as? [String: Any] {
guard let nestedContent = reply["content"] as? [String: Any] else {
Expand Down
7 changes: 5 additions & 2 deletions ios/XMTPModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,13 @@ public class XMTPModule: Module {
throw Error.conversationNotFound("no conversation found for \(topic)")
}

let sortDirection: Int = (direction != nil && direction == "SORT_DIRECTION_ASCENDING") ? 1 : 2

let decodedMessages = try await conversation.messages(
limit: limit,
before: beforeDate,
after: afterDate,
direction: PagingInfoSortDirection(rawValue: direction ?? "SORT_DIRECTION_DESCENDING")
direction: PagingInfoSortDirection(rawValue: sortDirection)
)

return decodedMessages.compactMap { (msg) in
Expand Down Expand Up @@ -298,7 +300,8 @@ public class XMTPModule: Module {
}

if let directionStr = jsonObj["direction"] as? String {
direction = PagingInfoSortDirection(rawValue: direction ?? "SORT_DIRECTION_DESCENDING")
let sortDirection: Int = (directionStr == "SORT_DIRECTION_ASCENDING") ? 1 : 2
direction = PagingInfoSortDirection(rawValue: sortDirection) ?? .descending
}

let page = Pagination(
Expand Down

0 comments on commit d1aac76

Please sign in to comment.