Skip to content

Commit

Permalink
[TIMOB-13066] Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pec1985 committed Nov 19, 2013
1 parent 269359b commit 600bad5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 33 deletions.
4 changes: 1 addition & 3 deletions iphone/Classes/TiUIDashboardView.h
Expand Up @@ -13,13 +13,11 @@

@private
LauncherView *launcher;
NSMutableArray *allItems;

}

-(LauncherView*)launcher;
-(void)setViewData:(NSArray*)data;
-(NSArray *)allItems;
-(void)setViewData_:(NSArray*)data;
@end


Expand Down
15 changes: 1 addition & 14 deletions iphone/Classes/TiUIDashboardView.m
Expand Up @@ -28,7 +28,6 @@ -(void)dealloc
[launcher endEditing];
}
RELEASE_TO_NIL(launcher);
RELEASE_TO_NIL(allItems);
[super dealloc];
}

Expand Down Expand Up @@ -73,22 +72,10 @@ -(void)setEditable_:(id)args
[[self proxy] replaceValue:args forKey:@"editable" notification:NO];
}

-(NSArray *)allItems
{
return allItems;
}

-(void)setViewData:(id)args
-(void)setViewData_:(id)args
{
[self launcher];

if(allItems == nil) {
allItems = [[NSMutableArray alloc] initWithArray:args];
} else {
[allItems removeAllObjects];
[allItems addObjectsFromArray:args];
}

NSArray* items = [launcher launcheritems_];
for (LauncherItem* item in items) {
[launcher removeItem:item animated:NO];
Expand Down
18 changes: 2 additions & 16 deletions iphone/Classes/TiUIDashboardViewProxy.m
Expand Up @@ -79,29 +79,15 @@ -(void)fireEvent:(NSString*)type withObject:(id)obj propagate:(BOOL)propagate re
[super fireEvent:type withObject:obj propagate:propagate reportSuccess:report errorCode:code message:message];
}

-(void)windowWillOpen
{
[super windowWillOpen];

TiUIDashboardView *v = (TiUIDashboardView*)[self view];

NSArray *data = [self valueForUndefinedKey:@"data"];
NSArray *items = [v allItems];

if(data != nil && (items == nil || [items count] == 0)) {
[self makeViewPerformSelector:@selector(setViewData:) withObject:data createIfNeeded:YES waitUntilDone:YES];
}
}

-(void)setData:(id)data
{
for (TiViewProxy* proxy in data) {
ENSURE_TYPE(proxy, TiUIDashboardItemProxy)
[self rememberProxy:proxy];
}

[self setValue:data forUndefinedKey:@"data"];
[self makeViewPerformSelector:@selector(setViewData:) withObject:data createIfNeeded:YES waitUntilDone:YES];
[self replaceValue:data forKey:@"data" notification:NO];
[self replaceValue:data forKey:@"viewData" notification:YES];
}

@end
Expand Down

0 comments on commit 600bad5

Please sign in to comment.