react-native-sdk-pianoio 0.2.5 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +36 -2
  2. package/SdkPianoio.podspec +4 -16
  3. package/android/build.gradle +12 -19
  4. package/android/gradle.properties +17 -2
  5. package/android/src/main/java/com/sdkpianoio/SdkPianoioModule.kt +543 -7
  6. package/android/src/main/java/com/sdkpianoio/SdkPianoioPackage.kt +3 -3
  7. package/ios/ComposerPianoImpl.swift +247 -0
  8. package/ios/MyComposerDelegate.swift +79 -200
  9. package/ios/SdkPianoio.swift +150 -0
  10. package/ios/SdkPianoioBridge.m +81 -0
  11. package/ios/services/TokenService.swift +10 -7
  12. package/lib/commonjs/NativeSdkPianoio.ts +13 -4
  13. package/lib/commonjs/PianoComposer.js +16 -9
  14. package/lib/commonjs/PianoComposer.js.map +1 -1
  15. package/lib/commonjs/debug.js +23 -0
  16. package/lib/commonjs/debug.js.map +1 -0
  17. package/lib/commonjs/index.js +7 -0
  18. package/lib/commonjs/index.js.map +1 -1
  19. package/lib/module/NativeSdkPianoio.ts +13 -4
  20. package/lib/module/PianoComposer.js +16 -9
  21. package/lib/module/PianoComposer.js.map +1 -1
  22. package/lib/module/debug.js +18 -0
  23. package/lib/module/debug.js.map +1 -0
  24. package/lib/module/index.js +1 -0
  25. package/lib/module/index.js.map +1 -1
  26. package/lib/typescript/commonjs/src/NativeSdkPianoio.d.ts +2 -2
  27. package/lib/typescript/commonjs/src/NativeSdkPianoio.d.ts.map +1 -1
  28. package/lib/typescript/commonjs/src/PianoComposer.d.ts +2 -2
  29. package/lib/typescript/commonjs/src/PianoComposer.d.ts.map +1 -1
  30. package/lib/typescript/commonjs/src/debug.d.ts +2 -0
  31. package/lib/typescript/commonjs/src/debug.d.ts.map +1 -0
  32. package/lib/typescript/commonjs/src/index.d.ts +1 -0
  33. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  34. package/lib/typescript/module/src/NativeSdkPianoio.d.ts +2 -2
  35. package/lib/typescript/module/src/NativeSdkPianoio.d.ts.map +1 -1
  36. package/lib/typescript/module/src/PianoComposer.d.ts +2 -2
  37. package/lib/typescript/module/src/PianoComposer.d.ts.map +1 -1
  38. package/lib/typescript/module/src/debug.d.ts +2 -0
  39. package/lib/typescript/module/src/debug.d.ts.map +1 -0
  40. package/lib/typescript/module/src/index.d.ts +1 -0
  41. package/lib/typescript/module/src/index.d.ts.map +1 -1
  42. package/package.json +31 -16
  43. package/src/NativeSdkPianoio.ts +13 -4
  44. package/src/PianoComposer.tsx +17 -10
  45. package/src/debug.ts +19 -0
  46. package/src/index.tsx +1 -0
  47. package/ios/ComposerPiano.swift +0 -297
  48. package/ios/SdkPianoio.h +0 -4
  49. package/ios/SdkPianoio.mm +0 -267
  50. package/ios/services/ComposerService.swift +0 -49
package/README.md CHANGED
@@ -9,7 +9,7 @@ Il progetto è ancora in **work in progress**.
9
9
  ## Indice
10
10
 
11
11
  - [Installazione](#installazione)
12
- - [Prerequisiti (adattamento del pacchetto a Expo < 52)](#prerequisiti-adattamento-del-pacchetto-a-expo--52)
12
+ - [Prerequisiti](#prerequisiti)
13
13
  - [iOS](#ios)
14
14
  - [Android](#android)
15
15
  - [Avviare progetto](#avviare-progetto)
@@ -24,7 +24,7 @@ Il progetto è ancora in **work in progress**.
24
24
 
25
25
  ## Installazione
26
26
 
27
- ### Prerequisiti (adattamento del pacchetto a Expo < 52)
27
+ ### Prerequisiti
28
28
 
29
29
  Seguendo la guida presente al link https://docs.expo.dev/get-started/create-a-project/ è possibile effettuare la creazione di un progetto in expo.
30
30
 
@@ -37,6 +37,28 @@ npx expo prebuild
37
37
  ```
38
38
  Questo creerà la cartella per iOS e per Android.
39
39
 
40
+ È necessario, all'interno dell'app.js avere questa configurazione con **"useFrameworks": "static"**:
41
+
42
+ ```sh
43
+ "plugins": [
44
+ [
45
+ "expo-build-properties",
46
+ {
47
+ "android": {
48
+ "buildToolsVersion": "34.0.0",
49
+ "compileSdkVersion": 34,
50
+ "minSdkVersion": 24,
51
+ "targetSdkVersion": 34
52
+ },
53
+ "ios": {
54
+ "deploymentTarget": "13.4",
55
+ "useFrameworks": "static"
56
+ }
57
+ }
58
+ ]
59
+ ]
60
+ ```
61
+
40
62
  Dopodiché si può passare all'installazione del pacchetto npm:
41
63
 
42
64
  ```sh
@@ -158,6 +180,16 @@ await composer.setUserToken('token123');
158
180
 
159
181
  ---
160
182
 
183
+ ### `executeExperience()`
184
+
185
+ Permette di eseguire l'espèerienza in base ai parametri impostati precedentemente, difatti le SDK ufficiali di piano non permettono di inserire in maniera comoda l'id dell'esperienza da eseguire, ma bisogna inserire il resto dei parametri e del resto se ne occupa il backend di piano.io.
186
+
187
+ ```ts
188
+ await composer.executeExperience();
189
+ ```
190
+
191
+ ---
192
+
161
193
  ### `toString()`
162
194
 
163
195
  Restituisce una rappresentazione leggibile dello stato del Composer.
@@ -224,6 +256,8 @@ await composer.setUrl('https://my.site/article');
224
256
  await composer.setUserToken('jwt-token');
225
257
  await composer.setCustomVariable('device', 'mobile');
226
258
 
259
+ await composer.executeExperience();
260
+
227
261
  console.log(await composer.toString());
228
262
  ```
229
263
 
@@ -2,7 +2,6 @@ require "json"
2
2
 
3
3
  package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
4
 
5
-
6
5
  Pod::Spec.new do |s|
7
6
  s.name = "SdkPianoio"
8
7
  s.version = package["version"]
@@ -12,31 +11,20 @@ Pod::Spec.new do |s|
12
11
  s.authors = package["author"]
13
12
 
14
13
  s.platforms = { :ios => min_ios_version_supported }
15
- s.source = { :git => "https://google.ch$.git", :tag => "#{s.version}" }
16
-
14
+ s.source = { :git => "https://github.com/HexagonSwiss/hex-react-native-sdk-pianoio.git", :tag => "#{s.version}" }
17
15
 
18
- s.source_files = "ios/**/*.{h,m,mm,cpp,swift}", "ios/services/**/*.{swift}"
19
- s.private_header_files = "ios/**/*.h"
16
+ s.source_files = "ios/**/*.swift", "ios/SdkPianoioBridge.m"
20
17
 
21
- if ENV['USE_FRAMEWORKS']
22
- s.pod_target_xcconfig = {
23
- 'DEFINES_MODULE' => 'YES',
24
- "FRAMEWORK_SEARCH_PATHS" => ["$(inherited)", "$(PODS_ROOT)/Headers/Public/SdkPianoio"],
25
- "HEADER_SEARCH_PATHS" => ["$(inherited)", "$(PODS_ROOT)/Headers/Public/SdkPianoio"]
26
- }
27
- end
18
+ s.swift_version = '5.0'
28
19
 
29
20
  s.requires_arc = true
30
21
 
31
-
32
- # piano usage
33
22
  s.dependency 'PianoComposer', '2.8.6'
34
23
  s.dependency 'PianoTemplate', '2.8.6'
35
24
  s.dependency 'PianoTemplate.ID', '2.8.6'
36
25
  s.dependency 'PianoOAuth', '2.8.6'
37
26
 
38
- # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
39
- # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
27
+
40
28
  if respond_to?(:install_modules_dependencies, true)
41
29
  install_modules_dependencies(s)
42
30
  else
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.getExtOrDefault = {name ->
2
+ ext.getExtOrDefault = { name ->
3
3
  return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['SdkPianoio_' + name]
4
4
  }
5
5
 
@@ -10,17 +10,13 @@ buildscript {
10
10
 
11
11
  dependencies {
12
12
  classpath "com.android.tools.build:gradle:8.7.2"
13
- // noinspection DifferentKotlinGradleVersion
14
13
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
15
14
  }
16
15
  }
17
16
 
18
-
19
17
  apply plugin: "com.android.library"
20
18
  apply plugin: "kotlin-android"
21
19
 
22
- apply plugin: "com.facebook.react"
23
-
24
20
  def getExtOrIntegerDefault(name) {
25
21
  return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["SdkPianoio_" + name]).toInteger()
26
22
  }
@@ -45,11 +41,12 @@ android {
45
41
  }
46
42
  }
47
43
 
48
- compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
44
+ // ✅ Esplicita i valori direttamente per evitare problemi
45
+ compileSdkVersion 34
49
46
 
50
47
  defaultConfig {
51
- minSdkVersion getExtOrIntegerDefault("minSdkVersion")
52
- targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
48
+ minSdkVersion 21
49
+ targetSdkVersion 34
53
50
  }
54
51
 
55
52
  buildFeatures {
@@ -82,19 +79,15 @@ android {
82
79
  }
83
80
 
84
81
  repositories {
85
- mavenCentral()
86
82
  google()
83
+ mavenCentral()
84
+ maven { url("$rootDir/../node_modules/react-native/android") }
87
85
  }
88
86
 
89
- def kotlin_version = getExtOrDefault("kotlinVersion")
90
-
91
87
  dependencies {
92
- implementation "com.facebook.react:react-android"
93
- implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
94
- }
95
-
96
- react {
97
- jsRootDir = file("../src/")
98
- libraryName = "SdkPianoio"
99
- codegenJavaPackageName = "com.sdkpianoio"
88
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:${getExtOrDefault('kotlinVersion')}"
89
+ implementation "com.facebook.react:react-android" // React Native core
90
+ implementation "com.facebook.react:react-native"
91
+ implementation "io.piano.android:composer:2.11.0"
92
+ implementation "io.piano.android:id:2.11.0"
100
93
  }
@@ -1,5 +1,20 @@
1
+ ## For more details on how to configure your build environment visit
2
+ # http://www.gradle.org/docs/current/userguide/build_environment.html
3
+ #
4
+ # Specifies the JVM arguments used for the daemon process.
5
+ # The setting is particularly useful for tweaking memory settings.
6
+ # Default value: -Xmx1024m -XX:MaxPermSize=256m
7
+ # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
8
+ #
9
+ # When configured, Gradle will run in incubating parallel mode.
10
+ # This option should only be used with decoupled projects. For more details, visit
11
+ # https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
12
+ # org.gradle.parallel=true
13
+ #Thu Jul 10 13:17:17 CEST 2025
14
+ SdkPianoio_compileSdkVersion=35
1
15
  SdkPianoio_kotlinVersion=2.0.21
2
16
  SdkPianoio_minSdkVersion=24
3
- SdkPianoio_targetSdkVersion=34
4
- SdkPianoio_compileSdkVersion=35
5
17
  SdkPianoio_ndkVersion=27.1.12297006
18
+ SdkPianoio_targetSdkVersion=34
19
+ android.enableJetifier=true
20
+ android.useAndroidX=true