1414
1515import { Injectable } from '@angular/core' ;
1616import { Location } from '@angular/common' ;
17- import { AlertController , NavController , NavOptions } from 'ionic-angular' ;
17+ import { NavController , NavOptions } from 'ionic-angular' ;
1818import { TranslateService } from '@ngx-translate/core' ;
1919import { CoreApp , CoreStoreConfig } from '@providers/app' ;
2020import { CoreConfigProvider } from '@providers/config' ;
@@ -101,7 +101,6 @@ export class CoreLoginHelperProvider {
101101 private initDelegate : CoreInitDelegate ,
102102 private sitePluginsProvider : CoreSitePluginsProvider ,
103103 private location : Location ,
104- private alertCtrl : AlertController ,
105104 private courseProvider : CoreCourseProvider
106105 ) {
107106 this . logger = logger . getInstance ( 'CoreLoginHelper' ) ;
@@ -1235,7 +1234,7 @@ export class CoreLoginHelperProvider {
12351234 protected showWorkplaceNoticeModal ( message : string ) : void {
12361235 const link = CoreApp . instance . getAppStoreUrl ( { android : 'com.moodle.workplace' , ios : 'id1470929705' } ) ;
12371236
1238- this . showDownloadAppNoticeModal ( message , link ) ;
1237+ this . domUtils . showDownloadAppNoticeModal ( message , link ) ;
12391238 }
12401239
12411240 /**
@@ -1251,45 +1250,7 @@ export class CoreLoginHelperProvider {
12511250
12521251 const link = CoreApp . instance . getAppStoreUrl ( storesConfig ) ;
12531252
1254- this . showDownloadAppNoticeModal ( message , link ) ;
1255- }
1256-
1257- /**
1258- * Show a modal warning the user that he should use a different app.
1259- *
1260- * @param message The warning message.
1261- * @param link Link to the app to download if any.
1262- */
1263- protected showDownloadAppNoticeModal ( message : string , link ?: string ) : void {
1264- const buttons : any [ ] = [
1265- {
1266- text : this . translate . instant ( 'core.ok' ) ,
1267- role : 'cancel'
1268- }
1269- ] ;
1270-
1271- if ( link ) {
1272- buttons . push ( {
1273- text : this . translate . instant ( 'core.download' ) ,
1274- handler : ( ) : void => {
1275- this . utils . openInBrowser ( link ) ;
1276- }
1277- } ) ;
1278- }
1279-
1280- const alert = this . alertCtrl . create ( {
1281- message : message ,
1282- buttons : buttons
1283- } ) ;
1284-
1285- alert . present ( ) . then ( ( ) => {
1286- const isDevice = CoreApp . instance . isAndroid ( ) || CoreApp . instance . isIOS ( ) ;
1287- if ( ! isDevice ) {
1288- // Treat all anchors so they don't override the app.
1289- const alertMessageEl : HTMLElement = alert . pageRef ( ) . nativeElement . querySelector ( '.alert-message' ) ;
1290- this . domUtils . treatAnchors ( alertMessageEl ) ;
1291- }
1292- } ) ;
1253+ this . domUtils . showDownloadAppNoticeModal ( message , link ) ;
12931254 }
12941255
12951256 /**
0 commit comments