j3k0 / cordova-plugin-purchase

In-App Purchase for Cordova on iOS, Android and Windows
https://purchase.cordova.fovea.cc
1.3k stars 535 forks source link

Migrating library problems (store.initialize never ends) #1480

Closed yoprogramo closed 1 year ago

yoprogramo commented 1 year ago

Observed behavior

Migrating to v13 from v8 (yes, I know...)

 window.store = window.CdvPurchase.store;

I register my subscriptions and then I call

    await window.store.initialize([platform]);

And this ALL the log:

[CdvPurchase] INFO: initialize()
store.js:338 [CdvPurchase.Adapters] INFO: Adding platforms: [{"platform":"android-playstore"}]
store.js:338 [CdvPurchase.Adapters] INFO: 
store.js:338 [CdvPurchase.Adapters] INFO: GooglePlay initializing...
store.js:338 [CdvPurchase.GooglePlay] INFO: Initialize
store.js:338 [CdvPurchase.GooglePlay.Bridge] INFO: setup ok
store.js:338 [CdvPurchase.GooglePlay.Bridge] INFO: listener: {"type":"ready","data":{}}

The function never ends...

Expected behavior

GooglePlay initialized and function ends...

System Info

Cordova Packages:

    cli: 12.0.0
        common: 5.0.0
        create: 5.0.0
        lib: 12.0.1
            common: 5.0.0
            fetch: 4.0.0
            serve: 4.0.1

Project Installed Platforms:

    android: 12.0.1

Project Installed Plugins:

    com.napolitano.cordova.plugin.intent: 0.1.3
    com.verso.cordova.clipboard: 0.1.0
    cordova-custom-config: 5.1.1
    cordova-plugin-android-fingerprint-auth: 1.5.0
    cordova-plugin-androidx-adapter: 1.1.3
    cordova-plugin-androidx: 3.0.0
    cordova-plugin-app-version: 0.1.14
    cordova-plugin-apprate: 1.7.2
    cordova-plugin-ble-central: 1.3.1
    cordova-plugin-customurlscheme: 5.0.2
    cordova-plugin-device: 2.1.0
    cordova-plugin-dialogs: 2.0.2
    cordova-plugin-facebook4: 6.4.0
    cordova-plugin-file: 8.0.0
    cordova-plugin-firebasex: 16.1.0
    cordova-plugin-geolocation: 4.0.3-dev
    cordova-plugin-google-play-services-checker: 1.0.5
    cordova-plugin-googleplus: 8.5.2
    cordova-plugin-hidden-statusbar-overlay: 2.0.1
    cordova-plugin-inappbrowser: 5.0.0
    cordova-plugin-nativestorage: 2.3.2
    cordova-plugin-purchase: 13.8.6
    cordova-plugin-qrscanner: 3.0.1
    cordova-plugin-splashscreen: 6.0.2
    cordova-plugin-statusbar: 3.0.0
    cordova-plugin-whitelist: 1.3.5
    cordova-plugin-wifi-manager: 0.2.1
    cordova-plugin-x-socialsharing: 6.0.4
    es6-promise-plugin: 4.2.2

Environment:

    OS: Ubuntu 22.04.3 LTS (linux 6.2.0-33-generic) x64
    Node: v18.10.0
    npm: 8.19.2

android Environment:

    android:
ERROR: Command failed with ENOENT: avdmanager list target
spawn avdmanager ENOENT

