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

[7947] Feature: Blank out app preview screen when switching apps on m… #8009

Merged
merged 1 commit into from
May 22, 2019
Merged

Conversation

bitsikka
Copy link
Contributor

@bitsikka bitsikka commented Apr 22, 2019

Fixes #7947

Notes: #8009 (comment)

status: ready

@bitsikka
Copy link
Contributor Author

Tested only in iOS simulator so far

@status-im-auto
Copy link
Member

status-im-auto commented Apr 22, 2019

Jenkins Builds

Click to see older builds (54)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 95fc453 #1 2019-04-22 08:42:51 ~12 min macos 📦 dmg
✔️ 95fc453 #1 2019-04-22 08:48:34 ~18 min linux 📦 App
✔️ 95fc453 #1 2019-04-22 08:49:28 ~19 min android-e2e 📦 apk
✔️ 95fc453 #1 2019-04-22 08:49:58 ~19 min windows 📦 exe
✔️ 95fc453 #1 2019-04-22 08:55:14 ~25 min ios 📦 ipa
✔️ 95fc453 #2 2019-04-29 17:38:31 ~15 min android 📦 apk
✔️ a77c004 #2 2019-05-08 16:05:30 ~17 min macos 📦 dmg
✔️ a77c004 #2 2019-05-08 16:12:12 ~24 min ios 📦 ipa
✔️ a77c004 #2 2019-05-08 16:28:02 ~40 min windows 📦 exe
✔️ a77c004 #2 2019-05-08 16:31:35 ~43 min linux 📦 App
✔️ a77c004 #2 2019-05-08 16:35:40 ~48 min android-e2e 📦 apk
✔️ a77c004 #3 2019-05-08 16:35:57 ~48 min android 📦 apk
✔️ f684a01 #3 2019-05-08 22:19:46 ~16 min macos 📦 dmg
✔️ f684a01 #3 2019-05-08 22:19:59 ~16 min linux 📦 App
✔️ f684a01 #4 2019-05-08 22:20:41 ~17 min android 📦 apk
✔️ f684a01 #3 2019-05-08 22:20:50 ~17 min android-e2e 📦 apk
✔️ f684a01 #3 2019-05-08 22:23:27 ~20 min windows 📦 exe
✔️ f684a01 #3 2019-05-08 22:30:23 ~27 min ios 📦 ipa
7497d68 #4 2019-05-09 09:40:20 ~5 min macos 📄 log
7497d68 #4 2019-05-09 09:40:29 ~5 min ios 📄 log
7497d68 #4 2019-05-09 09:41:30 ~6 min linux 📄 log
7497d68 #4 2019-05-09 09:41:58 ~7 min windows 📄 log
7497d68 #4 2019-05-09 09:42:42 ~8 min android-e2e 📄 log
7497d68 #5 2019-05-09 09:43:33 ~8 min android 📄 log
✔️ 8c57ac5 #5 2019-05-09 11:05:48 ~29 min macos 📦 dmg
✔️ 8c57ac5 #5 2019-05-09 11:10:15 ~33 min ios 📦 ipa
✔️ 8c57ac5 #6 2019-05-09 11:12:49 ~36 min android 📦 apk
✔️ 8c57ac5 #5 2019-05-09 11:16:05 ~39 min linux 📦 App
✔️ 8c57ac5 #5 2019-05-09 11:19:58 ~43 min windows 📦 exe
✔️ 8c57ac5 #5 2019-05-09 11:32:02 ~55 min android-e2e 📦 apk
✔️ 6fcccc4 #6 2019-05-14 21:59:46 ~18 min linux 📦 App
✔️ 6fcccc4 #7 2019-05-14 21:59:50 ~18 min android 📦 apk
✔️ 6fcccc4 #6 2019-05-14 21:59:53 ~18 min windows 📦 exe
✔️ 6fcccc4 #6 2019-05-14 22:00:22 ~18 min android-e2e 📦 apk
✔️ 6fcccc4 #6 2019-05-14 22:00:25 ~18 min macos 📦 dmg
✔️ 6fcccc4 #6 2019-05-14 22:04:10 ~22 min ios 📦 ipa
✔️ ef66f82 #7 2019-05-17 16:59:41 ~15 min linux 📦 App
✔️ ef66f82 #7 2019-05-17 17:02:24 ~17 min macos 📦 dmg
✔️ ef66f82 #7 2019-05-17 17:02:37 ~17 min windows 📦 exe
✔️ ef66f82 #7 2019-05-17 17:05:27 ~21 min android-e2e 📦 apk
✔️ ef66f82 #8 2019-05-17 17:05:52 ~21 min android 📦 apk
✔️ ef66f82 #7 2019-05-17 17:08:37 ~24 min ios 📦 ipa
✔️ 8b8f96d #8 2019-05-20 11:12:03 ~17 min macos 📦 dmg
✔️ 8b8f96d #8 2019-05-20 11:13:46 ~19 min linux 📦 App
✔️ 8b8f96d #8 2019-05-20 11:13:55 ~19 min windows 📦 exe
✔️ 8b8f96d #8 2019-05-20 11:17:02 ~22 min ios 📦 ipa
✔️ 8b8f96d #9 2019-05-20 11:19:17 ~24 min android 📦 apk
✔️ 8b8f96d #8 2019-05-20 11:20:19 ~26 min android-e2e 📦 apk
✔️ 28a647e #9 2019-05-20 13:46:17 ~20 min macos 📦 dmg
✔️ 28a647e #9 2019-05-20 13:49:22 ~24 min ios 📦 ipa
✔️ 28a647e #10 2019-05-20 13:51:45 ~26 min android 📦 apk
✔️ 28a647e #9 2019-05-20 13:55:17 ~29 min linux 📦 App
✔️ 28a647e #9 2019-05-20 13:55:35 ~30 min android-e2e 📦 apk
✔️ 28a647e #9 2019-05-20 14:05:46 ~40 min windows 📦 exe
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 0a7a420 #10 2019-05-22 00:30:45 ~15 min linux 📦 App
✔️ 0a7a420 #10 2019-05-22 00:33:13 ~17 min macos 📦 dmg
✔️ 0a7a420 #10 2019-05-22 00:36:04 ~20 min android-e2e 📦 apk
✔️ 0a7a420 #10 2019-05-22 00:38:03 ~22 min windows 📦 exe
✔️ 0a7a420 #10 2019-05-22 00:38:29 ~23 min ios 📦 ipa
✔️ 0a7a420 #11 2019-05-22 00:39:44 ~24 min android 📦 apk
✔️ cabf04c #11 2019-05-22 11:09:42 ~16 min linux 📦 App
✔️ cabf04c #11 2019-05-22 11:10:07 ~17 min macos 📦 dmg
✔️ cabf04c #11 2019-05-22 11:12:31 ~19 min windows 📦 exe
✔️ cabf04c #11 2019-05-22 11:15:00 ~22 min ios 📦 ipa
✔️ cabf04c #12 2019-05-22 11:16:34 ~23 min android 📦 apk
✔️ cabf04c #11 2019-05-22 11:16:54 ~24 min android-e2e 📦 apk

@statustestbot
Copy link

100% of end-end tests have passed

Total executed tests: 48
Failed tests: 0
Passed tests: 48

Passed tests (48)

Click to expand
1. test_block_user_from_public_chat
Device sessions

2. test_filters_from_daap
Device sessions

3. test_copy_and_paste_messages
Device sessions

4. test_send_transaction_from_daap
Device sessions

5. test_request_and_receive_tokens_in_1_1_chat
Device sessions

6. test_deploy_contract_from_daap
Device sessions

7. test_public_chat_messaging
Device sessions

8. test_password_in_logcat_sign_in
Device sessions

9. test_text_message_1_1_chat
Device sessions

10. test_add_to_contacts
Device sessions

11. test_sign_typed_message (TestRail link is not found)
Device sessions

12. test_unread_messages_counter_1_1_chat
Device sessions

13. test_logcat_send_transaction_from_daap
Device sessions

14. test_send_message_in_group_chat
Device sessions

15. test_logcat_send_transaction_from_wallet
Device sessions

16. test_send_token_with_7_decimals
Device sessions

17. test_modify_transaction_fee_values
Device sessions

18. test_send_eth_from_wallet_to_address
Device sessions

19. test_manage_assets
Device sessions

20. test_logcat_send_transaction_in_1_1_chat
Device sessions

21. test_request_and_receive_eth_in_1_1_chat
Device sessions

22. test_swipe_to_delete_public_chat
Device sessions

23. test_send_emoji
Device sessions

24. test_search_chat_on_home
Device sessions

25. test_logcat_recovering_account
Device sessions

26. test_messaging_in_different_networks
Device sessions

27. test_send_tokens_in_1_1_chat
Device sessions

28. test_network_mismatch_for_send_request_commands
Device sessions

29. test_logcat_sign_message_from_daap
Device sessions

30. test_swipe_to_delete_1_1_chat
Device sessions

31. test_switch_users_and_add_new_account
Device sessions

32. test_send_stt_from_wallet
Device sessions

33. test_send_eth_in_1_1_chat
Device sessions

34. test_login_with_new_account
Device sessions

35. test_send_eth_from_wallet_to_contact
Device sessions

36. test_add_contact_from_public_chat
Device sessions

37. test_send_two_transactions_one_after_another_in_dapp
Device sessions

38. test_password_in_logcat_creating_account
Device sessions

39. test_backup_recovery_phrase
Device sessions

40. test_offline_status
Device sessions

41. test_open_google_com_via_open_dapp
Device sessions

42. test_unread_messages_counter_public_chat
Device sessions

43. test_sign_message_from_daap
Device sessions

44. test_user_can_remove_profile_picture
Device sessions

45. test_share_contact_code_and_wallet_address
Device sessions

46. test_request_eth_in_wallet
Device sessions

47. test_refresh_button_browsing_app_webview
Device sessions

48. test_backup_recovery_phrase_warning_from_wallet
Device sessions

@status-github-bot
Copy link

Pull Request Checklist

  • Have you updated the documentation, if impacted (e.g. docs.status.im)?

@statustestbot
Copy link

100% of end-end tests have passed

Total executed tests: 48
Failed tests: 0
Passed tests: 48

Passed tests (48)

Click to expand
1. test_block_user_from_public_chat
Device sessions

2. test_filters_from_daap
Device sessions

3. test_copy_and_paste_messages
Device sessions

4. test_send_transaction_from_daap
Device sessions

5. test_request_and_receive_tokens_in_1_1_chat
Device sessions

6. test_deploy_contract_from_daap
Device sessions

7. test_public_chat_messaging
Device sessions

8. test_password_in_logcat_sign_in
Device sessions

9. test_text_message_1_1_chat
Device sessions

10. test_add_to_contacts
Device sessions

11. test_sign_typed_message (TestRail link is not found)
Device sessions

12. test_unread_messages_counter_1_1_chat
Device sessions

13. test_logcat_send_transaction_from_daap
Device sessions

14. test_send_message_in_group_chat
Device sessions

15. test_logcat_send_transaction_from_wallet
Device sessions

16. test_send_token_with_7_decimals
Device sessions

17. test_modify_transaction_fee_values
Device sessions

18. test_send_eth_from_wallet_to_address
Device sessions

19. test_manage_assets
Device sessions

20. test_logcat_send_transaction_in_1_1_chat
Device sessions

21. test_request_and_receive_eth_in_1_1_chat
Device sessions

22. test_swipe_to_delete_public_chat
Device sessions

23. test_send_emoji
Device sessions

24. test_search_chat_on_home
Device sessions

