Skip to content

Commit

Permalink
Set new user in main app instead of utils
Browse files Browse the repository at this point in the history
  • Loading branch information
sho-87 committed Mar 14, 2020
1 parent fbe223b commit 8e60adc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ class App extends Component {
if (!this.props.isEmbed) {
localStorage.setItem('version', version);
}

if (isNewUser()) {
localStorage.setItem('isNewUser', false);
}
}

/**
Expand Down Expand Up @@ -688,7 +692,7 @@ class App extends Component {
? isUpgrade(localStorage.getItem('version'), version)
: true
}
isNewUser={isNewUser}
isNewUser={isNewUser()}
isInvalidBuild={this.invalidModalFlag}
/>

Expand Down
3 changes: 1 addition & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ export function isNewUser() {
!localStorage.getItem('isNewUser') ||
JSON.parse(localStorage.getItem('isNewUser') === true)
) {
localStorage.setItem('isNewUser', false);
return true;
} else {
return false;
Expand All @@ -215,7 +214,7 @@ export function isNewUser() {
*/
export function isUpgrade(oldVer, newVer) {
// New users are never considered upgrades
if (!localStorage.getItem('isNewUser')) {
if (isNewUser()) {
return false;
}

Expand Down

0 comments on commit 8e60adc

Please sign in to comment.