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

Invite and search users feature #144

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Conversation

bit-world
Copy link

that's better?

@grishka
Copy link
Owner

grishka commented Feb 23, 2021

  • Still has Russian strings from another pull request
  • The contact search part makes no sense. You query the content provider every time the search query changes, you then filter the rows using a regular expression for no good reason, and you compile it twice for each row processed. If that's not bad enough, you do it all on the UI thread. You could load the full contact list once and then filter it without any additional content provider queries.
  • The buttons in the confirmation dialog use hardcoded strings

@lanalabinsta
Copy link

Could u explain how to use it as a code? How I could add it to app?

@bit-world
Copy link
Author

and you compile it twice for each row processed

Why twice?

I'll fix the rest

ContactsContract.CommonDataKinds.Phone.NUMBER));

if (query.equals("") || (
Pattern.compile(Pattern.quote(query), Pattern.CASE_INSENSITIVE).matcher(name).find() ||

Choose a reason for hiding this comment

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

complied 1st time

Copy link

@fedorovdima fedorovdima Feb 23, 2021

Choose a reason for hiding this comment

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

Could it be like this?

--- a/Houseclub/src/main/java/me/grishka/houseclub/fragments/InviteListFragment.java
+++ b/Houseclub/src/main/java/me/grishka/houseclub/fragments/InviteListFragment.java
@@ -116,9 +116,10 @@ public class InviteListFragment extends SearchListFragment {
                         String phoneNo = pCur.getString(pCur.getColumnIndex(
                                 ContactsContract.CommonDataKinds.Phone.NUMBER));

+                        Pattern pattern = Pattern.compile(Pattern.quote(query), Pattern.CASE_INSENSITIVE);
                         if (query.equals("") || (
-                                Pattern.compile(Pattern.quote(query), Pattern.CASE_INSENSITIVE).matcher(name).find() ||
-                                        Pattern.compile(Pattern.quote(query), Pattern.CASE_INSENSITIVE).matcher(phoneNo).find())) {
+                                pattern.matcher(name).find() ||
+                                pattern.matcher(phoneNo).find())) {

                             FullUser u = new FullUser();
                             u.name = name;

Copy link
Author

@bit-world bit-world Feb 23, 2021

Choose a reason for hiding this comment

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

thanx, now understood


if (query.equals("") || (
Pattern.compile(Pattern.quote(query), Pattern.CASE_INSENSITIVE).matcher(name).find() ||
Pattern.compile(Pattern.quote(query), Pattern.CASE_INSENSITIVE).matcher(phoneNo).find())) {

Choose a reason for hiding this comment

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

compiled 2nd time

Choose a reason for hiding this comment

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

Is there anyone who can send me invitation

@alexeysi
Copy link

Looks good and better than #105 👋 🤚🤙🤙🤙

@impozzible
Copy link

This model is not available in your pull request

import me.grishka.houseclub.api.model.Contact;

@bit-world
Copy link
Author

This model is not available in your pull request

import me.grishka.houseclub.api.model.Contact;

can you check, is it ok now?

@impozzible
Copy link

impozzible commented Feb 23, 2021

This model is not available in your pull request
import me.grishka.houseclub.api.model.Contact;

can you check, is it ok now?

`

    public class Contact {
public String name, phone_number;
public Contact(){
}

public Contact(String name, String phone_number){
	this.name=name;
	this.phone_number=phone_number;
}

     }

`

phone_number should be phone, because

if (query.equals("") || ( pattern.matcher(contact.name + contact.phone).find())) { FullUser user = new FullUser(); user.name = contact.name; user.bio = contact.phone; users.add(user); i++; if(i > limit) break; }

@bit-world
Copy link
Author

phone_number should be phone, because

the correct option "phone_number", such response from API, initially did not know, I had to fix it

ClubhouseAPI: Raw response: {"num_invites":0,"suggested_invites":[{"phone_number":"+000000","in_app":true,"is_invited":false,"num_friends":73}

@bit-world
Copy link
Author

me.grishka.houseclub.api.model.FullUser;

this is not my class, it is from origin

@impozzible
Copy link

Also, you need to push HomeFragment.java

@bit-world
Copy link
Author

And please add a Navigation to your InviteListFragment and SearchListFragment into HomeFragment to have an access to your new features.

Done

@impozzible
Copy link

On my end page is just rolling

@impozzible
Copy link

Oh never mind, that was because i had thousands of contacts on my device

@alexeysi
Copy link

Oh never mind, that was because i had thousands of contacts on my device
Me too, but it works fine....

@RikuAlice01
Copy link

Hey you can use API "get_suggested_invites" put phone number for check in_app and is_invited status
it will look good for filter fitting row

@alexeysi
Copy link

UserListFragment.java sometimes getting zero length data array and out of bounds exception in getImageURL()

Please use following implementation...

@OverRide
public String getImageURL(int position, int image){
if (data.size()>0) return data.get(position).photoUrl;
return null;
}

}
return true;
return false;
Copy link
Owner

Choose a reason for hiding this comment

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

Why?

Choose a reason for hiding this comment

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

I'm changed this return to false independently too. Dunno why, but got some exceptions in navigation when more than 2 items in a menu...

Copy link
Author

Choose a reason for hiding this comment

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

fixed

Choose a reason for hiding this comment

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

@bit-world: with true here I had the same problem as @josefjebavy described, couldnt navigate twice to the same page.

Comment on lines 79 to 80
<string name="button_positive">Ok</string>
<string name="button_negative">Cancel</string>
Copy link
Owner

Choose a reason for hiding this comment

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

These strings already exist...

Copy link
Author

Choose a reason for hiding this comment

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

fixed

Comment on lines 328 to 329
Toast.makeText(getContext(), getString(R.string.invite_err, ""), Toast.LENGTH_SHORT).show();
error.showToast(getContext());
Copy link
Owner

Choose a reason for hiding this comment

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

This is indented with spaces for some reason

Copy link
Author

Choose a reason for hiding this comment

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

fixed

Comment on lines 281 to 286
super(getActivity(), R.layout.user_list_row);

name=findViewById(R.id.name);
bio=findViewById(R.id.bio);
followBtn=findViewById(R.id.follow_btn);
photo=findViewById(R.id.photo);
Copy link
Owner

Choose a reason for hiding this comment

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

And this too

Copy link
Author

Choose a reason for hiding this comment

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

fixed

@josefjebavy
Copy link

Hi i tested this feature:

  • invitation - it look that it is work.
  • notificiation page - first time it is display, but than this page always fall

@alexeysi
Copy link

Hi i tested this feature:

  • invitation - it look that it is work.
    +1. Confirming, I also used my invite and it passed to another android user successfully.
  • notificiation page - first time it is display, but than this page always fall
    Try to change HomeFragment.java line143: to return false; instead of true;

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.

10 participants