25. test_logcat_recovering_account
Device sessions

26. test_messaging_in_different_networks
Device sessions

27. test_send_tokens_in_1_1_chat
Device sessions

28. test_network_mismatch_for_send_request_commands
Device sessions

29. test_logcat_sign_message_from_daap
Device sessions

30. test_swipe_to_delete_1_1_chat
Device sessions

31. test_switch_users_and_add_new_account
Device sessions

32. test_send_stt_from_wallet
Device sessions

33. test_send_eth_in_1_1_chat
Device sessions

34. test_login_with_new_account
Device sessions

35. test_send_eth_from_wallet_to_contact
Device sessions

36. test_add_contact_from_public_chat
Device sessions

37. test_send_two_transactions_one_after_another_in_dapp
Device sessions

38. test_password_in_logcat_creating_account
Device sessions

39. test_backup_recovery_phrase
Device sessions

40. test_offline_status
Device sessions

41. test_open_google_com_via_open_dapp
Device sessions

42. test_unread_messages_counter_public_chat
Device sessions

43. test_sign_message_from_daap
Device sessions

44. test_user_can_remove_profile_picture
Device sessions

45. test_share_contact_code_and_wallet_address
Device sessions

46. test_request_eth_in_wallet
Device sessions

47. test_refresh_button_browsing_app_webview
Device sessions

48. test_backup_recovery_phrase_warning_from_wallet
Device sessions

src/status_im/ui/screens/views.cljs Outdated Show resolved Hide resolved
@yenda
Copy link
Contributor

yenda commented Apr 30, 2019

Have we considered this approach? https://stackoverflow.com/questions/9822076/how-do-i-prevent-android-taking-a-screenshot-when-my-app-goes-to-the-background

@bitsikka
Copy link
Contributor Author

Have we considered this approach? https://stackoverflow.com/questions/9822076/how-do-i-prevent-android-taking-a-screenshot-when-my-app-goes-to-the-background

didn't know about this.. sounds more robust
will check it out

@yenda yenda self-assigned this Apr 30, 2019
@rasom
Copy link
Contributor

rasom commented May 2, 2019

yep seems that on android we need to try FLAG_SECURE

https://developer.android.com/reference/android/view/Display.html#FLAG_SECURE
https://github.com/kristiansorens/react-native-flag-secure-android

@bitsikka
Copy link
Contributor Author

bitsikka commented May 3, 2019

yep seems that on android we need to try FLAG_SECURE

https://developer.android.com/reference/android/view/Display.html#FLAG_SECURE
https://github.com/kristiansorens/react-native-flag-secure-android

Thanks @rasom @yenda for the pointers

I barely got my development machine in order after having it being broken more than a week ago.

I am hardly familiar with lower React-Native / Android development / Java areas, but this will give me a chance to get to know it

Going to do the due diligence and make a proper implementation soon

Please bare with me

@bitsikka
Copy link
Contributor Author

bitsikka commented May 8, 2019

@flexsurfer @yenda @rasom

Changed the implementation as guided using FLAG_SECURE in android. Additionally, used SharedPreferences/NSUserDefaults to persist flag setting - additions are made to Status native-module.

@corpetty includes bonus (user setting) as requested

Tested in iOS Simulator and Android-avd:

  • tested preview is blank by default
  • tested preview is blank/not-blank according to user setting
  • tested preview setting persists through app re-starts

Notes:

  • in Android (when preview privacy mode is on) prevents screen capture in non preview screen as well
  • in iOS does not prevent screen capture
  • in iOS if there is keyboard showing at the time of putting app to background, keyboard renders in preview above blank screen

@flexsurfer flexsurfer requested review from mandrigin, rasom and yenda and removed request for yenda and rasom May 14, 2019 11:45
@flexsurfer
Copy link
Member

@rasom @yenda ping

