aws-amplify / amplify-android

The fastest and easiest way to use AWS from your Android app.
https://docs.amplify.aws/lib/q/platform/android/
Apache License 2.0
247 stars 117 forks source link

HubChannel - How to define their own channels for intra-app communication. #1738

Open kzhang-dsg opened 2 years ago

kzhang-dsg commented 2 years ago

Before opening, please confirm:

Language and Async Model

Java

Amplify Categories

Not applicable

Gradle script dependencies

```groovy // Put output below this line // Amplify core dependency implementation 'com.amplifyframework:core:1.35.2' // Support for Java 8 features coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' // Amplify analytics implementation 'com.amplifyframework:aws-analytics-pinpoint:1.35.2' implementation 'com.amplifyframework:aws-auth-cognito:1.35.2' // Amplify auth (Cognito) implementation 'com.amplifyframework:aws-auth-cognito:1.35.2' ```

Environment information

``` # Put output below this line ------------------------------------------------------------ Gradle 7.2 ------------------------------------------------------------ Build time: 2021-08-17 09:59:03 UTC Revision: a773786b58bb28710e3dc96c4d1a7063628952ad Kotlin: 1.5.21 Groovy: 3.0.8 Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020 JVM: 1.8.0_275 (AdoptOpenJDK 25.275-b01) OS: Linux 5.4.0-109-generic amd64 ```

Please include any relevant guides or documentation you're referencing

No response

Describe the feature request

In the HubChannel class, it said "Apps can define their own channels for intra-app communication.":

/**
 * HubChannel represents the channels on which Amplify category messages will be dispatched.
 * Apps can define their own channels for intra-app communication. Internally, Amplify uses the Hub
 * for dispatching notifications about events associated with different categories.
 */
public enum HubChannel {

But in the HubCategory.subscribe(@NonNull HubChannel hubChannel, @NonNull HubSubscriber hubSubscriber) method, the method only accepts the HubChannel enum. Which means we can not extend and define custom channels.

Could you please change the HubChannel to an interface instead of enum to make it extandable?

Initialization steps (if applicable)

No response

Code Snippet

// Put your code below this line.

amplifyconfiguration.json

No response

GraphQL Schema

```graphql // Put your schema below this line ```

Additional information and screenshots

No response

ankpshah commented 9 months ago

Hello thank you for creating the issue, someone from our team will get back on this.