新增快捷发言永久隐藏逻辑

This commit is contained in:
huangjian
2022-10-08 16:02:49 +08:00
parent 1d184b4bee
commit da9549407a
2 changed files with 24 additions and 1 deletions

View File

@@ -1079,7 +1079,11 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
val rvSpeedyMessage =
speedyMessageContainer.findViewById<RecyclerView>(R.id.rv_speedy_message)
val phrases = AvRoomDataManager.get().phrases
if (ListUtils.isListEmpty(phrases) || !TimeUtils.isTomorrow(DemoCache.readSpeedyMessageGoneTime())) {
val closeSpeedyCount = DemoCache.readSeedMsgCount()
if (closeSpeedyCount >= 3 ||
ListUtils.isListEmpty(phrases) ||
!TimeUtils.isTomorrow(DemoCache.readSpeedyMessageGoneTime())
) {
speedyMessageContainer.visibility = View.GONE
return
}
@@ -1102,6 +1106,9 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
lastSendTime = CurrentTimeUtils.getCurrentTime()
StatisticManager.Instance()
.onEvent(StatisticsProtocol.EVENT_ROOM_QUICKCHAT_CLICK, "语音房_快捷发言")
if (closeSpeedyCount != -1) {
DemoCache.saveSeedMsgCount(-1)
}
} else {
val roomInfo =
AvRoomDataManager.get().mCurrentRoomInfo ?: return@setOnItemClickListener
@@ -1113,6 +1120,9 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
}
}
speedyMessageContainer.findViewById<View>(R.id.iv_close_speedy_message).setOnClickListener {
if (closeSpeedyCount != -1) {
DemoCache.saveSeedMsgCount(closeSpeedyCount + 1)
}
speedyMessageContainer.visibility = View.GONE
DemoCache.saveSpeedyMessageGoneTime(System.currentTimeMillis())
}

View File

@@ -57,6 +57,7 @@ public class DemoCache {
private static final String KEY_LAUNCH_COUNT = "key_launch_count";
private static final String KEY_RADISH_TIPS = "key_radish_tips";
private static final String KEY_KICK_OUT_ROOM = "kick_out_room";
private static final String KEY_SPEED_MSG_COUNT = "key_speed_msg_count";
private static StatusBarNotificationConfig notificationConfig;
@@ -327,4 +328,16 @@ public class DemoCache {
}
public static void saveSeedMsgCount(int count) {
SettingsPref.instance().putInt(KEY_SPEED_MSG_COUNT, count);
}
/**
* @return 快捷发言关闭次数, 0为初始值,-1为使用过快捷发言,不需要永久隐藏快捷发言
*/
public static int readSeedMsgCount() {
return SettingsPref.instance().getInt(KEY_SPEED_MSG_COUNT, 0);
}
}