Skip to content

Commit

Permalink
MOBILE-4362 siteplugins: Add helper function to update cached data
Browse files Browse the repository at this point in the history
  • Loading branch information
dpalou committed Oct 19, 2023
1 parent 1250779 commit df81617
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { CoreSitePlugins, CoreSitePluginsContent, CoreSitePluginsProvider } from
import { CoreNavigator } from '@services/navigator';
import { CoreDomUtils } from '@services/utils/dom';
import { CoreEvents } from '@singletons/events';
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';

/**
* Component to render a site plugin content.
Expand Down Expand Up @@ -238,6 +239,19 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck {
CoreEvents.trigger(CoreSitePluginsProvider.UPDATE_COURSE_CONTENT, { cmId, alreadyFetched });
}

/**
* Update this content stored in the app's cache. This function will not reload the view, it will only update the data stored
* in the device so it's updated for the next usage. If you want to update the view, please use refreshContent.
*/
async updateCachedContent(): Promise<void> {
await CoreSitePlugins.getContent(
this.component,
this.method,
this.args,
CoreSites.getReadingStrategyPreSets(CoreSitesReadingStrategy.ONLY_NETWORK),
);
}

}

export type CoreSitePluginsPluginContentLoadedData = {
Expand Down

0 comments on commit df81617

Please sign in to comment.