From af5982593fd5884bec0957387b4236af9fc89d9a Mon Sep 17 00:00:00 2001 From: Andrey Date: Wed, 8 Jan 2025 11:48:22 +0100 Subject: [PATCH 1/2] Removed unused quick login module --- quicklogin/.gitignore | 1 - quicklogin/build.gradle | 102 ----------- quicklogin/src/main/AndroidManifest.xml | 2 - .../android/quicklogin/QuickLoginWordpress.kt | 161 ------------------ quicklogin/woo_login.sh | 24 --- settings.gradle | 1 - 6 files changed, 291 deletions(-) delete mode 100644 quicklogin/.gitignore delete mode 100644 quicklogin/build.gradle delete mode 100644 quicklogin/src/main/AndroidManifest.xml delete mode 100644 quicklogin/src/main/kotlin/com/woocommerce/android/quicklogin/QuickLoginWordpress.kt delete mode 100755 quicklogin/woo_login.sh diff --git a/quicklogin/.gitignore b/quicklogin/.gitignore deleted file mode 100644 index 796b96d1c40..00000000000 --- a/quicklogin/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/quicklogin/build.gradle b/quicklogin/build.gradle deleted file mode 100644 index 777990b5d42..00000000000 --- a/quicklogin/build.gradle +++ /dev/null @@ -1,102 +0,0 @@ -plugins { - alias(libs.plugins.android.test) - alias(libs.plugins.kotlin.android) -} - -repositories { - maven { - url 'https://a8c-libs.s3.amazonaws.com/android' - content { - includeGroup "org.wordpress" - includeGroup "org.wordpress.fluxc" - includeGroup "org.wordpress.fluxc.plugins" - includeGroup "org.wordpress.wellsql" - includeGroup "org.wordpress.mediapicker" - includeGroup "com.automattic" - includeGroup "com.automattic.tracks" - } - } - maven { - url 'https://zendesk.jfrog.io/zendesk/repo' - content { - includeGroup "com.zendesk" - includeGroup "com.zendesk.belvedere2" - } - } - mavenCentral() - maven { - url "https://a8c-libs.s3.amazonaws.com/android/jcenter-mirror" - content { - includeVersion "com.android.volley", "volley", "1.1.1" - includeVersion "com.google.android", "flexbox", "2.0.1" - includeVersion "com.jraska", "falcon", "2.1.1" - includeVersion "org.wordpress", "wellsql", "1.6.0" - includeVersion "org.wordpress", "wellsql-core", "1.6.0" - } - } - maven { - url "https://jitpack.io" - content { - includeModule("com.github.Automattic", "Automattic-Tracks-Android") - includeModule("com.github.wordpress-mobile.WordPress-Aztec-Android", "aztec") - includeModule("com.github.wordpress-mobile.WordPress-Aztec-Android", "glide-loader") - includeModule("com.github.chrisbanes", "PhotoView") - includeModule("com.github.PhilJay", "MPAndroidChart") - } - } -} - -android { - namespace "com.woocommerce.android.quicklogin" - - compileSdkVersion gradle.ext.compileSdkVersion - - defaultConfig { - minSdkVersion gradle.ext.minSdkVersion - targetSdkVersion gradle.ext.targetSdkVersion - - missingDimensionStrategy 'buildType', 'wasabi' - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - testApplicationId "com.woocommerce.android.dev.quicklogin" - - buildConfigField "String", "QUICK_LOGIN_WP_EMAIL", "\"${project.getProperties().get("quickLoginWpEmail")}\"" - buildConfigField "String", "QUICK_LOGIN_WP_PASSWORD", "\"${project.getProperties().get("quickLoginWpPassword")}\"" - buildConfigField "String", "QUICK_LOGIN_WP_SITE", "\"${project.getProperties().get("quickLoginWpSite")}\"" - } - - compileOptions { - sourceCompatibility libs.versions.java.get() - targetCompatibility libs.versions.java.get() - } - - buildFeatures { - buildConfig true - } - - targetProjectPath ':WooCommerce' -} - -dependencies { - implementation(libs.androidx.lifecycle.process) - - implementation(libs.androidx.test.uiautomator) - implementation(libs.junit) - implementation(libs.androidx.test.ext.junit) - implementation(libs.androidx.test.main.runner) - implementation(libs.androidx.test.main.rules) - implementation(libs.androidx.test.main.core) -} - -if (project.hasProperty("debugStoreFile")) { - def sharedDebugStore = file(project.debugStoreFile.replaceFirst("^~", System.getProperty("user.home"))) - if (sharedDebugStore.exists()) { - android { - signingConfigs { - debug { - storeFile sharedDebugStore - } - } - } - } -} diff --git a/quicklogin/src/main/AndroidManifest.xml b/quicklogin/src/main/AndroidManifest.xml deleted file mode 100644 index 8072ee00dbf..00000000000 --- a/quicklogin/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/quicklogin/src/main/kotlin/com/woocommerce/android/quicklogin/QuickLoginWordpress.kt b/quicklogin/src/main/kotlin/com/woocommerce/android/quicklogin/QuickLoginWordpress.kt deleted file mode 100644 index f14af966a89..00000000000 --- a/quicklogin/src/main/kotlin/com/woocommerce/android/quicklogin/QuickLoginWordpress.kt +++ /dev/null @@ -1,161 +0,0 @@ -package com.woocommerce.android.quicklogin - -import android.content.ClipboardManager -import android.content.Context -import android.content.Intent -import androidx.test.core.app.ApplicationProvider -import androidx.test.ext.junit.runners.AndroidJUnit4 -import androidx.test.platform.app.InstrumentationRegistry -import androidx.test.uiautomator.By -import androidx.test.uiautomator.Direction.DOWN -import androidx.test.uiautomator.UiDevice -import androidx.test.uiautomator.UiObject2 -import androidx.test.uiautomator.Until -import com.woocommerce.android.AppPrefs -import org.junit.Before -import org.junit.Test -import org.junit.runner.RunWith - -private const val DEBUG_PACKAGE_NAME = "com.woocommerce.android.dev" -private const val SHORT_TIMEOUT = 2000L -private const val TIMEOUT = 5000L -private const val LONG_TIMEOUT = 60000L - -private const val SECOND_FACTOR_LENGTH = 6 -private const val SITE_FLINGS_COUNT = 10 - -@RunWith(AndroidJUnit4::class) -class QuickLoginWordpress { - private val instrumentation = InstrumentationRegistry.getInstrumentation() - private val device = UiDevice.getInstance(instrumentation) - private val context = ApplicationProvider.getApplicationContext() - - @Before - fun init() { - AppPrefs.init(context) - } - - @Test - fun loginWithWordpress() { - verifyEmailAndPassword() - startTheApp() - chooseWpComLogin() - enterEmail() - enterPassword() - enterSecondFactorIfNeeded() - selectSiteIfProvided() - } - - private fun verifyEmailAndPassword() { - if (BuildConfig.QUICK_LOGIN_WP_EMAIL.isBlank() || - BuildConfig.QUICK_LOGIN_WP_PASSWORD.isBlank() - ) { - exitFlowWithMessage("WP Email or password is not set. Look into quicklogin/woo_login.sh-example") - } - } - - private fun startTheApp() { - device.pressHome() - - device.wait(Until.hasObject(By.pkg(device.launcherPackageName).depth(0)), TIMEOUT) - - val launchIntentForPackage = context.packageManager.getLaunchIntentForPackage(DEBUG_PACKAGE_NAME) - if (launchIntentForPackage == null) exitFlowWithMessage("$DEBUG_PACKAGE_NAME is not installed") - val intent = launchIntentForPackage?.apply { addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) } - context.startActivity(intent) - - device.wait( - Until.hasObject(By.pkg(DEBUG_PACKAGE_NAME).depth(0)), - TIMEOUT - ) - } - - private fun chooseWpComLogin() { - val loginWithWpButton = device - .wait(Until.findObject(By.res(DEBUG_PACKAGE_NAME, "button_login_wpcom")), TIMEOUT) - - if (loginWithWpButton == null) exitFlowWithMessage("You are logged in already") - - loginWithWpButton.click() - } - - private fun enterEmail() { - val emailInputField = device - .wait(Until.findObject(By.res(DEBUG_PACKAGE_NAME, "input")), TIMEOUT) - val continueButton = device - .wait(Until.findObject(By.res(DEBUG_PACKAGE_NAME, "login_continue_button")), TIMEOUT) - - emailInputField.text = BuildConfig.QUICK_LOGIN_WP_EMAIL - continueButton.click() - } - - private fun enterPassword() { - val passwordInputField = device - .wait(Until.findObject(By.res(DEBUG_PACKAGE_NAME, "input")), TIMEOUT) - val continueButton = device - .wait(Until.findObject(By.res(DEBUG_PACKAGE_NAME, "bottom_button")), TIMEOUT) - - if (passwordInputField == null) exitFlowWithMessage("Check used email address") - - passwordInputField.text = BuildConfig.QUICK_LOGIN_WP_PASSWORD - continueButton.click() - } - - private fun enterSecondFactorIfNeeded() { - device - .wait(Until.findObject(By.res(DEBUG_PACKAGE_NAME, "login_otp_button")), TIMEOUT) - ?: return - - val secondFactorInputField = device - .wait(Until.findObject(By.res(DEBUG_PACKAGE_NAME, "input")), TIMEOUT) - - val continueButton = device - .wait(Until.findObject(By.res(DEBUG_PACKAGE_NAME, "bottom_button")), TIMEOUT) - - instrumentation.runOnMainSync { - val clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager - if (clipboard.hasPrimaryClip() && - clipboard.primaryClip!!.getItemAt(0).text.length == SECOND_FACTOR_LENGTH - ) { - secondFactorInputField.text = clipboard.primaryClip!!.getItemAt(0).text.toString() - } - } - continueButton.click() - - device.wait(Until.findObject(By.res(DEBUG_PACKAGE_NAME, "site_list_container")), LONG_TIMEOUT) - } - - private fun selectSiteIfProvided() { - if (BuildConfig.QUICK_LOGIN_WP_SITE.isBlank().not()) { - val siteList = device - .wait(Until.findObject(By.res(DEBUG_PACKAGE_NAME, "site_list_container")), TIMEOUT) - ?: return - - val selectedSite = findSelectedSite(siteList) ?: return - - val doneButton = device - .wait(Until.findObject(By.res(DEBUG_PACKAGE_NAME, "button_primary")), TIMEOUT) - - selectedSite.click() - doneButton.click() - - device.wait(Until.findObject(By.res(DEBUG_PACKAGE_NAME, "bottom_nav")), LONG_TIMEOUT) - } - } - - private fun findSelectedSite(siteList: UiObject2): UiObject2? { - fun findSiteToSelect() = device.wait(Until.findObject(By.text(BuildConfig.QUICK_LOGIN_WP_SITE)), SHORT_TIMEOUT) - var selectedSite = findSiteToSelect() - var flingsCount = 0 - while (selectedSite == null && flingsCount < SITE_FLINGS_COUNT) { - siteList.fling(DOWN) - selectedSite = findSiteToSelect() - flingsCount++ - } - return selectedSite - } - - private fun exitFlowWithMessage(message: String) { - throw IllegalStateException(message) - } -} diff --git a/quicklogin/woo_login.sh b/quicklogin/woo_login.sh deleted file mode 100755 index 16ce0d19c44..00000000000 --- a/quicklogin/woo_login.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -e - -# PASS WORDPRESS_EMAIL, WORDPRESS_SITE and WORDPRESS_PASSWORD as env variable to the script -# Optionally pass path to your adb: ADB_PATH -# Example: ADB_PATH=~/Library/Android/sdk/platform-tools/adb WORDPRESS_EMAIL=my_wp_email@gmail.com WORDPRESS_PASSWORD=my_pasword_1_# WORDPRESS_SITE=my_wordpress_site ./quicklogin/woo_login.sh - -if [[ "$ADB_PATH" ]]; then - adbPath="$ADB_PATH" -else - adbPath='~/Library/Android/sdk/platform-tools/adb' -fi - -packageName="com.woocommerce.android.dev" - -eval $adbPath shell pm clear $packageName - -./gradlew installWasabiDebug -./gradlew :quicklogin:installDebug \ --PquickLoginWpEmail="$WORDPRESS_EMAIL" \ --PquickLoginWpPassword="$WORDPRESS_PASSWORD" \ --PquickLoginWpSite="$WORDPRESS_SITE" - -eval $adbPath shell am instrument -w -r -e debug false -e class 'com.woocommerce.android.quicklogin.QuickLoginWordpress' $packageName.quicklogin/androidx.test.runner.AndroidJUnitRunner -eval $adbPath shell am start -n $packageName/com.woocommerce.android.ui.main.MainActivity diff --git a/settings.gradle b/settings.gradle index 6506be3dedd..50ff884ef85 100644 --- a/settings.gradle +++ b/settings.gradle @@ -22,7 +22,6 @@ plugins { rootProject.name = 'WCAndroid' -include ':quicklogin' include ':libs:commons' include ':libs:cardreader' include ':libs:iap' From 14e209ebc380157239af17971546ab06db64ad79 Mon Sep 17 00:00:00 2001 From: Andrey Date: Wed, 8 Jan 2025 11:57:10 +0100 Subject: [PATCH 2/2] Removed IAP module as not used --- WooCommerce/build.gradle | 1 - WooCommerce/src/debug/AndroidManifest.xml | 5 - .../android/di/InAppPurchasesModule.kt | 45 - .../android/iapshowcase/IAPDebugLogWrapper.kt | 20 - .../iapshowcase/IAPShowcaseActivity.kt | 23 - .../iapshowcase/IapMobilePayApiProvider.kt | 46 - .../purchase/IAPShowcasePurchaseFragment.kt | 95 -- .../purchase/IAPShowcasePurchaseViewModel.kt | 91 -- .../IAPShowcaseSupportCheckerFragment.kt | 52 -- .../IAPShowcaseSupportCheckerViewModel.kt | 46 - .../debug/res/layout/activity_iapshowcase.xml | 7 - .../layout/fragment_iap_showcase_purchase.xml | 95 -- .../fragment_iap_showcase_support_checker.xml | 34 - WooCommerce/src/debug/res/values/strings.xml | 8 - developer.properties-example | 1 - docs/iap-module.md | 94 -- libs/iap/.gitignore | 1 - libs/iap/build.gradle | 41 - libs/iap/proguard-rules.pro | 21 - libs/iap/src/main/AndroidManifest.xml | 2 - .../internal/core/IAPBillingClientProvider.kt | 18 - .../core/IAPBillingClientStateHandler.kt | 85 -- .../internal/core/IAPBillingClientWrapper.kt | 35 - .../core/IAPBillingFlowParamsBuilder.kt | 16 - .../android/iap/internal/core/IAPExt.kt | 28 - .../android/iap/internal/core/IAPInMapper.kt | 14 - .../android/iap/internal/core/IAPManager.kt | 201 ----- .../iap/internal/core/IAPManagerFactory.kt | 29 - .../android/iap/internal/core/IAPOutMapper.kt | 66 -- .../core/IAPPeriodicPurchaseStatusChecker.kt | 50 -- .../core/IAPPurchasesUpdatedListener.kt | 30 - .../model/IAPBillingClientConnectionResult.kt | 8 - .../android/iap/internal/model/IAPParams.kt | 12 - .../model/IAPProductDetailsResponse.kt | 9 - .../iap/internal/model/IAPPurchaseResult.kt | 30 - .../network/ApiImplementationProvider.kt | 21 - .../internal/network/IAPMobilePayAPIStub.kt | 42 - .../IAPPurchaseWPComPlanActionsImpl.kt | 83 -- .../IAPPurchaseWpComPlanHandler.kt | 101 --- .../IAPPurchaseWpComPlanSupportCheckerImpl.kt | 33 - .../android/iap/pub/IAPActivityWrapper.kt | 5 - .../android/iap/pub/IAPLogWrapper.kt | 9 - .../iap/pub/IAPSitePurchasePlanFactory.kt | 35 - .../iap/pub/PurchaseWPComPlanActions.kt | 14 - .../pub/PurchaseWpComPlanSupportChecker.kt | 8 - .../android/iap/pub/model/IAPError.kt | 26 - .../iap/pub/model/IAPSupportedResult.kt | 6 - .../iap/pub/model/WPComIsPurchasedResult.kt | 12 - .../iap/pub/model/WPComProductResult.kt | 13 - .../iap/pub/model/WPComPurchaseResult.kt | 6 - .../iap/pub/network/IAPMobilePayAPI.kt | 15 - .../iap/pub/network/SandboxTestingConfig.kt | 6 - .../model/CreateAndConfirmOrderResponse.kt | 8 - .../network/ApiImplementationProviderTest.kt | 52 -- .../pub/IAPPurchaseWPComPlanActionsTest.kt | 811 ------------------ .../IAPPurchaseWpComPlanSupportCheckerTest.kt | 124 --- .../android/iap/pub/IAPTestDataHelper.kt | 76 -- .../iap/pub/IAPTestPreparationHelper.kt | 45 - settings.gradle | 1 - 59 files changed, 2911 deletions(-) delete mode 100644 WooCommerce/src/debug/kotlin/com/woocommerce/android/di/InAppPurchasesModule.kt delete mode 100644 WooCommerce/src/debug/kotlin/com/woocommerce/android/iapshowcase/IAPDebugLogWrapper.kt delete mode 100644 WooCommerce/src/debug/kotlin/com/woocommerce/android/iapshowcase/IAPShowcaseActivity.kt delete mode 100644 WooCommerce/src/debug/kotlin/com/woocommerce/android/iapshowcase/IapMobilePayApiProvider.kt delete mode 100644 WooCommerce/src/debug/kotlin/com/woocommerce/android/iapshowcase/purchase/IAPShowcasePurchaseFragment.kt delete mode 100644 WooCommerce/src/debug/kotlin/com/woocommerce/android/iapshowcase/purchase/IAPShowcasePurchaseViewModel.kt delete mode 100644 WooCommerce/src/debug/kotlin/com/woocommerce/android/iapshowcase/supportcheck/IAPShowcaseSupportCheckerFragment.kt delete mode 100644 WooCommerce/src/debug/kotlin/com/woocommerce/android/iapshowcase/supportcheck/IAPShowcaseSupportCheckerViewModel.kt delete mode 100644 WooCommerce/src/debug/res/layout/activity_iapshowcase.xml delete mode 100644 WooCommerce/src/debug/res/layout/fragment_iap_showcase_purchase.xml delete mode 100644 WooCommerce/src/debug/res/layout/fragment_iap_showcase_support_checker.xml delete mode 100644 WooCommerce/src/debug/res/values/strings.xml delete mode 100644 docs/iap-module.md delete mode 100644 libs/iap/.gitignore delete mode 100644 libs/iap/build.gradle delete mode 100644 libs/iap/proguard-rules.pro delete mode 100644 libs/iap/src/main/AndroidManifest.xml delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/core/IAPBillingClientProvider.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/core/IAPBillingClientStateHandler.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/core/IAPBillingClientWrapper.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/core/IAPBillingFlowParamsBuilder.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/core/IAPExt.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/core/IAPInMapper.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/core/IAPManager.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/core/IAPManagerFactory.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/core/IAPOutMapper.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/core/IAPPeriodicPurchaseStatusChecker.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/core/IAPPurchasesUpdatedListener.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/model/IAPBillingClientConnectionResult.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/model/IAPParams.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/model/IAPProductDetailsResponse.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/model/IAPPurchaseResult.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/network/ApiImplementationProvider.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/network/IAPMobilePayAPIStub.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/planpurchase/IAPPurchaseWPComPlanActionsImpl.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/planpurchase/IAPPurchaseWpComPlanHandler.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/internal/planpurchase/IAPPurchaseWpComPlanSupportCheckerImpl.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/pub/IAPActivityWrapper.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/pub/IAPLogWrapper.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/pub/IAPSitePurchasePlanFactory.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/pub/PurchaseWPComPlanActions.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/pub/PurchaseWpComPlanSupportChecker.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/pub/model/IAPError.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/pub/model/IAPSupportedResult.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/pub/model/WPComIsPurchasedResult.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/pub/model/WPComProductResult.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/pub/model/WPComPurchaseResult.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/pub/network/IAPMobilePayAPI.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/pub/network/SandboxTestingConfig.kt delete mode 100644 libs/iap/src/main/java/com/woocommerce/android/iap/pub/network/model/CreateAndConfirmOrderResponse.kt delete mode 100644 libs/iap/src/test/kotlin/com/woocommerce/android/iap/internal/network/ApiImplementationProviderTest.kt delete mode 100644 libs/iap/src/test/kotlin/com/woocommerce/android/iap/pub/IAPPurchaseWPComPlanActionsTest.kt delete mode 100644 libs/iap/src/test/kotlin/com/woocommerce/android/iap/pub/IAPPurchaseWpComPlanSupportCheckerTest.kt delete mode 100644 libs/iap/src/test/kotlin/com/woocommerce/android/iap/pub/IAPTestDataHelper.kt delete mode 100644 libs/iap/src/test/kotlin/com/woocommerce/android/iap/pub/IAPTestPreparationHelper.kt diff --git a/WooCommerce/build.gradle b/WooCommerce/build.gradle index 71dc80c9291..6bca880c5a5 100644 --- a/WooCommerce/build.gradle +++ b/WooCommerce/build.gradle @@ -319,7 +319,6 @@ dependencies { implementation project(":libs:commons") implementation project(":libs:cardreader") - debugImplementation project(":libs:iap") implementation(libs.facebook.shimmer) implementation(libs.photoview) diff --git a/WooCommerce/src/debug/AndroidManifest.xml b/WooCommerce/src/debug/AndroidManifest.xml index a96d39261a2..42bb9847ebc 100644 --- a/WooCommerce/src/debug/AndroidManifest.xml +++ b/WooCommerce/src/debug/AndroidManifest.xml @@ -32,11 +32,6 @@ android:enabled="@bool/enable_leak_canary" android:exported="false" /> - - { - CreateAndConfirmOrderResponse.Success(response.orderId) - } - is MobilePayRestClient.CreateOrderResponse.Error -> { - when (response.type) { - MobilePayRestClient.CreateOrderErrorType.API_ERROR, - MobilePayRestClient.CreateOrderErrorType.AUTH_ERROR, - MobilePayRestClient.CreateOrderErrorType.GENERIC_ERROR, - MobilePayRestClient.CreateOrderErrorType.INVALID_RESPONSE -> - CreateAndConfirmOrderResponse.Server(response.message ?: "Reason is not provided") - MobilePayRestClient.CreateOrderErrorType.TIMEOUT, - MobilePayRestClient.CreateOrderErrorType.NETWORK_ERROR -> CreateAndConfirmOrderResponse.Network - } - } - } - } - } -} diff --git a/WooCommerce/src/debug/kotlin/com/woocommerce/android/iapshowcase/purchase/IAPShowcasePurchaseFragment.kt b/WooCommerce/src/debug/kotlin/com/woocommerce/android/iapshowcase/purchase/IAPShowcasePurchaseFragment.kt deleted file mode 100644 index 0d85420499f..00000000000 --- a/WooCommerce/src/debug/kotlin/com/woocommerce/android/iapshowcase/purchase/IAPShowcasePurchaseFragment.kt +++ /dev/null @@ -1,95 +0,0 @@ -package com.woocommerce.android.iapshowcase.purchase - -import android.os.Bundle -import android.util.Log -import android.view.View -import android.widget.Button -import android.widget.TextView -import android.widget.Toast -import androidx.appcompat.app.AppCompatActivity -import androidx.appcompat.widget.Toolbar -import androidx.core.view.isVisible -import androidx.fragment.app.Fragment -import androidx.fragment.app.viewModels -import androidx.lifecycle.ViewModel -import androidx.lifecycle.ViewModelProvider -import com.woocommerce.android.R -import com.woocommerce.android.iap.pub.IAPActivityWrapper -import com.woocommerce.android.iap.pub.IAPSitePurchasePlanFactory -import com.woocommerce.android.iap.pub.network.SandboxTestingConfig -import com.woocommerce.android.iapshowcase.IAPDebugLogWrapper -import com.woocommerce.android.iapshowcase.IapMobilePayApiProvider -import dagger.hilt.android.AndroidEntryPoint -import javax.inject.Inject - -@AndroidEntryPoint -class IAPShowcasePurchaseFragment : Fragment(R.layout.fragment_iap_showcase_purchase) { - @Inject - lateinit var mobilePayAPIProvider: IapMobilePayApiProvider - - @Inject - lateinit var debugLogWrapper: IAPDebugLogWrapper - - private val viewModel: IAPShowcasePurchaseViewModel by viewModels { - object : ViewModelProvider.Factory { - @Suppress("UNCHECKED_CAST") - override fun create(modelClass: Class): T { - return IAPShowcasePurchaseViewModel( - IAPSitePurchasePlanFactory.createIAPSitePurchasePlan( - this@IAPShowcasePurchaseFragment.requireActivity().application, - debugLogWrapper, - mobilePayAPIProvider::buildMobilePayAPI, - object : SandboxTestingConfig { - override val isDebug: Boolean - get() = true - override val iapTestingSandboxUrl: String - get() = "" - } - ) - ) as T - } - } - } - - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - setupToolbar(view) - setupObservers(view) - - view.findViewById