forked from organicmaps/organicmaps
Removed unused code and useless event tracking.
This commit is contained in:
parent
25c3a74209
commit
17c5cb89cd
9 changed files with 0 additions and 179 deletions
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include "map/information_display.hpp"
|
||||
#include "map/location_state.hpp"
|
||||
#include "map/dialog_settings.hpp"
|
||||
|
||||
#include "platform/settings.hpp"
|
||||
|
||||
|
|
|
@ -22,9 +22,6 @@ public enum Statistics
|
|||
INSTANCE;
|
||||
|
||||
private final static String KEY_STAT_ENABLED = "StatisticsEnabled";
|
||||
private final static String KEY_STAT_COLLECTED = "InitialStatisticsCollected";
|
||||
|
||||
private final static double ACTIVE_USER_MIN_FOREGROUND_TIME = 5 * 60; // 5 minutes
|
||||
|
||||
private List<StatisticsEngine> mStatisticsEngines;
|
||||
private EventBuilder mEventBuilder;
|
||||
|
@ -42,10 +39,8 @@ public enum Statistics
|
|||
public static final String COUNTRY_UPDATE = "Country update";
|
||||
public static final String COUNTRY_DELETE = "Country deleted";
|
||||
public static final String SEARCH_CAT_CLICKED = "Search category clicked";
|
||||
public static final String BOOKMARK_GROUP_CHANGED = "Bookmark group changed";
|
||||
public static final String DESCRIPTION_CHANGED = "Description changed";
|
||||
public static final String GROUP_CREATED = "Group Created";
|
||||
public static final String SEARCH_CONTEXT_CHANGED = "Search context changed";
|
||||
public static final String COLOR_CHANGED = "Color changed";
|
||||
public static final String BOOKMARK_CREATED = "Bookmark created";
|
||||
public static final String PLACE_SHARED = "Place Shared";
|
||||
|
@ -69,7 +64,6 @@ public enum Statistics
|
|||
public static final String SEARCH_ON_MAP_CLICKED = "Search on map clicked.";
|
||||
public static final String STATISTICS_STATUS_CHANGED = "Statistics status changed";
|
||||
//
|
||||
public static final String NO_FREE_SPACE = "Downloader. Not enough free space.";
|
||||
public static final String PLUS_DIALOG_LATER = "GPlus dialog cancelled.";
|
||||
public static final String RATE_DIALOG_LATER = "GPlay dialog cancelled.";
|
||||
public static final String FACEBOOK_INVITE_LATER = "Facebook invites dialog cancelled.";
|
||||
|
@ -87,12 +81,7 @@ public enum Statistics
|
|||
public static final String CALLER_ID = "Caller ID";
|
||||
public static final String HAD_VALID_LOCATION = "Had valid location";
|
||||
public static final String DELAY_MILLIS = "Delay in milliseconds";
|
||||
public static final String BOOKMARK_NUMBER_AVG = "Average number of bmks";
|
||||
public static final String CATEGORIES_COUNT = "Categories count";
|
||||
public static final String FG_TIME = "Foreground time";
|
||||
public static final String PRO_STAT = "One time PRO stat";
|
||||
public static final String ENABLED = "Enabled";
|
||||
public static final String APP_FLAVOR = "Flavor";
|
||||
public static final String RATING = "Rating";
|
||||
}
|
||||
|
||||
|
@ -157,11 +146,6 @@ public enum Statistics
|
|||
trackIfEnabled(event);
|
||||
}
|
||||
|
||||
public void trackGroupChanged()
|
||||
{
|
||||
trackIfEnabled(mEventBuilder.setName(EventName.BOOKMARK_GROUP_CHANGED).buildEvent());
|
||||
}
|
||||
|
||||
public void trackDescriptionChanged()
|
||||
{
|
||||
trackIfEnabled(mEventBuilder.setName(EventName.DESCRIPTION_CHANGED).buildEvent());
|
||||
|
@ -172,17 +156,6 @@ public enum Statistics
|
|||
trackIfEnabled(mEventBuilder.setName(EventName.GROUP_CREATED).buildEvent());
|
||||
}
|
||||
|
||||
public void trackSearchContextChanged(String from, String to)
|
||||
{
|
||||
final Event event = mEventBuilder
|
||||
.setName(EventName.SEARCH_CONTEXT_CHANGED)
|
||||
.addParam(EventParam.FROM, from)
|
||||
.addParam(EventParam.TO, to)
|
||||
.buildEvent();
|
||||
|
||||
trackIfEnabled(event);
|
||||
}
|
||||
|
||||
public void trackColorChanged(String from, String to)
|
||||
{
|
||||
final Event event = mEventBuilder
|
||||
|
@ -279,21 +252,10 @@ public enum Statistics
|
|||
for (StatisticsEngine engine : mStatisticsEngines)
|
||||
engine.onStartActivity(activity);
|
||||
|
||||
if (doCollectStatistics())
|
||||
collectOneTimeStatistics();
|
||||
|
||||
FbUtil.activate(activity);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean doCollectStatistics()
|
||||
{
|
||||
return isStatisticsEnabled()
|
||||
&& !isStatisticsCollected()
|
||||
&& isActiveUser(MWMApplication.get().getForegroundTime());
|
||||
}
|
||||
|
||||
|
||||
private void configure()
|
||||
{
|
||||
final String key = MWMApplication.get().getResources().getString(R.string.flurry_app_key);
|
||||
|
@ -317,40 +279,6 @@ public enum Statistics
|
|||
}
|
||||
}
|
||||
|
||||
private void collectOneTimeStatistics()
|
||||
{
|
||||
mEventBuilder.setName(EventParam.PRO_STAT);
|
||||
|
||||
// Number of sets
|
||||
final int categoriesCount = BookmarkManager.INSTANCE.getCategoriesCount();
|
||||
if (categoriesCount > 0)
|
||||
{
|
||||
// Calculate average number of bookmarks in category
|
||||
final double[] sizes = new double[categoriesCount];
|
||||
for (int catIndex = 0; catIndex < categoriesCount; catIndex++)
|
||||
sizes[catIndex] = BookmarkManager.INSTANCE.getCategoryById(catIndex).getSize();
|
||||
final double average = MathUtils.average(sizes);
|
||||
|
||||
mEventBuilder.addParam(EventParam.BOOKMARK_NUMBER_AVG, String.valueOf(average));
|
||||
}
|
||||
|
||||
mEventBuilder.addParam(EventParam.CATEGORIES_COUNT, String.valueOf(categoriesCount))
|
||||
.addParam(EventParam.FG_TIME, String.valueOf(MWMApplication.get().getForegroundTime()));
|
||||
|
||||
trackIfEnabled(mEventBuilder.buildEvent());
|
||||
setStatisticsCollected(true);
|
||||
}
|
||||
|
||||
private boolean isStatisticsCollected()
|
||||
{
|
||||
return MWMApplication.get().nativeGetBoolean(KEY_STAT_COLLECTED, false);
|
||||
}
|
||||
|
||||
private void setStatisticsCollected(boolean isCollected)
|
||||
{
|
||||
MWMApplication.get().nativeSetBoolean(KEY_STAT_COLLECTED, isCollected);
|
||||
}
|
||||
|
||||
public boolean isStatisticsEnabled()
|
||||
{
|
||||
return MWMApplication.get().nativeGetBoolean(KEY_STAT_ENABLED, true);
|
||||
|
@ -366,9 +294,4 @@ public enum Statistics
|
|||
.addParam(EventParam.ENABLED, String.valueOf(isEnabled))
|
||||
.buildEvent());
|
||||
}
|
||||
|
||||
private boolean isActiveUser(double foregroundTime)
|
||||
{
|
||||
return foregroundTime > ACTIVE_USER_MIN_FOREGROUND_TIME;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
#import "UIKitCategories.h"
|
||||
#import "3party/Alohalytics/src/alohalytics_objc.h"
|
||||
|
||||
#include "map/dialog_settings.hpp"
|
||||
|
||||
extern NSString * const kUDAlreadyRatedKey;
|
||||
extern NSString * const kRateAlertEventName = @"rateAlertEvent";
|
||||
|
||||
|
@ -154,7 +152,6 @@ static NSString * const kRateAlertNibName = @"MWMRateAlert";
|
|||
}
|
||||
completion:^(BOOL finished)
|
||||
{
|
||||
dlg_settings::SaveResult(dlg_settings::AppStore, dlg_settings::OK);
|
||||
[[UIApplication sharedApplication] rateVersionFrom:@"ios_pro_popup"];
|
||||
[self close];
|
||||
[self setupAlreadyRatedInUserDefaults];
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "../Statistics/Statistics.h"
|
||||
|
||||
#include "../../../map/country_status_display.hpp"
|
||||
#include "../../../map/dialog_settings.hpp"
|
||||
#include "../../../map/user_mark.hpp"
|
||||
|
||||
#include "../../../platform/file_logging.hpp"
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#import "UIKitCategories.h"
|
||||
#import <MessageUI/MFMailComposeViewController.h>
|
||||
#import <sys/utsname.h>
|
||||
#include "../../map/dialog_settings.hpp"
|
||||
#include "../../platform/platform.hpp"
|
||||
#import "SettingsViewController.h"
|
||||
#import "UIViewController+Navigation.h"
|
||||
|
@ -196,7 +195,6 @@ extern NSDictionary * const deviceNames = @{@"x86_64" : @"Simulator",
|
|||
|
||||
- (void)rateApp
|
||||
{
|
||||
dlg_settings::SaveResult(dlg_settings::AppStore, dlg_settings::OK);
|
||||
[[UIApplication sharedApplication] rateVersionFrom:@"rate_menu_item"];
|
||||
}
|
||||
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
#include "map/dialog_settings.hpp"
|
||||
|
||||
#include "platform/settings.hpp"
|
||||
|
||||
#include "base/assert.hpp"
|
||||
|
||||
|
||||
namespace dlg_settings
|
||||
{
|
||||
|
||||
/// @note Add new values to the end and do not change order.
|
||||
//@{
|
||||
char const * g_arrSettingsName[] =
|
||||
{
|
||||
"FacebookDialog",
|
||||
"AppStoreRate"
|
||||
};
|
||||
|
||||
int g_arrMinForegroundTime[] = { 30 * 60, 60 * 60, 50 * 60};
|
||||
//@}
|
||||
|
||||
string const g_timeInApp = "AllForegroundTime";
|
||||
|
||||
void AddTimeToSetting(string const & settingName, double elapsed)
|
||||
{
|
||||
double val = 0;
|
||||
(void)Settings::Get(settingName, val);
|
||||
Settings::Set(settingName, val + elapsed);
|
||||
}
|
||||
|
||||
|
||||
bool ShouldShow(DialogT dlg)
|
||||
{
|
||||
string const name = g_arrSettingsName[dlg];
|
||||
|
||||
bool flag = true;
|
||||
(void)Settings::Get("ShouldShow" + name, flag);
|
||||
if (!flag)
|
||||
return false;
|
||||
|
||||
double val = 0;
|
||||
(void)Settings::Get(name + "ForegroundTime", val);
|
||||
return (val >= g_arrMinForegroundTime[dlg]);
|
||||
}
|
||||
|
||||
void SaveResult(DialogT dlg, ResultT res)
|
||||
{
|
||||
string const name = g_arrSettingsName[dlg];
|
||||
|
||||
switch (res)
|
||||
{
|
||||
case OK: case Never:
|
||||
Settings::Set("ShouldShow" + name, false);
|
||||
break;
|
||||
case Later:
|
||||
Settings::Set(name + "ForegroundTime", 0);
|
||||
break;
|
||||
default:
|
||||
ASSERT ( false, () );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void EnterBackground(double elapsed)
|
||||
{
|
||||
for (int i = 0; i < DlgCount; ++i)
|
||||
{
|
||||
string const name = string(g_arrSettingsName[i]) + "ForegroundTime";
|
||||
AddTimeToSetting(name, elapsed);
|
||||
}
|
||||
AddTimeToSetting(g_timeInApp, elapsed);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
|
||||
namespace dlg_settings
|
||||
{
|
||||
/// @note Do not change numeric values, order and leave DlgCount last.
|
||||
//@{
|
||||
enum DialogT { FacebookDlg = 0, AppStore, DlgCount };
|
||||
enum ResultT { OK = 0, Later, Never };
|
||||
//@}
|
||||
|
||||
void EnterBackground(double elapsed);
|
||||
|
||||
bool ShouldShow(DialogT dlg);
|
||||
void SaveResult(DialogT dlg, ResultT res);
|
||||
}
|
|
@ -3,7 +3,6 @@
|
|||
#include "benchmark_engine.hpp"
|
||||
#include "geourl_process.hpp"
|
||||
#include "navigator_utils.hpp"
|
||||
#include "dialog_settings.hpp"
|
||||
#include "ge0_parser.hpp"
|
||||
|
||||
#include "render/cpu_drawer.hpp"
|
||||
|
@ -1022,8 +1021,6 @@ void Framework::EnterBackground()
|
|||
#ifndef OMIM_OS_ANDROID
|
||||
ClearAllCaches();
|
||||
#endif
|
||||
|
||||
dlg_settings::EnterBackground(my::Timer::LocalTime() - m_StartForegroundTime);
|
||||
}
|
||||
|
||||
void Framework::EnterForeground()
|
||||
|
|
|
@ -27,7 +27,6 @@ HEADERS += \
|
|||
animator.hpp \
|
||||
move_screen_task.hpp \
|
||||
change_viewport_task.hpp \
|
||||
dialog_settings.hpp \
|
||||
mwm_url.hpp \
|
||||
bookmark_manager.hpp \
|
||||
ge0_parser.hpp \
|
||||
|
@ -61,7 +60,6 @@ SOURCES += \
|
|||
animator.cpp \
|
||||
move_screen_task.cpp \
|
||||
change_viewport_task.cpp \
|
||||
dialog_settings.cpp \
|
||||
mwm_url.cpp \
|
||||
bookmark_manager.cpp \
|
||||
ge0_parser.cpp \
|
||||
|
|
Loading…
Add table
Reference in a new issue