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

feat: add property "enableCopy" to TextField/TextArea #12657

Merged
merged 4 commits into from Jun 7, 2021

Conversation

jquick-axway
Copy link
Contributor

@jquick-axway jquick-axway commented Mar 25, 2021

JIRA:
https://jira.appcelerator.org/browse/TIMOB-25705

Summary:

  • Added new boolean property "enableCopy" to TextField/TextArea.
  • Defaults to true.
  • Setting to false will do the following...
    • Remove menu items: copy, cut, share
    • Ignores Command+C and Command+X keyboard operations.
  • Intended to improve security by preventing personal info from being copied.

Note:
On Android, we can't remove the copy and cut options from the virtual keyboard's "Text Editing" section or the landscape fullscreen context menu... but we can block the copy/cut actions from working.


TextField Test:
(Run below test on iOS, Android 5.0, and Android 11.)

  1. Build and run TextFieldDisableCopyTest.js attached to TIMOB-25705.
  2. Tap on the 1st text field, select the text, and tap-and-hold.
  3. Verify context menu does show "copy" and "cut" options.
  4. Tap on the 3rd text field, select the text, and tap-and-hold.
  5. Verify context menu does NOT show "copy", "cut", or "share" options.
  6. Tap on the 4th text field (it's a password field), select the text, and tap-and-hold.
  7. Verify context menu does NOT show "copy", "cut", or "share" options.

TextArea Test:
(Run below test on iOS, Android 5.0, and Android 11.)

  1. Build and run TextAreaDisableCopyTest.js attached to TIMOB-25705.
  2. Tap on the 1st text area, select the text, and tap-and-hold.
  3. Verify context menu does show "copy" and "cut" options.
  4. Tap on the 2nd text area, select the text, and tap-and-hold.
  5. Verify context menu does NOT show "copy", "cut", or "share" options.

Bonus Test:
There is a TextFieldKeyboardAdvancedTest.js script attached to TIMOB-25705 which makes it easy to test various combinations of text field options for ad-hoc testing.

@jquick-axway jquick-axway added ios android feature backport 10_2_X when applied, PRs with this label will get an auto-generated backport to 10_2_X branch on merge labels Mar 25, 2021
@jquick-axway jquick-axway added this to the 10.1.0 milestone Mar 25, 2021
@build build requested review from a team March 25, 2021 03:00
@build build added the docs label Mar 25, 2021
@build
Copy link
Contributor

build commented Mar 25, 2021

Fails
🚫 Tests have failed, see below for more information.
Messages
📖 ✊ The commits in this PR match our conventions! Feel free to Rebase and Merge this PR when ready.
📖 ❌ 6 tests have failed There are 6 tests failing and 957 skipped out of 15473 total tests.
📖

💾 Here's the generated SDK zipfile.

Tests:

ClassnameNameTimeError
android.emulator.Titanium.UI.ScrollViewcontentOffset (5.0.2)0.258
Error: Uncaught Uncaught AssertionError
ios.ipad.Titanium.Network.HTTPClient#timeoutForResource (14.4.0)0.001
Error: onload shouldn't fire. Resource request timeout should reach before transferring entire resource.
file:///Users/build/Library/Developer/CoreSimulator/Devices/D5325D35-8512-4A56-BF9A-970E14891CB0/data/Containers/Bundle/Application/1CB2AB8F-0E8F-4BD2-A5AD-C5794893CCDB/mocha.app/ti.network.httpclient.test.js:810:40
ios.ipad.Titanium.Network.HTTPClientresponseHeaders (14.4.0)59.999
Error: Timeout of 60000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (app.js)
ios.macos.Titanium.Network.HTTPClient#timeoutForResource (10.15.5)0.001
Error: onload shouldn't fire. Resource request timeout should reach before transferring entire resource.
file:///Users/build/jenkins/workspace/ium-sdk_titanium_mobile_PR-12657/tmp/mocha/build/iphone/build/Products/Debug-maccatalyst/mocha.app/Contents/Resources/ti.network.httpclient.test.js:810:40
ios.macos.Titanium.Network.HTTPClientresponseHeaders (10.15.5)60.063
Error: Timeout of 60000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (app.js)
ios.macos.Titanium.Network.HTTPClientTIMOB-23214 (10.15.5)60
Error: Timeout of 60000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (app.js)

Generated by 🚫 dangerJS against 756613f

Copy link
Contributor

@garymathews garymathews left a comment

Choose a reason for hiding this comment

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

Android CR: PASS

Copy link
Contributor

@vijaysingh-axway vijaysingh-axway left a comment

Choose a reason for hiding this comment

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

iOS changes looks good!

@lokeshchdhry
Copy link
Contributor

lokeshchdhry commented Jun 3, 2021

@jquick-axway , The changes does not seem to be working on Android 5.1 API 22.
For copy enabled textfield or text area I do not get a copy option, only paste. So basically I cant copy the text.

@jquick-axway
Copy link
Contributor Author

@lokeshchdhry, are you sure you don't see a "copy" option in the top toolbar? The popup menu won't show the "copy" option for me either on Android 5.x, but the same is true in Google's own apps like Messaging. Basically, we can't control where the Android OS puts these options (in a popup or toolbar), but they are there for me.

@lokeshchdhry
Copy link
Contributor

@jquick-axway , Alright makes sense. I see the copy option in the tool bar. Was not sure if popup should be an option.

@lokeshchdhry
Copy link
Contributor

FR Passed.

@sgtcoolguy sgtcoolguy merged commit 6dcfcac into tidev:master Jun 7, 2021
@build
Copy link
Contributor

build commented Jun 7, 2021

The backport to 10_0_X failed:

The process 'git' failed with exit code 128

Check the run for full details
To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Check out the target branch
git checkout 10_0_X
# Make sure it's up to date
git pull
# Check out your branch
git checkout -b backport-12657-to-10_0_X
# Apply the commits from the PR
curl -s https://github.com/appcelerator/titanium_mobile/commit/63bd9103714be6cb52468cc6fda71a1a9ab4452b.patch | git am -3 --ignore-whitespace
# Push it to GitHub
git push --set-upstream origin backport-12657-to-10_0_X

Then, create a pull request where the base branch is 10_0_X and the compare/head branch is backport-12657-to-10_0_X.

@ewanharris ewanharris removed the backport 10_2_X when applied, PRs with this label will get an auto-generated backport to 10_2_X branch on merge label Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants