MOBILE-3641 core: Register site info cron handler
parent
d73b5d6160
commit
267f4445ae
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { COMPILER_OPTIONS, NgModule } from '@angular/core';
|
import { APP_INITIALIZER, COMPILER_OPTIONS, NgModule } from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { RouteReuseStrategy } from '@angular/router';
|
import { RouteReuseStrategy } from '@angular/router';
|
||||||
|
@ -29,6 +29,8 @@ import { AddonsModule } from '@/addons/addons.module';
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { AppRoutingModule } from './app-routing.module';
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
import { JitCompilerFactory } from '@angular/platform-browser-dynamic';
|
import { JitCompilerFactory } from '@angular/platform-browser-dynamic';
|
||||||
|
import { CoreCronDelegate } from '@services/cron';
|
||||||
|
import { CoreSiteInfoCronHandler } from '@services/handlers/site-info-cron';
|
||||||
|
|
||||||
// For translate loader. AoT requires an exported function for factories.
|
// For translate loader. AoT requires an exported function for factories.
|
||||||
export function createTranslateLoader(http: HttpClient): TranslateHttpLoader {
|
export function createTranslateLoader(http: HttpClient): TranslateHttpLoader {
|
||||||
|
@ -57,6 +59,14 @@ export function createTranslateLoader(http: HttpClient): TranslateHttpLoader {
|
||||||
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
|
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
|
||||||
{ provide: COMPILER_OPTIONS, useValue: {}, multi: true },
|
{ provide: COMPILER_OPTIONS, useValue: {}, multi: true },
|
||||||
{ provide: JitCompilerFactory, useClass: JitCompilerFactory, deps: [COMPILER_OPTIONS] },
|
{ provide: JitCompilerFactory, useClass: JitCompilerFactory, deps: [COMPILER_OPTIONS] },
|
||||||
|
{
|
||||||
|
provide: APP_INITIALIZER,
|
||||||
|
multi: true,
|
||||||
|
deps: [],
|
||||||
|
useFactory: () => () => {
|
||||||
|
CoreCronDelegate.register(CoreSiteInfoCronHandler.instance);
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
bootstrap: [AppComponent],
|
bootstrap: [AppComponent],
|
||||||
})
|
})
|
||||||
|
|
|
@ -15,12 +15,13 @@
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { CoreCronHandler } from '@services/cron';
|
import { CoreCronHandler } from '@services/cron';
|
||||||
import { CoreSites } from '@services/sites';
|
import { CoreSites } from '@services/sites';
|
||||||
|
import { makeSingleton } from '@singletons';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cron handler to update site info every certain time.
|
* Cron handler to update site info every certain time.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable({ providedIn: 'root' })
|
||||||
export class CoreSiteInfoCronHandler implements CoreCronHandler {
|
export class CoreSiteInfoCronHandlerService implements CoreCronHandler {
|
||||||
|
|
||||||
name = 'CoreSiteInfoCronHandler';
|
name = 'CoreSiteInfoCronHandler';
|
||||||
|
|
||||||
|
@ -60,3 +61,5 @@ export class CoreSiteInfoCronHandler implements CoreCronHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const CoreSiteInfoCronHandler = makeSingleton(CoreSiteInfoCronHandlerService);
|
||||||
|
|
Loading…
Reference in New Issue