void FinishRecording(UIAlertAction _) { Logger.LOG_EVENT_WITH_ACTION("STOP_RECORDING", ""); // Only once a recording is complete can End for each annotation be computed InterviewPrompt.ComputeEndForAllAnnotationsInSession(AudioRecorder.CurrentTime()); InterviewSession session = new InterviewSession { ConsentType = NSUserDefaults.StandardUserDefaults.StringForKey("SESSION_CONSENT"), Lang = (int)NSUserDefaults.StandardUserDefaults.IntForKey("SESSION_LANG"), SessionID = InterviewSessionID, RecordingURL = AudioRecorder.FinishRecording(), CreatedAt = DateTime.Now, // This uniquely identifies who created the interview; the account created locally // will have a different ID than the one on the server as they are not in sync CreatorEmail = Session.ActiveUser.Email, ProjectID = SelectedProjectID, Prompts = Queries.AnnotationsForLastSession(), IsUploaded = false }; session = Queries.AddSelectedParticipantsToInterviewSession(session); Queries.AddInterviewSession(session); NSUserDefaults.StandardUserDefaults.SetBool(true, "SESSION_RECORDED"); // The ProjectsController manages uploading sessions PerformSegue("UnWindToSessionsVC", this); }
void SaveRecording() { // Only once a recording is complete can End for each annotation be computed InterviewPrompt.ComputeEndForAllAnnotationsInSession(_seconds); InterviewSession thisSession = new InterviewSession { ConsentType = ConsentType, SessionID = InterviewSessionID, RecordingURL = _path, CreatedAt = DateTime.UtcNow, Lang = langId, CreatorEmail = Session.ActiveUser.Email, ProjectID = SelectedProjectID, Prompts = Queries.AnnotationsForLastSession(), IsUploaded = false }; // Added before to simplify accessing the participants involved next. thisSession = Queries.AddSelectedParticipantsToInterviewSession(thisSession); Queries.AddInterviewSession(thisSession); // Now the session has been stored to the database we no longer need it var _prefs = PreferenceManager.GetDefaultSharedPreferences(ApplicationContext); _prefs.Edit().Remove("SESSION_CONSENT").Commit(); _prefs.Edit().Remove("SESSION_LANG").Commit(); _prefs.Edit().PutBoolean("SESSION_RECORDED", true).Commit(); }