Skip to content

Commit

Permalink
1.0.1 - Add refreshing check so when the user presses
Browse files Browse the repository at this point in the history
a cell, it doesn't load information and possibly
causes the app to crash.

Fix character roles for the character section in the
staff detail.
  • Loading branch information
香風智乃 authored and 香風智乃 committed Oct 25, 2018
1 parent af61ccb commit ac77879
Show file tree
Hide file tree
Showing 7 changed files with 185 additions and 151 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ + (NSDictionary *)AniListPersontoAtarashii:(NSDictionary *)person {
vaobj.characterid = ((NSNumber *)characterrole[@"node"][@"id"]).intValue;
vaobj.name = characterrole[@"node"][@"name"][@"last"] != [NSNull null] && ((NSString *)characterrole[@"node"][@"name"][@"last"]).length > 0 ? [NSString stringWithFormat:@"%@, %@",characterrole[@"node"][@"name"][@"last"],characterrole[@"node"][@"name"][@"first"]] : characterrole[@"node"][@"name"][@"first"];
vaobj.image_url = characterrole[@"node"][@"image"] != [NSNull null] && characterrole[@"node"][@"image"][@"large"] ? characterrole[@"node"][@"image"][@"large"] : @"";
vaobj.main_role = [(NSString *)characterrole[@"role"] isEqualToString:@"MAIN"];
for (NSDictionary *anime in characterrole[@"media"]) {
vaobj.anime = @{@"id" : anime[@"id"], @"title" : anime[@"title"][@"romaji"]};
[characterroles addObject:vaobj.NSDictionaryRepresentation];
Expand Down Expand Up @@ -469,7 +470,7 @@ + (NSDictionary *)AniListCharactertoAtarashii:(NSDictionary *)person {
for (NSDictionary *va in media[@"voiceActors"]) {
@autoreleasepool {
if ([voiceactors filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"id == %@", va[@"id"]]].count == 0) {
[voiceactors addObject:@{@"id" : va[@"id"], @"name" : va[@"name"][@"last"] != [NSNull null] ? [NSString stringWithFormat:@"%@, %@", va[@"name"][@"last"], va[@"name"][@"first"]] : va[@"name"][@"first"], @"image" : va[@"image"] != [NSNull null] && va[@"image"][@"medium"] ? va[@"image"][@"medium"] : @"" , @"language" : ((NSString *)va[@"language"]).lowercaseString.capitalizedString}];
[voiceactors addObject:@{@"id" : va[@"id"], @"name" : va[@"name"][@"last"] != [NSNull null] && ((NSString *)va[@"name"][@"last"]).length > 0 ? [NSString stringWithFormat:@"%@, %@",va[@"name"][@"last"],va[@"name"][@"first"]] : va[@"name"][@"first"], @"image" : va[@"image"] != [NSNull null] && va[@"image"][@"medium"] ? va[@"image"][@"medium"] : @"" , @"language" : ((NSString *)va[@"language"]).lowercaseString.capitalizedString}];
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Shukofukurou-IOS/Backend/Constants/AniListConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ @implementation AniListConstants
NSString *const kAnilistUserProfileByUsername = @"query ($name: String) {\n User (name: $name) {\n id\n name\n about # (asHtml: true)\n donatorTier\n isFollowing\n mediaListOptions {\n scoreFormat\n }\n avatar {\n large\n medium\n }\n updatedAt\n }\n}";
NSString *const kAniListSeason = @"query ($season: MediaSeason, $seasonYear: Int, $page: Int) {\n Page (page : $page) {\n media(season: $season, seasonYear: $seasonYear, type: ANIME) {\n id\n idMal\n isAdult\n coverImage {\n large\n medium\n }\n title {\n romaji\n english\n native\n userPreferred\n }\n format\n }\n pageInfo {\n total\n currentPage\n lastPage\n hasNextPage\n perPage\n }\n }\n}";
NSString *const kAniListAiring = @"query ($page: Int) {\n Page (page : $page) {\n media(status: RELEASING, type: ANIME) {\n id\n idMal\n isAdult\n title {\n romaji\n english\n native\n userPreferred\n }\n episodes\n format\n meanScore\n description\n coverImage {\n large\n medium\n }\n nextAiringEpisode {\n id\n airingAt\n }\n }\n pageInfo {\n total\n currentPage\n lastPage\n hasNextPage\n perPage\n }\n }\n}";
NSString *const kAnilistRetrieveListTitleIdsOnly = @"query ($id : Int!, $page: Int, $type : MediaType) {\n List: Page (page: $page) {\n mediaList(userId: $id, type: $type) {\n id :media{id, idMal}\n }\n pageInfo {\n total\n currentPage\n lastPage\n hasNextPage\n perPage\n }\n }\n}";
NSString *const kAnilistCharacterSearch = @"query ($query : String) {\n Page(perPage: 50) {\n characters(search: $query) {\n id\n name {\n first\n last\n native\n }\n image {\n large\n medium\n }\n }\n } \n}";
NSString *const kAniListStaffSearch = @"query ($query: String) {\n Page(perPage: 50) {\n staff(search: $query) {\n id\n name {\n first\n last\n native\n }\n image {\n large\n medium\n }\n }\n }\n}";
#pragma mark mutations
NSString *const kAnilistAddAnimeListEntry = @"mutation ($mediaid : Int, $progress : Int, $status : MediaListStatus, $score : Int) {\n SaveMediaListEntry(mediaId: $mediaid, progress: $progress, status: $status, scoreRaw: $score) {\n id\n progress\n status\n score(format: POINT_100)\n }\n}";
NSString *const kAnilistAddMangaListEntry = @"mutation ($mediaid : Int, $progress : Int, $progressVolumes : Int, $status : MediaListStatus, $score : Int) {\n SaveMediaListEntry(mediaId: $mediaid, progress: $progress, progressVolumes: $progressVolumes,status: $status, scoreRaw: $score) {\n id\n progress\n progressVolumes\n status\n score(format: POINT_100)\n }\n}";
Expand All @@ -36,7 +39,4 @@ @implementation AniListConstants
NSString *const kAnilistUpdateMangaListEntryAdvanced = @"mutation ($id : Int, $progress : Int, $progressVolumes : Int, $status : MediaListStatus, $score : Int, $notes : String, $private : Boolean, $startedAt : FuzzyDateInput, $completedAt : FuzzyDateInput, $reconsumeCount : Int) {\n SaveMediaListEntry(id: $id, progress: $progress, progressVolumes: $progressVolumes, status: $status, scoreRaw: $score, notes: $notes, private: $private, startedAt: $startedAt, completedAt: $completedAt, repeat: $reconsumeCount) {\n id\n progress\n progressVolumes\n status\n score(format: POINT_100)\n notes\n private\n startedAt {\n year\n month\n day\n }\n completedAt {\n year\n month\n day\n }\n }\n}";
NSString *const kAnilistDeleteListEntry = @"mutation ($id : Int) {\n DeleteMediaListEntry (id: $id) {\n deleted\n }\n}";
NSString *const kAnilistModifyCustomLists = @"mutation ($id : Int, $custom_lists : [String] ) {\n SaveMediaListEntry(id: $id, customLists : $custom_lists) {\n id\n customLists(asArray:true)\n }\n}";
NSString *const kAnilistRetrieveListTitleIdsOnly = @"query ($id : Int!, $page: Int, $type : MediaType) {\n List: Page (page: $page) {\n mediaList(userId: $id, type: $type) {\n id :media{id, idMal}\n }\n pageInfo {\n total\n currentPage\n lastPage\n hasNextPage\n perPage\n }\n }\n}";
NSString *const kAnilistCharacterSearch = @"query ($query : String) {\n Page(perPage: 50) {\n characters(search: $query) {\n id\n name {\n first\n last\n native\n }\n image {\n large\n medium\n }\n }\n } \n}";
NSString *const kAniListStaffSearch = @"query ($query: String) {\n Page(perPage: 50) {\n staff(search: $query) {\n id\n name {\n first\n last\n native\n }\n image {\n large\n medium\n }\n }\n }\n}";
@end
4 changes: 2 additions & 2 deletions Shukofukurou-IOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.1</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>20181024</string>
<string>20181025</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIBackgroundModes</key>
Expand Down
41 changes: 23 additions & 18 deletions Shukofukurou-IOS/View Controllers/AiringViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -119,24 +119,29 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSDictionary *entry = _airinglist[indexPath.row];
switch ([listservice getCurrentServiceID]) {
case 1:
if (entry[@"idMal"] != [NSNull null]) {
[self showTitleView:((NSNumber *)entry[@"idMal"]).intValue];
}
break;
case 2:
if (entry[@"idMal"] != [NSNull null]) {
[TitleIdConverter getKitsuIDFromMALId:((NSNumber *)entry[@"idMal"]).intValue withTitle:entry[@"title"] titletype:entry[@"type"] withType:0 completionHandler:^(int kitsuid) {
[self showTitleView:kitsuid];
} error:^(NSError *error) {
}];
}
break;
case 3:
[self showTitleView:((NSNumber *)entry[@"id"]).intValue];
break;
if (!self.tableView.refreshControl.refreshing) {
NSDictionary *entry = _airinglist[indexPath.row];
switch ([listservice getCurrentServiceID]) {
case 1:
if (entry[@"idMal"] != [NSNull null]) {
[self showTitleView:((NSNumber *)entry[@"idMal"]).intValue];
}
break;
case 2:
if (entry[@"idMal"] != [NSNull null]) {
[TitleIdConverter getKitsuIDFromMALId:((NSNumber *)entry[@"idMal"]).intValue withTitle:entry[@"title"] titletype:entry[@"type"] withType:0 completionHandler:^(int kitsuid) {
[self showTitleView:kitsuid];
} error:^(NSError *error) {
}];
}
break;
case 3:
[self showTitleView:((NSNumber *)entry[@"id"]).intValue];
break;
}
}
else {
[[tableView cellForRowAtIndexPath:indexPath] setSelected:NO animated:NO];
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,14 @@ - (void)populateCharacterData:(NSDictionary *)data {
}
});
if (data[@"description"]) {
[detailsArray addObject:@{@"title" : @"Details", @"value" : data[@"description"], @"type" : @"longdetail"}];
if (((NSString *)data[@"description"]).length > 0) {
[detailsArray addObject:@{@"title" : @"Details", @"value" : data[@"description"], @"type" : @"longdetail"}];
}
}
else {
[detailsArray addObject:@{@"title" : @"Details", @"value" : data[@"more_details"], @"type" : @"longdetail"}];
if (((NSString *)data[@"more_details"]).length > 0) {
[detailsArray addObject:@{@"title" : @"Details", @"value" : data[@"more_details"], @"type" : @"longdetail"}];
}
}
if (data[@"favorited_count"] && ((NSNumber *)data[@"favorited_count"]).intValue > 0) {
[detailsArray addObject:@{@"title" : @"Favorited", @"value" : ((NSNumber *)data[@"favorited_count"]).stringValue, @"type" : @"detail"}];
Expand Down
Loading

0 comments on commit ac77879

Please sign in to comment.