Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JcMinarro committed Jul 24, 2023
1 parent bc2fbfc commit 90111aa
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Finally, add the `FirebasePushDeviceGenerator` to your `NotificationConfig` and

```kotlin {2,5}
val notificationConfig = NotificationConfig(
pushDeviceGenerators = listOf(FirebasePushDeviceGenerator())
pushDeviceGenerators = listOf(FirebasePushDeviceGenerator(providerName = "providerName"))
)
ChatClient.Builder("apiKey", context)
.notifications(notificationConfig)
Expand All @@ -42,11 +42,15 @@ ChatClient.Builder("apiKey", context)

```java
boolean pushNotificationEnabled = true;
List<PushDeviceGenerator> pushDeviceGeneratorList = Collections.singletonList(new FirebasePushDeviceGenerator());
NotificationConfig notificationConfig = new NotificationConfig(pushNotificationEnabled, pushDeviceGeneratorList);
new ChatClient.Builder("apiKey", context)
.notifications(notificationConfig)
.build();
List<PushDeviceGenerator> pushDeviceGeneratorList = Collections.singletonList(
new FirebasePushDeviceGenerator(
"providerName"
)
);
NotificationConfig notificationConfig = new NotificationConfig(true, pushDeviceGeneratorList);
new ChatClient.Builder("apiKey", context)
.notifications(notificationConfig)
.build();
```
</TabItem>
</Tabs>
Expand All @@ -72,7 +76,7 @@ class CustomFirebaseMessagingService : FirebaseMessagingService() {
override fun onNewToken(token: String) {
// Update device's token on Stream backend
try {
FirebaseMessagingDelegate.registerFirebaseToken(token, "optional-provider-name")
FirebaseMessagingDelegate.registerFirebaseToken(token, "providerName")
} catch (exception: IllegalStateException) {
// ChatClient was not initialized
}
Expand Down Expand Up @@ -102,7 +106,7 @@ public final class CustomFirebaseMessagingService extends FirebaseMessagingServi
public void onNewToken(@NonNull String token) {
// Update device's token on Stream backend
try {
FirebaseMessagingDelegate.registerFirebaseToken(token, "optional-provider-name");
FirebaseMessagingDelegate.registerFirebaseToken(token, "providerName");
} catch (IllegalStateException exception) {
// ChatClient was not initialized
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ val notificationConfig = NotificationConfig(
pushDeviceGenerators = listOf(
HuaweiPushDeviceGenerator(
context = context,
appId = "YOUR HUAWEI APP ID"
appId = "YOUR HUAWEI APP ID",
providerName = "provierName",
)
)
)
Expand All @@ -50,7 +51,13 @@ ChatClient.Builder("apiKey", context)

```java
boolean pushNotificationEnabled = true;
List<PushDeviceGenerator> pushDeviceGeneratorList = Collections.singletonList(new HuaweiPushDeviceGenerator(context, "YOUR HUAWEI APP ID", null));
List<PushDeviceGenerator> pushDeviceGeneratorList = Collections.singletonList(
new HuaweiPushDeviceGenerator(
context,
"YOUR HUAWEI APP ID",
"provierName"
)
);
NotificationConfig notificationConfig = new NotificationConfig(true, pushDeviceGeneratorList);
new ChatClient.Builder("apiKey", context)
.notifications(notificationConfig)
Expand Down Expand Up @@ -80,7 +87,7 @@ class CustomHuaweiMessagingService : HmsMessageService() {
override fun onNewToken(token: String) {
// Update device's token on Stream backend
try {
HuaweiMessagingDelegate.registerHuaweiToken(token, "optional-provider-name")
HuaweiMessagingDelegate.registerHuaweiToken(token, "providerName")
} catch (exception: IllegalStateException) {
// ChatClient was not initialized
}
Expand Down Expand Up @@ -109,7 +116,7 @@ public final class CustomHuaweiMessagingService extends HmsMessageService {
public void onNewToken(String token) {
// Update device's token on Stream backend
try {
HuaweiMessagingDelegate.registerHuaweiToken(token, "optional-provider-name");
HuaweiMessagingDelegate.registerHuaweiToken(token, "providerName");
} catch (IllegalStateException exception){
// ChatClient was not initialized
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ Then, create a `XiaomiPushDeviceGenerator` and add it to the list of generators
<Tabs>
<TabItem value="kotlin" label="Kotlin">

```kotlin {3-7,11}
```kotlin {3-8,12}
val notificationConfig = NotificationConfig(
pushDeviceGenerators = listOf(
XiaomiPushDeviceGenerator(
context = context,
appId = "YOUR XIAOMI APP ID",
appKey = "YOUR XIAOMI APP KEY",
providerName = "providerName",
)
)
)
Expand All @@ -52,7 +53,7 @@ ChatClient.Builder("apiKey", context)

```java
boolean pushNotificationEnabled = true;
List<PushDeviceGenerator> pushDeviceGeneratorList = Collections.singletonList(new XiaomiPushDeviceGenerator(context, "YOUR HUAWEI APP ID", "YOUR XIAOMI APP KEY", null, Region.Global));
List<PushDeviceGenerator> pushDeviceGeneratorList = Collections.singletonList(new XiaomiPushDeviceGenerator(context, "YOUR HUAWEI APP ID", "YOUR XIAOMI APP KEY", "providerName", Region.Global));
NotificationConfig notificationConfig = new NotificationConfig(true, pushDeviceGeneratorList);
new ChatClient.Builder("apiKey", context)
.notifications(notificationConfig)
Expand Down Expand Up @@ -82,7 +83,7 @@ class CustomPushMessageReceiver : PushMessageReceiver() {
override fun onReceiveRegisterResult(context: Context, miPushCommandMessage: MiPushCommandMessage) {
// Update device's token on Stream backend
try {
XiaomiMessagingDelegate.registerXiaomiToken(miPushCommandMessage, "optional-provider-name")
XiaomiMessagingDelegate.registerXiaomiToken(miPushCommandMessage, "providerName")
} catch (exception: IllegalStateException) {
// ChatClient was not initialized
}
Expand Down Expand Up @@ -112,7 +113,7 @@ public final class CustomPushMessageReceiver extends PushMessageReceiver {
public void onReceiveRegisterResult(Context context, MiPushCommandMessage miPushCommandMessage) {
// Update device's token on Stream backend
try {
XiaomiMessagingDelegate.registerXiaomiToken(miPushCommandMessage, "optional-provider-name");
XiaomiMessagingDelegate.registerXiaomiToken(miPushCommandMessage, "providerName");
} catch (IllegalStateException exception) {
// ChatClient was not initialized
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import androidx.annotation.NonNull;
import androidx.core.app.NotificationCompat;

import com.google.firebase.messaging.FirebaseMessaging;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.huawei.hms.push.HmsMessageService;
Expand Down Expand Up @@ -176,8 +175,7 @@ public void configureFirebaseNotifications(Context context) {
boolean pushNotificationEnabled = true;
List<PushDeviceGenerator> pushDeviceGeneratorList = Collections.singletonList(
new FirebasePushDeviceGenerator(
FirebaseMessaging.getInstance(),
"Firebase"
"providerName"
)
);
NotificationConfig notificationConfig = new NotificationConfig(true, pushDeviceGeneratorList);
Expand All @@ -195,7 +193,7 @@ public final class CustomFirebaseMessagingService extends FirebaseMessagingServi
public void onNewToken(@NonNull String token) {
// Update device's token on Stream backend
try {
FirebaseMessagingDelegate.registerFirebaseToken(token, "optional-provider-name");
FirebaseMessagingDelegate.registerFirebaseToken(token, "providerName");
} catch (IllegalStateException exception) {
// ChatClient was not initialized
}
Expand Down Expand Up @@ -226,7 +224,9 @@ class Huawei {
*/
public void configureHuaweiNotifications(Context context) {
boolean pushNotificationEnabled = true;
List<PushDeviceGenerator> pushDeviceGeneratorList = Collections.singletonList(new HuaweiPushDeviceGenerator(context, "YOUR HUAWEI APP ID", null));
List<PushDeviceGenerator> pushDeviceGeneratorList = Collections.singletonList(
new HuaweiPushDeviceGenerator(context, "YOUR HUAWEI APP ID", "providerName")
);
NotificationConfig notificationConfig = new NotificationConfig(true, pushDeviceGeneratorList);
new ChatClient.Builder("apiKey", context)
.notifications(notificationConfig)
Expand All @@ -241,7 +241,7 @@ public final class CustomHuaweiMessagingService extends HmsMessageService {
public void onNewToken(String token) {
// Update device's token on Stream backend
try {
HuaweiMessagingDelegate.registerHuaweiToken(token, "optional-provider-name");
HuaweiMessagingDelegate.registerHuaweiToken(token, "providerName");
} catch (IllegalStateException exception) {
// ChatClient was not initialized
}
Expand Down Expand Up @@ -271,7 +271,7 @@ class Xiaomi {
*/
public void configureXiaomiNotifications(Context context) {
boolean pushNotificationEnabled = true;
List<PushDeviceGenerator> pushDeviceGeneratorList = Collections.singletonList(new XiaomiPushDeviceGenerator(context, "YOUR HUAWEI APP ID", "YOUR XIAOMI APP KEY", null, Region.Global));
List<PushDeviceGenerator> pushDeviceGeneratorList = Collections.singletonList(new XiaomiPushDeviceGenerator(context, "YOUR HUAWEI APP ID", "YOUR XIAOMI APP KEY", "providerName", Region.Global));
NotificationConfig notificationConfig = new NotificationConfig(true, pushDeviceGeneratorList);
new ChatClient.Builder("apiKey", context)
.notifications(notificationConfig)
Expand All @@ -287,7 +287,7 @@ class CustomPushMessageReceiver extends PushMessageReceiver {
public void onReceiveRegisterResult(Context context, MiPushCommandMessage miPushCommandMessage) {
// Update device's token on Stream backend
try {
XiaomiMessagingDelegate.registerXiaomiToken(miPushCommandMessage, "optional-provider-name");
XiaomiMessagingDelegate.registerXiaomiToken(miPushCommandMessage, "providerName");
} catch (IllegalStateException exception) {
// ChatClient was not initialized
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class Push {
override fun onNewToken(token: String) {
// Update device's token on Stream backend
try {
HuaweiMessagingDelegate.registerHuaweiToken(token, "optional-provider-name")
HuaweiMessagingDelegate.registerHuaweiToken(token, "providerName")
} catch (exception: IllegalStateException) {
// ChatClient was not initialized
}
Expand Down Expand Up @@ -271,7 +271,7 @@ class Push {
override fun onReceiveRegisterResult(context: Context, miPushCommandMessage: MiPushCommandMessage) {
// Update device's token on Stream backend
try {
XiaomiMessagingDelegate.registerXiaomiToken(miPushCommandMessage, "optional-provider-name")
XiaomiMessagingDelegate.registerXiaomiToken(miPushCommandMessage, "providerName")
} catch (exception: IllegalStateException) {
// ChatClient was not initialized
}
Expand Down

0 comments on commit 90111aa

Please sign in to comment.