Skip to content

Commit

Permalink
added support to track resource open and also worked on package issue…
Browse files Browse the repository at this point in the history
…s on my PC reason for change changes in package.json file
  • Loading branch information
OchiengPaul442 committed Feb 25, 2024
1 parent 686179d commit 0670d13
Show file tree
Hide file tree
Showing 5 changed files with 2,317 additions and 1,495 deletions.
7 changes: 4 additions & 3 deletions apps/picsa-apps/extension-app/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ export class AppComponent {
private async init() {
this.performanceService.setEnabled({ enabled: ENVIRONMENT.production });
this.crashlyticsService.ready().then(() => null);
if (ENVIRONMENT.production) {
this.analyticsService.init(this.router);
}
// if (ENVIRONMENT.production) {
// this.analyticsService.init(this.router);
// }
this.analyticsService.init(this.router);
// eagerly load resources service to populate hardcoded resources
this.resourcesService.ready();
// eagerly load monitoring service to sync form data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Capacitor } from '@capacitor/core';
import { ConfigurationService } from '@picsa/configuration/src';
import { APP_VERSION } from '@picsa/environments/src';
import { PicsaAsyncService } from '@picsa/shared/services/asyncService.service';
import { AnalyticsService } from '@picsa/shared/services/core/analytics.service';
import { PicsaDatabase_V2_Service, PicsaDatabaseAttachmentService } from '@picsa/shared/services/core/db_v2';
import { FileService } from '@picsa/shared/services/core/file.service';
import { NativeStorageService } from '@picsa/shared/services/native';
Expand All @@ -21,7 +22,8 @@ export class ResourcesToolService extends PicsaAsyncService {
private dbAttachmentService: PicsaDatabaseAttachmentService,
private configurationService: ConfigurationService,
private nativeStorageService: NativeStorageService,
private fileService: FileService
private fileService: FileService,
private analyticsService: AnalyticsService
) {
super();
}
Expand Down Expand Up @@ -71,6 +73,8 @@ export class ResourcesToolService extends PicsaAsyncService {
}

public async openFileResource(uri: string, mimetype: string) {
// track the resource open event
this.analyticsService.trackResourceOpen();
if (Capacitor.isNativePlatform()) {
try {
this.nativeStorageService.openFileURI(uri, mimetype);
Expand Down
8 changes: 8 additions & 0 deletions libs/shared/src/services/core/analytics.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,12 @@ export class AnalyticsService {
params: { video_id: videoId, app_version: APP_VERSION },
});
}

// Method to track when users open a resource file
public trackResourceOpen() {
this.firebaseAnalytics.logEvent({
name: 'open_resource_file',
params: { app_version: APP_VERSION },
});
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"dexie": "^3.2.3",
"downloadjs": "^1.4.7",
"enketo-core": "^6.1.3",
"fast-xml-parser": "^4.2.2",
"fast-xml-parser": "4.2.2",
"firebase": "^9.16.0",
"form-data": "^4.0.0",
"fuse.js": "^7.0.0",
Expand Down
Loading

0 comments on commit 0670d13

Please sign in to comment.