diff --git a/android/src/com/mapswithme/maps/settings/SettingsPrefsFragment.java b/android/src/com/mapswithme/maps/settings/SettingsPrefsFragment.java index d21899296c..26778b076d 100644 --- a/android/src/com/mapswithme/maps/settings/SettingsPrefsFragment.java +++ b/android/src/com/mapswithme/maps/settings/SettingsPrefsFragment.java @@ -579,8 +579,11 @@ public class SettingsPrefsFragment extends BaseXmlSettingsFragment powerManagementPref.setOnPreferenceChangeListener((preference, newValue) -> { - String valueStr = (String) newValue; - PowerManagment.setScheme(Integer.parseInt(valueStr)); + @PowerManagment.SchemeType + int scheme = Integer.parseInt((String) newValue); + + PowerManagment.setScheme(scheme); + Statistics.INSTANCE.trackPowerManagmentSchemeChanged(scheme); return true; }); diff --git a/android/src/com/mapswithme/util/statistics/Statistics.java b/android/src/com/mapswithme/util/statistics/Statistics.java index fa1dbbe09d..c0f9609aac 100644 --- a/android/src/com/mapswithme/util/statistics/Statistics.java +++ b/android/src/com/mapswithme/util/statistics/Statistics.java @@ -40,6 +40,7 @@ import com.mapswithme.util.BatteryState; import com.mapswithme.util.Config; import com.mapswithme.util.ConnectionState; import com.mapswithme.util.Counters; +import com.mapswithme.util.PowerManagment; import com.mapswithme.util.SharedPropertiesUtils; import com.my.tracker.MyTracker; @@ -436,6 +437,7 @@ public enum Statistics public static final String MAP_STYLE = "Settings. Map style."; public static final String VOICE_ENABLED = "Settings. Switch voice."; public static final String VOICE_LANGUAGE = "Settings. Voice language."; + public static final String ENERGY_SAVING = "Settings_EnergySaving_change"; private Settings() {} } @@ -1452,6 +1454,22 @@ public enum Statistics .add(PURCHASE, purchaseId)); } + public void trackPowerManagmentSchemeChanged(@PowerManagment.SchemeType int scheme) + { + String statisticValue = ""; + switch (scheme) + { + case PowerManagment.NONE: + case PowerManagment.MEDIUM: + throw new AssertionError("Incorrect scheme type"); + case PowerManagment.NORMAL: statisticValue = "never"; break; + case PowerManagment.AUTO: statisticValue = "auto"; break; + case PowerManagment.HIGH: statisticValue = "max"; break; + } + + trackEvent(EventName.Settings.ENERGY_SAVING, params().add(EventParam.VALUE, statisticValue)); + } + public void trackPurchaseProductDelivered(@NonNull String purchaseId, @NonNull String vendor) { trackEvent(INAPP_PURCHASE_PRODUCT_DELIVERED, params().add(VENDOR, vendor) diff --git a/iphone/Maps/Common/Statistics/StatisticsStrings.h b/iphone/Maps/Common/Statistics/StatisticsStrings.h index da698f75cc..a49d0731f2 100644 --- a/iphone/Maps/Common/Statistics/StatisticsStrings.h +++ b/iphone/Maps/Common/Statistics/StatisticsStrings.h @@ -147,6 +147,7 @@ static NSString * const kStatEditorProblemReport = @"Editor_Problem_report"; static NSString * const kStatEditorRegRequest = @"Editor_Reg_request"; static NSString * const kStatEditorSecondTimeShareClick = @"Editor_SecondTimeShare_click"; static NSString * const kStatEditorSecondTimeShareShow = @"Editor_SecondTimeShare_show"; +static NSString * const kStatEnergySavingChange = @"Settings_EnergySaving_change"; static NSString * const kStatError = @"error"; static NSString * const kStatErrorCode = @"error_code"; static NSString * const kStatErrorData = @"err_data"; diff --git a/iphone/Maps/UI/Settings/MWMPowerManagmentViewController.mm b/iphone/Maps/UI/Settings/MWMPowerManagmentViewController.mm index 6add3e22d3..8cf162abb7 100644 --- a/iphone/Maps/UI/Settings/MWMPowerManagmentViewController.mm +++ b/iphone/Maps/UI/Settings/MWMPowerManagmentViewController.mm @@ -1,5 +1,6 @@ #import "MWMPowerManagmentViewController.h" +#import "Statistics.h" #import "SwiftBridge.h" #include "Framework.h" @@ -43,12 +44,28 @@ using namespace power_management; selectedCell.accessoryType = UITableViewCellAccessoryCheckmark; _selectedCell = selectedCell; + NSString * statisticValue = @""; + Scheme scheme = Scheme::None; if ([selectedCell isEqual:self.never]) - GetFramework().GetPowerManager().SetScheme(Scheme::Normal); + { + statisticValue = @"never"; + scheme = Scheme::Normal; + } else if ([selectedCell isEqual:self.manualMax]) - GetFramework().GetPowerManager().SetScheme(Scheme::EconomyMaximum); + { + statisticValue = @"max"; + scheme = Scheme::EconomyMaximum; + } else if ([selectedCell isEqual:self.automatic]) - GetFramework().GetPowerManager().SetScheme(Scheme::Auto); + { + statisticValue = @"auto"; + scheme = Scheme::Auto; + } + + CHECK_NOT_EQUAL(scheme, Scheme::None, ()); + + GetFramework().GetPowerManager().SetScheme(scheme); + [Statistics logEvent:kStatEnergySavingChange withParameters:@{kStatValue: statisticValue}]; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath