diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 12f262dd..ac4fd4dd 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -385,6 +385,11 @@ PODS: - react-native-blur (4.3.0): - React-Core - react-native-cameraroll (5.3.1): +<<<<<<< HEAD +======= + - React-Core + - react-native-get-random-values (1.8.0): +>>>>>>> onboarding-and-discovery - React-Core - react-native-image-resizer (3.0.5): - React-Core @@ -615,6 +620,7 @@ DEPENDENCIES: - React-logger (from `../node_modules/react-native/ReactCommon/logger`) - "react-native-blur (from `../node_modules/@react-native-community/blur`)" - "react-native-cameraroll (from `../node_modules/@react-native-camera-roll/camera-roll`)" + - react-native-get-random-values (from `../node_modules/react-native-get-random-values`) - "react-native-image-resizer (from `../node_modules/@bam.tech/react-native-image-resizer`)" - react-native-pager-view (from `../node_modules/react-native-pager-view`) - "react-native-paste-input (from `../node_modules/@mattermost/react-native-paste-input`)" @@ -748,6 +754,8 @@ EXTERNAL SOURCES: :path: "../node_modules/@react-native-community/blur" react-native-cameraroll: :path: "../node_modules/@react-native-camera-roll/camera-roll" + react-native-get-random-values: + :path: "../node_modules/react-native-get-random-values" react-native-image-resizer: :path: "../node_modules/@bam.tech/react-native-image-resizer" react-native-pager-view: @@ -869,6 +877,10 @@ SPEC CHECKSUMS: React-logger: 957e5dc96d9dbffc6e0f15e0ee4d2b42829ff207 react-native-blur: 50c9feabacbc5f49b61337ebc32192c6be7ec3c3 react-native-cameraroll: f3050460fe1708378698c16686bfaa5f34099be2 +<<<<<<< HEAD +======= + react-native-get-random-values: a6ea6a8a65dc93e96e24a11105b1a9c8cfe1d72a +>>>>>>> onboarding-and-discovery react-native-image-resizer: 00ceb0e05586c7aadf061eea676957a6c2ec60fa react-native-pager-view: 54bed894cecebe28cede54c01038d9d1e122de43 react-native-paste-input: 3392800944a47c00dddbff23c31c281482209679 diff --git a/package.json b/package.json index 33c72458..194c649e 100644 --- a/package.json +++ b/package.json @@ -90,6 +90,7 @@ "react-native-fast-image": "^8.6.3", "react-native-fs": "^2.20.0", "react-native-gesture-handler": "~2.9.0", + "react-native-get-random-values": "^1.8.0", "react-native-haptic-feedback": "^1.14.0", "react-native-image-crop-picker": "^0.38.1", "react-native-inappbrowser-reborn": "^3.6.3", diff --git a/src/platform/polyfills.ts b/src/platform/polyfills.ts index 336ce12b..3dbd1398 100644 --- a/src/platform/polyfills.ts +++ b/src/platform/polyfills.ts @@ -1 +1,50 @@ export {} + +/** +https://github.com/MaxArt2501/base64-js +The MIT License (MIT) +Copyright (c) 2014 MaxArt2501 + */ + +const b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' +// Regular expression to check formal correctness of base64 encoded strings +const b64re = + /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/ + +globalThis.atob = (str: string): string => { + // atob can work with strings with whitespaces, even inside the encoded part, + // but only \t, \n, \f, \r and ' ', which can be stripped. + str = String(str).replace(/[\t\n\f\r ]+/g, '') + if (!b64re.test(str)) { + throw new TypeError( + "Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.", + ) + } + + // Adding the padding if missing, for semplicity + str += '=='.slice(2 - (str.length & 3)) + var bitmap, + result = '', + r1, + r2, + i = 0 + for (; i < str.length; ) { + bitmap = + (b64.indexOf(str.charAt(i++)) << 18) | + (b64.indexOf(str.charAt(i++)) << 12) | + ((r1 = b64.indexOf(str.charAt(i++))) << 6) | + (r2 = b64.indexOf(str.charAt(i++))) + + result += + r1 === 64 + ? String.fromCharCode((bitmap >> 16) & 255) + : r2 === 64 + ? String.fromCharCode((bitmap >> 16) & 255, (bitmap >> 8) & 255) + : String.fromCharCode( + (bitmap >> 16) & 255, + (bitmap >> 8) & 255, + bitmap & 255, + ) + } + return result +} diff --git a/yarn.lock b/yarn.lock index f3b747e8..19ed4cda 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7503,6 +7503,11 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" +fast-base64-decode@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fast-base64-decode/-/fast-base64-decode-1.0.0.tgz#b434a0dd7d92b12b43f26819300d2dafb83ee418" + integrity sha512-qwaScUgUGBYeDNRnbc/KyllVU88Jk1pRHPStuF/lO7B0/RTRLj7U0lkdTAutlBblY08rwZDff6tNU9cjv6j//Q== + fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" @@ -13680,6 +13685,13 @@ react-native-gesture-handler@~2.9.0: lodash "^4.17.21" prop-types "^15.7.2" +react-native-get-random-values@^1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/react-native-get-random-values/-/react-native-get-random-values-1.8.0.tgz#1cb4bd4bd3966a356e59697b8f372999fe97cb16" + integrity sha512-H/zghhun0T+UIJLmig3+ZuBCvF66rdbiWUfRSNS6kv5oDSpa1ZiVyvRWtuPesQpT8dXj+Bv7WJRQOUP+5TB1sA== + dependencies: + fast-base64-decode "^1.0.0" + react-native-gradle-plugin@^0.71.15: version "0.71.16" resolved "https://registry.yarnpkg.com/react-native-gradle-plugin/-/react-native-gradle-plugin-0.71.16.tgz#822bb0c680e03b5df5aa65f2e5ffc2bc2930854a"