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

Use external DittoPresenceViewerCore dependency #166

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

bplattenburg
Copy link
Member

@bplattenburg bplattenburg commented Dec 13, 2024

Updates to use the presence viewer from its own repo / package as part of the path to a single source of truth for the presence viewer's web code (JS & HTML). All the Swift code stays here.

Depends on getditto/DittoPresenceViewerCore#7

Closes CXTOOLS-358
Part of CXTOOLS-337

Copy link

linear bot commented Dec 13, 2024

Copy link

linear bot commented Dec 13, 2024

@bplattenburg bplattenburg marked this pull request as ready for review December 19, 2024 14:59
@bplattenburg bplattenburg requested a review from a team as a code owner December 19, 2024 14:59
@bplattenburg bplattenburg force-pushed the BP/extract_presence_viewer branch from 36e7fd5 to 8f85300 Compare December 20, 2024 18:32
@bplattenburg
Copy link
Member Author

This will now depend on getditto/DittoPresenceViewerCore#5 and a matching new release of the new package to avoid undoing the work in #167.

Marking as a draft for now.

@bplattenburg bplattenburg marked this pull request as ready for review January 2, 2025 18:17
@bplattenburg bplattenburg marked this pull request as draft January 2, 2025 20:06
Package.swift Outdated Show resolved Hide resolved
Sources/DittoPresenceViewer/JSWebView.swift Show resolved Hide resolved
@bplattenburg bplattenburg changed the title Use external DittoPresenceViewer dependency Use external DittoPresenceViewerCore dependency Jan 3, 2025
// MARK: Constants

private struct LocalizedStrings {
static let title = NSLocalizedString("Ditto Presence",
Copy link
Member Author

@bplattenburg bplattenburg Jan 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't actually have any matching localized strings (or any at all in the package), and I was getting some inconsistent build errors from Xcode 16.2 around the Bundle+FrameworkBundle.swift code - removing this single usage allowed me to remove that extension as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zmarkan I was seeing the links from the other comment thread not working, this is the localization removal

@bplattenburg
Copy link
Member Author

This now depends on getditto/DittoPresenceViewerCore#7

@bplattenburg
Copy link
Member Author

bplattenburg commented Jan 10, 2025

And here is this used in the POS demo app, showcasing no breaking changes for consuming apps: getditto/demoapp-pos-kds#69

@bplattenburg bplattenburg marked this pull request as ready for review January 14, 2025 16:51
@@ -128,7 +120,7 @@ final class DittoPresenceViewController: PlatformViewController {
#if canImport(UIKit)
guard navigationController == nil else { return }

navigationItem.title = LocalizedStrings.title
navigationItem.title = "Ditto Presence"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why move to hardcode strings?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #166 - essentially we didn't actually do any localization and all the machinery to make it work was causing other build issues with the current Xcode version.

If we want to revisit localization later the tools need a much larger overhaul

@@ -83,7 +75,7 @@ final class DittoPresenceViewController: PlatformViewController {
override func viewDidLoad() {
super.viewDidLoad()

title = LocalizedStrings.title
title = "Ditto Presence"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why move to hardcoded strings?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #166 - essentially we didn't actually do any localization and all the machinery to make it work was causing other build issues with the current Xcode version.

If we want to revisit localization later the tools need a much larger overhaul

@bplattenburg bplattenburg requested a review from a team January 29, 2025 19:49
@rdas-ditto
Copy link
Contributor

I noticed that when building for Mac Catalyst, then Presence Viewer doesn't work as expected:
Screenshot 2025-01-30 at 14 51 31

When run as Mac (Designed for iPad), it works fine.
Screenshot 2025-01-30 at 14 52 14

Although, it's not a regression. Same behaviour on the prior version, with embedded js.

Given there are (apparently) other issues when building for Mac Catalyst (I noticed creds don't persist in Keychain, either) — shall we consider this expected behaviour, so we can move forward, and fix Catalyst later?

Copy link
Contributor

@rdas-ditto rdas-ditto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks compilation for tvOS, as there are numerous platform deltas.

My understanding is that the Presence Viewer (as it relies on js) is entirely incompatible on tvOS (it is excluded from the menu entirely), so I'll work out cleanly excluding all the relevant source from the platform (as opposed to resolving issues, or line-by-line workarounds)

@bplattenburg
Copy link
Member Author

This breaks compilation for tvOS, as there are numerous platform deltas.

My understanding is that the Presence Viewer (as it relies on js) is entirely incompatible on tvOS (it is excluded from the menu entirely), so I'll work out cleanly excluding all the relevant source from the platform (as opposed to resolving issues, or line-by-line workarounds)

That's right, presence viewer doesn't work today on tvOS, but we should still ensure that it compiles so customers can use the other tools. I'm hoping that's as simple as some #if !os(tvOS) lines but it might not be.

@bplattenburg
Copy link
Member Author

I noticed that when building for Mac Catalyst, then Presence Viewer doesn't work as expected: Screenshot 2025-01-30 at 14 51 31

When run as Mac (Designed for iPad), it works fine. Screenshot 2025-01-30 at 14 52 14

Although, it's not a regression. Same behaviour on the prior version, with embedded js.

Given there are (apparently) other issues when building for Mac Catalyst (I noticed creds don't persist in Keychain, either) — shall we consider this expected behaviour, so we can move forward, and fix Catalyst later?

I'd lean towards tracking the mac catalyst issues separately if the behavior is unchanged by this work - can you write up a summary in a new issue?

@rdas-ditto
Copy link
Contributor

Slightly more involved than !tvOS, but I'm working on a fix. Should be able to push tomorrow. I want to snip the tv condition as high up the food chain as possible. Got it nearly worked out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants