From 970b8edd3d3ff26cefe49e9ee34eb1124c617352 Mon Sep 17 00:00:00 2001
From: Daniel Gerhardt <code@dgerhardt.net>
Date: Fri, 1 Feb 2019 13:56:33 +0100
Subject: [PATCH] Enable export/import for iOS

Recent iOS version should be able to handle the export and import w/o
problems.
---
 src/main/webapp/app/internationalization.js   |  2 -
 .../webapp/app/view/home/MySessionsPanel.js   | 12 ++----
 .../app/view/speaker/AudienceQuestionPanel.js | 38 +++++++++----------
 3 files changed, 22 insertions(+), 30 deletions(-)

diff --git a/src/main/webapp/app/internationalization.js b/src/main/webapp/app/internationalization.js
index 7ec2cacd8..2c27e3656 100755
--- a/src/main/webapp/app/internationalization.js
+++ b/src/main/webapp/app/internationalization.js
@@ -525,7 +525,6 @@
 				EXPORT_SELECTED_SESSIONS_MSG: "Wohin möchten Sie die Session(s) exportieren?",
 				EXPORT_SESSION_INFORMATION: "Neben Hörsaal- und Vorbereitungsaufgaben der ausgewählten Sessions werden zusätzlich exportiert...",
 				EXPORT_NOTIFICATION: "Es wurde keine Session ausgewählt",
-				EXPORT_IOS_NOTIFICATION: "Ein Export kann auf iOS-Geräten nicht durchgeführt werden",
 				EXPORT_BUTTON_FS: "Mein System",
 				EXPORT_BUTTON_PP: "Public Pool",
 				EXPORT_PP_NOTIFICATION: 'Als "Gast" können Sie keine Session in den Public Pool exportieren. Bitte melden Sie sich über einen der anderen Zugänge an.',
@@ -1416,7 +1415,6 @@
 				EXPORT_SELECTED_SESSIONS_MSG: "Where should the session(s) be exported?",
 				EXPORT_SESSION_INFORMATION: "Auditorium questions and preparation tasks questions for the selected sessions will be exported.",
 				EXPORT_NOTIFICATION:	"No session selected.",
-				EXPORT_IOS_NOTIFICATION: "An export can not be performed on iOS devices.",
 				EXPORT_BUTTON_FS: "My System",
 				EXPORT_BUTTON_PP: "Public Pool",
 				EXPORT_PP_NOTIFICATION: 'As a "guest" you can not export a session in the public pool. Please log in using one of the other approaches.',
diff --git a/src/main/webapp/app/view/home/MySessionsPanel.js b/src/main/webapp/app/view/home/MySessionsPanel.js
index 55389e055..ee57ed5b9 100644
--- a/src/main/webapp/app/view/home/MySessionsPanel.js
+++ b/src/main/webapp/app/view/home/MySessionsPanel.js
@@ -313,14 +313,10 @@ Ext.define('ARSnova.view.home.MySessionsPanel', {
 							fn: function (btn) {
 								var dest = null;
 								if (btn === 'yes') {
-									if (Ext.os.is.iOS) {
-										Ext.Msg.alert(Messages.NOTIFICATION, Messages.EXPORT_IOS_NOTIFICATION);
-									} else {
-										dest = Ext.create('ARSnova.view.home.SessionExportListPanel', {
-											exportType: 'filesystem'
-										});
-										hTP.animateActiveItem(dest, 'slide');
-									}
+									dest = Ext.create('ARSnova.view.home.SessionExportListPanel', {
+										exportType: 'filesystem'
+									});
+									hTP.animateActiveItem(dest, 'slide');
 								} else {
 									if (ARSnova.app.loginMode === ARSnova.app.LOGIN_GUEST) {
 										Ext.Msg.alert(Messages.NOTIFICATION, Messages.EXPORT_PP_NOTIFICATION);
diff --git a/src/main/webapp/app/view/speaker/AudienceQuestionPanel.js b/src/main/webapp/app/view/speaker/AudienceQuestionPanel.js
index aaa428a28..509b2a75a 100644
--- a/src/main/webapp/app/view/speaker/AudienceQuestionPanel.js
+++ b/src/main/webapp/app/view/speaker/AudienceQuestionPanel.js
@@ -223,29 +223,27 @@ Ext.define('ARSnova.view.speaker.AudienceQuestionPanel', {
 			listeners: {
 				loadsuccess: function (data) {
 					var error = false;
-					if (!Ext.os.is.iOS) {
-						// remove prefix and decode
-						var str = data.substring(data.indexOf("base64,") + 7);
-						data = atob(str);
-						try {
-							data = decodeURIComponent(window.escape(data));
-						} catch (e) {
-							error = true;
-							console.warn("Invalid charset: UTF-8 expected");
-						}
-
-						if (self.getVariant() === 'flashcard') {
-							self.loadFilePanel.hide();
-							ARSnova.app.getController('FlashcardImport')
-								.importFile(data, this.importCsv, this.importFlashcards);
-						} else {
-							ARSnova.app.getController('QuestionImport').importCsvFile(data);
-						}
+					// remove prefix and decode
+					var str = data.substring(data.indexOf("base64,") + 7);
+					data = atob(str);
+					try {
+						data = decodeURIComponent(window.escape(data));
+					} catch (e) {
+						error = true;
+						console.warn("Invalid charset: UTF-8 expected");
+					}
 
-						this.importCsv = false;
-						this.importFlashcards = false;
+					if (self.getVariant() === 'flashcard') {
+						self.loadFilePanel.hide();
+						ARSnova.app.getController('FlashcardImport')
+							.importFile(data, this.importCsv, this.importFlashcards);
+					} else {
+						ARSnova.app.getController('QuestionImport').importCsvFile(data);
 					}
 
+					this.importCsv = false;
+					this.importFlashcards = false;
+
 					if (error) {
 						Ext.Msg.alert(Messages.NOTIFICATION, Messages.QUESTIONS_IMPORT_INVALID_CHARSET);
 					}
-- 
GitLab