|
@@ -4,14 +4,14 @@
|
4
|
4
|
|
5
|
5
|
@implementation RNNOverlayManager {
|
6
|
6
|
NSMutableDictionary* _overlayDict;
|
|
7
|
+ NSMutableDictionary* _overlayWindows;
|
7
|
8
|
RNNStore* _store;
|
8
|
|
- RNNOverlayWindow *_overlayWindow;
|
9
|
|
- UIWindow *_previousWindow;
|
10
|
9
|
}
|
11
|
10
|
|
12
|
11
|
- (instancetype)initWithStore:(RNNStore *)store {
|
13
|
12
|
self = [super init];
|
14
|
13
|
_overlayDict = [[NSMutableDictionary alloc] init];
|
|
14
|
+ _overlayWindows = [[NSMutableDictionary alloc] init];
|
15
|
15
|
_store = store;
|
16
|
16
|
return self;
|
17
|
17
|
}
|
|
@@ -20,11 +20,11 @@
|
20
|
20
|
|
21
|
21
|
- (void)showOverlay:(RNNRootViewController *)viewController completion:(RNNTransitionCompletionBlock)completion {
|
22
|
22
|
[self cacheOverlay:viewController];
|
23
|
|
- _previousWindow = [UIApplication sharedApplication].keyWindow;
|
24
|
|
- _overlayWindow = [[RNNOverlayWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
25
|
|
- [_overlayWindow setWindowLevel:UIWindowLevelNormal];
|
26
|
|
- [_overlayWindow setRootViewController:viewController];
|
27
|
|
- [_overlayWindow makeKeyAndVisible];
|
|
23
|
+ UIWindow* overlayWindow = [[RNNOverlayWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
|
24
|
+ [_overlayWindows setObject:overlayWindow forKey:viewController.componentId];
|
|
25
|
+ [overlayWindow setWindowLevel:UIWindowLevelNormal];
|
|
26
|
+ [overlayWindow setRootViewController:viewController];
|
|
27
|
+ [overlayWindow setHidden:NO];
|
28
|
28
|
|
29
|
29
|
completion();
|
30
|
30
|
}
|
|
@@ -32,7 +32,7 @@
|
32
|
32
|
- (void)dismissOverlay:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion rejection:(RNNTransitionRejectionBlock)reject {
|
33
|
33
|
RNNRootViewController* viewController = [_overlayDict objectForKey:componentId];
|
34
|
34
|
if (viewController) {
|
35
|
|
- [self detachOverlayWindow];
|
|
35
|
+ [self detachOverlayWindow:componentId];
|
36
|
36
|
[self removeCachedOverlay:viewController];
|
37
|
37
|
completion();
|
38
|
38
|
} else {
|
|
@@ -51,11 +51,11 @@
|
51
|
51
|
[_store removeComponent:viewController.componentId];
|
52
|
52
|
}
|
53
|
53
|
|
54
|
|
-- (void)detachOverlayWindow {
|
55
|
|
- [_overlayWindow setRootViewController:nil];
|
56
|
|
- _overlayWindow = nil;
|
57
|
|
- [_previousWindow makeKeyAndVisible];
|
58
|
|
- _previousWindow = nil;
|
|
54
|
+- (void)detachOverlayWindow:(NSString *)componentId {
|
|
55
|
+ UIWindow* overlayWindow = [_overlayWindows objectForKey:componentId];
|
|
56
|
+ [overlayWindow setHidden:YES];
|
|
57
|
+ [overlayWindow setRootViewController:nil];
|
|
58
|
+ overlayWindow = nil;
|
59
|
59
|
}
|
60
|
60
|
|
61
|
61
|
@end
|