Skip to content

Commit

Permalink
1.1.3 - Fix crash with air notifications if the
Browse files Browse the repository at this point in the history
anilist id is unavailable (nil), to prevent a
nil value in dictionary crash.
  • Loading branch information
香風智乃 authored and 香風智乃 committed Jan 20, 2019
1 parent 02c9103 commit c0d4031
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 12 additions & 1 deletion Shukofukurou-IOS/Backend/AiringNotificationManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ - (void)performNewNotificationCheck:(NSArray *)notificationList withPosition:(in
}
AFHTTPSessionManager *sessionmanager = [Utility jsonmanager];
__block NSManagedObjectContext *notifyobj = notificationList[position];
if ([notifyobj valueForKey:@"nextairdate"] != [NSNull null]) {
if ([notifyobj valueForKey:@"nextairdate"] != [NSNull null] && [notifyobj valueForKey:@"nextairdate"]) {
if ([(NSDate *)[notifyobj valueForKey:@"nextairdate"] timeIntervalSinceNow] > 0) {
if (notificationList.count == position+1) {
[self setNotifications];
Expand All @@ -174,6 +174,17 @@ - (void)performNewNotificationCheck:(NSArray *)notificationList withPosition:(in
return;
}
}
if ([notifyobj valueForKey:@"anilistid"] == [NSNull null] || ![notifyobj valueForKey:@"anilistid"]) {
if (notificationList.count == position+1) {
[self setNotifications];
completionHandler(true);
}
else {
int newPosition = position + 1;
[self performNewNotificationCheck:notificationList withPosition:newPosition completionHandler:completionHandler];
}
return;
}
NSDictionary *parameters = @{@"query" : kAniListNextEpisode, @"variables" : @{@"id": (NSNumber *)[notifyobj valueForKey:@"anilistid"]}};
[sessionmanager POST:@"https://graphql.anilist.co/" parameters:parameters progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
[self.managedObjectContext performBlockAndWait:^{
Expand Down
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.1.2</string>
<string>1.1.3</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>20181221</string>
<string>20190120</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIBackgroundModes</key>
Expand Down

0 comments on commit c0d4031

Please sign in to comment.