Official-Kodi-Remote-iOS icon indicating copy to clipboard operation
Official-Kodi-Remote-iOS copied to clipboard

Kodi Remote Watchapp

Open integralpro opened this issue 6 years ago • 39 comments

I've been missing watchOS support and finally decided to implement it. It's written in swift and depend only on APIKit (https://github.com/ishkawa/APIKit). It can send rpc requests directly from watches or via iOS app.

The changes are more or less isolated. Folders "watchapp" and "watchapp Extensions" contain code running on watches. The code in "KodiAPI" is called from watchOS and iOS. Important changes are in "XBMC Remote/AppDelegate.m".

  • Before trying, run carthage update to setup dependencies.

I would be glad to see the watch support in the Official-Kodi-Remote-iOS app. If you decide to reuse the code you can just take it or; It will be my pleasure to make changes required to merge the code after the review.

Anyway let me know what do you think.

integralpro avatar Sep 18 '18 09:09 integralpro

You are simply amazing :) Thank you for your work!

I only ask you to have a little patience because in this moment I'm total full with work damn stuff :(

Again, well done at first glance!

joethefox avatar Sep 18 '18 09:09 joethefox

@integralpro Can you setup a TestFlight so that volunteers can test it? Please join: https://forum.kodi.tv/showthread.php?tid=335853

piejanssens avatar Sep 13 '19 07:09 piejanssens

Sure, I can try to do something next Monday. —Pavel

On Sep 13, 2019, at 12:44 AM, Pieter Janssens [email protected] wrote:

@integralpro https://github.com/integralpro Can you setup a TestFlight so that volunteers can test it? Please join: https://forum.kodi.tv/showthread.php?tid=335853 https://forum.kodi.tv/showthread.php?tid=335853 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xbmc/Official-Kodi-Remote-iOS/pull/91?email_source=notifications&email_token=AAJW2OUH5KEDSIMISXAS2NLQJNAFJA5CNFSM4FVWCDH2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6UH2IA#issuecomment-531135776, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJW2OQGJMLDD26LUXLQ2BTQJNAFJANCNFSM4FVWCDHQ.

integralpro avatar Sep 13 '19 07:09 integralpro

@integralpro are you still interested in the PR?

I haven't reviewed code yet, just a question out of interest: why did you decide to choose APIKit over Alamofire? :)

kambala-decapitator avatar Jan 05 '21 11:01 kambala-decapitator

@kambala-decapitator yes, it would be great if there will be some watch support. I still can work on that. APIKit was just the first thing I found.

integralpro avatar Jan 05 '21 17:01 integralpro

Please resolve conflicts then and test your changes with Xcode 12

kambala-decapitator avatar Jan 05 '21 18:01 kambala-decapitator

Yes, I will rebase and cleanup the code.

On Jan 5, 2021, at 11:00 AM, Andrey Filipenkov [email protected] wrote:

Please resolve conflicts then and test your changes with Xcode 12

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/xbmc/Official-Kodi-Remote-iOS/pull/91#issuecomment-754833786, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJW2OV7ODN7IDQCV4B3GKTSYNOUDANCNFSM4FVWCDHQ.

integralpro avatar Jan 05 '21 19:01 integralpro

@kambala-decapitator let me know if you have any comments/suggestions.

integralpro avatar Jan 11 '21 21:01 integralpro

thanks for updating! Will check in the next days. Please be aware that it won't make it into next update as our primary goal is to release a fixed version that works flawlessly on modern iOS.

This branch has conflicts that must be resolved

;)

kambala-decapitator avatar Jan 11 '21 21:01 kambala-decapitator

This branch has conflicts that must be resolved

;)

They will appear every time project.pbxproj is updated. Let me know when you finish the work related to a next release, I will fix any infrastructure conflicts.

integralpro avatar Jan 11 '21 21:01 integralpro

They will appear every time project.pbxproj is updated.

Well, that's not entirely true. It depends on the changes.

IMO build settings in master are correct now, nothing else to update. But It's a good idea to rebase after the release indeed.

I think the issue is with your commit https://github.com/xbmc/Official-Kodi-Remote-iOS/pull/91/commits/08d8ca1ef9eed82fe598ceeb3351b2a797242b30 as I pushed the same change today.

kambala-decapitator avatar Jan 11 '21 21:01 kambala-decapitator

TODO besides fixing conflicts and review comments:

  1. make the project buildable: 1.1. move MARKETING_VERSION from target to project level 1.2. ensure that watch app/extension receive the same CFBundleVersion as the host app (CURRENT_PROJECT_VERSION should be dropped)
  2. change bundle ID of new frameworks to match host app
    • you could introduce a special "bundle ID prefix" variable to reduce copy-paste, would also be easier to create separate app for debugging purposes
  3. what about using App Groups to share settings? (might be an overkill just for sharing hosts though)
  4. You're essentially building the new framework twice. Isn't it possible to build once and share it between apps? (hm, I guess not, as deployment target is different - iOS vs watchOS)
    • you could also drop those frameworks and link code directly to targets
  5. raise deployment target to 4.3, set all deployment targets on project level instead of target level
  6. add shared scheme for watch extension
  7. Assets for extension are empty and should be removed
  8. Why don't you use Assets to bundle watch app's resources?
  9. if possible, please split your changes into multiple commits: e.g., first commit could be SPM+iOS framework, second would be watch app itself and the third for fixing point 1. The more granular the better :)
  10. use the latest APIKit

Made runtime test on watch 1 with OS 4.3.2: looks good.

kambala-decapitator avatar Apr 03 '21 11:04 kambala-decapitator

Thank you for the review! I'll get back with the update soon.

integralpro avatar Apr 06 '21 05:04 integralpro

One question... I'm not sure if it's critical is to have CURRENT_PROJECT_VERSION undefined everywhere.

Please see that the current change defines CURRENT_PROJECT_VERSION to 1 (same value as it was in .info for CFBundleVersion for the host), and all .info files now use $(CURRENT_PROJECT_VERSION) it for CFBundleVersion

integralpro avatar Apr 07 '21 09:04 integralpro

One question... I'm not sure if it's critical is to have CURRENT_PROJECT_VERSION undefined everywhere.

Please see that the current change defines CURRENT_PROJECT_VERSION to 1 (same value as it was in .info for CFBundleVersion for the host), and all .info files now use $(CURRENT_PROJECT_VERSION) it for CFBundleVersion

currently bundle version of the host app is derived as count of git commits, you can find it in a script build phase. Either simply copy this phase to other targets or pre-compute the value somehow.

kambala-decapitator avatar Apr 07 '21 09:04 kambala-decapitator

One question... I'm not sure if it's critical is to have CURRENT_PROJECT_VERSION undefined everywhere. Please see that the current change defines CURRENT_PROJECT_VERSION to 1 (same value as it was in .info for CFBundleVersion for the host), and all .info files now use $(CURRENT_PROJECT_VERSION) it for CFBundleVersion

currently bundle version of the host app is derived as count of git commits, you can find it in a script build phase. Either simply copy this phase to other targets or pre-compute the value somehow.

Okay, I see. I will do the change.

integralpro avatar Apr 07 '21 09:04 integralpro

TODO besides fixing conflicts and review comments:

  1. make the project buildable: 1.1. move MARKETING_VERSION from target to project level

done

1.2. ensure that watch app/extension receive the same CFBundleVersion as the host app (CURRENT_PROJECT_VERSION should be dropped)

done

  1. change bundle ID of new frameworks to match host app

    • you could introduce a special "bundle ID prefix" variable to reduce copy-paste, would also be easier to create separate app for debugging purposes

dropped frameworks, added .swift files to the corresponding targets

  1. what about using App Groups to share settings? (might be an overkill just for sharing hosts though)

if needed, may be done in a separate change

  1. You're essentially building the new framework twice. Isn't it possible to build once and share it between apps? (hm, I guess not, as deployment target is different - iOS vs watchOS)

    • you could also drop those frameworks and link code directly to targets

Correct, they need to be built twice - per platform. I followed your suggestion and dropped framework targets.

  1. raise deployment target to 4.3, set all deployment targets on project level instead of target level

