Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export default class UserClientController
- {
- constructor(AppConstants, SessionService, $translate, $localStorage, $window, $stickyState, $mdDialog, $mdToast, $state, $rootScope, $scope)
- {
- 'ngInject';
- this.AppConstants = AppConstants;
- this.SessionService = SessionService;
- this.$translate = $translate;
- this.$localStorage = $localStorage;
- this.$window = $window;
- this.$stickyState = $stickyState;
- this.$mdDialog = $mdDialog;
- this.$mdToast = $mdToast;
- this.$state = $state;
- this.$rootScope = $rootScope;
- this.$scope = $scope;
- this.$scope.flashvarsString = '';
- this.$scope.flashVars = {
- "connection.info.host": this.AppConstants.client.clientHost,
- "connection.info.port": this.AppConstants.client.clientPort,
- "external.texts.txt": this.AppConstants.client.clientTexts,
- "external.variables.txt": this.AppConstants.client.clientVariables,
- "external.figurepartlist.txt": this.AppConstants.client.clientFigureList,
- "furnidata.load.url": this.AppConstants.client.clientFurniData,
- "productdata.load.url": this.AppConstants.client.clientProductData,
- "avatareditor.promohabbos": this.AppConstants.client.clientPromoHabbos,
- "client.allow.cross.domain": 1,
- "client.notify.cross.domain": 0,
- "client.starting": this.AppConstants.siteName,
- "client.starting.revolving": this.$translate.instant('client.revolving'),
- "flash.client.url": this.AppConstants.client.clientBase,
- "flash.client.origin": "popup",
- "url.prefix": this.AppConstants.siteLink + '/',
- "processlog.enabled": 1,
- "has.identity": 1,
- "spaweb": 1,
- "sso.ticket": this.$localStorage.currentUser.usersession,
- "accountid": this.$localStorage.currentUser.userid,
- "uniquehabboid": this.$localStorage.currentUser.usersession
- };
- angular.forEach(this.$scope.flashVars, (value, key) =>
- {
- this.$scope.flashvarsString += key + '=' + value + '&';
- });
- this.$scope.reloadClient = () =>
- {
- this.$stickyState.reset('client');
- }
- this.$window.HabboFlashClient = {
- started: !1,
- init: () =>
- {
- setTimeout(() =>
- {
- this.$window.HabboFlashClient.flashInterface = document.getElementById('flash-container');
- }, 1000);
- }
- };
- this.$window.addEventListener("load", this.$window.HabboFlashClient.init());
- this.$window.FlashExternalInterface = {};
- this.$window.FlashExternalInterface.logout = () =>
- {
- return this.$translate(['generic.messages.title', 'generic.buttons.logout', 'generic.dialogs.logout', 'generic.dialogs.cancel'])
- .then((text) =>
- {
- return this.$mdDialog.show(
- this.$mdDialog.confirm({
- title: text['generic.messages.title'],
- textContent: text['generic.buttons.logout'],
- ok: text['generic.buttons.logout'],
- cancel: text['generic.buttons.cancel']
- }));
- })
- .then(() =>
- {
- return this.SessionService.destroySession();
- })
- .then(() =>
- {
- return this.$state.go('login');
- })
- .catch(() =>
- {
- return;
- })
- };
- this.$window.FlashExternalInterface.disconnect = () =>
- {
- return this.$translate(['generic.messages.disconnected'])
- .then((text) =>
- {
- this.$mdToast.show(
- $mdToast.simple({
- textContent: text['generic.messages.disconnected'],
- hideDelay: 3000,
- position: 'top right'
- }));
- this.$stickyState.reset('client');
- if(this.$state.includes('client')) return this.$state.reload();
- return this.$state.go('client');
- });
- };
- this.$window.FlashExternalInterface.openAvatars = () =>
- {
- return this.$state.go('settings');
- };
- this.$window.FlashExternalInterface.openMinimail = () =>
- {
- return this.$state.go('messages');
- };
- this.$window.FlashExternalInterface.openNews = () =>
- {
- return this.$state.go('news');
- };
- this.$window.FlashExternalInterface.track = (action, label, value) =>
- {
- console.log('action = [' + action + '], label = [' + label + '], value = [' + value + ']');
- };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement