feat: add migration part 1 banner (MESSENGER-7564)

This commit is contained in:
Jan Niklas Grabowski
2025-09-15 17:39:24 +02:00
parent b819783abf
commit 00d9048124
10 changed files with 148 additions and 67 deletions
@@ -202,7 +202,7 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
{
NSMutableArray *types = [NSMutableArray array];
// bwi: add new feature banner
if (!shouldHideFeatureBanner && BWIBuildSettings.shared.showTopBanner && BWIBuildSettings.shared.isWellknownFederationEnabled){
if (!shouldHideFeatureBanner && BWIBuildSettings.shared.showTopBanner && BWIBuildSettings.shared.BuMXMigrationInfoLevel > 0) {
[types addObject:@(RecentsDataSourceSectionTypeFeatureBanner)];
}
@@ -1890,17 +1890,18 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
- (void) shouldShowFeatureBanner
{
if (BWIBuildSettings.shared.showTopBanner && BWIBuildSettings.shared.isWellknownFederationEnabled){
if (BWIBuildSettings.shared.showTopBanner && BWIBuildSettings.shared.BuMXMigrationInfoLevel > 0){
MXSession* session = [self mxSession];
if(!session)
return;
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
FeatureBannerVisibilityService *featureBannerService = [[FeatureBannerVisibilityService alloc] initWithMxSession:session];
[featureBannerService isUnreadWithVersion:version completion:^(BOOL unread) {
[featureBannerService isUnreadWithCompletion: ^(BOOL unread) {
if (unread) {
// this notification will be called either if the user clicked on the banner or wants to hide it
[[NSNotificationCenter defaultCenter] addObserverForName:@"de.bwi.messenger.hide_top_banner" object:NULL queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) {
[self markFeatureBannerAsRead];
self->shouldHideFeatureBanner = TRUE;
[self.delegate dataSource:self didCellChange:nil];
//[self markFeatureBannerAsRead];
}];
// this notification will be called either if the user clicked on the banner or wants to hide it using a swipe gesture
@@ -1931,9 +1932,8 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
MXSession* session = [self mxSession];
if(!session)
return;
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
FeatureBannerVisibilityService *featureBannerService = [[FeatureBannerVisibilityService alloc] initWithMxSession:session];
[featureBannerService markAsReadWithVersion:version];
[featureBannerService markAsRead];
self->shouldHideFeatureBanner = TRUE;
[self.delegate dataSource:self didCellChange:nil];
}