AppsFlyerSDK / appsflyer-capacitor-plugin

AppsFlyer SDK plugin for Capacitor
MIT License
13 stars 23 forks source link

Migrate to capacitor v4 #30

Closed MateiNenciu closed 1 year ago

MateiNenciu commented 1 year ago

Upgraded plugin to use latest capacitor v4.0.1 core and bumped minimum sdk versions to match the new specs.

undergroundcreative commented 1 year ago

Hi, how can I use this in my project? I've just upgraded to Capacitor 4 but the main appsflyer-capacitor-plugin plugin is failing. I'd like to use this pull which I've installed using:

npm i --save-dev AppsFlyerSDK/appsflyer-capacitor-plugin#pull/30/head --force

It adds it in the devDependencies section of package.json so when I do npm run build, I'm getting:

Cannot find module 'appsflyer-capacitor-plugin' or its corresponding type declarations.

I get the same if I uninstall and use:

npm i --save AppsFlyerSDK/appsflyer-capacitor-plugin#pull/30/head --force

Please help! Stuck!

Thanks :)

undergroundcreative commented 1 year ago

I've also installed with:

npm i appsflyer-capacitor-plugin@github:Ejobs/appsflyer-capacitor-plugin

But, again, when I do npm run build I'm getting:

Cannot find module 'appsflyer-capacitor-plugin' or its corresponding type declarations.

Just to clarify, the files are downloaded in the node_modules folder.

Here's my app's package.json:

{ "name": "QuizSwipe", "private": true, "version": "1.0.18", "description": "QuizSwipe", "license": "MIT", "files": [ "dist/" ], "scripts": { "build": "stencil build", "start": "stencil build --dev --watch --serve", "test": "stencil test --spec --e2e", "test.watch": "stencil test --spec --e2e --watch", "generate": "stencil generate", "clean": "npx rimraf www" }, "devDependencies": { "@capacitor/cli": "^4.0.0", "@ionic/core": "^5.0.7", "@stencil/core": "2.10.0", "@stencil/store": "^1.3.0", "@types/node": "^18.11.2" }, "dependencies": { "@awesome-cordova-plugins/in-app-purchase-2": "^5.45.0", "@capacitor-community/admob": "^3.3.0", "@capacitor-community/firebase-analytics": "^1.0.1", "@capacitor-community/native-audio": "^4.0.0-0", "@capacitor/android": "^4.0.0", "@capacitor/app": "^4.0.0", "@capacitor/app-launcher": "^4.0.0", "@capacitor/browser": "^4.0.0", "@capacitor/clipboard": "^4.0.0", "@capacitor/core": "^4.0.0", "@capacitor/device": "^4.0.0", "@capacitor/ios": "^4.0.0", "@capacitor/local-notifications": "^4.0.0", "@capacitor/network": "^4.0.0", "@capacitor/preferences": "^4.0.1", "@capacitor/push-notifications": "^4.0.0", "@capacitor/share": "^4.0.0", "@capacitor/splash-screen": "^4.0.0", "@ionic-native/core": "^5.26.0", "@ionic-native/screenshot": "^5.31.1", "@sparkfabrik/capacitor-plugin-idfa": "github:AE1NS/capacitor-plugin-idfa", "appsflyer-capacitor-plugin": "github:Ejobs/appsflyer-capacitor-plugin", "capacitor-rate-app": "^3.0.0", "com.darktalker.cordova.screenshot": "^0.1.6", "cordova-plugin-device": "^2.0.3", "cordova-plugin-purchase": "^11.0.0", "cordova-support-android-plugin": "^1.0.2", "cordova-support-google-services": "^1.4.0", "es6-promise-plugin": "^4.2.2", "jetifier": "^1.6.6", "ts-md5": "^1.2.11", "tslib": "^1.11.1", "web-social-share": "^6.4.1" }, "postinstall": "jetifier" }

I've been struggling with this for days now, could someone help me out?

Thanks,

Sean

undergroundcreative commented 1 year ago

@MateiNenciu @sawaca96

How can I install this to use in my project?

See my package.json above.

There is no dist folder and I'm getting:

"Cannot find module 'appsflyer-capacitor-plugin' or its corresponding type declarations." when I do npm run build

Help! :)

Screenshot 2022-10-25 at 17 02 32

sawaca96 commented 1 year ago

@undergroundcreative I'm still use capacitor v3 😭

