Skip to content

Commit

Permalink
Merge branch 'trunk' into bump_sentry_gradle_plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
wzieba committed Mar 19, 2024
2 parents 1387dd5 + 6b46937 commit ee7d11a
Show file tree
Hide file tree
Showing 31 changed files with 213 additions and 109 deletions.
4 changes: 4 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
*** PLEASE FOLLOW THIS FORMAT: [<priority indicator, more stars = higher priority>] <description> [<PR URL>]

24.6
-----


24.5
-----
* [*] [internal] Block editor: Remove code associated to Story block [https://github.com/wordpress-mobile/WordPress-Android/pull/20400]
Expand Down
11 changes: 9 additions & 2 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -722,11 +722,18 @@ if (project.hasProperty("debugStoreFile")) {
// Copy React Native JavaScript bundle and source map so they can be upload it to the Crash logging
// service during the build process.
android {
applicationVariants.all { variant ->
applicationVariants.configureEach { variant ->
def variantAssets = variant.mergeAssetsProvider.get().outputDir.get()

tasks.register("delete${variant.name.capitalize()}ReactNativeBundleSourceMap", Delete) {
delete(fileTree(dir: variantAssets, includes: ['**/*.bundle.map']))
}

tasks.register("copy${variant.name.capitalize()}ReactNativeBundleSourceMap", Copy) {
from("${buildDir}/intermediates/assets/${variant.name}")
from(variantAssets)
into("${buildDir}/react-native-bundle-source-map")
include("*.bundle", "*.bundle.map")
finalizedBy("delete${variant.name.capitalize()}ReactNativeBundleSourceMap")
}

variant.mergeAssetsProvider.configure {
Expand Down
10 changes: 4 additions & 6 deletions WordPress/jetpack_metadata/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
- Added a new Traffic tab on the Stats screen
- Upgraded the Notifications design
- Introduced video block support for VideoPress v5
- Fixed a crash caused by block editor auto-scrolling
- Provided an error message for video upload failure
- Removed image transparency during upload
* [*] [internal] Block editor: Remove code associated to Story block [https://github.com/wordpress-mobile/WordPress-Android/pull/20400]
* [*] [Jetpack-only] Fixes broken links on some notifications [https://github.com/wordpress-mobile/WordPress-Android/pull/20417]
* [**] [internal] Block editor: Upgrade React Native to version 0.73.3 [#20167]

6 changes: 2 additions & 4 deletions WordPress/metadata/release_notes.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
We made a few changes to the block editor.
* [*] [internal] Block editor: Remove code associated to Story block [https://github.com/wordpress-mobile/WordPress-Android/pull/20400]
* [**] [internal] Block editor: Upgrade React Native to version 0.73.3 [#20167]

- The app won’t crash anymore when the editor auto-scrolls down to a block.
- You’ll now see an error message when a video fails to upload to media and text blocks.
- Images no longer appear partly transparent while they’re being uploaded.
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,11 @@ public static ReaderPost fromJson(JSONObject json) {
// if there's no featured image, check if featured media has been set to an image
if (!post.hasFeaturedImage() && json.has("featured_media")) {
JSONObject jsonMedia = json.optJSONObject("featured_media");
String type = JSONUtils.getString(jsonMedia, "type");
if (type.equals("image")) {
post.mFeaturedImage = JSONUtils.getString(jsonMedia, "uri");
if (jsonMedia != null) {
String type = JSONUtils.getString(jsonMedia, "type");
if (type.equals("image")) {
post.mFeaturedImage = JSONUtils.getString(jsonMedia, "uri");
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class RecommendApiCallsProvider @Inject constructor(
cont.resume(Failure(errorMessage))
}

restClientProvider.getRestClientUtilsV2().get(
restClientProvider.getRestClientUtilsV2().getWithLocale(
endPointPath,
listener,
errorListener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static void getPushNotificationSettings(Context context, RestRequest.List
if (!TextUtils.isEmpty(deviceID)) {
settingsEndpoint += "?device_id=" + deviceID;
}
WordPress.getRestClientUtilsV1_1().get(settingsEndpoint, listener, errorListener);
WordPress.getRestClientUtilsV1_1().getWithLocale(settingsEndpoint, listener, errorListener);
}

public static void registerDeviceForPushNotifications(final Context ctx, String token) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class InviteLinksApiCallsProvider @Inject constructor(
cont.resume(Failure(error))
}

WordPress.getRestClientUtilsV1_1().get(
WordPress.getRestClientUtilsV1_1().getWithLocale(
endPointPath,
listener,
errorListener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void onErrorResponse(VolleyError volleyError) {
params.put("order_by", "display_name");
params.put("order", "ASC");
String path = String.format(Locale.US, "sites/%d/users", site.getSiteId());
WordPress.getRestClientUtilsV1_1().get(path, params, null, listener, errorListener);
WordPress.getRestClientUtilsV1_1().getWithLocale(path, params, null, listener, errorListener);
}

public static void fetchAuthors(final SiteModel site, final int offset, final FetchUsersCallback callback) {
Expand Down Expand Up @@ -95,7 +95,7 @@ public static void fetchAuthors(final SiteModel site, final int offset, final Fe
params.put("order", "ASC");
params.put("authors_only", "true");
String path = String.format(Locale.US, "sites/%d/users", site.getSiteId());
WordPress.getRestClientUtilsV1_1().get(path, params, null, listener, errorListener);
WordPress.getRestClientUtilsV1_1().getWithLocale(path, params, null, listener, errorListener);
}

public static void fetchRevisionAuthorsDetails(final SiteModel site, List<String> authors,
Expand Down Expand Up @@ -144,7 +144,7 @@ public void onErrorResponse(VolleyError volleyError) {
site.getSiteId(), authors.get(i)));
}

WordPress.getRestClientUtilsV1_1().get("batch/", batchParams, null, listener, errorListener);
WordPress.getRestClientUtilsV1_1().getWithLocale("batch/", batchParams, null, listener, errorListener);
}

public static void fetchFollowers(final SiteModel site, final int page, final FetchFollowersCallback callback) {
Expand Down Expand Up @@ -195,7 +195,7 @@ public void onErrorResponse(VolleyError volleyError) {
params.put("page", Integer.toString(page));
params.put("type", isEmailFollower ? "email" : "wp_com");
String path = String.format(Locale.US, "sites/%d/stats/followers", site.getSiteId());
WordPress.getRestClientUtilsV1_1().get(path, params, null, listener, errorListener);
WordPress.getRestClientUtilsV1_1().getWithLocale(path, params, null, listener, errorListener);
}

public static void fetchViewers(final SiteModel site, final int offset, final FetchViewersCallback callback) {
Expand Down Expand Up @@ -233,7 +233,7 @@ public void onErrorResponse(VolleyError volleyError) {
params.put("number", Integer.toString(FETCH_LIMIT));
params.put("page", Integer.toString(page));
String path = String.format(Locale.US, "sites/%d/viewers", site.getSiteId());
WordPress.getRestClientUtilsV1_1().get(path, params, null, listener, errorListener);
WordPress.getRestClientUtilsV1_1().getWithLocale(path, params, null, listener, errorListener);
}

public static void updateRole(final SiteModel site, long personID, String newRole, final int localTableBlogId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void onErrorResponse(VolleyError volleyError) {
};

String path = "/me/keyring-connections";
WordPress.getRestClientUtilsV1_1().get(path, listener, errorListener);
WordPress.getRestClientUtilsV1_1().getWithLocale(path, listener, errorListener);
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class PublicizeUpdateServicesV2 @Inject constructor(
}
val errorListener = RestRequest.ErrorListener { volleyError -> failure(volleyError) }
val path = "sites/$siteId/external-services?type=publicize"
restClientProvider.getRestClientUtilsV2().get(path, listener, errorListener)
restClientProvider.getRestClientUtilsV2().getWithLocale(path, listener, errorListener)
}

/*
Expand All @@ -45,6 +45,6 @@ class PublicizeUpdateServicesV2 @Inject constructor(
}
val errorListener = RestRequest.ErrorListener { volleyError -> failure(volleyError) }
val path = String.format(Locale.ROOT, "sites/%d/publicize-connections", siteId)
restClientProvider.getRestClientUtilsV1_1().get(path, listener, errorListener)
restClientProvider.getRestClientUtilsV1_1().getWithLocale(path, listener, errorListener)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -398,10 +398,11 @@ public void onErrorResponse(VolleyError volleyError) {
};

if (hasBlogId) {
WordPress.getRestClientUtilsV1_1().get("read/sites/" + blogId, listener, errorListener);
WordPress.getRestClientUtilsV1_1().getWithLocale("read/sites/" + blogId, listener, errorListener);
} else {
WordPress.getRestClientUtilsV1_1()
.get("read/sites/" + UrlUtils.urlEncode(UrlUtils.getHost(blogUrl)), listener, errorListener);
.getWithLocale("read/sites/" + UrlUtils.urlEncode(UrlUtils.getHost(blogUrl)), listener,
errorListener);
}
}

Expand Down Expand Up @@ -438,7 +439,7 @@ public void onErrorResponse(VolleyError volleyError) {
} else {
path = "read/feed/" + UrlUtils.urlEncode(feedUrl);
}
WordPress.getRestClientUtilsV1_1().get(path, listener, errorListener);
WordPress.getRestClientUtilsV1_1().getWithLocale(path, listener, errorListener);
}

private static void handleUpdateBlogInfoResponse(JSONObject jsonObject, UpdateBlogInfoListener infoListener) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public void onErrorResponse(VolleyError volleyError) {
}
};
AppLog.d(T.READER, "updating post");
WordPress.getRestClientUtilsV1_2().get(path, null, null, listener, errorListener);
WordPress.getRestClientUtilsV1_2().getWithLocale(path, null, null, listener, errorListener);
}

private static void handleUpdatePostResponse(@NonNull final ReaderPost localPost,
Expand Down Expand Up @@ -320,7 +320,7 @@ public void onErrorResponse(VolleyError volleyError) {
};

AppLog.d(T.READER, "requesting post");
restClientUtils.get(path, null, null, listener, errorListener);
restClientUtils.getWithLocale(path, null, null, listener, errorListener);
}

private static String getTrackingPixelForPost(@NonNull ReaderPost post) {
Expand Down Expand Up @@ -417,7 +417,7 @@ public void onErrorResponse(VolleyError volleyError) {
+ "?size_local=" + NUM_RELATED_POSTS_TO_REQUEST
+ "&size_global=" + NUM_RELATED_POSTS_TO_REQUEST
+ "&fields=" + ReaderSimplePost.SIMPLE_POST_FIELDS;
WordPress.getRestClientUtilsV1_2().get(path, null, null, listener, errorListener);
WordPress.getRestClientUtilsV1_2().getWithLocale(path, null, null, listener, errorListener);
}

private static void handleRelatedPostsResponse(final ReaderPost sourcePost,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class ParseDiscoverCardsJsonUseCase @Inject constructor(
}

fun parseNextPageHandle(jsonObject: JSONObject): String =
jsonObject.getString(ReaderConstants.JSON_NEXT_PAGE_HANDLE)
jsonObject.optString(ReaderConstants.JSON_NEXT_PAGE_HANDLE)

fun convertListOfJsonArraysIntoSingleJsonArray(jsons: List<String>): JSONArray {
val arrays = jsons.map { JSONArray(it) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public void onErrorResponse(VolleyError volleyError) {
}
};
AppLog.d(AppLog.T.READER, "updating comments");
WordPress.getRestClientUtilsV1_1().get(path, null, null, listener, errorListener);
WordPress.getRestClientUtilsV1_1().getWithLocale(path, null, null, listener, errorListener);
}

private static void handleUpdateCommentsResponse(final JSONObject jsonObject,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import org.wordpress.android.ui.reader.services.discover.ReaderDiscoverLogic.Dis
import org.wordpress.android.ui.reader.services.discover.ReaderDiscoverLogic.DiscoverTasks.REQUEST_MORE
import org.wordpress.android.util.AppLog
import org.wordpress.android.util.AppLog.T.READER
import org.wordpress.android.util.LocaleManagerWrapper
import org.wordpress.android.util.config.ReaderDiscoverNewEndpointFeatureConfig
import javax.inject.Inject

Expand All @@ -59,6 +60,7 @@ class ReaderDiscoverLogic @Inject constructor(
private val getDiscoverCardsUseCase: GetDiscoverCardsUseCase,
private val appPrefsWrapper: AppPrefsWrapper,
private val readerDiscoverNewEndpointFeatureConfig: ReaderDiscoverNewEndpointFeatureConfig,
private val localeManagerWrapper: LocaleManagerWrapper,
) {
enum class DiscoverTasks {
REQUEST_MORE, REQUEST_FIRST_PAGE
Expand Down Expand Up @@ -118,12 +120,13 @@ class ReaderDiscoverLogic @Inject constructor(
AppLog.e(READER, volleyError)
resultListener.onUpdateResult(FAILED)
}
params["_locale"] = localeManagerWrapper.getLanguage()
val endpoint = if (readerDiscoverNewEndpointFeatureConfig.isEnabled()) {
"read/streams/discover"
} else {
"read/tags/cards"
}
WordPress.getRestClientUtilsV2()[endpoint, params, null, listener, errorListener]
WordPress.getRestClientUtilsV2().get(endpoint, params, null, listener, errorListener)
}
}

Expand All @@ -150,7 +153,9 @@ class ReaderDiscoverLogic @Inject constructor(
insertCardsJsonIntoDb(simplifiedCardsJson)

val nextPageHandle = parseDiscoverCardsJsonUseCase.parseNextPageHandle(json)
appPrefsWrapper.readerCardsPageHandle = nextPageHandle
if (nextPageHandle.isNotEmpty()) {
appPrefsWrapper.readerCardsPageHandle = nextPageHandle
}

if (cards.isEmpty()) {
readerTagTableWrapper.clearTagLastUpdated(ReaderTag.createDiscoverPostCardsTag())
Expand Down Expand Up @@ -238,7 +243,11 @@ class ReaderDiscoverLogic @Inject constructor(
// If we've received a recommended tags or blogs card as the first element,
// it should be displayed as the third card.
if (firstRecommendationCard != null) {
simplifiedJsonList.add(2, firstRecommendationCard)
if (simplifiedJsonList.size >=2) {
simplifiedJsonList.add(2, firstRecommendationCard)
} else {
simplifiedJsonList.add(firstRecommendationCard)
}
}

return JSONArray(simplifiedJsonList)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
import org.wordpress.android.ui.reader.ReaderEvents;
import org.wordpress.android.ui.reader.services.ServiceCompletionListener;
import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.LocaleManagerWrapper;

import javax.inject.Inject;

import dagger.hilt.android.AndroidEntryPoint;

import static org.wordpress.android.ui.reader.services.post.ReaderPostServiceStarter.ARG_ACTION;
import static org.wordpress.android.ui.reader.services.post.ReaderPostServiceStarter.ARG_BLOG_ID;
Expand All @@ -26,9 +31,12 @@
* EventBus to alert of update status
*/

@AndroidEntryPoint
public class ReaderPostJobService extends JobService implements ServiceCompletionListener {
private ReaderPostLogic mReaderPostLogic;

@Inject LocaleManagerWrapper mLocaleManagerWrapper;

@Override public boolean onStartJob(JobParameters params) {
AppLog.i(AppLog.T.READER, "reader post job service > started");
UpdateAction action;
Expand Down Expand Up @@ -66,7 +74,7 @@ public class ReaderPostJobService extends JobService implements ServiceCompletio
@Override
public void onCreate() {
super.onCreate();
mReaderPostLogic = new ReaderPostLogic(this);
mReaderPostLogic = new ReaderPostLogic(this, mLocaleManagerWrapper);
AppLog.i(AppLog.T.READER, "reader post job service > created");
}

Expand Down
Loading

0 comments on commit ee7d11a

Please sign in to comment.