Skip to content

Commit

Permalink
1.1.5 - Add Loading HUD when reviews are being
Browse files Browse the repository at this point in the history
loaded.
  • Loading branch information
香風智乃 authored and 香風智乃 committed Feb 4, 2019
1 parent 528a8cf commit 1e300d7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Shukofukurou-IOS/View Controllers/ReviewTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
#import "listservice.h"
#import "ReviewDetailViewController.h"
#import "ThemeManager.h"
#import "MBProgressHUD.h"

@interface ReviewTableViewController ()
@property int type;
@property int titleid;
@property (strong) NSMutableArray *reviews;
@property int nextPageOffset;
@property bool loadingReactions;
@property (strong) MBProgressHUD *hud;
@end

@implementation ReviewTableViewController
Expand Down Expand Up @@ -85,6 +87,7 @@ - (void)retrieveReviewsForTitleID:(int)titleid withType:(int)type {
}];
}
else {
[self showloadingview:YES];
[listservice retrieveReviewsForTitle:titleid withType:type completion:^(id responseObject) {
switch ([listservice getCurrentServiceID]) {
case 1:
Expand All @@ -98,8 +101,10 @@ - (void)retrieveReviewsForTitleID:(int)titleid withType:(int)type {
}
[self.tableView reloadData];
self.navigationItem.hidesBackButton = NO;
[self showloadingview:NO];
} error:^(NSError *error) {
NSLog(@"%@",error);
[self showloadingview:NO];
[self.navigationController popViewControllerAnimated:YES];
}];
}
Expand Down Expand Up @@ -181,4 +186,16 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
[reviewdetailvc viewDidLoad];
}

- (void)showloadingview:(bool)show {
if (show) {
_hud = [MBProgressHUD showHUDAddedTo:self.navigationController.view animated:YES];
_hud.label.text = @"Loading";
_hud.bezelView.blurEffectStyle = [NSUserDefaults.standardUserDefaults boolForKey:@"darkmode"] ? UIBlurEffectStyleDark : UIBlurEffectStyleLight;
_hud.contentColor = [ThemeManager sharedCurrentTheme].textColor;
}
else {
[_hud hideAnimated:YES];
}
}

@end

0 comments on commit 1e300d7

Please sign in to comment.