| 84 | } |
| 85 | |
| 86 | private shareIOS(message, subject, attachment): void { |
| 87 | // Check if sharing via email is supported |
| 88 | this.socialSharing |
| 89 | .canShareViaEmail() |
| 90 | .then(() => { |
| 91 | this.logger.info('sharing via email is possible'); |
| 92 | this.socialSharing |
| 93 | .shareViaEmail( |
| 94 | message, |
| 95 | subject, |
| 96 | null, // TO: must be null or an array |
| 97 | null, // CC: must be null or an array |
| 98 | null, // BCC: must be null or an array |
| 99 | attachment // FILES: can be null, a string, or an array |
| 100 | ) |
| 101 | .then(data => { |
| 102 | this.logger.info('Email created successfully: ', data); |
| 103 | }) |
| 104 | .catch(err => { |
| 105 | this.logger.error('socialSharing Error: ', err); |
| 106 | }); |
| 107 | }) |
| 108 | .catch(() => { |
| 109 | this.logger.warn('sharing via email is not possible'); |
| 110 | this.socialSharing |
| 111 | .share( |
| 112 | message, |
| 113 | subject, |
| 114 | attachment // FILES: can be null, a string, or an array |
| 115 | ) |
| 116 | .catch(err => { |
| 117 | this.logger.error('socialSharing Error: ', err); |
| 118 | }); |
| 119 | }); |
| 120 | } |
| 121 | } |