@lodev09/react-native-exify 0.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.
Files changed (34) hide show
  1. package/Exify.podspec +41 -0
  2. package/LICENSE +20 -0
  3. package/README.md +50 -0
  4. package/android/build.gradle +95 -0
  5. package/android/gradle.properties +5 -0
  6. package/android/src/main/AndroidManifest.xml +3 -0
  7. package/android/src/main/AndroidManifestNew.xml +2 -0
  8. package/android/src/main/java/com/exify/ExifyModule.kt +99 -0
  9. package/android/src/main/java/com/exify/ExifyPackage.kt +17 -0
  10. package/android/src/main/java/com/exify/ExifyTags.kt +142 -0
  11. package/android/src/main/java/com/exify/ExifyUtils.kt +41 -0
  12. package/ios/Exify-Bridging-Header.h +11 -0
  13. package/ios/Exify.mm +28 -0
  14. package/ios/Exify.swift +131 -0
  15. package/ios/Exify.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  16. package/ios/Exify.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  17. package/ios/Exify.xcodeproj/project.xcworkspace/xcuserdata/lodev09.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  18. package/ios/Exify.xcodeproj/xcuserdata/lodev09.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  19. package/ios/ExifyUtils.swift +131 -0
  20. package/lib/commonjs/index.js +53 -0
  21. package/lib/commonjs/index.js.map +1 -0
  22. package/lib/commonjs/types.js +2 -0
  23. package/lib/commonjs/types.js.map +1 -0
  24. package/lib/module/index.js +31 -0
  25. package/lib/module/index.js.map +1 -0
  26. package/lib/module/types.js +2 -0
  27. package/lib/module/types.js.map +1 -0
  28. package/lib/typescript/src/index.d.ts +16 -0
  29. package/lib/typescript/src/index.d.ts.map +1 -0
  30. package/lib/typescript/src/types.d.ts +161 -0
  31. package/lib/typescript/src/types.d.ts.map +1 -0
  32. package/package.json +181 -0
  33. package/src/index.ts +40 -0
  34. package/src/types.ts +161 -0
