@@ -29,8 +29,9 @@ class ArchiveLocalAdsState extends Equatable {
2929 this .videoAdsCursor,
3030 this .videoAdsHasMore = false ,
3131 this .exception,
32- this .lastDeletedLocalAd,
3332 this .restoredLocalAd,
33+ this .lastPendingDeletionId,
34+ this .snackbarLocalAdTitle,
3435 });
3536
3637 final ArchiveLocalAdsStatus status;
@@ -86,12 +87,18 @@ class ArchiveLocalAdsState extends Equatable {
8687 /// The error describing an operation failure, if any.
8788 final HttpException ? exception;
8889
89- /// The last deleted local ad, used for undo functionality.
90- final LocalAd ? lastDeletedLocalAd;
91-
9290 /// The last restored local ad, used for triggering UI updates.
9391 final LocalAd ? restoredLocalAd;
9492
93+ /// The ID of the local ad that was most recently added to pending deletions.
94+ /// Used to trigger the snackbar display.
95+ final String ? lastPendingDeletionId;
96+
97+ /// The title of the local ad for which the snackbar should be displayed.
98+ /// This is set when a deletion is requested and cleared when the snackbar
99+ /// is no longer needed.
100+ final String ? snackbarLocalAdTitle;
101+
95102 ArchiveLocalAdsState copyWith ({
96103 ArchiveLocalAdsStatus ? status,
97104 ArchiveLocalAdsStatus ? nativeAdsStatus,
@@ -111,10 +118,9 @@ class ArchiveLocalAdsState extends Equatable {
111118 String ? videoAdsCursor,
112119 bool ? videoAdsHasMore,
113120 HttpException ? exception,
114- LocalAd ? lastDeletedLocalAd,
115121 LocalAd ? restoredLocalAd,
116- bool clearLastDeletedLocalAd = false ,
117- bool clearRestoredLocalAd = false ,
122+ String ? lastPendingDeletionId ,
123+ String ? snackbarLocalAdTitle ,
118124 }) {
119125 return ArchiveLocalAdsState (
120126 status: status ?? this .status,
@@ -137,13 +143,11 @@ class ArchiveLocalAdsState extends Equatable {
137143 videoAds: videoAds ?? this .videoAds,
138144 videoAdsCursor: videoAdsCursor ?? this .videoAdsCursor,
139145 videoAdsHasMore: videoAdsHasMore ?? this .videoAdsHasMore,
140- exception: exception ?? this .exception,
141- lastDeletedLocalAd: clearLastDeletedLocalAd
142- ? null
143- : lastDeletedLocalAd ?? this .lastDeletedLocalAd,
144- restoredLocalAd: clearRestoredLocalAd
145- ? null
146- : restoredLocalAd ?? this .restoredLocalAd,
146+ exception: exception, // Explicitly set to null if not provided
147+ restoredLocalAd:
148+ restoredLocalAd, // Explicitly set to null if not provided
149+ lastPendingDeletionId: lastPendingDeletionId,
150+ snackbarLocalAdTitle: snackbarLocalAdTitle,
147151 );
148152 }
149153
@@ -167,7 +171,8 @@ class ArchiveLocalAdsState extends Equatable {
167171 videoAdsCursor,
168172 videoAdsHasMore,
169173 exception,
170- lastDeletedLocalAd,
171174 restoredLocalAd,
175+ lastPendingDeletionId,
176+ snackbarLocalAdTitle,
172177 ];
173178}
0 commit comments