Project Setting Files:

    config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="170" id="com.biblioeteca.apps.NoMorePass" ios-CFBundleIdentifier="com.biblioeteca.apps.NoMorePass" ios-CFBundleVersion="2021041501" version="1.26.2" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>NoMorePass</name>
    <description>
        Forget your passwords!
    </description>
    <author email="soporte@nomorepass.com" href="https://www.nomorepass.com">
        BiblioEteca Technologies SL
    </author>
    <content src="index.html" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <allow-navigation href="*" />
    <allow-intent href="nomorepass://*" />
    <hook src="scripts/phonon-ios.js" type="before_build" />
    <preference name="KeyboardDisplayRequiresUserAction" value="false" />
    <preference name="SplashScreenDelay" value="1000" />
    <preference name="Orientation" value="portrait" />
    <platform name="android">
        <allow-intent href="market:*" />
        <icon density="ldpi" src="res/icons/android/icon-36-ldpi.png" />
        <icon density="mdpi" src="res/icons/android/icon-48-mdpi.png" />
        <icon density="hdpi" src="res/icons/android/icon-72-hdpi.png" />
        <icon density="xhdpi" src="res/icons/android/icon-96-xhdpi.png" />
        <icon density="xxhdpi" src="res/icons/android/icon-144-xxhdpi.png" />
        <icon density="xxxhdpi" src="res/icons/android/icon-192-xxxhdpi.png" />
        <preference name="android-targetSdkVersion" value="34" />
        <preference name="AndroidWindowSplashScreenAnimatedIcon" value="res/icons/android/splash-icon.png" />
        <resource-file src="res/icons/android/drawable-mdpi/my_icon.png" target="app/src/main/res/drawable-mdpi/my_icon.png" />
        <resource-file src="res/icons/android/drawable-hdpi/my_icon.png" target="app/src/main/res/drawable-hdpi/my_icon.png" />
        <resource-file src="res/icons/android/drawable-xhdpi/my_icon.png" target="app/src/main/res/drawable-xhdpi/my_icon.png" />
        <resource-file src="res/icons/android/drawable-xxhdpi/my_icon.png" target="app/src/main/res/drawable-xxhdpi/my_icon.png" />
        <resource-file src="res/icons/android/drawable-xxxhdpi/my_icon.png" target="app/src/main/res/drawable-xxxhdpi/my_icon.png" />
        <resource-file src="res/icons/android/drawable-xxxhdpi/my_icon_large.png" target="app/src/main/res/drawable-xxxhdpi/my_icon_large.png" />
        <preference name="android-minSdkVersion" value="22" />
        <preference name="SplashMaintainAspectRatio" value="true" />
        <preference name="StatusBarOverlaysWebView" value="false" />
        <preference name="Fullscreen" value="false" />
        <preference name="AndroidExtraFilesystems" value="files,files-external,documents,sdcard,cache,cache-external,assets,root" />
        <preference name="AndroidPersistentFileLocation" value="Compatibility" />
        <config-file parent="./application/activity" target="AndroidManifest.xml">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <action android:name="android.intent.action.SEND" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="file" />
                <data android:mimeType="application/json" />
                <data android:pathPattern=".*\\.nmp" />
            </intent-filter>
            <intent-filter android:label="@string/launcher_name">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </config-file>
        <preference name="AndroidXEnabled" value="true" />
        <preference name="exported" value="true" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
        <icon height="167" src="res/icons/ios/icon-83-5-2x.png" width="167" />
        <icon height="180" src="res/icons/ios/icon-60-3x.png" width="180" />
        <icon height="60" src="res/icons/ios/icon-60.png" width="60" />
        <icon height="120" src="res/icons/ios/icon-60-2x.png" width="120" />
        <icon height="76" src="res/icons/ios/icon-76.png" width="76" />
        <icon height="152" src="res/icons/ios/icon-76-2x.png" width="152" />
        <icon height="20" src="res/icons/ios/icon-20.png" width="20" />
        <icon height="48" src="res/icons/ios/icon-24-2x.png" width="48" />
        <icon height="55" src="res/icons/ios/icon-27-5-2x.png" width="55" />
        <icon height="40" src="res/icons/ios/icon-40.png" width="40" />
        <icon height="80" src="res/icons/ios/icon-40-2x.png" width="80" />
        <icon height="57" src="res/icons/ios/icon.png" width="57" />
        <icon height="114" src="res/icons/ios/icon-2x.png" width="114" />
        <icon height="72" src="res/icons/ios/icon-72.png" width="72" />
        <icon height="144" src="res/icons/ios/icon-72-2x.png" width="144" />
        <icon height="29" src="res/icons/ios/icon-small.png" width="29" />
        <icon height="58" src="res/icons/ios/icon-small-2x.png" width="58" />
        <icon height="87" src="res/icons/ios/icon-small-3x.png" width="87" />
        <icon height="88" src="res/icons/ios/icon-44-2x.png" width="88" />
        <icon height="172" src="res/icons/ios/icon-86-2x.png" width="172" />
        <icon height="196" src="res/icons/ios/icon-98-2x.png" width="196" />
        <icon height="50" src="res/icons/ios/icon-50.png" width="50" />
        <icon height="100" src="res/icons/ios/icon-50-2x.png" width="100" />
        <icon height="1024" src="res/icons/ios/icon-1024.png" width="1024" />
        <splash src="res/screens/ios/Default@2x~iphone~anyany.png" />
        <preference name="BackupWebStorage" value="local" />
        <preference name="AllowInlineMediaPlayback" value="true" />
        <preference name="MediaPlaybackRequiresUserAction" value="false" />
        <preference name="DisallowOverscroll" value="true" />
        <preference name="UseSwiftLanguageVersion" value="5" />
        <config-file parent="UIFileSharingEnabled" target="*-Info.plist">
            <true />
        </config-file>
        <edit-config file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription">
            <string>Need location to enforce password geolocation restrictions</string>
        </edit-config>
        <edit-config file="*-Info.plist" mode="merge" target="NSLocationAlwaysUsageDescription">
            <string>Need location to enforce password geolocation restrictions</string>
        </edit-config>
        <preference name="NativeXHRLogging" value="full" />
        <preference name="AllowUntrustedCerts" value="true" />
        <preference name="InterceptRemoteRequest" value="all" />
        <preference name="allowFileAccessFromFileURLs" value="true" />
        <preference name="allowUniversalAccessFromFileURLs" value="true" />
    </platform>
    <platform name="browser">
        <preference name="ShowSplashScreen" value="false" />
    </platform>