package/package.json ADDED
@@ -0,0 +1,181 @@
1
+ {
2
+ "name": "@lodev09/react-native-exify",
3
+ "version": "0.1.0",
4
+ "description": "Read and write exif data into an image.",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/src/index.d.ts",
8
+ "react-native": "src/index",
9
+ "source": "src/index",
10
+ "files": [
11
+ "src",
12
+ "lib",
13
+ "android",
14
+ "ios",
15
+ "cpp",
16
+ "*.podspec",
17
+ "!ios/build",
18
+ "!android/build",
19
+ "!android/gradle",
20
+ "!android/gradlew",
21
+ "!android/gradlew.bat",
22
+ "!android/local.properties",
23
+ "!**/__tests__",
24
+ "!**/__fixtures__",
25
+ "!**/__mocks__",
26
+ "!**/.*"
27
+ ],
28
+ "scripts": {
29
+ "example": "yarn workspace exify-example",
30
+ "test": "jest",
31
+ "typecheck": "tsc --noEmit",
32
+ "lint": "eslint --fix \"**/*.{js,ts,tsx}\"",
33
+ "format": "prettier --write \"**/*.{js,ts,tsx}\"",
34
+ "tidy": "yarn typecheck && yarn lint && yarn format",
35
+ "clean": "del-cli android/build lib && yarn workspace exify-example clean",
36
+ "prepare": "bob build",
37
+ "release": "release-it"
38
+ },
39
+ "keywords": [
40
+ "exif",
41
+ "exif-gps",
42
+ "image-exif",
43
+ "react-native",
44
+ "ios",
45
+ "android"
46
+ ],
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/lodev09/react-native-exify.git"
50
+ },
51
+ "author": "lodev09 <lodev09@gmail.com> (https://github.com/lodev09)",
52
+ "license": "MIT",
53
+ "bugs": {
54
+ "url": "https://github.com/lodev09/react-native-exify/issues"
55
+ },
56
+ "homepage": "https://github.com/lodev09/react-native-exify#readme",
57
+ "publishConfig": {
58
+ "registry": "https://registry.npmjs.org/"
59
+ },
60
+ "devDependencies": {
61
+ "@commitlint/config-conventional": "^19.0.3",
62
+ "@evilmartians/lefthook": "^1.6.5",
63
+ "@react-native/eslint-config": "^0.73.2",
64
+ "@release-it/conventional-changelog": "^8.0.1",
65
+ "@types/jest": "^29.5.12",
66
+ "@types/react": "^18.2.64",
67
+ "@typescript-eslint/eslint-plugin": "^7.1.1",
68
+ "@typescript-eslint/parser": "^7.1.1",
69
+ "commitlint": "^19.0.3",
70
+ "del-cli": "^5.1.0",
71
+ "eslint": "^8.57.0",
72
+ "eslint-config-prettier": "^9.1.0",
73
+ "eslint-config-standard": "^17.1.0",
74
+ "eslint-plugin-import": "^2.29.1",
75
+ "eslint-plugin-n": "^16.6.2",
76
+ "eslint-plugin-prettier": "^5.1.3",
77
+ "eslint-plugin-promise": "^6.1.1",
78
+ "jest": "^29.7.0",
79
+ "prettier": "^3.2.5",
80
+ "react": "^18.2.0",
81
+ "react-native": "^0.73.5",
82
+ "react-native-builder-bob": "^0.23.2",
83
+ "release-it": "^17.1.1",
84
+ "turbo": "^1.12.5",
85
+ "typescript": "~5.3.3"
86
+ },
87
+ "resolutions": {
88
+ "@types/react": "^18.2.44"
89
+ },
90
+ "peerDependencies": {
91
+ "react": "*",
92
+ "react-native": "*"
93
+ },
94
+ "workspaces": [
95
+ "example"
96
+ ],
97
+ "packageManager": "yarn@3.6.1",
98
+ "jest": {
99
+ "preset": "react-native",
100
+ "modulePathIgnorePatterns": [
101
+ "<rootDir>/example/node_modules",
102
+ "<rootDir>/lib/"
103
+ ]
104
+ },
105
+ "commitlint": {
106
+ "extends": [
107
+ "@commitlint/config-conventional"
108
+ ]
109
+ },
110
+ "release-it": {
111
+ "git": {
112
+ "commitMessage": "chore: release ${version}",
113
+ "tagName": "v${version}"
114
+ },
115
+ "npm": {
116
+ "publish": true
117
+ },
118
+ "github": {
119
+ "release": true
120
+ },
121
+ "plugins": {
122
+ "@release-it/conventional-changelog": {
123
+ "preset": "angular"
124
+ }
125
+ }
126
+ },
127
+ "eslintConfig": {
128
+ "root": true,
129
+ "extends": [
130
+ "plugin:@typescript-eslint/recommended",
131
+ "eslint:recommended",
132
+ "plugin:react/recommended",
133
+ "plugin:react-native/all",
134
+ "standard",
135
+ "prettier"
136
+ ],
137
+ "globals": {
138
+ "it": false
139
+ },
140
+ "rules": {
141
+ "@typescript-eslint/no-var-requires": 0,
142
+ "@typescript-eslint/no-unused-vars": [
143
+ "error",
144
+ {
145
+ "argsIgnorePattern": "^_",
146
+ "varsIgnorePattern": "^_"
147
+ }
148
+ ],
149
+ "no-unused-vars": 0
150
+ },
151
+ "settings": {
152
+ "react": {
153
+ "pragma": "React",
154
+ "version": "detect"
155
+ }
156
+ }
157
+ },
158
+ "prettier": {
159
+ "quoteProps": "consistent",
160
+ "singleQuote": true,
161
+ "tabWidth": 2,
162
+ "trailingComma": "es5",
163
+ "useTabs": false,
164
+ "printWidth": 100,
165
+ "semi": false
166
+ },
167
+ "react-native-builder-bob": {
168
+ "source": "src",
169
+ "output": "lib",
170
+ "targets": [
171
+ "commonjs",
172
+ "module",
173
+ [
174
+ "typescript",
175
+ {
176
+ "project": "tsconfig.build.json"
177
+ }
178
+ ]
179
+ ]
180
+ }
181
+ }
package/src/index.ts ADDED
@@ -0,0 +1,40 @@
1
+ import { NativeModules, Platform } from 'react-native'
2
+ import type { ExifTags, ExifyWriteResult } from './types'
3
+
4
+ const LINKING_ERROR =
5
+ `The package '@lodev09/react-native-exify' doesn't seem to be linked. Make sure: \n\n` +
6
+ Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
7
+ '- You rebuilt the app after installing the package\n' +
8
+ '- You are not using Expo Go\n'
9
+
10
+ const Exify = NativeModules.Exify
11
+ ? NativeModules.Exify
12
+ : new Proxy(
13
+ {},
14
+ {
15
+ get() {
16
+ throw new Error(LINKING_ERROR)
17
+ },
18
+ }
19
+ )
20
+
21
+ /**
22
+ * Write Exif data into an image file.
23
+ * @param {string} uri the image uri to write
24
+ * @param {ExifTags} tags the exif tags to be written
25
+ * @return {Promise<ExifyWriteResult>} the full exif tags of the image
26
+ */
27
+ export function writeAsync(uri: string, tags: ExifTags): Promise<ExifyWriteResult | undefined> {
28
+ return Exify.writeAsync(uri, tags)
29
+ }
30
+
31
+ /**
32
+ * Read Exif data from an image file.
33
+ * @param {string} uri the image uri to read
34
+ * @return {Promise<ExifTags>} the raw exif tags of the image
35
+ */
36
+ export function readAsync(uri: string): Promise<ExifTags | undefined> {
37
+ return Exify.readAsync(uri)
38
+ }
39
+
40
+ export * from './types'
package/src/types.ts ADDED
@@ -0,0 +1,161 @@
1
+ /**
2
+ * From Android's ExifInterface Tags
3
+ */
4
+ export interface ExifTags {
5
+ SensorLeftBorder?: number
6
+ SensorBottomBorder?: number
7
+ DefaultCropSize?: number
8
+ GPSTrackRef?: string
9
+ GPSSpeedRef?: string
10
+ GPSSpeed?: number
11
+ GPSMapDatum?: string
12
+ GPSLatitudeRef?: string
13
+ GPSLatitude?: number
14
+ GPSDifferential?: number
15
+ GPSDestLatitudeRef?: string
16
+ GPSDestDistanceRef?: string
17
+ GPSHPositioningError?: string
18
+ GPSDestDistance?: number
19
+ GPSDestBearing?: number
20
+ GPSDateStamp?: string
21
+ GPSAltitudeRef?: number
22
+ GPSAltitude?: number
23
+ GPSDestLatitude?: number
24
+ GPSImgDirection?: number
25
+ GPSDOP?: number
26
+ GPSTrack?: number
27
+ GPSVersionID?: string
28
+ GPSLongitude?: number
29
+ GPSDestLongitudeRef?: string
30
+ GPSImgDirectionRef?: string
31
+ GPSProcessingMethod?: string
32
+ GPSMeasureMode?: string
33
+ GPSLongitudeRef?: string
34
+ GPSSatellites?: string
35
+ GPSAreaInformation?: string
36
+ GPSDestBearingRef?: string
37
+ GPSStatus?: string
38
+ GPSTimeStamp?: string
39
+ GPSDestLongitude?: number
40
+ SensorTopBorder?: number
41
+ Copyright?: string
42
+ PreviewImageStart?: number
43
+ SubSecTimeDigitized?: string
44
+ SubSecTime?: string
45
+ SubfileType?: number
46
+ SpectralSensitivity?: string
47
+ SpatialFrequencyResponse?: string
48
+ DNGVersion?: number
49
+ Sharpness?: number
50
+ PixelXDimension?: number
51
+ SceneCaptureType?: number
52
+ ExposureTime?: number
53
+ RelatedSoundFile?: string
54
+ AspectFrame?: number
55
+ Flash?: number
56
+ SceneType?: string
57
+ OECF?: string
58
+ NewSubfileType?: number
59
+ PixelYDimension?: number
60
+ MakerNote?: string
61
+ ShutterSpeedValue?: number
62
+ LightSource?: number
63
+ UserComment?: string
64
+ GainControl?: number
65
+ ISOSpeedRatings?: number[]
66
+ FocalPlaneResolutionUnit?: number
67
+ FocalPlaneXResolution?: number
68
+ YCbCrCoefficients?: number
69
+ FocalLengthIn35mmFilm?: number
70
+ LensMake?: string
71
+ LensModel?: string
72
+ LensSpecification?: number[]
73
+ ISO?: number
74
+ FlashpixVersion?: number[]
75
+ StripOffsets?: number
76
+ SensingMethod?: number
77
+ FlashEnergy?: number
78
+ FocalLength?: number
79
+ FNumber?: number
80
+ MeteringMode?: number
81
+ FocalPlaneYResolution?: number
82
+ ExposureBiasValue?: number
83
+ ExposureProgram?: number
84
+ SubjectDistance?: number
85
+ ThumbnailImageLength?: number
86
+ Compression?: number
87
+ ExposureMode?: number
88
+ ExposureIndex?: number
89
+ WhiteBalance?: number
90
+ DateTimeOriginal?: string
91
+ RowsPerStrip?: number
92
+ DateTimeDigitized?: string
93
+ ExifVersion?: number[]
94
+ Saturation?: number
95
+ CustomRendered?: number
96
+ Contrast?: number
97
+ ComponentsConfiguration?: number[]
98
+ ColorSpace?: number
99
+ SubjectLocation?: number
100
+ ThumbnailImageWidth?: number
101
+ BrightnessValue?: number
102
+ Model?: string
103
+ InteroperabilityIndex?: string
104
+ CompressedBitsPerPixel?: number
105
+ ApertureValue?: number
106
+ DeviceSettingDescription?: string
107
+ JPEGInterchangeFormat?: number
108
+ StripByteCounts?: number
109
+ YCbCrSubSampling?: number
110
+ DigitalZoomRatio?: number
111
+ PreviewImageLength?: number
112
+ YCbCrPositioning?: number
113
+ FileSource?: string
114
+ Artist?: string
115
+ Make?: string
116
+ CFAPattern?: string
117
+ WhitePoint?: number
118
+ SamplesPerPixel?: number
119
+ SubjectArea?: number[]
120
+ JPEGInterchangeFormatLength?: number
121
+ ResolutionUnit?: number
122
+ PrimaryChromaticities?: number
123
+ PlanarConfiguration?: number
124
+ TransferFunction?: number
125
+ SubSecTimeOriginal?: string
126
+ Orientation?: number
127
+ PhotometricInterpretation?: number
128
+ MaxApertureValue?: number
129
+ ImageDescription?: string
130
+ SensorRightBorder?: number
131
+ YResolution?: number
132
+ BitsPerSample?: number
133
+ ImageUniqueID?: string
134
+ DateTime?: string
135
+ ImageWidth?: number
136
+ ReferenceBlackWhite?: number
137
+ ImageLength?: number
138
+ SubjectDistanceRange?: number
139
+ XResolution?: number
140
+ Software?: string
141
+ [key: string]: unknown
142
+ }
143
+
144
+ /**
145
+ * Exify `writeAsync` result data
146
+ */
147
+ export interface ExifyWriteResult {
148
+ /**
149
+ * The URI of the image that was written.
150
+ * On IOS asset, this will be new URI created.
151
+ */
152
+ uri?: string
153
+ /**
154
+ * Media Library Asset ID
155
+ */
156
+ assetId?: string | null
157
+ /**
158
+ * Raw EXIF data from the platform
159
+ */
160
+ tags?: ExifTags
161
+ }