done

  1. add shared scheme for watch extension

done

  1. Assets for extension are empty and should be removed

done

  1. Why don't you use Assets to bundle watch app's resources?

done + added missing icons. I remember they are anyway required to for the AppStore.

  1. if possible, please split your changes into multiple commits: e.g., first commit could be SPM+iOS framework, second would be watch app itself and the third for fixing point 1. The more granular the better :)

Give me a good reason to do that. Don't you plan to squash everything before the merge?

  1. use the latest APIKit

APIKit is set to 5.1.0, but there is 5.2.0 available. I expected SPM to automatically track it up to a next major release. Let me check that.

integralpro avatar Apr 08 '21 03:04 integralpro

  1. use the latest APIKit

done

integralpro avatar Apr 08 '21 03:04 integralpro

One question... I'm not sure if it's critical is to have CURRENT_PROJECT_VERSION undefined everywhere.

Please see that the current change defines CURRENT_PROJECT_VERSION to 1 (same value as it was in .info for CFBundleVersion for the host), and all .info files now use $(CURRENT_PROJECT_VERSION) it for CFBundleVersion

you know, some time after that I've actually realised how to

pre-compute the value somehow

and use the approach you described :)

In my local changes that I'll PR soon I've done the same (since debug builds don't care about the actual build version and 1 is fine) and offloaded CURRENT_PROJECT_VERSION computation to the Fastfile to run only when uploading a build. #235

Sorry, but you'll have to remove script phase changes from 4d75b18e45474c4d6a9c24256fdcedc783ac84f5.

if needed, may be done in a separate change

I think not.

Give me a good reason to do that. Don't you plan to squash everything before the merge?

I prefer clear history with detailed changes. This also follows approach used in contributions to https://github.com/xbmc/xbmc. But if it's cumbersome for this PR (lots of pbxproj changes, I know), then I can squash.

I expected SPM to automatically track it up to a next major release

I've never worked with SPM, but that would've been a bad approach if it had updated dependencies for you implicitly :) That's why update command exists: pod update, carthage update, bundle update to name a few.

Will review your changes soon.

kambala-decapitator avatar Apr 08 '21 05:04 kambala-decapitator

Sorry, but you'll have to remove script phase changes from 4d75b18.

That's okay, I can remove them.

integralpro avatar Apr 08 '21 15:04 integralpro

Hi, just compiled this PR and tested the App on the iPhone Xs simulator. It seems the Launch Screen has gone. Instead there is a black screen while loading. Can you take a look at this?

wutschel avatar Apr 13 '21 19:04 wutschel

Hi, just compiled this PR and tested the App on the iPhone Xs simulator. It seems the Launch Screen has gone. Instead there is a black screen while loading. Can you take a look at this?

Thanks for checking and letting me know! I will take a look.

integralpro avatar Apr 13 '21 19:04 integralpro

@wutschel I accidentally removed launch screen from project.pbxproj. Should be fine now.

integralpro avatar Apr 13 '21 20:04 integralpro

@wutschel I accidentally removed launch screen from project.pbxproj. Should be fine now.

Thanks, I confirm it´s back now.

wutschel avatar Apr 14 '21 04:04 wutschel

Another question: When building the App for iPhone I get several hundred new warnings caused by changing CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF to YES. Also other new warnings are coming up now. Was this done intentionally?

wutschel avatar Apr 14 '21 17:04 wutschel

CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF is a switch to enable compiler warnings for implicit self retains. It was turned on unintentionally, may be at some point I agreed to update project with "recommended settings". Let me check if I can turn this option OFF.

integralpro avatar Apr 14 '21 17:04 integralpro

I disabled CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF to suppress the warnings, but let @kambala-decapitator to decide if those retains are the real issue.

There are two new warnings coming with the PR:

  1. Unused return value in AppDelegate, calling KodiAPI -- I fixed it.
  2. 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is ...

The second is because of APIKit dependency, it sets IPHONEOS_DEPLOYMENT_TARGET to 8.0 in the config files. It shouldn't be a problem, however I don't know if it's possible to change it to 9.0 or how to suppress it.

