Compare commits
7 Commits
feature-is
...
feature-is
| Author | SHA1 | Date | |
|---|---|---|---|
| 8a7d588206 | |||
| 42ae45c743 | |||
| 3246dd0d70 | |||
| 06ac1fd8b0 | |||
| 81da40d786 | |||
| 9eb919b3cf | |||
| b4cbff3d6a |
@ -205,7 +205,6 @@ public class DataUtils {
|
||||
.getCertification()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe(new BiResponse<UserInfoEntity>() {
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
@Override
|
||||
public void onSuccess(UserInfoEntity data) {
|
||||
SPUtils.setString(Constants.SP_DEVICE_CERTIFICATION_PREFIX + gid, GsonUtils.toJson(data));
|
||||
|
||||
@ -8,7 +8,15 @@ import android.database.Cursor
|
||||
import android.database.sqlite.SQLiteDatabase
|
||||
import android.database.sqlite.SQLiteOpenHelper
|
||||
import android.net.Uri
|
||||
import android.text.TextUtils
|
||||
import android.util.Base64
|
||||
import com.gh.common.constant.Constants
|
||||
import com.gh.common.util.GsonUtils
|
||||
import com.gh.common.util.SPUtils
|
||||
import com.gh.gamecenter.BuildConfig
|
||||
import com.gh.gamecenter.entity.UserInfoEntity
|
||||
import com.gh.gamecenter.user.UserRepository
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.utils.Utils
|
||||
|
||||
class GhContentProvider : ContentProvider() {
|
||||
@ -18,6 +26,7 @@ class GhContentProvider : ContentProvider() {
|
||||
|
||||
init {
|
||||
mUriMatcher.addURI(AUTHORITY, CERTIFICATION_TABLE_NAME, 1)
|
||||
mUriMatcher.addURI(AUTHORITY, SYNC_CERTIFICATION_TABLE_NAME, 2)
|
||||
}
|
||||
|
||||
override fun onCreate(): Boolean {
|
||||
@ -31,6 +40,13 @@ class GhContentProvider : ContentProvider() {
|
||||
"$KEY_IS_ADULT BOOL" +
|
||||
")"
|
||||
db.execSQL(sql)
|
||||
|
||||
val syncSql = "CREATE TABLE ${SYNC_CERTIFICATION_TABLE_NAME}(" +
|
||||
"$KEY_PRIMARY_KEY INTEGER PRIMARY KEY AUTOINCREMENT," +
|
||||
"$KEY_REAL_NAME TEXT," +
|
||||
"$KEY_ID_CARD TEXT" +
|
||||
")"
|
||||
db.execSQL(syncSql)
|
||||
}
|
||||
|
||||
override fun onUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
|
||||
@ -49,15 +65,28 @@ class GhContentProvider : ContentProvider() {
|
||||
selectionArgs: Array<out String>?,
|
||||
sortOrder: String?
|
||||
): Cursor? {
|
||||
return mSqLiteDatabase?.query(
|
||||
CERTIFICATION_TABLE_NAME,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
)
|
||||
when(mUriMatcher.match(uri)){
|
||||
1 -> return mSqLiteDatabase?.query(
|
||||
CERTIFICATION_TABLE_NAME,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
)
|
||||
2 -> return mSqLiteDatabase?.query(
|
||||
SYNC_CERTIFICATION_TABLE_NAME,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
)
|
||||
}
|
||||
return null
|
||||
|
||||
}
|
||||
|
||||
override fun getType(uri: Uri): String? = null
|
||||
@ -81,13 +110,44 @@ class GhContentProvider : ContentProvider() {
|
||||
Utils.log("CertificationContentProvider", "insert success:" + uri.authority + ", status => " + values?.toString())
|
||||
return nameUri
|
||||
}
|
||||
}
|
||||
} else if (mUriMatcher.match(uri) == 2) {
|
||||
val certificationStr =
|
||||
SPUtils.getString(Constants.SP_DEVICE_CERTIFICATION_PREFIX + HaloApp.getInstance().gid)
|
||||
val isCertification = if (TextUtils.isEmpty(certificationStr)) {
|
||||
false
|
||||
} else {
|
||||
val userInfo: UserInfoEntity =
|
||||
GsonUtils.fromJson(certificationStr, UserInfoEntity::class.java)
|
||||
if (userInfo != null) {
|
||||
!TextUtils.isEmpty(userInfo.idCard?.id)
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
||||
}
|
||||
if (!isCertification) {//如果未实名的话 就直接将写入的信息进行实名信息绑定
|
||||
val realName = values?.getAsString(KEY_REAL_NAME)
|
||||
val idCard = values?.getAsString(KEY_ID_CARD)
|
||||
if (!TextUtils.isEmpty(realName) && !TextUtils.isEmpty(idCard)) {
|
||||
//base64解密存储的数据
|
||||
val finalRealName = String(Base64.decode(realName, Base64.DEFAULT))
|
||||
val finalIdCard = String(Base64.decode(idCard, Base64.DEFAULT))
|
||||
// Utils.log("解密后的数据:$finalRealName ------ $finalIdCard")
|
||||
//发送同步实名认证请求
|
||||
UserRepository.getInstance().syncCertificate(finalRealName, finalIdCard)
|
||||
return ContentUris.withAppendedId(uri, 1)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
override fun delete(uri: Uri, selection: String?, selectionArgs: Array<out String>?): Int {
|
||||
// delete from outside is forbidden
|
||||
if (mUriMatcher.match(uri) == 2){
|
||||
return mSqLiteDatabase?.delete(SYNC_CERTIFICATION_TABLE_NAME,selection,selectionArgs) ?: 0
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -108,5 +168,10 @@ class GhContentProvider : ContentProvider() {
|
||||
const val KEY_PRIMARY_KEY = "primary_key"
|
||||
const val KEY_IS_CERTIFICATED = "is_certificated"
|
||||
const val KEY_IS_ADULT = "is_adult"
|
||||
|
||||
private const val SYNC_CERTIFICATION_TABLE_NAME = "sync_certification"
|
||||
|
||||
const val KEY_REAL_NAME = "real_name"
|
||||
const val KEY_ID_CARD = "id_card"
|
||||
}
|
||||
}
|
||||
@ -3534,4 +3534,13 @@ public interface ApiService {
|
||||
*/
|
||||
@POST("videos/{video_id}/comments/{comment_id}:unset-top")
|
||||
Observable<ResponseBody> postVideoCommentUnTop(@Path("video_id") String videoId, @Path("comment_id") String commentId);
|
||||
|
||||
/**
|
||||
* 同步从其他游戏传过来的实名认证
|
||||
*/
|
||||
@POST("./certification:sync")
|
||||
Observable<ResponseBody> postSyncCertification(@Body RequestBody body);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -55,6 +55,7 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
@ -502,6 +503,37 @@ public class UserRepository {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 同步实名信息
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void syncCertificate(final String realName, final String idCard) {
|
||||
Map<String,Map<String,String>> map = new HashMap<>();
|
||||
Map<String,String> info = new HashMap<>();
|
||||
info.put("id",idCard);
|
||||
info.put("name",realName);
|
||||
map.put("id_card",info);
|
||||
RequestBody body = RequestBody.create(
|
||||
MediaType.parse("application/json"), new JSONObject(map).toString());
|
||||
RetrofitManager.getInstance().getApi().postSyncCertification(body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<ResponseBody>(){
|
||||
@Override
|
||||
public void onResponse(@Nullable ResponseBody response) {
|
||||
super.onResponse(response);
|
||||
DataUtils.getDeviceCertification(HaloApp.getInstance().getGid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApiFailure(ApiResponse<ResponseBody> e) {
|
||||
super.onApiFailure(e);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private Response<UserInfoEntity> userInfoResponse(final LoginTag loginTag) {
|
||||
return new Response<UserInfoEntity>() {
|
||||
@Override
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="20dp" />
|
||||
<solid android:color="@color/theme" />
|
||||
</shape>
|
||||
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="20dp" />
|
||||
<solid android:color="@color/divider" />
|
||||
</shape>
|
||||
@ -880,4 +880,7 @@
|
||||
<string name="attempt_tips_2">该游戏暂时仅提供试玩版本。试玩版可能存在bug或兼容性问题。敬请留意后续相关消息。</string>
|
||||
<string name="rating_protection">游戏停服更新维护中,为避免情绪化内容对游戏评分带来的影响,因此开启停服保护功能。在停服保护状态期间,所新增及修改发布的评分将不计入总分,所评分评论内容在展示上也会有文字提示告知其他玩家。\n\n感谢您的配合及谅解,祝您游戏愉快!\n\n光环助手会持续关注产品建议及反馈,如您在使用过程中有任何问题,欢迎向我们反馈。</string>
|
||||
<string name="teenager_mode_description">开启青少年模式后,系统将自动关闭所有游戏的下载功能,需要输入密码才能恢复使用\n\n开启青少年模式,需要先设置独立密码,如忘记密码可联系客服申述重置\n\n青少年模式是光环助手响应国家政策,为促进青少年健康成长的一种模式,我们优先针对核心场景进行优化,也将继续致力于优化更多场景</string>
|
||||
|
||||
<string name="dialog_sync_certification_content">您是否同意将您在光环平台游戏内的实名信息与状态同步至光环助手,您的信息将仅用于\n1、部分游戏在助手内无需再次实名即可下载\n2、游戏内使用快速认证方式,无需重复实名</string>
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user