Skip to content

Commit

Permalink
fix bug where we remove messages that weren't shown
Browse files Browse the repository at this point in the history
  • Loading branch information
fire-at-will committed Oct 2, 2024
1 parent f12b407 commit 36d2788
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/Support/StoreMessagesHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,20 @@ actor StoreMessagesHelper: StoreMessagesHelperType {
}

func showStoreMessages(types: Set<StoreMessageType>) async {
var messagesToKeep: [StoreMessage] = []
for message in self.deferredMessages {
if let messageType = message.reason.messageType, types.contains(messageType) {
do {
try await message.display(in: self.systemInfo.currentWindowScene)
} catch {
Logger.error(Strings.storeKit.error_displaying_store_message(error))
messagesToKeep.append(message)
}
} else {
messagesToKeep.append(message)
}
}
self.deferredMessages.removeAll()
self.deferredMessages = messagesToKeep
}

#endif
Expand Down

0 comments on commit 36d2788

Please sign in to comment.