1// Copyright 2015-present 650 Industries. All rights reserved.
2
3@import UIKit;
4
5#import "EXDisabledDevLoadingView.h"
6#import "EXDevSettings.h"
7
8@implementation EXDisabledDevLoadingView {
9  BOOL _isObserving;
10}
11
12+ (NSString *)moduleName { return @"RCTDevLoadingView"; }
13
14
15RCT_EXPORT_METHOD(hide)
16{
17  RCTDevSettings *settings = [[super bridge] devSettings];
18  BOOL isFastRefreshEnabled = [settings isHotLoadingEnabled];
19  if (_isObserving && isFastRefreshEnabled) {
20    [self sendEventWithName:@"devLoadingView:hide" body:@{}];
21  }
22}
23
24RCT_EXPORT_METHOD(showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(UIColor *)backgroundColor)
25{
26  RCTDevSettings *settings = [[super bridge] devSettings];
27  BOOL isFastRefreshEnabled = [settings isHotLoadingEnabled];
28  if (_isObserving && isFastRefreshEnabled) {
29    [self sendEventWithName:@"devLoadingView:showMessage" body:@{@"message":message}];
30  }
31}
32
33- (NSArray<NSString *> *)supportedEvents
34{
35  return @[@"devLoadingView:showMessage", @"devLoadingView:hide"];
36}
37
38- (void)startObserving
39{
40  _isObserving = YES;
41}
42
43- (void)stopObserving
44{
45  _isObserving = NO;
46}
47
48// RCTDevLoadingViewProtocol implementations
49
50+ (void)setEnabled:(BOOL)enabled
51{
52
53}
54
55- (void)showWithURL:(NSURL *)URL
56{
57
58}
59
60- (void)updateProgress:(RCTLoadingProgress *)progress
61{
62
63}
64
65@end
66
67