Skip to content

Commit

Permalink
Some extra logging
Browse files Browse the repository at this point in the history
  • Loading branch information
OhMyGuus committed Feb 9, 2021
1 parent 4dad2e3 commit 4edf63b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class AppComponent implements OnInit {
}

this.appCenterAnalytics.setEnabled(true).then(() => {
this.appCenterAnalytics.trackEvent('My Event', { TEST: 'HELLO_WORLD' }).then(() => {
this.appCenterAnalytics.trackEvent('Started app', { time: new Date().toISOString() }).then(() => {
console.log('Custom event tracked');
});
});
Expand Down
17 changes: 16 additions & 1 deletion src/app/services/game-helper.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import AudioController from './AudioController.service';
import { ConnectionController } from './ConnectionController.service';
import { EventEmitter as EventEmitterO } from 'events';
import { BackgroundMode } from '@ionic-native/background-mode/ngx';
import { AppCenterAnalytics } from '@ionic-native/app-center-analytics/ngx';

const { LocalNotifications, BetterCrewlinkNativePlugin } = Plugins;

Expand Down Expand Up @@ -39,7 +40,8 @@ export class GameHelperService extends EventEmitterO implements IGameHelperServi
private androidPermissions: AndroidPermissions,
public platform: Platform,
public cManager: ConnectionController,
private backgroundMode: BackgroundMode
private backgroundMode: BackgroundMode,
private appCenterAnalytics: AppCenterAnalytics
) {
super();
this.load();
Expand All @@ -66,6 +68,14 @@ export class GameHelperService extends EventEmitterO implements IGameHelperServi
connect() {
this.disconnect(false);

this.appCenterAnalytics.trackEvent('connect', {
gameCode: this.settings.gamecode.toUpperCase(),
username: this.settings.username,
micrphone: this.settings.selectedMicrophone.deviceId,
natfixEnabled: this.settings.natFix ? 'true' : 'false',
time: new Date().toISOString(),
});

this.requestPermissions().then((haspermissions) => {
if (!haspermissions) {
console.log('permissions failed');
Expand All @@ -91,6 +101,11 @@ export class GameHelperService extends EventEmitterO implements IGameHelperServi
BetterCrewlinkNativePlugin.disconnect();
}
this.cManager.disconnect(true);

this.appCenterAnalytics.trackEvent('disconnect', {
disableBackgroundMode: disableBackgroundMode ? 'true' : 'false',
time: new Date().toISOString(),
});
}

muteMicrophone() {
Expand Down

0 comments on commit 4edf63b

Please sign in to comment.