expo-observe 0.1.5 → 0.1.7

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-present 650 Industries, Inc. (aka Expo)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -62,7 +62,7 @@ dependencies {
62
62
  implementation project(':expo-updates-interface')
63
63
  implementation "com.facebook.react:react-android"
64
64
  implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0"
65
- implementation "com.squareup.okhttp3:okhttp:5.3.0"
65
+ implementation "com.squareup.okhttp3:okhttp:4.9.2"
66
66
  // This is a workaround for IDE warning - https://youtrack.jetbrains.com/issue/KTIJ-31549
67
67
  implementation "androidx.annotation:annotation-experimental:1.5.1"
68
68
 
@@ -76,7 +76,7 @@ dependencies {
76
76
  testImplementation 'junit:junit:4.13.2'
77
77
  testImplementation 'org.robolectric:robolectric:4.11.1'
78
78
  testImplementation 'androidx.test:core:1.5.0'
79
- testImplementation 'com.squareup.okhttp3:mockwebserver:5.3.0'
79
+ testImplementation 'com.squareup.okhttp3:mockwebserver:4.9.2'
80
80
  testImplementation 'io.mockk:mockk:1.13.8'
81
81
  testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3'
82
82
  }
@@ -73,7 +73,7 @@ class EventDispatcher(
73
73
  }
74
74
 
75
75
  val response = call.execute()
76
- Log.d(TAG, "Server responded with: ${response.body.string()}")
76
+ Log.d(TAG, "Server responded with: ${response.body?.string()}")
77
77
 
78
78
  continuation.resume(response.code in 200..299)
79
79
  } catch (e: Exception) {
@@ -1,10 +1,15 @@
1
1
  package expo.modules.observe
2
2
 
3
+ import android.app.NotificationChannel
4
+ import android.app.NotificationManager
3
5
  import android.content.Context
6
+ import android.os.Build
4
7
  import android.util.Log
8
+ import androidx.core.app.NotificationCompat
5
9
  import androidx.work.Constraints
6
10
  import androidx.work.CoroutineWorker
7
11
  import androidx.work.ExistingWorkPolicy
12
+ import androidx.work.ForegroundInfo
8
13
  import androidx.work.NetworkType
9
14
  import androidx.work.OneTimeWorkRequestBuilder
10
15
  import androidx.work.WorkManager
@@ -51,6 +56,21 @@ class ObservabilityBackgroundWorker(
51
56
  )
52
57
  }
53
58
 
59
+ override suspend fun getForegroundInfo(): ForegroundInfo {
60
+ val channelId = "expo-observe-background"
61
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
62
+ val channel = NotificationChannel(channelId, "Metrics dispatch", NotificationManager.IMPORTANCE_LOW)
63
+ val manager = applicationContext.getSystemService(NotificationManager::class.java)
64
+ manager.createNotificationChannel(channel)
65
+ }
66
+ val notification = NotificationCompat.Builder(applicationContext, channelId)
67
+ .setSmallIcon(android.R.drawable.ic_popup_sync)
68
+ .setContentTitle("Sending metrics")
69
+ .setPriority(NotificationCompat.PRIORITY_LOW)
70
+ .build()
71
+ return ForegroundInfo(WORK_NAME.hashCode(), notification)
72
+ }
73
+
54
74
  override suspend fun doWork(): Result {
55
75
  return try {
56
76
  if (observabilityManager == null) {
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;;AAErD,wBAAyE"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;;AAErD,wBAAyE"}
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAG3C,eAAe,mBAAmB,CAAwB,aAAa,CAAC,CAAC","sourcesContent":["import { requireNativeModule } from 'expo';\nimport type { ExpoObserveModuleType } from './types';\n\nexport default requireNativeModule<ExpoObserveModuleType>('ExpoObserve');\n"]}
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAI3C,eAAe,mBAAmB,CAAwB,aAAa,CAAC,CAAC","sourcesContent":["import { requireNativeModule } from 'expo';\n\nimport type { ExpoObserveModuleType } from './types';\n\nexport default requireNativeModule<ExpoObserveModuleType>('ExpoObserve');\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"module.web.d.ts","sourceRoot":"","sources":["../src/module.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,MAAM,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE7D,cAAc,SAAS,CAAC;AAExB,cAAM,iBAAkB,SAAQ,YAAa,YAAW,qBAAqB;IACrE,cAAc;IACpB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAChC;;AAED,wBAAmE"}
1
+ {"version":3,"file":"module.web.d.ts","sourceRoot":"","sources":["../src/module.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAqB,MAAM,MAAM,CAAC;AAEvD,OAAO,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE7D,cAAc,SAAS,CAAC;AAExB,cAAM,iBAAkB,SAAQ,YAAa,YAAW,qBAAqB;IACrE,cAAc;IACpB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAChC;;AAED,wBAAmE"}
@@ -1 +1 @@
1
- {"version":3,"file":"module.web.js","sourceRoot":"","sources":["../src/module.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAGvD,cAAc,SAAS,CAAC;AAExB,MAAM,iBAAkB,SAAQ,YAAY;IAC1C,KAAK,CAAC,cAAc,KAAI,CAAC;IACzB,SAAS,CAAC,MAAc,IAAS,CAAC;CACnC;AAED,eAAe,iBAAiB,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import { NativeModule, registerWebModule } from 'expo';\nimport type { Config, ExpoObserveModuleType } from './types';\n\nexport * from './types';\n\nclass ExpoObserveModule extends NativeModule implements ExpoObserveModuleType {\n async dispatchEvents() {}\n configure(config: Config): void {}\n}\n\nexport default registerWebModule(ExpoObserveModule, 'ExpoObserve');\n"]}
1
+ {"version":3,"file":"module.web.js","sourceRoot":"","sources":["../src/module.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAIvD,cAAc,SAAS,CAAC;AAExB,MAAM,iBAAkB,SAAQ,YAAY;IAC1C,KAAK,CAAC,cAAc,KAAI,CAAC;IACzB,SAAS,CAAC,MAAc,IAAS,CAAC;CACnC;AAED,eAAe,iBAAiB,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import { NativeModule, registerWebModule } from 'expo';\n\nimport type { Config, ExpoObserveModuleType } from './types';\n\nexport * from './types';\n\nclass ExpoObserveModule extends NativeModule implements ExpoObserveModuleType {\n async dispatchEvents() {}\n configure(config: Config): void {}\n}\n\nexport default registerWebModule(ExpoObserveModule, 'ExpoObserve');\n"]}
@@ -11,8 +11,8 @@ Pod::Spec.new do |s|
11
11
  s.author = package['author']
12
12
  s.homepage = package['homepage']
13
13
  s.platforms = {
14
- :ios => '15.1',
15
- :tvos => '15.1'
14
+ :ios => '16.4',
15
+ :tvos => '16.4'
16
16
  }
17
17
  s.swift_version = '6.0'
18
18
  s.source = { git: 'https://github.com/expo/expo.git' }
@@ -36,9 +36,5 @@ Pod::Spec.new do |s|
36
36
 
37
37
  s.test_spec 'Tests' do |test_spec|
38
38
  test_spec.source_files = 'Tests'
39
- test_spec.platforms = {
40
- :ios => '17.0',
41
- :tvos => '17.0'
42
- }
43
39
  end
44
40
  end
package/package.json CHANGED
@@ -1,20 +1,10 @@
1
1
  {
2
2
  "name": "expo-observe",
3
- "title": "Expo Observe",
4
- "version": "0.1.5",
3
+ "version": "0.1.7",
5
4
  "description": "Expo module that dispatches collected app metrics to EAS Observe",
6
5
  "main": "src/index.ts",
7
6
  "types": "build/index.d.ts",
8
7
  "sideEffects": false,
9
- "scripts": {
10
- "build": "expo-module build",
11
- "clean": "expo-module clean",
12
- "lint": "expo-module lint",
13
- "test": "expo-module test",
14
- "prepare": "expo-module prepare",
15
- "prepublishOnly": "expo-module prepublishOnly",
16
- "expo-module": "expo-module"
17
- },
18
8
  "homepage": "https://docs.expo.dev/",
19
9
  "repository": {
20
10
  "type": "git",
@@ -33,13 +23,22 @@
33
23
  "author": "650 Industries, Inc.",
34
24
  "license": "MIT",
35
25
  "dependencies": {
36
- "expo-app-metrics": "~0.1.5",
37
- "expo-eas-client": "~55.0.3"
26
+ "expo-eas-client": "~55.0.2",
27
+ "expo-updates-interface": "~55.1.3"
38
28
  },
39
29
  "devDependencies": {
40
- "expo-module-scripts": "^5.0.7"
30
+ "expo-module-scripts": "55.0.2"
41
31
  },
42
32
  "peerDependencies": {
43
- "expo": "*"
33
+ "expo-app-metrics": "0.1.7",
34
+ "react-native": "*",
35
+ "expo": "55.0.2"
36
+ },
37
+ "scripts": {
38
+ "build": "expo-module build",
39
+ "clean": "expo-module clean",
40
+ "lint": "expo-module lint",
41
+ "test": "expo-module test",
42
+ "expo-module": "expo-module"
44
43
  }
45
- }
44
+ }
package/src/module.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { requireNativeModule } from 'expo';
2
+
2
3
  import type { ExpoObserveModuleType } from './types';
3
4
 
4
5
  export default requireNativeModule<ExpoObserveModuleType>('ExpoObserve');
package/src/module.web.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { NativeModule, registerWebModule } from 'expo';
2
+
2
3
  import type { Config, ExpoObserveModuleType } from './types';
3
4
 
4
5
  export * from './types';