-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Facebook Publicize disable selection of profiles #8115
Merged
Merged
Changes from 25 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
b7a4134
Hide Facebook publicize option
kwonye 194ee67
Reformat code with code style
kwonye cdde859
Adding notice and text for facebook deprecation
kwonye bf10084
Adding conditional view for facebook connections
kwonye 1a6b0e3
Fixing conditional on whether to hide Google plus
kwonye 8ceea99
Adding text to link to facebook sharing changes
kwonye cd51f2f
Adding new must_disconnect status for a connection
kwonye d3733e9
Making a constant
kwonye 9b83ef9
Fixing formatting
kwonye 9fee14f
Adding must_disconnect case for status
kwonye a947664
Adding additional fields from the JSON object response
kwonye 3834d18
Updating table
kwonye ee2be5d
Creating the new model from services json
kwonye 57e18e8
Resetting the publicize services table on update
kwonye 51d9887
Removing extra semi-colon
kwonye 4fdea8e
Revert "Updating table"
kwonye 8d15e83
Only should hide google plus if it’s not already connected
kwonye 70a0730
Setting the name from either the display or normal name
kwonye e82db0b
Add table modification in DB
kwonye 8d5c455
Determine if the service is external users only
kwonye edde2fb
Counting external accounts now
kwonye 71bb66f
Removing multiple external user
kwonye 18d252d
Cleaning up spaces
kwonye eaa792c
Only add non-external sites if there are multiple external sites
kwonye fddb151
Fixing typo
kwonye 217f03c
Allowing an external connection to change items of a connection
kwonye 5f0146b
Using current connection
kwonye d9642e1
Changing around the order for selection of name
kwonye f4bc277
Adding externalUserId as a parameter to pass to the server
kwonye d0b4d56
Resetting the table if it exists instead of modifying it
kwonye 69fbdc1
Fixing check for if there are only external accounts
kwonye 0737a3e
Cleaning up space
kwonye 4c80d6a
Fixing null check
kwonye 5f42654
fixed int to bool conversion for boolean columns in Publicize when re…
mzorz 2e78b52
Merge branch 'fix/facebook-publicize-aug-1' of https://github.com/wor…
mzorz 81edf5d
fixed line lengths and unused imports
mzorz b620788
Adding the external_user_ID parameter
kwonye File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ public void onBindViewHolder(final ViewHolder holder, int position) { | |
final PublicizeConnection connection = mConnectionItems.get(position); | ||
holder.mProfileImageView | ||
.setImageUrl(connection.getExternalProfilePictureUrl(), WPNetworkImageView.ImageType.PHOTO); | ||
holder.mNameTextView.setText(connection.getExternalDisplayName()); | ||
holder.mNameTextView.setText(getName(connection)); | ||
holder.mRadioButton.setChecked(position == mSelectedPosition); | ||
|
||
if (!mAreAccountsConnected) { | ||
|
@@ -82,4 +82,14 @@ public ViewHolder(View view) { | |
public interface OnPublicizeAccountChooserListener { | ||
void onAccountSelected(int selectedIndex); | ||
} | ||
|
||
private String getName(PublicizeConnection connection) { | ||
String name = connection.getExternalDisplayName(); | ||
|
||
if (name.isEmpty()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's use |
||
name = connection.getExternalName(); | ||
} | ||
|
||
return name; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,21 +139,31 @@ public void onErrorResponse(VolleyError volleyError) { | |
|
||
private static boolean shouldShowChooserDialog(long siteId, String serviceId, JSONObject jsonObject) { | ||
JSONArray jsonConnectionList = jsonObject.optJSONArray("connections"); | ||
|
||
if (jsonConnectionList == null || jsonConnectionList.length() <= 1) { | ||
return false; | ||
} | ||
|
||
int totalAccounts = 0; | ||
int totalExternalAccounts = 0; | ||
try { | ||
for (int i = 0; i < jsonConnectionList.length(); i++) { | ||
JSONObject connectionObject = jsonConnectionList.getJSONObject(i); | ||
PublicizeConnection publicizeConnection = PublicizeConnection.fromJson(connectionObject); | ||
if (publicizeConnection.getService().equals(serviceId) && !publicizeConnection.isInSite(siteId)) { | ||
totalAccounts++; | ||
JSONArray externalJsonArray = connectionObject.getJSONArray("additional_external_users"); | ||
for (int j = 0; j < externalJsonArray.length(); j++) { | ||
totalExternalAccounts++; | ||
} | ||
} | ||
} | ||
|
||
return totalAccounts > 0; | ||
if (PublicizeTable.onlyExternalConnections(serviceId)) { | ||
return totalAccounts > 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't this be |
||
} else { | ||
return totalAccounts > 0 || totalExternalAccounts > 0; | ||
} | ||
} catch (JSONException e) { | ||
return false; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This crashes when there is no pre-existent
PublicizeTable
. Apparently, it is only created whenPublicizeListActivity
is first visited here . We should add a check that the table exists before creating it, or force creating it before this step execution by callingPublicizeTable.createTables(mDb);
right above thisALTER TABLE
statement.