(app, platform)
| 53 | } |
| 54 | |
| 55 | private share(app, platform): void { |
| 56 | const logs = this.prepareSessionLogs(); |
| 57 | const now = new Date().toISOString(); |
| 58 | const subject: string = app + '-logs ' + now; |
| 59 | const message = |
| 60 | 'Session Logs. Be careful, this could contain sensitive private data'; |
| 61 | |
| 62 | const blob = new Blob([logs], { type: 'text/txt' }); |
| 63 | |
| 64 | const reader = new FileReader(); |
| 65 | reader.onload = event => { |
| 66 | const attachment = (event as any).target.result; // <-- data url |
| 67 | |
| 68 | if (platform == 'android') { |
| 69 | this.shareAndroid(message, subject, attachment); |
| 70 | } else { |
| 71 | this.shareIOS(message, subject, attachment); |
| 72 | } |
| 73 | }; |
| 74 | |
| 75 | reader.readAsDataURL(blob); |
| 76 | } |
| 77 | |
| 78 | private shareAndroid(message, subject, attachment): void { |
| 79 | // share via email with attachment is not working correctly in some android versions |
no test coverage detected