@@ -39,7 +39,6 @@ define(function (require, exports, module) {
3939 const GENERAL_SURVEY_TIME = 1200000 , // 20 min
4040 SURVEY_PRELOAD_DELAY = 10000 , // 10 seconds to allow the survey to preload, but not
4141 // enough time to break user workflow
42- ONE_MONTH_IN_DAYS = 30 ,
4342 POWER_USER_SURVEY_INTERVAL_DAYS = 35 ;
4443
4544 const userAlreadyDidAction = PhStore . getItem ( GUIDED_TOUR_LOCAL_STORAGE_KEY )
@@ -58,11 +57,10 @@ define(function (require, exports, module) {
5857 * 2. Then after user opens default project, we show "edit code for live preview popup"
5958 * 3. When user changes file by clicking on files panel, we show "click here to open new project window"
6059 * this will continue showing every session until user clicks on the new project icon
61- * 4. After about 2 minutes, the GitHub stars popup will show, if not shown in the past two weeks. Repeats 2 weeks.
62- * 5. After about 3 minutes, the health popup will show up.
63- * 6. power user survey shows up if the user has used brackets for 3 days or 8 hours in the last two weeks after 3
60+ * 4. After about 3 minutes, the health popup will show up.
61+ * 5. power user survey shows up if the user has used brackets for 3 days or 8 hours in the last two weeks after 3
6462 * minutes. This will not coincide with health popup due to the power user check.
65- * 7 . After about 10 minutes, survey shows up.
63+ * 6 . After about 10 minutes, survey shows up.
6664 * // the rest are by user actions
6765 * a. When user clicks on live preview, we show "click here to popout live preview"
6866 * b. Beautification notification when user opened the editor context menu and have not done any beautification yet.
@@ -125,94 +123,6 @@ define(function (require, exports, module) {
125123 } ) ;
126124 }
127125
128- function _loadTwitterScripts ( ) {
129- // https://developer.twitter.com/en/docs/twitter-for-websites/javascript-api/guides/javascript-api
130- // we maily do this to metric the users who clicked on the tweet button
131- if ( window . twttr ) {
132- return ;
133- }
134- const twitterScript = document . createElement ( 'script' ) ;
135- twitterScript . setAttribute ( 'src' , "https://platform.twitter.com/widgets.js" ) ;
136- document . body . appendChild ( twitterScript ) ;
137- twitterScript . addEventListener ( "load" , ( ) => {
138- if ( ! window . twttr ) {
139- console . error ( "twitter scripts not loaded" ) ;
140- return ;
141- }
142- window . twttr . events . bind ( 'click' , function ( ev ) {
143- Metrics . countEvent ( Metrics . EVENT_TYPE . USER , "notify" , "twit.click" , 1 ) ;
144- if ( Phoenix . isNativeApp ) {
145- // hyperlinks wont work in tauri, so we have to use tauri apis
146- Phoenix . app . openURLInDefaultBrowser (
147- 'https://twitter.com/intent/tweet?screen_name=phcodedev&ref_src=twsrc%5Etfw' ) ;
148- }
149- } ) ;
150- } ) ;
151- }
152-
153- function _openStarsPopup ( ) {
154- _loadTwitterScripts ( ) ;
155- let notification = $ ( `${ Strings . GITHUB_STARS_POPUP }
156- <div class="gtstarph" style="display: flex;justify-content: space-around;margin-top: 6px;">
157- <a class="github-button"
158- href="https://github.com/phcode-dev/phoenix"
159- data-color-scheme="no-preference: dark; light: dark; dark: dark;"
160- data-icon="octicon-star"
161- data-size="large"
162- data-show-count="true"
163- title="Star phcode.dev on GitHub"
164- aria-label="Star phcode-dev/phoenix on GitHub">Star</a>
165- <a class="github-button"
166- href="https://github.com/sponsors/phcode-dev"
167- data-color-scheme="no-preference: dark; light: dark; dark: dark;"
168- data-icon="octicon-heart"
169- data-size="large"
170- data-show-count="true"
171- title="Star phcode.dev on GitHub"
172- aria-label="Sponsor @phcode-dev on GitHub">Sponsor</a>
173- <script async defer src="https://buttons.github.io/buttons.js"></script>
174- </div>
175- ${ Strings . GITHUB_STARS_POPUP_TWITTER }
176- <div class="twbnpop" style="display: flex;justify-content: space-around;margin-top: 6px;">
177- <a href="https://twitter.com/intent/tweet?screen_name=phcodedev&ref_src=twsrc%5Etfw"
178- class="twitter-mention-button"
179- data-size="large"
180- data-related="BracketsCont,brackets"
181- data-show-count="false">Tweet to @phcodedev</a>
182- </div>
183- </div>` ) ;
184- notification . find ( ".gtstarph" ) . click ( ( ) => {
185- Metrics . countEvent ( Metrics . EVENT_TYPE . USER , "notify" , "star.click" , 1 ) ;
186- if ( Phoenix . isNativeApp ) {
187- // hyperlinks wont work in tauri, so we have to use tauri apis
188- Phoenix . app . openURLInDefaultBrowser (
189- 'https://github.com/phcode-dev/phoenix' ) ;
190- }
191- } ) ;
192- NotificationUI . createToastFromTemplate ( Strings . ENJOYING_APP , notification , {
193- dismissOnClick : false
194- } ) ;
195- }
196-
197- function _showRequestStarsPopup ( ) {
198- if ( Phoenix . firstBoot ) {
199- // on first boot we don't show the `enjoying phoenix?` popup as user needs more time to evaluate.
200- // GitHub stars/tweet situation isn't improving either. So we show this at the second launch so that we
201- // the users like the product to revisit and then, every 30 days.
202- return ;
203- }
204- let lastShownDate = userAlreadyDidAction . lastShownGithubStarsDate ;
205- let nextShowDate = new Date ( lastShownDate ) ;
206- nextShowDate . setUTCDate ( nextShowDate . getUTCDate ( ) + ONE_MONTH_IN_DAYS ) ;
207- let currentDate = new Date ( ) ;
208- if ( ! lastShownDate || currentDate >= nextShowDate ) {
209- Metrics . countEvent ( Metrics . EVENT_TYPE . USER , "notify" , "star" , 1 ) ;
210- _openStarsPopup ( ) ;
211- userAlreadyDidAction . lastShownGithubStarsDate = Date . now ( ) ;
212- PhStore . setItem ( GUIDED_TOUR_LOCAL_STORAGE_KEY , JSON . stringify ( userAlreadyDidAction ) ) ;
213- }
214- }
215-
216126 function _showFirstUseSurvey ( surveyURL , delayOverride , title , useDialog ) {
217127 let surveyVersion = 6 ; // increment this if you want to show this again
218128 if ( userAlreadyDidAction . generalSurveyShownVersion === surveyVersion ) {
@@ -372,7 +282,6 @@ define(function (require, exports, module) {
372282 tourStarted = true ;
373283 _showNewProjectNotification ( ) ;
374284 _showBeautifyNotification ( ) ;
375- _showRequestStarsPopup ( ) ;
376285 _showSurveys ( ) ;
377286 } ;
378287} ) ;
0 commit comments