setSessionCount method
Manually sets the session count to a specific value.
This method can be used to override the automatic session tracking or to set the count to a specific value from another source.
Parameters:
count
: The new session count value to set
Returns true if the update was successful, false otherwise.
Example:
// Reset the session count
await SuperFCM.instance.setSessionCount(0);
Implementation
Future<bool> setSessionCount(int count) async {
return _queueOrExecute("setSessionCount", () async {
logger.i('Manually setting session count to $count');
final response = await _patch(
'subscriptions/${subscription!.id}',
{
'sessionCount': count,
},
_config!.cacheOnOffline,
);
return _handleResponse(
response,
'update session count',
onSuccess: (response) {
subscription = subscription!.copyWith(sessionCount: count);
_storeSubscription();
},
);
});
}