simplify: dedupe boilerplate and remove dead code across all layers
This commit is contained in:
@@ -371,13 +371,7 @@ class PushRenderer {
|
||||
jsonEncode({'chatToken': ?chatToken, 'nid': nid});
|
||||
|
||||
/// Deterministic non-negative 31-bit id from a string, used when the push
|
||||
/// carries no `nid`.
|
||||
int _fallbackId(String? seed) {
|
||||
if (seed == null || seed.isEmpty) return 0;
|
||||
var hash = 0;
|
||||
for (final unit in seed.codeUnits) {
|
||||
hash = (hash * 31 + unit) & 0x7fffffff;
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
/// carries no `nid`. Shares the hash with [stableChatNotificationId] (an
|
||||
/// empty/null seed hashes to 0).
|
||||
int _fallbackId(String? seed) => stableChatNotificationId(seed ?? '');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user