mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-22 01:22:46 +02:00
@@ -59,6 +59,12 @@ limitations under the License.
|
||||
The fake top view displayed in case of vertical bounce.
|
||||
*/
|
||||
__weak UIView *topview;
|
||||
|
||||
/**
|
||||
`isRefreshNeeded` is set to `YES` if an update of the datasource has been triggered but the UI has not been updated.
|
||||
It's set to `NO` after a refresh of the UI.
|
||||
*/
|
||||
BOOL isRefreshNeeded;
|
||||
}
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UISearchBar *recentsSearchBar;
|
||||
@@ -83,6 +89,11 @@ limitations under the License.
|
||||
*/
|
||||
@property (nonatomic) BOOL enableBarButtonSearch;
|
||||
|
||||
/**
|
||||
Enabled or disabled the UI update after recents syncs. Default YES.
|
||||
*/
|
||||
@property (nonatomic, getter=isRecentsUpdateEnabled) BOOL recentsUpdateEnabled;
|
||||
|
||||
#pragma mark - Class methods
|
||||
|
||||
/**
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
{
|
||||
[super finalizeInit];
|
||||
|
||||
_recentsUpdateEnabled = YES;
|
||||
_enableBarButtonSearch = YES;
|
||||
}
|
||||
|
||||
@@ -169,6 +170,8 @@
|
||||
|
||||
// Observe the server sync
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onSyncNotification) name:kMXSessionDidSyncNotification object:nil];
|
||||
|
||||
self.recentsUpdateEnabled = YES;
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated
|
||||
@@ -319,6 +322,10 @@
|
||||
|
||||
- (void)refreshRecentsTable
|
||||
{
|
||||
if (!self.recentsUpdateEnabled) return;
|
||||
|
||||
isRefreshNeeded = NO;
|
||||
|
||||
// For now, do a simple full reload
|
||||
[self.recentsTableView reloadData];
|
||||
}
|
||||
@@ -330,6 +337,16 @@
|
||||
[self.view setNeedsUpdateConstraints];
|
||||
}
|
||||
|
||||
- (void)setRecentsUpdateEnabled:(BOOL)activeUpdate
|
||||
{
|
||||
_recentsUpdateEnabled = activeUpdate;
|
||||
|
||||
if (_recentsUpdateEnabled && isRefreshNeeded)
|
||||
{
|
||||
[self refreshRecentsTable];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Action
|
||||
|
||||
- (IBAction)search:(id)sender
|
||||
@@ -385,6 +402,12 @@
|
||||
|
||||
- (void)dataSource:(MXKDataSource *)dataSource didCellChange:(id)changes
|
||||
{
|
||||
if (!_recentsUpdateEnabled)
|
||||
{
|
||||
isRefreshNeeded = YES;
|
||||
return;
|
||||
}
|
||||
|
||||
// For now, do a simple full reload
|
||||
[self refreshRecentsTable];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user