</widget>

    package.json:
--- Start of Cordova JSON Snippet ---
{
  "plugins": {
    "cordova-plugin-google-play-services-checker": {},
    "cordova-plugin-android-fingerprint-auth": {},
    "cordova-custom-config": {},
    "com.napolitano.cordova.plugin.intent": {},
    "cordova-plugin-statusbar": {},
    "cordova-plugin-androidx": {},
    "cordova-plugin-androidx-adapter": {},
    "cordova-plugin-firebasex": {
      "FIREBASE_ANALYTICS_COLLECTION_ENABLED": "true",
      "FIREBASE_PERFORMANCE_COLLECTION_ENABLED": "true",
      "FIREBASE_CRASHLYTICS_COLLECTION_ENABLED": "true",
      "FIREBASE_FCM_AUTOINIT_ENABLED": "true",
      "ANDROID_ICON_ACCENT": "#FF00FFFF",
      "ANDROID_FIREBASE_PERFORMANCE_MONITORING": "false",
      "ANDROID_PLAY_SERVICES_TAGMANAGER_VERSION": "18.0.2",
      "ANDROID_PLAY_SERVICES_AUTH_VERSION": "20.5.0",
      "ANDROID_FIREBASE_ANALYTICS_VERSION": "21.2.2",
      "ANDROID_FIREBASE_MESSAGING_VERSION": "23.1.2",
      "ANDROID_FIREBASE_CONFIG_VERSION": "21.4.0",
      "ANDROID_FIREBASE_PERF_VERSION": "20.3.2",
      "ANDROID_FIREBASE_AUTH_VERSION": "22.0.0",
      "ANDROID_FIREBASE_INAPPMESSAGING_VERSION": "20.3.2",
      "ANDROID_FIREBASE_FIRESTORE_VERSION": "24.6.0",
      "ANDROID_FIREBASE_FUNCTIONS_VERSION": "20.3.0",
      "ANDROID_FIREBASE_IID_VERSION": "21.1.0",
      "ANDROID_FIREBASE_INSTALLATIONS_VERSION": "17.1.3",
      "ANDROID_FIREBASE_CRASHLYTICS_VERSION": "18.3.7",
      "ANDROID_FIREBASE_CRASHLYTICS_NDK_VERSION": "18.3.7",
      "ANDROID_GSON_VERSION": "2.9.0",
      "ANDROID_FIREBASE_PERF_GRADLE_PLUGIN_VERSION": "1.4.2",
      "ANDROID_GRPC_OKHTTP": "1.46.0"
    }
  },
  "platforms": [
    "android"
  ]
}
j3k0 commented 1 year ago

Can you enable DEBUG logs:

store.verbosity = CdvPurchase.LogLevel.DEBUG

Can you run with google chrome developer tools connected, see if there's any exception thrown or something.

yoprogramo commented 1 year ago

Hello @j3k0

The problem comes with the tablet I was using to test that does not executed well some "yield" and so it does not finish the initialize part... I have tested now with a "modern" phone and the error was vanished... I'm going to close the issue.

Thank you.