This commit is contained in:
zhongchao
2021-11-05 22:59:09 +08:00
parent a4938ccd8c
commit 6c094debd8
96 changed files with 671 additions and 3266 deletions

View File

@@ -43,21 +43,7 @@ private fun track(eventType: String, data: MutableMap<String, Any>? = hashMapOf(
trackRouter!!.track(eventType, data)
}
@DebugLog
fun trackAppEnter(type: String, context: Context = AbsMogoApplication.getApp().applicationContext) {
trackNormalEvent(
TRACK_APP_ENTER,
mutableMapOf(
"from" to type,
"appname" to context.getString(R.string.app_name),
"appversion" to context.packageManager.getPackageInfo(
context.packageName,
0
).versionName
)
)
}
//todo
@DebugLog
fun trackCall(callType: Int, type: Int) {
//记录开始语音、直播时间

View File

@@ -2,10 +2,7 @@
package com.mogo.chat.util.sp
import com.mogo.chat.aspect.DebugLog
const val TEMPORARY_FILE_NAME = "temporary_im_data"
const val CONFIG_FILE_NAME = "configs_im_data"
const val FILE_NAME = "settings_im_data"
const val PARAM_ROOM_ID = "PARAM_ROOM_ID"
@@ -14,20 +11,7 @@ const val PARAM_NEW_FOCUS = "PARAM_NEW_FOCUS"
const val PARAM_VOICE_TYPE = "PARAM_VOICE_TYPE"
const val PARAM_CALL_TIME = "PARAM_CALL_TIME"
const val PARAM_INIT_TIP = "PARAM_INIT_TIP"
const val PARAM_CAR_ONLINE_STATUS = "PARAM_CAR_ONLINE_STATUS"
const val PARAM_GUIDE_SHOW_STATUS = "PARAM_GUIDE_SHOW_STATUS"
const val PARAM_CONFIG_EXPIRY_TIME = "PARAM_CONFIG_EXPIRY_TIME"
const val PARAM_CONFIG_COUNT_DOWN_TIME = "PARAM_CONFIG_COUNT_DOWN_TIME"
const val PARAM_CONFIG_VOICE_CONTENT = "PARAM_CONFIG_VOICE_CONTENT"
const val PARAM_CONFIG_IMAGE_IS_SAVED = "PARAM_CONFIG_IMAGE_IS_SAVED"
const val PARAM_CONFIG_TOPIC_GUIDE = "PARAM_CONFIG_TOPIC_GUIDE"
const val PARAM_CONFIG_FOCUS_NOTICE_TIMES = "PARAM_CONFIG_FOCUS_NOTICE_TIMES"
const val PARAM_CONFIG_OWN_NICK_NAME = "PARAM_CONFIG_OWN_NICK_NAME"
const val PARAM_CONFIG_OWN_HEAD_IMG = "PARAM_CONFIG_OWN_HEAD_IMG"
fun saveRoomId(roomId: Int) {
getCommitSP(TEMPORARY_FILE_NAME) {
@@ -86,15 +70,6 @@ fun getCarOnLineStatus(): Boolean {
return getSP(FILE_NAME).getBoolean(PARAM_CAR_ONLINE_STATUS, true)
}
fun initTip(initType: Int) {
getApplySp(FILE_NAME) {
putBoolean(PARAM_INIT_TIP + initType, true)
}
}
fun getInitStatus(initType: Int): Boolean {
return getSP(FILE_NAME).getBoolean(PARAM_INIT_TIP + initType, false)
}
fun recordCallTime() {
getApplySp(FILE_NAME) {
@@ -111,77 +86,3 @@ fun getTalkTime(): Long {
}
}
fun guideHasShown() {
getApplySp(FILE_NAME) {
putBoolean(PARAM_GUIDE_SHOW_STATUS, true).apply()
}
}
fun getGuideShowStatus(): Boolean {
return getSP(FILE_NAME).getBoolean(PARAM_GUIDE_SHOW_STATUS, false)
}
/**********************************************配置Data*****************************************************/
fun setExpiryTime(expiryTime: Long) {
getApplySp(CONFIG_FILE_NAME) {
putLong(PARAM_CONFIG_EXPIRY_TIME, expiryTime)
}
}
fun isExpiryTime(requestTime: Long): Boolean {
return getSP(CONFIG_FILE_NAME).getLong(PARAM_CONFIG_EXPIRY_TIME, 0) != requestTime
}
fun setCountDownTime(countDownTime: Int) {
getApplySp(CONFIG_FILE_NAME) {
putInt(PARAM_CONFIG_COUNT_DOWN_TIME, countDownTime)
}
}
fun getCountDownTime(): Int {
return getSP(CONFIG_FILE_NAME).getInt(PARAM_CONFIG_COUNT_DOWN_TIME, 0)
}
fun setConfigVoiceContent(voiceContent: String) {
getApplySp(CONFIG_FILE_NAME) {
putString(PARAM_CONFIG_VOICE_CONTENT, voiceContent)
}
}
fun getConfigVoiceContent(): String {
return getSP(CONFIG_FILE_NAME).getString(PARAM_CONFIG_VOICE_CONTENT, "")!!
}
fun setImageSaveStatus(saveStatus: Boolean) {
getApplySp(CONFIG_FILE_NAME) {
putBoolean(PARAM_CONFIG_IMAGE_IS_SAVED, saveStatus)
}
}
fun getImageSaveStatus(): Boolean {
return getSP(CONFIG_FILE_NAME).getBoolean(PARAM_CONFIG_IMAGE_IS_SAVED, false)
}
fun setFocusNoticeTimes(times: Int) {
getApplySp(CONFIG_FILE_NAME) {
putInt(PARAM_CONFIG_FOCUS_NOTICE_TIMES, times)
}
}
fun getFocusNoticeTimes(): Int {
return getSP(CONFIG_FILE_NAME).getInt(PARAM_CONFIG_FOCUS_NOTICE_TIMES, 0)
}
@DebugLog
fun setTopicGuideContent(content: String) {
getApplySp(CONFIG_FILE_NAME) {
putString(PARAM_CONFIG_TOPIC_GUIDE, content)
}
}
fun getTopicGuideContent(): Array<String> {
val content = getSP(CONFIG_FILE_NAME).getString(PARAM_CONFIG_TOPIC_GUIDE, "")
return if (content.isNullOrEmpty()) emptyArray() else content.split("/").toTypedArray()
}