-
-
Notifications
You must be signed in to change notification settings - Fork 197
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
Conversation
085c04d
to
d25f412
Compare
|
||
export class PostInstallCliCommand extends PostInstallCommand { | ||
|
||
private fileSystem: IFileSystem; |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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()) { |
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
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";
06aebfd
to
4bde8cc
Compare
4bde8cc
to
402e33f
Compare
#2128