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

iOS ExternalActionViewModifierPlugin: make apply func open #539

Conversation

nancywu1
Copy link
Contributor

@nancywu1 nancywu1 commented Nov 5, 2024

exposing apply func so it can be overriden in ExternalWidgetPlugin

Change Type (required)

Indicate the type of change your pull request is:

  • patch
  • minor
  • major

Does your PR have any documentation updates?

  • Updated docs
  • No Update needed
  • Unable to update docs
📦 Published PR as canary version: 0.9.2--canary.539.18398

Try this version out locally by upgrading relevant packages to 0.9.2--canary.539.18398

Version

Published prerelease version: 0.10.0-next.9

Changelog

Release Notes

Add Missing DSL Docs (#548)

Docs - Add DSL docs

Applicability docs (#544)

  • Update applicability docs to reflect desired patterns and behaviors
  • Fix flaky react reference asset test
  • Fix misc vitest issues when running outside of bazel (cjs environment, excluded directories)

Change Type (required)

Indicate the type of change your pull request is:

  • patch
  • minor
  • major

Does your PR have any documentation updates?

  • Updated docs
  • No Update needed
  • Unable to update docs

Remove unneeded dependency on pubsub-js (#547)

Remove dead dependencies

Change Type (required)

Indicate the type of change your pull request is:

  • patch
  • minor
  • major

Does your PR have any documentation updates?

  • Updated docs
  • No Update needed
  • Unable to update docs

Minor Docs Fixes (#538)

  • Fix search on next subdomain searching against and redirecting to latest
  • Update page description on the landing page

Change Type (required)

Indicate the type of change your pull request is:

  • patch
  • minor
  • major

Does your PR have any documentation updates?

  • Updated docs
  • No Update needed
  • Unable to update docs

More Doc Fixes (#532)

  • Fix links for latest and next pages
  • Add package manager tabs for js install instructions
  • Fix version selector breaking on main page

Change Type (required)

Indicate the type of change your pull request is:

  • patch
  • minor
  • major

Does your PR have any documentation updates?

  • Updated docs
  • No Update needed
  • Unable to update docs

Fix docs build visibility (#531)

Fix visibility of docs build

ios: enhance tapable logger to handle variadic args from the JS log (#524)

Prefixing message with the format [Player] [\(logLevel)]: moved out of the Tapable logger and moved to PrintLoggerPlugin. Any consumers using their own LoggerPlugin will need to append the logLevel if they want to print it

Before

public class CustomLoggingPlugin: NativePlugin {
    
    public let pluginName = "CustomLoggingPlugin"

    public func apply<P>(player: P) where P: HeadlessPlayer {
        guard let player = player as? SwiftUIPlayer else { return }
        player.logger.logLevel = .trace
        player.logger.hooks.trace.tap(name: pluginName, { print("Custom message")\(($0))" ) })
        ...
    }

After

public class CustomLoggingPlugin: NativePlugin {
    
    public let pluginName = "CustomLoggingPlugin"

    public func apply<P>(player: P) where P: HeadlessPlayer {
        guard let player = player as? SwiftUIPlayer else { return }
        player.logger.logLevel = .trace
        let prefixedMessage = "[Player] [trace]: "
        player.logger.hooks.trace.tap(name: pluginName, { print("\(prefixedMessage) Custom message \(($0))" ) })
        ...
    }

Breaking Changes

Any usage of the player.logger.hooks taps will have breaking changes in the callback because the calls have been changed to provide a [Any] type instead of String so it can be returned in the form of messages instead of a single message. Unless nothing is done in the callback to access the value but just to print it, there should be breaking changes

Example:

// this should be no breaking change
player.logger.hooks.trace.tap(name: "log", { print("\(($0))" ) })

// if `values` should be accessed in anyway, i.e want the first value, or want to seperate the values
 player.logger.hooks.debug.tap(name: "log") { values in
            // values is of type [Any], if you want to print only the first value
            print("\((message as? [String])?.first))" )
        }

🚀 Enhancement

  • ios: enhance tapable logger to handle variadic args from the JS log #524 (@nancywu1)

🐛 Bug Fix

🏠 Internal

📝 Documentation

Authors: 8

@nancywu1
Copy link
Contributor Author

nancywu1 commented Nov 5, 2024

/canary

Copy link

codecov bot commented Nov 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.57%. Comparing base (fb57765) to head (57070db).
Report is 33 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #539   +/-   ##
=======================================
  Coverage   89.57%   89.57%           
=======================================
  Files         331      331           
  Lines       19718    19718           
  Branches     1949     1949           
=======================================
  Hits        17663    17663           
  Misses       2041     2041           
  Partials       14       14           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nancywu1 nancywu1 changed the title iOS ExternalActionViewModifierPlugin: expose controllers, transition func, and apply func iOS ExternalActionViewModifierPlugin: make apply func open Nov 18, 2024
@nancywu1
Copy link
Contributor Author

/canary

@nancywu1
Copy link
Contributor Author

/canary

@nancywu1 nancywu1 marked this pull request as ready for review December 2, 2024 18:17
@nancywu1 nancywu1 requested a review from adierkens as a code owner December 2, 2024 18:18
@nancywu1 nancywu1 merged commit 1c7b805 into main Dec 2, 2024
11 checks passed
@nancywu1 nancywu1 deleted the exposing-external-action-view-modifier-plugin-for-external-widget-plugin branch December 2, 2024 18:18
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.

2 participants