Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复部分问题 #6

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
  •  
  •  
  •  
2,180 changes: 1,136 additions & 1,044 deletions oschina.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Binary file modified oschina/.DS_Store
Binary file not shown.
2 changes: 0 additions & 2 deletions oschina/ActivesView.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@

#import <UIKit/UIKit.h>
#import "NewsDetail.h"
#import "PostDetail.h"
#import "Activity.h"
//#import "ColorActiveCell.h"
#import "FTCoreTextView.h"
#import "ShareView.h"
#import "News.h"
#import "Post.h"
Expand Down
55 changes: 28 additions & 27 deletions oschina/ActivesView.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#import "ActivesView.h"
#import "MessageSystemView.h"

// FIXME: appImageDidLoad not implement
@implementation ActivesView
@synthesize tableActivies;
//@synthesize imageDownloadsInProgress;
Expand Down Expand Up @@ -30,7 +31,7 @@ - (void)viewDidLoad

// self.imageDownloadsInProgress = [NSMutableDictionary dictionary];
// self.tweetDownloadsInProgress = [NSMutableDictionary dictionary];

activies = [[NSMutableArray alloc] initWithCapacity:20];
//下拉刷新
if (_refreshHeaderView == nil) {
Expand All @@ -39,12 +40,12 @@ - (void)viewDidLoad
[self.tableActivies addSubview:view];
_refreshHeaderView = view;
}
[_refreshHeaderView refreshLastUpdatedDate];
[_refreshHeaderView refreshLastUpdatedDate];

self.tableActivies.backgroundColor = [Tool getBackgroundColor];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshed:) name:Notification_TabClick object:nil];

_iconCache = [[TQImageCache alloc] initWithCachePath:@"icons" andMaxMemoryCacheNumber:50];
}
- (void)refreshed:(NSNotification *)notification
Expand Down Expand Up @@ -120,18 +121,18 @@ - (void)reload:(BOOL)noRefresh
}
int pageIndex = allCount / 20;
NSString *url = [NSString stringWithFormat:@"%@?catalog=%d&pageIndex=%d&pageSize=%d&uid=%d",api_active_list,self.catalog,pageIndex,20,[Config Instance].getUID];

[[AFOSCClient sharedClient] getPath:url parameters:nil
success:^(AFHTTPRequestOperation *operation, id responseObject) {

if (!noRefresh) {
[self clear];
}
[Tool getOSCNotice2:operation.responseString];
isLoading = NO;
NSString *response = operation.responseString;
@try {

TBXML *xml = [[TBXML alloc] initWithXMLString:response error:nil];
int count = [Tool isListOver2:operation.responseString];
allCount += count;
Expand All @@ -141,18 +142,18 @@ - (void)reload:(BOOL)noRefresh
TBXMLElement *root = xml.rootXMLElement;
TBXMLElement *activelist = [TBXML childElementNamed:@"activies" parentElement:root];
if (activelist == nil) {

//检测是否未登录
ApiError *error = [Tool getApiError2:operation.responseString];
if (error == nil) {
[Tool ToastNotification:operation.responseString andView:self.view andLoading:NO andIsBottom:NO];
}
if (error.errorCode == 0) {
NSLog(error.errorMessage);
NSLog(@"%@", error.errorMessage);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"错误" message:@"用户未登录,需要重新登录" delegate:self cancelButtonTitle:@"返回" otherButtonTitles:@"登录", nil];
[alert show];
}

return;
}
TBXMLElement *first = [TBXML childElementNamed:@"active" parentElement:activelist];
Expand Down Expand Up @@ -185,10 +186,10 @@ - (void)reload:(BOOL)noRefresh
objectbody = [TBXML childElementNamed:@"objectbody" parentElement:objectReply];
reply = [[ObjectReply alloc] initWithParameter:[TBXML textForElement:objectname] andBody:[TBXML textForElement:objectbody]];
}

TBXMLElement *appClient = [TBXML childElementNamed:@"appclient" parentElement:first];
TBXMLElement *tweetImage = [TBXML childElementNamed:@"tweetimage" parentElement:first];

Activity *a = [[Activity alloc] initWithParameters:[[TBXML textForElement:_id] intValue] andImg:[TBXML textForElement:portrait] andAuthor:[TBXML textForElement:author] andAuthorID:[[TBXML textForElement:authorid] intValue] andCatalog:[[TBXML textForElement:_catalog] intValue] andObjectid:[[TBXML textForElement:objectID] intValue] andMessage:[TBXML textForElement:message] andPubDate:appClient ? [NSString stringWithFormat:@"%@ %@",[Tool intervalSinceNow:[TBXML textForElement:pubDate]],[Tool getAppClientString:[[TBXML textForElement:appClient] intValue]]]:[Tool intervalSinceNow:[TBXML textForElement:pubDate]] andCommentCount:[[TBXML textForElement:commentCount] intValue] andObjectType:[[TBXML textForElement:objectType] intValue] andObjectCatalog:[[TBXML textForElement:objectCatalog] intValue] andObjectTitle:[TBXML textForElement:objectTitle] andForUserView:NO andReply:reply andImgTweet:[TBXML textForElement:tweetImage] andUrl:[TBXML textForElement:url]];
if (![Tool isRepeatActive: activies andActive:a]) {
[newActivies addObject:a];
Expand Down Expand Up @@ -218,7 +219,7 @@ - (void)reload:(BOOL)noRefresh
objectbody = [TBXML childElementNamed:@"objectbody" parentElement:objectReply];
reply = [[ObjectReply alloc] initWithParameter:[TBXML textForElement:objectname] andBody:[TBXML textForElement:objectbody]];
}

appClient = nil;
appClient = [TBXML childElementNamed:@"appclient" parentElement:first];
tweetImage = [TBXML childElementNamed:@"tweetimage" parentElement:first];
Expand All @@ -235,19 +236,19 @@ - (void)reload:(BOOL)noRefresh
[activies addObjectsFromArray:newActivies];
[self.tableActivies reloadData];
[self doneLoadingTableViewData];

}
@catch (NSException *exception) {
[NdUncaughtExceptionHandler TakeException:exception];
}
@finally {
[self doneLoadingTableViewData];
}

} failure:^(AFHTTPRequestOperation *operation, NSError *error) {

NSLog(@"动态列表获取出错");

//刷新错误
[self doneLoadingTableViewData];
isLoading = NO;
Expand All @@ -259,7 +260,7 @@ - (void)reload:(BOOL)noRefresh
[Tool ToastNotification:@"错误 网络无连接" andView:self.view andLoading:NO andIsBottom:NO];
}
}];

isLoading = YES;
[self.tableActivies reloadData];
}
Expand Down Expand Up @@ -340,14 +341,14 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
{
cell.imgTweet.hidden = YES;
}

if ([cell.imgPortrait.gestureRecognizers count] > 0) {
UITap *tap = (UITap *)[cell.imgPortrait.gestureRecognizers objectAtIndex:0];
if (tap) {
tap.tag = a.authorid;
}
}

[cell.rtLabel setText:a.result];
if (a.catalog >=1 && a.catalog <= 4) {
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
Expand All @@ -371,8 +372,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
// if (imageData) {
// a.imgData = [UIImage imageWithData:imageData];
// cell.imgPortrait = a.imgData;
// }
// else
// }
// else
// {
//// IconDownloader *downloader = [imageDownloadsInProgress objectForKey:[NSString stringWithFormat:@"%d", indexPath.row]];
//// if (downloader == nil) {
Expand Down Expand Up @@ -513,9 +514,9 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
{
[Tool analysis:a.url andNavController:self.parentViewController.navigationController];
}

}

}
#pragma 下提刷新
- (void)reloadTableViewDataSource
Expand Down Expand Up @@ -602,15 +603,15 @@ - (void)refresh
// if (iconDownloader) {
// a.imgData = iconDownloader.imgRecord.img;
// }
//
//
// IconDownloader *iconTweet = [tweetDownloadsInProgress objectForKey:index];
// if (iconTweet) {
// a.imgTweetData = iconTweet.imgRecord.img;
// }
// // cache it
// NSData * imageData = UIImagePNGRepresentation(a.imgData);
// [_iconCache putImage:imageData withName:[TQImageCache parseUrlForCacheName:a.img]];
//
//
// [tableActivies reloadData];
// }
//}
Expand Down
1 change: 0 additions & 1 deletion oschina/Activity.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#import <Foundation/Foundation.h>
#import "Tool.h"
#import "ObjectReply.h"
#import "FTCoreTextView.h"
#import "RTLabel.h"
#import "RTActiveCell.h"

Expand Down
Binary file removed oschina/Categories/.DS_Store
Binary file not shown.
Binary file removed oschina/Classes/.DS_Store
Binary file not shown.
Loading