修复新增游戏时长功能部分测试问题 https://gitlab.ghzs.com/pm/halo-app-issues/issues/722

This commit is contained in:
chenjuntao
2020-01-02 16:23:33 +08:00
parent 943c359c22
commit b80fab06ad
5 changed files with 31 additions and 11 deletions

View File

@ -108,6 +108,7 @@ import com.tencent.bugly.crashreport.CrashReport;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
@ -998,6 +999,7 @@ public class MainActivity extends BaseActivity {
DataCollectionUtils.uploadInorunstall(this, busFour.getType(), busFour.getPackageName());
}
@SuppressWarnings("ResultOfMethodCallIgnored")
@SuppressLint("CheckResult")
private void postNewlyInstalledApp(String gameId, String packageName) {
@ -1017,11 +1019,20 @@ public class MainActivity extends BaseActivity {
.subscribe(new EmptyResponse<>());
if (!TextUtils.isEmpty(gameId) && UserManager.getInstance().isLoggedIn()) {
RetrofitManager.getInstance(MainActivity.this).getApi()
.postPlayedGame(UserManager.getInstance().getUserId(), gameId)
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("game_id", gameId);
jsonObject.put("package", packageName);
RequestBody rBody = RequestBody.create(MediaType.parse("application/json"), jsonObject.toString());
RetrofitManager.getInstance(MainActivity.this).getApi()
.postPlayedGame(UserManager.getInstance().getUserId(), rBody)
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.subscribe(new EmptyResponse<>());
} catch (JSONException e) {
e.printStackTrace();
}
}
}