FIDRenderingWindowHelper.m 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. UIWindowForModal = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  24. UIWindowForModal.windowLevel = UIWindowLevelNormal;
  25. });
  26. return UIWindowForModal;
  27. }
  28. + (UIWindow *)UIWindowForBannerView {
  29. static UIWindow *UIWindowForBanner;
  30. static dispatch_once_t onceToken;
  31. dispatch_once(&onceToken, ^{
  32. UIWindowForBanner = [[FIDBannerViewUIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  33. UIWindowForBanner.windowLevel = UIWindowLevelNormal;
  34. });
  35. return UIWindowForBanner;
  36. }
  37. + (UIWindow *)UIWindowForImageOnlyView {
  38. static UIWindow *UIWindowForImageOnly;
  39. static dispatch_once_t onceToken;
  40. dispatch_once(&onceToken, ^{
  41. UIWindowForImageOnly = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  42. UIWindowForImageOnly.windowLevel = UIWindowLevelNormal;
  43. });
  44. return UIWindowForImageOnly;
  45. }
  46. @end