Skip to content

Commit

Permalink
[React Kit] Remove embarrassing TODOs
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Akers committed Mar 26, 2015
1 parent bdd1705 commit 7a97043
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 29 deletions.
2 changes: 0 additions & 2 deletions Libraries/Image/RCTImageDownloader.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#import "RCTCache.h"
#import "RCTUtils.h"

// TODO: something a bit more sophisticated

typedef void (^RCTCachedDataDownloadBlock)(BOOL cached, NSData *data, NSError *error);

@implementation RCTImageDownloader
Expand Down
1 change: 0 additions & 1 deletion Libraries/Text/RCTShadowText.m
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ - (void)_setParagraphStyleOnAttributedString:(NSMutableAttributedString *)attrib
}
}];

// TODO: umm, these can't be null, so we're mapping left to natural - is that right?
self.textAlign = _textAlign ?: NSTextAlignmentNatural;
self.writingDirection = _writingDirection ?: NSWritingDirectionNatural;

Expand Down
15 changes: 0 additions & 15 deletions Libraries/Text/RCTTextManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,24 +72,10 @@ - (RCTShadowView *)shadowView
view.truncationMode = truncationMode;
}

- (RCTViewManagerUIBlock)uiBlockToAmendWithShadowView:(RCTShadowText *)shadowView
{
//TODO: This could be a cleaner replacement for uiBlockToAmendWithShadowViewRegistry
return nil;
}

// TODO: the purpose of this block is effectively just to copy properties from the shadow views
// to their equivalent UIViews. In this case, the property being copied is the attributed text,
// but the same principle could be used to copy any property. The implementation is really ugly tho
// because the RCTViewManager doesn't retain a reference to the views that it manages, so it basically
// has to search the entire view hierarchy for relevant views. Not awesome. This seems like something
// where we could introduce a generic solution - perhaps a method on RCTShadowView that is called after
// layout to copy its properties across?
- (RCTViewManagerUIBlock)uiBlockToAmendWithShadowViewRegistry:(RCTSparseArray *)shadowViewRegistry
{
NSMutableArray *uiBlocks = [NSMutableArray new];

// TODO: are modules global, or specific to a given rootView?
for (RCTShadowView *rootView in shadowViewRegistry.allObjects) {
if (![rootView isReactRootView]) {
// This isn't a root view
Expand All @@ -101,7 +87,6 @@ - (RCTViewManagerUIBlock)uiBlockToAmendWithShadowViewRegistry:(RCTSparseArray *)
continue;
}

// TODO: this is a slightly weird way to do this - a recursive approach would be cleaner
RCTSparseArray *reactTaggedAttributedStrings = [[RCTSparseArray alloc] init];
NSMutableArray *queue = [NSMutableArray arrayWithObject:rootView];
for (NSInteger i = 0; i < [queue count]; i++) {
Expand Down
1 change: 0 additions & 1 deletion React/Base/RCTBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,6 @@ - (void)invalidate
// Wait for queued methods to finish
dispatch_sync(self.shadowQueue, ^{
// Make sure all dispatchers have been executed before continuing
// TODO: is this still needed?
});

// Invalidate modules
Expand Down
6 changes: 2 additions & 4 deletions React/Base/RCTInvalidating.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@

#import <Foundation/Foundation.h>

// TODO (#5906496): is there a reason for this protocol? It seems to be
// used in a number of places where it isn't really required - only the
// RCTBridge actually ever calls casts to it - in all other
// cases it is simply a way of adding some method definitions to classes
// TODO (#5906496): This protocol is only used to add method definitions to
// classes. We should decide if it's actually necessary.

@protocol RCTInvalidating <NSObject>

Expand Down
2 changes: 1 addition & 1 deletion React/Base/RCTLog.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void RCTInjectLogFunction(void (^logFunction)(NSString *msg)) {
return [NSString stringWithFormat:@"[RCTLog][tid:%@][%@:%d]>", threadName, fileName, lineNumber];
}

// TODO (#5906496): // kinda ugly that this is tied to RCTBridge
// TODO (#5906496): Does this need to be tied to RCTBridge?
NSString *RCTLogObjects(NSArray *objects, NSString *level)
{
NSString *str = objects[0];
Expand Down
2 changes: 1 addition & 1 deletion React/Executors/RCTContextExecutor.m
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ + (void)runRunLoopThread

// run the run loop
while (kCFRunLoopRunStopped != CFRunLoopRunInMode(kCFRunLoopDefaultMode, [[NSDate distantFuture] timeIntervalSinceReferenceDate], NO)) {
RCTAssert(NO, @"not reached assertion"); // runloop spun. that's bad.
RCTAssert(NO, @"not reached assertion"); // runloop spun. that's bad.
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions React/Modules/RCTUIManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -1356,10 +1356,6 @@ - (void)startOrResetInteractionTiming
}];
}

// TODO: remove horrible hack - this is only here so that
// [rootView endAndResetInteractionTiming] below doesn't raise warnings
- (NSDictionary *)endAndResetInteractionTiming { return nil; }

- (void)endAndResetInteractionTiming:(RCTResponseSenderBlock)onSuccess
onError:(RCTResponseSenderBlock)onError
{
Expand Down

0 comments on commit 7a97043

Please sign in to comment.