Show feedback when the compatibility is submitted.

This commit is contained in:
Unknown W. Brackets 2016-06-27 22:59:09 -07:00
parent 45218be5e3
commit 42fd4aeb12
4 changed files with 73 additions and 6 deletions

View file

@ -294,7 +294,7 @@ EventReturn ReportScreen::HandleBrowser(EventParams &e) {
}
ReportFinishScreen::ReportFinishScreen(const std::string &gamePath)
: UIScreenWithGameBackground(gamePath) {
: UIScreenWithGameBackground(gamePath), resultNotice_(nullptr), setStatus_(false) {
}
void ReportFinishScreen::CreateViews() {
@ -309,7 +309,7 @@ void ReportFinishScreen::CreateViews() {
LinearLayout *rightColumnItems = new LinearLayout(ORIENT_VERTICAL);
leftColumnItems->Add(new TextView(rp->T("FeedbackThanks", "Thanks for your feedback."), new LinearLayoutParams(Margins(12, 5, 0, 5))));
leftColumnItems->Add(new TextView(rp->T("FeedbackDelayInfo", "Your data is being submitted in the background."), new LinearLayoutParams(Margins(12, 5, 0, 5))));
resultNotice_ = leftColumnItems->Add(new TextView(rp->T("FeedbackDelayInfo", "Your data is being submitted in the background."), new LinearLayoutParams(Margins(12, 5, 0, 5))));
rightColumnItems->SetSpacing(0.0f);
rightColumnItems->Add(new Choice(rp->T("View Feedback")))->OnClick.Handle(this, &ReportFinishScreen::HandleViewFeedback);
@ -325,6 +325,30 @@ void ReportFinishScreen::CreateViews() {
rightColumn->Add(rightColumnItems);
}
void ReportFinishScreen::update(InputState &input) {
I18NCategory *rp = GetI18NCategory("Reporting");
if (!setStatus_) {
Reporting::Status status = Reporting::GetStatus();
switch (status) {
case Reporting::Status::WORKING:
resultNotice_->SetText(rp->T("FeedbackSubmitDone", "Your data has been submitted."));
break;
case Reporting::Status::FAILING:
resultNotice_->SetText(rp->T("FeedbackSubmitFail", "Could not submit data to server. Try updating PPSSPP."));
break;
case Reporting::Status::BUSY:
default:
// Can't update yet.
break;
}
}
UIScreenWithGameBackground::update(input);
}
UI::EventReturn ReportFinishScreen::HandleViewFeedback(UI::EventParams &e) {
const std::string url = "http://" + Reporting::ServerHost() + "/game/" + Reporting::CurrentGameID();
LaunchBrowser(url.c_str());