Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Correct API version check to support major versions >13 #738

Merged
merged 2 commits into from
Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Kodi Remote.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
C703692927148CEF0049F9BF /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C703692827148CEF0049F9BF /* StoreKit.framework */; };
C718444625FFD06400F5A060 /* SafariServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C718444525FFD06300F5A060 /* SafariServices.framework */; };
C7478BF9257258E700161C1E /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C7478BF8257258E700161C1E /* Launch Screen.storyboard */; };
C78C30F528F877870055CD95 /* VersionCheck.m in Sources */ = {isa = PBXBuildFile; fileRef = C78C30F428F877870055CD95 /* VersionCheck.m */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -291,6 +292,8 @@
C7478BF8257258E700161C1E /* Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
C7868BB627491FB7001B35B6 /* en-US */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "en-US"; path = "en-US.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
C7868BB727491FB7001B35B6 /* en-US */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "en-US"; path = "en-US.lproj/Localizable.strings"; sourceTree = "<group>"; };
C78C30F428F877870055CD95 /* VersionCheck.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VersionCheck.m; sourceTree = "<group>"; };
C78C30F628F8779A0055CD95 /* VersionCheck.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VersionCheck.h; sourceTree = "<group>"; };
C7A030F128B60DB200B27764 /* ca-ES */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "ca-ES"; path = "ca-ES.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
C7A030F228B60DB200B27764 /* ca-ES */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "ca-ES"; path = "ca-ES.lproj/Localizable.strings"; sourceTree = "<group>"; };
C7A030F328B60EB900B27764 /* es-MX */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-MX"; path = "es-MX.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -518,6 +521,8 @@
0FB133A9165EC1E5003756C1 /* tcpJSONRPC.m */,
0FEA79FA165FBBEC00BB281F /* XBMCVirtualKeyboard.h */,
0FEA79FB165FBBEC00BB281F /* XBMCVirtualKeyboard.m */,
C78C30F628F8779A0055CD95 /* VersionCheck.h */,
C78C30F428F877870055CD95 /* VersionCheck.m */,
0F90904316E53C580021EFA9 /* Utilities.h */,
0F90904416E53C580021EFA9 /* Utilities.m */,
0F4019AE18F3ECEB0064E4DC /* customButton.h */,
Expand Down Expand Up @@ -820,6 +825,7 @@
0F32092816FE181300636BA2 /* SDWebImageDecoder.m in Sources */,
0F32092916FE181300636BA2 /* SDWebImageDownloader.m in Sources */,
0F32092A16FE181300636BA2 /* SDWebImageDownloaderOperation.m in Sources */,
C78C30F528F877870055CD95 /* VersionCheck.m in Sources */,
0F32092B16FE181300636BA2 /* SDWebImageManager.m in Sources */,
0F4019B318F415A50064E4DC /* MessagesView.m in Sources */,
0F32092C16FE181300636BA2 /* SDWebImagePrefetcher.m in Sources */,
Expand Down
11 changes: 5 additions & 6 deletions XBMC Remote/DetailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#import "ProgressPieView.h"
#import "SettingsValuesViewController.h"
#import "customButton.h"
#import "VersionCheck.h"

