MOBILE-3132 mod: Fill context menu even if there's an error
This commit is contained in:
		
							parent
							
								
									3edc42ccc2
								
							
						
					
					
						commit
						06c0a266b7
					
				@ -219,8 +219,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }).then(() => {
 | 
					        }).finally(() => {
 | 
				
			||||||
            // All data obtained, now fill the context menu.
 | 
					 | 
				
			||||||
            this.fillContextMenu(refresh);
 | 
					            this.fillContextMenu(refresh);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -163,12 +163,11 @@ export class AddonModBookIndexComponent extends CoreCourseModuleMainResourceComp
 | 
				
			|||||||
                    // We could load the main file but the download failed. Show error message.
 | 
					                    // We could load the main file but the download failed. Show error message.
 | 
				
			||||||
                    this.domUtils.showErrorModal('core.errordownloadingsomefiles', true);
 | 
					                    this.domUtils.showErrorModal('core.errordownloadingsomefiles', true);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					 | 
				
			||||||
                // All data obtained, now fill the context menu.
 | 
					 | 
				
			||||||
                this.fillContextMenu(refresh);
 | 
					 | 
				
			||||||
            }).catch(() => {
 | 
					            }).catch(() => {
 | 
				
			||||||
                // Ignore errors, they're handled inside the loadChapter function.
 | 
					                // Ignore errors, they're handled inside the loadChapter function.
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					        }).finally(() => {
 | 
				
			||||||
 | 
					            this.fillContextMenu(refresh);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -82,12 +82,11 @@ export class AddonModChatIndexComponent extends CoreCourseModuleMainActivityComp
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            this.dataRetrieved.emit(chat);
 | 
					            this.dataRetrieved.emit(chat);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // All data obtained, now fill the context menu.
 | 
					 | 
				
			||||||
            this.fillContextMenu(refresh);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            return this.chatProvider.areSessionsAvailable().then((available) => {
 | 
					            return this.chatProvider.areSessionsAvailable().then((available) => {
 | 
				
			||||||
                this.sessionsAvailable = available;
 | 
					                this.sessionsAvailable = available;
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					        }).finally(() => {
 | 
				
			||||||
 | 
					            this.fillContextMenu(refresh);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -154,8 +154,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo
 | 
				
			|||||||
            return this.fetchOptions(hasOffline).then(() => {
 | 
					            return this.fetchOptions(hasOffline).then(() => {
 | 
				
			||||||
                return this.fetchResults();
 | 
					                return this.fetchResults();
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }).then(() => {
 | 
					        }).finally(() => {
 | 
				
			||||||
            // All data obtained, now fill the context menu.
 | 
					 | 
				
			||||||
            this.fillContextMenu(refresh);
 | 
					            this.fillContextMenu(refresh);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -247,12 +247,10 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                return this.fetchEntriesData();
 | 
					                return this.fetchEntriesData();
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }).then(() => {
 | 
					 | 
				
			||||||
            // All data obtained, now fill the context menu.
 | 
					 | 
				
			||||||
            this.fillContextMenu(refresh);
 | 
					 | 
				
			||||||
        }).finally(() => {
 | 
					        }).finally(() => {
 | 
				
			||||||
            this.canAdd = canAdd;
 | 
					            this.canAdd = canAdd;
 | 
				
			||||||
            this.canSearch = canSearch;
 | 
					            this.canSearch = canSearch;
 | 
				
			||||||
 | 
					            this.fillContextMenu(refresh);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -129,8 +129,7 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            this.showModuleData(folder);
 | 
					            this.showModuleData(folder);
 | 
				
			||||||
 | 
					        }).finally(() => {
 | 
				
			||||||
            // All data obtained, now fill the context menu.
 | 
					 | 
				
			||||||
            this.fillContextMenu(refresh);
 | 
					            this.fillContextMenu(refresh);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -244,8 +244,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom
 | 
				
			|||||||
            this.domUtils.showErrorModalDefault(message, 'addon.mod_forum.errorgetforum', true);
 | 
					            this.domUtils.showErrorModalDefault(message, 'addon.mod_forum.errorgetforum', true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            this.loadMoreError = true; // Set to prevent infinite calls with infinite-loading.
 | 
					            this.loadMoreError = true; // Set to prevent infinite calls with infinite-loading.
 | 
				
			||||||
        }).then(() => {
 | 
					        }).finally(() => {
 | 
				
			||||||
            // All data obtained, now fill the context menu.
 | 
					 | 
				
			||||||
            this.fillContextMenu(refresh);
 | 
					            this.fillContextMenu(refresh);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -158,8 +158,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity
 | 
				
			|||||||
            }));
 | 
					            }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return Promise.all(promises);
 | 
					            return Promise.all(promises);
 | 
				
			||||||
        }).then(() => {
 | 
					        }).finally(() => {
 | 
				
			||||||
            // All data obtained, now fill the context menu.
 | 
					 | 
				
			||||||
            this.fillContextMenu(refresh);
 | 
					            this.fillContextMenu(refresh);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -112,7 +112,7 @@ export class AddonModImscpIndexComponent extends CoreCourseModuleMainResourceCom
 | 
				
			|||||||
                this.domUtils.showErrorModal('core.errordownloadingsomefiles', true);
 | 
					                this.domUtils.showErrorModal('core.errordownloadingsomefiles', true);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // All data obtained, now fill the context menu.
 | 
					        }).finally(() => {
 | 
				
			||||||
            this.fillContextMenu(refresh);
 | 
					            this.fillContextMenu(refresh);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -211,6 +211,8 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
 | 
				
			|||||||
                    this.lessonReady(refresh);
 | 
					                    this.lessonReady(refresh);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					        }).finally(() => {
 | 
				
			||||||
 | 
					            this.fillContextMenu(refresh);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -336,9 +338,6 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
 | 
				
			|||||||
            // Store the password in DB.
 | 
					            // Store the password in DB.
 | 
				
			||||||
            this.lessonProvider.storePassword(this.lesson.id, this.password);
 | 
					            this.lessonProvider.storePassword(this.lesson.id, this.password);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					 | 
				
			||||||
        // All data obtained, now fill the context menu.
 | 
					 | 
				
			||||||
        this.fillContextMenu(refresh);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -67,8 +67,7 @@ export class AddonModLtiIndexComponent extends CoreCourseModuleMainActivityCompo
 | 
				
			|||||||
            this.lti = ltiData;
 | 
					            this.lti = ltiData;
 | 
				
			||||||
            this.description = this.lti.intro || this.description;
 | 
					            this.description = this.lti.intro || this.description;
 | 
				
			||||||
            this.dataRetrieved.emit(this.lti);
 | 
					            this.dataRetrieved.emit(this.lti);
 | 
				
			||||||
        }).then(() => {
 | 
					        }).finally(() => {
 | 
				
			||||||
            // All data obtained, now fill the context menu.
 | 
					 | 
				
			||||||
            this.fillContextMenu(refresh);
 | 
					            this.fillContextMenu(refresh);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -127,8 +127,6 @@ export class AddonModPageIndexComponent extends CoreCourseModuleMainResourceComp
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            // Get the page HTML.
 | 
					            // Get the page HTML.
 | 
				
			||||||
            promises.push(this.pageHelper.getPageHtml(this.module.contents, this.module.id).then((content) => {
 | 
					            promises.push(this.pageHelper.getPageHtml(this.module.contents, this.module.id).then((content) => {
 | 
				
			||||||
                // All data obtained, now fill the context menu.
 | 
					 | 
				
			||||||
                this.fillContextMenu(refresh);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                this.contents = content;
 | 
					                this.contents = content;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -139,6 +137,8 @@ export class AddonModPageIndexComponent extends CoreCourseModuleMainResourceComp
 | 
				
			|||||||
            }));
 | 
					            }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return Promise.all(promises);
 | 
					            return Promise.all(promises);
 | 
				
			||||||
 | 
					        }).finally(() => {
 | 
				
			||||||
 | 
					            this.fillContextMenu(refresh);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -224,11 +224,10 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp
 | 
				
			|||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }).then(() => {
 | 
					        }).then(() => {
 | 
				
			||||||
            // All data obtained, now fill the context menu.
 | 
					 | 
				
			||||||
            this.fillContextMenu(refresh);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // Quiz is ready to be shown, move it to the variable that is displayed.
 | 
					            // Quiz is ready to be shown, move it to the variable that is displayed.
 | 
				
			||||||
            this.quiz = this.quizData;
 | 
					            this.quiz = this.quizData;
 | 
				
			||||||
 | 
					        }).finally(() => {
 | 
				
			||||||
 | 
					            this.fillContextMenu(refresh);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -135,8 +135,7 @@ export class AddonModResourceIndexComponent extends CoreCourseModuleMainResource
 | 
				
			|||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                this.mode = 'external';
 | 
					                this.mode = 'external';
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }).then(() => {
 | 
					        }).finally(() => {
 | 
				
			||||||
            // All data obtained, now fill the context menu.
 | 
					 | 
				
			||||||
            this.fillContextMenu(refresh);
 | 
					            this.fillContextMenu(refresh);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -254,8 +254,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }).then(() => {
 | 
					        }).finally(() => {
 | 
				
			||||||
            // All data obtained, now fill the context menu.
 | 
					 | 
				
			||||||
            this.fillContextMenu(refresh);
 | 
					            this.fillContextMenu(refresh);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -126,8 +126,7 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo
 | 
				
			|||||||
            if (!this.survey.surveydone && !this.hasOffline) {
 | 
					            if (!this.survey.surveydone && !this.hasOffline) {
 | 
				
			||||||
                return this.fetchQuestions();
 | 
					                return this.fetchQuestions();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }).then(() => {
 | 
					        }).finally(() => {
 | 
				
			||||||
            // All data obtained, now fill the context menu.
 | 
					 | 
				
			||||||
            this.fillContextMenu(refresh);
 | 
					            this.fillContextMenu(refresh);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -299,8 +299,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp
 | 
				
			|||||||
                    return this.fetchWikiPage();
 | 
					                    return this.fetchWikiPage();
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
        }).then(() => {
 | 
					        }).finally(() => {
 | 
				
			||||||
            // All data obtained, now fill the context menu.
 | 
					 | 
				
			||||||
            this.fillContextMenu(refresh);
 | 
					            this.fillContextMenu(refresh);
 | 
				
			||||||
        }).catch((error) => {
 | 
					        }).catch((error) => {
 | 
				
			||||||
            if (this.pageWarning) {
 | 
					            if (this.pageWarning) {
 | 
				
			||||||
 | 
				
			|||||||
@ -231,8 +231,7 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity
 | 
				
			|||||||
            });
 | 
					            });
 | 
				
			||||||
        }).then(() => {
 | 
					        }).then(() => {
 | 
				
			||||||
            return this.setPhaseInfo();
 | 
					            return this.setPhaseInfo();
 | 
				
			||||||
        }).then(() => {
 | 
					        }).finally(() => {
 | 
				
			||||||
            // All data obtained, now fill the context menu.
 | 
					 | 
				
			||||||
            this.fillContextMenu(refresh);
 | 
					            this.fillContextMenu(refresh);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user