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

Feature/sharing update to fluxc #5933

Merged
merged 41 commits into from
May 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
1008e50
Fix merge issue that overwrote viewBlogSettings function
kwonye May 3, 2017
f363510
Calling a new method for viewing Sharing screen with SiteModel instea…
kwonye May 3, 2017
343a833
Retrieving siteId from SiteModel passed in
kwonye May 3, 2017
bc87343
Matching to develop branch
kwonye May 3, 2017
bb83af6
Removing fetching of account in PublicizeActions and adding a paramet…
kwonye May 3, 2017
439a184
Replacing use of AccountHelper with AccountStore
kwonye May 3, 2017
4590c8f
Replacing WPButton with Button
kwonye May 3, 2017
ee9e77b
Replacing use of AccountHelper with AccountStore
kwonye May 3, 2017
ed37a4f
Converting the use of SettingsFragment to AccountSettingsFragment
kwonye May 4, 2017
627eac5
Using the accountStore to get info
kwonye May 4, 2017
e3baa03
Showing to .com sites only
kwonye May 4, 2017
2c5521a
Declaring parameter final
kwonye May 4, 2017
8d8c063
Updating to use left
kwonye May 4, 2017
a6b0c2b
Merge branch 'feature/sharing-master' into feature/sharing-update-to-…
kwonye May 11, 2017
78f98f5
Updating gradle plugin
kwonye May 11, 2017
766c166
Merge branch 'feature/sharing-master' into feature/sharing-update-to-…
kwonye May 13, 2017
0107fcf
Pass site to PublicizeManageConnectionsFragment
nbradbury May 24, 2017
8593aca
Remove mSiteId from PublicizeListActivity
nbradbury May 24, 2017
bda1fe7
Retrieve site settings
nbradbury May 24, 2017
014ec3b
Use findPreference rather than getChangePref
nbradbury May 24, 2017
80a921e
PublicizeManageConnectionsFragment now inherits from SiteSettingsFrag…
nbradbury May 24, 2017
413a285
PublicizeManageConnectionsFragment now compiles
nbradbury May 24, 2017
449c84d
Pass current user ID to PublicizeServiceAdapter
nbradbury May 24, 2017
f75a342
Pass current user ID to PublicizeConnectionAdapter
nbradbury May 24, 2017
6f7ed2b
Merge branch 'feature/sharing-master' of https://github.com/wordpress…
nbradbury May 24, 2017
d3992db
Inject AccountStore into PublicizeWebViewFragment
nbradbury May 24, 2017
79ee076
Inject AccountStore into PublicizeDetailFragment
nbradbury May 24, 2017
a6572fb
Inject AccountStore into PublicizeListFragment
nbradbury May 24, 2017
b0d6df0
Pass SiteModel to PublicizeListFragment
nbradbury May 24, 2017
b9ef8c2
Pass SiteModel to PublicizeWebViewFragment
nbradbury May 24, 2017
c2a5c25
Pass SiteModel to PublicizeDetailFragment
nbradbury May 24, 2017
f7e2ce2
Use long siteId
nbradbury May 24, 2017
fe92de5
Use correct long siteId for PublicizeTable and PublicizeConnection
nbradbury May 24, 2017
5fd7499
Revert "Use correct long siteId for PublicizeTable and PublicizeConne…
nbradbury May 24, 2017
8aa7524
Use correct long siteId for PublicizeTable and PublicizeConnection
nbradbury May 24, 2017
c0b20f3
Pass the long siteId to PublicizeServiceAdapter
nbradbury May 24, 2017
e1c774b
Pass the long siteId to PublicizeUpdateService
nbradbury May 24, 2017
d1ff838
Removed siteId param from showListFragment
nbradbury May 24, 2017
016130c
Pass the long siteId to PublicizeConnectionAdapter
nbradbury May 24, 2017
872e4c2
Re-enable WebViewUtils.clearCookiesAsync()
nbradbury May 25, 2017
0ff514e
Pass only the siteId
nbradbury May 25, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ public static void addOrUpdateConnection(PublicizeConnection connection) {
getReadableDb().insertWithOnConflict(CONNECTIONS_TABLE, null, values, SQLiteDatabase.CONFLICT_REPLACE);
}

