Feature/3608 matomo new

This commit is contained in:
Frank Rotermund
2022-09-21 08:54:22 +00:00
parent 087b4e1715
commit c20a0a7bdb
17 changed files with 310 additions and 52 deletions
@@ -43,6 +43,7 @@ enum
SECTION_KEYBACKUP,
#endif
SECTION_ADVANCED,
SECTION_ANALYTICS,
SECTION_COUNT
};
@@ -70,6 +71,10 @@ enum {
ADVANCED_COUNT
};
enum {
ANALYTICS_ENABLED
};
@interface SecurityViewController () <
SettingsSecureBackupTableViewSectionDelegate,
@@ -320,9 +325,17 @@ TableViewSectionsDelegate>
}
[sections addObject:pinCodeSection];
// BWI: if tracking is enabled show switch to turn it on/off
if ([BWIAnalytics.sharedTracker isEnabled]) {
Section *analyticsSection = [Section sectionWithTag:SECTION_ANALYTICS];
[analyticsSection addRowWithTag:ANALYTICS_ENABLED];
analyticsSection.headerTitle = BWIL10n.bwiSettingsAnalyticsSectionHeader;
[sections addObject:analyticsSection];
}
// Crypto sessions section
if (RiotSettings.shared.settingsSecurityScreenShowSessions)
{
Section *sessionsSection = [Section sectionWithTag:SECTION_CRYPTO_SESSIONS];
@@ -1286,6 +1299,21 @@ TableViewSectionsDelegate>
}
}
}
// bwi: analytics
else if (sectionTag == SECTION_ANALYTICS)
{
if (rowTag == ANALYTICS_ENABLED) {
MXKTableViewCellWithLabelAndSwitch* labelAndSwitchCell = [self getLabelAndSwitchCell:tableView forIndexPath:indexPath];
labelAndSwitchCell.mxkLabel.text = BWIL10n.matomoSettingsSendDiagnosticData;
labelAndSwitchCell.mxkSwitch.on = BWIAnalytics.sharedTracker.running;
labelAndSwitchCell.mxkSwitch.onTintColor = ThemeService.shared.theme.tintColor;
labelAndSwitchCell.mxkSwitch.enabled = YES;
[labelAndSwitchCell.mxkSwitch addTarget:self action:@selector(bwiToggleEnableMatomoTracking:) forControlEvents:UIControlEventTouchUpInside];
cell = labelAndSwitchCell;
}
}
return cell;
}
@@ -1880,4 +1908,13 @@ TableViewSectionsDelegate>
[self.tableView reloadData];
}
#pragma mark - bwi analytics
- (void)bwiToggleEnableMatomoTracking:(UISwitch *)sender
{
BOOL isOn = sender.on;
BWIAnalytics.sharedTracker.running = isOn;
}
@end