Skip to content

issue 283 reenable contact search#617

Merged
tomholub merged 15 commits intomasterfrom
issue-283-search-contacts
Oct 11, 2021
Merged

issue 283 reenable contact search#617
tomholub merged 15 commits intomasterfrom
issue-283-search-contacts

Conversation

@tomholub
Copy link
Collaborator

@tomholub tomholub commented Oct 5, 2021

This PR re-enables contact search so that we can make a video for Google oAuth verification process.

close #283


Tests (delete all except exactly one):

  • Tests will be added later

To be filled by reviewers

I have reviewed that this PR... (tick whichever items you personally focused on during this review):

  • addresses the issue it closes (if any)
  • code is readable and understandable
  • is accompanied with tests, or tests are not needed
  • is free of vulnerabilities
  • is documented clearly and usefully, or doesn't need documentation

@tomholub
Copy link
Collaborator Author

tomholub commented Oct 5, 2021

@sosnovsky could you please help me look into this tomorrow? I've re-enabled functionality that was disabled for a long time and the presentation logic probably conflicts with the current app layout.

To test: 1) log out 2) log in and proceed regardless of the warning during grant 3) compose new message 4) start typing into recipient field

@sosnovsky
Copy link
Collaborator

Yes, I'll check it tomorrow

@sosnovsky
Copy link
Collaborator

I found other issues with contacts functionality - it worked well, but after some time all contacts API requests returned 401 error:

Optional("{\n  \"error\": {\n    \"code\": 401,\n    \"message\": \"Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.\",\n    \"status\": \"UNAUTHENTICATED\"\n  }\n}\n")
Optional(<NSHTTPURLResponse: 0x600001b52fa0> { URL: https://www.google.com/m8/feeds/contacts/default/thin?q=A&v=3.0&alt=json&access_token...

I logout and then logged in again to get new token and now contacts requests give 400 error with such message:

Contacts API is being deprecated. Migrate to People API to retain programmatic access to Google Contacts. See https://developers.google.com/people/contacts-api-migration.

This link says The Contacts API is deprecated and is schedule for sunset on June 15, 2021. Apps should instead use the People API., so we need to migrate our code to new People API to make it work.

@tomholub
Copy link
Collaborator Author

tomholub commented Oct 6, 2021

hm. do they require the same oauth scope? Or different? (contacts vs people)

@sosnovsky
Copy link
Collaborator

contacts scope should be enough

Screenshot 2021-10-06 at 16 39 32

@tomholub
Copy link
Collaborator Author

tomholub commented Oct 6, 2021

Good. Please see if People can be used. Last time I tried, the API wasn't useful - it didn't allow me to search people and get their email addresses. Maybe I overlooked, or it changed since.

@tomholub
Copy link
Collaborator Author

tomholub commented Oct 6, 2021

Not sure if still relevant

dyld4 config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unexpected nil element for willDisplayCell: <_ASTableViewCell: 0x11e243990; baseClass = UITableViewCell; frame = (0 174.333; 320 0); autoresize = W; layer = <CALayer: 0x2800c9ba0>>, <ASTableView: 0x107a4d000; baseClass = UITableView; frame = (0 0; 320 693); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x280e0aee0>; layer = <FlowCryptUI.TableNode-Layer: 0x281595340; node = <FlowCryptUI.TableNode: 0x1079c1c00>>; contentOffset: {0, -87}; contentSize: {320, 263}; adjustedContentInset: {87, 0, 37, 0}; dataSource: <ASTableViewProxy: 0x2807e9e40>>, <NSIndexPath: 0x84260b1799598112> {length = 2, path = 1 - 3}'
terminating with uncaught exception of type NSException
(lldb) 

@sosnovsky
Copy link
Collaborator

@tomholub I receive such error when trying to use People API:

People API has not been used in project 679326713487 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/people.googleapis.com/overview?project=679326713487 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

Can you please check if it's enabled for FlowCrypt project?

@tomholub
Copy link
Collaborator Author

tomholub commented Oct 6, 2021

Just enabled it 👍

image

@sosnovsky sosnovsky marked this pull request as ready for review October 10, 2021 20:52
@sosnovsky
Copy link
Collaborator

sosnovsky commented Oct 10, 2021

@tomholub I updated code to use Google People API for searching contacts, but can't assign you as reviewer for this PR.
And currently I have only 1 another issue assigned to me - #553

@tomholub
Copy link
Collaborator Author

Excellent! Please do #553 next. I'll assign some more now.

I'll review this on Tuesday (afk on Monday unfortunately).

Copy link
Collaborator Author

@tomholub tomholub left a comment

Choose a reason for hiding this comment

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

Code looks good, will test functionality tomorrow.

Copy link
Collaborator Author

@tomholub tomholub left a comment

Choose a reason for hiding this comment

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

Looks good. But somehow it finds very, very few recipients (unlike when trying in gmail). We'll look into that some other day. Thanks!

@tomholub tomholub merged commit 346478f into master Oct 11, 2021
@tomholub tomholub deleted the issue-283-search-contacts branch October 11, 2021 19:56
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.

re-enable search contacts/recipietns on google once oauth permissions approved

3 participants