Commit a3e08923 by sikang

KSP

parent 292ffd76
......@@ -4,6 +4,7 @@ android{
defaultConfig{
buildConfigField 'Boolean', 'IS_COLLECT_MODE', 'false'
buildConfigField 'Boolean', 'IS_DIVERSION_MODE', 'false'
buildConfigField 'Boolean', 'IS_KSP', 'false'
//同盾采集SDK
buildConfigField 'String', 'TONGDUN_PARENT_CODE', '\"\"'
buildConfigField 'String', 'TONGDUN_PARENT_KEY', '\" \"'
......
......@@ -112,6 +112,7 @@
<!--注册协议和隐私政策-->
<activity
android:name="com.common.activity.AgreementPolicyActivity"
android:launchMode="standard"
/>
<!--帮助中心-->
......
......@@ -3,6 +3,7 @@ package com.common.activity;
import android.app.Activity;
import android.content.Intent;
import android.support.v4.app.FragmentActivity;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.View;
import android.webkit.WebView;
......@@ -14,7 +15,9 @@ import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import tech.starwin.R;
import com.common.base.BaseActivity;
import tech.starwin.constants.ActionEnum;
import tech.starwin.impl.OnEventClickListener;
import tech.starwin.network.Gateway;
......@@ -22,16 +25,27 @@ import tech.starwin.utils.PreferencesManager;
import tech.starwin.utils.context_utils.EasyActivityResult;
import tech.starwin.utils.ui_utils.DialogFactory;
import tech.starwin.utils.ui_utils.UIHelper;
import com.common.widget.TopBar;
import java.io.Serializable;
/**
* Created by SiKang on 2018/11/19.
* 注册协议及隐私政策
*/
public class AgreementPolicyActivity extends BaseActivity {
public enum Type implements Serializable {
AGREEMENT_POLICY,
AGREEMENT_KSP
}
public static void startForResult(FragmentActivity activity, int requestCode, EasyActivityResult.OnResultListener listener) {
Type agreementType;
public static void startForResult(FragmentActivity activity, Type type, int requestCode, EasyActivityResult.OnResultListener listener) {
Intent intent = new Intent(activity, AgreementPolicyActivity.class);
intent.putExtra("agreementType", type);
new EasyActivityResult(activity).startForResult(intent, requestCode, listener);
}
......@@ -51,6 +65,7 @@ public class AgreementPolicyActivity extends BaseActivity {
@Override
public void initView() {
agreementType = (Type) getIntent().getSerializableExtra("agreementType");
EventBus.getDefault().register(this);
mCheckBox = findViewById(R.id.activity_policy_checkbox);
webView = findViewById(R.id.activity_policy_webview);
......@@ -60,9 +75,22 @@ public class AgreementPolicyActivity extends BaseActivity {
public void onEventClick(View v) {
if (v.getId() == R.id.activity_policy_ok_btn) {
if (mCheckBox.isChecked()) {
PreferencesManager.get().setPolicyStatus(true);
setResult(Activity.RESULT_OK);
finish();
switch (agreementType) {
case AGREEMENT_POLICY:
PreferencesManager.get().setPolicyStatus(true);
AgreementPolicyActivity.startForResult(AgreementPolicyActivity.this, Type.AGREEMENT_KSP, 0, (requestCode, resultCode, data) -> {
if(resultCode==RESULT_OK){
setResult(Activity.RESULT_OK);
}
finish();
});
break;
case AGREEMENT_KSP:
PreferencesManager.get().setPolicyKSPStatus(true);
setResult(RESULT_OK);
finish();
break;
}
} else {
DialogFactory.showMessageDialog(AgreementPolicyActivity.this, getString(R.string.check_the_checkbox));
}
......@@ -70,8 +98,10 @@ public class AgreementPolicyActivity extends BaseActivity {
}
}
}, R.id.activity_policy_ok_btn);
webView.loadUrl(Gateway.getAgreementPolicyUrl());
String policyUrl = agreementType == Type.AGREEMENT_POLICY ? Gateway.getAgreementPolicyUrl() : Gateway.getKSPUrl();
if (!TextUtils.isEmpty(policyUrl)) {
webView.loadUrl(policyUrl);
}
}
......
......@@ -49,6 +49,13 @@ public class Gateway {
}
/**
* KSP成员协议
* */
public static String getKSPUrl() {
return getAgreementPolicyUrl().replace(".html","Ksp.html");
}
/**
* 上传地址
* */
public static String getHarvesterUrl() {
......
......@@ -203,13 +203,6 @@ public class PreferencesManager {
/**
* 更新政策 是否同意 状态
*/
public void setPolicyStatus(boolean isAgreed) {
saveData("has_agreed_policy", isAgreed);
}
/**
* 贷款申请结果提示是否已经显示过
*/
public void setLoanRsultNotifyStatus(boolean isNotified) {
......@@ -227,6 +220,26 @@ public class PreferencesManager {
return getBoolean("has_agreed_policy", false);
}
/**
* 更新政策 是否同意 状态
*/
public void setPolicyStatus(boolean isAgreed) {
saveData("has_agreed_policy", isAgreed);
}
/**
* 是否已同意政策
*/
public boolean hasAgreedKSPPolicy() {
return getBoolean("has_agreed_ksp_policy", false);
}
/**
* 更新政策 是否同意 状态
*/
public void setPolicyKSPStatus(boolean isAgreed) {
saveData("has_agreed_ksp_policy", isAgreed);
}
/**
* 清除登录信息
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment