Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/src/main/java/org/wikipedia/login/LoginActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ class LoginActivity : BaseActivity() {
const val SOURCE_SUGGESTED_EDITS = "suggestededits"
const val SOURCE_TALK = "talk"
const val SOURCE_ACTIVITY_TAB = "activity_tab"
const val SOURCE_YEAR_IN_REVIEW = "yir"

fun newIntent(context: Context, source: String, createAccountFirst: Boolean = true): Intent {
return Intent(context, LoginActivity::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,72 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.res.stringResource
import org.wikipedia.R
import org.wikipedia.activity.BaseActivity
import org.wikipedia.auth.AccountUtil
import org.wikipedia.compose.components.WikipediaAlertDialog
import org.wikipedia.compose.theme.BaseTheme
import org.wikipedia.login.LoginActivity

class YearInReviewOnboardingActivity : BaseActivity() {

private val loginLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
if (it.resultCode == LoginActivity.RESULT_LOGIN_SUCCESS) {
proceed()
}
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
BaseTheme {
var showLoginDialog by remember { mutableStateOf(false) }
if (showLoginDialog) {
WikipediaAlertDialog(
title = stringResource(R.string.year_in_review_login_dialog_title),
message = stringResource(R.string.year_in_review_login_dialog_body),
confirmButtonText = stringResource(R.string.year_in_review_login_dialog_positive),
dismissButtonText = stringResource(R.string.year_in_review_login_dialog_negative),
onDismissRequest = {
showLoginDialog = false
},
onConfirmButtonClick = {
loginLauncher.launch(LoginActivity.newIntent(this, LoginActivity.SOURCE_YEAR_IN_REVIEW))
showLoginDialog = false
},
onDismissButtonClick = {
proceed()
}
)
}

YearInReviewOnboardingScreen(
onBackButtonClick = {
finish()
},
onGetStartedClick = {
startActivity(YearInReviewActivity.newIntent(this))
finish()
if (!AccountUtil.isLoggedIn) {
showLoginDialog = true
} else {
proceed()
}
}
)
}
}
}

private fun proceed() {
startActivity(YearInReviewActivity.newIntent(this))
finish()
}

companion object {
fun newIntent(context: Context): Intent {
return Intent(context, YearInReviewOnboardingActivity::class.java)
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values-qq/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1887,6 +1887,10 @@
<string name="year_in_review_screenshot_error">A generic error idicator with \"%s\" representing the actual error thrown</string>
<string name="year_in_review_share_subject">The subject line for sharing the year in review</string>
<string name="year_in_review_globe_icon">Content description for the year in review globe icon</string>
<string name="year_in_review_login_dialog_title">Title of a dialog asking the user to log in before accessing the Year in Review feature.</string>
<string name="year_in_review_login_dialog_body">Body text of a dialog asking the user to log in before accessing the Year in Review feature.</string>
<string name="year_in_review_login_dialog_positive">Positive button label for a dialog asking the user to log in before accessing the Year in Review feature.</string>
<string name="year_in_review_login_dialog_negative">Negative button label for a dialog asking the user to log in before accessing the Year in Review feature.</string>
<string name="recommended_reading_list_title">Title for the recommended reading list feature.</string>
<string name="recommended_reading_list_onboarding_card_title">Title of the onboarding card for the recommended reading list.</string>
<string name="recommended_reading_list_onboarding_card_message">Message on the onboarding card for the recommended reading list.</string>
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2007,6 +2007,10 @@
<string name="year_in_review_screenshot_error">Could not generate screenshot: %s</string>
<string name="year_in_review_share_subject">Year In Review Image and Link</string>
<string name="year_in_review_globe_icon">Globe Icon</string>
<string name="year_in_review_login_dialog_title">Log in for personalization?</string>
<string name="year_in_review_login_dialog_body">Logging in gives you access to personalized insights. You can still see collective insights without logging in.</string>
<string name="year_in_review_login_dialog_positive">Log in / join Wikipedia</string>
<string name="year_in_review_login_dialog_negative">Continue without logging in</string>


<!--Recommended Reading list -->
Expand Down
Loading