UNPKG

one

Version:

One is a React framework for web, iOS, and Android apps.

255 lines (253 loc) • 7.93 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var index_native_exports = {}; __export(index_native_exports, { MFMailComposeViewController: () => MFMailComposeViewController, MFMessageComposeViewController: () => MFMessageComposeViewController }); module.exports = __toCommonJS(index_native_exports); var import_react_native_nitro_modules = require("react-native-nitro-modules"); var import_nativeError = require("../nativeError.native.js"); function _class_call_check(instance, Constructor) { if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function"); } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _create_class(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _define_property(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true }); } else obj[key] = value; return obj; } function create(name) { if (!import_react_native_nitro_modules.NitroModules.hasHybridObject(name)) throw new Error("MessageUI needs an iOS build"); return import_react_native_nitro_modules.NitroModules.createHybridObject(name); } var mailCapabilities; var messageCapabilities; var MFMailComposeViewController = /* @__PURE__ */ (function() { "use strict"; function MFMailComposeViewController2() { _class_call_check(this, MFMailComposeViewController2); _define_property(this, "mailComposeDelegate", null); _define_property(this, "native", create("OneMailCompose")); } _create_class(MFMailComposeViewController2, [ { key: "setSubject", value: function setSubject(subject) { this.native.setSubject(subject); } }, { key: "setToRecipients", value: function setToRecipients(recipients) { this.native.setToRecipients(recipients); } }, { key: "setCcRecipients", value: function setCcRecipients(recipients) { this.native.setCcRecipients(recipients); } }, { key: "setBccRecipients", value: function setBccRecipients(recipients) { this.native.setBccRecipients(recipients); } }, { key: "setMessageBody", value: function setMessageBody(body, isHTML) { this.native.setMessageBody(body, isHTML); } }, { key: "setPreferredSendingEmailAddress", value: function setPreferredSendingEmailAddress(emailAddress) { this.native.setPreferredSendingEmailAddress(emailAddress); } }, { key: "addAttachmentData", value: function addAttachmentData(attachment, mimeType, fileName) { this.native.addAttachmentData(attachment, mimeType, fileName); } }, { key: "present", value: function present() { var _this = this; var animated = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true; return this.native.present(animated, function(result, error) { var _this_mailComposeDelegate; return (_this_mailComposeDelegate = _this.mailComposeDelegate) === null || _this_mailComposeDelegate === void 0 ? void 0 : _this_mailComposeDelegate.mailComposeController(_this, { didFinishWith: result, error }); }).catch(import_nativeError.rethrowNativeError); } }, { key: "dismiss", value: function dismiss() { var animated = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true; return this.native.dismiss(animated).catch(import_nativeError.rethrowNativeError); } } ], [{ key: "canSendMail", value: function canSendMail() { return (mailCapabilities !== null && mailCapabilities !== void 0 ? mailCapabilities : mailCapabilities = create("OneMailCompose")).canSendMail(); } }]); return MFMailComposeViewController2; })(); var MFMessageComposeViewController = /* @__PURE__ */ (function() { "use strict"; function MFMessageComposeViewController2() { _class_call_check(this, MFMessageComposeViewController2); _define_property(this, "messageComposeDelegate", null); _define_property(this, "native", create("OneMessageCompose")); } _create_class(MFMessageComposeViewController2, [ { key: "recipients", get: function get() { return this.native.recipients; }, set: function set(value) { this.native.recipients = value; } }, { key: "body", get: function get() { return this.native.body; }, set: function set(value) { this.native.body = value; } }, { key: "subject", get: function get() { return this.native.subject; }, set: function set(value) { this.native.subject = value; } }, { key: "attachments", get: function get() { return this.native.attachments; } }, { key: "disableUserAttachments", value: function disableUserAttachments() { this.native.disableUserAttachments(); } }, { key: "addAttachmentData", value: function addAttachmentData(attachment, typeIdentifier, filename) { return this.native.addAttachmentData(attachment, typeIdentifier, filename); } }, { key: "addAttachmentURL", value: function addAttachmentURL(attachmentURL, withAlternateFilename) { return this.native.addAttachmentURL(attachmentURL, withAlternateFilename); } }, { key: "present", value: function present() { var _this = this; var animated = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true; return this.native.present(animated, function(result) { var _this_messageComposeDelegate; return (_this_messageComposeDelegate = _this.messageComposeDelegate) === null || _this_messageComposeDelegate === void 0 ? void 0 : _this_messageComposeDelegate.messageComposeViewController(_this, { didFinishWith: result }); }).catch(import_nativeError.rethrowNativeError); } }, { key: "dismiss", value: function dismiss() { var animated = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true; return this.native.dismiss(animated).catch(import_nativeError.rethrowNativeError); } } ], [ { key: "capabilities", value: function capabilities() { return messageCapabilities !== null && messageCapabilities !== void 0 ? messageCapabilities : messageCapabilities = create("OneMessageCompose"); } }, { key: "canSendText", value: function canSendText() { return this.capabilities().canSendText(); } }, { key: "canSendAttachments", value: function canSendAttachments() { return this.capabilities().canSendAttachments(); } }, { key: "canSendSubject", value: function canSendSubject() { return this.capabilities().canSendSubject(); } }, { key: "isSupportedAttachmentUTI", value: function isSupportedAttachmentUTI(uti) { return this.capabilities().isSupportedAttachmentUTI(uti); } } ]); return MFMessageComposeViewController2; })();