Skip to content

Commit

Permalink
Merge pull request #13130 from wordpress-mobile/feature/jetpack-stori…
Browse files Browse the repository at this point in the history
…es-block-base

Mobile stories block
  • Loading branch information
mzorz authored Nov 10, 2020
2 parents 0da07a0 + f66556c commit 784bc24
Show file tree
Hide file tree
Showing 30 changed files with 2,157 additions and 145 deletions.
11 changes: 1 addition & 10 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ androidExtensions {

dependencies {
implementation project(path:':libs:stories-android:stories')
testImplementation project(path:':photoeditor')
implementation project(path:':libs:image-editor::ImageEditor')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
import org.wordpress.android.ui.themes.ThemeBrowserActivity;
import org.wordpress.android.ui.themes.ThemeBrowserFragment;
import org.wordpress.android.ui.uploads.MediaUploadHandler;
import org.wordpress.android.ui.uploads.MediaUploadReadyProcessor;
import org.wordpress.android.ui.uploads.PostUploadHandler;
import org.wordpress.android.ui.uploads.UploadService;
import org.wordpress.android.ui.whatsnew.FeatureAnnouncementDialogFragment;
Expand Down Expand Up @@ -595,6 +596,8 @@ public interface AppComponent extends AndroidInjector<WordPress> {

void inject(MediaPickerFragment object);

void inject(MediaUploadReadyProcessor object);

void inject(PrepublishingCategoriesFragment object);

void inject(PrepublishingAddCategoryFragment object);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.wordpress.android.analytics.AnalyticsTracker;
import org.wordpress.android.analytics.AnalyticsTracker.Stat;
import org.wordpress.android.datasets.ReaderPostTable;
import org.wordpress.android.fluxc.model.LocalOrRemoteId.LocalId;
import org.wordpress.android.fluxc.model.PostImmutableModel;
import org.wordpress.android.fluxc.model.PostModel;
import org.wordpress.android.fluxc.model.SiteModel;
Expand Down Expand Up @@ -94,16 +95,21 @@
import java.util.List;
import java.util.Map;

import static com.wordpress.stories.util.BundleUtilsKt.KEY_STORY_INDEX;
import static org.wordpress.android.analytics.AnalyticsTracker.ACTIVITY_LOG_ACTIVITY_ID_KEY;
import static org.wordpress.android.analytics.AnalyticsTracker.Stat.POST_LIST_ACCESS_ERROR;
import static org.wordpress.android.analytics.AnalyticsTracker.Stat.READER_ARTICLE_DETAIL_REBLOGGED;
import static org.wordpress.android.analytics.AnalyticsTracker.Stat.READER_ARTICLE_REBLOGGED;
import static org.wordpress.android.analytics.AnalyticsTracker.Stat.STATS_ACCESS_ERROR;
import static org.wordpress.android.editor.gutenberg.GutenbergEditorFragment.ARG_STORY_BLOCK_ID;
import static org.wordpress.android.imageeditor.preview.PreviewImageFragment.ARG_EDIT_IMAGE_DATA;
import static org.wordpress.android.login.LoginMode.WPCOM_LOGIN_ONLY;
import static org.wordpress.android.ui.WPWebViewActivity.ENCODING_UTF8;
import static org.wordpress.android.ui.media.MediaBrowserActivity.ARG_BROWSER_TYPE;
import static org.wordpress.android.ui.pages.PagesActivityKt.EXTRA_PAGE_REMOTE_ID_KEY;
import static org.wordpress.android.ui.stories.StoryComposerActivity.KEY_ALL_UNFLATTENED_LOADED_SLIDES;
import static org.wordpress.android.ui.stories.StoryComposerActivity.KEY_LAUNCHED_FROM_GUTENBERG;
import static org.wordpress.android.ui.stories.StoryComposerActivity.KEY_POST_LOCAL_ID;
import static org.wordpress.android.viewmodel.activitylog.ActivityLogDetailViewModelKt.ACTIVITY_LOG_ID_KEY;

public class ActivityLauncher {
Expand Down Expand Up @@ -720,13 +726,73 @@ public static void addNewStoryWithMediaUrisForResult(
return;
}

Intent intent = new Intent(activity, StoryComposerActivity.class);
Intent intent = new Intent(activity, StoryComposerActivity.class);
intent.putExtra(WordPress.SITE, site);
intent.putExtra(MediaPickerConstants.EXTRA_MEDIA_URIS, mediaUris);
intent.putExtra(AnalyticsUtils.EXTRA_CREATION_SOURCE_DETAIL, source);
activity.startActivityForResult(intent, RequestCodes.CREATE_STORY);
}

public static void editStoryWithMediaIdsForResult(
Activity activity,
SiteModel site,
long[] mediaIds,
boolean launchingFromGutenberg
) {
if (site == null) {
return;
}

Intent intent = new Intent(activity, StoryComposerActivity.class);
intent.putExtra(WordPress.SITE, site);
intent.putExtra(MediaBrowserActivity.RESULT_IDS, mediaIds);
activity.startActivityForResult(intent, RequestCodes.EDIT_STORY);
}

public static void editStoryForResult(
Activity activity,
SiteModel site,
LocalId localPostId,
int storyIndex,
boolean allStorySlidesAreEditable,
boolean launchedFromGutenberg,
String storyBlockId
) {
if (site == null) {
return;
}

Intent intent = new Intent(activity, StoryComposerActivity.class);
intent.putExtra(WordPress.SITE, site);
intent.putExtra(KEY_POST_LOCAL_ID, localPostId.getValue());
intent.putExtra(KEY_STORY_INDEX, storyIndex);
intent.putExtra(KEY_LAUNCHED_FROM_GUTENBERG, launchedFromGutenberg);
intent.putExtra(KEY_ALL_UNFLATTENED_LOADED_SLIDES, allStorySlidesAreEditable);
intent.putExtra(ARG_STORY_BLOCK_ID, storyBlockId);
activity.startActivityForResult(intent, RequestCodes.EDIT_STORY);
}

public static void editEmptyStoryForResult(
Activity activity,
SiteModel site,
LocalId localPostId,
int storyIndex,
String storyBlockId
) {
if (site == null) {
return;
}

Intent intent = new Intent(activity, StoryComposerActivity.class);
intent.putExtra(WordPress.SITE, site);
intent.putExtra(KEY_LAUNCHED_FROM_GUTENBERG, true);
intent.putExtra(MediaPickerConstants.EXTRA_LAUNCH_WPSTORIES_CAMERA_REQUESTED, true);
intent.putExtra(KEY_POST_LOCAL_ID, localPostId.getValue());
intent.putExtra(KEY_STORY_INDEX, storyIndex);
intent.putExtra(ARG_STORY_BLOCK_ID, storyBlockId);
activity.startActivityForResult(intent, RequestCodes.EDIT_STORY);
}

public static void editPostOrPageForResult(Activity activity, SiteModel site, PostModel post) {
editPostOrPageForResult(new Intent(activity, EditPostActivity.class), activity, site, post.getId(), false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,5 @@ public class RequestCodes {

// Story creator
public static final int CREATE_STORY = 8000;
public static final int EDIT_STORY = 8001;
}
Loading

0 comments on commit 784bc24

Please sign in to comment.