Skip to content

Commit

Permalink
Added 2.1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
rimdoo committed Sep 23, 2021
1 parent 38f2a67 commit 4e7c257
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

### v2.1.8 (Sep 23, 2021) with Core SDK `v3.0.172`
* Added `getMessageTootip(int count)` in `ChannelFragment`.
* Added `initFromForeground(SendBirdUIKitAdapter adapter, Context context)` in `SendBirdUIKit`.

### v2.1.7 (August 19, 2021) with Core SDK `v3.0.170`
* Added filtering logics for channel events by custom message list params.
* Added filtering logics for channel list events by custom channel list query.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true
android.enablerD8=true

UIKIT_VERSION = 2.1.7
UIKIT_VERSION = 2.1.8
UIKIT_VERSION_CODE = 1

2 changes: 1 addition & 1 deletion uikit-custom-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ android {
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
// implementation project(":uikit")
implementation "com.sendbird.sdk:uikit:2.1.7"
implementation "com.sendbird.sdk:uikit:2.1.8"

implementation "androidx.multidex:multidex:2.0.1"
implementation 'com.google.firebase:firebase-messaging:21.0.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
import com.sendbird.android.BaseMessage;
import com.sendbird.android.FileMessageParams;
import com.sendbird.android.UserMessageParams;
import com.sendbird.uikit.customsample.R;
import com.sendbird.uikit.customsample.models.CustomMessageType;
import com.sendbird.uikit.fragments.ChannelFragment;

import java.util.Locale;

public class CustomChannelFragment extends ChannelFragment {
private CustomMessageType customMessageType = CustomMessageType.NONE;

Expand Down Expand Up @@ -79,6 +82,19 @@ protected void resendMessage(@NonNull BaseMessage message) {
super.resendMessage(message);
}

@Override
protected String getTooltipMessage(int count) {
String result = "";
if (count <= 1) {
result = String.format(Locale.US, getString(R.string.sb_text_channel_tooltip), count);
} else if (count <= 9) {
result = String.format(Locale.US, getString(R.string.sb_text_channel_tooltip_with_count), count);
} else {
result = getString(R.string.sb_text_channel_tooltip_with_count_over_10);
}
return result;
}

public void setCustomMessageType(CustomMessageType customMessageType) {
this.customMessageType = customMessageType;
}
Expand Down
1 change: 1 addition & 0 deletions uikit-custom-sample/src/main/res/values-ko-rKR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<string name="sb_text_channel_message_badge_edited">&#160;(편집됨)</string>
<string name="sb_text_channel_tooltip">새 메시지 %d개</string>
<string name="sb_text_channel_tooltip_with_count">새 메시지 %d개</string>
<string name="sb_text_channel_tooltip_with_count_over_10">10개 이상</string>
<string name="sb_text_channel_anchor_copy">복사</string>
<string name="sb_text_channel_anchor_save">저장</string>
<string name="sb_text_channel_anchor_edit">편집</string>
Expand Down
1 change: 1 addition & 0 deletions uikit-custom-sample/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@
<string name="text_error_connection_must_be_made">Connection must be made.</string>
<string name="text_error_update_user_information">Couldn\&#39;t update user information.</string>
<string name="text_error_update_do_not_disturb">Couldn\&#39;t update disturb setting.</string>
<string name="sb_text_channel_tooltip_with_count_over_10">Over 10 messages</string>
</resources>
2 changes: 1 addition & 1 deletion uikit-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ android {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// implementation project(":uikit")
implementation "com.sendbird.sdk:uikit:2.1.7"
implementation "com.sendbird.sdk:uikit:2.1.8"

implementation "androidx.multidex:multidex:2.0.1"
implementation 'com.google.firebase:firebase-messaging:21.0.0'
Expand Down
2 changes: 1 addition & 1 deletion uikit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

// Sendbird
api 'com.sendbird.sdk:sendbird-android-sdk:3.0.170'
api 'com.sendbird.sdk:sendbird-android-sdk:3.0.172'

implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
Expand Down
21 changes: 20 additions & 1 deletion uikit/src/main/java/com/sendbird/uikit/SendBirdUIKit.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,28 @@ static void clearAll() {
* @param context <code>Context</code> of <code>Application</code>.
*/
public synchronized static void init(@NonNull SendBirdUIKitAdapter adapter, @NonNull Context context) {
init(adapter, context, false);
}

/**
* Initializes Sendbird from foreground with given app ID.
*
* @param adapter The {@link SendBirdUIKitAdapter} providing an app ID, a information of the user.
* @param context <code>Context</code> of <code>Application</code>.
* @since 2.1.8
*/
public synchronized static void initFromForeground(@NonNull SendBirdUIKitAdapter adapter, @NonNull Context context) {
init(adapter, context, true);
}

private synchronized static void init(@NonNull SendBirdUIKitAdapter adapter, @NonNull Context context, boolean isForeground) {
SendBirdUIKit.adapter = adapter;
SendBirdUIKit.setResizingSize(new Pair<>(DEFAULT_RESIZING_WIDTH_SIZE, DEFAULT_RESIZING_HEIGHT_SIZE));
SendBird.init(adapter.getAppId(), context);
if (isForeground) {
SendBird.initFromForeground(adapter.getAppId(), context);
} else {
SendBird.init(adapter.getAppId(), context);
}
FileUtils.removeDeletableDir(context.getApplicationContext());

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,16 +785,6 @@ public void onActivityResult(int requestCode, int resultCode, @Nullable Intent d
}
}

private String getTooltipMessage(int count) {
String result = "";
if (count > 1) {
result = String.format(Locale.US, getString(R.string.sb_text_channel_tooltip_with_count), count);
} else if (count == 1) {
result = String.format(Locale.US, getString(R.string.sb_text_channel_tooltip), count);
}
return result;
}

private void sendMessage(View view) {
Logger.dev("++ onClick()");
if (view.getId() == binding.vgInputBox.getBinding().ibtnSend.getId()) {
Expand Down Expand Up @@ -950,6 +940,23 @@ public boolean shouldShowLoadingDialog() {
public void shouldDismissLoadingDialog() {
}

/**
* It will be called when the tooltip retrieve a text to show the information of new messages.
*
* @param count Number of newly added messages.
* @return Text to show in tooltip.
* @since 2.1.8
*/
protected String getTooltipMessage(int count) {
String result = "";
if (count > 1) {
result = String.format(Locale.US, getString(R.string.sb_text_channel_tooltip_with_count), count);
} else if (count == 1) {
result = String.format(Locale.US, getString(R.string.sb_text_channel_tooltip), count);
}
return result;
}

private String getEditTextString() {
return binding.vgInputBox.getInputText();
}
Expand Down

0 comments on commit 4e7c257

Please sign in to comment.