光环助手V4.5.0-包名检测弹窗和应用跳转 https://gitlab.ghzs.com/pm/halo-app-issues/-/issues/1058
This commit is contained in:
@ -19,6 +19,7 @@ import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RestrictTo;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
|
||||
import com.gh.base.AppUncaughtHandler;
|
||||
@ -71,6 +72,7 @@ import com.gh.gamecenter.eventbus.EBPackage;
|
||||
import com.gh.gamecenter.eventbus.EBReuse;
|
||||
import com.gh.gamecenter.eventbus.EBSkip;
|
||||
import com.gh.gamecenter.fragment.MainWrapperFragment;
|
||||
import com.gh.gamecenter.gamedetail.GameDetailFragment;
|
||||
import com.gh.gamecenter.manager.DataCollectionManager;
|
||||
import com.gh.gamecenter.manager.UpdateManager;
|
||||
import com.gh.gamecenter.manager.UserManager;
|
||||
@ -78,12 +80,14 @@ import com.gh.gamecenter.normal.NormalFragment;
|
||||
import com.gh.gamecenter.packagehelper.PackageRepository;
|
||||
import com.gh.gamecenter.packagehelper.PackageViewModel;
|
||||
import com.gh.gamecenter.qa.CommunityFragment;
|
||||
import com.gh.gamecenter.retrofit.BiResponse;
|
||||
import com.gh.gamecenter.retrofit.EmptyResponse;
|
||||
import com.gh.gamecenter.retrofit.Response;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
import com.gh.gamecenter.suggest.SuggestSelectFragment;
|
||||
import com.gh.gamecenter.suggest.SuggestType;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.halo.assistant.fragment.SettingsFragment;
|
||||
@ -96,6 +100,7 @@ import com.lightgame.utils.Utils;
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@ -125,9 +130,11 @@ import static com.gh.common.util.EntranceUtils.HOST_QQ;
|
||||
import static com.gh.common.util.EntranceUtils.HOST_QQ_GROUP;
|
||||
import static com.gh.common.util.EntranceUtils.HOST_WEB;
|
||||
import static com.gh.common.util.EntranceUtils.KEY_DATA;
|
||||
import static com.gh.common.util.EntranceUtils.KEY_MARKET_DETAILS;
|
||||
import static com.gh.common.util.EntranceUtils.KEY_NEXT_TO;
|
||||
import static com.gh.common.util.EntranceUtils.KEY_TO;
|
||||
import static com.gh.common.util.EntranceUtils.KEY_TYPE;
|
||||
import static com.gh.common.util.ExtensionsKt.singleToMain;
|
||||
import static com.gh.gamecenter.fragment.MainWrapperFragment.INDEX_PERSONAL;
|
||||
import static com.gh.gamecenter.personal.PersonalFragment.LOGIN_TAG;
|
||||
import static com.gh.gamecenter.personal.PersonalFragment.LOGOUT_TAG;
|
||||
@ -399,6 +406,9 @@ public class MainActivity extends BaseActivity {
|
||||
SimulatorGameManager.launchSimulatorGame(downloadEntity, gameEntity);
|
||||
}
|
||||
break;
|
||||
case KEY_MARKET_DETAILS:
|
||||
redirectGameDetail(bundle.getString(KEY_DATA));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -412,6 +422,29 @@ public class MainActivity extends BaseActivity {
|
||||
}, 500);
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用跳转
|
||||
* @param packageName
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
private void redirectGameDetail(String packageName) {
|
||||
RetrofitManager.getInstance(this).getApi().redirectGameDetail(packageName)
|
||||
.compose(singleToMain())
|
||||
.subscribe(new BiResponse<JsonObject>() {
|
||||
@Override
|
||||
public void onSuccess(JsonObject data) {
|
||||
String gameId = data.get("game_id").getAsString();
|
||||
DirectUtils.directToGameDetail(MainActivity.this, gameId, GameDetailFragment.INDEX_DESC, "应用跳转");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NotNull Exception exception) {
|
||||
super.onFailure(exception);
|
||||
DirectUtils.directToGameDetail(MainActivity.this, "", GameDetailFragment.INDEX_DESC, "应用跳转");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void checkNotificationPermission() {
|
||||
// 仅登录后再启动光环时请求一次权限
|
||||
if (UserManager.getInstance().isLoggedIn()) {
|
||||
|
||||
Reference in New Issue
Block a user