77 加入房间前判断上一个房间是否游戏中,日志上传后删除之前的日志数据。
This commit is contained in:
@@ -288,5 +288,12 @@ open class Application : CommonAppContext() {
|
||||
return APP_CONTENT
|
||||
}
|
||||
|
||||
fun getAppLogPath(): String {
|
||||
return LOGUTILS_SAVE_PATH
|
||||
}
|
||||
|
||||
fun getAppCrashPath(): String {
|
||||
return CRASHUTILS_SAVE_PATH
|
||||
}
|
||||
|
||||
}
|
||||
@@ -111,12 +111,11 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
|
||||
@Override
|
||||
public void onRefPitchUpdate(float refPitch, int numberOfRefPitches) {
|
||||
mKaraokeView.setPitch(refPitch);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLineFinished(KaraokeView view, LyricsLineModel line, int score, int cumulativeScore, int index, int numberOfLines) {
|
||||
LogUtils.e("onLineFinished :" + score + " " + cumulativeScore + " " + index + " " + numberOfLines);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.blankj.utilcode.util.ActivityUtils;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.xscm.modulemain.activity.room.contacts.RoomContacts;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.BeforeJoinRoomCheckBean;
|
||||
import com.xscm.moduleutil.bean.RedPacketInfo;
|
||||
import com.xscm.moduleutil.bean.RoomCharmRankBean;
|
||||
import com.xscm.moduleutil.bean.TasksMessage;
|
||||
@@ -40,7 +41,24 @@ public class RoomPresenter extends BasePresenter<RoomContacts.View> implements R
|
||||
// TODO: 2025/6/10 加入房间
|
||||
@Override
|
||||
public void getRoomIn(String roomId, String password) {
|
||||
RetrofitClient.getInstance().beforeJoinRoomCheck(roomId, new BaseObserver<BeforeJoinRoomCheckBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BeforeJoinRoomCheckBean beforeJoinRoomCheckBean) {
|
||||
if (beforeJoinRoomCheckBean.getRoom_id() == null || beforeJoinRoomCheckBean.getRoom_id().equals("")) {
|
||||
joinRoom(roomId, password);
|
||||
}else {
|
||||
queren(beforeJoinRoomCheckBean.getRoom_id(), beforeJoinRoomCheckBean.getMsg());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void joinRoom(String roomId, String password){
|
||||
api.roomGetIn(roomId, password, new BaseObserver<RoomInfoResp>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
@@ -109,6 +109,14 @@ public class SettingPresenter extends BasePresenter<SettingConacts.View> impleme
|
||||
boolean isZip = ZipUtils.zipFile(Application.Companion.getInstance().getAppContent(),
|
||||
file.getParent() + "/DataInfo.zip");
|
||||
if (isZip) {
|
||||
File fileLog = new File(Application.Companion.getInstance().getAppLogPath());
|
||||
File fileCrash = new File(Application.Companion.getInstance().getAppCrashPath());
|
||||
if (FileUtils.isFileExists(fileLog)) {
|
||||
FileUtils.delete(fileLog);
|
||||
}
|
||||
if (FileUtils.isFileExists(fileCrash)) {
|
||||
FileUtils.delete(fileCrash);
|
||||
}
|
||||
emitter.onNext(file.getParent() + "/DataInfo.zip");
|
||||
} else {
|
||||
emitter.onNext("");
|
||||
@@ -144,6 +152,9 @@ public class SettingPresenter extends BasePresenter<SettingConacts.View> impleme
|
||||
public void onNext(String s) {
|
||||
MvpRef.get().disLoadings();
|
||||
ToastUtils.showShort(s);
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.xscm.modulemain.activity.room.activity.RoomActivity;
|
||||
import com.xscm.modulemain.activity.user.activity.DailyTasksActivity;
|
||||
import com.xscm.modulemain.activity.user.activity.MyRoomActivity;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.BeforeJoinRoomCheckBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
import com.xscm.moduleutil.bean.room.RoomOnline;
|
||||
import com.xscm.moduleutil.bean.room.RoomOnlineBean;
|
||||
@@ -77,17 +78,27 @@ public class RoomManager {
|
||||
* @param password 房间密码
|
||||
*/
|
||||
public void fetchRoomDataAndEnter(Context context, String roomId, String password, String taskId) {
|
||||
RetrofitClient.getInstance().beforeJoinRoomCheck(roomId, new BaseObserver<BeforeJoinRoomCheckBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BeforeJoinRoomCheckBean beforeJoinRoomCheckBean) {
|
||||
if (beforeJoinRoomCheckBean.getRoom_id() == null || beforeJoinRoomCheckBean.getRoom_id().equals("")) {
|
||||
joinRoom(context, roomId, password, taskId);
|
||||
}else {
|
||||
queren(beforeJoinRoomCheckBean.getRoom_id(), beforeJoinRoomCheckBean.getMsg());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void joinRoom(Context context, String roomId, String password, String taskId) {
|
||||
this.taskId=taskId;
|
||||
this.context=context;
|
||||
|
||||
|
||||
|
||||
// 显示加载提示
|
||||
// 这里可以根据需要添加加载对话框
|
||||
// if (CommonAppContext.getInstance().isRoomJoininj) {
|
||||
// return;
|
||||
// }
|
||||
// CommonAppContext.getInstance().isRoomJoininj = true;
|
||||
// 检查是否有有效的缓存数据
|
||||
RoomInfoResp roomInfo = getCachedRoomData(roomId);
|
||||
//加入房间
|
||||
@@ -116,6 +127,7 @@ public class RoomManager {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void upInfo(Context context, String roomId, String password, boolean isOnline, RoomInfoResp roomInfo, boolean isCurrentRoom, String taskId) {
|
||||
if (isOnline) {
|
||||
RetrofitClient.getInstance().postRoomInfo(roomId, new BaseObserver<RoomInfoResp>() {
|
||||
@@ -396,15 +408,32 @@ public class RoomManager {
|
||||
new ConfirmDialog(ActivityUtils.getTopActivity(),
|
||||
"提示",
|
||||
msg,
|
||||
CommonAppContext.getInstance().playId.equals(roomId) ?"":"去上一个房间",
|
||||
CommonAppContext.getInstance().playId.equals(roomId) ?"取消":"在想想",
|
||||
isCurrRoom(roomId) ?"":"去上一个房间",
|
||||
isCurrRoom(roomId) ?"取消":"在想想",
|
||||
v -> {
|
||||
MessageListenerSingleton.getInstance().joinGroup(roomId);
|
||||
// MessageListenerSingleton.getInstance().joinGroup(roomId);
|
||||
// 点击“确认”按钮时执行删除操作
|
||||
fetchAndJoinRoom(ActivityUtils.getTopActivity(),roomId,"",taskId);
|
||||
},
|
||||
v -> {
|
||||
if (ActivityUtils.getTopActivity() instanceof MainActivity){
|
||||
((MainActivity) ActivityUtils.getTopActivity()).isShowLoading(false);
|
||||
}else if (ActivityUtils.getTopActivity() instanceof MyRoomActivity){
|
||||
((MyRoomActivity) ActivityUtils.getTopActivity()).isShowLoading(false);
|
||||
} else if (ActivityUtils.getTopActivity() instanceof DailyTasksActivity){
|
||||
((DailyTasksActivity) ActivityUtils.getTopActivity()).isShowLoading(false);
|
||||
}
|
||||
// 点击“取消”按钮时什么都不做
|
||||
}, false, 0).show();
|
||||
}
|
||||
|
||||
private boolean isCurrRoom(String roomId){
|
||||
if(CommonAppContext.getInstance().playId == null) {
|
||||
return false;
|
||||
}else if (CommonAppContext.getInstance().playId.equals(roomId)){
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user