Skip to content

Commit

Permalink
Merge pull request #8373 from wordpress-mobile/release/10.9
Browse files Browse the repository at this point in the history
Merge Release/10.9 into Master
  • Loading branch information
hypest authored Sep 26, 2018
2 parents 1fb793b + c4a809f commit 17cae8e
Show file tree
Hide file tree
Showing 129 changed files with 3,007 additions and 2,597 deletions.
5 changes: 3 additions & 2 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ android {

defaultConfig {
applicationId "org.wordpress.android"
versionName "10.9-rc-1"
versionCode 612
versionName "10.9.1"
versionCode 621
minSdkVersion 16
targetSdkVersion 26

Expand Down Expand Up @@ -141,6 +141,7 @@ dependencies {
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'
implementation 'com.android.installreferrer:installreferrer:1.0'
implementation 'com.github.chrisbanes.photoview:library:1.2.4'
implementation 'de.greenrobot:eventbus:2.4.0'
implementation 'com.automattic:rest:1.0.7'
Expand Down
18 changes: 18 additions & 0 deletions WordPress/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,16 @@
android:exported="false"
android:label="Notifications Update Job Service" />

<service
android:name=".util.analytics.service.InstallationReferrerService"
android:exported="false"
android:label="Installation Referrer Service" />
<service
android:name=".util.analytics.service.InstallationReferrerJobService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="false"
android:label="Installation Referrer Service" />

<service
android:name=".login.LoginWpcomService"
android:exported="false"
Expand Down Expand Up @@ -667,6 +677,14 @@
android:name="android.appwidget.provider"
android:resource="@xml/stats_widget_info" />
</receiver>
<receiver
android:name=".util.analytics.receiver.InstallationReferrerReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>


<!-- Google Cloud Messaging receiver and services -->
<meta-data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.Set;

public class JobServiceId {
public static final int JOB_INSTALL_REFERRER_SERVICE_ID = 9000;
public static final int JOB_STATS_SERVICE_ID = 8000;
public static final int JOB_NOTIFICATIONS_UPDATE_SERVICE_ID = 7000;
public static final int JOB_READER_SEARCH_SERVICE_ID = 5000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
import org.wordpress.android.ui.stats.datasets.StatsDatabaseHelper;
import org.wordpress.android.ui.stats.datasets.StatsTable;
import org.wordpress.android.ui.uploads.UploadService;
import org.wordpress.android.util.AnalyticsUtils;
import org.wordpress.android.util.analytics.AnalyticsUtils;
import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.AppLog.AppLogListener;
import org.wordpress.android.util.AppLog.LogLevel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import org.wordpress.android.ui.notifications.utils.NotificationsActions;
import org.wordpress.android.ui.notifications.utils.NotificationsUtils;
import org.wordpress.android.ui.notifications.utils.PendingDraftsNotificationsUtils;
import org.wordpress.android.util.AnalyticsUtils;
import org.wordpress.android.util.analytics.AnalyticsUtils;
import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.AppLog.T;
import org.wordpress.android.util.LocaleManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
import org.wordpress.android.ui.stats.models.StatsPostModel;
import org.wordpress.android.ui.stockmedia.StockMediaPickerActivity;
import org.wordpress.android.ui.themes.ThemeBrowserActivity;
import org.wordpress.android.util.AnalyticsUtils;
import org.wordpress.android.util.analytics.AnalyticsUtils;
import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.ToastUtils;
import org.wordpress.android.util.UrlUtils;
Expand Down Expand Up @@ -251,7 +251,7 @@ public static void viewPageParentForResult(@NonNull Fragment fragment, @NonNull
intent.putExtra(EXTRA_PAGE_REMOTE_ID_KEY, page.getRemoteId());
fragment.startActivityForResult(intent, RequestCodes.PAGE_PARENT);

AnalyticsUtils.trackWithSiteDetails(Stat.OPENED_PAGE_PARENT, page.getSite());
AnalyticsUtils.trackWithSiteDetails(AnalyticsTracker.Stat.OPENED_PAGE_PARENT, page.getSite());
}

public static void viewCurrentBlogComments(Context context, SiteModel site) {
Expand Down Expand Up @@ -297,6 +297,10 @@ public static void viewPluginDetail(Activity context, SiteModel site, String slu
}

public static void viewActivityLogList(Activity activity, SiteModel site) {
if (site == null) {
ToastUtils.showToast(activity, R.string.blog_not_found, ToastUtils.Duration.SHORT);
return;
}
AnalyticsUtils.trackWithSiteDetails(AnalyticsTracker.Stat.ACTIVITY_LOG_LIST_OPENED, site);
Intent intent = new Intent(activity, ActivityLogListActivity.class);
intent.putExtra(WordPress.SITE, site);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.wordpress.android.analytics.AnalyticsTracker;
import org.wordpress.android.fluxc.store.AccountStore;
import org.wordpress.android.ui.reader.ReaderActivityLauncher;
import org.wordpress.android.util.AnalyticsUtils;
import org.wordpress.android.util.analytics.AnalyticsUtils;
import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.AppLog.T;
import org.wordpress.android.util.LocaleManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.wordpress.android.fluxc.store.AccountStore;
import org.wordpress.android.login.LoginMode;
import org.wordpress.android.ui.accounts.LoginActivity;
import org.wordpress.android.util.AnalyticsUtils;
import org.wordpress.android.util.analytics.AnalyticsUtils;
import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.ToastUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import android.support.v7.app.AppCompatActivity
import android.view.MenuItem
import kotlinx.android.synthetic.main.toolbar.*
import org.wordpress.android.R
import org.wordpress.android.analytics.AnalyticsTracker.Stat.INSTALL_JETPACK_CANCELLED
import org.wordpress.android.ui.JetpackConnectionUtils.trackWithSource
import org.wordpress.android.ui.JetpackRemoteInstallFragment.Companion.TRACKING_SOURCE_KEY

class JetpackRemoteInstallActivity : AppCompatActivity() {
public override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -27,4 +30,12 @@ class JetpackRemoteInstallActivity : AppCompatActivity() {
}
return super.onOptionsItemSelected(item)
}

override fun onBackPressed() {
trackWithSource(
INSTALL_JETPACK_CANCELLED,
intent.getSerializableExtra(TRACKING_SOURCE_KEY) as JetpackConnectionSource
)
super.onBackPressed()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.arch.lifecycle.MutableLiveData
import android.arch.lifecycle.ViewModel
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import org.wordpress.android.analytics.AnalyticsTracker
import org.wordpress.android.fluxc.Dispatcher
import org.wordpress.android.fluxc.generated.JetpackActionBuilder
import org.wordpress.android.fluxc.model.SiteModel
Expand Down Expand Up @@ -89,12 +90,15 @@ class JetpackRemoteInstallViewModel
fun onEventsUpdated(event: OnJetpackInstalled) {
val site = siteModel ?: return
if (event.isError) {
AnalyticsTracker.track(AnalyticsTracker.Stat.INSTALL_JETPACK_REMOTE_FAILED)
mutableViewState.postValue(Error { startRemoteInstall(site) })
return
}
if (event.success) {
AnalyticsTracker.track(AnalyticsTracker.Stat.INSTALL_JETPACK_REMOTE_COMPLETED)
mutableViewState.postValue(Installed { connectJetpack(site.id) })
} else {
AnalyticsTracker.track(AnalyticsTracker.Stat.INSTALL_JETPACK_REMOTE_FAILED)
mutableViewState.postValue(Error { startRemoteInstall(site) })
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.wordpress.android.ui.main.WPMainActivity;
import org.wordpress.android.ui.media.MediaBrowserActivity;
import org.wordpress.android.ui.media.MediaBrowserType;
import org.wordpress.android.util.AnalyticsUtils;
import org.wordpress.android.util.analytics.AnalyticsUtils;
import org.wordpress.android.util.FluxCUtils;
import org.wordpress.android.util.LocaleManager;
import org.wordpress.android.util.PermissionUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -756,13 +756,18 @@ public void onGoogleSignupFinished(String name, String email, String photoUrl, S

@Override
public void onGoogleSignupError(String msg) {
BasicFragmentDialog dialog = new BasicFragmentDialog();
dialog.initialize(GOOGLE_ERROR_DIALOG_TAG, getString(R.string.error),
msg,
getString(org.wordpress.android.login.R.string.login_error_button),
null,
null);
dialog.show(this.getSupportFragmentManager(), GOOGLE_ERROR_DIALOG_TAG);
// Only show the error dialog if the activity is still active
if (!getSupportFragmentManager().isStateSaved()) {
BasicFragmentDialog dialog = new BasicFragmentDialog();
dialog.initialize(GOOGLE_ERROR_DIALOG_TAG, getString(R.string.error),
msg,
getString(org.wordpress.android.login.R.string.login_error_button),
null,
null);
dialog.show(getSupportFragmentManager(), GOOGLE_ERROR_DIALOG_TAG);
} else {
AppLog.d(T.MAIN, "'Google sign up failed' dialog not shown, because the activity wasn't visible.");
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.wordpress.android.fluxc.store.AccountStore;
import org.wordpress.android.fluxc.store.SiteStore;
import org.wordpress.android.login.LoginAnalyticsListener;
import org.wordpress.android.util.AnalyticsUtils;
import org.wordpress.android.util.analytics.AnalyticsUtils;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.wordpress.android.login.LoginBaseFormFragment;
import org.wordpress.android.ui.main.SitePickerAdapter;
import org.wordpress.android.ui.main.SitePickerAdapter.SiteList;
import org.wordpress.android.util.AnalyticsUtils;
import org.wordpress.android.util.analytics.AnalyticsUtils;
import org.wordpress.android.util.GravatarUtils;
import org.wordpress.android.util.StringUtils;
import org.wordpress.android.util.ViewUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import org.wordpress.android.fluxc.store.ActivityLogStore.RewindError
import org.wordpress.android.fluxc.store.ActivityLogStore.RewindPayload
import org.wordpress.android.fluxc.store.ActivityLogStore.RewindStatusError
import org.wordpress.android.modules.UI_CONTEXT
import org.wordpress.android.util.AnalyticsUtils
import org.wordpress.android.util.analytics.AnalyticsUtils
import java.util.Date
import javax.inject.Inject
import javax.inject.Named
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,25 @@ class ActivityLogListFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

log_list_view.layoutManager = LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false)
val nonNullActivity = checkNotNull(activity)

log_list_view.layoutManager = LinearLayoutManager(nonNullActivity, LinearLayoutManager.VERTICAL, false)

swipeToRefreshHelper = buildSwipeToRefreshHelper(swipe_refresh_layout) {
if (NetworkUtils.checkConnection(activity)) {
if (NetworkUtils.checkConnection(nonNullActivity)) {
viewModel.onPullToRefresh()
} else {
swipeToRefreshHelper.isRefreshing = false
}
}

(activity?.application as WordPress).component()?.inject(this)
(nonNullActivity.application as WordPress).component()?.inject(this)

viewModel = ViewModelProviders.of(this, viewModelFactory).get(ActivityLogViewModel::class.java)

val site = if (savedInstanceState == null) {
activity?.intent?.getSerializableExtra(WordPress.SITE) as SiteModel
val nonNullIntent = checkNotNull(nonNullActivity.intent)
nonNullIntent.getSerializableExtra(WordPress.SITE) as SiteModel
} else {
savedInstanceState.getSerializable(WordPress.SITE) as SiteModel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
import org.wordpress.android.ui.suggestion.service.SuggestionEvents;
import org.wordpress.android.ui.suggestion.util.SuggestionServiceConnectionManager;
import org.wordpress.android.ui.suggestion.util.SuggestionUtils;
import org.wordpress.android.util.AnalyticsUtils;
import org.wordpress.android.util.analytics.AnalyticsUtils;
import org.wordpress.android.util.AniUtils;
import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.AppLog.T;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
import org.wordpress.android.ui.reader.ReaderPostPagerActivity;
import org.wordpress.android.ui.uploads.UploadUtils;
import org.wordpress.android.util.AccessibilityUtils;
import org.wordpress.android.util.AnalyticsUtils;
import org.wordpress.android.util.analytics.AnalyticsUtils;
import org.wordpress.android.util.AniUtils;
import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.AppLog.T;
Expand All @@ -94,6 +94,7 @@
import org.wordpress.android.util.ShortcutUtils;
import org.wordpress.android.util.ToastUtils;
import org.wordpress.android.util.WPActivityUtils;
import org.wordpress.android.util.analytics.service.InstallationReferrerServiceStarter;
import org.wordpress.android.widgets.WPDialogSnackbar;

import java.util.List;
Expand Down Expand Up @@ -210,6 +211,10 @@ public void run() {
registeNewsItemObserver();

if (savedInstanceState == null) {
if (!AppPrefs.isInstallationReferrerObtained()) {
InstallationReferrerServiceStarter.startService(this, null);
}

if (FluxCUtils.isSignedInWPComOrHasWPOrgSite(mAccountStore, mSiteStore)) {
// open note detail if activity called from a push
boolean openedFromPush = (getIntent() != null && getIntent().getBooleanExtra(ARG_OPENED_FROM_PUSH,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
import org.wordpress.android.ui.uploads.UploadService;
import org.wordpress.android.ui.uploads.UploadUtils;
import org.wordpress.android.util.ActivityUtils;
import org.wordpress.android.util.AnalyticsUtils;
import org.wordpress.android.util.analytics.AnalyticsUtils;
import org.wordpress.android.util.AppLog;
import org.wordpress.android.util.DisplayUtils;
import org.wordpress.android.util.FluxCUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public interface MediaGridAdapterCallback {

public MediaGridAdapter(@NonNull Context context, @NonNull SiteModel site, @NonNull MediaBrowserType browserType) {
super();
((WordPress) WordPress.getContext()).component().inject(this);
((WordPress) WordPress.getContext().getApplicationContext()).component().inject(this);
setHasStableIds(true);

mContext = context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.wordpress.android.ui.news

import org.wordpress.android.util.AnalyticsUtils
import org.wordpress.android.util.analytics.AnalyticsUtils
import javax.inject.Inject

import javax.inject.Singleton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sealed class PageItem(open val type: Type) {
abstract class Page(
open val id: Long,
open val title: String,
open val labelRes: Int?,
open val labels: List<Int>,
open var indent: Int,
open val actions: Set<Action>,
open var actionsEnabled: Boolean
Expand All @@ -26,29 +26,29 @@ sealed class PageItem(open val type: Type) {
data class PublishedPage(
override val id: Long,
override val title: String,
override val labelRes: Int? = null,
override val labels: List<Int> = emptyList(),
override var indent: Int = 0,
override var actionsEnabled: Boolean = true
) : Page(id, title, labelRes, indent, setOf(VIEW_PAGE, SET_PARENT, MOVE_TO_DRAFT, MOVE_TO_TRASH), actionsEnabled)
) : Page(id, title, labels, indent, setOf(VIEW_PAGE, SET_PARENT, MOVE_TO_DRAFT, MOVE_TO_TRASH), actionsEnabled)

data class DraftPage(
override val id: Long,
override val title: String,
override val labelRes: Int? = null,
override val labels: List<Int> = emptyList(),
override var actionsEnabled: Boolean = true
) : Page(id, title, labelRes, 0, setOf(VIEW_PAGE, SET_PARENT, PUBLISH_NOW, MOVE_TO_TRASH), actionsEnabled)
) : Page(id, title, labels, 0, setOf(VIEW_PAGE, SET_PARENT, PUBLISH_NOW, MOVE_TO_TRASH), actionsEnabled)

data class ScheduledPage(
override val id: Long,
override val title: String,
override var actionsEnabled: Boolean = true
) : Page(id, title, null, 0, setOf(VIEW_PAGE, SET_PARENT, MOVE_TO_DRAFT, MOVE_TO_TRASH), actionsEnabled)
) : Page(id, title, emptyList(), 0, setOf(VIEW_PAGE, SET_PARENT, MOVE_TO_DRAFT, MOVE_TO_TRASH), actionsEnabled)

data class TrashedPage(
override val id: Long,
override val title: String,
override var actionsEnabled: Boolean = true
) : Page(id, title, null, 0, setOf(VIEW_PAGE, MOVE_TO_DRAFT, DELETE_PERMANENTLY), actionsEnabled)
) : Page(id, title, emptyList(), 0, setOf(VIEW_PAGE, MOVE_TO_DRAFT, DELETE_PERMANENTLY), actionsEnabled)

data class ParentPage(
val id: Long,
Expand Down
Loading

0 comments on commit 17cae8e

Please sign in to comment.