use of org.wikipedia.WikipediaApp in project apps-android-wikipedia by wikimedia.
the class ShareHandler method createFunnel.
private void createFunnel() {
WikipediaApp app = WikipediaApp.getInstance();
final Page page = fragment.getPage();
final PageProperties pageProperties = page.getPageProperties();
funnel = new ShareAFactFunnel(app, page.getTitle(), pageProperties.getPageId(), pageProperties.getRevisionId());
}
use of org.wikipedia.WikipediaApp in project apps-android-wikipedia by wikimedia.
the class EditSummaryHandler method persistSummary.
public void persistSummary() {
WikipediaApp app = (WikipediaApp) container.getContext().getApplicationContext();
EditSummary summary = new EditSummary(summaryEdit.getText().toString(), new Date());
app.getDatabaseClient(EditSummary.class).upsert(summary, EditHistoryContract.Summary.SELECTION);
}
use of org.wikipedia.WikipediaApp in project apps-android-wikipedia by wikimedia.
the class MainPageClient method getMainPageTitle.
@NonNull
public static PageTitle getMainPageTitle() {
WikipediaApp app = WikipediaApp.getInstance();
PageTitle title = new PageTitle(SiteInfoClient.getMainPageForLang(app.getAppOrSystemLanguageCode()), app.getWikiSite());
if (OfflineManager.hasCompilation() && !DeviceUtil.isOnline()) {
try {
title = new PageTitle(OfflineManager.instance().getMainPageTitle(), app.getWikiSite());
} catch (IOException e) {
L.e(e);
}
}
return title;
}
use of org.wikipedia.WikipediaApp in project apps-android-wikipedia by wikimedia.
the class WidgetProviderFeaturedPage method getMainPageLead.
private void getMainPageLead(final Callback cb) {
WikipediaApp app = WikipediaApp.getInstance();
final PageTitle title = new PageTitle(MainPageNameData.valueFor(app.getAppOrSystemLanguageCode()), app.getWikiSite());
getApiService(title).lead(null, null, title.getPrefixedText(), DimenUtil.calculateLeadImageWidth()).enqueue(new retrofit2.Callback<PageLead>() {
@Override
public void onResponse(Call<PageLead> call, Response<PageLead> rsp) {
PageLead lead = rsp.body();
if (lead.hasError()) {
lead.logError("Error while updating widget");
return;
}
L.d("Downloaded page " + title.getDisplayText());
String titleText = findFeaturedArticleTitle(lead.getLeadSectionContent());
cb.onFeaturedArticleReceived(titleText);
}
@Override
public void onFailure(Call<PageLead> call, Throwable t) {
L.e(t);
}
});
}
use of org.wikipedia.WikipediaApp in project apps-android-wikipedia by wikimedia.
the class CommonHeaderRequestInterceptor method intercept.
@Override
public Response intercept(Chain chain) throws IOException {
WikipediaApp app = WikipediaApp.getInstance();
Request request = chain.request().newBuilder().header("User-Agent", app.getUserAgent()).header(isEventLoggingEnabled() ? "X-WMF-UUID" : "DNT", isEventLoggingEnabled() ? app.getAppInstallID() : "1").build();
return chain.proceed(request);
}
Aggregations