FIX: fix the country code not correct issue under pre environment

Change-Id: I5fa3f20949b3f50304d42a50b3819cc5e04c0656
This commit is contained in:
lane.wei 2023-01-07 21:21:31 +08:00 committed by Lane.Wei
parent b3575b47d1
commit 0ddd7ed5e7
1 changed files with 8 additions and 7 deletions

View File

@ -241,7 +241,7 @@ wxBoxSizer *PreferencesDialog::create_item_region_combobox(wxString title, wxWin
auto region_index = e.GetSelection(); auto region_index = e.GetSelection();
auto region = local_regions[region_index]; auto region = local_regions[region_index];
auto area = ""; /*auto area = "";
if (region == "CHN" || region == "China") if (region == "CHN" || region == "China")
area = "CN"; area = "CN";
else if (region == "USA") else if (region == "USA")
@ -253,7 +253,7 @@ wxBoxSizer *PreferencesDialog::create_item_region_combobox(wxString title, wxWin
else if (region == "North America") else if (region == "North America")
area = "US"; area = "US";
else else
area = "Others"; area = "Others";*/
NetworkAgent* agent = wxGetApp().getAgent(); NetworkAgent* agent = wxGetApp().getAgent();
AppConfig* config = GUI::wxGetApp().app_config; AppConfig* config = GUI::wxGetApp().app_config;
@ -265,10 +265,11 @@ wxBoxSizer *PreferencesDialog::create_item_region_combobox(wxString title, wxWin
return; return;
} else { } else {
wxGetApp().request_user_logout(); wxGetApp().request_user_logout();
config->set("region", region.ToStdString());
auto area = config->get_country_code();
if (agent) { if (agent) {
agent->set_country_code(area); agent->set_country_code(area);
} }
config->set("region", region.ToStdString());
EndModal(wxID_CANCEL); EndModal(wxID_CANCEL);
} }
} else { } else {