Skip to content

Commit

Permalink
Updated DGS.m to use the quick_do.php api where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
justinweiss committed Jul 14, 2012
1 parent 92e443f commit fe20a2a
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 1,909 deletions.
15 changes: 0 additions & 15 deletions Classes/Models/CachingGameServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,4 @@
// Closes the database connection. This should be called before the app closes.
+ (void)closeDatabase;

- (void)logout;
- (void)loginWithUsername:(NSString *)username password:(NSString *)password;

- (void)addGame:(NewGame *)game onSuccess:(void (^)())onSuccess;
- (void)getCurrentGames:(void (^)(NSArray *gameList))onSuccess;
- (void)getSgfForGame:(Game *)game onSuccess:(void (^)(Game *game))onSuccess;
- (void)getWaitingRoomGames:(void (^)(GameList *gameList))onSuccess;
- (void)getWaitingRoomGameDetailsForGame:(NewGame *)game onSuccess:(void (^)(NewGame *game))onSuccess;
- (void)joinWaitingRoomGame:(int)gameId comment:(NSString *)comment onSuccess:(void (^)())onSuccess;
- (void)deleteWaitingRoomGame:(int)gameId onSuccess:(void (^)())onSuccess;


- (void)playMove:(Move *)move lastMove:(Move *)lastMove moveNumber:(int)moveNumber comment:(NSString *)comment gameId:(int)gameId onSuccess:(void (^)())onSuccess;
- (void)playHandicapStones:(NSArray *)moves comment:(NSString *)comment gameId:(int)gameId onSuccess:(void (^)())onSuccess;
- (void)markDeadStones:(NSArray *)changedStones moveNumber:(int)moveNumber comment:(NSString *)comment gameId:(int)gameId onSuccess:(void (^)())onSuccess;
@end
21 changes: 2 additions & 19 deletions Classes/Models/DGS.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
#import "Game.h"
#import "NewGame.h"
#import "GameList.h"
#import "GameServerProtocol.h"

#ifndef LOGIC_TEST_MODE
#import "ASIHTTPRequest.h"

typedef void (^ASIHTTPRequestBlock)(ASIHTTPRequest *request, NSString *responseString);
#endif

@interface DGS : NSObject {
@interface DGS : NSObject <GameServerProtocol> {
id <LoginProtocol> delegate;
#ifndef LOGIC_TEST_MODE
UIAlertView *errorView;
Expand All @@ -35,22 +36,6 @@ typedef void (^ASIHTTPRequestBlock)(ASIHTTPRequest *request, NSString *responseS

@property(nonatomic, retain) UIAlertView *errorView;

- (void)logout;
- (void)loginWithUsername:(NSString *)username password:(NSString *)password;

- (void)addGame:(NewGame *)game onSuccess:(void (^)())onSuccess;
- (void)getCurrentGames:(void (^)(NSArray *gameList))onSuccess;
- (void)getSgfForGame:(Game *)game onSuccess:(void (^)(Game *game))onSuccess;
- (void)getWaitingRoomGames:(void (^)(GameList *gameList))onSuccess;
- (void)getWaitingRoomGameDetailsForGame:(NewGame *)game onSuccess:(void (^)(NewGame *game))onSuccess;
- (void)joinWaitingRoomGame:(int)gameId onSuccess:(void (^)())onSuccess;
- (void)deleteWaitingRoomGame:(int)gameId onSuccess:(void (^)())onSuccess;


- (void)playMove:(Move *)move lastMove:(Move *)lastMove moveNumber:(int)moveNumber comment:(NSString *)comment gameId:(int)gameId onSuccess:(void (^)())onSuccess;
- (void)playHandicapStones:(NSArray *)moves comment:(NSString *)comment gameId:(int)gameId onSuccess:(void (^)())onSuccess;
- (void)markDeadStones:(NSArray *)changedStones moveNumber:(int)moveNumber comment:(NSString *)comment gameId:(int)gameId onSuccess:(void (^)())onSuccess;

// Starts an asynchronous request, calling onSuccess when the request finishes.
- (void)performRequest:(ASIHTTPRequest *)request onSuccess:(ASIHTTPRequestBlock)onSuccess;

Expand All @@ -60,8 +45,6 @@ typedef void (^ASIHTTPRequestBlock)(ASIHTTPRequest *request, NSString *responseS

// Internal, but these have to be exposed so the logic tests can hit them
- (NSArray *)gamesFromCSV:(NSString *)csvData;
- (NSArray *)gamesFromTable:(NSData *)htmlData;
- (NSArray *)gamesFromWaitingRoomTable:(NSData *)htmlData;
- (NSString *)nextPagePath:(NSData *)htmlData;
- (NewGame *)gameFromWaitingRoomDetailTable:(NSData *)htmlData game:(NewGame *)game;
@end
Loading

0 comments on commit fe20a2a

Please sign in to comment.