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

(refactor): kotlin-ify ShareModuleTest.java #37746

Closed

Conversation

siddarthkay
Copy link
Contributor

@siddarthkay siddarthkay commented Jun 7, 2023

Summary:

This PR converts the java logic inside of ShareModuleTest.java to Kotlin as requested in #37708
We also swap ShareModuleTest.java for ShareModuleTest.kt

Changelog:

[Internal][Changed]: Convert ShareModuleTest to Kotlin

Test Plan:

./gradlew :packages:react-native:ReactAndroid:test must pass and CI must be green

Screenshot of passing tests locally

Screenshot 2023-06-07 at 1 32 22 PM

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 7, 2023
@Pranav-yadav Pranav-yadav added the Tests This PR adds or edits a test case. label Jun 7, 2023
@siddarthkay siddarthkay marked this pull request as draft June 7, 2023 05:39
@siddarthkay siddarthkay force-pushed the refactor/share-module-test-kotlin branch from 3d490a0 to 36ab3a4 Compare June 7, 2023 08:02
@siddarthkay siddarthkay marked this pull request as ready for review June 7, 2023 08:03
@analysis-bot
Copy link

analysis-bot commented Jun 7, 2023

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,744,364 -58
android hermes armeabi-v7a 8,056,578 -49
android hermes x86 9,235,498 -50
android hermes x86_64 9,086,317 -64
android jsc arm64-v8a 9,306,971 -293
android jsc armeabi-v7a 8,496,503 -307
android jsc x86 9,368,975 -308
android jsc x86_64 9,623,886 -317

Base commit: 08dc0a6
Branch: main

@facebook-github-bot
Copy link
Contributor

@rshest has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@cortinico cortinico left a comment

Choose a reason for hiding this comment

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

Thanks for sending this @siddarthkay

I've left a minor nit that needs to be addressed before we can merge this. Thanks for doing this work.

Comment on lines 34 to 35
private var activity: Activity? = null
private var shareModule: ShareModule? = null
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private var activity: Activity? = null
private var shareModule: ShareModule? = null
private lateinit var activity: Activity
private lateinit var shareModule: ShareModule


val promise = SimplePromise()

shareModule?.share(content, dialogTitle, promise)
Copy link
Contributor

Choose a reason for hiding this comment

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

If you use lateinit, all those ?. can go

@siddarthkay
Copy link
Contributor Author

@cortinico : Thanks for teaching me something new about Kotlin :)
I've addressed the changes in 3160cc9

@facebook-github-bot
Copy link
Contributor

@rshest has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

Copy link
Contributor

@cortinico cortinico left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jun 7, 2023
@facebook-github-bot
Copy link
Contributor

@rshest merged this pull request in e1206da.

adamaveray added a commit to adamaveray/react-native that referenced this pull request Jun 8, 2023
* main: (1824 commits)
  Convert FallbackJSBundleLoaderTest to Kotlin (facebook#37750)
  Migrate JSPackagerClientTest to Kotlin (facebook#37747)
  (refactor): kotlin-ify `ShareModuleTest.java` (facebook#37746)
  Upgrade `@react-native/codegen-typescript-test`'s Jest dependency to Jest 29 (facebook#37745)
  Move flow-typed definitions to repo root (facebook#37636)
  Convert InterpolatorTypeTest to Kotlin (facebook#37724)
  Update documentation of ReactHost.reload method (facebook#37691)
  Reduce visibility of ReactHost.destroy() method (facebook#37693)
  Reduce visibility in React Context (facebook#37695)
  Remove InstanceHandleHelper as unused (facebook#37740)
  Convert CompositeReactPackageTest to Kotlin (facebook#37734)
  Add license header to SetSpanOperation.java
  Convert FakeEventDispatcher to kotlin (facebook#37739)
  Convert FakeRCTEventEmitter to Kotlin (facebook#37733)
  Convert InteropModuleRegistryTest to Kotlin (facebook#37735)
  Bump `autorebase.yml` to `v1.8` (facebook#37584)
  Convert StackTraceHelperTest to Kotlin (facebook#37741)
  Convert BlobModuleTest class to Kotlin (facebook#37719)
  Update prettier to v2.8.8 (facebook#37738)
  Introduce BoltsFutureTask class to avoid leaking bolts.Task into ReactHost API (facebook#37744)
  ...

# Conflicts:
#	BUCK
#	packages/react-native/React/Views/UIResponder+FirstResponder.h
#	packages/react-native/React/Views/UIResponder+FirstResponder.m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Tests This PR adds or edits a test case.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants