scandit-capacitor-datacapture-core 7.1.2 → 7.2.0-beta.2

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.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ ScanditCaptureCore builds the foundation of all data capture related functionality offered by the Scandit Data Capture SDK. It contains classes and interfaces shared between the data capture modules.
2
+
3
+ Learn more with the [official documentation](https://docs.scandit.com/) or get started with [our samples](https://github.com/Scandit/datacapture-capacitor-samples)
@@ -16,5 +16,5 @@ Pod::Spec.new do |s|
16
16
  s.swift_version = "5.7"
17
17
 
18
18
  s.dependency "Capacitor"
19
- s.dependency "scandit-datacapture-frameworks-core", '= 7.1.2'
19
+ s.dependency "scandit-datacapture-frameworks-core", '= 7.2.0-beta.2'
20
20
  end
@@ -9,10 +9,37 @@ def safeExtGet(prop, fallback) {
9
9
  }
10
10
 
11
11
  buildscript {
12
+ def retrieveCapacitorCompatibility = {
13
+ def file = project(":app").file("capacitor.build.gradle")
14
+ if (file.exists()) {
15
+ def content = file.text
16
+
17
+ def sourceCompatibilityMatch = content =~ /sourceCompatibility\s+JavaVersion.VERSION_(\d+)/
18
+ def targetCompatibilityMatch = content =~ /targetCompatibility\s+JavaVersion.VERSION_(\d+)/
19
+
20
+ if (sourceCompatibilityMatch) {
21
+ ext.rootSourceCompatibility = JavaVersion.toVersion(sourceCompatibilityMatch[0][1])
22
+ } else {
23
+ ext.rootSourceCompatibility = JavaVersion.VERSION_17
24
+ }
25
+
26
+ if (targetCompatibilityMatch) {
27
+ ext.rootTargetCompatibility = JavaVersion.toVersion(targetCompatibilityMatch[0][1])
28
+ } else {
29
+ ext.rootTargetCompatibility = JavaVersion.VERSION_17
30
+ }
31
+ }
32
+ }
33
+
12
34
  ext {
13
35
  kotlin_version = "1.8.20"
14
36
  agp_version = "8.5.1"
37
+ rootSourceCompatibility = JavaVersion.VERSION_17
38
+ rootTargetCompatibility = JavaVersion.VERSION_17
15
39
  }
40
+
41
+ retrieveCapacitorCompatibility()
42
+
16
43
  repositories {
17
44
  google()
18
45
  mavenCentral()
@@ -45,8 +72,8 @@ android {
45
72
  abortOnError false
46
73
  }
47
74
  compileOptions {
48
- sourceCompatibility = JavaVersion.VERSION_17
49
- targetCompatibility = JavaVersion.VERSION_17
75
+ sourceCompatibility = rootSourceCompatibility
76
+ targetCompatibility = rootTargetCompatibility
50
77
  }
51
78
  }
52
79
 
@@ -56,7 +83,7 @@ repositories {
56
83
  }
57
84
 
58
85
  dependencies {
59
- def sdk_version = "7.1.2"
86
+ def sdk_version = "7.2.0-beta.2"
60
87
 
61
88
  implementation fileTree(dir: 'libs', include: ['*.jar'])
62
89
 
@@ -18,6 +18,8 @@ import com.scandit.datacapture.core.source.FrameSourceState
18
18
  import com.scandit.datacapture.core.source.FrameSourceStateDeserializer
19
19
  import com.scandit.datacapture.frameworks.core.CoreModule
20
20
  import com.scandit.datacapture.frameworks.core.events.Emitter
21
+ import com.scandit.datacapture.frameworks.core.lifecycle.ActivityLifecycleDispatcher
22
+ import com.scandit.datacapture.frameworks.core.lifecycle.DefaultActivityLifecycle
21
23
  import com.scandit.datacapture.frameworks.core.listeners.FrameworksDataCaptureContextListener
22
24
  import com.scandit.datacapture.frameworks.core.listeners.FrameworksDataCaptureViewListener
23
25
  import com.scandit.datacapture.frameworks.core.listeners.FrameworksFrameSourceDeserializer
@@ -45,7 +47,8 @@ class ScanditCaptureCoreNative :
45
47
  "ScanditTextNative"
46
48
  )
47
49
  }
48
-
50
+ private val lifecycleDispatcher: ActivityLifecycleDispatcher =
51
+ DefaultActivityLifecycle.getInstance()
49
52
  private val captureViewHandler = DataCaptureViewHandler()
50
53
  private val frameSourceListener = FrameworksFrameSourceListener(this)
51
54
  private val coreModule = CoreModule(
@@ -91,9 +94,11 @@ class ScanditCaptureCoreNative :
91
94
  coreModule.registerDataCaptureContextListener()
92
95
  coreModule.registerDataCaptureViewListener()
93
96
  coreModule.registerFrameSourceListener()
97
+ lifecycleDispatcher.dispatchOnStart()
94
98
  }
95
99
 
96
100
  override fun handleOnStop() {
101
+ lifecycleDispatcher.dispatchOnStop()
97
102
  lastFrameSourceState = coreModule.getCurrentCameraDesiredState() ?: FrameSourceState.OFF
98
103
  coreModule.switchToDesiredCameraState(FrameSourceState.OFF)
99
104
  coreModule.unregisterDataCaptureContextListener()
@@ -102,10 +107,19 @@ class ScanditCaptureCoreNative :
102
107
  }
103
108
 
104
109
  override fun handleOnDestroy() {
110
+ lifecycleDispatcher.dispatchOnDestroy()
105
111
  coreModule.onDestroy()
106
112
  captureViewHandler.disposeCurrentWebView()
107
113
  }
108
114
 
115
+ override fun handleOnResume() {
116
+ lifecycleDispatcher.dispatchOnResume()
117
+ }
118
+
119
+ override fun handleOnPause() {
120
+ lifecycleDispatcher.dispatchOnPause()
121
+ }
122
+
109
123
  private fun checkCameraPermission(): Boolean =
110
124
  getPermissionState("camera") == PermissionState.GRANTED
111
125