Skip to content

Hub.publisher does not receive all events #3980

Open
@Robuske

Description

@Robuske

Describe the bug

The Hub.publisher(for:) does not receive all events that Hub.listen(to:) receives.

From what I have observed events like Amplify.configured, Auth.signedIn and Auth.signedOut are not received by the publisher (probably more).
Important to note that it does receive the internal events like InternalConfigureAuth, Auth.signInAPI and Auth.signOutAPI.

From my (brief) investigation of the library I believe some places are calling the HubCategory.dispatch, which sends to the publisher and the plugin, while others are calling the HubCategoryPlugin.dispatch directly.

Steps To Reproduce

1. Configure a `Amplify.Hub.listen(to: .auth)` and a `Amplify.Hub.publisher(for: .auth)`
2. Configure `Amplify` with the plugin `AWSCognitoAuthPlugin`
3. Sign in
4. Sign out
5. Observe the difference in the events between the `listener` and the `publisher`.

Expected behavior

The listener and the publisher should receive the same events.

Amplify Framework Version

2.46.1

Amplify Categories

Auth

Dependency manager

Swift PM

Swift version

6.1

CLI version

Not using

Xcode version

16.3 (16E140)

Relevant log output

<details>
<summary>Log Messages</summary>


INSERT LOG MESSAGES HERE

</details>

Is this a regression?

No

Regression additional context

No response

Platforms

iOS

OS Version

18.4

Device

Any

Specific to simulators

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcoreAmplify Core components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions