账号绑定的apple处理

This commit is contained in:
chenxi 2023-06-13 10:41:19 +08:00
parent 8891f004ff
commit 00ec7c553d
2 changed files with 117 additions and 39 deletions

View File

@ -13,13 +13,7 @@ function AccountBindUI:onLoadRootComplete()
self.uiMap["account_bind_ui.title_bg_img.title_text"]:setText(I18N:getGlobalText(I18N.GlobalConst.MESSAGE_BOX_TITLE)) self.uiMap["account_bind_ui.title_bg_img.title_text"]:setText(I18N:getGlobalText(I18N.GlobalConst.MESSAGE_BOX_TITLE))
self.uiMap["account_bind_ui.title_bg_img.bg.content_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BIND_TIPS_DESC)) self.uiMap["account_bind_ui.title_bg_img.bg.content_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BIND_TIPS_DESC))
self.uiMap["account_bind_ui.title_bg_img.google_sign_btn"]:addClickListener(function() self:initBindBtn()
if ModuleManager.AccountManager:getIsBinded() then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC))
return
end
ModuleManager.AccountManager:bindAccount()
end)
self.uiMap["account_bind_ui.close_btn"]:addClickListener(function() self.uiMap["account_bind_ui.close_btn"]:addClickListener(function()
self:closeUI() self:closeUI()
end) end)
@ -30,12 +24,44 @@ function AccountBindUI:onLoadRootComplete()
self:refreshAccountInfo() self:refreshAccountInfo()
end end
function AccountBindUI:initBindBtn()
if Platform:isIosPlatform() then
self.uiMap["account_bind_ui.title_bg_img.apple_sign_btn"]:setVisible(true)
self.uiMap["account_bind_ui.title_bg_img.google_sign_btn"]:setVisible(false)
self.uiMap["account_bind_ui.title_bg_img.apple_sign_btn"]:addClickListener(function()
if ModuleManager.AccountManager:getIsBinded() then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC))
return
end
ModuleManager.AccountManager:bindAccount()
end)
else
self.uiMap["account_bind_ui.title_bg_img.apple_sign_btn"]:setVisible(false)
self.uiMap["account_bind_ui.title_bg_img.google_sign_btn"]:setVisible(true)
self.uiMap["account_bind_ui.title_bg_img.google_sign_btn"]:addClickListener(function()
if ModuleManager.AccountManager:getIsBinded() then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC))
return
end
ModuleManager.AccountManager:bindAccount()
end)
end
end
function AccountBindUI:refreshAccountInfo() function AccountBindUI:refreshAccountInfo()
if Platform:isIosPlatform() then
if ModuleManager.AccountManager:getIsBinded() then
self.uiMap["account_bind_ui.title_bg_img.apple_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC))
else
self.uiMap["account_bind_ui.title_bg_img.apple_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.BIND_ACCOUNT_DESC))
end
else
if ModuleManager.AccountManager:getIsBinded() then if ModuleManager.AccountManager:getIsBinded() then
self.uiMap["account_bind_ui.title_bg_img.google_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC)) self.uiMap["account_bind_ui.title_bg_img.google_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC))
else else
self.uiMap["account_bind_ui.title_bg_img.google_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.BIND_ACCOUNT_DESC)) self.uiMap["account_bind_ui.title_bg_img.google_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.BIND_ACCOUNT_DESC))
end end
end
end end
return AccountBindUI return AccountBindUI

View File

