diff --git a/Riot/Modules/MediaPicker/Library/MediaAlbumContentViewController.h b/Riot/Modules/MediaPicker/Library/MediaAlbumContentViewController.h index 987ad6717..32424d8eb 100644 --- a/Riot/Modules/MediaPicker/Library/MediaAlbumContentViewController.h +++ b/Riot/Modules/MediaPicker/Library/MediaAlbumContentViewController.h @@ -69,7 +69,7 @@ /** The delegate for the view controller. */ -@property (nonatomic) id delegate; +@property (nonatomic, weak) id delegate; /** The array of the media types listed by the view controller (default value is an array containing kUTTypeImage). diff --git a/Riot/Modules/MediaPicker/Library/MediaAlbumContentViewController.m b/Riot/Modules/MediaPicker/Library/MediaAlbumContentViewController.m index f74637cde..03bc728c9 100644 --- a/Riot/Modules/MediaPicker/Library/MediaAlbumContentViewController.m +++ b/Riot/Modules/MediaPicker/Library/MediaAlbumContentViewController.m @@ -89,11 +89,15 @@ self.mediaTypes = @[(NSString *)kUTTypeImage]; } + MXWeakify(self); + // Observe UIApplicationWillEnterForegroundNotification to refresh captures collection when app leaves the background state. UIApplicationWillEnterForegroundNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillEnterForegroundNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) { + MXStrongifyAndReturnIfNil(self); + // Force a full refresh of the displayed collection - self.assetsCollection = _assetsCollection; + self.assetsCollection = self->_assetsCollection; }]; @@ -105,6 +109,8 @@ // Observe user interface theme change. kThemeServiceDidChangeThemeNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kThemeServiceDidChangeThemeNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) { + MXStrongifyAndReturnIfNil(self); + [self userInterfaceThemeDidChange]; }];