Skip to content

Commit

Permalink
Make 1.4.1 release to disable data collection by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
certaintls committed Aug 25, 2020
1 parent 8a6f0c5 commit 99f2a2e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions lib/certs_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ class CertsModel extends ChangeNotifier {
SharedPreferences prefs = await SharedPreferences.getInstance();
String userUuid = prefs.getString('user_id');
String userName = prefs.getString('user_name');
bool disableReporting = prefs.getBool('disable_reporting') ?? false;
if (!disableReporting) {
bool allowReporting = prefs.getBool('allow_reporting') ?? false;
if (allowReporting) {
// 1. Check existing user with UUID from sharedpreference
if (userUuid == null || userUuid.isEmpty) {
// 2. Create a new user if UUID empty, and store in sharedpreference
Expand Down
24 changes: 12 additions & 12 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class MyApp extends StatefulWidget {

class _MyAppState extends State<MyApp> {
int _selectedIndex = 0;
bool _disableReporting = false;
bool _allowReporting = false;

@override
void initState() {
Expand Down Expand Up @@ -101,33 +101,33 @@ class _MyAppState extends State<MyApp> {

void _showAboutDialog(BuildContext ctx) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String userName = prefs.getString('user_name');

showDialog(
context: ctx,
builder: (BuildContext context) {
bool disableReporting =
prefs.getBool('disable_reporting') ?? _disableReporting;
bool allowReporting =
prefs.getBool('allow_reporting') ?? _allowReporting;
return StatefulBuilder(builder: (context, setState) {
String userName = prefs.getString('user_name');
return AboutDialog(
applicationVersion: '1.4.0',
applicationVersion: '1.4.1',
applicationIcon: Image.asset('images/logo.png'),
children: [
Text(
'By default, CertainTLS will collect device OS meta data and certificates fingerprints for analysis. You can optionally provide your name below:'),
"Please help make CertainTLS better by allowing us to collect device operating system metadata and certificates' fingerprints for analysis. None of the above is personally identifying information. You can optionally provide your name below:"),
TextField(
decoration: InputDecoration(hintText: 'Your name'),
controller: TextEditingController()..text = userName,
onChanged: _onNameUpdate),
SizedBox(height: 20),
Row(children: [
Text('Or disable data collection:'),
Text('Allow data collection?'),
Switch(
value: disableReporting,
value: allowReporting,
onChanged: (changed) {
setState(() {
disableReporting = changed;
_saveDisableReportingPreference(changed);
allowReporting = changed;
_saveAllowReportingPreference(changed);
});
})
]),
Expand All @@ -143,9 +143,9 @@ class _MyAppState extends State<MyApp> {
prefs.setString('user_name', name);
}

void _saveDisableReportingPreference(bool isDisabled) async {
void _saveAllowReportingPreference(bool isAllowed) async {
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.setBool('disable_reporting', isDisabled);
prefs.setBool('allow_reporting', isAllowed);
}
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: A new Flutter project.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.4.0+6
version: 1.4.1+7

environment:
sdk: ">=2.2.0 <3.0.0"
Expand Down

0 comments on commit 99f2a2e

Please sign in to comment.