Skip to content

Commit

Permalink
Merge pull request #931 from IDEMSInternational/fix/app-menu-listeners
Browse files Browse the repository at this point in the history
Fix app side menu duplicate actions
  • Loading branch information
esmeetewinkel authored Jul 29, 2021
2 parents 9e6af86 + 7a0477b commit 313c8b7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
class="main-layout-padding"
templatename="app_menu"
(click)="menu.close()"
[ignoreQueryParamChanges]="true"
></plh-template-container>
</ion-content>
</ion-menu>
Expand Down
11 changes: 11 additions & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export class AppComponent {
this.themeService.init();
this.platform.ready().then(async () => {
this.dbService.init();
this.hackSetDeveloperOptions();
const user = await this.userMetaService.init();
if (!user.first_app_open) {
await this.surveyService.runSurvey("introSplash");
Expand Down Expand Up @@ -104,6 +105,16 @@ export class AppComponent {
}
}

/** ensure localhost dev can see all non-user content */
private hackSetDeveloperOptions() {
if (location.hostname === "localhost" && !environment.production) {
const isUserMode = this.templateService.getField("user_mode");
if (isUserMode !== false) {
this.templateService.setField("user_mode", "false");
}
}
}

/**
* temporary fix: set initial fields to avoid doubling up of quickstart buttons
* TODO CC 2021-07-23 - Review if methods still required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export class TemplateContainerComponent implements OnInit, OnDestroy, ITemplateC
@Input() templatename: string;
@Input() parent?: TemplateContainerComponent;
@Input() row?: FlowTypes.TemplateRow;
/** Query params are used for trigger template actions such as opening popups or enabling debug_mode. Ignored if required (e.g. app sidemenu template) */
@Input() ignoreQueryParamChanges?: boolean;
children: { [name: string]: TemplateContainerComponent } = {};

template: FlowTypes.Template;
Expand Down Expand Up @@ -68,7 +70,9 @@ export class TemplateContainerComponent implements OnInit, OnDestroy, ITemplateC
}

async ngOnInit() {
this.subscribeToQueryParamChanges();
if (!this.ignoreQueryParamChanges) {
this.subscribeToQueryParamChanges();
}
// add logging if default disabled and in debug view
if (this.debugMode) {
this.setLogging(true);
Expand Down

0 comments on commit 313c8b7

Please sign in to comment.