@SuppressLint({"SimpleDateFormat"}) private void onDestroySurvey() { if (this.mMixpanel != null) { if (this.mUpdateDisplayState != null) { Object localObject2 = getSurveyState(); Survey localSurvey = ((UpdateDisplayState.DisplayState.SurveyState)localObject2).getSurvey(); Object localObject3 = localSurvey.getQuestions(); Object localObject1 = this.mUpdateDisplayState.getDistinctId(); localObject1 = this.mMixpanel.getPeople().withIdentity((String)localObject1); ((MixpanelAPI.People)localObject1).append("$responses", Integer.valueOf(localSurvey.getCollectionId())); localObject2 = ((UpdateDisplayState.DisplayState.SurveyState)localObject2).getAnswers(); localObject3 = ((List)localObject3).iterator(); while (((Iterator)localObject3).hasNext()) { Object localObject4 = (Survey.Question)((Iterator)localObject3).next(); String str = ((UpdateDisplayState.AnswerMap)localObject2).get(Integer.valueOf(((Survey.Question)localObject4).getId())); if (str != null) { try { JSONObject localJSONObject = new JSONObject(); localJSONObject.put("$survey_id", localSurvey.getId()); localJSONObject.put("$collection_id", localSurvey.getCollectionId()); localJSONObject.put("$question_id", ((Survey.Question)localObject4).getId()); localJSONObject.put("$question_type", ((Survey.Question)localObject4).getType().toString()); localObject4 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); ((DateFormat)localObject4).setTimeZone(TimeZone.getTimeZone("UTC")); localJSONObject.put("$time", ((DateFormat)localObject4).format(new Date())); localJSONObject.put("$value", str); ((MixpanelAPI.People)localObject1).append("$answers", localJSONObject); } catch (JSONException localJSONException) { Log.e("MixpanelAPI.SrvyActvty", "Couldn't record user's answer.", localJSONException); } } } } this.mMixpanel.flush(); } UpdateDisplayState.releaseDisplayState(this.mIntentId); }
public void onBackPressed() { if ((isShowingSurvey()) && (this.mCurrentQuestion > 0)) { goToPreviousQuestion(); return; } if (isShowingInApp()) { UpdateDisplayState.releaseDisplayState(this.mIntentId); } super.onBackPressed(); }