@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(); }
protected void onCreate(Bundle paramBundle) { TraceMachine.startTracing("SurveyActivity"); try { TraceMachine.enterMethod(this._nr_trace, "SurveyActivity#onCreate", null); super.onCreate(paramBundle); this.mIntentId = getIntent().getIntExtra("com.mixpanel.android.surveys.SurveyActivity.INTENT_ID_KEY", Integer.MAX_VALUE); this.mUpdateDisplayState = UpdateDisplayState.claimDisplayState(this.mIntentId); if (this.mUpdateDisplayState == null) { Log.e("MixpanelAPI.SrvyActvty", "SurveyActivity intent received, but nothing was found to show."); finish(); TraceMachine.exitMethod(); return; } } catch (NoSuchFieldError localNoSuchFieldError) { for (;;) { TraceMachine.enterMethod(null, "SurveyActivity#onCreate", null); } this.mMixpanel = MixpanelAPI.getInstance(this, this.mUpdateDisplayState.getToken()); if (!isShowingInApp()) { break label116; } } onCreateInAppNotification(paramBundle); for (;;) { TraceMachine.exitMethod(); return; label116: if (isShowingSurvey()) { onCreateSurvey(paramBundle); } else { finish(); } } }