Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Qiscus.getChatConfig()
- .setEnableFcmPushNotification(true)
- .setOnlyEnablePushNotificationOutsideChatRoom(true)
- .setNotificationBigIcon(R.mipmap.ic_launcher)
- .setNotificationSmallIcon(R.mipmap.ic_launcher)
- .setNotificationClickListener((context, qiscusComment) -> {
- if (SystemEventUtil.isSystemEvent(qiscusComment) &&
- SystemEventUtil.getExtraPayloadType(qiscusComment)
- .equals(RealTimeChatroomHandler.SystemEvent.REMOVE_MEMBER)) {
- return;
- } else {
- ChatRoomNavigator
- .openChatRoom(context, qiscusComment)
- .withParentClass(MainActivity.class)
- .start();
- }
- })
- .setSwipeRefreshColorScheme(R.color.colorPrimary, R.color.colorAccent)
- .setLeftBubbleColor(R.color.leftBubble)
- .setLeftBubbleTextColor(R.color.qiscus_primary_text)
- .setLeftBubbleTimeColor(R.color.qiscus_secondary_text)
- .setLeftLinkTextColor(R.color.qiscus_primary_text)
- .setLeftProgressFinishedColor(R.color.colorPrimary)
- .setRightBubbleColor(R.color.colorPrimaryLight)
- .setRightProgressFinishedColor(R.color.colorPrimaryLight)
- .setSelectedBubbleBackgroundColor(R.color.colorPrimary)
- .setReadIconColor(R.color.colorPrimary)
- .setAppBarColor(R.color.colorPrimary)
- .setStatusBarColor(R.color.colorPrimaryDark)
- .setAccentColor(R.color.colorAccent)
- .setAccountLinkingTextColor(R.color.colorPrimary)
- .setAccountLinkingBackground(R.color.accountLinkingBackground)
- .setButtonBubbleTextColor(R.color.colorPrimary)
- .setButtonBubbleBackBackground(R.color.accountLinkingBackground)
- .setReplyBarColor(R.color.colorPrimary)
- .setReplySenderColor(R.color.colorPrimary)
- .setSendButtonIcon(R.drawable.ic_default_send)
- .setStopRecordIcon(R.drawable.ic_send_on)
- .setCancelRecordIcon(R.drawable.ic_cancel_record)
- .setEmptyRoomImageResource(R.drawable.ic_empty_chat_room)
- .setEmptyRoomTitle("It's so quiet over here")
- .setEmptyRoomSubtitle("Start by sending message, file or even a voice ")
- .setQiscusImageCompressionConfig(new QiscusImageCompressionConfig()
- .setMaxHeight(1920.0f)
- .setMaxWidth(1080.0f)
- .setQuality(100)
- )
- .setNotificationBuilderInterceptor((notificationBuilder, qiscusComment) -> {
- if (SystemEventUtil.isSystemEvent(qiscusComment)) {
- JsonObject extraPayload = SystemEventUtil.getExtraPayload(qiscusComment);
- JsonObject payload = extraPayload.get("payload").getAsJsonObject();
- String payloadAgoraCall = extraPayload.get("object_username").toString();
- payloadAgoraCall.substring(1, payloadAgoraCall.length() - 1);
- String typeExtra = extraPayload.get("type").toString();
- String checkTypeFirst = typeExtra.substring(1);
- String checkTypeLast = checkTypeFirst.substring(0, checkTypeFirst.length() - 1);
- if (payload.get("system_event_type") != null) {
- String checkadmin = payload.get("system_event_type").toString();
- String checkadminFirst = checkadmin.substring(1);
- String checkadminLast = checkadminFirst.substring(0, checkadminFirst.length() - 1);
- if (checkadminLast.equals("remove_group_admin") || checkadminLast.equals("add_group_admin")) {
- return true;
- }
- }
- if (checkTypeLast.equals("create_room") || checkTypeLast.equals("left_room")) {
- return true;
- }
- if (payload.has("system_event_type")) {
- if (payload.get("system_event_type").getAsString().equals("call"))
- return false;
- }
- if (payloadAgoraCall.substring(1, payloadAgoraCall.length() - 1).equals("System")) {
- return false;
- }
- }
- NotifBadgeUtil.updateCount(getApplicationContext());
- if (!ChatPreferencesHelper.getInstance().isEnableNotification()
- || !ChatPreferencesHelper.getInstance().isEnableNotification(qiscusComment.getRoomId())) {
- return false;
- }
- Uri sound = Uri.parse(ChatPreferencesHelper.getInstance().getRingtone(qiscusComment.getRoomId()));
- boolean vibrate = ChatPreferencesHelper.getInstance().isEnableVibration(qiscusComment.getRoomId());
- @ColorInt int ledColor = ChatPreferencesHelper.getInstance().getLedColor(qiscusComment.getRoomId());
- notificationBuilder.setSound(sound).setLights(ledColor, 3000, 2000);
- if (vibrate) {
- notificationBuilder.setVibrate(new long[]{100, 300, 600, 300, 100});
- }
- return true;
- })
- .setEnableForwardComment(true)
- .setForwardCommentHandler(comments -> startActivity(ForwardActivity.generateIntent(this, comments)
- .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)))
- .getDeleteCommentConfig()
- .setEnableDeleteComment(true)
- .setEnableHardDelete(true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement