Commit Graph

94 Commits

Author SHA1 Message Date
Pritesh Nandgaonkar
e104a1fa6b Split up the CK code so that internal refers to the latest and Open source refers to the sunset version and it won't be actively developed
Summary:
This diff keeps the opensource integration of CK for Flipper at the same place. It moves the code which is referred internally to a different folder under Facebook directory.

The reason we are doing this is because, CK won't be publishing any more opensource releases to Cocoapods. Thus we would like to keep the code for opensource compatible to the latest one. Internally we would refer to the CK code from Facebook directory.

Reviewed By: fabiomassimo

Differential Revision: D26047510

fbshipit-source-id: 302890bcd36d3e4c4888577d821433f58fcab5c7
2021-01-27 02:43:07 -08:00
Ruslan Serebriakov
0fd6262044 Fixing the issue with broken CKInsetComponent set up
Summary:
After updating the internal properties of CKInsetComponent we didn't update some KVO magic being used in Flipper which caused some crashes:
https://fb.workplace.com/groups/componentkit/permalink/4986354281413147/

Reviewed By: fabiomassimo

Differential Revision: D25946704

fbshipit-source-id: 5995cda20d12b18f7520507cb6ede897fddf2670
2021-01-20 04:52:29 -08:00
Shuo Yang
f1baf3c1d8 WPM | Fix for missing SonarKit symbols (SKNamed, SKComponentLayoutDescriptor)
Summary:
This should fix build failures with prod config. The symbols should only be in internal builds and not the prod ones.

```
stderr: Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_SKNamed", referenced from:
  ...
  "_OBJC_CLASS_$_SKComponentLayoutDescriptor", referenced from:
  ...
```

Reviewed By: rzito

Differential Revision: D24250749

fbshipit-source-id: 68c3d066a76baf4b1646f27dac0fd081bcaff41b
2020-10-12 09:37:08 -07:00
Dustin Shahidehpour
6a22d6dca9 Add docs to SKSubDesciptor
Summary: This tripped me up for a bit. Add some docs.

Reviewed By: Andrey-Mishanin

Differential Revision: D24160934

fbshipit-source-id: a36ac6b205a9edeeb0698f44476456583146907c
2020-10-07 15:44:33 -07:00
Dustin Shahidehpour
7711502413 Add ability to register additional attribute providers.
Summary:
We have some "internal-only" stuff we want to put in the attribute of a layout node.
This allows us to do so a way that keeps it out of open-source and avoid the clunky subclassing.

Reviewed By: adamjernst

Differential Revision: D24162047

fbshipit-source-id: 518ab9fbf0b4274076f5b0ae1b249e197563fa7f
2020-10-07 15:41:44 -07:00
Paco Estevez Garcia
d488b308de Add support for tagged messages on the Layout Inspector
Summary:
Related diff [Litho]: D23243009

This diff adds support for a protocol for layout messages where the type is recursively encoded as:

```
{
 kind: "type",
 data: ???
}
```

We check if the message adheres to the new encoding, otherwise we fall back to the old behavior. If it's the new encoding, the message is traversed recursively flattening the types to EditorValue using the type hints provided.

Reviewed By: Andrey-Mishanin

Differential Revision: D23319619

fbshipit-source-id: 79e8886f8f5a0aea4ec32938f1d5cd2fd645a297
2020-08-27 05:34:27 -07:00
Dominik Wielgórski
41f1a0b454 Extra data send from iOS to Flipper Desktop
Summary: Added `extraInfo` for node descriptor for ios. Analogical to android node descriptor

Reviewed By: cuva, Andrey-Mishanin

Differential Revision: D23105947

fbshipit-source-id: f21541e97d79c0009815f94e733a056320324459
2020-08-17 10:20:53 -07:00
Adam Ernst
b11082d229 Don't show accessibilityComponentAction in Flipper
Summary: This field is going to be removed in a subsequent version of the struct. Showing it is not that important, so let's just remove it.

Reviewed By: kevin0571

Differential Revision: D22335170

fbshipit-source-id: 0916927ee30757678f847cd0f826caa1d4a6c7cc
2020-07-01 14:54:49 -07:00
Kevin Lin
29c85e672b Rename CKComponentLayout to CKLayout
Summary:
Rename `CKComponentLayout` to `CKLayout`
#nocancel

Reviewed By: adamjernst

Differential Revision: D22332214

fbshipit-source-id: 8845f2b313e214cd7892199bf0c40341c88a595a
2020-07-01 11:59:41 -07:00
Adam Ernst
993dbef7b8 Remove expensive operator== from CKViewConfiguration & AccessibilityContext
Summary:
`CKComponentAccessibilityContext::operator==` can be extremely expensive; it may invoke the `accessibilityLazyTextBlock` for its `CKComponentAccessibilityTextAttribute` members, and that can do a lot of string construction.

I could refactor this to make it cheaper, e.g. by migrating to a function-pointer-and-context-object approach. But the easiest thing to do is to simply remove it; I don't think it's meaningfully used.

Reviewed By: kevin0571

Differential Revision: D22322108

fbshipit-source-id: 82a0548d6dd28ec4adf2f3ba85705eabf665d100
2020-07-01 08:26:04 -07:00
Andrey Mishanin
925a5a4d61 Displaying scope identifier
Summary: Ditto.

Reviewed By: kevin0571

Differential Revision: D21742950

fbshipit-source-id: e2e1e1a7758c0e0c9f0041c4c59f3a59618acbe8
2020-05-27 16:28:09 -07:00
Chaiwat Ekkaewnumchai
a42c2dda5b Fix Highlight not Removed Properly When Quit Flipper via Shortcut
Summary: Discovered in https://fburl.com/h6eczhr2; the highlight didn't get removed correctly. This was from [this method](https://fburl.com/diffusion/twur28gt), which must be called on main thread to be executed completely.

Reviewed By: jknoxville

Differential Revision: D21629318

fbshipit-source-id: cfc52ac755a1ddfe92e675aac1a81066ce338bd7
2020-05-19 09:44:49 -07:00
Adam Ernst
82898b784e Clean up Flipper's iOS layout invalidation
Summary:
This reverts D21285438 and patches some holes in the layout invalidation routines.

(I tried to use `didAddSubview:` and `willRemoveSubview:` but those are annoying for other reasons; for example, `willRemoveSubview:` can be called from within `dealloc` which is surprising. Also they still don't catch the case where subviews are being reordered.)

Reviewed By: Andrey-Mishanin

Differential Revision: D21512129

fbshipit-source-id: 1d9e8dac9333eddfae2309d446ef4de9e83220d6
2020-05-12 05:54:38 -07:00
Adam Ernst
029122ce7a Fix unresponsive UI bug due to sloppy swizzling
Summary:
If you're going to swizzle, you have to be very careful to call the original version of the swizzled method!

The blame diff for this regression is D21285438.

In this case we would fail to call `swizzle_removeFromSuperview` if the view being removed was a child of a window. Thus the view would never be removed.

In practice, this manifested as `UITransitionView` instances being left around. These would block taps, leading to developer reports of unresponsive UI.

Reviewed By: priteshrnandgaonkar

Differential Revision: D21509692

fbshipit-source-id: e400c55232c44e9cd3f478eb2b456222c0bc6576
2020-05-11 16:18:04 -07:00
Chaiwat Ekkaewnumchai
f4c209bc1c (client_ios) Update Descriptors
Summary: Similar to D21040424 and D21040426.

Reviewed By: Andrey-Mishanin

Differential Revision: D21335955

fbshipit-source-id: 5e8326915e54647c77fb241ad2ed4eaa55d0cfe2
2020-05-07 06:18:38 -07:00
Chaiwat Ekkaewnumchai
367dbeee8c (client_ios) Return Tree And Path to Flipper Desktop
Summary:
Similar to D21040429, we need to add data sent to Flipper desktop so that we can use to retrieve necessary data.

~~The implementation is different; storing **all** component data is needed because the plugin refers to it when asked for information. This might cause an issue because we need to store more data. However, due to the sparseness of data at a single touch, this shouldn't cause any OOM.~~

Implementation Detail:
- `FlipperKitLayoutPlugin.mm`
  - When the process finishes the tree returned is trie from root node to every node that is touched
- `SKTouch.m`
  - `_nodeStack` keeps track of path from root to current component
  - `_treeStack` keeps track of current prefix tree (trie)
  - `continueWithChildIndex` takes care of logic for `_nodeStack` and `_treeStack`

Reviewed By: Andrey-Mishanin

Differential Revision: D21335956

fbshipit-source-id: 84c0cabd7399abe50cf2deaff2b01149a1a792d5
2020-05-07 06:18:38 -07:00
Eloy Durán
c393ee9421 Entirely control Flipper being enabled through Podfile (#1086)
Summary:
Currently user’s are being told to add a definition of the `FB_SONARKIT_ENABLED` macro and examples, including those in stock React Native templates, set this for the user by making use of a `post_install` hook in the user’s `Podfile`. This leads to confusion, fragile code [when a user’s project dir structure deviates from vanilla], and is ultimately not necessary as CocoaPods already has dedicated mechanisms to:

* specify build settings (through the `xcconfig` property);
* and selectively include certain pods only in certain build configurations (e.g. debug).

Finally, this PR also includes a commit [to fix the current builds](https://github.com/facebook/flipper/pull/1086/files#r418526812).

## Changelog

> Entirely control Flipper being enabled through inclusion in Podfile and optionally limiting to certain build configurations using the `:configuration` directive.
Pull Request resolved: https://github.com/facebook/flipper/pull/1086

Test Plan: I have built and ran the Sample application, as well as used this version of Flipper with a new RN app built from `master`.

Reviewed By: passy

Differential Revision: D21381828

Pulled By: priteshrnandgaonkar

fbshipit-source-id: edf6dae28eb02336a49e8230654d6186360ea8d6
2020-05-05 03:11:45 -07:00
Pritesh Nandgaonkar
794d2f282f Solved the bug related to the toggle inspector of iOS
Summary:
Before this diff the nodes were not invalidated properly when the new view got added in the hierarchy, due to this there was following bug.

https://our.intern.facebook.com/intern/px/p/15RSP

Reviewed By: Andrey-Mishanin

Differential Revision: D21285438

fbshipit-source-id: b72aa93856688b31296ae1df4f15e128037aa1ca
2020-05-04 09:53:12 -07:00
Adam Ernst
affade67ff Remove unused getAllNodes support from Layout plugin impl
Summary: Added in D14209157, but the JavaScript no longer ever calls this method.

Reviewed By: jknoxville

Differential Revision: D21290792

fbshipit-source-id: df1969d83f0dc096a24977c15c27100d2f2bdfc0
2020-04-29 08:37:55 -07:00
Adam Ernst
c62760b3e8 Speed up Flipper by using background queue for serialization
Reviewed By: jknoxville

Differential Revision: D21290732

fbshipit-source-id: 21fcb793900a6517d764fa3a581255fd75a39801
2020-04-28 21:32:49 -07:00
Adam Ernst
d66484822b Allow subdescriptors to return nil to signal no data
Summary: Currently subdescriptors are *always* rendered. Allow them to return `nil` to signal that they don't need to be rendered.

Reviewed By: cuva

Differential Revision: D21157249

fbshipit-source-id: 68a83424efc50723e1ec71c069feef8e10037671
2020-04-21 11:53:11 -07:00
Adam Ernst
d0803ecd56 Show mounted ComponentKit views in Flipper
Summary:
Before this diff, Flipper showed *leaf* views created by ComponentKit, but not any intermediate views. Now we show both.

A new node type `SKComponentMountedView` is used for this purpose. Its descriptor `SKComponentMountedViewDescriptor` mostly delegates to its view's descriptor, but redirects back into ComponentKit for children.

Reviewed By: Andrey-Mishanin

Differential Revision: D21130997

fbshipit-source-id: b3c12ea7cc1200962b3ba7c269c48d68b1809948
2020-04-21 11:53:10 -07:00
Hugo Cuvillier
1ce8a41556 Use component.className instead of NSStringFromClass"
Summary: Component classes do not reflect the source of the component anymore.

Reviewed By: fabiomassimo

Differential Revision: D20595754

fbshipit-source-id: 645a63f78ee6aaaf75ac0c1e08bf67229a3f906b
2020-04-16 13:50:01 -07:00
Adam Ernst
70d417b62b Tweak docs for [SKNodeDescriptor -identifierForInvalidation:]
Summary: It took me a few tries to understand what this was for.

Reviewed By: jknoxville

Differential Revision: D20462208

fbshipit-source-id: f6dac7836409c8d4ec1ffb90a74f632624fb68f7
2020-03-16 07:29:23 -07:00
Adam Ernst
89d6dfcf95 Simplify invalidate batching in Layout plugin
Summary:
- Avoid holding lock while calling out to `send:withParams:`; it's hard to reason about whether we could trigger deadlock.
- Remove unnecessary `lastInvalidateMessage` ivar; we already ensure that we send at most one invalidate batch per 500ms by using `invalidateMessageQueued`.
- Misc code style items

Reviewed By: Andrey-Mishanin

Differential Revision: D20462193

fbshipit-source-id: 80f61e5a7ce5021e16ebc19a2ec40adfc46f9b92
2020-03-16 07:29:23 -07:00
Adam Ernst
d9a2167019 Refactor SKSubDescriptor
Reviewed By: d16r

Differential Revision: D20458337

fbshipit-source-id: e8ea848c6e2f7521c5a6c6eb4110bba0bfe25593
2020-03-15 19:42:39 -07:00
Adam Ernst
19876273a3 Refactor SKComponentLayoutDescriptor
Reviewed By: Andrey-Mishanin

Differential Revision: D20458227

fbshipit-source-id: 1723043d6b217323a1c70a455042b28eaf5218a0
2020-03-15 19:42:38 -07:00
Adam Ernst
1725fd6bf1 Simplify CKComponentHostingViewProtocol
Summary: All current implementations of `CKComponentHostingViewProtocol` *contain* a `CKInspectableView`, so there is no need for the hosting view itself to conform. This also simplifies the Flipper plugin.

Reviewed By: d16r

Differential Revision: D20457822

fbshipit-source-id: 472f80f5bb2ee507862487d076cfb0e3de6416fa
2020-03-15 19:42:38 -07:00
Shahar Freundlich
72a74c9a1d Change compiler flag
Summary: Change compiler flag "-Wno-unguarded-availability" to "-Wunguarded-availability" in order to make build time safety check for unsafe newly introduced api without guarding it with available conditional.

Reviewed By: priteshrnandgaonkar

Differential Revision: D20335903

fbshipit-source-id: b4b0e492a9244233f1bc3b5ba2a63c6415c92bb4
2020-03-12 00:49:50 -07:00
Andrey Mishanin
f544d95953 Displaying component identifiers
Summary: Adding the new "Identity" section to CK components' description.

Reviewed By: cuva

Differential Revision: D19948738

fbshipit-source-id: cbd9bc9c77b6f6503e10cfc75581ef4b94dd0247
2020-03-11 09:41:06 -07:00
Andrey Mishanin
127cb604be Use unique id for both root and hosting views
Summary: Same as D19600721, but supports hosting views too.

Reviewed By: cuva

Differential Revision: D19949935

fbshipit-source-id: 4490b03aff9f6d00003cf59468081cc3a4fef598
2020-03-11 09:31:09 -07:00
Eloy Durán
c6c667df69 Make iOS 9 compatible again. (#874)
Summary:
React Native v0.62.0’s template still uses iOS 9 as deployment target, bumping it to 10 this late in the release cycle is probably not a good idea, so instead I made this tiny change to make it iOS 9 compatible again.

⚠️  I made this change on top of the `v0.32.2` **tag**, as `master` was giving me a build failure and in any case it would be better to release _just_ this change as a patch release so the RN `v0.62.0-rc.3` release can go out without having to test Flipper as thoroughly again.

## Changelog

Make FlipperKit compatible with iOS 9 again.
Pull Request resolved: https://github.com/facebook/flipper/pull/874

Test Plan:
- `pod install` with a Podfile that has iOS 9 as its deployment target passes again.
- Building the Flipper Sample works.
- Building with a RN application created with the `v0.62.0-rc.3` template works.

Reviewed By: priteshrnandgaonkar

Differential Revision: D20307073

Pulled By: passy

fbshipit-source-id: 0dd02dfb810b7382c52ca81b8f1322f807fb3f29
2020-03-09 07:42:34 -07:00
Hugo Cuvillier
987822074b Back out "Use component.className instead of NSStringFromClass"
Summary:
Original diff broke OSS flipper. Need a new OSS release of CK first

Original commit changeset: 3e7564b25610

Reviewed By: kfirapps

Differential Revision: D20304743

fbshipit-source-id: 08a56359a42bc56b576d212e7cf642197a064076
2020-03-06 07:59:11 -08:00
Hugo Cuvillier
5a4ac4c32d Use component.className instead of NSStringFromClass
Summary: Use `component.className` in sonar for the layout inspector.

Reviewed By: kfirapps

Differential Revision: D20184486

fbshipit-source-id: 3e7564b2561016ee59f3b1fc9d21313e068bacb3
2020-03-06 04:06:02 -08:00
generatedunixname89002005287564
5c44d53739 Daily arc lint --take CLANGFORMAT
Reviewed By: zertosh

Differential Revision: D20278397

fbshipit-source-id: 2188283cd01d0d9d9d5b3995bd8d3f1fd687ad55
2020-03-05 08:30:40 -08:00
Pritesh Nandgaonkar
f03f119f0e Fix the broken target selector
Summary:
The target selector was broken on iOS. The overlay view which has the gesture recognizer, was never added to the window, due to which the gestures were not registered and the feature broke.

This diff adds the overlay view in the window object as the subview and then discards it in its view descriptor as otherwise we will capture all our touches in this view.

This was the most popular bug in our research trip and almost everyone reported it.

Reviewed By: fabiomassimo

Differential Revision: D20225594

fbshipit-source-id: af4041859d7e662152b2575d1eb258dd0c2d990e
2020-03-04 06:46:59 -08:00
Andrey Mishanin
adce24d343 Displaying identifier for root views
Summary: Adding the new "Identity" section to CK root views' description.

Reviewed By: cuva

Differential Revision: D19948784

fbshipit-source-id: f5e7fe51afd387a476f6500db32b8b5149594007
2020-02-21 04:25:16 -08:00
Pritesh Nandgaonkar
972277b031 Fix warnings of FlipperKit in iOS
Summary:
This diff fixes the warnings raised from FlipperKit. Also this diff updates the deployement target of FlipperKit  to iOS 10. Even wilde assumes the min deployment OS version to be iOS 10. In layout plugin we use [UIAccessibiltyTraiTabBar](https://developer.apple.com/documentation/uikit/uiaccessibility/uiaccessibilitytraits/1648592-tabbar), which assumes iOS 10 and above.

Partially fixes https://github.com/facebook/flipper/issues/803

Still there are some warnings which are coming from the dependencies outside of Flipper.

Reviewed By: passy

Differential Revision: D19941558

fbshipit-source-id: 31809fedb9aa297bc318b5af72e29e8444f0142f
2020-02-18 12:47:21 -08:00
Pritesh Nandgaonkar
e8b20d5b15 Run CLANGFORMAT on plugins
Summary:
This diff runs CLANGFORMAT lint on plugins. I have added CLANGFORMAT as the lint engined for objc files in xplat/sonar. Right now the iOS folder is not formatted according to CLANGFORMAT.

Ran `arc lint -a --paths-cmd "find ./iOS/Plugins -type f" --verbose`

Reviewed By: passy

Differential Revision: D19942173

fbshipit-source-id: 8b975b0a344df073b02d69cd1f9ee5629af2799d
2020-02-17 10:49:18 -08:00
Pritesh Nandgaonkar
cfb8b367c5 Fix for the broken Layout plugin
Summary: Fixes the broken Layout plugin in wilde. Before this fix it will just show an empty screen in the layout plugin.

Reviewed By: jknoxville

Differential Revision: D19621517

fbshipit-source-id: e10078248b95b93c6b9c87ccf4508628b6ad86bb
2020-01-29 07:50:27 -08:00
Andrey Mishanin
67a1c27af2 Prepending root scope ID
Summary: Using just the scope identifier for the root component is not sufficient when it doesn't have a scope. Solve this by prepending the scope root identifier to the parent identifier.

Reviewed By: fabiomassimo

Differential Revision: D19600721

fbshipit-source-id: d90f9ffd7ae369c76316cebc4ef792626a4584b7
2020-01-28 08:27:38 -08:00
Hugo Cuvillier
7047354f94 Removal of unused protocol CKRenderWithChildrenComponentProtocol
Summary: Ditto

Reviewed By: kfirapps

Differential Revision: D19496643

fbshipit-source-id: ab6777acb68122f2395919a5afbb30a1ccfafe06
2020-01-21 08:26:19 -08:00
Oleksii Dykan
8a136542a3 Remove margin from CKFlexboxComponent style property
Summary: This diff removes the margin property from the CKFlexboxComponetn style, as it was never working properly.

Reviewed By: Andrey-Mishanin

Differential Revision: D19251856

fbshipit-source-id: eb8e448a68d2e0ff3cd6726c40af0267fced96ea
2020-01-08 12:10:00 -08:00
Kevin Lin
5ca8b6dc30 Make rootNode a weak reference in SKComponentLayoutWrapper
Summary: In some cases this can cause a retain cycle.

Reviewed By: priteshrnandgaonkar

Differential Revision: D18297780

fbshipit-source-id: c60abdcaad9fd94c457647509aec0519042801e4
2019-11-05 09:58:04 -08:00
Andres Suarez
0675dd924d Tidy up Flipper license headers [1/2]
Reviewed By: passy

Differential Revision: D17863711

fbshipit-source-id: 259dc77826fb803ff1b88c88529d7f679d3b74d8
2019-10-11 13:46:45 -07:00
Kfir Schindelhaim
52976f1ee3 Introduce CKMountable protocol
Summary:
- Introduce new base protocol `CKMountable`
  - Contains Layout & Mount methods that have been extracted from `CKComponent`
  - This will allows us to introduce a new lighter version of `CKComponent`, which doesn't rely on Scope/State/Controllers/etc
- Refactor `CKComponentLayout` to work with `CKMountable` instead of `CKComponent`, which will allows us to interop between `CKComponent` and a new type of components.
- Refactor the codebase to support this change

Reviewed By: kevin0571

Differential Revision: D17668253

fbshipit-source-id: 13db5ff4acb37b338e291ca2dd7d67cd25dbc6d2
2019-10-02 08:20:00 -07:00
Andres Suarez
c4c5d453c2 Fix license headers
Reviewed By: scottrice

Differential Revision: D17673481

fbshipit-source-id: 1794e0a6e92e6894b5634b24c6e7910847616261
2019-09-30 15:10:17 -07:00
Roman Gorbunov
eff95991c6 Moving SKHighlightOverlay
Summary: Moving FlipperKitLayoutPlugin/FlipperKitPluginUtils/SKHighlightOverlay to shared folder, so Layout and WorkingRange plugins can depend on it

Reviewed By: kevin0571

Differential Revision: D17156396

fbshipit-source-id: 3f17371f2ab4818924d61e6cfb243f60ad1f2892
2019-09-05 07:31:23 -07:00
Oleksii Dykan
dbf0e3db43 Add size prop to layout inspector
Summary: Size is passed as a prop to every `CKComponent` and `CKFlexboxChild`. It is useful to see where it was set exactly

Reviewed By: kevin0571

Differential Revision: D16688496

fbshipit-source-id: 5f8dc39a967ab2d7d89d6a37a8152aa6b59db220
2019-08-07 10:24:19 -07:00
Roman Gorbunov
00e8f43e37 Improvement of live editing
Summary:
Live editing is now working faster.
We had an issue that it took about 5 seconds to see the view changed and 10 seconds to see tha value in the flipper, now it's done immidiately

Reviewed By: priteshrnandgaonkar

Differential Revision: D16500961

fbshipit-source-id: 742ce628a887bab06c1b883d9710c477af2508e7
2019-07-31 03:13:38 -07:00