版主历史版本增加初始内容(未修改),修改app更新逻辑
This commit is contained in:
@ -120,7 +120,7 @@ public class UpdateManager {
|
||||
UpdateManager.this.appEntity = appEntity;
|
||||
|
||||
// 手动更新 强制更新 每次都提示
|
||||
if (!isAutoCheck || appEntity.isForce() || "EVERY_TIME_OPEN".equals(appEntity.getAlert())) {
|
||||
if (!isAutoCheck || "EVERY_TIME_OPEN".equals(appEntity.getAlert())) {
|
||||
md5 = MD5Utils.getUpdateMD5(appEntity.getUrl(), appEntity.getContent());
|
||||
} else if (!"NEVER".equals(appEntity.getAlert())) { // 一天提示一次
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext);
|
||||
@ -170,7 +170,7 @@ public class UpdateManager {
|
||||
if (handler != null) {
|
||||
handler.sendEmptyMessage(1);
|
||||
}
|
||||
if (e != null && e.code() == 304) {
|
||||
if (e != null && (e.code() == 304 || e.code() == 404)) {
|
||||
Utils.toast(mContext, "您的光环助手已是最新版本");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -43,6 +43,7 @@ class AskColumnDetailActivity : BaseActivity() {
|
||||
private val mLoading by bindView<View>(R.id.column_detail_loading)
|
||||
private val mNoConn by bindView<View>(R.id.reuse_no_connection)
|
||||
private val mAppBar by bindView<AppBarLayout>(R.id.column_detail_appbar)
|
||||
private val mNoData by bindView<View>(R.id.reuse_none_data)
|
||||
|
||||
private var mCommunityEntity: CommunityEntity? = null
|
||||
private var mColumnEntity: AskTagGroupsEntity? = null
|
||||
@ -140,8 +141,14 @@ class AskColumnDetailActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
override fun onFailure(e: HttpException?) {
|
||||
if (e?.code() == 404) {
|
||||
mNoData.visibility = View.VISIBLE
|
||||
mNoConn.visibility = View.GONE
|
||||
} else {
|
||||
mNoData.visibility = View.GONE
|
||||
mNoConn.visibility = View.VISIBLE
|
||||
}
|
||||
mLoading.visibility = View.GONE
|
||||
mNoConn.visibility = View.VISIBLE
|
||||
mAppBar.visibility = View.GONE
|
||||
}
|
||||
})
|
||||
|
||||
@ -12,9 +12,9 @@ data class QuestionHistoryDetailEntity(@SerializedName("_id")
|
||||
val modifier: ModifierEntity = ModifierEntity(),
|
||||
val tags: List<String> = ArrayList(),
|
||||
@SerializedName("prev_version_id")
|
||||
val prevVersionId: String = "",
|
||||
var prevVersionId: String = "",
|
||||
@SerializedName("next_version_id")
|
||||
val nextVersionId: String = "")
|
||||
var nextVersionId: String = "")
|
||||
|
||||
|
||||
data class ModifierEntity(@SerializedName("_id")
|
||||
|
||||
@ -20,14 +20,39 @@ class HistoryDetailViewModel(application: Application,
|
||||
|
||||
val detailLiveData = MutableLiveData<QuestionHistoryDetailEntity>()
|
||||
|
||||
private val mApi = RetrofitManager.getInstance(getApplication()).api
|
||||
|
||||
private var mOriginVersion: String = ""
|
||||
|
||||
fun getModeratorModifiedVersionDetail(versionId: String) {
|
||||
processDialog.postValue(WaitingDialogFragment.WaitingDialogData("加载中...", true))
|
||||
RetrofitManager.getInstance(getApplication()).api
|
||||
.getModeratorModifiedVersionDetail(questionId, versionId)
|
||||
|
||||
var isOrigin = false
|
||||
|
||||
val observable = if (mOriginVersion != versionId) {
|
||||
mOriginVersion = ""
|
||||
mApi.getModeratorModifiedVersionDetail(questionId, versionId)
|
||||
} else {
|
||||
isOrigin = true
|
||||
mApi.getModeratorOriginVersionDetail(questionId, versionId, "origin")
|
||||
}
|
||||
|
||||
observable
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Response<QuestionHistoryDetailEntity>() {
|
||||
override fun onResponse(response: QuestionHistoryDetailEntity?) {
|
||||
if (response?.prevVersionId.isNullOrEmpty()) {
|
||||
mOriginVersion = versionId
|
||||
response?.prevVersionId = versionId
|
||||
}
|
||||
|
||||
if (isOrigin) {
|
||||
response?.prevVersionId = ""
|
||||
response?.nextVersionId = mOriginVersion
|
||||
mOriginVersion = ""
|
||||
}
|
||||
|
||||
detailLiveData.postValue(response)
|
||||
processDialog.postValue(WaitingDialogFragment.WaitingDialogData("加载中...", false))
|
||||
}
|
||||
|
||||
@ -1469,12 +1469,20 @@ public interface ApiService {
|
||||
@Query("page") int page);
|
||||
|
||||
/**
|
||||
* 版主隐藏问题
|
||||
* 获取版主修改后的数据
|
||||
*/
|
||||
@GET("questions/{question_id}/modified-versions/{version_id}")
|
||||
Observable<QuestionHistoryDetailEntity> getModeratorModifiedVersionDetail(@Path("question_id") String questionId,
|
||||
@Path("version_id") String versionId);
|
||||
|
||||
/**
|
||||
* 获取版主修改前的原始数据
|
||||
*/
|
||||
@GET("questions/{question_id}/modified-versions/{version_id}")
|
||||
Observable<QuestionHistoryDetailEntity> getModeratorOriginVersionDetail(@Path("question_id") String questionId,
|
||||
@Path("version_id") String versionId,
|
||||
@Query("view") String view);
|
||||
|
||||
/**
|
||||
* 获取问答-推荐的推荐关注列表
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user