-
Notifications
You must be signed in to change notification settings - Fork 1
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
RNMT-3515 Listen to 2-finger long press and open ECT #12
Conversation
To avoid a breaking change, this feature will live side-by-side with the old code and only run on applications which were built on MABS 6 and above and thus only target SDK 29 and onwards, which provides the required version of the Broadcaster plugin. The breaking change would manifest due to the lack of proper release segmentation on this asset. Since this plugin always injected at the latest version of the respective O<version> branch that means it is possible to have these changes running on an application built with MABS < 6. References https://outsystemsrd.atlassian.net/browse/RNMT-3515
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't there some preferences that allow the target SDK to change? These preferences can't change every value (hence the patches for MABS 6) but I'm not sure if they can change the target SDK.
If that is the case, we can break builds in every MABS version.
Avoids potential NPE. References https://outsystemsrd.atlassian.net/browse/RNMT-3515
There are preferences that can change the This check just ensure that this code does not run when the We could try leverage the |
I was just raising the flag regarding the android-targetSdkVersion preference. From what I understand the validations implemented in the supported plugins for the universal versions took this preference into consideration. I'd prefer if @Chuckytuh could chime in this thread. Regarding alternatives I'm not seeing much. My only guess would be using reflection to see if one of the new classes exists but it's quite ugly and "depends" on knowledge of another plugin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have a breaking change here 😞 check my comments below, please.
} | ||
if ((System.currentTimeMillis() - mSecondFingerTimeDown) >= INTERVAL_TO_SHOW_MENU) { | ||
mSecondFingerTimeDown = 0; | ||
if(cordovaActivity.getApplicationInfo().targetSdkVersion >= 29) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Houston, I think we have a breaking change here.
Although this is protected with the targetSdkVersion for the runtime, I'm not sure if this will build with previous MABS Versions 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After looking better I believe you are correct. There is a breaking change on the Constants
import from the Broadcaster. The constants used here (e.g. Constants.GESTURE_EVENT
) do not exist in older MABS versions (more specifically older Broadcaster versions) and will cause a compile-time error when using this App Feedback commit/version.
A way to avoid this breaking change is to drop the Constants
import and replace the constants used here with their string literals, although if the respective values change on the Broadcaster Constants
class this code can suddenly stop working without visibility.
Regarding the Event
import from the Broadcaster there is no breaking change because all MABS versions dating back from 3.3 include the Broadcaster with this Event
interface and the getData()
method. Any MABS version using this App Feedback commit/version will compile. However this is creating a dependency that may break if the Event
interface is changed...
What are your thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The price to pay for not having versioning on this plugin 😞
Go ahead with that changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should aim to have the plugins backwards compatibility with other MABS versions, in this case, it's more justified because we don't have versioning for this plugin. That being said, I agree with @luissilvaos to implement those changes.
@EiyuuZack what are we trying to achieve here? Is the new mechanism (with Broadcast Receiver) just to be used when running on Android 10 or when we compile the application with targetSdkVersion to 29? If we're just trying to understand whether the application is running on Android 10 than we should be using https://developer.android.com/reference/android/os/Build.VERSION.html#SDK_INT . |
@Chuckytuh this should run in all MABS 6 builds. It should not run in MABS 5- builds. The code that supports this is in the broadcaster plugin, but only in MABS 6. Therefore older builds should use the currently existing touch handler while newer builds should use this new code. |
We do not want this to run just because an app is running on Android 10. We want to run this new code when the app has been built targeting Android 10 (API 29). |
This would cause a breaking change due to the way this plugin is (not) versioned. Bear in mind that these constants still mirror the ones in the Broadcaster plugin and should any of these be modified there such changes must be reflected here, lest this code start failing suddenly. References https://outsystemsrd.atlassian.net/browse/RNMT-3515
This fix is twofold: 1) Unregisters the receiver which was not being done at all 2) Moves the register/unregister calls to the onStart and onStop lifecycle callbacks as per Android best practices References https://outsystemsrd.atlassian.net/browse/RNMT-3515
20ef2ca
Description
Following https://github.com/OutSystems/cordova-outsystems-broadcaster/pull/17, this PR makes the App Feedback subscribe to gesture events and react when a 2-finger long press is broadcast.
This will only hold true when targeting Android 10 (API 29), otherwise the old mechanism is used.
See the commit messages for more information.
Context
References https://outsystemsrd.atlassian.net/browse/RNMT-3515
Type of changes
Components affected
Tests
Manual tests
Screenshots (if appropriate)
Checklist