Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed Jun 19, 2019
1 parent 45c10c8 commit 5dcb8e6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
.vscode
.vscode
README.md
12 changes: 8 additions & 4 deletions email.android.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
var application = require("tns-core-modules/application");
var fs = require("tns-core-modules/file-system");

(function() {
(function () {
_cleanAttachmentFolder();
})();

var _determineAvailability = function() {
var _determineAvailability = function () {
var uri = android.net.Uri.fromParts("mailto", "", null);
var intent = new android.content.Intent(android.content.Intent.ACTION_SENDTO, uri);
var packageManager = application.android.context.getPackageManager();
Expand Down Expand Up @@ -132,7 +132,9 @@ function _getUriForAssetPath(path, fileName, ctx) {
}

var localFile = fs.File.fromPath(path);
var localFileContents = localFile.readSync(function(e) { error = e; });
var localFileContents = localFile.readSync(function (e) {
error = e;
});

var cacheFileName = _writeBytesToFile(ctx, fileName, localFileContents);
if (cacheFileName.indexOf("file://") === -1) {
Expand Down Expand Up @@ -167,7 +169,9 @@ function _writeBytesToFile(ctx, fileName, contents) {
var cacheFileName = storage + "/" + fileName;

var toFile = fs.File.fromPath(cacheFileName);
toFile.writeSync(contents, function(e) { error = e; });
toFile.writeSync(contents, function (e) {
error = e;
});

if (cacheFileName.indexOf("file://") === -1) {
cacheFileName = "file://" + cacheFileName;
Expand Down
25 changes: 14 additions & 11 deletions email.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var frame = require("tns-core-modules/ui/frame");

var _isEmailAvailable = null;

var _determineAvailability = function() {
var _determineAvailability = function () {
if (_isEmailAvailable === null) {
var isSimulator;
var processInfo = utils.ios.getter(NSProcessInfo, NSProcessInfo.processInfo);
Expand Down Expand Up @@ -48,15 +48,15 @@ exports.compose = function (arg) {

var topMostFrame = frame.topmost();
if (topMostFrame) {
var viewController = topMostFrame.currentPage && topMostFrame.currentPage.ios;
if (viewController) {
while (viewController.parentViewController) {
viewController = viewController.parentViewController;
}
while (viewController.presentedViewController) {
viewController = viewController.presentedViewController;
}
var viewController = topMostFrame.currentPage && topMostFrame.currentPage.ios;
if (viewController) {
while (viewController.parentViewController) {
viewController = viewController.parentViewController;
}
while (viewController.presentedViewController) {
viewController = viewController.presentedViewController;
}
}
}

var mail = MFMailComposeViewController.new();
Expand Down Expand Up @@ -135,7 +135,7 @@ function _getDataForAttachmentPath(path) {
}

function _dataFromBase64(base64String) {
base64String = base64String.substring(base64String.indexOf("://")+3);
base64String = base64String.substring(base64String.indexOf("://") + 3);
return NSData.alloc().initWithBase64EncodedStringOptions(base64String, 0);
}

Expand All @@ -148,7 +148,9 @@ function _dataForAsset(path) {
}

var localFile = fs.File.fromPath(path);
return localFile.readSync(function(e) { error = e; });
return localFile.readSync(function (e) {
error = e;
});
}

function _dataForAbsolutePath(path) {
Expand All @@ -165,6 +167,7 @@ function _dataForAbsolutePath(path) {

var MFMailComposeViewControllerDelegateImpl = (function (_super) {
__extends(MFMailComposeViewControllerDelegateImpl, _super);

function MFMailComposeViewControllerDelegateImpl() {
_super.apply(this, arguments);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nativescript-email",
"version": "1.5.3",
"version": "1.5.4",
"description": "Email plugin for your NativeScript app",
"main": "email",
"typings": "index.d.ts",
Expand Down

0 comments on commit 5dcb8e6

Please sign in to comment.