Skip to content

Commit 1d3bcc7

Browse files
committed
fix: handle event sending for own tokens in community token notifier
1 parent 989bc97 commit 1d3bcc7

1 file changed

Lines changed: 15 additions & 16 deletions

File tree

lib/app/features/tokenized_communities/providers/community_token_ion_connect_notifier_provider.r.dart

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,24 +79,23 @@ class CommunityTokenIonConnectService {
7979

8080
if (isOwnToken) {
8181
await _ionConnectNotifier.sendEvent(tokenDefinitionFirstBuyEvent);
82-
return;
82+
} else {
83+
await _ionConnectNotifier
84+
.sendEvent(
85+
tokenDefinitionFirstBuyEvent,
86+
actionSource: ActionSource.user(communityTokenDefinition.masterPubkey),
87+
metadataBuilders: [_userEventsMetadataBuilder],
88+
// Since we're sending this event only to the token owner, if owner shares
89+
// relays with the current user, we need to retry the sending to the current
90+
// user's relays in case of is-relay-authoritative error.
91+
ignoreAuthoritativeErrors: false,
92+
)
93+
.catchError(
94+
(_) => _ionConnectNotifier.sendEvent(tokenDefinitionFirstBuyEvent),
95+
test: RelayAuthService.isRelayAuthoritativeError,
96+
);
8397
}
8498

85-
await _ionConnectNotifier
86-
.sendEvent(
87-
tokenDefinitionFirstBuyEvent,
88-
actionSource: ActionSource.user(communityTokenDefinition.masterPubkey),
89-
metadataBuilders: [_userEventsMetadataBuilder],
90-
// Since we're sending this event only to the token owner, if owner shares
91-
// relays with the current user, we need to retry the sending to the current
92-
// user's relays in case of is-relay-authoritative error.
93-
ignoreAuthoritativeErrors: false,
94-
)
95-
.catchError(
96-
(_) => _ionConnectNotifier.sendEvent(tokenDefinitionFirstBuyEvent),
97-
test: RelayAuthService.isRelayAuthoritativeError,
98-
);
99-
10099
await _cacheTokenDefinitionFirstBuyReference(
101100
tokenDefinitionFirstBuyEvent: tokenDefinitionFirstBuyEvent,
102101
);

0 commit comments

Comments
 (0)