Skip to content

Commit

Permalink
Merge pull request #128 from shine2008/master
Browse files Browse the repository at this point in the history
feat(IMKit): 10.4.0版本发布
  • Loading branch information
shine2008 authored Nov 2, 2024
2 parents 197773b + 93a4aeb commit 5eb49ea
Show file tree
Hide file tree
Showing 28 changed files with 347 additions and 181 deletions.
2 changes: 1 addition & 1 deletion aisearchkit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ android {
defaultConfig {
minSdk = 24
consumerProguardFiles("consumer-rules.pro")
buildConfigField("String", "versionName", "\"10.3.1\"")
buildConfigField("String", "versionName", "\"10.4.0\"")
}

buildTypes {
Expand Down
16 changes: 8 additions & 8 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ android {
applicationId = "com.netease.yunxin.app.im"
minSdk = 24
versionCode = 1
versionName = "10.3.2"
versionName = "10.4.0"
multiDexEnabled = true
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -54,16 +54,16 @@ dependencies {
// implementation(project(":aisearchkit"))

//远端aar依赖
implementation("com.netease.yunxin.kit.contact:contactkit-ui:10.3.2")
implementation("com.netease.yunxin.kit.conversation:conversationkit-ui:10.3.2")
implementation("com.netease.yunxin.kit.team:teamkit-ui:10.3.2")
implementation("com.netease.yunxin.kit.chat:chatkit-ui:10.3.2")
implementation("com.netease.yunxin.kit.locationkit:locationkit:10.3.2")
implementation("com.netease.yunxin.kit.aisearchkit:aisearchkit:10.3.2")
implementation("com.netease.yunxin.kit.contact:contactkit-ui:10.4.0")
implementation("com.netease.yunxin.kit.conversation:conversationkit-ui:10.4.0")
implementation("com.netease.yunxin.kit.team:teamkit-ui:10.4.0")
implementation("com.netease.yunxin.kit.chat:chatkit-ui:10.4.0")
implementation("com.netease.yunxin.kit.locationkit:locationkit:10.4.0")
implementation("com.netease.yunxin.kit.aisearchkit:aisearchkit:10.4.0")


implementation("com.netease.yunxin.kit.call:call-ui:2.2.0") //呼叫组件 UI 包
implementation("com.netease.nimlib:avsignalling:10.3.0-beta") //信令组件
implementation("com.netease.nimlib:avsignalling:10.5.0") //信令组件
implementation("com.airbnb.android:lottie:5.0.3")
implementation("com.github.bumptech.glide:glide:4.13.1")
implementation("com.squareup.retrofit2:retrofit:2.9.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private void initView() {
boolean isCommonSkin =
AppSkinConfig.getInstance().getAppSkinStyle() == AppSkinConfig.AppSkin.commonSkin;
ALog.d(Constant.PROJECT_TAG, "MainActivity:initView");
// loadConfig();
// loadConfig();
List<Fragment> fragments = new ArrayList<>();

// 根据皮肤类型加载不同的Fragment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

package com.netease.yunxin.app.im.welcome;

import static com.netease.yunxin.app.im.IMApplication.LOGIN_PARENT_SCOPE;
import static com.netease.yunxin.app.im.IMApplication.LOGIN_SCOPE;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
Expand All @@ -23,46 +20,47 @@
import com.netease.yunxin.app.im.main.MainActivity;
import com.netease.yunxin.app.im.utils.Constant;
import com.netease.yunxin.kit.alog.ALog;
import com.netease.yunxin.kit.chatkit.IMKitConfigCenter;
import com.netease.yunxin.kit.common.ui.activities.BaseActivity;
import com.netease.yunxin.kit.common.ui.utils.ToastX;
import com.netease.yunxin.kit.corekit.im2.IMKitClient;
import com.netease.yunxin.kit.corekit.im2.extend.FetchCallback;

/** 启动页面 如果没有登录则展示登录按钮,点击登录按钮进入登录页面 如果已经登录则直接进入主页面 */
/**
* 启动页面 如果没有登录则展示登录按钮,点击登录按钮进入登录页面 如果已经登录则直接进入主页面
*/
public class WelcomeActivity extends BaseActivity {

private static final String TAG = "WelcomeActivity";
private ActivityWelcomeBinding activityWelcomeBinding;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ALog.d(Constant.PROJECT_TAG, TAG, "onCreateView");
IMApplication.setColdStart(true);
activityWelcomeBinding = ActivityWelcomeBinding.inflate(getLayoutInflater());
setContentView(activityWelcomeBinding.getRoot());
// 判断是否已经登录
if (TextUtils.isEmpty(NIMClient.getCurrentAccount())) {
startLogin();
} else {
showMainActivityAndFinish();
private static final String TAG = "WelcomeActivity";
private ActivityWelcomeBinding activityWelcomeBinding;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ALog.d(Constant.PROJECT_TAG, TAG, "onCreateView");
IMApplication.setColdStart(true);
activityWelcomeBinding = ActivityWelcomeBinding.inflate(getLayoutInflater());
setContentView(activityWelcomeBinding.getRoot());
// 判断是否已经登录
if (TextUtils.isEmpty(NIMClient.getCurrentAccount())) {
startLogin();
} else {
showMainActivityAndFinish();
}
}

// 进入主页面并结束当前页面
private void showMainActivityAndFinish() {
ALog.d(Constant.PROJECT_TAG, TAG, "showMainActivityAndFinish");
Intent intent = new Intent();
intent.setClass(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
this.startActivity(intent);
finish();
}
}

// 进入主页面并结束当前页面
private void showMainActivityAndFinish() {
ALog.d(Constant.PROJECT_TAG, TAG, "showMainActivityAndFinish");
Intent intent = new Intent();
intent.setClass(this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
this.startActivity(intent);
finish();
}

// 开始登录
private void startLogin() {
ALog.d(Constant.PROJECT_TAG, TAG, "startLogin");

// 开始登录
private void startLogin() {
ALog.d(Constant.PROJECT_TAG, TAG, "startLogin");

//填入你的 account and token
String account = "";
Expand Down
6 changes: 3 additions & 3 deletions chatkit-ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ android {
dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
// imuikit 底层库
api("com.netease.yunxin.kit.chat:chatkit:10.3.2")
api("com.netease.yunxin.kit.common:common-ui:1.3.7")
api("com.netease.yunxin.kit.core:corekit-plugin:1.1.2-rc01")
api("com.netease.yunxin.kit.chat:chatkit:10.4.0")
api("com.netease.yunxin.kit.common:common-ui:1.3.8")
api("com.netease.yunxin.kit.core:corekit-plugin:1.1.3")

api("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21")
implementation("androidx.appcompat:appcompat:1.4.2")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,8 @@ public class ChatKitUIConstant {
public static final String KEY_COLLECTION_SENDER_AVATAR = "avatar";
public static final String KEY_COLLECTION_CONVERSATION_NAME = "conversationName";
public static final String KEY_COLLECTION_MESSAGE = "message";
//消息可撤回的最小时间限制
public static final long MESSAGE_REVOKE_TIME_MIN = 2;
//消息可撤回的最大时间限制
public static final long MESSAGE_REVOKE_TIME_MAX = 10080;
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,13 @@ public class ChatUIConfig {

//输入框定制
public InputProperties inputProperties;

// 撤回操作时间限制,单位分钟,客户端限制,需要小于云信控制台配置时间才有用
public Long revokeTimeGap;

//撤回重新编辑时间,时间单位分钟,默认为两分钟
public Long revokeEditTimeGap;

//是否使用权限说明弹窗
public Boolean showPermissionPop;
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
/** 消息相关工具类,主要用于创建消息,消息内容解析等 */
public class MessageHelper {

public static final int REVOKE_TIME_INTERVAL = 2 * 60 * 1000;
//撤回可编辑时间,单位毫秒
public static final long REVOKE_TIME_INTERVAL = 2 * 60 * 1000;

public static final float DEF_SCALE = 0.6f;
public static final float SMALL_SCALE = 0.4F;
Expand Down Expand Up @@ -555,9 +556,15 @@ private static void viewSetText(View textView, SpannableString mSpannableString)
*/
public static boolean revokeMsgIsEdit(ChatMessageBean data) {
V2NIMMessage message = data.getMessageData().getMessage();
long gapTime = REVOKE_TIME_INTERVAL;
if (ChatKitClient.getChatUIConfig() != null
&& ChatKitClient.getChatUIConfig().revokeEditTimeGap != null) {
// 分钟转换为毫秒
gapTime = ChatKitClient.getChatUIConfig().revokeEditTimeGap * 60000;
}
return !isReceivedMessage(data)
&& canRevokeEdit(data.getMessageData().getMessage())
&& (System.currentTimeMillis() - message.getCreateTime() < REVOKE_TIME_INTERVAL)
&& (SystemClock.elapsedRealtime() - data.revokeMsgTime < gapTime)
&& data.revokeMsgEdit;
}

Expand Down Expand Up @@ -1491,6 +1498,7 @@ public static void sendForwardMessage(
ToastX.showShortToast(R.string.chat_message_removed_tip);
}
}

// 发送转发消息(逐条转发)
public static void sendForwardMessages(
String inputMsg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.netease.nimlib.sdk.media.record.AudioRecorder;
Expand All @@ -53,15 +52,11 @@
import com.netease.yunxin.kit.chatkit.ui.view.message.audio.ChatMessageAudioControl;
import com.netease.yunxin.kit.common.ui.action.ActionItem;
import com.netease.yunxin.kit.common.ui.dialog.BottomChoiceDialog;
import com.netease.yunxin.kit.common.ui.utils.Permission;
import com.netease.yunxin.kit.common.ui.utils.ToastX;
import com.netease.yunxin.kit.common.utils.KeyboardUtils;
import com.netease.yunxin.kit.common.utils.NetworkUtils;
import com.netease.yunxin.kit.common.utils.PermissionUtils;
import com.netease.yunxin.kit.common.utils.XKitUtils;
import com.netease.yunxin.kit.corekit.im2.IMKitClient;
import java.io.File;
import java.util.List;

/**
* 聊天界面底部输入布局
Expand Down Expand Up @@ -139,7 +134,7 @@ public void init(IMessageProxy proxy) {
(v, event) -> {
ALog.d(LIB_TAG, TAG, "inputAudioTv OnTouch, event:" + event.getAction());
if (event.getAction() == MotionEvent.ACTION_DOWN) {
if (mProxy.hasPermission(Manifest.permission.RECORD_AUDIO)) {
if (mProxy.hasPermission(new String[] {Manifest.permission.RECORD_AUDIO})) {
showAudioInputDialog();
} else {
return false;
Expand Down Expand Up @@ -761,30 +756,8 @@ public void onLocationClick() {
String[] permissions = {
Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION
};
if (PermissionUtils.hasPermissions(IMKitClient.getApplicationContext(), permissions)) {
if (mProxy.hasPermission(permissions)) {
mProxy.sendLocationLaunch();
} else {
Permission.requirePermissions(IMKitClient.getApplicationContext(), permissions)
.request(
new Permission.PermissionCallback() {
@Override
public void onGranted(List<String> permissionsGranted) {
mProxy.sendLocationLaunch();
}

@Override
public void onDenial(
List<String> permissionsDenial, List<String> permissionDenialForever) {
Toast.makeText(getContext(), R.string.permission_default, Toast.LENGTH_SHORT)
.show();
}

@Override
public void onException(Exception exception) {
Toast.makeText(getContext(), R.string.permission_default, Toast.LENGTH_SHORT)
.show();
}
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public interface IMessageProxy {

void onTypeStateChange(boolean isTyping);

boolean hasPermission(String permission);
boolean hasPermission(String[] permission);

void onCustomAction(View view, String action);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import static com.netease.yunxin.kit.chatkit.ui.ChatKitUIConstant.LIB_TAG;
import static com.netease.yunxin.kit.corekit.im2.utils.RouterConstant.KEY_REVOKE_EDIT_TAG;
import static com.netease.yunxin.kit.corekit.im2.utils.RouterConstant.KEY_REVOKE_TAG;
import static com.netease.yunxin.kit.corekit.im2.utils.RouterConstant.KEY_REVOKE_TIME_TAG;

import android.text.TextUtils;
import com.netease.nimlib.sdk.v2.conversation.enums.V2NIMConversationType;
Expand Down Expand Up @@ -43,13 +44,20 @@ public ChatMessageBean(IMMessageInfo messageData) {
if (localExtensionMap != null && localExtensionMap.containsKey(KEY_REVOKE_TAG)) {
Object revokeLocal = localExtensionMap.get(KEY_REVOKE_TAG);
Object revokeEdit = localExtensionMap.get(KEY_REVOKE_EDIT_TAG);
Object revokeTime = localExtensionMap.get(KEY_REVOKE_TIME_TAG);
if (revokeLocal instanceof Boolean) {
isRevoked = (Boolean) revokeLocal;
}

if (revokeEdit instanceof Boolean) {
revokeMsgEdit = (Boolean) revokeEdit;
}

if (revokeTime instanceof Integer) {
revokeMsgTime = (Integer) revokeTime;
} else if (revokeTime instanceof Long) {
revokeMsgTime = (Long) revokeTime;
}
}

initReplyMessage();
Expand All @@ -67,6 +75,7 @@ public ChatMessageBean(IMMessageInfo messageData) {
boolean isRevoked;

public boolean revokeMsgEdit = true;
public long revokeMsgTime = 0;

// 上传进度 % 0-100
public int progress;
Expand Down Expand Up @@ -107,13 +116,21 @@ public void setMessageData(IMMessageInfo messageData) {
if (localExtensionMap != null && localExtensionMap.containsKey(KEY_REVOKE_TAG)) {
Object revokeLocal = localExtensionMap.get(KEY_REVOKE_TAG);
Object revokeEdit = localExtensionMap.get(KEY_REVOKE_EDIT_TAG);
Object revokeTime = localExtensionMap.get(KEY_REVOKE_TIME_TAG);

if (revokeLocal instanceof Boolean) {
isRevoked = (Boolean) revokeLocal;
}

if (revokeEdit instanceof Boolean) {
revokeMsgEdit = (Boolean) revokeEdit;
}

if (revokeTime instanceof Integer) {
revokeMsgTime = (Integer) revokeTime;
} else if (revokeTime instanceof Long) {
revokeMsgTime = (Long) revokeTime;
}
}

initReplyMessage();
Expand Down
Loading

0 comments on commit 5eb49ea

Please sign in to comment.