Skip to content

Commit

Permalink
update logging
Browse files Browse the repository at this point in the history
  • Loading branch information
llbartekll committed Aug 31, 2023
1 parent e10d22d commit 34805cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ class NotifySubscribeResponseSubscriber {
networkingInteractor.responseSubscription(on: protocolMethod)
.sink { [unowned self] (payload: ResponseSubscriptionPayload<NotifySubscriptionPayload.Wrapper, NotifySubscriptionResponsePayload.Wrapper>) in
Task(priority: .high) {
logger.debug("NotifySubscribeResponseSubscriber: Received Notify Subscribe response")
logger.debug("Received Notify Subscribe response")

guard
let (responsePayload, _) = try? NotifySubscriptionResponsePayload.decodeAndVerify(from: payload.response)
else { fatalError() /* TODO: Handle error */ }

guard let responseKeys = kms.getAgreementSecret(for: payload.topic) else {
logger.debug("NotifySubscribeResponseSubscriber: no symmetric key for topic \(payload.topic)")
logger.debug("No symmetric key for topic \(payload.topic)")
return subscriptionErrorSubject.send(Errors.couldNotCreateSubscription)
}

Expand All @@ -77,15 +77,15 @@ class NotifySubscribeResponseSubscriber {
metadata = try dappsMetadataStore.get(key: payload.topic)
let availableTypes = try await subscriptionScopeProvider.getSubscriptionScope(dappUrl: metadata!.url)
subscribedTypes = availableTypes.filter{subscribedScope.contains($0.name)}
logger.debug("NotifySubscribeResponseSubscriber: subscribing notify subscription topic: \(notifySubscriptionTopic!)")
logger.debug("subscribing notify subscription topic: \(notifySubscriptionTopic!)")
try await networkingInteractor.subscribe(topic: notifySubscriptionTopic)
} catch {
logger.debug("NotifySubscribeResponseSubscriber: error: \(error)")
logger.debug("error: \(error)")
return subscriptionErrorSubject.send(Errors.couldNotCreateSubscription)
}

guard let metadata = metadata else {
logger.debug("NotifySubscribeResponseSubscriber: no metadata for topic: \(notifySubscriptionTopic!)")
logger.debug("No metadata for topic: \(notifySubscriptionTopic!)")
return subscriptionErrorSubject.send(Errors.couldNotCreateSubscription)
}
dappsMetadataStore.delete(forKey: payload.topic)
Expand All @@ -95,7 +95,7 @@ class NotifySubscribeResponseSubscriber {

try await notifyStorage.setSubscription(notifySubscription)

logger.debug("NotifySubscribeResponseSubscriber: unsubscribing response topic: \(payload.topic)")
logger.debug("Unsubscribing response topic: \(payload.topic)")
networkingInteractor.unsubscribe(topic: payload.topic)
}
}.store(in: &publishers)
Expand Down
1 change: 1 addition & 0 deletions Sources/Web3Inbox/Web3InboxClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public final class Web3InboxClient {

public var logsPublisher: AnyPublisher<Log, Never> {
logger.logsPublisher
.merge(with: notifyClient.logsPublisher)
.eraseToAnyPublisher()
}

Expand Down

0 comments on commit 34805cf

Please sign in to comment.