Skip to content

Added email registration for NativeScript mailing lists as post install step #2134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 17, 2016

Conversation

tzraikov
Copy link
Contributor

@tzraikov tzraikov commented Oct 17, 2016

@tzraikov tzraikov force-pushed the raikov/email-registration-2 branch from 085c04d to d25f412 Compare October 17, 2016 10:35

export class PostInstallCliCommand extends PostInstallCommand {

private fileSystem: IFileSystem;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property is just assigned, it's not used anywhere, consider removing it.


public execute(args: string[]): IFuture<void> {
return (() => {
super.execute(args).wait();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mixed spaces and tabs

this.logger.out("Leave your e-mail address here to subscribe for NativeScript newsletter and product updates, tips and tricks:");
let email = this.getEmail("(press Enter for blank)").wait();
this.sendEmail(email);
this.$userSettingsService.saveSetting("EMAIL_REGISTERED", true).wait();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the sendEmail command fails, next time when user installs NS CLI, he'll be prompted again (as the EMAIL_REGISTERED value will never be written in the settings file), is this expected? In case not, you can swap the two lines above.

}

private shouldAskForEmail(): boolean {
if (!helpers.isInteractive() || process.env.CLI_NOPROMPT === "1" || this.$userSettingsService.getSettingValue("EMAIL_REGISTERED").wait()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be simplified to:

return helpers.isInteractive() && process.env.CLI_NOPROMPT !== "1" && !this.$userSettingsService.getSettingValue("EMAIL_REGISTERED").wait();

But I do not insist changing it.

@@ -0,0 +1,91 @@
import {PostInstallCommand} from "../common/commands/post-install";
let emailValidatorModule = require('email-validator');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can include the email-validator.d.ts file from here:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/email-validator/email-validator.d.ts
Which will allow you to use

import * as emailValidator  from "email-validator";

But this is not a merge stopper :)

@@ -0,0 +1,91 @@
import {PostInstallCommand} from "../common/commands/post-install";
let emailValidatorModule = require('email-validator');
let queryString = require('querystring');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use

import * as querystring from "querystring";

@tzraikov tzraikov force-pushed the raikov/email-registration-2 branch 3 times, most recently from 06aebfd to 4bde8cc Compare October 17, 2016 11:53
@tzraikov tzraikov force-pushed the raikov/email-registration-2 branch from 4bde8cc to 402e33f Compare October 17, 2016 11:56
@tzraikov tzraikov merged commit 153739e into master Oct 17, 2016
@tzraikov tzraikov deleted the raikov/email-registration-2 branch October 17, 2016 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants