Permalink
Browse files

It's now easier to re-post a message that got cleared from the queue

  • Loading branch information...
1 parent b954149 commit 893eca99d18ebe6d86b140ce3b87593aad581328 @myell0w committed Nov 18, 2011
Showing with 16 additions and 0 deletions.
  1. +4 −0 MTStatusBarOverlay.h
  2. +12 −0 MTStatusBarOverlay.m
View
@@ -134,13 +134,17 @@ typedef enum MTMessageType {
- (void)addSubviewToBackgroundView:(UIView *)view;
- (void)addSubviewToBackgroundView:(UIView *)view atIndex:(NSInteger)index;
+// Method to re-post a cleared message
+- (void)postMessageDictionary:(NSDictionary *)messageDictionary;
+
// shows an activity indicator and the given message
- (void)postMessage:(NSString *)message;
- (void)postMessage:(NSString *)message duration:(NSTimeInterval)duration;
- (void)postMessage:(NSString *)message duration:(NSTimeInterval)duration animated:(BOOL)animated;
- (void)postMessage:(NSString *)message animated:(BOOL)animated;
// clears the message queue and shows this message instantly
- (void)postImmediateMessage:(NSString *)message animated:(BOOL)animated;
+- (void)postImmediateMessage:(NSString *)message duration:(NSTimeInterval)duration;
- (void)postImmediateMessage:(NSString *)message duration:(NSTimeInterval)duration animated:(BOOL)animated;
// shows a checkmark instead of the activity indicator and hides the status bar after the specified duration
View
@@ -514,6 +514,10 @@ - (void)postImmediateMessage:(NSString *)message animated:(BOOL)animated {
[self postImmediateMessage:message type:MTMessageTypeActivity duration:0 animated:animated];
}
+- (void)postImmediateMessage:(NSString *)message duration:(NSTimeInterval)duration {
+ [self postImmediateMessage:message type:MTMessageTypeActivity duration:duration animated:YES];
+}
+
- (void)postImmediateMessage:(NSString *)message duration:(NSTimeInterval)duration animated:(BOOL)animated {
[self postImmediateMessage:message type:MTMessageTypeActivity duration:duration animated:animated];
}
@@ -542,6 +546,14 @@ - (void)postImmediateErrorMessage:(NSString *)message duration:(NSTimeInterval)d
[self postImmediateMessage:message type:MTMessageTypeError duration:duration animated:animated];
}
+- (void)postMessageDictionary:(NSDictionary *)messageDictionary {
+ [self postMessage:[messageDictionary valueForKey:kMTStatusBarOverlayMessageKey]
+ type:[[messageDictionary valueForKey:kMTStatusBarOverlayMessageTypeKey] intValue]
+ duration:[[messageDictionary valueForKey:kMTStatusBarOverlayDurationKey] doubleValue]
+ animated:[[messageDictionary valueForKey:kMTStatusBarOverlayAnimationKey] boolValue]
+ immediate:[[messageDictionary valueForKey:kMTStatusBarOverlayImmediateKey] boolValue]];
+}
+
- (void)postMessage:(NSString *)message type:(MTMessageType)messageType duration:(NSTimeInterval)duration animated:(BOOL)animated immediate:(BOOL)immediate {
// don't add to queue when message is empty
if (message.length == 0) {

0 comments on commit 893eca9

Please sign in to comment.