(event)
| 106 | |
| 107 | // Triggered when a file is selected via the media picker. |
| 108 | function onMediaFileSelected(event) { |
| 109 | event.preventDefault(); |
| 110 | var file = event.target.files[0]; |
| 111 | |
| 112 | // Clear the selection in the file picker input. |
| 113 | imageFormElement.reset(); |
| 114 | |
| 115 | // Check if the file is an image. |
| 116 | if (!file.type.match('image.*')) { |
| 117 | var data = { |
| 118 | message: 'You can only share images', |
| 119 | timeout: 2000, |
| 120 | }; |
| 121 | signInSnackbarElement.MaterialSnackbar.showSnackbar(data); |
| 122 | return; |
| 123 | } |
| 124 | // Check if the user is signed-in |
| 125 | if (checkSignedInWithMessage()) { |
| 126 | saveImageMessage(file); |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | // Triggered when the send new message form is submitted. |
| 131 | function onMessageFormSubmit(e) { |
nothing calls this directly
no test coverage detected