expo-mail-composer 11.3.0 → 12.1.0

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/CHANGELOG.md CHANGED
@@ -10,6 +10,22 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 12.1.0 — 2023-02-03
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Fix `composeAsync` not resolving promise after sending/ discarding email. ([#20869](https://github.com/expo/expo/pull/20869) by [@keith-kurak](https://github.com/keith-kurak))
18
+
19
+ ### 💡 Others
20
+
21
+ - On Android bump `compileSdkVersion` and `targetSdkVersion` to `33`. ([#20721](https://github.com/expo/expo/pull/20721) by [@lukmccall](https://github.com/lukmccall))
22
+
23
+ ## 12.0.0 — 2022-10-25
24
+
25
+ ### 🛠 Breaking changes
26
+
27
+ - Bumped iOS deployment target to 13.0 and deprecated support for iOS 12. ([#18873](https://github.com/expo/expo/pull/18873) by [@tsapeta](https://github.com/tsapeta))
28
+
13
29
  ## 11.3.0 — 2022-07-07
14
30
 
15
31
  ### 🎉 New features
package/README.md CHANGED
@@ -4,7 +4,7 @@ Provides an API to compose mails using OS specific UI
4
4
 
5
5
  # API documentation
6
6
 
7
- - [Documentation for the main branch](https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/mail-composer.md)
7
+ - [Documentation for the main branch](https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/mail-composer.mdx)
8
8
  - [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/mail-composer/)
9
9
 
10
10
  # Installation in managed Expo projects
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '11.3.0'
6
+ version = '12.1.0'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -59,7 +59,7 @@ afterEvaluate {
59
59
  }
60
60
 
61
61
  android {
62
- compileSdkVersion safeExtGet("compileSdkVersion", 31)
62
+ compileSdkVersion safeExtGet("compileSdkVersion", 33)
63
63
 
64
64
  compileOptions {
65
65
  sourceCompatibility JavaVersion.VERSION_11
@@ -72,9 +72,9 @@ android {
72
72
 
73
73
  defaultConfig {
74
74
  minSdkVersion safeExtGet("minSdkVersion", 21)
75
- targetSdkVersion safeExtGet("targetSdkVersion", 31)
75
+ targetSdkVersion safeExtGet("targetSdkVersion", 33)
76
76
  versionCode 17
77
- versionName "11.3.0"
77
+ versionName "12.1.0"
78
78
  }
79
79
  lintOptions {
80
80
  abortOnError false
@@ -1,5 +1,6 @@
1
1
  package expo.modules.mailcomposer
2
2
 
3
+ import android.app.Activity
3
4
  import android.content.Context
4
5
  import android.content.Intent
5
6
  import android.content.pm.LabeledIntent
@@ -12,13 +13,15 @@ import expo.modules.core.Promise
12
13
  import expo.modules.core.arguments.ReadableArguments
13
14
  import expo.modules.core.interfaces.ActivityProvider
14
15
  import expo.modules.core.interfaces.ExpoMethod
15
- import expo.modules.core.interfaces.LifecycleEventListener
16
+ import expo.modules.core.interfaces.ActivityEventListener
17
+ import expo.modules.core.interfaces.services.UIManager
16
18
 
17
19
  class MailComposerModule(
18
20
  context: Context,
19
21
  private val moduleRegistryDelegate: ModuleRegistryDelegate = ModuleRegistryDelegate()
20
- ) : ExportedModule(context), LifecycleEventListener {
22
+ ) : ExportedModule(context), ActivityEventListener {
21
23
  private var composerOpened = false
24
+ private val uiManager: UIManager by moduleRegistry()
22
25
  private var pendingPromise: Promise? = null
23
26
  override fun getName() = "ExpoMailComposer"
24
27
  private val activityProvider: ActivityProvider by moduleRegistry()
@@ -27,6 +30,11 @@ class MailComposerModule(
27
30
 
28
31
  override fun onCreate(moduleRegistry: ModuleRegistry) {
29
32
  moduleRegistryDelegate.onCreate(moduleRegistry)
33
+ uiManager.registerActivityEventListener(this)
34
+ }
35
+
36
+ override fun onDestroy() {
37
+ uiManager.unregisterActivityEventListener(this)
30
38
  }
31
39
 
32
40
  @ExpoMethod
@@ -65,25 +73,26 @@ class MailComposerModule(
65
73
  null
66
74
  ).apply {
67
75
  putExtra(Intent.EXTRA_INITIAL_INTENTS, mailIntents.toTypedArray())
68
- addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
69
76
  addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
70
77
  }
71
78
  pendingPromise = promise
72
- context.startActivity(chooser)
79
+ activityProvider.currentActivity.startActivityForResult(chooser, REQUEST_CODE)
73
80
  composerOpened = true
74
81
  }
75
82
 
76
- override fun onHostResume() {
77
- val promise = pendingPromise ?: return
78
- if (composerOpened) {
79
- composerOpened = false
80
- promise.resolve(Bundle().apply { putString("status", "sent") })
83
+ override fun onNewIntent(intent: Intent) = Unit
84
+
85
+ override fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, data: Intent?) {
86
+ if (requestCode == REQUEST_CODE && pendingPromise != null) {
87
+ val promise = pendingPromise ?: return
88
+ if (composerOpened) {
89
+ composerOpened = false
90
+ promise.resolve(Bundle().apply { putString("status", "sent") })
91
+ }
81
92
  }
82
93
  }
83
94
 
84
- override fun onHostPause() = Unit
85
-
86
- override fun onHostDestroy() {
87
- // do nothing
95
+ companion object {
96
+ private const val REQUEST_CODE = 8675
88
97
  }
89
98
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * A map defining the data to fill the mail.
3
3
  */
4
- export declare type MailComposerOptions = {
4
+ export type MailComposerOptions = {
5
5
  /**
6
6
  * An array of e-mail addresses of the recipients.
7
7
  */
@@ -32,7 +32,7 @@ export declare type MailComposerOptions = {
32
32
  */
33
33
  attachments?: string[];
34
34
  };
35
- export declare type MailComposerResult = {
35
+ export type MailComposerResult = {
36
36
  status: MailComposerStatus;
37
37
  };
38
38
  export declare enum MailComposerStatus {
@@ -1 +1 @@
1
- {"version":3,"file":"MailComposer.types.d.ts","sourceRoot":"","sources":["../src/MailComposer.types.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,oBAAY,mBAAmB,GAAG;IAChC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAGF,oBAAY,kBAAkB,GAAG;IAC/B,MAAM,EAAE,kBAAkB,CAAC;CAC5B,CAAC;AAGF,oBAAY,kBAAkB;IAC5B,YAAY,iBAAiB;IAC7B,IAAI,SAAS;IACb,KAAK,UAAU;IACf,SAAS,cAAc;CACxB"}
1
+ {"version":3,"file":"MailComposer.types.d.ts","sourceRoot":"","sources":["../src/MailComposer.types.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAGF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,kBAAkB,CAAC;CAC5B,CAAC;AAGF,oBAAY,kBAAkB;IAC5B,YAAY,iBAAiB;IAC7B,IAAI,SAAS;IACb,KAAK,UAAU;IACf,SAAS,cAAc;CACxB"}
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
10
10
  s.license = package['license']
11
11
  s.author = package['author']
12
12
  s.homepage = package['homepage']
13
- s.platform = :ios, '12.0'
13
+ s.platform = :ios, '13.0'
14
14
  s.swift_version = '5.4'
15
15
  s.source = { git: 'https://github.com/expo/expo.git' }
16
16
  s.static_framework = true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-mail-composer",
3
- "version": "11.3.0",
3
+ "version": "12.1.0",
4
4
  "description": "Provides an API to compose mails using OS specific UI",
5
5
  "main": "build/MailComposer.js",
6
6
  "types": "build/MailComposer.d.ts",
@@ -38,10 +38,10 @@
38
38
  "query-string": "^6.2.0"
39
39
  },
40
40
  "devDependencies": {
41
- "expo-module-scripts": "^2.0.0"
41
+ "expo-module-scripts": "^3.0.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "expo": "*"
45
45
  },
46
- "gitHead": "6e131f2da851a47c3a24eb3d6fc971a1a7822086"
46
+ "gitHead": "1815e2eaad8c753588c7b1eb74420174a28e01f4"
47
47
  }