This app provides monitoring and information features for the common freifunk user and the technical stuff of a freifunk community.
Code base is taken from a TUM Practical Course project and added here to see if Freifunk Altdorf can use it.
https://www.freifunk-altdorf.de
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
1.5 KiB
84 lines
1.5 KiB
/** |
|
* Copyright (c) 2015-present, Facebook, Inc. |
|
* |
|
* This source code is licensed under the MIT license found in the |
|
* LICENSE file in the root directory of this source tree. |
|
*/ |
|
|
|
#import "RCTSurfaceView.h" |
|
#import "RCTSurfaceView+Internal.h" |
|
|
|
#import "RCTDefines.h" |
|
#import "RCTSurface.h" |
|
#import "RCTSurfaceRootView.h" |
|
|
|
@implementation RCTSurfaceView { |
|
RCTSurfaceRootView *_Nullable _rootView; |
|
RCTSurfaceStage _stage; |
|
} |
|
|
|
RCT_NOT_IMPLEMENTED(- (instancetype)init) |
|
RCT_NOT_IMPLEMENTED(- (instancetype)initWithFrame:(CGRect)frame) |
|
RCT_NOT_IMPLEMENTED(- (nullable instancetype)initWithCoder:(NSCoder *)coder) |
|
|
|
- (instancetype)initWithSurface:(RCTSurface *)surface |
|
{ |
|
if (self = [super initWithFrame:CGRectZero]) { |
|
_stage = surface.stage; |
|
_surface = surface; |
|
} |
|
|
|
return self; |
|
} |
|
|
|
#pragma mark - Internal Interface |
|
|
|
- (void)setRootView:(RCTSurfaceRootView *)rootView |
|
{ |
|
if (_rootView == rootView) { |
|
return; |
|
} |
|
|
|
[_rootView removeFromSuperview]; |
|
_rootView = rootView; |
|
[self _updateStage]; |
|
} |
|
|
|
- (RCTSurfaceRootView *)rootView |
|
{ |
|
return _rootView; |
|
} |
|
|
|
#pragma mark - stage |
|
|
|
- (void)setStage:(RCTSurfaceStage)stage |
|
{ |
|
if (stage == _stage) { |
|
return; |
|
} |
|
|
|
_stage = stage; |
|
|
|
[self _updateStage]; |
|
} |
|
|
|
- (RCTSurfaceStage)stage |
|
{ |
|
return _stage; |
|
} |
|
|
|
#pragma mark - Private |
|
|
|
- (void)_updateStage |
|
{ |
|
if (RCTSurfaceStageIsRunning(_stage)) { |
|
if (_rootView.superview != self) { |
|
[self addSubview:_rootView]; |
|
} |
|
} |
|
else { |
|
[_rootView removeFromSuperview]; |
|
} |
|
} |
|
|
|
@end
|
|
|