File tree Expand file tree Collapse file tree
PocketDDD.BlazorClient.LocalStorage Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,6 +114,11 @@ public async ValueTask<IList<T>> GetAllSyncItemsAsync()
114114 }
115115 return items ;
116116 }
117+ public async ValueTask < int > GetItemCountAsync ( )
118+ {
119+ var keys = await _localStorage . KeysAsync ( ) ;
120+ return keys . Count ( x => x . StartsWith ( _keyPrefix ) ) ;
121+ }
117122
118123 public ValueTask AddSyncItemAsync ( T item , string clientId ) =>
119124 _localStorage . SetItemAsync ( _keyPrefix + clientId , item ) ;
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ public async Task SyncEventFeedback()
6767 public async Task SyncEventFeedbackItems ( IList < SubmitEventFeedbackDTO > syncItems )
6868 {
6969 _dispatcher . Dispatch ( new SetSyncingEventFeedbackAction ( true ) ) ;
70+ _dispatcher . Dispatch ( new SetOutstandingEventFeedbackSyncCountAction ( syncItems . Count ) ) ;
7071
7172 try
7273 {
@@ -83,6 +84,9 @@ public async Task SyncEventFeedbackItems(IList<SubmitEventFeedbackDTO> syncItems
8384 // ignored
8485 }
8586 }
87+
88+ var newItemCount = await _localStorage . EventFeedbackSync . GetItemCountAsync ( ) ;
89+ _dispatcher . Dispatch ( new SetOutstandingEventFeedbackSyncCountAction ( newItemCount ) ) ;
8690 }
8791 finally
8892 {
@@ -106,6 +110,7 @@ public async Task SyncSessionFeedback()
106110 public async Task SyncSessionFeedbackItems ( IList < SubmitSessionFeedbackDTO > syncItems )
107111 {
108112 _dispatcher . Dispatch ( new SetSyncingSessionFeedbackAction ( true ) ) ;
113+ _dispatcher . Dispatch ( new SetOutstandingSessionFeedbackSyncCountAction ( syncItems . Count ) ) ;
109114
110115 try
111116 {
@@ -122,6 +127,9 @@ public async Task SyncSessionFeedbackItems(IList<SubmitSessionFeedbackDTO> syncI
122127 // ignored
123128 }
124129 }
130+
131+ var newItemCount = await _localStorage . SessionFeedbackSync . GetItemCountAsync ( ) ;
132+ _dispatcher . Dispatch ( new SetOutstandingSessionFeedbackSyncCountAction ( newItemCount ) ) ;
125133 }
126134 finally
127135 {
Original file line number Diff line number Diff line change @@ -7,3 +7,5 @@ public record SyncAction;
77public record SetSyncingEventAction ( bool Syncing ) ;
88public record SetSyncingEventFeedbackAction ( bool Syncing ) ;
99public record SetSyncingSessionFeedbackAction ( bool Syncing ) ;
10+ public record SetOutstandingEventFeedbackSyncCountAction ( int Count ) ;
11+ public record SetOutstandingSessionFeedbackSyncCountAction ( int Count ) ;
Original file line number Diff line number Diff line change @@ -10,10 +10,18 @@ public static class SyncReducer
1010 public static SyncState OnSetSyncingEvent ( SyncState state , SetSyncingEventAction action ) =>
1111 state with { IsSyncingEvent = action . Syncing } ;
1212
13+ [ ReducerMethod ]
14+ public static SyncState OnSetOutstandingEventFeedbackSyncCount ( SyncState state , SetOutstandingEventFeedbackSyncCountAction action ) =>
15+ state with { OutstandingEventFeedbackSyncCount = action . Count } ;
16+
1317 [ ReducerMethod ]
1418 public static SyncState OnSetSyncingEventFeedback ( SyncState state , SetSyncingEventFeedbackAction action ) =>
1519 state with { IsSyncingEventFeedback = action . Syncing } ;
1620
21+ [ ReducerMethod ]
22+ public static SyncState OnSetOutstandingSessionFeedbackSyncCountAction ( SyncState state , SetOutstandingSessionFeedbackSyncCountAction action ) =>
23+ state with { OutstandingSessionFeedbackSyncCount = action . Count } ;
24+
1725 [ ReducerMethod ]
1826 public static SyncState OnSetSyncingSessionFeedbackAction ( SyncState state , SetSyncingSessionFeedbackAction action ) =>
1927 state with { IsSyncingSessionFeedback = action . Syncing } ;
Original file line number Diff line number Diff line change 2424< script >
2525 if ( window . location . hostname . includes ( "localhost" ) || window . location . hostname . includes ( "development" ) ) {
2626 Blazor . start ( {
27- environment : "Development "
27+ environment : "Test "
2828 } ) ;
2929 } else if ( window . location . hostname . includes ( "test" ) ) {
3030 Blazor . start ( {
You can’t perform that action at this time.
0 commit comments