pazlavi commented 1 year ago

We are running a QA cycle for a new version supporting Capacitor 4. We expect to release this version by the end of the next week. MR: #33

undergroundcreative commented 1 year ago

@pazlavi Any update on this? Looks like it's not been released yet.

MateiNenciu commented 1 year ago

Why modifying / accepting an already opened MR from August, when you can have your users waiting till December to do it yourself ^

MateiNenciu commented 1 year ago

Sorry for late reply, you can either build that project and generate the dist folder, or you could do something like import {AppsFlyer} from 'appsflyer-capacitor-plugin/src' like I did, till the maintainer decides to care about users that are upgrading.

undergroundcreative commented 1 year ago

Sorry for late reply, you can either build that project and generate the dist folder, or you could do something like import {AppsFlyer} from 'appsflyer-capacitor-plugin/src' like I did, till the maintainer decides to care about users that are upgrading.

Thanks for the info.

I tried importing from the src folder as you suggested with the plugin installed as per my package.json as above but I was getting build errors:

Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)

So I uninstalled the AppsFlyer plugin and checked your PR out as a submodule. Installed and built to get the dist folder, then installed from my local build. Same error:

[ ERROR ] Rollup: Parse Error: ./submodules/appsflyer-capacitor-plugin/src/index.ts:3:12 Unexpected token (Note that you need plugins to import files that are not JavaScript)

  L3:  import type { AppsFlyerPlugin } from './definitions';
  L4:  const AppsFlyer = registerPlugin<AppsFlyerPlugin>('AppsFlyerPlugin', {

[11:17.2] build failed in 11.08 s

What am I doing wrong? ;)

Here's my latest package.json:

{ "name": "QuizSwipe", "private": true, "version": "1.0.18", "description": "QuizSwipe", "license": "MIT", "files": [ "dist/" ], "scripts": { "build": "stencil build", "start": "stencil build --dev --watch --serve", "test": "stencil test --spec --e2e", "test.watch": "stencil test --spec --e2e --watch", "generate": "stencil generate", "clean": "npx rimraf www" }, "devDependencies": { "@capacitor/cli": "^4.0.0", "@ionic/core": "^5.0.7", "@stencil/core": "2.10.0", "@stencil/store": "^1.3.0", "@types/node": "^18.11.2" }, "dependencies": { "@awesome-cordova-plugins/in-app-purchase-2": "^5.45.0", "@capacitor-community/admob": "4.0.0", "@capacitor-community/firebase-analytics": "^1.0.1", "@capacitor-community/native-audio": "^4.0.0-0", "@capacitor/android": "^4.0.0", "@capacitor/app": "^4.0.0", "@capacitor/app-launcher": "^4.0.0", "@capacitor/browser": "^4.0.0", "@capacitor/clipboard": "^4.0.0", "@capacitor/core": "^4.0.0", "@capacitor/device": "^4.0.0", "@capacitor/ios": "^4.0.0", "@capacitor/local-notifications": "^4.0.0", "@capacitor/network": "^4.0.0", "@capacitor/preferences": "^4.0.1", "@capacitor/push-notifications": "^4.0.0", "@capacitor/share": "^4.0.0", "@capacitor/splash-screen": "^4.0.0", "@ionic-native/core": "^5.26.0", "@ionic-native/screenshot": "^5.31.1", "@sparkfabrik/capacitor-plugin-idfa": "github:AE1NS/capacitor-plugin-idfa", "appsflyer-capacitor-plugin": "file:submodules/appsflyer-capacitor-plugin", "capacitor-plugin-android-post-notifications-permission": "file:submodules/capacitor-plugin-android-post-notifications-permission", "capacitor-rate-app": "^3.0.0", "com.darktalker.cordova.screenshot": "^0.1.6", "cordova-plugin-device": "^2.0.3", "cordova-plugin-purchase": "^11.0.0", "cordova-support-android-plugin": "^1.0.2", "cordova-support-google-services": "^1.4.0", "es6-promise-plugin": "^4.2.2", "jetifier": "^1.6.6", "ts-md5": "^1.2.11", "tslib": "^1.11.1", "web-social-share": "^6.4.1" }, "postinstall": "jetifier" }

pazlavi commented 1 year ago

We just released v6.9.2, which supports Capacitor v4. If you still wish to use Capacitor v3, please check this page .

undergroundcreative commented 1 year ago

Thanks for the update :)

