@amazon-devices/expo-image 2.0.9000000002 → 3.0.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/CMakeLists.txt +5 -9
- package/build/ExpoImageModules.kepler.d.ts.map +1 -1
- package/build/ExpoImageModules.kepler.js +1 -1
- package/build/ExpoImageModules.kepler.js.map +1 -1
- package/build/ImageViewNativeComponent.js +1 -1
- package/build/ImageViewNativeComponent.js.map +1 -1
- package/kepler/AutoLinkInit.cpp +1 -1
- package/kepler/ViewManagerFactory.cpp +2 -2
- package/kepler/test/utils/Base64.cpp +73 -0
- package/kepler/thumbhash/decode.cpp +7 -15
- package/kepler/utils/Base64.cpp +85 -0
- package/kepler/utils/Base64.h +36 -0
- package/lib/aarch64-release/com.amazon.kepler.uitoolkit.react.expoimageapp.so +0 -0
- package/lib/aarch64-release/libexpo-image-3.so +0 -0
- package/lib/armv7-release/com.amazon.kepler.uitoolkit.react.expoimageapp.so +0 -0
- package/lib/armv7-release/libexpo-image-3.so +0 -0
- package/lib/x86_64-release/com.amazon.kepler.uitoolkit.react.expoimageapp.so +0 -0
- package/lib/x86_64-release/libexpo-image-3.so +0 -0
- package/package.json +1 -1
- package/react-native.config.js +8 -9
- package/src/ExpoImageModules.kepler.ts +1 -1
- package/src/ImageViewNativeComponent.ts +1 -1
- package/kepler-compatibility.json +0 -8
package/CMakeLists.txt
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
cmake_minimum_required(VERSION 3.22)
|
|
16
16
|
|
|
17
|
-
set(EXPO_IMAGE_MAJOR_VERSION
|
|
17
|
+
set(EXPO_IMAGE_MAJOR_VERSION 3)
|
|
18
18
|
set(EXPO_IMAGE_MINOR_VERSION 0)
|
|
19
19
|
set(EXPO_IMAGE_VERSION "${EXPO_IMAGE_MAJOR_VERSION}.${EXPO_IMAGE_MINOR_VERSION}")
|
|
20
20
|
|
|
@@ -43,6 +43,7 @@ set(HEADERS
|
|
|
43
43
|
${SRC_DIR}/contentposition/ImageContentPosition.h
|
|
44
44
|
${SRC_DIR}/utils/ColorUtils.h
|
|
45
45
|
${SRC_DIR}/utils/SourceSelection.h
|
|
46
|
+
${SRC_DIR}/utils/Base64.h
|
|
46
47
|
${SRC_DIR}/ExpoImage/ExpoImageTurboModule.h
|
|
47
48
|
${SRC_DIR}/ExpoImage/PrefetchListener.h
|
|
48
49
|
${SRC_DIR}/ExpoImageComponent/ExpoImageComponentViewManager.h
|
|
@@ -68,30 +69,25 @@ set(SOURCES
|
|
|
68
69
|
${SRC_DIR}/ExpoImageComponent/TransitionAnimator.cpp
|
|
69
70
|
${SRC_DIR}/ExpoImageComponent/AccessibilityDelegate.cpp
|
|
70
71
|
${SRC_DIR}/utils/SourceSelection.cpp
|
|
72
|
+
${SRC_DIR}/utils/Base64.cpp
|
|
71
73
|
${SRC_DIR}/blurhash/decode.cpp
|
|
72
74
|
${SRC_DIR}/thumbhash/decode.cpp
|
|
73
75
|
)
|
|
74
76
|
|
|
75
|
-
find_library(MBED_CRYPTO NAMES mbedcrypto REQUIRED)
|
|
76
|
-
|
|
77
77
|
set(LIBRARIES
|
|
78
78
|
turbomoduleAPI::turbomoduleAPI
|
|
79
|
-
${MBED_CRYPTO}
|
|
80
79
|
)
|
|
81
80
|
|
|
82
81
|
|
|
83
82
|
kepler_add_library(${AUTO_LINK_PACKAGE_NAME} SHARED ${HEADERS} ${SOURCES})
|
|
84
83
|
|
|
85
|
-
set_target_properties(${AUTO_LINK_PACKAGE_NAME} PROPERTIES
|
|
86
|
-
SOVERSION ${EXPO_IMAGE_MAJOR_VERSION}.${EXPO_IMAGE_MINOR_VERSION})
|
|
87
|
-
|
|
88
84
|
target_include_directories(${AUTO_LINK_PACKAGE_NAME} PRIVATE ${SRC_DIR})
|
|
89
85
|
|
|
90
86
|
target_link_libraries(${AUTO_LINK_PACKAGE_NAME} PRIVATE expo_image_idl ${LIBRARIES})
|
|
91
87
|
|
|
92
|
-
kepler_install_components(${AUTO_LINK_PACKAGE_NAME} IN_PROCESS "/com.amazon.kepler.uitoolkit.react.
|
|
88
|
+
kepler_install_components(${AUTO_LINK_PACKAGE_NAME} IN_PROCESS "/com.amazon.kepler.uitoolkit.react.expoimageapp")
|
|
93
89
|
|
|
94
|
-
set(component_name "com.amazon.kepler.uitoolkit.react.
|
|
90
|
+
set(component_name "com.amazon.kepler.uitoolkit.react.expoimageapp.so")
|
|
95
91
|
add_custom_command(
|
|
96
92
|
TARGET ${AUTO_LINK_PACKAGE_NAME}
|
|
97
93
|
POST_BUILD
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoImageModules.kepler.d.ts","sourceRoot":"","sources":["../src/ExpoImageModules.kepler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAsB,MAAM,oCAAoC,CAAC;AAI1F,KAAK,IAAI,GAAG,iBAAiB,CAAC;AAC9B,eAAO,MAAM,eAAe,0GAAqB,CAAC;AAClD,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"ExpoImageModules.kepler.d.ts","sourceRoot":"","sources":["../src/ExpoImageModules.kepler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAsB,MAAM,oCAAoC,CAAC;AAI1F,KAAK,IAAI,GAAG,iBAAiB,CAAC;AAC9B,eAAO,MAAM,eAAe,0GAAqB,CAAC;AAClD,eAAO,MAAM,eAAe,EAA+D,IAAI,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TurboModuleRegistry } from '@amazon-devices/keplerscript-turbomodule-api';
|
|
2
2
|
import ExpoImageComponent from './ImageViewNativeComponent';
|
|
3
3
|
export const NativeExpoImage = ExpoImageComponent;
|
|
4
|
-
export const ExpoImageModule = TurboModuleRegistry.getEnforcing('
|
|
4
|
+
export const ExpoImageModule = TurboModuleRegistry.getEnforcing('ExpoImageAppTM');
|
|
5
5
|
//# sourceMappingURL=ExpoImageModules.kepler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoImageModules.kepler.js","sourceRoot":"","sources":["../src/ExpoImageModules.kepler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,mBAAmB,EAAC,MAAM,oCAAoC,CAAC;AAE1F,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAG5D,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAClD,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAC,YAAY,CAAO,
|
|
1
|
+
{"version":3,"file":"ExpoImageModules.kepler.js","sourceRoot":"","sources":["../src/ExpoImageModules.kepler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,mBAAmB,EAAC,MAAM,oCAAoC,CAAC;AAE1F,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAG5D,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAClD,MAAM,CAAC,MAAM,eAAe,GAAG,mBAAmB,CAAC,YAAY,CAAO,gBAAgB,CAAS,CAAC","sourcesContent":["import {KeplerTurboModule, TurboModuleRegistry} from '@amazon-devices/keplerscript-turbomodule-api';\n\nimport ExpoImageComponent from './ImageViewNativeComponent';\n\ntype Spec = KeplerTurboModule;\nexport const NativeExpoImage = ExpoImageComponent;\nexport const ExpoImageModule = TurboModuleRegistry.getEnforcing<Spec>('ExpoImageAppTM') as Spec;\n"]}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
import registerNativeComponent from './fabric/registerNativeComponent';
|
|
11
|
-
const ImageViewNativeComponent = registerNativeComponent('
|
|
11
|
+
const ImageViewNativeComponent = registerNativeComponent('ExpoImageAppComponent', {
|
|
12
12
|
validAttributes: {
|
|
13
13
|
placeholder: true,
|
|
14
14
|
pointerEvents: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageViewNativeComponent.js","sourceRoot":"","sources":["../src/ImageViewNativeComponent.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,uBAAuB,MAAM,kCAAkC,CAAC;AAevE,MAAM,wBAAwB,GAAG,uBAAuB,CAAgC,
|
|
1
|
+
{"version":3,"file":"ImageViewNativeComponent.js","sourceRoot":"","sources":["../src/ImageViewNativeComponent.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,uBAAuB,MAAM,kCAAkC,CAAC;AAevE,MAAM,wBAAwB,GAAG,uBAAuB,CAAgC,uBAAuB,EAAE;IAC/G,eAAe,EAAE;QACf,WAAW,EAAE,IAAI;QACjB,aAAa,EAAE,IAAI;QACnB,UAAU,EAAE,IAAI;QAChB,UAAU,EAAE,IAAI;QAChB,eAAe,EAAE,IAAI;QACrB,MAAM,EAAE,IAAI;QACZ,qBAAqB,EAAE,IAAI;QAC3B,UAAU,EAAE,IAAI;QAChB,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,IAAI;QACjB,gBAAgB,EAAE,IAAI;QACtB,YAAY,EAAE,IAAI;QAClB,WAAW,EAAE,IAAI;QACjB,MAAM,EAAE,IAAI;QACZ,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,IAAI;QACf,aAAa,EAAE,IAAI;QACnB,sBAAsB,EAAE,IAAI;QAC5B,YAAY,EAAE,IAAI;QAClB,GAAG,EAAE,IAAI;QACT,kBAAkB,EAAE,IAAI;QACxB,yBAAyB,EAAE,IAAI;QAC/B,gBAAgB,EAAE,IAAI;KACvB;CACF,CAAC,CAAC;AAEH,eAAe,wBAAwB,CAAC","sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @flow strict-local\n * @format\n */\n\nimport { NativeSyntheticEvent, ProcessedColorValue } from 'react-native';\n\nimport registerNativeComponent from './fabric/registerNativeComponent';\nimport {\n ImageNativeProps,\n ImageErrorEventData,\n ImageLoadEventData,\n ImageProgressEventData,\n} from './Image.types';\n\nexport type ImageViewNativeComponentProps = Omit<ImageNativeProps, 'tintColor' | 'onLoad' | 'onError' | 'onProgress'> & {\n tintColor: ProcessedColorValue | null | undefined;\n onLoad: (event: NativeSyntheticEvent<ImageLoadEventData>) => void;\n onError: (event: NativeSyntheticEvent<ImageErrorEventData>) => void;\n onProgress: (event: NativeSyntheticEvent<ImageProgressEventData>) => void;\n};\n\nconst ImageViewNativeComponent = registerNativeComponent<ImageViewNativeComponentProps>('ExpoImageAppComponent', {\n validAttributes: {\n placeholder: true,\n pointerEvents: true,\n resizeMode: true,\n contentFit: true,\n contentPosition: true,\n source: true,\n placeholderContentFit: true,\n transition: true,\n blurRadius: true,\n tintColor: true,\n priority: true,\n cachePolicy: true,\n responsivePolicy: true,\n recyclingKey: true,\n onLoadStart: true,\n onLoad: true,\n onProgress: true,\n onError: true,\n onLoadEnd: true,\n defaultSource: true,\n loadingIndicatorSource: true,\n fadeDuration: true,\n alt: true,\n accessibilityLabel: true,\n enableLiveTextInteraction: true,\n allowDownscaling: true,\n },\n});\n\nexport default ImageViewNativeComponent;\n"]}
|
package/kepler/AutoLinkInit.cpp
CHANGED
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
|
|
13
13
|
extern "C" {
|
|
14
14
|
__attribute__((visibility("default"))) void autoLinkKeplerTurboModulesV1() noexcept {
|
|
15
|
-
KEPLER_REGISTER_TURBO_MODULE_WITH_NAME("
|
|
15
|
+
KEPLER_REGISTER_TURBO_MODULE_WITH_NAME("ExpoImageAppTM", expoimage, ExpoImageTurboModule);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -24,7 +24,7 @@ Ptr<IViewManager> ViewManagerFactory::makeViewManager(StringView name) {
|
|
|
24
24
|
if (!viewModule) {
|
|
25
25
|
throw apmf::InvalidArgumentError("ExpoImage: failed to acquire IViewModule");
|
|
26
26
|
}
|
|
27
|
-
if (name == "
|
|
27
|
+
if (name == "ExpoImageAppComponent") {
|
|
28
28
|
return Ptr<ExpoImageComponentViewManager>::Make(viewModule);
|
|
29
29
|
}
|
|
30
30
|
throw apmf::InvalidArgumentError(
|
|
@@ -33,4 +33,4 @@ Ptr<IViewManager> ViewManagerFactory::makeViewManager(StringView name) {
|
|
|
33
33
|
|
|
34
34
|
} // namespace expoimage
|
|
35
35
|
|
|
36
|
-
APMF_COMPONENT("/com.amazon.kepler.uitoolkit.react.
|
|
36
|
+
APMF_COMPONENT("/com.amazon.kepler.uitoolkit.react.expoimageapp", expoimage::ViewManagerFactory);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#include "../../utils/Base64.h"
|
|
2
|
+
|
|
3
|
+
#include <gtest/gtest.h>
|
|
4
|
+
|
|
5
|
+
#include <string>
|
|
6
|
+
|
|
7
|
+
namespace expoimage {
|
|
8
|
+
namespace {
|
|
9
|
+
|
|
10
|
+
std::string decode(const std::string& in) {
|
|
11
|
+
std::string out;
|
|
12
|
+
EXPECT_TRUE(decodeBase64(in, out));
|
|
13
|
+
return out;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
TEST(DecodeBase64, DecodesSvg) {
|
|
17
|
+
EXPECT_EQ(decode("PHN2Zy8+"), "<svg/>");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
TEST(DecodeBase64, EmptyInput) {
|
|
21
|
+
std::string out;
|
|
22
|
+
EXPECT_TRUE(decodeBase64("", out));
|
|
23
|
+
EXPECT_EQ(out, "");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
TEST(DecodeBase64, NoPadding) {
|
|
27
|
+
// "Man" -> "TWFu" (exact multiple of 4, no padding)
|
|
28
|
+
EXPECT_EQ(decode("TWFu"), "Man");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
TEST(DecodeBase64, OnePadByte) {
|
|
32
|
+
// "Ma" -> "TWE=" (one '=' -> two output bytes)
|
|
33
|
+
EXPECT_EQ(decode("TWE="), "Ma");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
TEST(DecodeBase64, TwoPadBytes) {
|
|
37
|
+
// "M" -> "TQ==" (two '=' -> one output byte)
|
|
38
|
+
EXPECT_EQ(decode("TQ=="), "M");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
TEST(DecodeBase64, UnpaddedRemainder) {
|
|
42
|
+
// Same payloads as the padded cases but without '=' padding.
|
|
43
|
+
EXPECT_EQ(decode("TWE"), "Ma");
|
|
44
|
+
EXPECT_EQ(decode("TQ"), "M");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
TEST(DecodeBase64, PlusAndSlash) {
|
|
48
|
+
// bytes {0xFB, 0xFF, 0xBF} -> "+/+/"
|
|
49
|
+
EXPECT_EQ(decode("+/+/"), std::string("\xFB\xFF\xBF", 3));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
TEST(DecodeBase64, RejectsInvalidCharacter) {
|
|
53
|
+
std::string out;
|
|
54
|
+
EXPECT_FALSE(decodeBase64("TW*u", out));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
TEST(DecodeBase64, RejectsWhitespace) {
|
|
58
|
+
std::string out;
|
|
59
|
+
EXPECT_FALSE(decodeBase64("TW Fu", out));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
TEST(DecodeBase64, RejectsDataAfterPadding) {
|
|
63
|
+
std::string out;
|
|
64
|
+
EXPECT_FALSE(decodeBase64("TQ==A", out));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
TEST(DecodeBase64, RejectsLoneRemainderByte) {
|
|
68
|
+
std::string out;
|
|
69
|
+
EXPECT_FALSE(decodeBase64("TWFuA", out));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
} // namespace
|
|
73
|
+
} // namespace expoimage
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
#include "decode.h"
|
|
10
|
-
|
|
11
|
-
#include <mbedtls/base64.h>
|
|
10
|
+
#include "../utils/Base64.h"
|
|
12
11
|
|
|
13
12
|
#include <cmath>
|
|
14
13
|
#include <string>
|
|
@@ -19,19 +18,12 @@
|
|
|
19
18
|
namespace {
|
|
20
19
|
|
|
21
20
|
std::string base64_decode(const std::string& in) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
mbedtls_base64_decode(
|
|
29
|
-
reinterpret_cast<unsigned char*>(buffer.data()),
|
|
30
|
-
bufferSize,
|
|
31
|
-
&bufferSize,
|
|
32
|
-
reinterpret_cast<const unsigned char*>(in.data()),
|
|
33
|
-
in.size());
|
|
34
|
-
|
|
21
|
+
std::string buffer;
|
|
22
|
+
if (!expoimage::decodeBase64(in, buffer)) {
|
|
23
|
+
// Return empty on malformed input so the size check in the caller
|
|
24
|
+
// rejects the hash instead of decoding a partial buffer into garbage pixels
|
|
25
|
+
return "";
|
|
26
|
+
}
|
|
35
27
|
return buffer;
|
|
36
28
|
}
|
|
37
29
|
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* base64 decoding.
|
|
3
|
+
*
|
|
4
|
+
* Adapted from base64.cpp by René Nyffenegger (zlib license). Altered from the
|
|
5
|
+
* original: decode-only, strict RFC 4648 validation, and a bool success return.
|
|
6
|
+
*
|
|
7
|
+
* Copyright (C) 2004-2017 René Nyffenegger
|
|
8
|
+
*
|
|
9
|
+
* This source code is provided 'as-is', without any express or implied
|
|
10
|
+
* warranty. In no event will the author be held liable for any damages
|
|
11
|
+
* arising from the use of this software.
|
|
12
|
+
*
|
|
13
|
+
* Permission is granted to anyone to use this software for any purpose,
|
|
14
|
+
* including commercial applications, and to alter it and redistribute it
|
|
15
|
+
* freely, subject to the following restrictions:
|
|
16
|
+
*
|
|
17
|
+
* 1. The origin of this source code must not be misrepresented; you must not
|
|
18
|
+
* claim that you wrote the original source code. If you use this source code
|
|
19
|
+
* in a product, an acknowledgment in the product documentation would be
|
|
20
|
+
* appreciated but is not required.
|
|
21
|
+
* 2. Altered source versions must be plainly marked as such, and must not be
|
|
22
|
+
* misrepresented as being the original source code.
|
|
23
|
+
* 3. This notice may not be removed or altered from any source distribution.
|
|
24
|
+
*
|
|
25
|
+
* René Nyffenegger rene.nyffenegger@adp-gmbh.ch
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
#include "Base64.h"
|
|
29
|
+
|
|
30
|
+
namespace expoimage {
|
|
31
|
+
|
|
32
|
+
namespace {
|
|
33
|
+
|
|
34
|
+
int decodeValue(unsigned char c) {
|
|
35
|
+
if (c >= 'A' && c <= 'Z') return c - 'A';
|
|
36
|
+
if (c >= 'a' && c <= 'z') return c - 'a' + 26;
|
|
37
|
+
if (c >= '0' && c <= '9') return c - '0' + 52;
|
|
38
|
+
if (c == '+') return 62;
|
|
39
|
+
if (c == '/') return 63;
|
|
40
|
+
return -1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
} // namespace
|
|
44
|
+
|
|
45
|
+
bool decodeBase64(const std::string& input, std::string& output) {
|
|
46
|
+
output.clear();
|
|
47
|
+
output.reserve(input.size() / 4 * 3);
|
|
48
|
+
|
|
49
|
+
unsigned char block[4];
|
|
50
|
+
size_t filled = 0;
|
|
51
|
+
size_t padding = 0;
|
|
52
|
+
|
|
53
|
+
for (unsigned char c : input) {
|
|
54
|
+
if (c == '=') {
|
|
55
|
+
++padding;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (padding != 0) return false;
|
|
59
|
+
|
|
60
|
+
const int value = decodeValue(c);
|
|
61
|
+
if (value < 0) return false;
|
|
62
|
+
|
|
63
|
+
block[filled++] = static_cast<unsigned char>(value);
|
|
64
|
+
if (filled == 4) {
|
|
65
|
+
output.push_back(static_cast<char>((block[0] << 2) + ((block[1] & 0x30) >> 4)));
|
|
66
|
+
output.push_back(static_cast<char>(((block[1] & 0x0f) << 4) + ((block[2] & 0x3c) >> 2)));
|
|
67
|
+
output.push_back(static_cast<char>(((block[2] & 0x03) << 6) + block[3]));
|
|
68
|
+
filled = 0;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (padding > 2) return false;
|
|
73
|
+
if (filled == 1) return false;
|
|
74
|
+
|
|
75
|
+
if (filled >= 2) {
|
|
76
|
+
output.push_back(static_cast<char>((block[0] << 2) + ((block[1] & 0x30) >> 4)));
|
|
77
|
+
if (filled == 3) {
|
|
78
|
+
output.push_back(static_cast<char>(((block[1] & 0x0f) << 4) + ((block[2] & 0x3c) >> 2)));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
} // namespace expoimage
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* base64 decoding.
|
|
3
|
+
*
|
|
4
|
+
* Adapted from base64.cpp by René Nyffenegger (zlib license). Altered from the
|
|
5
|
+
* original: decode-only, strict RFC 4648 validation, and a bool success return.
|
|
6
|
+
*
|
|
7
|
+
* Copyright (C) 2004-2017 René Nyffenegger
|
|
8
|
+
*
|
|
9
|
+
* This source code is provided 'as-is', without any express or implied
|
|
10
|
+
* warranty. In no event will the author be held liable for any damages
|
|
11
|
+
* arising from the use of this software.
|
|
12
|
+
*
|
|
13
|
+
* Permission is granted to anyone to use this software for any purpose,
|
|
14
|
+
* including commercial applications, and to alter it and redistribute it
|
|
15
|
+
* freely, subject to the following restrictions:
|
|
16
|
+
*
|
|
17
|
+
* 1. The origin of this source code must not be misrepresented; you must not
|
|
18
|
+
* claim that you wrote the original source code. If you use this source code
|
|
19
|
+
* in a product, an acknowledgment in the product documentation would be
|
|
20
|
+
* appreciated but is not required.
|
|
21
|
+
* 2. Altered source versions must be plainly marked as such, and must not be
|
|
22
|
+
* misrepresented as being the original source code.
|
|
23
|
+
* 3. This notice may not be removed or altered from any source distribution.
|
|
24
|
+
*
|
|
25
|
+
* René Nyffenegger rene.nyffenegger@adp-gmbh.ch
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
#pragma once
|
|
29
|
+
|
|
30
|
+
#include <string>
|
|
31
|
+
|
|
32
|
+
namespace expoimage {
|
|
33
|
+
|
|
34
|
+
[[nodiscard]] bool decodeBase64(const std::string& input, std::string& output);
|
|
35
|
+
|
|
36
|
+
} // namespace expoimage
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@amazon-devices/expo-image", "title": "Expo Image", "version": "
|
|
1
|
+
{"name": "@amazon-devices/expo-image", "title": "Expo Image", "version": "3.0.2+1.6.0", "description": "A cross-platform, performant image component for React Native and Expo with Web support", "main": "build/index.js", "types": "build/index.d.ts", "sideEffects": false, "scripts": {"build": "expo-module build", "clean": "expo-module clean", "lint": "expo-module lint", "test": "expo-module test", "prepublishOnly": "expo-module prepublishOnly", "expo-module": "expo-module"}, "homepage": "https://docs.expo.dev/versions/latest/sdk/image/", "repository": {"type": "git", "url": "https://github.com/expo/expo.git", "directory": "packages/expo-image"}, "kepler": {"temporary-alias-for-package": {"name": "expo-image", "version": "1.6.0"}}, "keywords": ["react-native"], "author": "650 Industries, Inc.", "license": "See license in LICENSE", "dependencies": {"@amazon-devices/keplerscript-turbomodule-api": "^1.0.0"}, "devDependencies": {"expo-module-scripts": "^3.0.0"}, "peerDependencies": {"expo": "^50.0.0-alpha.1"}}
|
package/react-native.config.js
CHANGED
|
@@ -10,19 +10,18 @@ module.exports = {
|
|
|
10
10
|
platforms: {
|
|
11
11
|
kepler: {
|
|
12
12
|
autolink: {
|
|
13
|
-
|
|
14
|
-
libraryName: 'libexpo-image-
|
|
13
|
+
ExpoImageTMAppLib: {
|
|
14
|
+
libraryName: 'libexpo-image-3.so',
|
|
15
15
|
linkDynamic: true,
|
|
16
|
-
turbomodules: ['
|
|
17
|
-
|
|
18
|
-
provider: 'system',
|
|
16
|
+
turbomodules: ['ExpoImageAppTM'],
|
|
17
|
+
provider: 'application',
|
|
19
18
|
},
|
|
20
|
-
|
|
21
|
-
uiComponentName: '/com.amazon.kepler.uitoolkit.react.
|
|
19
|
+
ExpoImageViewAppLib: {
|
|
20
|
+
uiComponentName: '/com.amazon.kepler.uitoolkit.react.expoimageapp',
|
|
22
21
|
linkDynamic: true,
|
|
23
|
-
components: ['
|
|
22
|
+
components: ['ExpoImageAppComponent'],
|
|
24
23
|
turbomodules: [],
|
|
25
|
-
provider: '
|
|
24
|
+
provider: 'application',
|
|
26
25
|
},
|
|
27
26
|
},
|
|
28
27
|
},
|
|
@@ -4,4 +4,4 @@ import ExpoImageComponent from './ImageViewNativeComponent';
|
|
|
4
4
|
|
|
5
5
|
type Spec = KeplerTurboModule;
|
|
6
6
|
export const NativeExpoImage = ExpoImageComponent;
|
|
7
|
-
export const ExpoImageModule = TurboModuleRegistry.getEnforcing<Spec>('
|
|
7
|
+
export const ExpoImageModule = TurboModuleRegistry.getEnforcing<Spec>('ExpoImageAppTM') as Spec;
|
|
@@ -25,7 +25,7 @@ export type ImageViewNativeComponentProps = Omit<ImageNativeProps, 'tintColor' |
|
|
|
25
25
|
onProgress: (event: NativeSyntheticEvent<ImageProgressEventData>) => void;
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
const ImageViewNativeComponent = registerNativeComponent<ImageViewNativeComponentProps>('
|
|
28
|
+
const ImageViewNativeComponent = registerNativeComponent<ImageViewNativeComponentProps>('ExpoImageAppComponent', {
|
|
29
29
|
validAttributes: {
|
|
30
30
|
placeholder: true,
|
|
31
31
|
pointerEvents: true,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"versions": {
|
|
3
|
-
"2.0.0": "/com.amazon.kepler.expo_image_2@IExpoImage_0",
|
|
4
|
-
"2.0.9000000000": "/com.amazon.kepler.expo_image_2@IExpoImage_0",
|
|
5
|
-
"2.0.9000000001": "/com.amazon.kepler.expo_image_2@IExpoImage_0",
|
|
6
|
-
"2.0.9000000002": "/com.amazon.kepler.expo_image_2@IExpoImage_0"
|
|
7
|
-
}
|
|
8
|
-
}
|