refactor_questionedit分支合并到dev
This commit is contained in:
@ -46,7 +46,7 @@ object CollectionUtils {
|
||||
try {
|
||||
val string = e.response()?.errorBody()?.string()
|
||||
val errorBody = JSONObject(string)
|
||||
if (errorBody.getInt("status") == 403009) {
|
||||
if (errorBody.getInt("detail") == 403009) {
|
||||
listener.onSuccess()
|
||||
return
|
||||
}
|
||||
|
||||
@ -513,8 +513,10 @@ public class ShareUtils {
|
||||
shortMessageShare();
|
||||
break;
|
||||
case 6:
|
||||
if (mShareType == ShareType.askInvite || mShareType == ShareType.askNormal) {
|
||||
if (mShareType == ShareType.askInvite) {
|
||||
copyLink(mTitle + " - 光环助手" + shareUrl);
|
||||
} else if (mShareType == ShareType.askNormal) {
|
||||
copyLink(shareUrl);
|
||||
} else if (mShareType != ShareType.shareGh) {
|
||||
copyLink(shareUrl);
|
||||
} else {
|
||||
|
||||
@ -11,6 +11,7 @@ import android.content.pm.PackageInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.SystemClock;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
@ -74,6 +75,7 @@ import com.google.gson.reflect.TypeToken;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.lightgame.config.CommonDebug;
|
||||
import com.lightgame.download.DataWatcher;
|
||||
import com.lightgame.download.DownloadConfig;
|
||||
import com.lightgame.download.DownloadEntity;
|
||||
import com.lightgame.download.DownloadStatus;
|
||||
import com.lightgame.download.FileUtils;
|
||||
@ -171,6 +173,9 @@ public class MainActivity extends BaseActivity {
|
||||
if (DownloadStatus.hijack.equals(downloadEntity.getStatus())) {
|
||||
// 链接被劫持
|
||||
processHijack(downloadEntity);
|
||||
String nameAndPlatform = downloadEntity.getName() + ":"
|
||||
+ PlatformUtils.getInstance(getApplicationContext()).getPlatformName(downloadEntity.getPlatform());
|
||||
DataUtils.onMtaEvent(getApplicationContext(), "下载劫持", "游戏名字", nameAndPlatform, "网络状态" + DeviceUtils.getNetwork(getApplication()));
|
||||
return;
|
||||
} else if (DownloadStatus.notfound.equals(downloadEntity.getStatus())) {
|
||||
// 404 Not Found
|
||||
@ -240,8 +245,10 @@ public class MainActivity extends BaseActivity {
|
||||
* 3.
|
||||
*/
|
||||
|
||||
DataUtils.onMtaEvent(getApplication(), "解析包错误分析", "游戏名字"
|
||||
, downloadEntity.getName() + ":" + PlatformUtils.getInstance(getApplicationContext()).getPlatformName(downloadEntity.getPlatform()));
|
||||
DataUtils.onMtaEvent(getApplication(), "解析包错误分析"
|
||||
, "游戏名字", downloadEntity.getName() + ":"
|
||||
+ PlatformUtils.getInstance(getApplicationContext()).getPlatformName(downloadEntity.getPlatform())
|
||||
, "网络状态", DeviceUtils.getNetwork(getApplication()));
|
||||
|
||||
}
|
||||
}
|
||||
@ -765,7 +772,10 @@ public class MainActivity extends BaseActivity {
|
||||
for (DownloadEntity downloadEntity : DownloadManager.getInstance(this).getAll()) {
|
||||
if (DownloadStatus.neterror.equals(downloadEntity.getStatus()) ||
|
||||
DownloadStatus.timeout.equals(downloadEntity.getStatus())) {
|
||||
DownloadManager.getInstance(this).add(downloadEntity);
|
||||
Message msg = Message.obtain();
|
||||
msg.what = DownloadConfig.CONTINUE_DOWNLOAD_TASK;
|
||||
msg.obj = downloadEntity.getUrl();
|
||||
DownloadManager.getInstance(getApplicationContext()).sendMessageDelayed(msg, 1000);
|
||||
}
|
||||
Utils.log("checkRetryDownload::" + downloadEntity.getStatus());
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ public class InstallFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
Collections.sort(sortedList, new Comparator<GameInfoEntity>() { // 按安装时间排序
|
||||
@Override
|
||||
public int compare(GameInfoEntity lhs, GameInfoEntity rhs) {
|
||||
return lhs.getInstallTime() > rhs.getInstallTime()? -1 : 1;
|
||||
return lhs.getInstallTime() > rhs.getInstallTime() ? -1 : 1;
|
||||
}
|
||||
});
|
||||
for (GameInfoEntity info : sortedList) {
|
||||
@ -488,6 +488,7 @@ public class InstallFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
//跳转到快传 - 搜索接收者页面
|
||||
public void skipKc(int i) {
|
||||
GameEntity gameEntity = gameList.get(i);
|
||||
if (gameEntity.getApk().size() == 0) return;
|
||||
String packageName = gameEntity.getApk().get(0).getPackageName();
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
FileInfo fileInfo = new FileInfo();
|
||||
|
||||
@ -177,8 +177,10 @@ public class DiscoverFragment extends BaseFragment {
|
||||
@Override
|
||||
public void run() {
|
||||
GameTrendsInfo gameTrendsInfo = mGameTrendsDao.findGameTrendsInfo(UserManager.getInstance().getUserId());
|
||||
gameTrendsInfo.setReadPostTime(gameTrendsInfo.getInternetPostTime());
|
||||
mGameTrendsDao.add(gameTrendsInfo);
|
||||
if (gameTrendsInfo != null) {
|
||||
gameTrendsInfo.setReadPostTime(gameTrendsInfo.getInternetPostTime());
|
||||
mGameTrendsDao.add(gameTrendsInfo);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ public class GameDownloadFragment extends BaseFragment implements View.OnClickLi
|
||||
}
|
||||
} else {
|
||||
location = adapter.getLocation(downloadEntity.getUrl());
|
||||
if (location != null && adapter.getDownloadingList().size() > 0) {
|
||||
if (location != null && adapter.getDownloadingList().size() > location) {
|
||||
adapter.getDownloadingList().set(location, downloadEntity);
|
||||
adapter.notifyItemChanged(adapter.getBase() + location + 1);
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ class LibaoSearchAdapter(fragment: LibaoSearchFragment,
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun postFailed(error: Throwable) {
|
||||
override fun postFailed(error: Throwable?) {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
@ -8,6 +8,7 @@ import android.preference.PreferenceManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DeviceUtils;
|
||||
import com.gh.common.util.GetLoginDataUtils;
|
||||
import com.gh.common.util.LoginUtils;
|
||||
@ -16,6 +17,7 @@ import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.entity.LoginTokenEntity;
|
||||
import com.gh.gamecenter.entity.TokenEntity;
|
||||
import com.gh.gamecenter.entity.UserInfoEntity;
|
||||
import com.gh.gamecenter.manager.RefreshTokenManager;
|
||||
import com.gh.gamecenter.manager.UserManager;
|
||||
import com.gh.gamecenter.retrofit.Response;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
@ -32,6 +34,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
@ -209,15 +212,25 @@ class UserRepository {
|
||||
GetLoginDataUtils.getInstance(mContext).QQLogout();
|
||||
}
|
||||
|
||||
if (httpException != null && httpException.code() == 400) {
|
||||
ResponseBody responseBody = httpException.response().errorBody();
|
||||
String string = responseBody.string();
|
||||
JSONObject content = new JSONObject(string);
|
||||
int code = content.getInt("code");
|
||||
LoginUtils.outputErrorHint(mContext, code);
|
||||
Utils.log("login->onFailure:: code:" + code + " content:" + content.toString());
|
||||
if (httpException != null) {
|
||||
if ((httpException.code() == 400 || httpException.code() == 403)) {
|
||||
ResponseBody responseBody = httpException.response().errorBody();
|
||||
String string = responseBody.string();
|
||||
JSONObject content = new JSONObject(string);
|
||||
int code = content.getInt("code");
|
||||
if (httpException.code() == 400) {
|
||||
LoginUtils.outputErrorHint(mContext, code);
|
||||
} else {
|
||||
Utils.toast(mContext, mContext.getString(R.string.login_failure_hint_code, code));
|
||||
}
|
||||
Utils.log("login->onFailure:: code:" + code + " content:" + content.toString());
|
||||
DataUtils.onMtaEvent(mContext, "登录异常统计_手动登录", "错误码", String.valueOf(code));
|
||||
} else {
|
||||
Utils.toast(mContext, mContext.getString(R.string.login_failure_hint_code, httpException.code()));
|
||||
}
|
||||
} else {
|
||||
Utils.toast(mContext, mContext.getString(R.string.login_failure_hint));
|
||||
}
|
||||
Utils.toast(mContext, R.string.login_failure_hint);
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
package com.gh.gamecenter.manager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.gh.common.constant.Constants;
|
||||
import com.gh.common.util.DataUtils;
|
||||
import com.gh.common.util.DeviceUtils;
|
||||
import com.gh.gamecenter.BuildConfig;
|
||||
import com.gh.gamecenter.entity.LoginTokenEntity;
|
||||
@ -38,6 +40,7 @@ public class RefreshTokenManager {
|
||||
private AppDatabase mDatabase;
|
||||
private UserseaService mUserseaService;
|
||||
private ApiService mApiService;
|
||||
private SharedPreferences mSp;
|
||||
|
||||
private Context mContext;
|
||||
|
||||
@ -47,6 +50,7 @@ public class RefreshTokenManager {
|
||||
mDatabase = AppDatabase.getInstance(context);
|
||||
mUserseaService = RetrofitManager.getInstance(context).getUsersea();
|
||||
mApiService = RetrofitManager.getInstance(context).getApi();
|
||||
mSp = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
}
|
||||
|
||||
public static RefreshTokenManager getInstance(Context context) {
|
||||
@ -128,6 +132,7 @@ public class RefreshTokenManager {
|
||||
|
||||
if (code == 400802 || code == 400401) { // 自动注销
|
||||
EventBus.getDefault().post(new EBReuse(PersonalFragment.LOGOUT_TAG));
|
||||
DataUtils.onMtaEvent(mContext, "登录异常统计_自动登录", "错误码_RefreshToken", code + "_" + token);
|
||||
}
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
|
||||
@ -116,7 +116,6 @@ public class PersonalFragment extends BaseFragment implements Observer<ApiRespon
|
||||
|
||||
public final static String LOGIN_TAG = "login_tag"; //登入标识
|
||||
public final static String LOGOUT_TAG = "logout_tag"; // 登出标识
|
||||
public final static String LOGIN_RETRY = "login_retry";
|
||||
public final static String MESSAGE_UNREAD_TAG = "message_unread_tag";
|
||||
public final static String MESSAGE_READ_OVER = "MESSAGE_READ_OVER";
|
||||
public static final int REQUEST_MESSAGE = 199;
|
||||
@ -131,8 +130,6 @@ public class PersonalFragment extends BaseFragment implements Observer<ApiRespon
|
||||
private UserViewModel mUserViewModel;
|
||||
private MessageUnreadViewModel mUnreadViewModel;
|
||||
|
||||
private boolean isLogin;
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
@ -163,8 +160,6 @@ public class PersonalFragment extends BaseFragment implements Observer<ApiRespon
|
||||
mUserViewModel = ViewModelProviders.of(this, factory).get(UserViewModel.class);
|
||||
mUserViewModel.getLoginObsUserinfo().observe(this, this);
|
||||
|
||||
isLogin = mUserViewModel.isLogin();
|
||||
|
||||
mUnreadViewModel = ViewModelProviders.of(this,
|
||||
new MessageUnreadViewModel.Factory(HaloApp.getInstance().getApplication())).get(MessageUnreadViewModel.class);
|
||||
mUnreadViewModel.getLiveData().observe(this
|
||||
@ -194,7 +189,9 @@ public class PersonalFragment extends BaseFragment implements Observer<ApiRespon
|
||||
// 连接上网络事件
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEventMainThread(EBNetworkState busNetworkState) {
|
||||
if (busNetworkState.isNetworkConnected() && isLogin && mUserInfoEntity == null) {
|
||||
if (busNetworkState.isNetworkConnected()
|
||||
&& mUserViewModel.isLogin()
|
||||
&& (mUserInfoEntity == null || TextUtils.isEmpty(UserManager.getInstance().getToken()))) {
|
||||
mUserViewModel.retryCheckLogin();
|
||||
}
|
||||
}
|
||||
@ -207,8 +204,6 @@ public class PersonalFragment extends BaseFragment implements Observer<ApiRespon
|
||||
}
|
||||
} else if (LOGOUT_TAG.equals(reuse.getType())) {
|
||||
mUserViewModel.logout();
|
||||
} else if (LOGIN_RETRY.equals(reuse.getType())) {
|
||||
mUserViewModel.retryCheckLogin();
|
||||
}
|
||||
}
|
||||
|
||||
@ -447,23 +442,12 @@ public class PersonalFragment extends BaseFragment implements Observer<ApiRespon
|
||||
mUnreadViewModel.clean();
|
||||
changeLoginState(false);
|
||||
EventBus.getDefault().post(new EBConcernChanged());
|
||||
isLogin = false;
|
||||
} else {
|
||||
changeLoginState(true);
|
||||
isLogin = true;
|
||||
}
|
||||
|
||||
if (mLoginDialog != null) {
|
||||
mLoginDialog.dismissAllowingStateLoss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
// 检验登录一致性
|
||||
if (isLogin && TextUtils.isEmpty(UserManager.getInstance().getToken())) {
|
||||
mUserViewModel.retryCheckLogin();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,6 +31,7 @@ import com.gh.gamecenter.adapter.OnCommentCallBackListener;
|
||||
import com.gh.gamecenter.baselist.ListAdapter;
|
||||
import com.gh.gamecenter.baselist.ListFragment;
|
||||
import com.gh.gamecenter.entity.CommentEntity;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.gh.gamecenter.qa.answer.detail.AnswerDetailFragment;
|
||||
import com.lightgame.utils.Util_System_Keyboard;
|
||||
import com.lightgame.utils.Utils;
|
||||
@ -146,7 +147,7 @@ public class AnswerCommentFragment extends ListFragment<CommentEntity, AnswerCom
|
||||
if (mShowSoftKeyboardOnStartUp) {
|
||||
mCommentDetailCommentEt.postDelayed(() -> {
|
||||
InputMethodManager keyboard = (InputMethodManager)
|
||||
getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
HaloApp.getInstance().getApplication().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
keyboard.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
|
||||
}, 200);
|
||||
}
|
||||
|
||||
@ -29,7 +29,9 @@ public class InstallReceiver extends BroadcastReceiver {
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String path = intent.getStringExtra(EntranceUtils.KEY_PATH);
|
||||
if (PackageUtils.isCanLaunchSetup(context, path)) {
|
||||
context.startActivity(PackageUtils.getInstallIntent(context, path));
|
||||
Intent installIntent = PackageUtils.getInstallIntent(context, path);
|
||||
installIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(installIntent);
|
||||
} else {
|
||||
if (RunningUtils.isRunning(context)) {
|
||||
if (RunningUtils.isEqualsTop(context, DownloadManagerActivity.class.getName())) {
|
||||
|
||||
@ -273,6 +273,7 @@
|
||||
</string-array >
|
||||
<string name = "nickname_hint" >起一个难忘的名字吧</string >
|
||||
<string name = "login_failure_hint" >登录异常,请稍后重试</string >
|
||||
<string name = "login_failure_hint_code" >登录异常(%1$d),请稍后重试</string >
|
||||
<string name = "title_select_region" >选择地区</string >
|
||||
<string name = "setting_logout" >退出账号</string >
|
||||
<string name = "share" >分享</string >
|
||||
@ -549,6 +550,6 @@
|
||||
<string name = "comment" >我来评论</string >
|
||||
<string name = "sign_dialog_content" >已连续签到 <Data ><![CDATA[<font color="#1a7bd5">%1$d</font> 天]]></Data ></string >
|
||||
<string name = "sign_dialog_content2" ><Data ><![CDATA[累计经验: <font color="#1a7bd5">%1$d</font>]]></Data ></string >
|
||||
<string name="copyright_footnote">著作权归作者所有©光环助手</string>
|
||||
<string name = "copyright_footnote" >著作权归作者所有©光环助手</string >
|
||||
|
||||
</resources >
|
||||
|
||||
@ -21,7 +21,7 @@ org.gradle.parallel=true
|
||||
channel_file=channel.txt
|
||||
|
||||
# tinker patch version_name
|
||||
PATCH_VERSION_NAME=3.2
|
||||
PATCH_VERSION_NAME=3.2.2
|
||||
|
||||
# Third-party keys
|
||||
DEBUG_UMENG_APPKEY=58e5b0b9c62dca35a00005e6
|
||||
|
||||
Submodule libraries/LGLibrary updated: 3894faf023...5b735b0e09
Reference in New Issue
Block a user