increaseSession method

Future<void> increaseSession()

Increases a session for MBAudience.

Implementation

Future<void> increaseSession() async {
  SharedPreferences prefs = await SharedPreferences.getInstance();
  int session = prefs.getInt('com.mumble.mburger.audience.session') ?? 0;
  int newSession = session + 1;
  await prefs.setInt('com.mumble.mburger.audience.session', newSession);
  String key = _sessionDateKeyForSession(newSession);
  await prefs.setInt(key, DateTime.now().millisecondsSinceEpoch);
  await _clearOldSessionValues();
  await startSession();
}