Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into merge/13.3-into-de…
Browse files Browse the repository at this point in the history
…velop-final

# Conflicts:
#	WordPress/build.gradle
  • Loading branch information
jkmassel committed Oct 7, 2019
2 parents 443378b + 00acdb8 commit beafc3b
Show file tree
Hide file tree
Showing 244 changed files with 4,878 additions and 14,903 deletions.
5 changes: 4 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ Fixes #

To test:

Update release notes:
PR submission checklist:

- [ ] I have considered adding unit tests where possible.

- [ ] I have considered if this change warrants user-facing release notes and have added them to `RELEASE-NOTES.txt` if necessary.

7 changes: 0 additions & 7 deletions .idea/inspectionProfiles/profiles_settings.xml

This file was deleted.

10 changes: 9 additions & 1 deletion RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
13.4
-----

* Add Remote Preview support for posts and pages.
* Post List: Trashed post must now be restored before edit or preview.
* Post List: Unhandled conflict with auto saves are now detected and visible. On post opening, the app will let you choose which version you prefer.
* Fixed: Clicking on "Publish" on a private post sometimes published the post as public
* Post List: Unsaved changes are automatically backed up on all devices. On post opening, the app will let you choose which version you prefer.
* Clicking on "Publish" on a private post sometimes published the post as public
* Fixed a bunch of upload related issues
* Block editor: Fix a link editing issue, where trying to add a empty link at the start of another link would remove the existing link.

13.3
-----
* Added ability to change the username via Account Settings
Expand Down
7 changes: 5 additions & 2 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repositories {
jcenter()
maven { url 'https://zendesk.jfrog.io/zendesk/repo' }
maven { url "https://giphy.bintray.com/giphy-sdk" }
maven { url "https://jitpack.io" }
maven { url "https://www.jitpack.io" }
}

apply plugin: 'com.android.application'
Expand Down Expand Up @@ -84,17 +84,20 @@ android {
versionName "13.3"
}
versionCode 781
buildConfigField "boolean", "ME_ACTIVITY_AVAILABLE", "false"
}

zalpha { // alpha version - enable experimental features
applicationId "org.wordpress.android"
dimension "buildType"
buildConfigField "boolean", "VIDEO_OPTIMIZATION_AVAILABLE", "true"
buildConfigField "boolean", "ME_ACTIVITY_AVAILABLE", "true"
}

wasabi { // "hot" version, can be installed along release, alpha or beta versions
applicationId "org.wordpress.android.beta"
dimension "buildType"
buildConfigField "boolean", "ME_ACTIVITY_AVAILABLE", "true"
}
}

Expand Down Expand Up @@ -231,7 +234,7 @@ dependencies {
}
androidTestImplementation 'org.apache.httpcomponents:httpclient-android:4.3.5.1'

androidTestImplementation project(path:':libs:mocks:WordPressMocks')
androidTestImplementation project(path:':WordPressMocks')

androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test:rules:1.1.0'
Expand Down
268 changes: 0 additions & 268 deletions WordPress/lint-baseline.xml

Large diffs are not rendered by default.

26 changes: 4 additions & 22 deletions WordPress/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@
android:label="" />

<!-- Account activities -->
<activity
android:name=".ui.main.MeActivity"
android:theme="@style/Calypso.NoActionBar"
android:label="@string/me_section_screen_title" />
<activity
android:name=".ui.accounts.LoginActivity"
android:theme="@style/LoginTheme"
Expand Down Expand Up @@ -192,11 +196,6 @@
android:label="@string/comments"/>

<!-- Posts activities -->
<activity
android:name=".editor.legacy.EditLinkActivity"
android:label="@string/create_a_link"
android:theme="@style/Theme.AppCompat.Light.Dialog"
android:windowSoftInputMode="stateVisible" />
<activity
android:name=".ui.posts.EditPostActivity"
android:theme="@style/Calypso.ActionMode.Dark"
Expand Down Expand Up @@ -233,10 +232,6 @@
android:name=".ui.pages.PageParentActivity"
android:theme="@style/Calypso.NoActionBar"
android:label="@string/set_parent" />
<activity
android:name=".ui.posts.PostPreviewActivity"
android:label="@string/preview_post"
android:theme="@style/Calypso.NoActionBar" />
<activity
android:name=".ui.posts.SelectCategoriesActivity"
android:theme="@style/CalypsoTheme" />
Expand Down Expand Up @@ -564,19 +559,6 @@
android:label="@string/my_profile"
android:theme="@style/CalypsoTheme" />

