include/OFChallengeToUser.h

Go to the documentation of this file.
00001 //  Copyright 2009-2010 Aurora Feint, Inc.
00002 // 
00003 //  Licensed under the Apache License, Version 2.0 (the "License");
00004 //  you may not use this file except in compliance with the License.
00005 //  You may obtain a copy of the License at
00006 //  
00007 //      http://www.apache.org/licenses/LICENSE-2.0
00008 //      
00009 //  Unless required by applicable law or agreed to in writing, software
00010 //  distributed under the License is distributed on an "AS IS" BASIS,
00011 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012 //  See the License for the specific language governing permissions and
00013 //  limitations under the License.
00014 
00015 #import "OFResource.h"
00016 #import "OFChallengeToUser.h"
00017 
00018 @class OFService;
00019 @class OFChallenge;
00020 @class OFUser;
00021 @class OFRequestHandle;
00022 
00023 @protocol OFChallengeToUserDelegate;
00024 
00025 enum OFChallengeResult {kChallengeIncomplete, kChallengeResultRecipientWon, kChallengeResultRecipientLost, kChallengeResultTie};
00026 
00033 @interface OFChallengeToUser : OFResource<OFCallbackable>
00034 {
00035 @private
00036     OFChallenge* challenge;
00037     OFUser*     recipient;
00038     OFChallengeResult result;
00039     NSString* resultDescription;
00040     NSUInteger attempts;
00041     BOOL isCompleted;
00042     BOOL hasBeenViewed;
00043     
00044     BOOL hasDecrementedChallengeCount;
00045 }
00046 
00053 + (void)setDelegate:(id<OFChallengeToUserDelegate>)delegate;
00054 
00062 + (OFChallengeToUser*)readFromFile:(NSString*)fileName;
00063 
00079 - (OFRequestHandle*)completeWithResult:(OFChallengeResult)challengeResult;
00080 
00091 - (OFRequestHandle*)reject;
00092  
00107  - (void)displayCompletionWithData:(NSData*)resultData
00108             reChallengeDescription:(NSString*)reChallengeDescription;
00109 
00116 - (void)writeToFile:(NSString*)fileName;
00117 
00121 @property (nonatomic, readonly) OFChallenge* challenge;
00122 
00126 @property (nonatomic, readonly) OFUser*     recipient;
00127 
00131 @property (nonatomic, assign)   OFChallengeResult   result;
00132 
00141 @property (nonatomic, retain)           NSString* resultDescription;
00142 
00147 @property (nonatomic, readonly)         NSString* formattedResultDescription;
00148 
00152 @property (nonatomic, readonly)         BOOL hasBeenViewed;
00153 
00157 @property (nonatomic, readonly)         NSUInteger attempts;
00158 
00162 + (NSString*)getChallengeResultIconName:(OFChallengeResult)result;
00163 + (NSString*)getResourceName;
00164 @property (nonatomic, assign)           BOOL hasDecrementedChallengeCount;
00165 @property (nonatomic, assign)           BOOL isCompleted;
00166 
00167 @end
00168 
00174 @protocol OFChallengeToUserDelegate
00175 @optional
00179 - (void)didCompleteChallenge:(OFChallengeToUser*)challengeToUser;
00180 
00184 - (void)didFailCompleteChallenge:(OFChallengeToUser*)challengeToUser;
00185 
00189 - (void)didRejectChallenge:(OFChallengeToUser*)challengeToUser;
00190 
00194 - (void)didFailRejectChallenge:(OFChallengeToUser*)challengeToUser;
00195 @end
00196 
00197 
00198 
00199 
00200 
00201 
00202 
 All Classes Files Functions Variables Enumerations Enumerator Properties