@interface DetailViewController ()
- (void)configureView;
Expand Down Expand Up @@ -3997,9 +3998,8 @@ - (void)addQueue:(NSDictionary*)item indexPath:(NSIndexPath*)indexPath afterCurr
if ([item[@"filetype"] isEqualToString:@"directory"]) {
key = @"directory";
}
// Since API 12.7.0 Kodi server can handle Playlist.Insert and Playlist.Add for recordingid.
// Before, the JSON parameters must use the file path.
else if (!(AppDelegate.instance.APImajorVersion >= 12 && AppDelegate.instance.APIminorVersion >= 7) && [mainFields[@"row9"] isEqualToString:@"recordingid"]) {
// If Playlist.Insert and Playlist.Add for recordingid is not supported, use file path.
else if (![VersionCheck hasRecordingIdPlaylistSupport] && [mainFields[@"row9"] isEqualToString:@"recordingid"]) {
key = @"file";
value = item[@"file"];
}
Expand Down Expand Up @@ -4112,9 +4112,8 @@ - (void)addPlayback:(NSDictionary*)item indexPath:(NSIndexPath*)indexPath positi
if ([item[@"filetype"] isEqualToString:@"directory"]) {
key = @"directory";
}
// Since API 12.7.0 Kodi server can handle Playlist.Insert and Playlist.Add for recordingid.
// Before, the JSON parameters must use the file path.
else if (!(AppDelegate.instance.APImajorVersion >= 12 && AppDelegate.instance.APIminorVersion >= 7) && [mainFields[@"row8"] isEqualToString:@"recordingid"]) {
// If Playlist.Insert and Playlist.Add for recordingid is not supported, use file path.
else if (![VersionCheck hasRecordingIdPlaylistSupport] && [mainFields[@"row8"] isEqualToString:@"recordingid"]) {
key = @"file";
value = item[@"file"];
}
Expand Down
11 changes: 5 additions & 6 deletions XBMC Remote/ShowInfoViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#import "StackScrollViewController.h"
#import "ActorCell.h"
#import "Utilities.h"
#import "VersionCheck.h"

#define PLAY_BUTTON_SIZE 20
#define TV_LOGO_SIZE_REC_DETAILS 72
Expand Down Expand Up @@ -1542,9 +1543,8 @@ - (void)addQueueAfterCurrent:(BOOL)afterCurrent {
NSDictionary *item = self.detailItem;
NSString *param = item[@"family"];
id value = item[item[@"family"]];
// Since API 12.7.0 Kodi server can handle Playlist.Insert and Playlist.Add for recordingid.
// Before, the JSON parameters must use the file path.
if (!(AppDelegate.instance.APImajorVersion >= 12 && AppDelegate.instance.APIminorVersion >= 7) && [self.detailItem[@"family"] isEqualToString:@"recordingid"]) {
// If Playlist.Insert and Playlist.Add for recordingid is not supported, use file path.
if (![VersionCheck hasRecordingIdPlaylistSupport] && [self.detailItem[@"family"] isEqualToString:@"recordingid"]) {
param = @"file";
value = item[@"file"];
}
Expand Down Expand Up @@ -1613,9 +1613,8 @@ - (void)addPlayback:(float)resumePointLocal {
if (error == nil && methodError == nil) {
NSString *param = item[@"family"];
id value = item[item[@"family"]];
// Since API 12.7.0 Kodi server can handle Playlist.Insert and Playlist.Add for recordingid.
// Before, the JSON parameters must use the file path.
if (!(AppDelegate.instance.APImajorVersion >= 12 && AppDelegate.instance.APIminorVersion >= 7) && [self.detailItem[@"family"] isEqualToString:@"recordingid"]) {
// If Playlist.Insert and Playlist.Add for recordingid is not supported, use file path.
if (![VersionCheck hasRecordingIdPlaylistSupport] && [self.detailItem[@"family"] isEqualToString:@"recordingid"]) {
param = @"file";
value = item[@"file"];
}
Expand Down
16 changes: 16 additions & 0 deletions XBMC Remote/VersionCheck.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// VersionCheck.h
// Kodi Remote
//
// Created by Andree Buschmann on 13.10.22.
// Copyright © 2022 Team Kodi. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AppDelegate.h"

@interface VersionCheck : NSObject

+ (BOOL)hasRecordingIdPlaylistSupport;

@end
20 changes: 20 additions & 0 deletions XBMC Remote/VersionCheck.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// VersionCheck.m
// Kodi Remote
//
// Created by Andree Buschmann on 13.10.22.
// Copyright © 2022 Team Kodi. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AppDelegate.h"
#import "VersionCheck.h"

@implementation VersionCheck

+ (BOOL)hasRecordingIdPlaylistSupport {
// Since API 12.7.0 Kodi server can handle Playlist.Insert and Playlist.Add for recordingid.
return (AppDelegate.instance.APImajorVersion == 12 && AppDelegate.instance.APIminorVersion >= 7) || AppDelegate.instance.APImajorVersion > 12;
}

@end