Skip to content

Commit 8e3ae3b

Browse files
committed
Merge branch 'develop' into issue/8955-page-item-redesign
# Conflicts: # build.gradle
2 parents ec7709d + f37140e commit 8e3ae3b

35 files changed

+121
-103
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ gradlew text eol=lf
55
*.bat text eol=crlf
66
*.png binary
77
*.jpg binary
8+
RELEASE-NOTES.txt merge=union

RELEASE-NOTES.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
11
* Refreshed page list layout that includes a timestamp and a featured image thumbnail
2+
* Fixed a bug causing disappearance of old saved posts
3+
* Add Importing from Giphy in Editor and Media Library
4+
* Add support for .blog subdomains on new sites.
5+
* First version of the refreshed stats project - all tabs and all the blocks are completely rewritten in new design
6+
* Fix the coloring issue with Countries map stats block
7+
* Fix a crash in Stats for new sites with no data (date parsing in the Overview block)
8+

WordPress/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ android {
4343

4444
defaultConfig {
4545
applicationId "org.wordpress.android"
46-
versionName "alpha-147"
47-
versionCode 666
46+
versionName "alpha-149"
47+
versionCode 671
4848
minSdkVersion 21
4949
targetSdkVersion 26
5050

WordPress/metadata/PlayStoreStrings.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ msgid ""
1717
"* The Notifications list layout is more readable, as is the Me tab on tablets and large devices.\n"
1818
"* New privacy settings let you remove of geolocation from uploaded images.\n"
1919
"* Better messaging when there is no data to show in the stats screen adds clarity.\n"
20-
"* There was an issue where only admins of self-hosted sites could update their password. Now all users can.\n"
20+
"* There was an issue where some users of self-hosted sites couldn’t update their password. Now all users can.\n"
2121
msgstr ""
2222

2323
msgctxt "release_note_115"

WordPress/metadata/release_notes.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
* The Notifications list layout is more readable, as is the Me tab on tablets and large devices.
33
* New privacy settings let you remove of geolocation from uploaded images.
44
* Better messaging when there is no data to show in the stats screen adds clarity.
5-
* There was an issue where only admins of self-hosted sites could update their password. Now all users can.
5+
* There was an issue where some users of self-hosted sites couldn’t update their password. Now all users can.

WordPress/src/main/java/org/wordpress/android/WordPress.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,11 +591,13 @@ public static String getDefaultUserAgent() {
591591
if (mDefaultUserAgent == null) {
592592
try {
593593
mDefaultUserAgent = WebSettings.getDefaultUserAgent(getContext());
594-
} catch (AndroidRuntimeException | NullPointerException e) {
594+
} catch (AndroidRuntimeException | NullPointerException | IllegalArgumentException e) {
595595
// Catch AndroidRuntimeException that could be raised by the WebView() constructor.
596596
// See https://github.com/wordpress-mobile/WordPress-Android/issues/3594
597597
// Catch NullPointerException that could be raised by WebSettings.getDefaultUserAgent()
598598
// See https://github.com/wordpress-mobile/WordPress-Android/issues/3838
599+
// Catch IllegalArgumentException that could be raised by WebSettings.getDefaultUserAgent()
600+
// See https://github.com/wordpress-mobile/WordPress-Android/issues/9015
599601

600602
// init with the empty string, it's a rare issue
601603
mDefaultUserAgent = "";

WordPress/src/main/java/org/wordpress/android/datasets/ReaderPostTable.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,11 @@ private static int purgePostsForTag(SQLiteDatabase db, ReaderTag tag) {
243243
if (numPosts <= MAX_POSTS_PER_TAG) {
244244
return 0;
245245
}
246-
247-
String[] args = {tag.getTagSlug(), Integer.toString(tag.tagType.toInt()), Integer.toString(MAX_POSTS_PER_TAG)};
248-
String where = "pseudo_id NOT IN (SELECT DISTINCT pseudo_id FROM tbl_posts WHERE tag_name=? AND "
249-
+ "tag_type=? ORDER BY " + getSortColumnForTag(tag) + " DESC LIMIT ?)";
246+
String tagName = tag.getTagSlug();
247+
String tagType = Integer.toString(tag.tagType.toInt());
248+
String[] args = {tagName, tagType, tagName, tagType, Integer.toString(MAX_POSTS_PER_TAG)};
249+
String where = "tag_name=? AND tag_type=? AND pseudo_id NOT IN (SELECT DISTINCT pseudo_id FROM tbl_posts WHERE "
250+
+ "tag_name=? AND tag_type=? ORDER BY " + getSortColumnForTag(tag) + " DESC LIMIT ?)";
250251
int numDeleted = db.delete("tbl_posts", where, args);
251252
AppLog.d(AppLog.T.READER,
252253
String.format(Locale.ENGLISH, "reader post table > purged %d posts in tag %s", numDeleted,

WordPress/src/main/java/org/wordpress/android/ui/accounts/LoginActivity.java

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.wordpress.android.R;
2525
import org.wordpress.android.WordPress;
2626
import org.wordpress.android.analytics.AnalyticsTracker;
27+
import org.wordpress.android.fluxc.model.SiteModel;
2728
import org.wordpress.android.fluxc.network.MemorizingTrustManager;
2829
import org.wordpress.android.fluxc.store.AccountStore.AuthEmailPayloadScheme;
2930
import org.wordpress.android.fluxc.store.SiteStore;
@@ -53,6 +54,7 @@
5354
import org.wordpress.android.ui.accounts.SmartLockHelper.Callback;
5455
import org.wordpress.android.ui.accounts.login.LoginPrologueFragment;
5556
import org.wordpress.android.ui.accounts.login.LoginPrologueListener;
57+
import org.wordpress.android.ui.main.SitePickerActivity;
5658
import org.wordpress.android.ui.notifications.services.NotificationsUpdateServiceStarter;
5759
import org.wordpress.android.ui.posts.BasicFragmentDialog;
5860
import org.wordpress.android.ui.posts.BasicFragmentDialog.BasicDialogPositiveClickInterface;
@@ -112,6 +114,7 @@ private enum SmartLockHelperState {
112114
@Inject DispatchingAndroidInjector<Fragment> mFragmentInjector;
113115
@Inject protected LoginAnalyticsListener mLoginAnalyticsListener;
114116
@Inject ZendeskHelper mZendeskHelper;
117+
@Inject protected SiteStore mSiteStore;
115118

116119
@Override
117120
protected void attachBaseContext(Context newBase) {
@@ -191,7 +194,7 @@ private void showFragment(Fragment fragment, String tag) {
191194
private void slideInFragment(Fragment fragment, boolean shouldAddToBackStack, String tag) {
192195
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
193196
fragmentTransaction.setCustomAnimations(R.anim.activity_slide_in_from_right, R.anim.activity_slide_out_to_left,
194-
R.anim.activity_slide_in_from_left, R.anim.activity_slide_out_to_right);
197+
R.anim.activity_slide_in_from_left, R.anim.activity_slide_out_to_right);
195198
fragmentTransaction.replace(R.id.fragment_container, fragment, tag);
196199
if (shouldAddToBackStack) {
197200
fragmentTransaction.addToBackStack(null);
@@ -249,8 +252,26 @@ private void loggedInAndFinish(ArrayList<Integer> oldSitesIds, boolean doLoginUp
249252
break;
250253
case SHARE_INTENT:
251254
case SELFHOSTED_ONLY:
255+
// We are comparing list of site ID's before self-hosted site was added and after, trying to find a
256+
// newly added self-hosted site's ID, so we can select it
257+
ArrayList<Integer> newSitesIds = new ArrayList<>();
258+
for (SiteModel site : mSiteStore.getSites()) {
259+
newSitesIds.add(site.getId());
260+
}
261+
newSitesIds.removeAll(oldSitesIds);
262+
263+
if (newSitesIds.size() > 0) {
264+
Intent intent = new Intent();
265+
intent.putExtra(SitePickerActivity.KEY_LOCAL_ID, newSitesIds.get(0));
266+
setResult(Activity.RESULT_OK, intent);
267+
} else {
268+
AppLog.e(T.MAIN, "Couldn't detect newly added self-hosted site. "
269+
+ "Expected at least 1 site ID but was 0.");
270+
ToastUtils.showToast(this, R.string.site_picker_failed_selecting_added_site);
271+
setResult(Activity.RESULT_OK);
272+
}
273+
252274
// skip the epilogue when only added a self-hosted site or sharing to WordPress
253-
setResult(Activity.RESULT_OK);
254275
finish();
255276
break;
256277
}
@@ -501,8 +522,8 @@ public void needs2faSocial(String email, String userId, String nonceAuthenticato
501522
dismissSignupSheet();
502523
mLoginAnalyticsListener.trackLoginSocial2faNeeded();
503524
Login2FaFragment login2FaFragment = Login2FaFragment.newInstanceSocial(email, userId,
504-
nonceAuthenticator, nonceBackup,
505-
nonceSms);
525+
nonceAuthenticator, nonceBackup,
526+
nonceSms);
506527
slideInFragment(login2FaFragment, true, Login2FaFragment.TAG);
507528
}
508529

@@ -665,7 +686,7 @@ public void saveCredentialsInSmartLock(@Nullable final String username, @Nullabl
665686
}
666687

667688
mSmartLockHelper.saveCredentialsInSmartLock(StringUtils.notNullStr(username), StringUtils.notNullStr(password),
668-
displayName, profilePicture);
689+
displayName, profilePicture);
669690
}
670691

671692
@Override

WordPress/src/main/java/org/wordpress/android/ui/media/MediaGridAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ private boolean canSelectPosition(int position) {
432432
private void loadVideoThumbnail(final int position, final @NonNull MediaModel media,
433433
@NonNull final ImageView imageView) {
434434
// if we have a thumbnail url, use it and be done
435-
if (!TextUtils.isEmpty(media.getThumbnailUrl())) {
435+
if (!TextUtils.isEmpty(media.getThumbnailUrl()) && !MediaUtils.isVideo(media.getThumbnailUrl())) {
436436
mImageManager.load(imageView, ImageType.VIDEO, media.getThumbnailUrl(), ScaleType.CENTER_CROP);
437437
return;
438438
}

WordPress/src/main/java/org/wordpress/android/ui/stats/refresh/lists/StatsListFragment.kt

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,18 @@ import org.wordpress.android.ui.stats.refresh.lists.sections.granular.MonthsList
5454
import org.wordpress.android.ui.stats.refresh.lists.sections.granular.WeeksListViewModel
5555
import org.wordpress.android.ui.stats.refresh.lists.sections.granular.YearsListViewModel
5656
import org.wordpress.android.ui.stats.refresh.lists.sections.insights.InsightsListViewModel
57+
import org.wordpress.android.ui.stats.refresh.utils.StatsDateFormatter
5758
import org.wordpress.android.util.Event
5859
import org.wordpress.android.util.ToastUtils
5960
import org.wordpress.android.util.image.ImageManager
6061
import org.wordpress.android.util.observeEvent
62+
import java.util.Date
6163
import javax.inject.Inject
6264

6365
class StatsListFragment : DaggerFragment() {
6466
@Inject lateinit var viewModelFactory: ViewModelProvider.Factory
6567
@Inject lateinit var imageManager: ImageManager
68+
@Inject lateinit var statsDateFormatter: StatsDateFormatter
6669
private lateinit var viewModel: StatsListViewModel
6770

6871
private var layoutManager: LayoutManager? = null
@@ -213,55 +216,55 @@ class StatsListFragment : DaggerFragment() {
213216
activity,
214217
site,
215218
it.statsGranularity.toStatsTimeFrame(),
216-
it.selectedDate
219+
statsDateFormatter.printStatsDate(it.selectedDate)
217220
)
218221
}
219222
is ViewReferrers -> {
220223
ActivityLauncher.viewReferrersStats(
221224
activity,
222225
site,
223226
it.statsGranularity.toStatsTimeFrame(),
224-
it.selectedDate
227+
statsDateFormatter.printStatsDate(it.selectedDate)
225228
)
226229
}
227230
is ViewClicks -> {
228231
ActivityLauncher.viewClicksStats(
229232
activity,
230233
site,
231234
it.statsGranularity.toStatsTimeFrame(),
232-
it.selectedDate
235+
statsDateFormatter.printStatsDate(it.selectedDate)
233236
)
234237
}
235238
is ViewCountries -> {
236239
ActivityLauncher.viewCountriesStats(
237240
activity,
238241
site,
239242
it.statsGranularity.toStatsTimeFrame(),
240-
it.selectedDate
243+
statsDateFormatter.printStatsDate(it.selectedDate)
241244
)
242245
}
243246
is ViewVideoPlays -> {
244247
ActivityLauncher.viewVideoPlays(
245248
activity,
246249
site,
247250
it.statsGranularity.toStatsTimeFrame(),
248-
it.selectedDate
251+
statsDateFormatter.printStatsDate(it.selectedDate)
249252
)
250253
}
251254
is ViewSearchTerms -> {
252255
ActivityLauncher.viewSearchTerms(
253256
activity,
254257
site,
255258
it.statsGranularity.toStatsTimeFrame(),
256-
it.selectedDate
259+
statsDateFormatter.printStatsDate(it.selectedDate)
257260
)
258261
}
259262
is ViewAuthors -> {
260263
ActivityLauncher.viewAuthorsStats(
261264
activity,
262265
site,
263266
it.statsGranularity.toStatsTimeFrame(),
264-
it.selectedDate
267+
statsDateFormatter.printStatsDate(it.selectedDate)
265268
)
266269
}
267270
is ViewUrl -> {
@@ -305,13 +308,13 @@ sealed class NavigationTarget : Event() {
305308
class ViewTagsAndCategoriesStats : NavigationTarget()
306309
class ViewPublicizeStats : NavigationTarget()
307310
data class ViewTag(val link: String) : NavigationTarget()
308-
data class ViewPostsAndPages(val statsGranularity: StatsGranularity, val selectedDate: String) : NavigationTarget()
309-
data class ViewReferrers(val statsGranularity: StatsGranularity, val selectedDate: String) : NavigationTarget()
310-
data class ViewClicks(val statsGranularity: StatsGranularity, val selectedDate: String) : NavigationTarget()
311-
data class ViewCountries(val statsGranularity: StatsGranularity, val selectedDate: String) : NavigationTarget()
312-
data class ViewVideoPlays(val statsGranularity: StatsGranularity, val selectedDate: String) : NavigationTarget()
313-
data class ViewSearchTerms(val statsGranularity: StatsGranularity, val selectedDate: String) : NavigationTarget()
314-
data class ViewAuthors(val statsGranularity: StatsGranularity, val selectedDate: String) : NavigationTarget()
311+
data class ViewPostsAndPages(val statsGranularity: StatsGranularity, val selectedDate: Date) : NavigationTarget()
312+
data class ViewReferrers(val statsGranularity: StatsGranularity, val selectedDate: Date) : NavigationTarget()
313+
data class ViewClicks(val statsGranularity: StatsGranularity, val selectedDate: Date) : NavigationTarget()
314+
data class ViewCountries(val statsGranularity: StatsGranularity, val selectedDate: Date) : NavigationTarget()
315+
data class ViewVideoPlays(val statsGranularity: StatsGranularity, val selectedDate: Date) : NavigationTarget()
316+
data class ViewSearchTerms(val statsGranularity: StatsGranularity, val selectedDate: Date) : NavigationTarget()
317+
data class ViewAuthors(val statsGranularity: StatsGranularity, val selectedDate: Date) : NavigationTarget()
315318
data class ViewUrl(val url: String) : NavigationTarget()
316319
}
317320

0 commit comments

Comments
 (0)