expo-clipboard 2.0.0 → 2.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,16 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 2.1.0 — 2021-12-03
14
+
15
+ ### 🎉 New features
16
+
17
+ - Native module on iOS is now written in Swift using [Sweet API](https://blog.expo.dev/a-peek-into-the-upcoming-sweet-expo-module-api-6de6b9aca492). ([#14959](https://github.com/expo/expo/pull/14959) by [@tsapeta](https://github.com/tsapeta))
18
+
19
+ ## 2.0.1 — 2021-10-01
20
+
21
+ _This version does not introduce any user-facing changes._
22
+
13
23
  ## 2.0.0 — 2021-09-28
14
24
 
15
25
  ### 🛠 Breaking changes
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '2.0.0'
6
+ version = '2.1.0'
7
7
 
8
8
  buildscript {
9
9
  // Simple helper that allows the root project to override versions declared by this library.
@@ -57,7 +57,7 @@ android {
57
57
  minSdkVersion rootProject.ext.minSdkVersion
58
58
  targetSdkVersion rootProject.ext.targetSdkVersion
59
59
  versionCode 3
60
- versionName '2.0.0'
60
+ versionName '2.1.0'
61
61
  }
62
62
  lintOptions {
63
63
  abortOnError false
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "expo-clipboard",
3
+ "platforms": ["ios", "android", "web"],
4
+ "ios": {
5
+ "modulesClassNames": ["ClipboardModule"]
6
+ }
7
+ }
@@ -0,0 +1,42 @@
1
+ // Copyright 2018-present 650 Industries. All rights reserved.
2
+
3
+ import ExpoModulesCore
4
+
5
+ let onClipboardChanged = "onClipboardChanged"
6
+
7
+ public class ClipboardModule: Module {
8
+ public func definition() -> ModuleDefinition {
9
+ name("ExpoClipboard")
10
+
11
+ function("getStringAsync") { () -> String in
12
+ return UIPasteboard.general.string ?? ""
13
+ }
14
+
15
+ function("setString") { (content: String?) in
16
+ UIPasteboard.general.string = content ?? ""
17
+ }
18
+
19
+ events(onClipboardChanged)
20
+
21
+ onStartObserving {
22
+ NotificationCenter.default.removeObserver(self, name: UIPasteboard.changedNotification, object: nil)
23
+ NotificationCenter.default.addObserver(
24
+ self,
25
+ selector: #selector(self.clipboardChangedListener),
26
+ name: UIPasteboard.changedNotification,
27
+ object: nil
28
+ )
29
+ }
30
+
31
+ onStopObserving {
32
+ NotificationCenter.default.removeObserver(self, name: UIPasteboard.changedNotification, object: nil)
33
+ }
34
+ }
35
+
36
+ @objc
37
+ func clipboardChangedListener() {
38
+ sendEvent(onClipboardChanged, [
39
+ "content": UIPasteboard.general.string ?? ""
40
+ ])
41
+ }
42
+ }
@@ -11,18 +11,22 @@ Pod::Spec.new do |s|
11
11
  s.author = package['author']
12
12
  s.homepage = package['homepage']
13
13
  s.platform = :ios, '12.0'
14
+ s.swift_version = '5.4'
14
15
  s.source = { git: 'https://github.com/expo/expo.git' }
15
16
  s.static_framework = true
16
- s.source_files = 'EXClipboard/**/*.{h,m}'
17
- s.preserve_paths = 'EXClipboard/**/*.{h,m}'
18
- s.requires_arc = true
19
17
 
20
18
  s.dependency 'ExpoModulesCore'
21
19
 
20
+ # Swift/Objective-C compatibility
21
+ s.pod_target_xcconfig = {
22
+ 'DEFINES_MODULE' => 'YES',
23
+ 'SWIFT_COMPILATION_MODE' => 'wholemodule'
24
+ }
25
+
22
26
  if !$ExpoUseSources&.include?(package['name']) && ENV['EXPO_USE_SOURCE'].to_i == 0 && File.exist?("#{s.name}.xcframework") && Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0')
23
27
  s.source_files = "#{s.name}/**/*.h"
24
28
  s.vendored_frameworks = "#{s.name}.xcframework"
25
29
  else
26
- s.source_files = "#{s.name}/**/*.{h,m}"
30
+ s.source_files = "#{s.name}/**/*.{h,m,swift}"
27
31
  end
28
32
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-clipboard",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "ExpoClipboard standalone module",
5
5
  "main": "build/Clipboard.js",
6
6
  "types": "build/Clipboard.d.ts",
@@ -29,14 +29,15 @@
29
29
  "author": "650 Industries, Inc.",
30
30
  "license": "MIT",
31
31
  "homepage": "https://docs.expo.dev/versions/latest/sdk/clipboard",
32
- "dependencies": {
33
- "expo-modules-core": "~0.4.0"
34
- },
32
+ "dependencies": {},
35
33
  "devDependencies": {
36
34
  "expo-module-scripts": "^2.0.0"
37
35
  },
36
+ "peerDependencies": {
37
+ "expo": "*"
38
+ },
38
39
  "jest": {
39
40
  "preset": "expo-module-scripts/universal"
40
41
  },
41
- "gitHead": "1fffde73411ee7a642b98f1506a8de921805d52b"
42
+ "gitHead": "2e5c6983b86d5ecfca028ba64002897d8adc2cc4"
42
43
  }
package/unimodule.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "name": "expo-clipboard",
3
- "platforms": ["ios", "android", "web"]
4
- }