Search in sources :

Example 1 with UXStatsConf

use of com.frostwire.uxstats.UXStatsConf in project frostwire by frostwire.

the class SoftwareUpdater method updateConfiguration.

private void updateConfiguration(Update update, MainActivity mainActivity) {
    if (update.config == null) {
        return;
    }
    if (update.config.activeSearchEngines != null && update.config.activeSearchEngines.keySet() != null) {
        for (String name : update.config.activeSearchEngines.keySet()) {
            SearchEngine engine = SearchEngine.forName(name);
            if (engine != null) {
                // LOG.info(engine.getName() + " is remotely active: " + update.config.activeSearchEngines.get(name));
                engine.setActive(update.config.activeSearchEngines.get(name));
            } else {
                LOG.warn("Can't find any search engine by the name of: '" + name + "'");
            }
        }
    }
    ConfigurationManager CM = ConfigurationManager.instance();
    CM.setStringArray(Constants.PREF_KEY_GUI_OFFERS_WATERFALL, update.config.waterfall);
    CM.setInt(Constants.PREF_KEY_GUI_MOPUB_ALBUM_ART_BANNER_THRESHOLD, update.config.mopubAlbumArtBannerThreshold);
    CM.setInt(Constants.PREF_KEY_GUI_MOPUB_PREVIEW_BANNER_THRESHOLD, update.config.mopubPreviewBannerThreshold);
    CM.setInt(Constants.PREF_KEY_GUI_MOPUB_SEARCH_HEADER_BANNER_THRESHOLD, update.config.mopubSearchHeaderBannerThreshold);
    CM.setInt(Constants.PREF_KEY_GUI_MOPUB_SEARCH_HEADER_BANNER_DISMISS_INTERVAL_IN_MS, update.config.mopubSearchHeaderBannerIntervalInMs);
    CM.setInt(Constants.PREF_KEY_GUI_OGURY_THRESHOLD, update.config.oguryThreshold);
    CM.setInt(Constants.PREF_KEY_GUI_PREBID_THRESHOLD, update.config.prebidThreshold);
    CM.setInt(Constants.PREF_KEY_GUI_REMOVEADS_BACK_TO_BACK_THRESHOLD, update.config.removeAdsB2bThreshold);
    CM.setInt(Constants.PREF_KEY_GUI_INTERSTITIAL_OFFERS_TRANSFER_STARTS, update.config.interstitialOffersTransferStarts);
    CM.setInt(Constants.PREF_KEY_GUI_INTERSTITIAL_TRANSFER_OFFERS_TIMEOUT_IN_MINUTES, update.config.interstitialTransferOffersTimeoutInMinutes);
    CM.setInt(Constants.PREF_KEY_GUI_INTERSTITIAL_ON_RESUME_FIRST_DISPLAY_DELAY_IN_MINUTES, update.config.interstitialOnResumeFirstDisplayDelayInMinutes);
    CM.setInt(Constants.PREF_KEY_GUI_INTERSTITIAL_ON_RESUME_TIMEOUT_IN_MINUTES, update.config.interstitialOnResumeTimeoutInMinutes);
    CM.setInt(Constants.PREF_KEY_GUI_INTERSTITIAL_ON_EXIT_THRESHOLD, update.config.onExitThreshold);
    CM.setInt(Constants.PREF_KEY_GUI_INTERSTITIAL_ON_BACK_THRESHOLD, update.config.onBackThreshold);
    CM.setInt(Constants.PREF_KEY_GUI_INTERSTITIAL_ON_RESUME_THRESHOLD, update.config.onResumeThreshold);
    // This has to be invoked once again here. It gets invoked by main activity on resume before we're done on this thread.
    Offers.initAdNetworks(mainActivity);
    if (update.config.uxEnabled && CM.getBoolean(Constants.PREF_KEY_UXSTATS_ENABLED)) {
        String url = "http://ux.frostwire.com/aux";
        String os = SearchEngine.getOSVersionString();
        String fwversion = Constants.FROSTWIRE_VERSION_STRING;
        String fwbuild = Constants.FROSTWIRE_BUILD;
        int period = update.config.uxPeriod;
        int minEntries = update.config.uxMinEntries;
        int maxEntries = update.config.uxMaxEntries;
        UXStatsConf uxStatsContext = new UXStatsConf(url, os, fwversion, fwbuild, period, minEntries, maxEntries);
        UXStats.instance().setContext(uxStatsContext);
    }
}
Also used : UXStatsConf(com.frostwire.uxstats.UXStatsConf) ConfigurationManager(com.frostwire.android.core.ConfigurationManager)

Example 2 with UXStatsConf

use of com.frostwire.uxstats.UXStatsConf in project frostwire by frostwire.

the class UpdateMessageReader method processUXStatsMsg.

private void processUXStatsMsg(Attributes atts) {
    try {
        String enabled = atts.getValue("enabled");
        if (enabled != null && enabled.equals("true") && ApplicationSettings.UX_STATS_ENABLED.getValue()) {
            String url = "http://ux.frostwire.com/dux";
            String os = OSUtils.getFullOS();
            String fwversion = FrostWireUtils.getFrostWireVersion();
            String fwbuild = String.valueOf(FrostWireUtils.getBuildNumber());
            int period = Integer.parseInt(atts.getValue("period"));
            int minEntries = Integer.parseInt(atts.getValue("minEntries"));
            int maxEntries = Integer.parseInt(atts.getValue("maxEntries"));
            UXStatsConf context = new UXStatsConf(url, os, fwversion, fwbuild, period, minEntries, maxEntries);
            UXStats.instance().setContext(context);
        }
    } catch (Throwable e) {
        LOG.warn("Unable to process uxstats message from server", e);
    }
}
Also used : UXStatsConf(com.frostwire.uxstats.UXStatsConf)

Aggregations

UXStatsConf (com.frostwire.uxstats.UXStatsConf)2 ConfigurationManager (com.frostwire.android.core.ConfigurationManager)1