I installed it and sync-ed but now my app won't build :(

I'm getting:

[ ERROR ] Rollup: Parse Error: ./node_modules/appsflyer-capacitor-plugin/src/index.ts:3:12 Unexpected token (Note that you need plugins to import files that are not JavaScript)

  L3:  import type { AppsFlyerPlugin } from './definitions';
  L4:  const AppsFlyer = registerPlugin<AppsFlyerPlugin>('AppsFlyerPlugin', {

[03:04.1] build failed in 12.42 s

Here's my package.json:

{ "name": "QuizSwipe", "private": true, "version": "1.0.18", "description": "QuizSwipe", "license": "MIT", "files": [ "dist/" ], "scripts": { "build": "stencil build", "start": "stencil build --dev --watch --serve", "test": "stencil test --spec --e2e", "test.watch": "stencil test --spec --e2e --watch", "generate": "stencil generate", "clean": "npx rimraf www" }, "devDependencies": { "@capacitor/cli": "^4.0.0", "@ionic/core": "^5.0.7", "@stencil/core": "2.10.0", "@stencil/store": "^1.3.0", "@types/node": "^18.11.2" }, "dependencies": { "@awesome-cordova-plugins/in-app-purchase-2": "^5.45.0", "@capacitor-community/admob": "4.0.0", "@capacitor-community/firebase-analytics": "^1.0.1", "@capacitor-community/native-audio": "^4.0.0-0", "@capacitor/android": "^4.0.0", "@capacitor/app": "^4.0.0", "@capacitor/app-launcher": "^4.0.0", "@capacitor/browser": "^4.0.0", "@capacitor/clipboard": "^4.0.0", "@capacitor/core": "^4.0.0", "@capacitor/device": "^4.0.0", "@capacitor/ios": "^4.0.0", "@capacitor/local-notifications": "^4.0.0", "@capacitor/network": "^4.0.0", "@capacitor/preferences": "^4.0.1", "@capacitor/push-notifications": "^4.0.0", "@capacitor/share": "^4.0.0", "@capacitor/splash-screen": "^4.0.0", "@ionic-native/core": "^5.26.0", "@ionic-native/screenshot": "^5.31.1", "@sparkfabrik/capacitor-plugin-idfa": "github:AE1NS/capacitor-plugin-idfa", "appsflyer-capacitor-plugin": "^6.9.2", "capacitor-plugin-android-post-notifications-permission": "file:submodules/capacitor-plugin-android-post-notifications-permission", "capacitor-rate-app": "^3.0.0", "com.darktalker.cordova.screenshot": "^0.1.6", "cordova-plugin-device": "^2.0.3", "cordova-plugin-purchase": "^11.0.0", "cordova-support-android-plugin": "^1.0.2", "cordova-support-google-services": "^1.4.0", "es6-promise-plugin": "^4.2.2", "jetifier": "^1.6.6", "ts-md5": "^1.2.11", "tslib": "^1.11.1", "web-social-share": "^6.4.1" }, "postinstall": "jetifier" }

To get my version of TypeScript I did:

$ npx tsc -v

Which gives:

Version 4.1.6

Ionic:

Ionic CLI : 6.19.0 (/Users/seanwilson/.nvm/versions/node/v15.1.0/lib/node_modules/@ionic/cli)

Capacitor:

Capacitor CLI : 4.4.0 @capacitor/android : 4.4.0 @capacitor/core : 4.4.0 @capacitor/ios : 4.4.0

Utility:

cordova-res (update available: 0.15.4) : 0.15.3 native-run : 1.7.1

System:

NodeJS : v15.1.0 (/Users/seanwilson/.nvm/versions/node/v15.1.0/bin/node) npm : 7.5.2 OS : macOS Catalina

My project's tsconfig.json:

{ "compilerOptions": { "allowSyntheticDefaultImports": true, "allowUnreachableCode": false, "declaration": false, "emitDecoratorMetadata": true, "experimentalDecorators": true, "allowJs": true, "lib": [ "dom", "es2017" ], "moduleResolution": "node", "module": "esnext", "target": "es2017", "noUnusedLocals": true, "noUnusedParameters": true, "jsx": "react", "jsxFactory": "h", "esModuleInterop": true, "skipLibCheck": true }, "include": [ "src" ], "exclude": [ "node_modules" ] }