FIDRenderingWindowHelper.m 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright 2018 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import "FIDRenderingWindowHelper.h"
  17. #import "FIDBannerViewUIWindow.h"
  18. @implementation FIDRenderingWindowHelper
  19. + (UIWindow *)UIWindowForModalView {
  20. static UIWindow *UIWindowForModal;
  21. static dispatch_once_t onceToken;
  22. dispatch_once(&onceToken, ^{
  23. UIWindow *appWindow = [[[UIApplication sharedApplication] delegate] window];
  24. UIWindowForModal = [[UIWindow alloc] initWithFrame:[appWindow frame]];
  25. UIWindowForModal.windowLevel = UIWindowLevelNormal;
  26. });
  27. return UIWindowForModal;
  28. }
  29. + (UIWindow *)UIWindowForBannerView {
  30. static UIWindow *UIWindowForBanner;
  31. static dispatch_once_t onceToken;
  32. dispatch_once(&onceToken, ^{
  33. UIWindow *appWindow = [[[UIApplication sharedApplication] delegate] window];
  34. UIWindowForBanner = [[FIDBannerViewUIWindow alloc] initWithFrame:[appWindow frame]];
  35. UIWindowForBanner.windowLevel = UIWindowLevelNormal;
  36. });
  37. return UIWindowForBanner;
  38. }
  39. + (UIWindow *)UIWindowForImageOnlyView {
  40. static UIWindow *UIWindowForImageOnly;
  41. static dispatch_once_t onceToken;
  42. dispatch_once(&onceToken, ^{
  43. UIWindow *appWindow = [[[UIApplication sharedApplication] delegate] window];
  44. UIWindowForImageOnly = [[UIWindow alloc] initWithFrame:[appWindow frame]];
  45. UIWindowForImageOnly.windowLevel = UIWindowLevelNormal;
  46. });
  47. return UIWindowForImageOnly;
  48. }
  49. @end