Skip to content

Commit

Permalink
【ID868776255】App数据隐私合规整改--中国大陆仅仅提供18周岁以上成年人使用。
Browse files Browse the repository at this point in the history
http://tapd.oa.com/NEW_IOT/prong/stories/view/1020393192868776255

Change-Id: Ieccfe2a577c86d5f24378f1b4e714e1caae3cf25
  • Loading branch information
SundoggyNew committed Nov 1, 2021
1 parent 006c5a2 commit 0f12e59
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,16 @@ class ChooseCountryActivity : PActivity(), ChooseCountryView, View.OnClickListen
tv_register_to_country.text = countryName + getString(R.string.conutry_code_num, countryCode)
}

private fun shouldShowBirthdayDlg(): Boolean {
var lastTimeJson = Utils.getStringValueFromXml(this@ChooseCountryActivity, CommonField.USA_USER_REG_TIME_INFO, CommonField.USA_USER_REG_TIME_INFO)
private fun shouldShowBirthdayDlg(countryCode: String): Boolean {
var lastTimeJson: String?
if (countryCode == "1") {
lastTimeJson = Utils.getStringValueFromXml(this@ChooseCountryActivity, CommonField.USA_USER_REG_TIME_INFO, CommonField.USA_USER_REG_TIME_INFO)
} else if (countryCode == "86") {
lastTimeJson = Utils.getStringValueFromXml(this@ChooseCountryActivity, CommonField.CHINA_MAINLAND_USER_REG_TIME_INFO, CommonField.CHINA_MAINLAND_USER_REG_TIME_INFO)
} else {
return false
}

// 不存在上一次的注册信息
if (TextUtils.isEmpty(lastTimeJson) || lastTimeJson == "{}") return true

Expand All @@ -71,9 +79,18 @@ class ChooseCountryActivity : PActivity(), ChooseCountryView, View.OnClickListen
var currentYear = currentDate.year + 1900
var currentMonth = currentDate.month + 1
var currentDay = currentDate.day
var tagYear = json.getIntValue(CommonField.USA_USER_REG_TIME_INFO_YEAR)
var tagMonth = json.getIntValue(CommonField.USA_USER_REG_TIME_INFO_MONTH)
var tagDay = json.getIntValue(CommonField.USA_USER_REG_TIME_INFO_DAY)
var tagYear = 0
var tagMonth = 0
var tagDay = 0
if (countryCode == "1") {
tagYear = json.getIntValue(CommonField.USA_USER_REG_TIME_INFO_YEAR)
tagMonth = json.getIntValue(CommonField.USA_USER_REG_TIME_INFO_MONTH)
tagDay = json.getIntValue(CommonField.USA_USER_REG_TIME_INFO_DAY)
} else if (countryCode == "86") {
tagYear = json.getIntValue(CommonField.CHINA_MAINLAND_USER_REG_TIME_INFO_YEAR)
tagMonth = json.getIntValue(CommonField.CHINA_MAINLAND_USER_REG_TIME_INFO_MONTH)
tagDay = json.getIntValue(CommonField.CHINA_MAINLAND_USER_REG_TIME_INFO_DAY)
}
if (currentYear - tagYear > 0 && currentMonth - tagMonth == 0 && currentDay - tagDay == 0) { // 满周年
return true
}
Expand All @@ -95,15 +112,26 @@ class ChooseCountryActivity : PActivity(), ChooseCountryView, View.OnClickListen
}

private fun showBirthDayDlg() {
if (presenter.getCountryCode() == "1" && shouldShowBirthdayDlg()) {
val countryCode = presenter.getCountryCode()
if (shouldShowBirthdayDlg(countryCode)) {
var dlg = InputBirthdayDialog(this@ChooseCountryActivity)
dlg.show()
dlg.setOnDismissListener(object: InputBirthdayDialog.OnDismisListener {
override fun onOkClicked(year: Int, month: Int, day: Int) {
var age = 0
if (countryCode == "1") {
age = 13
} else if (countryCode == "86") {
age = 18
}

// 是否满13周岁
if (!ifOver13YearsOld(year, month, day)) {
T.show(resources.getString(R.string.too_young_to_use))
// 是否满age周岁
if (!ifOverAge(age, year, month, day)) {
if (countryCode == "1") {
T.show(resources.getString(R.string.usa_too_young_to_use))
} else if (countryCode == "86") {
T.show(resources.getString(R.string.mainland_too_young_to_use))
}
finish()
return
}
Expand All @@ -113,26 +141,36 @@ class ChooseCountryActivity : PActivity(), ChooseCountryView, View.OnClickListen
var currentYear = currentDate.year + 1900
var currentMonth = currentDate.month + 1
var currentDay = currentDate.day
// 记录本次使用的日期
timeJson.put(CommonField.USA_USER_REG_TIME_INFO_YEAR, currentYear)
timeJson.put(CommonField.USA_USER_REG_TIME_INFO_MONTH, currentMonth)
timeJson.put(CommonField.USA_USER_REG_TIME_INFO_DAY, currentDay)
Utils.setXmlStringValue(T.getContext(), CommonField.USA_USER_REG_TIME_INFO,
CommonField.USA_USER_REG_TIME_INFO, timeJson.toJSONString())

if (countryCode == "1") {
// 记录本次使用的日期
timeJson.put(CommonField.USA_USER_REG_TIME_INFO_YEAR, currentYear)
timeJson.put(CommonField.USA_USER_REG_TIME_INFO_MONTH, currentMonth)
timeJson.put(CommonField.USA_USER_REG_TIME_INFO_DAY, currentDay)
Utils.setXmlStringValue(T.getContext(), CommonField.USA_USER_REG_TIME_INFO,
CommonField.USA_USER_REG_TIME_INFO, timeJson.toJSONString())
} else if (countryCode == "86") {
// 记录本次使用的日期
timeJson.put(CommonField.CHINA_MAINLAND_USER_REG_TIME_INFO_YEAR, currentYear)
timeJson.put(CommonField.CHINA_MAINLAND_USER_REG_TIME_INFO_MONTH, currentMonth)
timeJson.put(CommonField.CHINA_MAINLAND_USER_REG_TIME_INFO_DAY, currentDay)
Utils.setXmlStringValue(T.getContext(), CommonField.CHINA_MAINLAND_USER_REG_TIME_INFO,
CommonField.CHINA_MAINLAND_USER_REG_TIME_INFO, timeJson.toJSONString())
}
}

override fun onCancelClicked() { finish() }
})
}
}

private fun ifOver13YearsOld(year: Int, month: Int, day: Int): Boolean {
private fun ifOverAge(age: Int,year: Int, month: Int, day: Int): Boolean {
var currentDate = Date()
var currentYear = currentDate.year + 1900
var currentMonth = currentDate.month + 1
var currentDay = currentDate.day
if (currentYear - year < 13 || (currentYear - year == 13 && currentMonth - month < 0) ||
(currentYear - year == 13 && currentMonth - month == 0 && currentDay - day < 0)) {
if (currentYear - year < age || (currentYear - year == age && currentMonth - month < 0) ||
(currentYear - year == age && currentMonth - month == 0 && currentDay - day < 0)) {
return false
}
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ class RegisterActivity : PActivity(), RegisterView, View.OnClickListener {

// 是否满13周岁
if (!ifOver13YearsOld(year, month, day)) {
T.show(resources.getString(R.string.too_young_to_use))
T.show(resources.getString(R.string.usa_too_young_to_use))
finish()
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,14 @@ object CommonField {
/*************** 注册 ****************/
const val TYPE = "Type"
const val REG_COUNTRY_INFO = "RegCountryInfo"
const val USA_USER_REG_TIME_INFO = "RegTimeInfo"
const val USA_USER_REG_TIME_INFO_YEAR = "RegTimeInfoYear"
const val USA_USER_REG_TIME_INFO_MONTH = "RegTimeInfoMonth"
const val USA_USER_REG_TIME_INFO_DAY = "RegTimeInfoDay"
const val USA_USER_REG_TIME_INFO = "USARegTimeInfo"
const val USA_USER_REG_TIME_INFO_YEAR = "USARegTimeInfoYear"
const val USA_USER_REG_TIME_INFO_MONTH = "USARegTimeInfoMonth"
const val USA_USER_REG_TIME_INFO_DAY = "USARegTimeInfoDay"
const val CHINA_MAINLAND_USER_REG_TIME_INFO = "ChinaMainlandRegTimeInfo"
const val CHINA_MAINLAND_USER_REG_TIME_INFO_YEAR = "ChinaMainlandRegTimeInfoYear"
const val CHINA_MAINLAND_USER_REG_TIME_INFO_MONTH = "ChinaMainlandRegTimeInfoMonth"
const val CHINA_MAINLAND_USER_REG_TIME_INFO_DAY = "ChinaMainlandRegTimeInfoDay"
const val COUNTRY_INFO = "CountryInfo"
const val COUNTRY_CODE = "CountryCode"
const val AGREED_RULE_FLAG = "agreeRule"
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values-en-rUS/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@
<string name="not_install_wechat_client">WeChat is not installed. Try again after you install WeChat.</string>
<string name="cancel_wechat">Deauthorize</string>
<string name="input_birthday_for_better_react">Date of Birth</string>
<string name="too_young_to_use"> Sorry. Tencent LianLian is not available.</string>
<string name="usa_too_young_to_use">Because you are under 13 years old, you cannot use our products and services temporarily.</string>
<string name="mainland_too_young_to_use">Because you are under 18 years old, you cannot use our products and services temporarily.</string>
<string name="location_failed">Positioning failed </string>

<string name="login">Log In</string>
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@
<string name="not_install_wechat_client">微信未安装,请安装后重试</string>
<string name="cancel_wechat">取消授权</string>
<string name="input_birthday_for_better_react">出生日期</string>
<string name="too_young_to_use">很遗憾,我们目前无法向您提供腾讯连连</string>
<string name="usa_too_young_to_use">由于您未满十三周岁,暂无法使用我们的产品服务。</string>
<string name="mainland_too_young_to_use">由于您未满十八周岁,暂无法使用我们的产品服务。</string>
<string name="location_failed">定位失败</string>

<string name="login">登录</string>
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@
<string name="not_install_wechat_client">微信未安装,请安装后重试</string>
<string name="cancel_wechat">取消授权</string>
<string name="input_birthday_for_better_react">出生日期</string>
<string name="too_young_to_use">很遗憾,我们目前无法向您提供腾讯连连</string>
<string name="usa_too_young_to_use">由于您未满十三周岁,暂无法使用我们的产品服务。</string>
<string name="mainland_too_young_to_use">由于您未满十八周岁,暂无法使用我们的产品服务。</string>
<string name="location_failed">定位失败</string>

<string name="login">登录</string>
Expand Down

0 comments on commit 0f12e59

Please sign in to comment.