Skip to content

Conversation

prashantsaini1
Copy link
Contributor

  • This PR reverts the method removeOnLifecycleEventListener return type which was earlier void but changed to boolean in another PR here.
  • It also reverts all other similar methods return type for consistency (though all other methods were newly added).

It allows modules, compiled with older SDKs (<= 12.6.4), to run on newer SDK versions with the another PR merged.

Copy link
Contributor

@m1ga m1ga left a comment

Choose a reason for hiding this comment

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

LGTM.

Which module was causing issues here?

@prashantsaini1
Copy link
Contributor Author

prashantsaini1 commented Apr 10, 2025

The latest Android code of ti.bottomsheet module which uses removeOnLifecycleEventListener.

  • It will crash the app if we compile the module with <= 12.6.4.GA but build the app with the latest ti-sdk master (12.7.0) as the signatures will be different in this case.
  • However, using the same SDK version to compile both the module and the apps will be fine.

@m1ga
Copy link
Contributor

m1ga commented Apr 10, 2025

Ah ok. I was scanning through some Ti modules and didn't find it in there. Still strange because you are not using the return value so in my opinion it should call the same method. But glad this fixes it

@prashantsaini1
Copy link
Contributor Author

prashantsaini1 commented Apr 10, 2025

Whether or not we use the return value, at compilation of the module the Java Class will be used based on the SDK version which will differ in return type for different SDK versions without this PR.

@m1ga
Copy link
Contributor

m1ga commented Apr 10, 2025

I see, just tested it and can confirm:

No virtual method removeOnLifecycleEventListener(Lorg/appcelerator/titanium/TiLifecycle$OnLifecycleEvent;)V in class Lorg/appcelerator/titanium/TiBaseActivity; or its super classes (declaration of 'org.appcelerator.titanium.TiBaseActivity'

with this changes it works again.

Side note: you might want to update the Calling .toColor() without Context parameter is deprecated in your module.

@prashantsaini1
Copy link
Contributor Author

Yes, that's the crash error. Thanks for the hint on toColor, just pushed it too.

However, I think that we should use current-activity context if available, otherwise the TiApplication context in the SDK itself to make it backward compatible and remove that deprecated warning. Reason being that majority of the use cases will rely on the current activity context. What do you think?

e.g.

Configuration config;

if (context != null) {
    config = context.getResources().getConfiguration();
} else if (TiApplication.getAppCurrentActivity() != null) {
    config = TiApplication.getAppCurrentActivity().getResources().getConfiguration();
} else {
    config = TiApplication.getInstance().getResources().getConfiguration();
}

@m1ga
Copy link
Contributor

m1ga commented Apr 10, 2025

The deprecation note is a preparation of this PR #13273
But I don't have any more details about that PR. I just know it will break all modules that don't use the new toColor way. But I think most first party modules are update by now.

@prashantsaini1
Copy link
Contributor Author

@m1ga Thanks. @hansemannn We can merge this PR now.

@hansemannn hansemannn merged commit be955f6 into tidev:master Apr 12, 2025
5 checks passed
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