debt - drop enableSendASmile flag

This commit is contained in:
Benjamin Pasero
2016-04-19 22:00:12 +01:00
parent d81b3eca0a
commit c83fa467d0
4 changed files with 25 additions and 29 deletions
+6 -7
View File
@@ -2,19 +2,18 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { globals } from 'vs/base/common/platform';
export const enableSendASmile = environment('enableSendASmile');
import {globals} from 'vs/base/common/platform';
// Telemetry endpoint (used in the standalone editor) for hosts that want to collect editor telemetry
export const standaloneEditorTelemetryEndpoint:string = environment('telemetryEndpoint', null);
export const standaloneEditorTelemetryEndpoint: string = environment('telemetryEndpoint', null);
// Option for hosts to overwrite the worker script url (used in the standalone editor)
export const getCrossOriginWorkerScriptUrl:(workerId:string, label:string)=>string = environment('getWorkerUrl', null);
export const getCrossOriginWorkerScriptUrl: (workerId: string, label: string) => string = environment('getWorkerUrl', null);
function environment(name:string, fallback:any = false):any {
function environment(name: string, fallback: any = false): any {
if (globals.MonacoEnvironment && globals.MonacoEnvironment.hasOwnProperty(name)) {
return globals.MonacoEnvironment[name];
}
@@ -22,6 +21,6 @@ function environment(name:string, fallback:any = false):any {
return fallback;
}
export function workersCount(defaultCount:number): number {
export function workersCount(defaultCount: number): number {
return environment('workersCount', defaultCount);
}
+1 -4
View File
@@ -172,10 +172,7 @@
});
}
window.MonacoEnvironment = {
'enableSendASmile' : !!configuration.sendASmile
};
window.MonacoEnvironment = {};
var timers = window.MonacoEnvironment.timers = {
start: new Date()
};
@@ -5,15 +5,12 @@
'use strict';
import {Registry} from 'vs/platform/platform';
import * as Flags from 'vs/base/common/flags';
import {StatusbarAlignment, IStatusbarRegistry, Extensions, StatusbarItemDescriptor} from 'vs/workbench/browser/parts/statusbar/statusbar';
import {FeedbackStatusbarItem} from 'vs/workbench/parts/feedback/electron-browser/feedbackStatusbarItem';
// Register Statusbar item
if (Flags.enableSendASmile) {
(<IStatusbarRegistry>Registry.as(Extensions.Statusbar)).registerStatusbarItem(new StatusbarItemDescriptor(
FeedbackStatusbarItem,
StatusbarAlignment.RIGHT,
-100 /* Low Priority */
));
}
(<IStatusbarRegistry>Registry.as(Extensions.Statusbar)).registerStatusbarItem(new StatusbarItemDescriptor(
FeedbackStatusbarItem,
StatusbarAlignment.RIGHT,
-100 /* Low Priority */
));
@@ -10,15 +10,16 @@ import {IStatusbarItem} from 'vs/workbench/browser/parts/statusbar/statusbar';
import {FeedbackDropdown, IFeedback, IFeedbackService} from 'vs/workbench/parts/feedback/browser/feedback';
import {IContextViewService} from 'vs/platform/contextview/browser/contextView';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import {shell} from 'electron';
class TwitterFeedbackService implements IFeedbackService {
private static TWITTER_URL: string = 'https://twitter.com/intent/tweet';
private static VIA_NAME: string = 'code';
private static HASHTAGS: string[] = ['HappyCoding'];
private static HASHTAGS: string[] = ['HappyCoding'];
private combineHashTagsAsString() : string {
private combineHashTagsAsString(): string {
return TwitterFeedbackService.HASHTAGS.join(',');
}
@@ -29,9 +30,8 @@ class TwitterFeedbackService implements IFeedbackService {
}
public getCharacterLimit(sentiment: number): number {
let length : number = 0;
if (sentiment === 1)
{
let length: number = 0;
if (sentiment === 1) {
TwitterFeedbackService.HASHTAGS.forEach(element => {
length += element.length + 2;
});
@@ -48,14 +48,17 @@ export class FeedbackStatusbarItem implements IStatusbarItem {
constructor(
@IInstantiationService private instantiationService: IInstantiationService,
@IContextViewService private contextViewService: IContextViewService
@IContextViewService private contextViewService: IContextViewService,
@IWorkspaceContextService private contextService: IWorkspaceContextService
) {
}
public render(element: HTMLElement): IDisposable {
return this.instantiationService.createInstance(FeedbackDropdown, element, {
contextViewProvider: this.contextViewService,
feedbackService: this.instantiationService.createInstance(TwitterFeedbackService)
});
if (this.contextService.getConfiguration().env.sendASmile) {
return this.instantiationService.createInstance(FeedbackDropdown, element, {
contextViewProvider: this.contextViewService,
feedbackService: this.instantiationService.createInstance(TwitterFeedbackService)
});
}
}
}