Exemplo n.º 1
0
        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);
        }