GIVE [+1] · [+10] 은 서버가 기여를 확정한 묶음 기준으로만 표시
This commit is contained in:
@@ -17,7 +17,7 @@ class ZapController extends ChangeNotifier {
|
||||
ZapResult? result;
|
||||
Timer? _burst;
|
||||
bool _disposed = false;
|
||||
({String fandomId, int count, String key})? _batch;
|
||||
({String fandomId, int count, String key, int streak})? _batch;
|
||||
bool get needsRetry => _batch != null && !sending;
|
||||
|
||||
/// 아직 확정되지 않은 연타 — 보내는 중인 묶음 + 다음 묶음. 표시 잔액은 이만큼 미리 뺀다.
|
||||
@@ -27,6 +27,10 @@ class ZapController extends ChangeNotifier {
|
||||
/// [streakWindow] 안에 다시 누르면 이어지고, 넘기면 1 부터 다시 센다.
|
||||
int streak = 0;
|
||||
Timer? _streakTimer;
|
||||
|
||||
/// 마지막으로 확정된 묶음의 끝 탭이 몇 번째 연속이었나 — 확정 결과 [+1] · [+10] 은 이것으로 정한다.
|
||||
/// 확정 안 된 뒤 연타는 세지 않는다.
|
||||
int confirmedStreak = 0;
|
||||
String? _pendingFandom;
|
||||
static const streakWindow = Duration(milliseconds: 500);
|
||||
|
||||
@@ -85,6 +89,7 @@ class ZapController extends ChangeNotifier {
|
||||
fandomId: fandomId,
|
||||
count: pending,
|
||||
key: 'z${DateTime.now().microsecondsSinceEpoch}',
|
||||
streak: streak,
|
||||
);
|
||||
if (batch.count == 0) return;
|
||||
_burst?.cancel();
|
||||
@@ -102,6 +107,7 @@ class ZapController extends ChangeNotifier {
|
||||
if (_disposed) return;
|
||||
if (receipt.txId.isEmpty) throw StateError('Missing ZAP receipt');
|
||||
if (receipt.balanceAfter >= 0) balance = receipt.balanceAfter;
|
||||
confirmedStreak = batch.streak;
|
||||
result = receipt;
|
||||
_batch = null;
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user