Skip to content

Commit

Permalink
Added 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Doo Rim authored and Doo Rim committed Aug 3, 2022
1 parent addd7bf commit 588c725
Show file tree
Hide file tree
Showing 121 changed files with 7,725 additions and 1,368 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

### v3.1.0 (Aug 3, 2022) with Core SDK `v4.0.5`
* Support Android 13
* Set the `maxSdkVersion` of `android.permission.READ_EXTERNAL_STORAGE` to `32`
* Removed `android.permission.REQUEST_INSTALL_PACKAGES` permission
* Support moderation in OpenChannel
* Added `MODERATIONS` in `OpenChannelSettingsMenuComponent.Menu`
* Added `OpenChannelModerationActivity`, `OpenChannelModerationFragment`, `OpenChannelModerationModule`, `OpenChannelModerationViewModel`
* Added `OpenChannelOperatorListActivity`, `OpenChannelOperatorListFragment`, `OpenChannelOperatorListModule`, `OpenChannelOperatorListViewModel`, `OpenChannelOperatorListAdapter`
* Added `OpenChannelRegisterOperatorActivity`, `OpenChannelRegisterOperatorFragment`, `OpenChannelRegisterOperatorModule`, `OpenChannelRegisterOperatorViewModel`, `OpenChannelRegisterOperatorAdapter`
* Added `OpenChannelBannedUserListActivity`, `OpenChannelBannedUserListFragment`, `OpenChannelBannedUserListModule`, `OpenChannelBannedUserListViewModel`, `OpenChannelBannedUserListAdapter`
* Added `OpenChannelMutedParticipantListActivity`, `OpenChannelMutedParticipantListFragment`, `OpenChannelMutedParticipantListModule`, `OpenChannelMutedParticipantListViewModel`, `OpenChannelMutedParticipantListAdapter`
* Added `newOpenChannelModerationFragment()`, `newOpenChannelOperatorListFragment()`, `newOpenChannelRegisterOperatorFragment()`, `newOpenChannelMutedParticipantListFragment()`, `newOpenChannelBannedUserListFragment()` in `UIKitFragmentFactory`
* Improved stability

### v3.0.0 (Jul 12, 2022) with Core SDK `v4.0.4`
* Support `modules` and `components` in the UIKit
* Added `setEditedTextMarkUIConfig(TextUIConfig, TextUIConfig)` in `OpenChannelFragment.Builder`
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,4 @@ dependencies {

After saving your `build.gradle` file, click the **Sync** button to apply all the changes.

<br />
<br />
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ org.gradle.jvmargs=-Xmx1536m
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true

UIKIT_VERSION = 3.0.0
UIKIT_VERSION = 3.1.0
UIKIT_VERSION_CODE = 1
4 changes: 2 additions & 2 deletions uikit-custom-sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
compileSdkVersion 32
compileSdkVersion 33

defaultConfig {
applicationId "com.sendbird.uikit.customsample"
minSdkVersion 21
targetSdkVersion 32
targetSdkVersion 33
versionCode 1
versionName "1.0"
multiDexEnabled true
Expand Down
1 change: 1 addition & 0 deletions uikit-custom-sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
package="com.sendbird.uikit.customsample">
<uses-permission android:name="android.permission.VIBRATE" android:maxSdkVersion="18"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

<application
android:name=".BaseApplication"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
package com.sendbird.uikit.customsample;

import android.Manifest;
import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.view.View;

import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.core.content.PermissionChecker;

import com.sendbird.android.SendbirdChat;
import com.sendbird.android.exception.SendbirdException;
Expand All @@ -23,9 +33,11 @@
import com.sendbird.uikit.customsample.openchannel.OpenChannelMainActivity;
import com.sendbird.uikit.customsample.utils.PreferenceUtils;
import com.sendbird.uikit.customsample.utils.PushUtils;
import com.sendbird.uikit.utils.ContextUtils;
import com.sendbird.uikit.widgets.WaitingDialog;

import java.util.List;
import java.util.Locale;
import java.util.Map;

/**
Expand All @@ -35,6 +47,11 @@ public class HomeActivity extends AppCompatActivity {
private ActivityHomeBinding binding;
private static final String USER_EVENT_HANDLER_KEY = "USER_EVENT_HANDLER_KEY" + System.currentTimeMillis();

@NonNull
private final ActivityResultLauncher<String> requestPermissionLauncher = registerForActivityResult(new ActivityResultContracts.RequestPermission(), isGranted -> {});
@NonNull
private final ActivityResultLauncher<Intent> appSettingLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), intent -> {});

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -50,6 +67,18 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {

binding.tvUnreadCount.setTextAppearance(this, R.style.SendbirdCaption3OnDark01);
binding.tvUnreadCount.setBackgroundResource(R.drawable.shape_badge_background);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
final String permission = Manifest.permission.POST_NOTIFICATIONS;
if (ContextCompat.checkSelfPermission(this, permission) == PermissionChecker.PERMISSION_GRANTED) {
return;
}
if (ActivityCompat.shouldShowRequestPermissionRationale(this, permission)) {
showPermissionRationalePopup(permission);
return;
}
requestPermissionLauncher.launch(permission);
}
}

@Override
Expand Down Expand Up @@ -127,4 +156,22 @@ public void onError(@NonNull SendbirdException e) {
}
});
}

private void showPermissionRationalePopup(@NonNull String permission) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getString(com.sendbird.uikit.R.string.sb_text_dialog_permission_title));
builder.setMessage(String.format(Locale.US, getString(R.string.sb_text_need_to_allow_permission_notification), ContextUtils.getApplicationName(this)));
builder.setPositiveButton(com.sendbird.uikit.R.string.sb_text_go_to_settings, (dialogInterface, i) -> {
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setData(Uri.parse("package:" + getPackageName()));
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
appSettingLauncher.launch(intent);
});
AlertDialog dialog = builder.create();
dialog.show();
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(ContextCompat.getColor(this, com.sendbird.uikit.R.color.secondary_300));
}
}
Loading

0 comments on commit 588c725

Please sign in to comment.