integralpro avatar Apr 14 '21 18:04 integralpro

I disabled CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF to suppress the warnings, but let @kambala-decapitator to decide if those retains are the real issue.

it's difficult to say without actually checking every warning. Anyway, it's a topic for another PR.

The second is because of APIKit dependency, it sets IPHONEOS_DEPLOYMENT_TARGET to 8.0 in the config files. It shouldn't be a problem, however I don't know if it's possible to change it to 9.0 or how to suppress it.

this can be ignored. I know how to fix such with cocoapods, but SPM probably doesn't allow that many customisations. If really needed, it can always be solved in a fork of APIKit.

kambala-decapitator avatar Apr 14 '21 18:04 kambala-decapitator

every time I open project with Xcode 12.4, some files become changed, please fix.

❯ git --no-pager diff
diff --git a/Kodi Remote.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Kodi Remote.xcodeproj/project.xcworkspace/contents.xcworkspacedata
index 3af3be2..919434a 100644
--- a/Kodi Remote.xcodeproj/project.xcworkspace/contents.xcworkspacedata	
+++ b/Kodi Remote.xcodeproj/project.xcworkspace/contents.xcworkspacedata	
@@ -2,6 +2,6 @@
 <Workspace
    version = "1.0">
    <FileRef
-      location = "self:Kodi Remote.xcodeproj">
+      location = "self:">
    </FileRef>
 </Workspace>
diff --git a/Kodi Remote.xcodeproj/xcshareddata/xcschemes/watchapp.xcscheme b/Kodi Remote.xcodeproj/xcshareddata/xcschemes/watchapp.xcscheme
index 94ad1fb..ee477ec 100644
--- a/Kodi Remote.xcodeproj/xcshareddata/xcschemes/watchapp.xcscheme	
+++ b/Kodi Remote.xcodeproj/xcshareddata/xcschemes/watchapp.xcscheme	
@@ -63,8 +63,10 @@
       debugDocumentVersioning = "YES"
       debugServiceExtension = "internal"
       allowLocationSimulation = "YES">
-      <BuildableProductRunnable
-         runnableDebuggingMode = "0">
+      <RemoteRunnable
+         runnableDebuggingMode = "2"
+         BundleIdentifier = "com.apple.Carousel"
+         RemotePath = "/Kodi Remote">
          <BuildableReference
             BuildableIdentifier = "primary"
             BlueprintIdentifier = "92663CA7203021D5002FE988"
@@ -72,7 +74,7 @@
             BlueprintName = "watchapp"
             ReferencedContainer = "container:Kodi Remote.xcodeproj">
          </BuildableReference>
-      </BuildableProductRunnable>
+      </RemoteRunnable>
    </LaunchAction>
    <ProfileAction
       buildConfiguration = "Release"
@@ -80,8 +82,10 @@
       savedToolIdentifier = ""
       useCustomWorkingDirectory = "NO"
       debugDocumentVersioning = "YES">
-      <BuildableProductRunnable
-         runnableDebuggingMode = "0">
+      <RemoteRunnable
+         runnableDebuggingMode = "2"
+         BundleIdentifier = "com.apple.Carousel"
+         RemotePath = "/Kodi Remote">
          <BuildableReference
             BuildableIdentifier = "primary"
             BlueprintIdentifier = "92663CA7203021D5002FE988"
@@ -89,7 +93,16 @@
             BlueprintName = "watchapp"
             ReferencedContainer = "container:Kodi Remote.xcodeproj">
          </BuildableReference>
-      </BuildableProductRunnable>
+      </RemoteRunnable>
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "92663CA7203021D5002FE988"
+            BuildableName = "watchapp.app"
+            BlueprintName = "watchapp"
+            ReferencedContainer = "container:Kodi Remote.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
    </ProfileAction>
    <AnalyzeAction
       buildConfiguration = "Debug">

kambala-decapitator avatar Apr 17 '21 08:04 kambala-decapitator

You may change those after we merge the PR. I don't have such changes and also use Xcode 12.4.

integralpro avatar Apr 17 '21 16:04 integralpro