public static PublicizeConnectionList getConnectionsForSite(int siteId) {
public static PublicizeConnectionList getConnectionsForSite(long siteId) {
PublicizeConnectionList connectionList= new PublicizeConnectionList();
String args[] = {Integer.toString(siteId)};
String args[] = {Long.toString(siteId)};
Cursor c = getReadableDb().rawQuery("SELECT * FROM " + CONNECTIONS_TABLE + " WHERE site_id=?", args);
try {
while (c.moveToNext()) {
Expand All @@ -223,12 +223,12 @@ public static PublicizeConnectionList getConnectionsForSite(int siteId) {
}
}

public static void setConnectionsForSite(int siteId, PublicizeConnectionList connectionList) {
public static void setConnectionsForSite(long siteId, PublicizeConnectionList connectionList) {
SQLiteStatement stmt = null;
SQLiteDatabase db = getWritableDb();
db.beginTransaction();
try {
db.delete(CONNECTIONS_TABLE, "site_id=?", new String[] {Integer.toString(siteId)});
db.delete(CONNECTIONS_TABLE, "site_id=?", new String[] {Long.toString(siteId)});

stmt = db.compileStatement(
"INSERT INTO " + CONNECTIONS_TABLE
Expand Down Expand Up @@ -278,7 +278,7 @@ public static void setConnectionsForSite(int siteId, PublicizeConnectionList con
private static PublicizeConnection getConnectionFromCursor(Cursor c) {
PublicizeConnection connection = new PublicizeConnection();

connection.siteId = c.getInt(c.getColumnIndex("site_id"));
connection.siteId = c.getLong(c.getColumnIndex("site_id"));
connection.connectionId = c.getInt(c.getColumnIndex("id"));
connection.userId = c.getInt(c.getColumnIndex("user_id"));
connection.keyringConnectionId = c.getInt(c.getColumnIndex("keyring_connection_id"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public String toString() {
}

public int connectionId;
public int siteId;
public long siteId;
public int keyringConnectionId;
public int keyringConnectionUserId;

Expand All @@ -41,7 +41,7 @@ public String toString() {
private String mExternalName;
private String mExternalDisplayName;
private String mExternalProfilePictureUrl;
private int[] mSites;
private long[] mSites;

// `status` can be `ok` or `broken` -- `broken` means the connection needs to be re-established via the `refresh_URL`
private String mStatus;
Expand Down Expand Up @@ -139,15 +139,15 @@ public boolean isSameAs(PublicizeConnection other) {
&& other.getService().equals(this.getService());
}

public void setSites(int[] sites) {
public void setSites(long[] sites) {
mSites = sites;
}

public int[] getSites() {
public long[] getSites() {
return mSites;
}

public boolean isInSite(int siteId) {
public boolean isInSite(long siteId) {
for (int i = 0; i < mSites.length; i++) {
if (siteId == mSites[i]) {
return true;
Expand Down Expand Up @@ -190,7 +190,7 @@ public static PublicizeConnection fromJson(JSONObject json) {
PublicizeConnection connection = new PublicizeConnection();

connection.connectionId = json.optInt("ID");
connection.siteId = json.optInt("site_ID");
connection.siteId = json.optLong("site_ID");
connection.userId = json.optInt("user_ID");
connection.keyringConnectionId = json.optInt("keyring_connection_ID");
connection.keyringConnectionUserId = json.optInt("keyring_connection_user_ID");
Expand All @@ -210,17 +210,17 @@ public static PublicizeConnection fromJson(JSONObject json) {
JSONArray jsonSitesArray = json.getJSONArray("sites");
connection.mSites = getSitesArrayFromJson(jsonSitesArray);
} catch (JSONException e) {
connection.mSites = new int[0];
connection.mSites = new long[0];
e.printStackTrace();
}

return connection;
}

private static int[] getSitesArrayFromJson(JSONArray jsonArray) throws JSONException {
int[] sitesArray = new int[jsonArray.length()];
private static long[] getSitesArrayFromJson(JSONArray jsonArray) throws JSONException {
long[] sitesArray = new long[jsonArray.length()];
for (int i = 0; i < jsonArray.length(); i++) {
sitesArray[i] = jsonArray.getInt(i);
sitesArray[i] = jsonArray.getLong(i);
}

return sitesArray;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
import org.wordpress.android.ui.prefs.SiteSettingsFragment;
import org.wordpress.android.ui.prefs.SiteSettingsInterface;
import org.wordpress.android.ui.prefs.notifications.NotificationsSettingsFragment;
import org.wordpress.android.ui.publicize.PublicizeDetailFragment;
import org.wordpress.android.ui.publicize.PublicizeListFragment;
import org.wordpress.android.ui.publicize.PublicizeWebViewFragment;
import org.wordpress.android.ui.reader.ReaderCommentListActivity;
import org.wordpress.android.ui.reader.ReaderPostDetailFragment;
import org.wordpress.android.ui.reader.ReaderPostListFragment;
Expand Down Expand Up @@ -145,6 +148,10 @@ public interface AppComponent {
void inject(MediaEditFragment object);
void inject(MediaPreviewActivity object);

void inject(PublicizeWebViewFragment object);
void inject(PublicizeDetailFragment object);
void inject(PublicizeListFragment object);

void inject(EditPostActivity object);
void inject(EditPostSettingsFragment object);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,24 +131,18 @@ public static void viewCurrentBlogPeople(Context context, SiteModel site) {
}

public static void viewBlogSettingsForResult(Activity activity, SiteModel site) {
if (site == null) return;
public static void viewBlogSharing(Context context, Blog blog) {
if (blog == null) return;

Intent intent = new Intent(context, PublicizeListActivity.class);
intent.putExtra(PublicizeConstants.ARG_SITE_ID, blog.getRemoteBlogId());
context.startActivity(intent);
}

public static void viewBlogSettingsForResult(Activity activity, Blog blog) {
if (blog == null) return;

Intent intent = new Intent(activity, BlogPreferencesActivity.class);
intent.putExtra(WordPress.SITE, site);
activity.startActivityForResult(intent, RequestCodes.SITE_SETTINGS);
AnalyticsUtils.trackWithSiteDetails(AnalyticsTracker.Stat.OPENED_BLOG_SETTINGS, site);
}

public static void viewBlogSharing(Context context, SiteModel site) {
Intent intent = new Intent(context, PublicizeListActivity.class);
intent.putExtra(WordPress.SITE, site);
context.startActivity(intent);
}

public static void viewCurrentSite(Context context, SiteModel site, boolean openFromHeader) {
if (site == null) {
Toast.makeText(context, context.getText(R.string.blog_not_found), Toast.LENGTH_SHORT).show();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public void onClick(View v) {
mSharingView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityLauncher.viewBlogSharing(getActivity(), WordPress.getBlog(mBlogLocalId));
ActivityLauncher.viewBlogSharing(getActivity(), getSelectedSite());
}
});

Expand Down Expand Up @@ -357,7 +357,7 @@ private void refreshSelectedSiteDetails() {
mThemesContainer.setVisibility(themesVisibility);

// sharing is only exposed for wp.com blogs
int sharingVisibility = blog.isDotcomFlag() ? View.VISIBLE : View.GONE;
int sharingVisibility = getSelectedSite().isWPCom() ? View.VISIBLE : View.GONE;
mSharingView.setVisibility(sharingVisibility);

// show settings for all self-hosted to expose Delete Site
Expand Down
Loading