Skip to content

Commit

Permalink
Merge pull request #234 from PermanentOrg/feature/Legacy_Planning-DIalog
Browse files Browse the repository at this point in the history
Feature/legacy planning d ialog
  • Loading branch information
flaviuvsp authored Oct 27, 2023
2 parents f13a203 + 08a9c1f commit f0df767
Show file tree
Hide file tree
Showing 17 changed files with 1,245 additions and 1,020 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ android {
applicationId "org.permanent.PermanentArchive"
minSdkVersion 26
targetSdkVersion 34
versionCode 53
versionName "1.8.0"
versionCode 54
versionName "1.8.1"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
1,944 changes: 973 additions & 971 deletions app/mapping.txt

Large diffs are not rendered by default.

20 changes: 16 additions & 4 deletions app/src/main/java/org/permanent/permanent/ui/PreferencesHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const val IS_ARCHIVE_ONBOARDING_IN_APP = "is_archive_onboarding_done_in_app"
const val IS_USER_LOGGED_IN = "is_user_logged_in"
const val IS_BIOMETRICS_LOG_IN = "is_biometrics_log_in"
const val IS_WELCOME_SEEN = "is_welcome_seen"
const val IS_LEGACY_SEEN = "is_legacy_seen"
const val IS_ARCHIVE_ONBOARDING_DEFAULT_FLOW = "is_archive_onboarding_default_flow"
const val IS_LIST_VIEW_MODE = "is_list_view_mode"
const val SHOW_ARCHIVES_SCREEN = "should_show_archives_screen"
Expand Down Expand Up @@ -39,10 +40,6 @@ const val PREFS_DEEP_LINK_FOLDER_LINK_ID = "preferences_deep_link_folder_link_id

class PreferencesHelper(private val sharedPreferences: SharedPreferences) {

fun isOnboardingCompleted(): Boolean {
return sharedPreferences.getBoolean(IS_ONBOARDING_COMPLETED, false)
}

fun saveWelcomeDialogSeen(isSeen: Boolean) {
with(sharedPreferences.edit()) {
putBoolean(IS_WELCOME_SEEN, isSeen)
Expand All @@ -54,6 +51,21 @@ class PreferencesHelper(private val sharedPreferences: SharedPreferences) {
return sharedPreferences.getBoolean(IS_WELCOME_SEEN, false)
}

fun saveLegacyDialogSeen(isSeen: Boolean) {
with(sharedPreferences.edit()) {
putBoolean(IS_LEGACY_SEEN, isSeen)
apply()
}
}

fun isLegacyDialogSeen(): Boolean {
return sharedPreferences.getBoolean(IS_LEGACY_SEEN, false)
}

fun isOnboardingCompleted(): Boolean {
return sharedPreferences.getBoolean(IS_ONBOARDING_COMPLETED, false)
}

fun saveArchiveOnboardingDefaultFlow(isDefault: Boolean) {
with(sharedPreferences.edit()) {
putBoolean(IS_ARCHIVE_ONBOARDING_DEFAULT_FLOW, isDefault)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.RelativeLayout
import androidx.core.content.ContextCompat
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
Expand All @@ -30,7 +29,6 @@ class StorageFragment : PermanentBaseFragment(), TabLayout.OnTabSelectedListener

private lateinit var binding: FragmentStorageBinding
private lateinit var viewModel: StorageViewModel
private lateinit var googlePayButton: RelativeLayout
private lateinit var googlePayLauncher: GooglePayLauncher
private var isGooglePayReady: Boolean = false

Expand All @@ -44,7 +42,6 @@ class StorageFragment : PermanentBaseFragment(), TabLayout.OnTabSelectedListener
binding.executePendingBindings()
binding.lifecycleOwner = this
binding.viewModel = viewModel
googlePayButton = binding.buttonLayout

binding.tlAmount.addTab(binding.tlAmount.newTab().setText(DONATION_AMOUNT_10_VALUE))
binding.tlAmount.addTab(binding.tlAmount.newTab().setText(DONATION_AMOUNT_20_VALUE))
Expand All @@ -63,7 +60,7 @@ class StorageFragment : PermanentBaseFragment(), TabLayout.OnTabSelectedListener
readyCallback = ::onGooglePayReady,
resultCallback = ::onGooglePayResult
)
binding.buttonLayout.setOnClickListener {
binding.btnEndow.setOnClickListener {
if (!isGooglePayReady) showDialogThatNavigatesToGoogleWallet()
else viewModel.getPaymentIntent()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import org.permanent.permanent.RECIPIENT_ARCHIVE_NAME_KEY
import org.permanent.permanent.RECIPIENT_ARCHIVE_NR_KEY
import org.permanent.permanent.START_DESTINATION_FRAGMENT_ID_KEY
import org.permanent.permanent.databinding.ActivityMainBinding
import org.permanent.permanent.databinding.DialogLegacyPlanningBinding
import org.permanent.permanent.databinding.DialogTitleTextTwoButtonsBinding
import org.permanent.permanent.databinding.DialogWelcomeBinding
import org.permanent.permanent.databinding.NavMainHeaderBinding
Expand Down Expand Up @@ -109,7 +110,7 @@ class MainActivity : PermanentBaseActivity(), Toolbar.OnMenuItemClickListener {
binding.toolbar.menu?.findItem(R.id.moreItem)?.isVisible = true
}

R.id.loadingFragment-> {
R.id.legacyLoadingFragment-> {
binding.toolbar.menu?.findItem(R.id.settingsItem)?.isVisible = false
}

Expand Down Expand Up @@ -272,6 +273,10 @@ class MainActivity : PermanentBaseActivity(), Toolbar.OnMenuItemClickListener {
showWelcomeDialog()
}

if (!prefsHelper.isLegacyDialogSeen()) {
showLegacyDialog()
}

if (!isGooglePlayServicesAvailable(this)) GoogleApiAvailability.getInstance()
.makeGooglePlayServicesAvailable(this)
}
Expand Down Expand Up @@ -404,6 +409,24 @@ class MainActivity : PermanentBaseActivity(), Toolbar.OnMenuItemClickListener {
alert.show()
}

private fun showLegacyDialog() {
val dialogBinding: DialogLegacyPlanningBinding = DataBindingUtil.inflate(
LayoutInflater.from(this), R.layout.dialog_legacy_planning, null, false
)
val alert = AlertDialog.Builder(this).setView(dialogBinding.root).create()
dialogBinding.ivClose.setOnClickListener {
prefsHelper.saveLegacyDialogSeen(true)
alert.dismiss()
}
dialogBinding.btnTryNow.setOnClickListener {
prefsHelper.saveLegacyDialogSeen(true)
navController.navigate(R.id.legacyLoadingFragment)
alert.dismiss()
}
alert.setCanceledOnTouchOutside(false)
alert.show()
}

private fun isGooglePlayServicesAvailable(activity: Activity): Boolean {
val googleApiAvailability: GoogleApiAvailability = GoogleApiAvailability.getInstance()
val status = googleApiAvailability.isGooglePlayServicesAvailable(activity)
Expand Down
27 changes: 27 additions & 0 deletions app/src/main/res/drawable/ic_google_pay_mark.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="62dp"
android:height="32dp"
android:viewportWidth="62"
android:viewportHeight="32">
<path
android:pathData="M29.622,17.136V21.976H28.086V10.024H32.158C33.19,10.024 34.07,10.368 34.79,11.056C35.526,11.744 35.894,12.584 35.894,13.576C35.894,14.592 35.526,15.432 34.79,16.112C34.078,16.792 33.198,17.128 32.158,17.128H29.622V17.136ZM29.622,11.496V15.664H32.19C32.798,15.664 33.31,15.456 33.71,15.048C34.118,14.64 34.326,14.144 34.326,13.584C34.326,13.032 34.118,12.544 33.71,12.136C33.31,11.712 32.806,11.504 32.19,11.504H29.622V11.496Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M39.912,13.528C41.048,13.528 41.944,13.832 42.6,14.44C43.256,15.048 43.584,15.88 43.584,16.936V21.976H42.12V20.84H42.056C41.424,21.776 40.576,22.24 39.52,22.24C38.616,22.24 37.864,21.976 37.256,21.44C36.648,20.904 36.344,20.24 36.344,19.44C36.344,18.592 36.664,17.92 37.304,17.424C37.944,16.92 38.8,16.672 39.864,16.672C40.776,16.672 41.528,16.84 42.112,17.176V16.824C42.112,16.288 41.904,15.84 41.48,15.464C41.056,15.088 40.56,14.904 39.992,14.904C39.136,14.904 38.456,15.264 37.96,15.992L36.608,15.144C37.352,14.064 38.456,13.528 39.912,13.528ZM37.928,19.464C37.928,19.864 38.096,20.2 38.44,20.464C38.776,20.728 39.176,20.864 39.632,20.864C40.28,20.864 40.856,20.624 41.36,20.144C41.864,19.664 42.12,19.104 42.12,18.456C41.64,18.08 40.976,17.888 40.12,17.888C39.496,17.888 38.976,18.04 38.56,18.336C38.136,18.648 37.928,19.024 37.928,19.464Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M51.934,13.792L46.814,25.568H45.23L47.134,21.448L43.758,13.792H45.43L47.862,19.664H47.894L50.262,13.792H51.934Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M23.512,16.16C23.512,15.66 23.467,15.181 23.384,14.72H16.945V17.36L20.653,17.361C20.503,18.239 20.019,18.988 19.277,19.487V21.2H21.485C22.773,20.007 23.512,18.244 23.512,16.16Z"
android:fillColor="#4285F4"/>
<path
android:pathData="M19.28,19.486C18.666,19.901 17.875,20.143 16.949,20.143C15.161,20.143 13.644,18.938 13.101,17.315H10.824V19.081C11.952,21.319 14.271,22.855 16.949,22.855C18.8,22.855 20.355,22.247 21.487,21.198L19.28,19.486Z"
android:fillColor="#34A853"/>
<path
android:pathData="M12.885,16.004C12.885,15.548 12.961,15.108 13.099,14.693V12.927H10.823C10.356,13.852 10.094,14.897 10.094,16.004C10.094,17.112 10.357,18.156 10.823,19.082L13.099,17.316C12.961,16.901 12.885,16.46 12.885,16.004Z"
android:fillColor="#FABB05"/>
<path
android:pathData="M16.949,11.864C17.959,11.864 18.864,12.212 19.579,12.892L21.535,10.938C20.347,9.832 18.798,9.152 16.949,9.152C14.271,9.152 11.952,10.688 10.824,12.927L13.101,14.693C13.644,13.069 15.161,11.864 16.949,11.864Z"
android:fillColor="#E94235"/>
</vector>
13 changes: 13 additions & 0 deletions app/src/main/res/drawable/ic_legacy_hands.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="30dp"
android:height="24dp"
android:viewportWidth="30"
android:viewportHeight="24">
<group>
<clip-path
android:pathData="M0,0h30v24h-30z"/>
<path
android:pathData="M8.438,3.591C8.438,1.608 10.045,0 12.028,0C12.98,0 13.894,0.38 14.564,1.05L15,1.486L15.436,1.05C16.106,0.38 17.02,0 17.972,0C19.955,0 21.563,1.608 21.563,3.591C21.563,4.542 21.183,5.456 20.513,6.127L15.661,10.973C15.295,11.339 14.7,11.339 14.334,10.973L9.488,6.127C8.817,5.456 8.438,4.542 8.438,3.591ZM1.875,3C2.911,3 3.75,3.839 3.75,4.875V6.75V10.5V12.384C3.75,13.181 4.064,13.945 4.627,14.508L7.022,16.903C7.411,17.292 8.02,17.353 8.475,17.048C9.08,16.645 9.164,15.788 8.648,15.277L7.936,14.564L6.436,13.064C5.85,12.478 5.85,11.527 6.436,10.941C7.022,10.355 7.973,10.355 8.559,10.941L10.059,12.441L10.772,13.153L11.958,14.339C12.942,15.323 13.495,16.659 13.495,18.052V21.75C13.495,22.992 12.488,24 11.245,24H8.123C7.327,24 6.563,23.686 6,23.123L1.317,18.441C0.473,17.597 0,16.453 0,15.258V10.5V7.5V4.875C0,3.839 0.839,3 1.875,3ZM28.125,3C29.161,3 30,3.839 30,4.875V7.5V10.5V15.258C30,16.453 29.527,17.597 28.683,18.441L24,23.123C23.438,23.686 22.673,24 21.877,24H18.75C17.508,24 16.5,22.992 16.5,21.75V18.052C16.5,16.659 17.053,15.323 18.038,14.339L19.223,13.153L19.936,12.441L21.436,10.941C22.022,10.355 22.973,10.355 23.559,10.941C24.145,11.527 24.145,12.478 23.559,13.064L22.059,14.564L21.347,15.277C20.831,15.792 20.916,16.645 21.52,17.048C21.975,17.353 22.584,17.292 22.973,16.903L25.369,14.508C25.931,13.945 26.245,13.181 26.245,12.384V10.5V6.75V4.875C26.245,3.839 27.084,3 28.12,3H28.125Z"
android:fillColor="#ffffff"/>
</group>
</vector>
24 changes: 24 additions & 0 deletions app/src/main/res/drawable/ic_new_feature.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="76dp"
android:height="18dp"
android:viewportWidth="76"
android:viewportHeight="18">
<path
android:pathData="M4,0L72,0A4,4 0,0 1,76 4L76,14A4,4 0,0 1,72 18L4,18A4,4 0,0 1,0 14L0,4A4,4 0,0 1,4 0z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="0"
android:startY="0"
android:endX="8.073"
android:endY="34.088"
android:type="linear">
<item android:offset="0" android:color="#FF8D0085"/>
<item android:offset="1" android:color="#FFFF9400"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M11.961,12H10.422L7.938,7.68H7.902C7.952,8.443 7.977,8.987 7.977,9.313V12H6.895V6.289H8.422L10.902,10.566H10.93C10.891,9.824 10.871,9.299 10.871,8.992V6.289H11.961V12ZM17.491,12H14.202V6.289H17.491V7.281H15.413V8.535H17.347V9.527H15.413V11H17.491V12ZM25.049,12H23.67L22.897,9C22.868,8.893 22.819,8.673 22.748,8.34C22.681,8.004 22.642,7.779 22.631,7.664C22.616,7.805 22.577,8.031 22.514,8.344C22.452,8.654 22.403,8.875 22.369,9.008L21.6,12H20.225L18.768,6.289H19.959L20.69,9.406C20.817,9.982 20.91,10.481 20.967,10.902C20.983,10.754 21.018,10.525 21.073,10.215C21.13,9.902 21.183,9.66 21.233,9.488L22.065,6.289H23.209L24.041,9.488C24.078,9.632 24.123,9.85 24.178,10.144C24.233,10.439 24.274,10.691 24.303,10.902C24.329,10.699 24.371,10.447 24.428,10.144C24.485,9.84 24.538,9.594 24.584,9.406L25.311,6.289H26.502L25.049,12ZM32.091,12H30.899V6.289H34.173V7.281H32.091V8.754H34.028V9.742H32.091V12ZM39.379,12H36.09V6.289H39.379V7.281H37.301V8.535H39.234V9.527H37.301V11H39.379V12ZM44.87,12L44.456,10.641H42.374L41.96,12H40.655L42.671,6.266H44.152L46.175,12H44.87ZM44.167,9.625C43.784,8.393 43.568,7.697 43.519,7.535C43.472,7.374 43.438,7.246 43.417,7.152C43.331,7.486 43.085,8.31 42.679,9.625H44.167ZM49.901,12H48.69V7.297H47.139V6.289H51.452V7.297H49.901V12ZM57.779,6.289V9.984C57.779,10.406 57.684,10.776 57.494,11.094C57.306,11.411 57.034,11.655 56.677,11.824C56.321,11.993 55.899,12.078 55.412,12.078C54.677,12.078 54.107,11.891 53.701,11.516C53.294,11.138 53.091,10.622 53.091,9.969V6.289H54.298V9.785C54.298,10.225 54.387,10.548 54.564,10.754C54.741,10.96 55.034,11.063 55.443,11.063C55.839,11.063 56.125,10.96 56.302,10.754C56.482,10.546 56.572,10.22 56.572,9.777V6.289H57.779ZM61.188,8.824H61.579C61.962,8.824 62.244,8.76 62.427,8.633C62.609,8.505 62.7,8.305 62.7,8.031C62.7,7.76 62.606,7.568 62.419,7.453C62.234,7.339 61.946,7.281 61.556,7.281H61.188V8.824ZM61.188,9.809V12H59.977V6.289H61.641C62.417,6.289 62.992,6.431 63.364,6.715C63.736,6.996 63.923,7.424 63.923,8C63.923,8.336 63.83,8.635 63.645,8.898C63.46,9.159 63.199,9.363 62.86,9.512C63.72,10.796 64.279,11.625 64.54,12H63.196L61.833,9.809H61.188ZM69.348,12H66.059V6.289H69.348V7.281H67.27V8.535H69.203V9.527H67.27V11H69.348V12Z"
android:fillColor="#ffffff"/>
</vector>
128 changes: 128 additions & 0 deletions app/src/main/res/layout/dialog_legacy_planning.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<data></data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
app:layout_constraintEnd_toStartOf="@+id/guideline2"
app:layout_constraintStart_toStartOf="@+id/guideline2">

<ImageView
android:id="@+id/ivLegacyLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0"
app:srcCompat="@drawable/ic_legacy_hands" />

<ImageView
android:id="@+id/ivClose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="2dp"
android:padding="24dp"
app:layout_constraintBottom_toBottomOf="@+id/ivLegacyLogo"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/ivLegacyLogo"
app:srcCompat="@drawable/ic_close_middle_grey"
app:tint="@color/whiteSuperTransparent" />

<TextView
android:id="@+id/tvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:fontFamily="@font/open_sans_bold"
android:letterSpacing="-0.01"
android:text="@string/dialog_legacy_title"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivLegacyLogo" />

<ImageView
android:id="@+id/ivNewFeature"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
app:layout_constraintBottom_toBottomOf="@+id/tvTitle"
app:layout_constraintStart_toEndOf="@+id/tvTitle"
app:layout_constraintTop_toTopOf="@+id/tvTitle"
app:srcCompat="@drawable/ic_new_feature" />

<TextView
android:id="@+id/tvText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="24dp"
android:fontFamily="@font/open_sans"
android:letterSpacing="-0.01"
android:text="@string/dialog_legacy_text"
android:textColor="@color/whiteTransparent"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvTitle" />

<View
android:id="@+id/viewDivider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:background="@color/whiteSuperTransparent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvText" />

<com.google.android.material.button.MaterialButton
android:id="@+id/btnTryNow"
style="@style/customButtonBottomSheetStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="24dp"
android:fontFamily="@font/open_sans"
android:letterSpacing="-0.01"
android:paddingStart="0dp"
android:text="@string/button_try_now"
android:textAlignment="textStart"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/viewDivider"
app:layout_constraintVertical_bias="0.0" />

<ImageView
android:id="@+id/ivArrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="2dp"
app:layout_constraintBottom_toBottomOf="@+id/btnTryNow"
app:layout_constraintEnd_toEndOf="@+id/btnTryNow"
app:layout_constraintTop_toTopOf="@+id/btnTryNow"
app:srcCompat="@drawable/ic_arrow_select_grey"
app:tint="@color/white" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_archive_options.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
android:textAlignment="textStart"
android:textAllCaps="false"
android:textColor="@color/black"
app:icon="@drawable/legacy_planning_menu"
app:icon="@drawable/ic_legacy_planning_primary"
app:iconPadding="16dp"
app:iconTint="@color/black"
android:visibility="@{viewModel.accessRole != AccessRole.OWNER ? View.GONE : View.VISIBLE}"
Expand Down
Loading

0 comments on commit f0df767

Please sign in to comment.