@bitsikka bitsikka requested a review from a team as a code owner May 17, 2019 16:44
@flexsurfer flexsurfer requested review from mandrigin, rasom and yenda and removed request for mandrigin, rasom and yenda May 20, 2019 15:07
@flexsurfer
Copy link
Member

@mandrigin @rasom @yenda ping

Copy link
Contributor

@mandrigin mandrigin left a comment

Choose a reason for hiding this comment

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

a few small changes, good job otherwise!

ios/StatusIm/AppDelegate.m Outdated Show resolved Hide resolved
@bitsikka
Copy link
Contributor Author

@mandrigin updated PR with suggested changes.

Please note that at this point I am barely getting acquainted with Java and Objective-c and the implementation might still be sloppy. Hope the work is acceptable. If not, with feedback, still going to do what it takes.

Those (Java/Obj-c) parts have mostly been an adaptation(with prior knowledge of languages other than those) of code found in the interwebs; with finally reading documentations in the past 24 hrs :p. Sorry about that and thanks for baring with me.

Also definitely going to continue to spend some time acquiring knowledge on them for knowledge sake.

@statustestbot
Copy link

94% of end-end tests have passed

Total executed tests: 49
Failed tests: 3
Passed tests: 46

Failed tests (3)

Click to expand
1. test_public_chat_messaging

Device 2: Looking for message with text 'hello'
Device 2: Looking for an element by text: 'Today'

Device 2: 'BaseButton' is not found on the screen

Device sessions

2. test_add_to_contacts

Device 1: Tap on ChatMenuButton
Device 1: Tap on ViewProfileButton

An unknown server-side error occurred while processing the command. Original error: io.appium.uiautomator2.common.exceptions.TakeScreenshotException: Failed to capture a screenshot. Does the current view have 'secure' flag set? at io.appium.uiautoma

Device sessions

3. test_user_can_remove_profile_picture

Device 1: Looking for an element by text: 'DCIM'
Device 1: Tap on ConfirmEditButton

An unknown server-side error occurred while processing the command. Original error: io.appium.uiautomator2.common.exceptions.TakeScreenshotException: Failed to capture a screenshot. Does the current view have 'secure' flag set? at io.appium.uiautoma

Device sessions

Passed tests (46)

Click to expand
1. test_block_user_from_public_chat
Device sessions

2. test_filters_from_daap
Device sessions

3. test_copy_and_paste_messages
Device sessions

4. test_send_transaction_from_daap
Device sessions

5. test_request_and_receive_tokens_in_1_1_chat
Device sessions

6. test_deploy_contract_from_daap
Device sessions

7. test_open_transaction_on_etherscan
Device sessions

8. test_long_press_to_delete_1_1_chat
Device sessions

9. test_password_in_logcat_sign_in
Device sessions

10. test_text_message_1_1_chat
Device sessions

11. test_sign_typed_message (TestRail link is not found)
Device sessions

12. test_unread_messages_counter_1_1_chat
Device sessions

13. test_logcat_send_transaction_from_daap
Device sessions

14. test_send_message_in_group_chat
Device sessions

15. test_logcat_send_transaction_from_wallet
Device sessions

16. test_send_token_with_7_decimals
Device sessions

17. test_modify_transaction_fee_values
Device sessions

18. test_send_eth_from_wallet_to_address
Device sessions

19. test_manage_assets
Device sessions

20. test_logcat_send_transaction_in_1_1_chat
Device sessions

21. test_request_and_receive_eth_in_1_1_chat
Device sessions

22. test_long_press_to_delete_public_chat
Device sessions

23. test_send_emoji
Device sessions

24. test_search_chat_on_home
Device sessions

25. test_logcat_recovering_account
Device sessions

26. test_messaging_in_different_networks
Device sessions

27. test_send_tokens_in_1_1_chat
Device sessions

28. test_network_mismatch_for_send_request_commands
Device sessions

29. test_logcat_sign_message_from_daap
Device sessions

30. test_switch_users_and_add_new_account
Device sessions

