2016-06-13 15:28:17 +00:00
|
|
|
/*
|
|
|
|
Copyright 2016 OpenMarket Ltd
|
2017-03-08 15:14:41 +00:00
|
|
|
Copyright 2017 Vector Creations Ltd
|
2016-06-13 15:28:17 +00:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import "AttachmentsViewController.h"
|
|
|
|
|
2018-11-30 16:10:28 +00:00
|
|
|
#import "Riot-Swift.h"
|
2016-06-13 15:28:17 +00:00
|
|
|
|
2017-07-21 09:28:17 +00:00
|
|
|
@interface AttachmentsViewController ()
|
|
|
|
{
|
2019-01-11 09:32:56 +00:00
|
|
|
// Observe kThemeServiceDidChangeThemeNotification to handle user interface theme change.
|
|
|
|
id kThemeServiceDidChangeThemeNotificationObserver;
|
2017-07-21 09:28:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2016-06-13 15:28:17 +00:00
|
|
|
@implementation AttachmentsViewController
|
|
|
|
|
|
|
|
#pragma mark -
|
|
|
|
|
2017-01-03 13:40:23 +00:00
|
|
|
- (void)finalizeInit
|
2016-06-13 15:28:17 +00:00
|
|
|
{
|
2017-01-03 13:40:23 +00:00
|
|
|
[super finalizeInit];
|
2016-06-13 15:28:17 +00:00
|
|
|
|
2017-07-21 09:28:17 +00:00
|
|
|
// Setup `MXKViewControllerHandling` properties.
|
2016-06-13 15:28:17 +00:00
|
|
|
self.enableBarTintColorStatusChange = NO;
|
|
|
|
self.rageShakeManager = [RageShakeManager sharedManager];
|
|
|
|
}
|
|
|
|
|
2017-01-03 13:40:23 +00:00
|
|
|
- (void)viewDidLoad
|
|
|
|
{
|
|
|
|
[super viewDidLoad];
|
|
|
|
// Do any additional setup after loading the view, typically from a nib.
|
2017-04-04 13:16:25 +00:00
|
|
|
|
|
|
|
self.attachmentsCollection.accessibilityIdentifier =@"AttachmentsVC";
|
2017-07-21 09:28:17 +00:00
|
|
|
|
|
|
|
// Observe user interface theme change.
|
2019-01-11 09:32:56 +00:00
|
|
|
kThemeServiceDidChangeThemeNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kThemeServiceDidChangeThemeNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) {
|
2017-07-21 09:28:17 +00:00
|
|
|
|
|
|
|
[self userInterfaceThemeDidChange];
|
|
|
|
|
|
|
|
}];
|
|
|
|
[self userInterfaceThemeDidChange];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)userInterfaceThemeDidChange
|
|
|
|
{
|
2019-01-11 10:45:27 +00:00
|
|
|
[ThemeService.shared.theme applyStyleOnNavigationBar:self.navigationController.navigationBar];
|
2018-11-29 16:31:41 +00:00
|
|
|
|
2019-01-11 10:45:27 +00:00
|
|
|
self.view.backgroundColor = ThemeService.shared.theme.backgroundColor;
|
|
|
|
self.activityIndicator.backgroundColor = ThemeService.shared.theme.overlayBackgroundColor;
|
2017-09-19 07:35:49 +00:00
|
|
|
|
2019-01-11 10:45:27 +00:00
|
|
|
self.backButton.tintColor = ThemeService.shared.theme.tintColor;
|
2020-04-08 10:58:12 +00:00
|
|
|
|
|
|
|
[self setNeedsStatusBarAppearanceUpdate];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (UIStatusBarStyle)preferredStatusBarStyle
|
|
|
|
{
|
|
|
|
return ThemeService.shared.theme.statusBarStyle;
|
2017-01-03 13:40:23 +00:00
|
|
|
}
|
|
|
|
|
2016-06-13 15:28:17 +00:00
|
|
|
- (void)viewWillAppear:(BOOL)animated
|
|
|
|
{
|
|
|
|
[super viewWillAppear:animated];
|
2017-12-22 12:19:40 +00:00
|
|
|
|
|
|
|
// Screen tracking
|
2018-06-27 07:55:06 +00:00
|
|
|
[[Analytics sharedInstance] trackScreen:@"AttachmentsViewer"];
|
2016-06-13 15:28:17 +00:00
|
|
|
}
|
|
|
|
|
2017-07-21 09:28:17 +00:00
|
|
|
- (void)destroy
|
|
|
|
{
|
|
|
|
[super destroy];
|
|
|
|
|
2019-01-11 09:32:56 +00:00
|
|
|
if (kThemeServiceDidChangeThemeNotificationObserver)
|
2017-07-21 09:28:17 +00:00
|
|
|
{
|
2019-01-11 09:32:56 +00:00
|
|
|
[[NSNotificationCenter defaultCenter] removeObserver:kThemeServiceDidChangeThemeNotificationObserver];
|
|
|
|
kThemeServiceDidChangeThemeNotificationObserver = nil;
|
2017-07-21 09:28:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-21 14:06:32 +00:00
|
|
|
- (void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion
|
|
|
|
{
|
|
|
|
BOOL animated = flag && !self.presentingViewController.presentingViewController;
|
|
|
|
[super dismissViewControllerAnimated:animated completion:completion];
|
|
|
|
}
|
|
|
|
|
2016-06-13 15:28:17 +00:00
|
|
|
@end
|