Skip to content

Commit

Permalink
Merge branch 'main' into pageToolbarT302397_design
Browse files Browse the repository at this point in the history
* main: (39 commits)
  Fix updating of reading lists after renaming. (#3251)
  Update kotlin-gradle-plugin version to 1.6.20 (#3250)
  Fix: update talk page pageTitle after changing the language (#3241)
  Refactor title functions (#3232)
  Disable flaky test of EventPlatformClient. (#3249)
  Prevent possible crash when highlighting text for editing. (#3248)
  Bump version code (#3247)
  Article clicks and Edit history analytics wiring (#3234)
  Change affects to affect (incorrect plural) (#3242)
  Fix improper scrolling/jumping when composing long Talk message. (#3245)
  Fix behavior of article overflow menu in split-screen mode. (#3244)
  Improve OOP logic for analytics events containing state information. (#3240)
  Localisation updates from https://translatewiki.net.
  Convert EventPlatformClient to kotlin. (#3239)
  Localisation updates from https://translatewiki.net.
  Get the updated value of duration in timed events. (#3237)
  Add DAO method to get multiple reading lists. (#3224)
  Fix deserialization of pageId. (#3236)
  Further optimize API calls to Commons and Wikidata. (#3227)
  Create constant WikiSite for Commons and Wikidata. (#3230)
  ...

# Conflicts:
#	app/src/main/java/org/wikipedia/page/PageActivity.kt
#	app/src/main/java/org/wikipedia/views/PageActionOverflowView.kt
#	app/src/main/res/layout/view_page_action_overflow.xml
#	app/src/main/res/values-qq/strings.xml
  • Loading branch information
sharvaniharan committed Apr 6, 2022
2 parents c3ed333 + a35aac9 commit 034db94
Show file tree
Hide file tree
Showing 141 changed files with 2,662 additions and 1,070 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ android {
applicationId 'org.wikipedia'
minSdkVersion 21
targetSdkVersion 31
versionCode 50397
versionCode 50399
testApplicationId 'org.wikipedia.test'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunnerArguments clearPackageData: 'true'
Expand Down Expand Up @@ -183,9 +183,9 @@ dependencies {
String mockitoVersion = '3.4.0'
String leakCanaryVersion = '2.8.1'
String kotlinCoroutinesVersion = '1.3.9'
String firebaseMessagingVersion = '23.0.0'
String firebaseMessagingVersion = '23.0.2'
String mlKitVersion = '17.0.3'
String roomVersion = "2.4.1"
String roomVersion = "2.4.2"
String espressoVersion = '3.4.0'
String serialization_version = '1.2.1'

Expand All @@ -200,7 +200,7 @@ dependencies {
implementation "androidx.browser:browser:1.4.0"
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation "androidx.fragment:fragment-ktx:1.4.1"
implementation "androidx.paging:paging-runtime-ktx:3.1.0"
implementation "androidx.paging:paging-runtime-ktx:3.1.1"
implementation "androidx.palette:palette-ktx:1.0.0"
implementation "androidx.preference:preference-ktx:1.2.0"
implementation "androidx.recyclerview:recyclerview:1.2.1"
Expand Down
8 changes: 5 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@
android:label="@string/tabs_activity_title"
android:theme="@style/AppTheme" />

<activity
android:name=".categories.CategoryActivity"
android:theme="@style/AppTheme.ActionBar" />

<activity android:name=".suggestededits.SuggestedEditsImageTagsOnboardingActivity" />

<activity
Expand Down Expand Up @@ -289,9 +293,7 @@
android:name=".talk.TalkTopicActivity" />

<activity
android:name=".diff.ArticleEditDetailsActivity"
android:label=""
android:theme="@style/AppTheme.ActionBar" />
android:name=".diff.ArticleEditDetailsActivity" />

<activity
android:name=".page.customize.CustomizeToolbarActivity"
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/java/org/wikipedia/Constants.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.wikipedia

import org.wikipedia.dataclient.Service
import org.wikipedia.dataclient.WikiSite

object Constants {

const val ACTIVITY_REQUEST_ADD_A_LANGUAGE = 59
Expand Down Expand Up @@ -57,7 +60,12 @@ object Constants {
const val SUGGESTION_REQUEST_ITEMS = 5

const val WIKI_CODE_COMMONS = "commons"
const val COMMONS_DB_NAME = "commonswiki"
const val WIKI_CODE_WIKIDATA = "wikidata"
const val WIKIDATA_DB_NAME = "wikidatawiki"

val commonsWikiSite = WikiSite(Service.COMMONS_URL)
val wikidataWikiSite = WikiSite(Service.WIKIDATA_URL)

enum class InvokeSource(val value: String) {
ANNOUNCEMENT("announcement"),
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/org/wikipedia/LongPressHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class LongPressHandler(
wikiSite = this
}
}
title = wikiSite.titleForInternalLink(uri.path)
title = PageTitle.titleForInternalLink(uri.path, wikiSite)
referrer = callback.referrer
showPopupMenu(view, true)
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/org/wikipedia/WikipediaApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public void onCreate() {
// For good measure, explicitly call our token subscription function, in case the
// API failed in previous attempts.
WikipediaFirebaseMessagingService.Companion.updateSubscription();
EventPlatformClient.setUpStreamConfigs();
EventPlatformClient.INSTANCE.setUpStreamConfigs();
}

public int getVersionCode() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
package org.wikipedia.analytics.eventplatform

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import org.wikipedia.auth.AccountUtil

class ArticleInteractionEvent(private var wikiDb: String, private var pageId: Int) : TimedEvent() {

fun logLoaded() {
submitEvent("load")
}

fun logSaveClick() {
submitEvent("save")
}

fun logLanguageClick() {
submitEvent("language")
}

fun logFindInArticleClick() {
submitEvent("find_in_article")
}

fun logThemeClick() {
submitEvent("theme")
}

fun logContentsClick() {
submitEvent("contents")
}

fun logMoreClick() {
submitEvent("more")
}

fun logShareClick() {
submitEvent("share")
}

fun logTalkPageClick() {
submitEvent("talk_page")
}

fun logEditHistoryClick() {
submitEvent("edit_history")
}

fun logNewTabClick() {
submitEvent("new_tab")
}

fun logExploreClick() {
submitEvent("explore")
}

fun logForwardClick() {
submitEvent("forward")
}

fun logNotificationClick() {
submitEvent("notification")
}

fun logTabsClick() {
submitEvent("tabs")
}

fun logSearchWikipediaClick() {
submitEvent("search_wikipedia")
}

fun logBackClick() {
submitEvent("back")
}

fun logEditHistoryArticleClick() {
submitEvent("edit_history_from_article")
}

fun logTalkPageArticleClick() {
submitEvent("talk_page_from_article")
}

fun logTocSwipe() {
submitEvent("toc_swipe")
}

fun logCategoriesClick() {
submitEvent("categories")
}

private fun submitEvent(action: String) {
EventPlatformClient.submit(ArticleInteractionEventImpl(!AccountUtil.isLoggedIn, duration, wikiDb, pageId, action))
}

@Suppress("unused")
@Serializable
@SerialName("/analytics/mobile_apps/android_article_toolbar_interaction/1.0.0")
class ArticleInteractionEventImpl(@SerialName("is_anon") private val isAnon: Boolean,
@SerialName("time_spent_ms") private var timeSpentMs: Int,
@SerialName("wiki_db") private var wikiDb: String,
@SerialName("page_id") private var pageId: Int,
private val action: String) :
MobileAppsEvent("android.article_toolbar_interaction")
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@ import org.wikipedia.auth.AccountUtil
import org.wikipedia.page.action.PageActionItem
import org.wikipedia.settings.Prefs

@Suppress("unused")
@Serializable
@SerialName("/analytics/mobile_apps/android_customize_toolbar_interaction/1.0.0")
class CustomizeToolbarEvent : TimedEvent(STREAM_NAME) {
@SerialName("is_anon") private var isAnon: Boolean? = null
@SerialName("is_rfm_enabled") private var isRfmEnabled: Boolean? = null
@SerialName("favorites_order") private var favoritesOrder: List<Int> = emptyList()
@SerialName("menu_order") private var menuOrder: List<Int> = emptyList()
@SerialName("time_spent_ms") private var timeSpentMs: Int = 0
private var source: String = ""
class CustomizeToolbarEvent : TimedEvent() {

fun logCustomization(favoritesOrder: List<Int>, menuOrder: List<Int>) {
this.isAnon = !AccountUtil.isLoggedIn
this.isRfmEnabled = Prefs.readingFocusModeEnabled
this.source = if (Prefs.customizeToolbarMenuOrder.contains(PageActionItem.THEME.id))
InvokeSource.PAGE_OVERFLOW_MENU.value else InvokeSource.PAGE_ACTION_TAB.value
this.favoritesOrder = favoritesOrder
this.menuOrder = menuOrder
this.timeSpentMs = duration.toInt()
EventPlatformClient.submit(this)
EventPlatformClient.submit(CustomizeToolbarEventImpl(
!AccountUtil.isLoggedIn,
Prefs.readingFocusModeEnabled,
favoritesOrder,
menuOrder,
duration,
if (Prefs.customizeToolbarMenuOrder.contains(PageActionItem.THEME.id))
InvokeSource.PAGE_OVERFLOW_MENU.value else InvokeSource.PAGE_ACTION_TAB.value)
)
}

companion object {
private const val STREAM_NAME = "android.customize_toolbar_interaction"
}
@Suppress("unused")
@Serializable
@SerialName("/analytics/mobile_apps/android_customize_toolbar_interaction/1.0.0")
class CustomizeToolbarEventImpl(
@SerialName("is_anon") private val isAnon: Boolean,
@SerialName("is_rfm_enabled") private val isRfmEnabled: Boolean,
@SerialName("favorites_order") private val favoritesOrder: List<Int>,
@SerialName("menu_order") private val menuOrder: List<Int>,
@SerialName("time_spent_ms") private val timeSpentMs: Int,
private val source: String
) : MobileAppsEvent("android.customize_toolbar_interaction")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package org.wikipedia.analytics.eventplatform

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import org.wikipedia.auth.AccountUtil

class EditHistoryInteractionEvent(private var wikiDb: String, private var pageId: Int) :
TimedEvent() {

fun logShowHistory() {
submitEvent("show_history")
}

fun logRevision() {
submitEvent("revision_view")
}

fun logCompare1() {
submitEvent("compare1")
}

fun logCompare2() {
submitEvent("compare2")
}

fun logThankTry() {
submitEvent("thank_try")
}

fun logThankSuccess() {
submitEvent("thank_success")
}

fun logThankFail() {
submitEvent("thank_fail")
}

private fun submitEvent(action: String) {
EventPlatformClient.submit(EditHistoryInteractionEventImpl(!AccountUtil.isLoggedIn, duration, wikiDb, pageId, action))
}

@Suppress("unused")
@Serializable
@SerialName("/analytics/mobile_apps/android_edit_history_interaction/1.0.0")
class EditHistoryInteractionEventImpl(@SerialName("is_anon") private val isAnon: Boolean,
@SerialName("time_spent_ms") private var timeSpentMs: Int,
@SerialName("wiki_db") private var wikiDb: String,
@SerialName("page_id") private var pageId: Int,
private val action: String) :
MobileAppsEvent("android.edit_history_interaction")
}

0 comments on commit 034db94

Please sign in to comment.