<activity android:name=".ui.VisualEditorOptionsReceiver">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="editor"
android:scheme="wordpress" />
</intent-filter>
</activity>

<!-- Lib activities-->
<activity
android:name="com.yalantis.ucrop.UCropActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ public WordPressDB(Context ctx) {
PeopleTable.createTables(mDb);
case 45:
case 46:
AppPrefs.setVisualEditorAvailable(true);
AppPrefs.setVisualEditorEnabled(true);
case 47:
PeopleTable.reset(mDb);
case 48:
Expand Down Expand Up @@ -151,7 +149,6 @@ public WordPressDB(Context ctx) {
mDb.execSQL(DROP_TABLE_PREFIX + THEMES_TABLE);
case 59:
// Enable Aztec for all users
AppPrefs.setVisualEditorEnabled(false);
AppPrefs.setAztecEditorEnabled(true);
case 60:
// add Start of Week site setting as part of #betterjetpackxp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,12 @@
import org.wordpress.android.ui.plugins.PluginListFragment;
import org.wordpress.android.ui.posts.AddCategoryFragment;
import org.wordpress.android.ui.posts.EditPostActivity;
import org.wordpress.android.ui.posts.EditPostPreviewFragment;
import org.wordpress.android.ui.posts.EditPostPublishSettingsFragment;
import org.wordpress.android.ui.posts.EditPostSettingsFragment;
import org.wordpress.android.ui.posts.HistoryListFragment;
import org.wordpress.android.ui.posts.PostDatePickerDialogFragment;
import org.wordpress.android.ui.posts.PostListFragment;
import org.wordpress.android.ui.posts.PostNotificationScheduleTimeDialogFragment;
import org.wordpress.android.ui.posts.PostPreviewActivity;
import org.wordpress.android.ui.posts.PostPreviewFragment;
import org.wordpress.android.ui.posts.PostSettingsTagsActivity;
import org.wordpress.android.ui.posts.PostTimePickerDialogFragment;
import org.wordpress.android.ui.posts.PostsListActivity;
Expand Down Expand Up @@ -317,14 +314,8 @@ public interface AppComponent extends AndroidInjector<WordPress> {

void inject(EditPostSettingsFragment object);

void inject(EditPostPreviewFragment object);

void inject(PostSettingsTagsActivity object);

void inject(PostPreviewActivity object);

void inject(PostPreviewFragment object);

void inject(PostsListActivity object);

void inject(AuthorSelectionAdapter object);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.wordpress.android.ui.stats.refresh.lists.widget.configuration.StatsWidgetSiteSelectionDialogFragment;
import org.wordpress.android.ui.stats.refresh.lists.widget.minified.StatsMinifiedWidgetConfigureFragment;
import org.wordpress.android.util.wizard.WizardManager;
import org.wordpress.android.viewmodel.ContextProvider;
import org.wordpress.android.viewmodel.helpers.ConnectionStatus;
import org.wordpress.android.viewmodel.helpers.ConnectionStatusLiveData;

Expand All @@ -40,8 +41,8 @@ public abstract class ApplicationModule {
abstract Context bindContext(Application application);

@Provides
public static NewsService provideLocalNewsService(Context context) {
return new LocalNewsService(context);
public static NewsService provideLocalNewsService(ContextProvider contextProvider) {
return new LocalNewsService(contextProvider);
}

@ContributesAndroidInjector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class ZendeskHelper(
zendeskNeedsToBeEnabledError
}
requireIdentity(context, selectedSite) {
AnalyticsTracker.track(Stat.SUPPORT_NEW_REQUEST_VIEWED)
RequestActivity.builder()
.show(context, buildZendeskConfig(context, siteStore.sites, origin, selectedSite, extraTags))
}
Expand All @@ -165,6 +166,7 @@ class ZendeskHelper(
zendeskNeedsToBeEnabledError
}
requireIdentity(context, selectedSite) {
AnalyticsTracker.track(Stat.SUPPORT_TICKET_LIST_VIEWED)
RequestListActivity.builder()
.show(context, buildZendeskConfig(context, siteStore.sites, origin, selectedSite, extraTags))
}
Expand Down
112 changes: 84 additions & 28 deletions WordPress/src/main/java/org/wordpress/android/ui/ActivityLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.wordpress.android.ui.history.HistoryDetailActivity;
import org.wordpress.android.ui.history.HistoryDetailContainerFragment;
import org.wordpress.android.ui.history.HistoryListItem.Revision;
import org.wordpress.android.ui.main.MeActivity;
import org.wordpress.android.ui.main.SitePickerActivity;
import org.wordpress.android.ui.main.WPMainActivity;
import org.wordpress.android.ui.media.MediaBrowserActivity;
Expand All @@ -53,8 +54,9 @@
import org.wordpress.android.ui.plugins.PluginDetailActivity;
import org.wordpress.android.ui.plugins.PluginUtils;
import org.wordpress.android.ui.posts.EditPostActivity;
import org.wordpress.android.ui.posts.PostPreviewActivity;
import org.wordpress.android.ui.posts.PostUtils;
import org.wordpress.android.ui.posts.PostsListActivity;
import org.wordpress.android.ui.posts.RemotePreviewLogicHelper.RemotePreviewType;
import org.wordpress.android.ui.prefs.AccountSettingsActivity;
import org.wordpress.android.ui.prefs.AppPrefs;
import org.wordpress.android.ui.prefs.AppSettingsActivity;
Expand Down Expand Up @@ -472,7 +474,8 @@ public static void viewCurrentSite(Context context, SiteModel site, boolean open
} else if (!TextUtils.isEmpty(site.getUsername()) && !TextUtils.isEmpty(site.getPassword())) {
// Show self-hosted sites as authenticated since we should have the username & password
WPWebViewActivity
.openUrlByUsingBlogCredentials(context, site, null, siteUrl, new String[]{}, false, true);
.openUrlByUsingBlogCredentials(context, site, null, siteUrl, new String[]{}, false, true,
false);
} else {
// Show non-wp.com sites without a password unauthenticated. These would be Jetpack sites that are
// connected through REST API.
Expand All @@ -490,24 +493,6 @@ public static void viewBlogAdmin(Context context, SiteModel site) {
openUrlExternal(context, site.getAdminUrl());
}

public static void viewPostPreviewForResult(Activity activity, SiteModel site, PostModel post) {
if (post == null) {
return;
}

Intent intent = new Intent(activity, PostPreviewActivity.class);
intent.putExtra(EditPostActivity.EXTRA_POST_LOCAL_ID, post.getId());
intent.putExtra(WordPress.SITE, site);
activity.startActivityForResult(intent, RequestCodes.PREVIEW_POST);
}

public static void viewPagePreview(@NonNull Fragment fragment, @NonNull PageModel page) {
Intent intent = new Intent(fragment.getContext(), PostPreviewActivity.class);
intent.putExtra(EditPostActivity.EXTRA_POST_LOCAL_ID, page.getPageId());
intent.putExtra(WordPress.SITE, page.getSite());
fragment.startActivity(intent);
}

public static void addNewPostForResult(Activity activity, SiteModel site, boolean isPromo) {
addNewPostForResult(new Intent(activity, EditPostActivity.class), activity, site, isPromo);
}
Expand All @@ -524,10 +509,21 @@ public static void addNewPostForResult(Intent intent, Activity activity, SiteMod
}

public static void editPostOrPageForResult(Activity activity, SiteModel site, PostModel post) {
editPostOrPageForResult(new Intent(activity, EditPostActivity.class), activity, site, post.getId());
editPostOrPageForResult(new Intent(activity, EditPostActivity.class), activity, site, post.getId(), false);
}

public static void editPostOrPageForResult(Activity activity, SiteModel site, PostModel post,
boolean loadAutoSaveRevision) {
editPostOrPageForResult(new Intent(activity, EditPostActivity.class), activity, site, post.getId(),
loadAutoSaveRevision);
}

public static void editPostOrPageForResult(Intent intent, Activity activity, SiteModel site, int postLocalId) {
editPostOrPageForResult(intent, activity, site, postLocalId, false);
}

public static void editPostOrPageForResult(Intent intent, Activity activity, SiteModel site, int postLocalId,
boolean loadAutoSaveRevision) {
if (site == null) {
return;
}
Expand All @@ -537,6 +533,8 @@ public static void editPostOrPageForResult(Intent intent, Activity activity, Sit
// in order to avoid issues like TransactionTooLargeException it's better to pass the id of the post.
// However, we still want to keep passing the SiteModel to avoid confusion around local & remote ids.
intent.putExtra(EditPostActivity.EXTRA_POST_LOCAL_ID, postLocalId);
intent.putExtra(EditPostActivity.EXTRA_LOAD_AUTO_SAVE_REVISION, loadAutoSaveRevision);

activity.startActivityForResult(intent, RequestCodes.EDIT_POST);
}

Expand Down Expand Up @@ -571,36 +569,94 @@ public static void viewHistoryDetailForResult(Activity activity, Revision revisi
* Load the post preview as an authenticated URL so stats aren't bumped
*/
public static void browsePostOrPage(Context context, SiteModel site, PostModel post) {
browsePostOrPageEx(context, site, post, RemotePreviewType.NOT_A_REMOTE_PREVIEW);
}

public static void previewPostOrPageForResult(
Activity activity,
SiteModel site,
PostModel post,
RemotePreviewType remotePreviewType
) {
browsePostOrPageEx(activity, site, post, remotePreviewType);
}

private static void browsePostOrPageEx(
Context context,
SiteModel site,
PostModel post,
RemotePreviewType remotePreviewType) {
if (site == null || post == null || TextUtils.isEmpty(post.getLink())) {
return;
}

// always add the preview parameter to avoid bumping stats when viewing posts
String url = UrlUtils.appendUrlParameter(post.getLink(), "preview", "true");
if (remotePreviewType == RemotePreviewType.REMOTE_PREVIEW_WITH_REMOTE_AUTO_SAVE
&& TextUtils.isEmpty(post.getAutoSavePreviewUrl())) {
return;
}

String url = PostUtils.getPreviewUrlForPost(remotePreviewType, post);

String shareableUrl = post.getLink();
String shareSubject = post.getTitle();
boolean startPreviewForResult = remotePreviewType != RemotePreviewType.NOT_A_REMOTE_PREVIEW;

if (site.isWPCom()) {
WPWebViewActivity.openPostUrlByUsingGlobalWPCOMCredentials(context, url, shareableUrl, shareSubject, true);
} else if (site.isJetpackConnected()) {
WPWebViewActivity.openPostUrlByUsingGlobalWPCOMCredentials(
context,
url,
shareableUrl,
shareSubject,
true,
startPreviewForResult);
} else if (site.isJetpackConnected() && site.isUsingWpComRestApi()) {
WPWebViewActivity
.openJetpackBlogPostPreview(context, url, shareableUrl, shareSubject, site.getFrameNonce(), true);
.openJetpackBlogPostPreview(
context,
url,
shareableUrl,
shareSubject,
site.getFrameNonce(),
true,
startPreviewForResult);
} else {
// Add the original post URL to the list of allowed URLs.
// This is necessary because links are disabled in the webview, but WP removes "?preview=true"
// from the passed URL, and internally redirects to it. EX:Published posts on a site with Plain
// permalink structure settings.
// Ref: https://github.com/wordpress-mobile/WordPress-Android/issues/4873
WPWebViewActivity
.openUrlByUsingBlogCredentials(context, site, post, url, new String[]{post.getLink()}, true, true);
WPWebViewActivity.openUrlByUsingBlogCredentials(
context,
site,
post,
url,
new String[]{post.getLink()},
true,
true,
startPreviewForResult);
}
}

public static void showActionableEmptyView(
Context context,
WPWebViewUsageCategory actionableState,
String postTitle
) {
WPWebViewActivity.openActionableEmptyViewDirectly(context, actionableState, postTitle);
}

public static void viewMyProfile(Context context) {
Intent intent = new Intent(context, MyProfileActivity.class);
AnalyticsTracker.track(AnalyticsTracker.Stat.OPENED_MY_PROFILE);
context.startActivity(intent);
}

public static void viewMeActivity(Context context) {
Intent intent = new Intent(context, MeActivity.class);
AnalyticsTracker.track(AnalyticsTracker.Stat.ME_ACCESSED);
context.startActivity(intent);
}

public static void viewAccountSettings(Context context) {
Intent intent = new Intent(context, AccountSettingsActivity.class);
AnalyticsTracker.track(AnalyticsTracker.Stat.OPENED_ACCOUNT_SETTINGS);
Expand Down
Loading

0 comments on commit beafc3b

Please sign in to comment.