31. test_send_stt_from_wallet
Device sessions

32. test_send_eth_in_1_1_chat
Device sessions

33. test_login_with_new_account
Device sessions

34. test_send_eth_from_wallet_to_contact
Device sessions

35. test_add_contact_from_public_chat
Device sessions

36. test_send_two_transactions_one_after_another_in_dapp
Device sessions

37. test_password_in_logcat_creating_account
Device sessions

38. test_backup_recovery_phrase
Device sessions

39. test_offline_status
Device sessions

40. test_open_google_com_via_open_dapp
Device sessions

41. test_unread_messages_counter_public_chat
Device sessions

42. test_sign_message_from_daap
Device sessions

43. test_share_contact_code_and_wallet_address
Device sessions

44. test_request_eth_in_wallet
Device sessions

45. test_refresh_button_browsing_app_webview
Device sessions

46. test_backup_recovery_phrase_warning_from_wallet
Device sessions

@bitsikka
Copy link
Contributor Author

An unknown server-side error occurred while processing the command. Original error: io.appium.uiautomator2.common.exceptions.TakeScreenshotException: Failed to capture a screenshot. Does the current view have 'secure' flag set? at io.appium.uiautoma

yes 'secure' flag is set

@antdanchenko @churik help! looks like e2e tests are going to have to be updated for this one as well

or the implementation is going to have to change if significant number of tests depend on capturing screenshot 🤔

@mandrigin
Copy link
Contributor

@bitsikka maybe we can have this option behind a build flag somehow? so it is disabled for e2e?

@mandrigin
Copy link
Contributor

@bitsikka or, easier, it should be false by default (it is true for Android in your code).

@bitsikka
Copy link
Contributor Author

bitsikka commented May 22, 2019

@bitsikka or, easier, it should be false by default (it is true for Android in your code).

yes, it is true by default for both Android and iOS(for iOS, just the blanking out in background state - not preventing screencap). @corpetty OP of the issue, requested it that it be so, and it made sense to do that, but we had no idea of this consequence

I'll make it false cause now, that also makes sense :)

@churik churik self-assigned this May 22, 2019
@statustestbot
Copy link

33% of end-end tests have passed

Total executed tests: 3
Failed tests: 2
Passed tests: 1

Failed tests (2)

Click to expand
1. test_add_to_contacts

Device 1: Tap on ChatMenuButton
Device 1: Tap on ViewProfileButton

An unknown server-side error occurred while processing the command. Original error: io.appium.uiautomator2.common.exceptions.TakeScreenshotException: Failed to capture a screenshot. Does the current view have 'secure' flag set? at io.appium.uiautoma

Device sessions

2. test_user_can_remove_profile_picture

Device 1: Looking for an element by text: 'DCIM'
Device 1: Tap on ConfirmEditButton

An unknown server-side error occurred while processing the command. Original error: io.appium.uiautomator2.common.exceptions.TakeScreenshotException: Failed to capture a screenshot. Does the current view have 'secure' flag set? at io.appium.uiautoma

Device sessions

Passed tests (1)

Click to expand
1. test_public_chat_messaging
Device sessions

@statustestbot
Copy link

100% of end-end tests have passed

Total executed tests: 2
Failed tests: 0
Passed tests: 2

Passed tests (2)

Click to expand
1. test_add_to_contacts
Device sessions

2. test_user_can_remove_profile_picture
Device sessions

@churik
Copy link
Member

churik commented May 22, 2019

Thanks, @bitsikka!

Tested IOS 11.4.1 (IPhone 7), Android 8 (LG V20):

  • going to background with wallet, chat screens, with popup, with opened keyboard, on login screen - preview is blanked out;
  • reopening app;

…obile

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
@flexsurfer flexsurfer merged commit d640b4c into status-im:develop May 22, 2019
@bitsikka bitsikka deleted the fix/#7947 branch May 22, 2019 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Feature: Blank out app preview screen when switching apps on mobile
8 participants