@@ -17,6 +17,10 @@ import NavContext from '../../navContext';
1717import tipShare from './img/tip-share.png' ;
1818import tipRightClick from './img/tip-right-click.png' ;
1919import LauncherManager from '../../manager/launcherManager' ;
20+ import InputContainer from '../editprofile/components/inputcontainer' ;
21+ import Checkbox from '../../component/checkbox/checkbox' ;
22+ import Detail from '../../component/detail/detail' ;
23+ import Analytics from '../../util/analytics' ;
2024
2125const { dialog } = require ( 'electron' ) . remote ;
2226
@@ -118,6 +122,7 @@ function WelcomePage({ history }) {
118122 const [ mcExe , setMCExe ] = useState ( Global . getDefaultMCExePath ( ) ) ;
119123 const [ step , setStep ] = useState ( 0 ) ;
120124 const [ preparing , setPreparing ] = useState ( false ) ;
125+ const [ analyticsEnabled , setAnalyticsEnabled ] = useState ( true ) ;
121126
122127 useEffect ( ( ) => {
123128 nav . header . setTitle ( 'welcome' ) ;
@@ -146,7 +151,12 @@ function WelcomePage({ history }) {
146151 SettingsManager . setMCExe ( mcExe ) ;
147152
148153 SettingsManager . currentSettings . mcAccount = Object . keys ( LauncherManager . getMCAccounts ( ) ) [ 0 ] ;
154+ SettingsManager . currentSettings . analyticsEnabled = analyticsEnabled ;
155+ SettingsManager . currentSettings . lastVersion = Global . MCM_VERSION ;
149156 SettingsManager . save ( ) ;
157+
158+ if ( analyticsEnabled ) Analytics . send ( 'first-install' ) ;
159+
150160 const mcl = path . join ( LibrariesManager . getLibrariesPath ( ) , '/minecraftmanager' ) ;
151161 if ( ! fs . existsSync ( mcl ) ) {
152162 fs . mkdirSync ( mcl ) ;
@@ -188,6 +198,10 @@ function WelcomePage({ history }) {
188198 }
189199 } ;
190200
201+ const analyticsClick = ( ) => {
202+ setAnalyticsEnabled ( ! analyticsEnabled ) ;
203+ }
204+
191205 return (
192206 < >
193207 < Content >
@@ -283,6 +297,27 @@ function WelcomePage({ history }) {
283297 ) }
284298
285299 { step === 4 && (
300+ < >
301+ < Spacing />
302+ < Title > Analytics</ Title >
303+
304+ < p >
305+ Minecraft Manager contains anonymous, privacy-respecting analytics. < br />
306+ Would you like these to be enabled?
307+ </ p >
308+
309+ < InputContainer >
310+ < Checkbox lighter checked = { analyticsEnabled } onClick = { analyticsClick } />
311+ < Detail > Enable Analytics</ Detail >
312+ </ InputContainer >
313+
314+ < GB onClick = { nextStep } color = "green" >
315+ continue
316+ </ GB >
317+ </ >
318+ ) }
319+
320+ { step === 5 && (
286321 < >
287322 < Spacing />
288323 < Title > You're all set!</ Title >
@@ -300,7 +335,7 @@ function WelcomePage({ history }) {
300335 </ >
301336 ) }
302337
303- { step === 5 && (
338+ { step === 6 && (
304339 < >
305340 < Spacing />
306341 < Title > tips and tricks</ Title >
@@ -318,7 +353,7 @@ function WelcomePage({ history }) {
318353 </ >
319354 ) }
320355
321- { step === 6 && (
356+ { step === 7 && (
322357 < >
323358 < Spacing />
324359 < Title > tips and tricks</ Title >
0 commit comments