@ -47,6 +47,21 @@ function GameSettingUI:_display()
end end
function GameSettingUI:initLoginBtn() function GameSettingUI:initLoginBtn()
self:initGoogleLoginBtn()
self:initAppleLoginBtn()
local deleteBtn = self.uiMap["game_setting_ui.bg.delete_btn"]
deleteBtn:addClickListener(function()
ModuleManager.AccountManager:showDeleteUI()
end)
self:refreshAccountInfo()
end
function GameSettingUI:initGoogleLoginBtn()
if Platform:isIosPlatform() then
self.uiMap["game_setting_ui.bg.google_sign_btn"]:setVisible(false)
self.uiMap["game_setting_ui.bg.google_switch_btn"]:setVisible(false)
else
self.uiMap["game_setting_ui.bg.google_sign_btn"]:setVisible(true)
self.uiMap["game_setting_ui.bg.google_sign_btn"]:addClickListener(function() self.uiMap["game_setting_ui.bg.google_sign_btn"]:addClickListener(function()
if ModuleManager.AccountManager:getIsBinded() then if ModuleManager.AccountManager:getIsBinded() then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC)) GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC))
@ -55,6 +70,7 @@ function GameSettingUI:initLoginBtn()
ModuleManager.AccountManager:bindAccount() ModuleManager.AccountManager:bindAccount()
end) end)
self.uiMap["game_setting_ui.bg.google_switch_btn"]:setVisible(true)
self.uiMap["game_setting_ui.bg.google_switch_btn"]:addClickListener(function() self.uiMap["game_setting_ui.bg.google_switch_btn"]:addClickListener(function()
if ModuleManager.AccountManager:getIsBinded() then if ModuleManager.AccountManager:getIsBinded() then
ModuleManager.AccountManager:changeAccount() ModuleManager.AccountManager:changeAccount()
@ -71,12 +87,40 @@ function GameSettingUI:initLoginBtn()
end end
end) end)
self.uiMap["game_setting_ui.bg.google_switch_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.CHANGE_ACCOUNT_DESC)) self.uiMap["game_setting_ui.bg.google_switch_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.CHANGE_ACCOUNT_DESC))
end
end
local deleteBtn = self.uiMap["game_setting_ui.bg.delete_btn"] function GameSettingUI:initAppleLoginBtn()
deleteBtn:addClickListener(function() if Platform:isIosPlatform() then
ModuleManager.AccountManager:showDeleteUI() self.uiMap["game_setting_ui.bg.apple_sign_btn"]:setVisible(true)
self.uiMap["game_setting_ui.bg.apple_sign_btn"]:addClickListener(function()
if ModuleManager.AccountManager:getIsBinded() then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC))
return
end
ModuleManager.AccountManager:bindAccount()
end) end)
self:refreshAccountInfo() self.uiMap["game_setting_ui.bg.apple_switch_btn"]:setVisible(true)
self.uiMap["game_setting_ui.bg.apple_switch_btn"]:addClickListener(function()
if ModuleManager.AccountManager:getIsBinded() then
ModuleManager.AccountManager:changeAccount()
else
local params = {
content = I18N:getGlobalText(I18N.GlobalConst.CHANGE_ACCOUNT_TIPS_DESC),
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
okFunc = function()
ModuleManager.AccountManager:changeAccount()
end
}
GFunc.showMessageBox(params)
end
end)
self.uiMap["game_setting_ui.bg.apple_switch_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.CHANGE_ACCOUNT_DESC))
else
self.uiMap["game_setting_ui.bg.apple_sign_btn"]:setVisible(false)
self.uiMap["game_setting_ui.bg.apple_switch_btn"]:setVisible(false)
end
end end
function GameSettingUI:_addListeners() function GameSettingUI:_addListeners()
@ -149,11 +193,19 @@ function GameSettingUI:refreshVoice()
end end
function GameSettingUI:refreshAccountInfo() function GameSettingUI:refreshAccountInfo()
if Platform:isIosPlatform() then
if ModuleManager.AccountManager:getIsBinded() then
self.uiMap["game_setting_ui.bg.apple_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC))
else
self.uiMap["game_setting_ui.bg.apple_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.BIND_ACCOUNT_DESC))
end
else
if ModuleManager.AccountManager:getIsBinded() then if ModuleManager.AccountManager:getIsBinded() then
self.uiMap["game_setting_ui.bg.google_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC)) self.uiMap["game_setting_ui.bg.google_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_ALREADY_BINDED_DESC))
else else
self.uiMap["game_setting_ui.bg.google_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.BIND_ACCOUNT_DESC)) self.uiMap["game_setting_ui.bg.google_sign_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.BIND_ACCOUNT_DESC))
end end
end
end end
return GameSettingUI return GameSettingUI