aws-amplify / aws-amplify/amplify-android
HubChannel - How to define their own channels for intra-app communication.
- Dominant language
- Java
- Stars
- 287
- Forks
- 132
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 45
Description
### Before opening, please confirm:
- [X] I have [searched for duplicate or closed issues](https://github.com/aws-amplify/amplify-android/issues?q=is%3Aissue+) and [discussions](https://github.com/aws-amplify/amplify-android/discussions).
### 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.":
```java
/**
* 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
```java
// 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_
Contributor guide
Research direction
Start by reading the HubChannel enum and HubCategory.subscribe(@NonNull HubChannel, @NonNull HubSubscriber) described in the issue. Trace how Amplify category messages are dispatched and review the public API implications of allowing application-defined channels. Done means custom channels can be defined and used for intra-app communication without breaking existing Hub categories.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100