Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5681630e4c | ||
|
|
1eecae469d | ||
|
|
f7c8bf3949 | ||
|
|
d538838921 | ||
|
|
b5abddb69a | ||
|
|
15cbdcfaca | ||
|
|
30246a189c | ||
|
|
f77f0a7aa2 | ||
|
|
36d4bd7e99 | ||
|
|
b8f2a9e24f | ||
|
|
d7edbf55b5 | ||
|
|
d362d9e8dd | ||
|
|
f47693fb35 | ||
|
|
54b10c818e |
No files matched your search
@@ -1,3 +1,7 @@
|
||||
if (__DEV__) {
|
||||
import('./reactotron').then(() => console.log('Reactotron Configured'));
|
||||
}
|
||||
|
||||
import LBRYApp from './src/index';
|
||||
|
||||
export default LBRYApp;
|
||||
Generated
+99
-60
@@ -2074,9 +2074,9 @@
|
||||
}
|
||||
},
|
||||
"@react-navigation/core": {
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@react-navigation/core/-/core-3.5.0.tgz",
|
||||
"integrity": "sha512-NLm24lA51R8o8c+iFnwtN9elqRzm4OJ8f1qPBCUNIYW1sb8M5yCD53vRP0fRcPFpr/6Xzs2TJMsWnnebwFp0Rw==",
|
||||
"version": "3.5.1",
|
||||
"resolved": "https://registry.npmjs.org/@react-navigation/core/-/core-3.5.1.tgz",
|
||||
"integrity": "sha512-q7NyhWVYOhVIWqL2GZKa6G78YarXaVTTtOlSDkvy4ZIggo40wZzamlnrJRvsaQX46gsgw45FAWb5SriHh8o7eA==",
|
||||
"requires": {
|
||||
"hoist-non-react-statics": "^3.3.0",
|
||||
"path-to-regexp": "^1.7.0",
|
||||
@@ -2085,9 +2085,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"hoist-non-react-statics": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.0.tgz",
|
||||
"integrity": "sha512-0XsbTXxgiaCDYDIWFcwkmerZPSwywfUqYmwT4jzewKTQSWoE6FCMoUVOeBJWK3E/CrWbxRG3m5GzY4lnIwGRBA==",
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz",
|
||||
"integrity": "sha512-wbg3bpgA/ZqWrZuMOeJi8+SKMhr7X9TesL/rXMjTzh0p0JUBo3II8DHboYbuIXWRlttrUFxwcu/5kygrCw8fJw==",
|
||||
"requires": {
|
||||
"react-is": "^16.7.0"
|
||||
}
|
||||
@@ -2095,9 +2095,9 @@
|
||||
}
|
||||
},
|
||||
"@react-navigation/native": {
|
||||
"version": "3.6.1",
|
||||
"resolved": "https://registry.npmjs.org/@react-navigation/native/-/native-3.6.1.tgz",
|
||||
"integrity": "sha512-q12/sG4LinEokc7K0DRn0uxoBuLy42TedHNDXN3b9Fj9c2FamUqlLeTZQtjDQc8dLBEeN2Bpp5FSDN8MYxxjAA==",
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@react-navigation/native/-/native-3.6.2.tgz",
|
||||
"integrity": "sha512-Cybeou6N82ZeRmgnGlu+wzlV3z5BZQR2dmYaNFV1TNLUGHqtvv8E7oNw9uYcz9Ox5LFbiX+FdNTn2d6ZPlK0kg==",
|
||||
"requires": {
|
||||
"hoist-non-react-statics": "^3.0.1",
|
||||
"react-native-safe-area-view": "^0.14.1",
|
||||
@@ -2105,27 +2105,12 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"hoist-non-react-statics": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.0.tgz",
|
||||
"integrity": "sha512-0XsbTXxgiaCDYDIWFcwkmerZPSwywfUqYmwT4jzewKTQSWoE6FCMoUVOeBJWK3E/CrWbxRG3m5GzY4lnIwGRBA==",
|
||||
"version": "3.3.1",
|
||||
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz",
|
||||
"integrity": "sha512-wbg3bpgA/ZqWrZuMOeJi8+SKMhr7X9TesL/rXMjTzh0p0JUBo3II8DHboYbuIXWRlttrUFxwcu/5kygrCw8fJw==",
|
||||
"requires": {
|
||||
"react-is": "^16.7.0"
|
||||
}
|
||||
},
|
||||
"react-native-safe-area-view": {
|
||||
"version": "0.14.7",
|
||||
"resolved": "https://registry.npmjs.org/react-native-safe-area-view/-/react-native-safe-area-view-0.14.7.tgz",
|
||||
"integrity": "sha512-fmuBYpvKDJK33bimo4JXrK2BN2CGw7nof1y1LDRgzqv+FZ3eADSDGshprN8WeQqSZjQ20hJx1CiWk28Edg/v4Q==",
|
||||
"requires": {
|
||||
"hoist-non-react-statics": "^2.3.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"hoist-non-react-statics": {
|
||||
"version": "2.5.5",
|
||||
"resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz",
|
||||
"integrity": "sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw=="
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -7062,8 +7047,8 @@
|
||||
}
|
||||
},
|
||||
"lbry-redux": {
|
||||
"version": "github:lbryio/lbry-redux#abe90e0665cfad3fb8853501ec058c5d1f0d9cc8",
|
||||
"from": "github:lbryio/lbry-redux#abe90e0665cfad3fb8853501ec058c5d1f0d9cc8",
|
||||
"version": "github:lbryio/lbry-redux#2c569a729bb40d45249ca38150b00922162b7ce3",
|
||||
"from": "github:lbryio/lbry-redux#2c569a729bb40d45249ca38150b00922162b7ce3",
|
||||
"requires": {
|
||||
"proxy-polyfill": "0.1.6",
|
||||
"reselect": "^3.0.0",
|
||||
@@ -8584,6 +8569,12 @@
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
|
||||
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
|
||||
},
|
||||
"mitt": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/mitt/-/mitt-1.1.3.tgz",
|
||||
"integrity": "sha512-mUDCnVNsAi+eD6qA0HkRkwYczbLHJ49z17BGe2PYRhZL4wpZUFZGJHU7/5tmvohoma+Hdn0Vh/oJTiPEmgSruA==",
|
||||
"dev": true
|
||||
},
|
||||
"mixin-deep": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz",
|
||||
@@ -9155,9 +9146,9 @@
|
||||
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw=="
|
||||
},
|
||||
"path-to-regexp": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.7.0.tgz",
|
||||
"integrity": "sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=",
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz",
|
||||
"integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==",
|
||||
"requires": {
|
||||
"isarray": "0.0.1"
|
||||
},
|
||||
@@ -9526,9 +9517,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"query-string": {
|
||||
"version": "6.8.2",
|
||||
"resolved": "https://registry.npmjs.org/query-string/-/query-string-6.8.2.tgz",
|
||||
"integrity": "sha512-J3Qi8XZJXh93t2FiKyd/7Ec6GNifsjKXUsVFkSBj/kjLsDylWhnCz4NT1bkPcKotttPW+QbKGqqPH8OoI2pdqw==",
|
||||
"version": "6.9.0",
|
||||
"resolved": "https://registry.npmjs.org/query-string/-/query-string-6.9.0.tgz",
|
||||
"integrity": "sha512-KG4bhCFYapExLsUHrFt+kQVEegF2agm4cpF/VNc6pZVthIfCc/GK8t8VyNIE3nyXG9DK3Tf2EGkxjR6/uRdYsA==",
|
||||
"requires": {
|
||||
"decode-uri-component": "^0.2.0",
|
||||
"split-on-first": "^1.0.0",
|
||||
@@ -9899,6 +9890,14 @@
|
||||
"resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-1.4.0.tgz",
|
||||
"integrity": "sha512-tO7nSNNP+iRLVbkcSS5GXyDBb7tSI02+XuRL3/S39EAr35rnvUy2JfeLUQG+fWSObJjnMVhasUDEUwlENk8IXw=="
|
||||
},
|
||||
"react-native-safe-area-view": {
|
||||
"version": "0.14.8",
|
||||
"resolved": "https://registry.npmjs.org/react-native-safe-area-view/-/react-native-safe-area-view-0.14.8.tgz",
|
||||
"integrity": "sha512-MtRSIcZNstxv87Jet+UsPhEd1tpGe8cVskDXlP657x6rHpSrbrc+y13ZNXrwAgGNNhqQNX7UJT68ZIq//ZRmvw==",
|
||||
"requires": {
|
||||
"hoist-non-react-statics": "^2.3.1"
|
||||
}
|
||||
},
|
||||
"react-native-screens": {
|
||||
"version": "1.0.0-alpha.23",
|
||||
"resolved": "https://registry.npmjs.org/react-native-screens/-/react-native-screens-1.0.0-alpha.23.tgz",
|
||||
@@ -10098,14 +10097,14 @@
|
||||
}
|
||||
},
|
||||
"react-navigation": {
|
||||
"version": "3.12.1",
|
||||
"resolved": "https://registry.npmjs.org/react-navigation/-/react-navigation-3.12.1.tgz",
|
||||
"integrity": "sha512-WLjQis/A40cIMpFlw4o26nSLN+CvrZp8MGvJoL5K5H7DMZ/TdwgPa/Nm2sAQA27Hw7hOohQGj+diyxFRZi89Iw==",
|
||||
"version": "3.13.0",
|
||||
"resolved": "https://registry.npmjs.org/react-navigation/-/react-navigation-3.13.0.tgz",
|
||||
"integrity": "sha512-r64bTImY2aNye8wtd39ubouVB6ZMJqjVQYKxH4LFmOav4FsI59fQTDN7sZzyJa29owowYw/wVkh+NWGT+tdD1A==",
|
||||
"requires": {
|
||||
"@react-navigation/core": "~3.5.0",
|
||||
"@react-navigation/native": "~3.6.1",
|
||||
"@react-navigation/core": "~3.5.1",
|
||||
"@react-navigation/native": "~3.6.2",
|
||||
"react-navigation-drawer": "~1.4.0",
|
||||
"react-navigation-stack": "~1.5.0",
|
||||
"react-navigation-stack": "1.5.3",
|
||||
"react-navigation-tabs": "~1.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -10118,9 +10117,9 @@
|
||||
}
|
||||
},
|
||||
"react-navigation-stack": {
|
||||
"version": "1.5.5",
|
||||
"resolved": "https://registry.npmjs.org/react-navigation-stack/-/react-navigation-stack-1.5.5.tgz",
|
||||
"integrity": "sha512-qMhOhmUmyPNfFGWMbwv5flrNVsFU4JZSBWnONSgVGK4KWGW8DbobXBi4i4sBAC9Kg8EqJK0qyWcxnkMJJtfMWA==",
|
||||
"version": "1.5.3",
|
||||
"resolved": "https://registry.npmjs.org/react-navigation-stack/-/react-navigation-stack-1.5.3.tgz",
|
||||
"integrity": "sha512-MQcwDVbZUYsTtDJb5cFOSm+K+e7KpUCoROaGoUOR+JHWE3uuaJ3pd/Nu+32a57J98TNBf4qq0+2TPJWl6z6IBg==",
|
||||
"requires": {
|
||||
"prop-types": "^15.7.2"
|
||||
}
|
||||
@@ -10128,12 +10127,9 @@
|
||||
}
|
||||
},
|
||||
"react-navigation-drawer": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/react-navigation-drawer/-/react-navigation-drawer-1.4.0.tgz",
|
||||
"integrity": "sha512-ZyWBozcjB2aZ7vwCALv90cYA2NpDjM+WALaiYRshvPvue8l7cqynePbHK8GhlMGyJDwZqp4MxQmu8u1XAKp3Bw==",
|
||||
"requires": {
|
||||
"react-native-tab-view": "^1.2.0"
|
||||
}
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/react-navigation-drawer/-/react-navigation-drawer-2.3.3.tgz",
|
||||
"integrity": "sha512-d/rA8Slqv7HoMfONKVDBQUrRF7YQH796Gzal/KOhaY4VOwUUqIwfxMRJ3WrsdL2OkDPixtkXJE2Fz6KAj658uA=="
|
||||
},
|
||||
"react-navigation-redux-helpers": {
|
||||
"version": "3.0.2",
|
||||
@@ -10191,6 +10187,43 @@
|
||||
"integrity": "sha512-kv5QlFFSZWo7OlJFNYbxRtY66JImuP2LcrFgyJfQaf85gSP+byzG21UbDQEYjU7f//ny8rwiEkO6py2Y+fEgAQ==",
|
||||
"dev": true
|
||||
},
|
||||
"reactotron-core-client": {
|
||||
"version": "2.8.6",
|
||||
"resolved": "https://registry.npmjs.org/reactotron-core-client/-/reactotron-core-client-2.8.6.tgz",
|
||||
"integrity": "sha512-xgg6dusfgQHC98f4iRH/Zak/PNvA46znupEd2U7DSCmmhZbfCpSSveKUsYok0OW0HiSCSvi41tNELj+QU6pRVQ==",
|
||||
"dev": true
|
||||
},
|
||||
"reactotron-react-native": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/reactotron-react-native/-/reactotron-react-native-4.0.2.tgz",
|
||||
"integrity": "sha512-zY5m0TV9y52h31/Vvd/Zs3jneEKYWbJ6vGrBeZ/d6Z2gVvwI3su+7B2qh8s00KHStIF4MTg0MrKc0FYRFWmmoQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"mitt": "1.1.3",
|
||||
"query-string": "6.8.1",
|
||||
"reactotron-core-client": "2.8.6",
|
||||
"rn-host-detect": "1.1.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"query-string": {
|
||||
"version": "6.8.1",
|
||||
"resolved": "https://registry.npmjs.org/query-string/-/query-string-6.8.1.tgz",
|
||||
"integrity": "sha512-g6y0Lbq10a5pPQpjlFuojfMfV1Pd2Jw9h75ypiYPPia3Gcq2rgkKiIwbkS6JxH7c5f5u/B/sB+d13PU+g1eu4Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"decode-uri-component": "^0.2.0",
|
||||
"split-on-first": "^1.0.0",
|
||||
"strict-uri-encode": "^2.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"reactotron-redux": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/reactotron-redux/-/reactotron-redux-3.1.2.tgz",
|
||||
"integrity": "sha512-2ScTmE2+kxjKPc7+vsYuw+igkhd4tjoftn4ouugVudQCO7B5vXVyQwLkNv/feaFfFoPlCQSVeJVg7PdzDFOsEQ==",
|
||||
"dev": true
|
||||
},
|
||||
"read-pkg": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",
|
||||
@@ -10264,16 +10297,16 @@
|
||||
}
|
||||
},
|
||||
"redux-persist": {
|
||||
"version": "5.10.0",
|
||||
"resolved": "https://registry.npmjs.org/redux-persist/-/redux-persist-5.10.0.tgz",
|
||||
"integrity": "sha512-sSJAzNq7zka3qVHKce1hbvqf0Vf5DuTVm7dr4GtsqQVOexnrvbV47RWFiPxQ8fscnyiuWyD2O92DOxPl0tGCRg=="
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/redux-persist/-/redux-persist-6.0.0.tgz",
|
||||
"integrity": "sha512-71LLMbUq2r02ng2We9S215LtPu3fY0KgaGE0k8WRgl6RkqxtGfl7HUozz1Dftwsb0D/5mZ8dwAaPbtnzfvbEwQ=="
|
||||
},
|
||||
"redux-persist-filesystem-storage": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/redux-persist-filesystem-storage/-/redux-persist-filesystem-storage-1.4.1.tgz",
|
||||
"integrity": "sha512-QDBlRWdFpn4JMrdLZcimwT7d3yc0xkSnA5j9xKWAY2Qw9rd3Uzlt76qXwEuuQ4M3qgKu/nLE8Roazl5BUcxfcA==",
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/redux-persist-filesystem-storage/-/redux-persist-filesystem-storage-2.1.0.tgz",
|
||||
"integrity": "sha512-KFj4opJCu8WXUveNV8YKZ1OMGiQm0kiTjWHSSYJ2hmQNrhEa7MOMiIcTImfNDO3vfRl9U+bidKDhQebtCeWrCw==",
|
||||
"requires": {
|
||||
"rn-fetch-blob": "0.10.15"
|
||||
"rn-fetch-blob": "^0.10.16"
|
||||
},
|
||||
"dependencies": {
|
||||
"glob": {
|
||||
@@ -10290,9 +10323,9 @@
|
||||
}
|
||||
},
|
||||
"rn-fetch-blob": {
|
||||
"version": "0.10.15",
|
||||
"resolved": "https://registry.npmjs.org/rn-fetch-blob/-/rn-fetch-blob-0.10.15.tgz",
|
||||
"integrity": "sha512-/m/gurTaPAvR3J843uehHhznj5k89x7XClyO5ejmbspNLNQ4ByF+kZs80wiiKGWntj+Wqo0jJu1goArXEfc0kA==",
|
||||
"version": "0.10.16",
|
||||
"resolved": "https://registry.npmjs.org/rn-fetch-blob/-/rn-fetch-blob-0.10.16.tgz",
|
||||
"integrity": "sha512-hZV+nF0HK4CWmspXGMw7/G8Q8qugpS/wbKiNLsFpdBZR8XYzjFZNvBWgGyC0F5JWQn3sjmK2w/FJjBlwdQWNQg==",
|
||||
"requires": {
|
||||
"base-64": "0.1.0",
|
||||
"glob": "7.0.6"
|
||||
@@ -10553,6 +10586,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"rn-host-detect": {
|
||||
"version": "1.1.5",
|
||||
"resolved": "https://registry.npmjs.org/rn-host-detect/-/rn-host-detect-1.1.5.tgz",
|
||||
"integrity": "sha512-ufk2dFT3QeP9HyZ/xTuMtW27KnFy815CYitJMqQm+pgG3ZAtHBsrU8nXizNKkqXGy3bQmhEoloVbrfbvMJMqkg==",
|
||||
"dev": true
|
||||
},
|
||||
"rsvp": {
|
||||
"version": "4.8.5",
|
||||
"resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz",
|
||||
|
||||
+8
-6
@@ -12,7 +12,7 @@
|
||||
"base-64": "^0.1.0",
|
||||
"@expo/vector-icons": "^8.1.0",
|
||||
"gfycat-style-urls": "^1.0.3",
|
||||
"lbry-redux": "lbryio/lbry-redux#abe90e0665cfad3fb8853501ec058c5d1f0d9cc8",
|
||||
"lbry-redux": "lbryio/lbry-redux#2c569a729bb40d45249ca38150b00922162b7ce3",
|
||||
"lbryinc": "lbryio/lbryinc#053ca52f4f7f9bf8eb62a3581b183671a475ad1c",
|
||||
"lodash": ">=4.17.11",
|
||||
"merge": ">=1.2.1",
|
||||
@@ -34,14 +34,14 @@
|
||||
"react-native-super-grid": "^3.0.4",
|
||||
"react-native-vector-icons": "^6.6.0",
|
||||
"react-native-video": "lbryio/react-native-video#7992ff945872f9bd00a3736d9ff1318f343abf47",
|
||||
"react-navigation": "^3.11.0",
|
||||
"react-navigation-drawer": "^1.4.0",
|
||||
"react-navigation": "^3.13.0",
|
||||
"react-navigation-drawer": "^2.3.3",
|
||||
"react-navigation-redux-helpers": "^3.0.2",
|
||||
"react-navigation-stack": "^1.8.1",
|
||||
"react-redux": "^5.0.3",
|
||||
"redux": "^4.0.4",
|
||||
"redux-persist": "^5.10.0",
|
||||
"redux-persist-filesystem-storage": "^1.3.2",
|
||||
"redux-persist": "^6.0.0",
|
||||
"redux-persist-filesystem-storage": "^2.1.0",
|
||||
"redux-persist-transform-compress": "^4.2.0",
|
||||
"redux-persist-transform-filter": "0.0.18",
|
||||
"redux-thunk": "^2.3.0",
|
||||
@@ -70,6 +70,8 @@
|
||||
"metro-react-native-babel-preset": "^0.56.0",
|
||||
"prettier": "^1.11.1",
|
||||
"@react-native-community/eslint-config": "^0.0.5",
|
||||
"react-devtools": "^3.6.3"
|
||||
"react-devtools": "^3.6.3",
|
||||
"reactotron-react-native": "4.0.2",
|
||||
"reactotron-redux": "3.1.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import AsyncStorage from '@react-native-community/async-storage';
|
||||
import Reactotron from 'reactotron-react-native';
|
||||
import { reactotronRedux } from 'reactotron-redux';
|
||||
|
||||
const reactotron = Reactotron
|
||||
.setAsyncStorageHandler(AsyncStorage) // AsyncStorage would either come from `react-native` or `@react-native-community/async-storage` depending on where you get it from
|
||||
.configure() // controls connection & communication settings
|
||||
.useReactNative() // add all built-in react native plugins
|
||||
.use(reactotronRedux())
|
||||
.connect();
|
||||
|
||||
export default reactotron;
|
||||
@@ -51,6 +51,7 @@ import {
|
||||
selectHashChanged,
|
||||
selectUser,
|
||||
} from 'lbryinc';
|
||||
import { doStartDownload, doUpdateDownload, doCompleteDownload } from 'redux/actions/file';
|
||||
import { makeSelectClientSetting, selectFullscreenMode } from 'redux/selectors/settings';
|
||||
import { decode as atob } from 'base-64';
|
||||
import { dispatchNavigateBack, dispatchNavigateToUri, transformUrl } from 'utils/helper';
|
||||
@@ -311,6 +312,10 @@ class AppWithNavigationState extends React.Component {
|
||||
this.emailVerifyCheckInterval = setInterval(() => this.checkEmailVerification(), 5000);
|
||||
Linking.addEventListener('url', this._handleUrl);
|
||||
|
||||
DeviceEventEmitter.addListener('onDownloadStarted', this.handleDownloadStarted);
|
||||
DeviceEventEmitter.addListener('onDownloadUpdated', this.handleDownloadUpdated);
|
||||
DeviceEventEmitter.addListener('onDownloadCompleted', this.handleDownloadCompleted);
|
||||
|
||||
// call /sync/get with interval
|
||||
this.syncGetInterval = setInterval(() => {
|
||||
this.setState({ syncHashChanged: false }); // reset local state
|
||||
@@ -345,7 +350,29 @@ class AppWithNavigationState extends React.Component {
|
||||
);
|
||||
};
|
||||
|
||||
handleDownloadStarted = evt => {
|
||||
const { dispatch } = this.props;
|
||||
const { uri, outpoint, fileInfo } = evt;
|
||||
dispatch(doStartDownload(uri, outpoint, fileInfo));
|
||||
};
|
||||
|
||||
handleDownloadUpdated = evt => {
|
||||
const { dispatch } = this.props;
|
||||
const { uri, outpoint, fileInfo, progress } = evt;
|
||||
dispatch(doUpdateDownload(uri, outpoint, fileInfo, progress));
|
||||
};
|
||||
|
||||
handleDownloadCompleted = evt => {
|
||||
const { dispatch } = this.props;
|
||||
const { uri, outpoint, fileInfo } = evt;
|
||||
dispatch(doCompleteDownload(uri, outpoint, fileInfo));
|
||||
};
|
||||
|
||||
componentWillUnmount() {
|
||||
DeviceEventEmitter.removeListener('onDownloadStarted', this.handleDownloadStarted);
|
||||
DeviceEventEmitter.removeListener('onDownloadUpdated', this.handleDownloadUpdated);
|
||||
DeviceEventEmitter.removeListener('onDownloadCompleted', this.handleDownloadCompleted);
|
||||
|
||||
AppState.removeEventListener('change', this._handleAppStateChange);
|
||||
BackHandler.removeEventListener('hardwareBackPress');
|
||||
Linking.removeEventListener('url', this._handleUrl);
|
||||
|
||||
@@ -10,7 +10,7 @@ import discoverStyle from 'styles/discover';
|
||||
const groupedMenuItems = {
|
||||
'Find content': [
|
||||
{ icon: 'hashtag', label: 'Your Tags', route: Constants.DRAWER_ROUTE_DISCOVER },
|
||||
{ icon: 'heart', solid: true, label: 'Subscriptions', route: Constants.DRAWER_ROUTE_SUBSCRIPTIONS },
|
||||
{ icon: 'heart', solid: true, label: 'Following', route: Constants.DRAWER_ROUTE_SUBSCRIPTIONS },
|
||||
{ icon: 'globe-americas', label: 'All Content', route: Constants.DRAWER_ROUTE_TRENDING },
|
||||
],
|
||||
'Your content': [
|
||||
|
||||
@@ -11,11 +11,6 @@ class FileDownloadButton extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
// this.checkAvailability(nextProps.uri);
|
||||
// this.restartDownload(nextProps);
|
||||
}
|
||||
|
||||
restartDownload(props) {
|
||||
const { downloading, fileInfo, uri, restartDownload } = props;
|
||||
|
||||
@@ -35,7 +30,6 @@ class FileDownloadButton extends React.PureComponent {
|
||||
fileInfo,
|
||||
downloading,
|
||||
uri,
|
||||
purchaseUri,
|
||||
costInfo,
|
||||
isPlayable,
|
||||
isViewable,
|
||||
@@ -45,6 +39,7 @@ class FileDownloadButton extends React.PureComponent {
|
||||
doPause,
|
||||
style,
|
||||
openFile,
|
||||
onFileActionPress,
|
||||
onButtonLayout,
|
||||
} = this.props;
|
||||
|
||||
@@ -72,19 +67,7 @@ class FileDownloadButton extends React.PureComponent {
|
||||
text={isPlayable ? __('Play') : isViewable ? __('View') : __('Download')}
|
||||
onLayout={onButtonLayout}
|
||||
style={[style, fileDownloadButtonStyle.container]}
|
||||
onPress={() => {
|
||||
NativeModules.Firebase.track('purchase_uri', { uri: uri });
|
||||
purchaseUri(uri, costInfo, !isPlayable);
|
||||
if (NativeModules.UtilityModule) {
|
||||
NativeModules.UtilityModule.checkDownloads();
|
||||
}
|
||||
if (isPlayable && onPlay) {
|
||||
this.props.onPlay();
|
||||
}
|
||||
if (isViewable && onView) {
|
||||
this.props.onView();
|
||||
}
|
||||
}}
|
||||
onPress={onFileActionPress}
|
||||
/>
|
||||
);
|
||||
} else if (fileInfo && fileInfo.download_path) {
|
||||
|
||||
@@ -36,5 +36,5 @@ const perform = dispatch => ({
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
perform,
|
||||
)(FileListItem);
|
||||
@@ -6,6 +6,7 @@ import Colors from 'styles/colors';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import DateTime from 'component/dateTime';
|
||||
import FileItemMedia from 'component/fileItemMedia';
|
||||
import FilePrice from 'component/filePrice';
|
||||
import Icon from 'react-native-vector-icons/FontAwesome5';
|
||||
import Link from 'component/link';
|
||||
import NsfwOverlay from 'component/nsfwOverlay';
|
||||
@@ -47,8 +48,8 @@ class FileListItem extends React.PureComponent {
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
const { claim, resolveUri, uri } = this.props;
|
||||
if (!claim && uri !== this.state.url) {
|
||||
const { claim, resolveUri, uri, batchResolve } = this.props;
|
||||
if (!claim && uri !== this.state.url && !batchResolve) {
|
||||
this.setState({ url: uri }, () => resolveUri(uri));
|
||||
}
|
||||
}
|
||||
@@ -158,8 +159,15 @@ class FileListItem extends React.PureComponent {
|
||||
</View>
|
||||
)}
|
||||
{fileInfo && fileInfo.completed && fileInfo.download_path && (
|
||||
<Icon style={fileListStyle.downloadedIcon} solid color={Colors.NextLbryGreen} name={'folder'} size={16} />
|
||||
<Icon
|
||||
style={featuredResult ? fileListStyle.featuredDownloadedIcon : fileListStyle.downloadedIcon}
|
||||
solid
|
||||
color={Colors.NextLbryGreen}
|
||||
name={'folder'}
|
||||
size={16}
|
||||
/>
|
||||
)}
|
||||
<FilePrice uri={uri} style={fileListStyle.filePriceContainer} textStyle={fileListStyle.filePriceText} />
|
||||
<View style={fileListStyle.detailsContainer}>
|
||||
{featuredResult && (
|
||||
<Text style={fileListStyle.featuredUri} numberOfLines={1}>
|
||||
@@ -172,7 +180,7 @@ class FileListItem extends React.PureComponent {
|
||||
{!title && !name && <Text style={fileListStyle.uri}>{uri}</Text>}
|
||||
{!title && !name && (
|
||||
<View style={fileListStyle.row}>
|
||||
<ActivityIndicator size={'small'} color={featuredResult ? Colors.White : Colors.LbryGreen} />
|
||||
<ActivityIndicator size={'small'} color={featuredResult ? Colors.White : Colors.NextLbryGreen} />
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
@@ -203,7 +211,7 @@ class FileListItem extends React.PureComponent {
|
||||
normalizeURI(shortChannelUri || fullChannelUri),
|
||||
null,
|
||||
false,
|
||||
fullChannelUri
|
||||
fullChannelUri,
|
||||
);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -1,25 +1,27 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doResolveUris,
|
||||
doSearch,
|
||||
makeSelectClaimForUri,
|
||||
makeSelectRecommendedContentForUri,
|
||||
makeSelectTitleForUri,
|
||||
selectResolvingUris,
|
||||
selectIsSearching,
|
||||
} from 'lbry-redux';
|
||||
import RelatedContent from './view';
|
||||
|
||||
const select = (state, props) => ({
|
||||
claim: makeSelectClaimForUri(props.uri)(state),
|
||||
recommendedContent: makeSelectRecommendedContentForUri(props.uri)(state),
|
||||
title: makeSelectTitleForUri(props.uri)(state),
|
||||
isSearching: selectIsSearching(state),
|
||||
recommendedContent: makeSelectRecommendedContentForUri(props.uri)(state),
|
||||
resolvingUris: selectResolvingUris(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
resolveUris: uris => dispatch(doResolveUris(uris)),
|
||||
searchRecommended: query => dispatch(doSearch(query, 20, undefined, true, false)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
perform,
|
||||
)(RelatedContent);
|
||||
@@ -9,26 +9,53 @@ import relatedContentStyle from 'styles/relatedContent';
|
||||
|
||||
export default class RelatedContent extends React.PureComponent {
|
||||
state = {
|
||||
urlsResolved: false,
|
||||
resolveStarted: false,
|
||||
};
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
const { resolveUris, recommendedContent } = this.props;
|
||||
componentDidMount() {
|
||||
const { title, searchRecommended } = this.props;
|
||||
if (title) {
|
||||
searchRecommended(title);
|
||||
}
|
||||
}
|
||||
|
||||
if (recommendedContent && recommendedContent.length > 0 && !this.state.urisResolved) {
|
||||
this.setState({ urisResolved: true }, () => {
|
||||
// batch resolve the uris
|
||||
resolveUris(recommendedContent);
|
||||
shouldComponentUpdate(nextProps, nextState) {
|
||||
const { isSearching, recommendedContent } = nextProps;
|
||||
return isSearching || (!isSearching && this.allContentResolved());
|
||||
}
|
||||
|
||||
allContentResolved() {
|
||||
const { recommendedContent, resolvingUris } = this.props;
|
||||
if (recommendedContent) {
|
||||
let allResolved = true;
|
||||
recommendedContent.forEach(uri => {
|
||||
allResolved = allResolved && !resolvingUris.includes(uri);
|
||||
});
|
||||
return allResolved;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
const { isSearching, resolveUris, recommendedContent } = this.props;
|
||||
if (!isSearching && !this.state.resolveStarted) {
|
||||
this.setState({ resolveStarted: true }, () => {
|
||||
if (recommendedContent && recommendedContent.length > 0) {
|
||||
// batch resolve the uris
|
||||
resolveUris(recommendedContent);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { recommendedContent, navigation, uri, fullUri } = this.props;
|
||||
const { isSearching, recommendedContent, navigation, uri, fullUri } = this.props;
|
||||
|
||||
return (
|
||||
<View style={relatedContentStyle.container}>
|
||||
<Text style={relatedContentStyle.title}>{__('Related Content')}</Text>
|
||||
{isSearching && <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />}
|
||||
{recommendedContent &&
|
||||
recommendedContent
|
||||
.filter(recommendedUri => recommendedUri !== normalizeURI(fullUri))
|
||||
|
||||
@@ -46,7 +46,7 @@ class UriBar extends React.PureComponent {
|
||||
const { currentRoute: prevRoute } = this.props;
|
||||
|
||||
if (Constants.DRAWER_ROUTE_SEARCH === currentRoute && currentRoute !== prevRoute) {
|
||||
this.setState({ currentValue: query, inputText: query });
|
||||
this.setState({ currentValue: query, inputText: query }, () => this.setCaretPosition(query));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,9 @@ class UriBar extends React.PureComponent {
|
||||
}
|
||||
}, UriBar.INPUT_TIMEOUT);
|
||||
}
|
||||
this.setState({ inputText: newValue, currentValue: newValue, changeTextTimeout: timeout });
|
||||
this.setState({ inputText: newValue, currentValue: newValue, changeTextTimeout: timeout }, () =>
|
||||
this.setCaretPosition(newValue),
|
||||
);
|
||||
};
|
||||
|
||||
handleItemPress = item => {
|
||||
@@ -85,7 +87,7 @@ class UriBar extends React.PureComponent {
|
||||
Keyboard.dismiss();
|
||||
|
||||
if (SEARCH_TYPES.SEARCH === type) {
|
||||
this.setState({ currentValue: value });
|
||||
this.setState({ currentValue: value }, () => this.setCaretPosition(value));
|
||||
updateSearchQuery(value);
|
||||
|
||||
if (onSearchSubmitted) {
|
||||
@@ -129,6 +131,12 @@ class UriBar extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
setCaretPosition(text) {
|
||||
if (this.textInput && text && text.length > 0) {
|
||||
this.textInput.setNativeProps({ selection: { start: text.length, end: text.length } });
|
||||
}
|
||||
}
|
||||
|
||||
handleSubmitEditing = () => {
|
||||
const { navigation, onSearchSubmitted, updateSearchQuery } = this.props;
|
||||
if (this.state.inputText) {
|
||||
@@ -179,7 +187,7 @@ class UriBar extends React.PureComponent {
|
||||
value,
|
||||
} = this.props;
|
||||
if (this.state.currentValue === null) {
|
||||
this.setState({ currentValue: value });
|
||||
this.setState({ currentValue: value }, () => this.setCaretPosition(value));
|
||||
}
|
||||
|
||||
let style = [
|
||||
@@ -253,7 +261,9 @@ class UriBar extends React.PureComponent {
|
||||
autoCorrect={false}
|
||||
style={uriBarStyle.uriText}
|
||||
onLayout={() => {
|
||||
this.setSelection();
|
||||
if (!this.state.focused) {
|
||||
this.setSelection();
|
||||
}
|
||||
}}
|
||||
selectTextOnFocus
|
||||
placeholder={__('Search movies, music, and more')}
|
||||
|
||||
@@ -38,9 +38,10 @@ class WalletSend extends React.PureComponent<Props> {
|
||||
handleSend = () => {
|
||||
const { balance, sendToAddress, notify } = this.props;
|
||||
const { address, amount } = this.state;
|
||||
if (address && !regexAddress.test(address)) {
|
||||
if (address && (!regexAddress.test(address) || address.substring(0, 1) === 'r')) {
|
||||
notify({
|
||||
message: __('The recipient address is not a valid LBRY address.'),
|
||||
isError: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -48,6 +49,7 @@ class WalletSend extends React.PureComponent<Props> {
|
||||
if (amount > balance) {
|
||||
notify({
|
||||
message: __('Insufficient credits'),
|
||||
isError: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -72,6 +74,7 @@ class WalletSend extends React.PureComponent<Props> {
|
||||
const { notify } = this.props;
|
||||
notify({
|
||||
message: __('The recipient address is not a valid LBRY address.'),
|
||||
isError: true,
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -97,9 +100,10 @@ class WalletSend extends React.PureComponent<Props> {
|
||||
this.setState({
|
||||
address: value,
|
||||
addressChanged: true,
|
||||
addressValid: value.trim().length === 0 || regexAddress.test(value),
|
||||
addressValid: value.trim().length === 0 || (regexAddress.test(value) && !value.startsWith('r')),
|
||||
})
|
||||
}
|
||||
numberOfLines={1}
|
||||
onBlur={this.handleAddressInputBlur}
|
||||
onSubmitEditing={this.handleAddressInputSubmit}
|
||||
placeholder={'bbFxRyXXXXXXXXXXXZD8nE7XTLUxYnddTs'}
|
||||
|
||||
+3
-2
@@ -52,8 +52,9 @@ function checkMessageAndSave(message, messagesFilePath) {
|
||||
); */
|
||||
})
|
||||
.catch(err => {
|
||||
if (err) {
|
||||
throw err;
|
||||
if (err && !isProduction) {
|
||||
// only do this when not in production
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+4
-3
@@ -42,6 +42,7 @@ import AppWithNavigationState, {
|
||||
} from 'component/AppNavigator';
|
||||
import { REHYDRATE, PURGE, persistCombineReducers, persistStore } from 'redux-persist';
|
||||
import { __ } from 'i18n';
|
||||
import reactotron from '../reactotron';
|
||||
import Constants from 'constants'; // eslint-disable-line node/no-deprecated-api
|
||||
import getStoredStateMigrateV4 from 'redux-persist/lib/integration/getStoredStateMigrateV4';
|
||||
import FilesystemStorage from 'redux-persist-filesystem-storage';
|
||||
@@ -57,7 +58,7 @@ window.__ = __;
|
||||
|
||||
const globalExceptionHandler = (error, isFatal) => {
|
||||
if (error && NativeModules.Firebase) {
|
||||
NativeModules.Firebase.logException(isFatal, error.message ? error.message : 'No message', JSON.stringify(error));
|
||||
NativeModules.Firebase.logException(!!isFatal, error.message ? error.message : 'No message', JSON.stringify(error));
|
||||
}
|
||||
};
|
||||
setJSExceptionHandler(globalExceptionHandler, true);
|
||||
@@ -179,7 +180,7 @@ const sharedStateCallback = ({ dispatch, getState }) => {
|
||||
const emailVerified = selectUserVerifiedEmail(state);
|
||||
if (syncEnabled && emailVerified) {
|
||||
NativeModules.UtilityModule.getSecureValue(Constants.KEY_WALLET_PASSWORD).then(password =>
|
||||
dispatch(doGetSync(password))
|
||||
dispatch(doGetSync(password)),
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -195,7 +196,7 @@ const composeEnhancers = compose;
|
||||
const store = createStore(
|
||||
enableBatching(reducers),
|
||||
{}, // initial state,
|
||||
composeEnhancers(applyMiddleware(...middleware))
|
||||
composeEnhancers(applyMiddleware(...middleware), reactotron.createEnhancer()),
|
||||
);
|
||||
window.store = store;
|
||||
|
||||
|
||||
+4
-15
@@ -8,7 +8,7 @@ import {
|
||||
doPurchaseUri,
|
||||
doDeletePurchasedUri,
|
||||
doResolveUri,
|
||||
doSearch,
|
||||
doResolveUris,
|
||||
doSendTip,
|
||||
doToast,
|
||||
makeSelectIsUriResolving,
|
||||
@@ -18,7 +18,6 @@ import {
|
||||
makeSelectContentPositionForUri,
|
||||
makeSelectContentTypeForUri,
|
||||
makeSelectMetadataForUri,
|
||||
makeSelectRecommendedContentForUri,
|
||||
makeSelectStreamingUrlForUri,
|
||||
makeSelectThumbnailForUri,
|
||||
makeSelectTitleForUri,
|
||||
@@ -39,13 +38,7 @@ import {
|
||||
selectRewardContentClaimIds,
|
||||
selectBlackListedOutpoints,
|
||||
} from 'lbryinc';
|
||||
import {
|
||||
doStartDownload,
|
||||
doUpdateDownload,
|
||||
doCompleteDownload,
|
||||
doDeleteFile,
|
||||
doStopDownloadingFile,
|
||||
} from 'redux/actions/file';
|
||||
import { doDeleteFile, doStopDownloadingFile } from 'redux/actions/file';
|
||||
import { doPushDrawerStack, doPopDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import { doToggleFullscreenMode } from 'redux/actions/settings';
|
||||
import { selectDrawerStack } from 'redux/selectors/drawer';
|
||||
@@ -76,7 +69,6 @@ const select = (state, props) => {
|
||||
streamingUrl: makeSelectStreamingUrlForUri(contentUri)(state),
|
||||
thumbnail: makeSelectThumbnailForUri(contentUri)(state),
|
||||
title: makeSelectTitleForUri(contentUri)(state),
|
||||
recommendedContent: makeSelectRecommendedContentForUri(contentUri)(state),
|
||||
isSearchingRecommendContent: selectIsSearching(state),
|
||||
viewCount: makeSelectViewCountForUri(contentUri)(state),
|
||||
};
|
||||
@@ -100,18 +92,15 @@ const perform = dispatch => ({
|
||||
purchaseUri: (uri, costInfo, saveFile) => dispatch(doPurchaseUri(uri, costInfo, saveFile)),
|
||||
deletePurchasedUri: uri => dispatch(doDeletePurchasedUri(uri)),
|
||||
resolveUri: uri => dispatch(doResolveUri(uri)),
|
||||
searchRecommended: query => dispatch(doSearch(query, 20, undefined, true)),
|
||||
resolveUris: uris => dispatch(doResolveUris(uris)),
|
||||
sendTip: (amount, claimId, isSupport, successCallback, errorCallback) =>
|
||||
dispatch(doSendTip(amount, claimId, isSupport, successCallback, errorCallback)),
|
||||
setPlayerVisible: () => dispatch(doSetPlayerVisible(true)),
|
||||
stopDownload: (uri, fileInfo) => dispatch(doStopDownloadingFile(uri, fileInfo)),
|
||||
startDownload: (uri, outpoint, fileInfo) => dispatch(doStartDownload(uri, outpoint, fileInfo)),
|
||||
updateDownload: (uri, outpoint, fileInfo, progress) => dispatch(doUpdateDownload(uri, outpoint, fileInfo, progress)),
|
||||
completeDownload: (uri, outpoint, fileInfo) => dispatch(doCompleteDownload(uri, outpoint, fileInfo)),
|
||||
toggleFullscreenMode: mode => dispatch(doToggleFullscreenMode(mode)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
perform,
|
||||
)(FilePage);
|
||||
+390
-329
@@ -72,6 +72,7 @@ class FilePage extends React.PureComponent {
|
||||
fileViewLogged: false,
|
||||
fullscreenMode: false,
|
||||
fileGetStarted: false,
|
||||
hasCheckedAllResolved: false,
|
||||
imageUrls: null,
|
||||
isLandscape: false,
|
||||
mediaLoaded: false,
|
||||
@@ -86,6 +87,7 @@ class FilePage extends React.PureComponent {
|
||||
playerHeight: 0,
|
||||
uri: null,
|
||||
uriVars: null,
|
||||
showRecommended: false,
|
||||
stopDownloadConfirmed: false,
|
||||
streamingMode: false,
|
||||
viewCountFetched: false,
|
||||
@@ -101,29 +103,24 @@ class FilePage extends React.PureComponent {
|
||||
|
||||
onComponentFocused = () => {
|
||||
StatusBar.setHidden(false);
|
||||
NativeModules.Firebase.setCurrentScreen('File');
|
||||
NativeModules.Firebase.setCurrentScreen('File').then(result => {
|
||||
DeviceEventEmitter.addListener('onStoragePermissionGranted', this.handleStoragePermissionGranted);
|
||||
DeviceEventEmitter.addListener('onStoragePermissionRefused', this.handleStoragePermissionRefused);
|
||||
|
||||
DeviceEventEmitter.addListener('onDownloadStarted', this.handleDownloadStarted);
|
||||
DeviceEventEmitter.addListener('onDownloadUpdated', this.handleDownloadUpdated);
|
||||
DeviceEventEmitter.addListener('onDownloadCompleted', this.handleDownloadCompleted);
|
||||
const { claim, fetchMyClaims, fileInfo, isResolvingUri, resolveUri, navigation } = this.props;
|
||||
const { uri, uriVars } = navigation.state.params;
|
||||
this.setState({ uri, uriVars });
|
||||
|
||||
const { fetchMyClaims, fileInfo, isResolvingUri, resolveUri, navigation } = this.props;
|
||||
const { uri, uriVars } = navigation.state.params;
|
||||
this.setState({ uri, uriVars });
|
||||
if (!isResolvingUri && !claim) resolveUri(uri);
|
||||
|
||||
if (!isResolvingUri) resolveUri(uri);
|
||||
this.fetchFileInfo(uri, this.props);
|
||||
this.fetchCostInfo(uri, this.props);
|
||||
|
||||
this.fetchFileInfo(this.props);
|
||||
this.fetchCostInfo(this.props);
|
||||
fetchMyClaims();
|
||||
|
||||
fetchMyClaims();
|
||||
|
||||
if (NativeModules.Firebase) {
|
||||
NativeModules.Firebase.track('open_file_page', { uri: uri });
|
||||
}
|
||||
if (NativeModules.UtilityModule) {
|
||||
NativeModules.UtilityModule.keepAwakeOn();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
@@ -151,6 +148,7 @@ class FilePage extends React.PureComponent {
|
||||
navigation,
|
||||
contentType,
|
||||
notify,
|
||||
recommendedContent: prevRecommendedContent,
|
||||
drawerStack: prevDrawerStack,
|
||||
} = this.props;
|
||||
const { uri } = navigation.state.params;
|
||||
@@ -162,6 +160,8 @@ class FilePage extends React.PureComponent {
|
||||
purchaseUriErrorMessage,
|
||||
streamingUrl,
|
||||
drawerStack,
|
||||
recommendedContent,
|
||||
resolveUris,
|
||||
} = nextProps;
|
||||
|
||||
if (Constants.ROUTE_FILE === currentRoute && currentRoute !== prevRoute) {
|
||||
@@ -177,11 +177,9 @@ class FilePage extends React.PureComponent {
|
||||
|
||||
const mediaType = Lbry.getMediaType(contentType);
|
||||
const isPlayable = mediaType === 'video' || mediaType === 'audio';
|
||||
if (
|
||||
(this.state.fileGetStarted || prevPurchasedUris.length !== purchasedUris.length) &&
|
||||
NativeModules.UtilityModule
|
||||
) {
|
||||
if (purchasedUris.includes(uri)) {
|
||||
if (this.state.fileGetStarted || prevPurchasedUris.length !== purchasedUris.length) {
|
||||
const { permanent_url: permanentUrl } = claim;
|
||||
if (purchasedUris.includes(uri) || purchasedUris.includes(permanentUrl)) {
|
||||
const { nout, txid } = claim;
|
||||
const outpoint = `${txid}:${nout}`;
|
||||
NativeModules.UtilityModule.queueDownload(outpoint);
|
||||
@@ -216,9 +214,23 @@ class FilePage extends React.PureComponent {
|
||||
if (claim && !this.state.viewCountFetched) {
|
||||
this.setState({ viewCountFetched: true }, () => fetchViewCount(claim.claim_id));
|
||||
}
|
||||
|
||||
if (
|
||||
(!prevRecommendedContent && recommendedContent) ||
|
||||
(recommendedContent && prevRecommendedContent && recommendedContent.length !== prevRecommendedContent.length)
|
||||
) {
|
||||
resolveUris(recommendedContent);
|
||||
}
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
shouldComponentUpdate(nextProps, nextState) {
|
||||
return (
|
||||
Object.keys(this.difference(nextProps, this.props)).length > 0 ||
|
||||
Object.keys(this.difference(nextState, this.state)).length > 0
|
||||
);
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps, prevState) {
|
||||
const {
|
||||
claim,
|
||||
contentType,
|
||||
@@ -228,7 +240,6 @@ class FilePage extends React.PureComponent {
|
||||
resolveUri,
|
||||
navigation,
|
||||
purchaseUri,
|
||||
searchRecommended,
|
||||
title,
|
||||
} = this.props;
|
||||
const { uri } = this.state;
|
||||
@@ -236,10 +247,6 @@ class FilePage extends React.PureComponent {
|
||||
resolveUri(uri);
|
||||
}
|
||||
|
||||
if (title && !this.state.didSearchRecommended) {
|
||||
this.setState({ didSearchRecommended: true }, () => searchRecommended(title));
|
||||
}
|
||||
|
||||
// Returned to the page. If mediaLoaded, and currentMediaInfo is different, update
|
||||
if (this.state.mediaLoaded && window.currentMediaInfo && window.currentMediaInfo.uri !== this.state.uri) {
|
||||
const { metadata } = this.props;
|
||||
@@ -252,29 +259,26 @@ class FilePage extends React.PureComponent {
|
||||
|
||||
// attempt to retrieve images and html/text automatically once the claim is loaded, and it's free
|
||||
const mediaType = Lbry.getMediaType(contentType);
|
||||
const isPlayable = mediaType === 'video' || mediaType === 'audio';
|
||||
const isViewable = mediaType === 'image' || mediaType === 'text';
|
||||
if (claim && costInfo && costInfo.cost === 0 && !this.state.autoGetAttempted && isViewable) {
|
||||
this.setState(
|
||||
{
|
||||
autoGetAttempted: true,
|
||||
downloadPressed: true,
|
||||
autoPlayMedia: true,
|
||||
stopDownloadConfirmed: false,
|
||||
},
|
||||
() => purchaseUri(claim.permanent_url, costInfo, true)
|
||||
);
|
||||
this.setState({ autoGetAttempted: true }, () => this.checkStoragePermissionForDownload());
|
||||
}
|
||||
|
||||
if (((costInfo && costInfo.cost > 0) || !isPlayable) && !this.state.showRecommended) {
|
||||
this.setState({ showRecommended: true });
|
||||
}
|
||||
}
|
||||
|
||||
fetchFileInfo(props) {
|
||||
fetchFileInfo(uri, props) {
|
||||
if (props.fileInfo === undefined) {
|
||||
props.fetchFileInfo(props.navigation.state.params.uri);
|
||||
props.fetchFileInfo(uri);
|
||||
}
|
||||
}
|
||||
|
||||
fetchCostInfo(props) {
|
||||
fetchCostInfo(uri, props) {
|
||||
if (props.costInfo === undefined) {
|
||||
props.fetchCostInfo(props.navigation.state.params.uri);
|
||||
props.fetchCostInfo(uri);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,12 +313,12 @@ class FilePage extends React.PureComponent {
|
||||
const { abandonClaim, claim, deleteFile, deletePurchasedUri, myClaimUris, fileInfo, navigation } = this.props;
|
||||
|
||||
Alert.alert(
|
||||
'Delete file',
|
||||
'Are you sure you want to remove this file from your device?',
|
||||
__('Delete file'),
|
||||
__('Are you sure you want to remove this file from your device?'),
|
||||
[
|
||||
{ text: 'No' },
|
||||
{ text: __('No') },
|
||||
{
|
||||
text: 'Yes',
|
||||
text: __('Yes'),
|
||||
onPress: () => {
|
||||
const { uri } = navigation.state.params;
|
||||
|
||||
@@ -341,7 +345,7 @@ class FilePage extends React.PureComponent {
|
||||
},
|
||||
},
|
||||
],
|
||||
{ cancelable: true }
|
||||
{ cancelable: true },
|
||||
);
|
||||
};
|
||||
|
||||
@@ -377,7 +381,7 @@ class FilePage extends React.PureComponent {
|
||||
},
|
||||
},
|
||||
],
|
||||
{ cancelable: true }
|
||||
{ cancelable: true },
|
||||
);
|
||||
};
|
||||
|
||||
@@ -399,27 +403,34 @@ class FilePage extends React.PureComponent {
|
||||
}
|
||||
window.player = null;
|
||||
|
||||
DeviceEventEmitter.removeListener('onDownloadStarted', this.handleDownloadStarted);
|
||||
DeviceEventEmitter.removeListener('onDownloadUpdated', this.handleDownloadUpdated);
|
||||
DeviceEventEmitter.removeListener('onDownloadCompleted', this.handleDownloadCompleted);
|
||||
DeviceEventEmitter.removeListener('onStoragePermissionGranted', this.handleStoragePermissionGranted);
|
||||
DeviceEventEmitter.removeListener('onStoragePermissionRefused', this.handleStoragePermissionRefused);
|
||||
}
|
||||
|
||||
handleDownloadStarted = evt => {
|
||||
const { startDownload } = this.props;
|
||||
const { uri, outpoint, fileInfo } = evt;
|
||||
startDownload(uri, outpoint, fileInfo);
|
||||
handleStoragePermissionGranted = () => {
|
||||
// permission was allowed. proceed to download
|
||||
const { notify } = this.props;
|
||||
|
||||
// update the configured download folder and then download
|
||||
NativeModules.UtilityModule.getDownloadDirectory().then(downloadDirectory => {
|
||||
Lbry.settings_set({
|
||||
key: 'download_dir',
|
||||
value: downloadDirectory,
|
||||
})
|
||||
.then(() => this.performDownload())
|
||||
.catch(() => {
|
||||
notify({ message: 'The file could not be downloaded to the default download directory.', isError: true });
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
handleDownloadUpdated = evt => {
|
||||
const { updateDownload } = this.props;
|
||||
const { uri, outpoint, fileInfo, progress } = evt;
|
||||
updateDownload(uri, outpoint, fileInfo, progress);
|
||||
};
|
||||
|
||||
handleDownloadCompleted = evt => {
|
||||
const { completeDownload } = this.props;
|
||||
const { uri, outpoint, fileInfo } = evt;
|
||||
completeDownload(uri, outpoint, fileInfo);
|
||||
handleStoragePermissionRefused = () => {
|
||||
const { notify } = this.props;
|
||||
this.setState({ downloadPressed: false });
|
||||
notify({
|
||||
message: __('The file could not be downloaded because the permission to write to storage was not granted.'),
|
||||
isError: true,
|
||||
});
|
||||
};
|
||||
|
||||
localUriForFileInfo = fileInfo => {
|
||||
@@ -536,6 +547,9 @@ class FilePage extends React.PureComponent {
|
||||
payload['time_to_start_ms'] = timeToStartMillis;
|
||||
}
|
||||
NativeModules.Firebase.track('play', payload);
|
||||
|
||||
// only fetch recommended content after playback has started
|
||||
this.setState({ showRecommended: true });
|
||||
};
|
||||
|
||||
onPlaybackFinished = () => {
|
||||
@@ -589,14 +603,80 @@ class FilePage extends React.PureComponent {
|
||||
));
|
||||
};
|
||||
|
||||
onFileDownloadButtonPlayed = () => {
|
||||
const { setPlayerVisible } = this.props;
|
||||
this.startTime = Date.now();
|
||||
this.setState({ downloadPressed: true, autoPlayMedia: true, stopDownloadConfirmed: false });
|
||||
setPlayerVisible();
|
||||
confirmPurchaseUri = (uri, costInfo, download) => {
|
||||
const { notify, purchaseUri, title } = this.props;
|
||||
const { cost } = costInfo;
|
||||
|
||||
if (!costInfo) {
|
||||
notify({ message: __('This content cannot be viewed at this time. Please try again in a bit.'), isError: true });
|
||||
return;
|
||||
}
|
||||
|
||||
if (costInfo.cost > 0) {
|
||||
Alert.alert(
|
||||
__('Confirm Purchase'),
|
||||
__(
|
||||
cost === 1
|
||||
? 'This will purchase "%title%" for %amount% credit'
|
||||
: 'This will purchase "%title%" for %amount% credits',
|
||||
{ title, amount: cost },
|
||||
),
|
||||
[
|
||||
{
|
||||
text: __('OK'),
|
||||
onPress: () => purchaseUri(uri, costInfo, download),
|
||||
},
|
||||
{ text: __('Cancel') },
|
||||
],
|
||||
);
|
||||
} else {
|
||||
// Free content. Just call purchaseUri directly.
|
||||
purchaseUri(uri, costInfo, download);
|
||||
}
|
||||
};
|
||||
|
||||
onFileDownloadButtonPressed = () => {
|
||||
const { claim, costInfo, contentType, purchaseUri, setPlayerVisible } = this.props;
|
||||
const mediaType = Lbry.getMediaType(contentType);
|
||||
const isPlayable = mediaType === 'video' || mediaType === 'audio';
|
||||
const isViewable = mediaType === 'image' || mediaType === 'text';
|
||||
|
||||
const { permanent_url: uri } = claim;
|
||||
NativeModules.Firebase.track('purchase_uri', { uri: uri });
|
||||
|
||||
if (!isPlayable) {
|
||||
this.checkStoragePermissionForDownload();
|
||||
} else {
|
||||
this.confirmPurchaseUri(uri, costInfo, !isPlayable);
|
||||
}
|
||||
|
||||
if (isPlayable) {
|
||||
this.startTime = Date.now();
|
||||
this.setState({ downloadPressed: true, autoPlayMedia: true, stopDownloadConfirmed: false });
|
||||
setPlayerVisible();
|
||||
}
|
||||
if (isViewable) {
|
||||
this.setState({ downloadPressed: true });
|
||||
}
|
||||
};
|
||||
|
||||
onDownloadPressed = () => {
|
||||
this.checkStoragePermissionForDownload();
|
||||
};
|
||||
|
||||
checkStoragePermissionForDownload = () => {
|
||||
// check if we the permission to write to external storage has been granted
|
||||
NativeModules.UtilityModule.canReadWriteStorage().then(canReadWrite => {
|
||||
if (!canReadWrite) {
|
||||
// request permission
|
||||
NativeModules.UtilityModule.requestStoragePermission();
|
||||
} else {
|
||||
this.performDownload();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
performDownload = () => {
|
||||
const { claim, costInfo, purchaseUri } = this.props;
|
||||
this.setState(
|
||||
{
|
||||
@@ -604,7 +684,10 @@ class FilePage extends React.PureComponent {
|
||||
autoPlayMedia: false,
|
||||
stopDownloadConfirmed: false,
|
||||
},
|
||||
() => purchaseUri(claim.permanent_url, costInfo, true)
|
||||
() => {
|
||||
this.confirmPurchaseUri(claim.permanent_url, costInfo, true);
|
||||
NativeModules.UtilityModule.checkDownloads();
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
@@ -621,14 +704,7 @@ class FilePage extends React.PureComponent {
|
||||
// file already in library or URI already purchased, use fileGet directly
|
||||
this.setState({ fileGetStarted: true }, () => fileGet(uri, true));
|
||||
} else {
|
||||
this.setState(
|
||||
{
|
||||
downloadPressed: true,
|
||||
autoPlayMedia: false,
|
||||
stopDownloadConfirmed: false,
|
||||
},
|
||||
() => purchaseUri(uri, costInfo, true)
|
||||
);
|
||||
this.checkStoragePermissionForDownload();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -648,7 +724,7 @@ class FilePage extends React.PureComponent {
|
||||
],
|
||||
showImageViewer: true,
|
||||
},
|
||||
() => pushDrawerStack(Constants.DRAWER_ROUTE_FILE_VIEW)
|
||||
() => pushDrawerStack(Constants.DRAWER_ROUTE_FILE_VIEW),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -659,23 +735,12 @@ class FilePage extends React.PureComponent {
|
||||
{
|
||||
showWebView: true,
|
||||
},
|
||||
() => pushDrawerStack(Constants.DRAWER_ROUTE_FILE_VIEW)
|
||||
() => pushDrawerStack(Constants.DRAWER_ROUTE_FILE_VIEW),
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
onMediaContainerPressed = () => {
|
||||
const { costInfo, contentType, purchaseUri } = this.props;
|
||||
const { uri } = this.state;
|
||||
const mediaType = Lbry.getMediaType(contentType);
|
||||
const isPlayable = mediaType === 'video' || mediaType === 'audio';
|
||||
purchaseUri(uri, costInfo, isPlayable);
|
||||
if (isPlayable) {
|
||||
this.onFileDownloadButtonPlayed();
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
const {
|
||||
balance,
|
||||
@@ -710,7 +775,7 @@ class FilePage extends React.PureComponent {
|
||||
let innerContent = null;
|
||||
if ((isResolvingUri && !claim) || !claim) {
|
||||
return (
|
||||
<View style={filePageStyle.container}>
|
||||
<View style={filePageStyle.pageContainer}>
|
||||
<UriBar value={uri} navigation={navigation} />
|
||||
{isResolvingUri && (
|
||||
<View style={filePageStyle.busyContainer}>
|
||||
@@ -748,232 +813,233 @@ class FilePage extends React.PureComponent {
|
||||
);
|
||||
}
|
||||
|
||||
if (claim) {
|
||||
if (isChannel) {
|
||||
return <ChannelPage uri={uri} navigation={navigation} />;
|
||||
}
|
||||
|
||||
let isClaimBlackListed = false;
|
||||
|
||||
if (blackListedOutpoints) {
|
||||
for (let i = 0; i < blackListedOutpoints.length; i += 1) {
|
||||
const outpoint = blackListedOutpoints[i];
|
||||
if (outpoint.txid === claim.txid && outpoint.nout === claim.nout) {
|
||||
isClaimBlackListed = true;
|
||||
break;
|
||||
}
|
||||
let isClaimBlackListed = false;
|
||||
if (blackListedOutpoints) {
|
||||
for (let i = 0; i < blackListedOutpoints.length; i += 1) {
|
||||
const outpoint = blackListedOutpoints[i];
|
||||
if (outpoint.txid === claim.txid && outpoint.nout === claim.nout) {
|
||||
isClaimBlackListed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isClaimBlackListed) {
|
||||
return (
|
||||
<View style={filePageStyle.pageContainer}>
|
||||
<View style={filePageStyle.dmcaContainer}>
|
||||
<Text style={filePageStyle.dmcaText}>
|
||||
{__(
|
||||
'In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.'
|
||||
)}
|
||||
</Text>
|
||||
<Link style={filePageStyle.dmcaLink} href="https://lbry.com/faq/dmca" text={__('Read More')} />
|
||||
</View>
|
||||
<UriBar value={uri} navigation={navigation} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
if (isClaimBlackListed) {
|
||||
innerContent = (
|
||||
<View style={filePageStyle.dmcaContainer}>
|
||||
<Text style={filePageStyle.dmcaText}>
|
||||
{__(
|
||||
'In response to a complaint we received under the US Digital Millennium Copyright Act, we have blocked access to this content from our applications.',
|
||||
)}
|
||||
</Text>
|
||||
<Link style={filePageStyle.dmcaLink} href="https://lbry.com/faq/dmca" text={__('Read More')} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
let tags = [];
|
||||
if (claim && claim.value && claim.value.tags) {
|
||||
tags = claim.value.tags;
|
||||
}
|
||||
let tags = [];
|
||||
if (claim && claim.value && claim.value.tags) {
|
||||
tags = claim.value.tags;
|
||||
}
|
||||
|
||||
const completed = fileInfo && fileInfo.completed;
|
||||
const isRewardContent = rewardedContentClaimIds.includes(claim.claim_id);
|
||||
const description = metadata.description ? metadata.description : null;
|
||||
const mediaType = Lbry.getMediaType(contentType);
|
||||
const isPlayable = mediaType === 'video' || mediaType === 'audio';
|
||||
const isWebViewable = mediaType === 'text';
|
||||
const { height, signing_channel: signingChannel, value } = claim;
|
||||
const channelName = signingChannel && signingChannel.name;
|
||||
const channelClaimId = claim && claim.signing_channel && claim.signing_channel.claim_id;
|
||||
const fullUri = `${claim.name}#${claim.claim_id}`;
|
||||
const canEdit = myClaimUris.includes(normalizeURI(fullUri));
|
||||
const showActions =
|
||||
(canEdit || (fileInfo && fileInfo.download_path)) &&
|
||||
!this.state.fullscreenMode &&
|
||||
!this.state.showImageViewer &&
|
||||
!this.state.showWebView;
|
||||
const showFileActions =
|
||||
canEdit ||
|
||||
(fileInfo &&
|
||||
fileInfo.download_path &&
|
||||
(completed || (fileInfo && !fileInfo.stopped && fileInfo.written_bytes < fileInfo.total_bytes)));
|
||||
const fullChannelUri =
|
||||
channelClaimId && channelClaimId.trim().length > 0
|
||||
? normalizeURI(`${channelName}#${channelClaimId}`)
|
||||
: normalizeURI(channelName);
|
||||
const shortChannelUri = signingChannel ? signingChannel.short_url : null;
|
||||
const completed = fileInfo && fileInfo.completed;
|
||||
const isRewardContent = rewardedContentClaimIds.includes(claim.claim_id);
|
||||
const description = metadata.description ? metadata.description : null;
|
||||
const mediaType = Lbry.getMediaType(contentType);
|
||||
const isPlayable = mediaType === 'video' || mediaType === 'audio';
|
||||
const isWebViewable = mediaType === 'text';
|
||||
const { height, signing_channel: signingChannel, value } = claim;
|
||||
const channelName = signingChannel && signingChannel.name;
|
||||
const channelClaimId = claim && claim.signing_channel && claim.signing_channel.claim_id;
|
||||
const fullUri = `${claim.name}#${claim.claim_id}`;
|
||||
const canEdit = myClaimUris.includes(normalizeURI(fullUri));
|
||||
const showActions =
|
||||
(canEdit || (fileInfo && fileInfo.download_path)) &&
|
||||
!this.state.fullscreenMode &&
|
||||
!this.state.showImageViewer &&
|
||||
!this.state.showWebView;
|
||||
const showFileActions =
|
||||
canEdit ||
|
||||
(fileInfo &&
|
||||
fileInfo.download_path &&
|
||||
(completed || (fileInfo && !fileInfo.stopped && fileInfo.written_bytes < fileInfo.total_bytes)));
|
||||
const fullChannelUri =
|
||||
channelClaimId && channelClaimId.trim().length > 0
|
||||
? normalizeURI(`${channelName}#${channelClaimId}`)
|
||||
: normalizeURI(channelName);
|
||||
const shortChannelUri = signingChannel ? signingChannel.short_url : null;
|
||||
|
||||
const playerStyle = [
|
||||
filePageStyle.player,
|
||||
this.state.isLandscape
|
||||
? filePageStyle.containedPlayerLandscape
|
||||
: this.state.fullscreenMode
|
||||
? filePageStyle.fullscreenPlayer
|
||||
: filePageStyle.containedPlayer,
|
||||
];
|
||||
const playerBgStyle = [filePageStyle.playerBackground, filePageStyle.containedPlayerBackground];
|
||||
const fsPlayerBgStyle = [filePageStyle.playerBackground, filePageStyle.fullscreenPlayerBackground];
|
||||
// at least 2MB (or the full download) before media can be loaded
|
||||
const canLoadMedia =
|
||||
this.state.streamingMode ||
|
||||
(fileInfo && (fileInfo.written_bytes >= 2097152 || fileInfo.written_bytes === fileInfo.total_bytes)); // 2MB = 1024*1024*2
|
||||
const duration = claim && claim.value && claim.value.video ? claim.value.video.duration : null;
|
||||
const isViewable = mediaType === 'image' || mediaType === 'text';
|
||||
const canOpen = isViewable && completed;
|
||||
const localFileUri = this.localUriForFileInfo(fileInfo);
|
||||
const unsupported = !isPlayable && !canOpen;
|
||||
const playerStyle = [
|
||||
filePageStyle.player,
|
||||
this.state.isLandscape
|
||||
? filePageStyle.containedPlayerLandscape
|
||||
: this.state.fullscreenMode
|
||||
? filePageStyle.fullscreenPlayer
|
||||
: filePageStyle.containedPlayer,
|
||||
];
|
||||
const playerBgStyle = [filePageStyle.playerBackground, filePageStyle.containedPlayerBackground];
|
||||
const fsPlayerBgStyle = [filePageStyle.playerBackground, filePageStyle.fullscreenPlayerBackground];
|
||||
// at least 2MB (or the full download) before media can be loaded
|
||||
const canLoadMedia =
|
||||
this.state.streamingMode ||
|
||||
(fileInfo && (fileInfo.written_bytes >= 2097152 || fileInfo.written_bytes === fileInfo.total_bytes)); // 2MB = 1024*1024*2
|
||||
const duration = claim && claim.value && claim.value.video ? claim.value.video.duration : null;
|
||||
const isViewable = mediaType === 'image' || mediaType === 'text';
|
||||
const canOpen = isViewable && completed;
|
||||
const localFileUri = this.localUriForFileInfo(fileInfo);
|
||||
const unsupported = !isPlayable && !canOpen;
|
||||
|
||||
if (fileInfo && !this.state.autoDownloadStarted && this.state.uriVars && this.state.uriVars.download === 'true') {
|
||||
this.setState({ autoDownloadStarted: true }, () => {
|
||||
purchaseUri(uri, costInfo, !isPlayable);
|
||||
if (NativeModules.UtilityModule) {
|
||||
NativeModules.UtilityModule.checkDownloads();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (
|
||||
!this.state.autoDownloadStarted &&
|
||||
claim &&
|
||||
costInfo &&
|
||||
((isPlayable && costInfo.cost === 0) || (this.state.uriVars && this.state.uriVars.download === 'true'))
|
||||
) {
|
||||
this.setState({ autoDownloadStarted: true }, () => {
|
||||
if (!isPlayable) {
|
||||
this.checkStoragePermissionForDownload();
|
||||
} else {
|
||||
this.confirmPurchaseUri(claim.permanent_url, costInfo, !isPlayable);
|
||||
}
|
||||
NativeModules.UtilityModule.checkDownloads();
|
||||
});
|
||||
}
|
||||
|
||||
if (this.state.downloadPressed && canOpen && !this.state.autoOpened) {
|
||||
// automatically open a web viewable or image file after the download button is pressed
|
||||
this.setState({ autoOpened: true }, () => this.openFile(localFileUri, mediaType));
|
||||
}
|
||||
if (this.state.downloadPressed && canOpen && !this.state.autoOpened) {
|
||||
// automatically open a web viewable or image file after the download button is pressed
|
||||
this.setState({ autoOpened: true }, () => this.openFile(localFileUri, mediaType));
|
||||
}
|
||||
|
||||
return (
|
||||
<View style={filePageStyle.pageContainer}>
|
||||
{!this.state.fullscreenMode && <UriBar value={uri} navigation={navigation} />}
|
||||
{this.state.showWebView && isWebViewable && (
|
||||
<WebView allowFileAccess source={{ uri: localFileUri }} style={filePageStyle.viewer} />
|
||||
)}
|
||||
if (isChannel) {
|
||||
return <ChannelPage uri={uri} navigation={navigation} />;
|
||||
}
|
||||
|
||||
{this.state.showImageViewer && (
|
||||
<ImageViewer
|
||||
style={StyleSheet.flatten(filePageStyle.viewer)}
|
||||
imageUrls={this.state.imageUrls}
|
||||
renderIndicator={() => null}
|
||||
/>
|
||||
)}
|
||||
return (
|
||||
<View style={filePageStyle.pageContainer}>
|
||||
{!this.state.fullscreenMode && <UriBar value={uri} navigation={navigation} />}
|
||||
{innerContent}
|
||||
|
||||
{!this.state.showWebView && (
|
||||
<View
|
||||
style={
|
||||
this.state.fullscreenMode ? filePageStyle.innerPageContainerFsMode : filePageStyle.innerPageContainer
|
||||
}
|
||||
onLayout={this.checkOrientation}
|
||||
{this.state.showWebView && isWebViewable && (
|
||||
<WebView allowFileAccess source={{ uri: localFileUri }} style={filePageStyle.viewer} />
|
||||
)}
|
||||
{this.state.showImageViewer && (
|
||||
<ImageViewer
|
||||
style={StyleSheet.flatten(filePageStyle.viewer)}
|
||||
imageUrls={this.state.imageUrls}
|
||||
renderIndicator={() => null}
|
||||
/>
|
||||
)}
|
||||
{!innerContent && !this.state.showWebView && (
|
||||
<View
|
||||
style={
|
||||
this.state.fullscreenMode ? filePageStyle.innerPageContainerFsMode : filePageStyle.innerPageContainer
|
||||
}
|
||||
onLayout={this.checkOrientation}
|
||||
>
|
||||
<TouchableOpacity
|
||||
activeOpacity={0.5}
|
||||
style={filePageStyle.mediaContainer}
|
||||
onPress={this.onFileDownloadButtonPressed}
|
||||
>
|
||||
<TouchableOpacity
|
||||
activeOpacity={0.5}
|
||||
style={filePageStyle.mediaContainer}
|
||||
onPress={this.onMediaContainerPressed}
|
||||
>
|
||||
{(canOpen || (!fileInfo || (isPlayable && !canLoadMedia)) || (!canOpen && fileInfo)) && (
|
||||
<FileItemMedia
|
||||
duration={duration}
|
||||
style={filePageStyle.thumbnail}
|
||||
title={title}
|
||||
thumbnail={thumbnail}
|
||||
/>
|
||||
)}
|
||||
{!unsupported &&
|
||||
(!this.state.downloadButtonShown || this.state.downloadPressed) &&
|
||||
!this.state.mediaLoaded && (
|
||||
<ActivityIndicator size="large" color={Colors.NextLbryGreen} style={filePageStyle.loading} />
|
||||
)}
|
||||
|
||||
{unsupported && fileInfo && completed && (
|
||||
<View style={filePageStyle.unsupportedContent}>
|
||||
<Image
|
||||
style={filePageStyle.unsupportedContentImage}
|
||||
resizeMode={'stretch'}
|
||||
source={require('../../assets/gerbil-happy.png')}
|
||||
/>
|
||||
<View style={filePageStyle.unspportedContentTextContainer}>
|
||||
<Text style={filePageStyle.unsupportedContentTitle}>{__('Unsupported Content')}</Text>
|
||||
<Text style={filePageStyle.unsupportedContentText}>
|
||||
Sorry, we are unable to display this content in the app. You can find the file named{' '}
|
||||
<Text style={filePageStyle.unsupportedContentFilename}>{fileInfo.file_name}</Text> in your
|
||||
downloads folder.
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
|
||||
{((isPlayable && !completed && !canLoadMedia) ||
|
||||
canOpen ||
|
||||
(!completed && !this.state.streamingMode)) &&
|
||||
!this.state.downloadPressed && (
|
||||
<FileDownloadButton
|
||||
uri={claim && claim.permanent_url ? claim.permanent_url : uri}
|
||||
style={filePageStyle.downloadButton}
|
||||
openFile={() => this.openFile(localFileUri, mediaType)}
|
||||
isPlayable={isPlayable}
|
||||
isViewable={isViewable}
|
||||
onPlay={this.onFileDownloadButtonPlayed}
|
||||
onView={() => this.setState({ downloadPressed: true })}
|
||||
onButtonLayout={() => this.setState({ downloadButtonShown: true })}
|
||||
/>
|
||||
)}
|
||||
{!fileInfo && (
|
||||
<FilePrice
|
||||
uri={uri}
|
||||
style={filePageStyle.filePriceContainer}
|
||||
textStyle={filePageStyle.filePriceText}
|
||||
/>
|
||||
)}
|
||||
|
||||
<TouchableOpacity style={filePageStyle.backButton} onPress={this.onBackButtonPressed}>
|
||||
<Icon name={'arrow-left'} size={18} style={filePageStyle.backButtonIcon} />
|
||||
</TouchableOpacity>
|
||||
</TouchableOpacity>
|
||||
{(this.state.streamingMode || (canLoadMedia && fileInfo && isPlayable)) && (
|
||||
<View
|
||||
style={playerBgStyle}
|
||||
ref={ref => {
|
||||
this.playerBackground = ref;
|
||||
}}
|
||||
onLayout={evt => {
|
||||
if (!this.state.playerBgHeight) {
|
||||
this.setState({ playerBgHeight: evt.nativeEvent.layout.height });
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{(this.state.streamingMode || (canLoadMedia && fileInfo && isPlayable)) && this.state.fullscreenMode && (
|
||||
<View style={fsPlayerBgStyle} />
|
||||
)}
|
||||
{(this.state.streamingMode || (canLoadMedia && fileInfo && isPlayable)) && (
|
||||
<MediaPlayer
|
||||
claim={claim}
|
||||
assignPlayer={ref => {
|
||||
this.player = ref;
|
||||
}}
|
||||
uri={uri}
|
||||
source={this.playerUriForFileInfo(fileInfo)}
|
||||
style={playerStyle}
|
||||
autoPlay={autoplay || this.state.autoPlayMedia}
|
||||
onFullscreenToggled={this.handleFullscreenToggle}
|
||||
onLayout={evt => {
|
||||
if (!this.state.playerHeight) {
|
||||
this.setState({ playerHeight: evt.nativeEvent.layout.height });
|
||||
}
|
||||
}}
|
||||
onMediaLoaded={() => this.onMediaLoaded(channelName, title, uri)}
|
||||
onBackButtonPressed={this.onBackButtonPressed}
|
||||
onPlaybackStarted={this.onPlaybackStarted}
|
||||
onPlaybackFinished={this.onPlaybackFinished}
|
||||
{(canOpen || (!fileInfo || (isPlayable && !canLoadMedia)) || (!canOpen && fileInfo)) && (
|
||||
<FileItemMedia
|
||||
duration={duration}
|
||||
style={filePageStyle.thumbnail}
|
||||
title={title}
|
||||
thumbnail={thumbnail}
|
||||
position={position}
|
||||
/>
|
||||
)}
|
||||
{!unsupported &&
|
||||
(!this.state.downloadButtonShown || this.state.downloadPressed) &&
|
||||
!this.state.mediaLoaded && (
|
||||
<ActivityIndicator size="large" color={Colors.NextLbryGreen} style={filePageStyle.loading} />
|
||||
)}
|
||||
|
||||
{unsupported && fileInfo && completed && (
|
||||
<View style={filePageStyle.unsupportedContent}>
|
||||
<Image
|
||||
style={filePageStyle.unsupportedContentImage}
|
||||
resizeMode={'stretch'}
|
||||
source={require('../../assets/gerbil-happy.png')}
|
||||
/>
|
||||
<View style={filePageStyle.unspportedContentTextContainer}>
|
||||
<Text style={filePageStyle.unsupportedContentTitle}>{__('Unsupported Content')}</Text>
|
||||
<Text style={filePageStyle.unsupportedContentText}>
|
||||
Sorry, we are unable to display this content in the app. You can find the file named{' '}
|
||||
<Text style={filePageStyle.unsupportedContentFilename}>{fileInfo.file_name}</Text> in your
|
||||
downloads folder.
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
)}
|
||||
|
||||
{((isPlayable && !completed && !canLoadMedia) ||
|
||||
canOpen ||
|
||||
(!completed && !this.state.streamingMode)) && (
|
||||
<FileDownloadButton
|
||||
uri={claim && claim.permanent_url ? claim.permanent_url : uri}
|
||||
style={filePageStyle.downloadButton}
|
||||
openFile={() => this.openFile(localFileUri, mediaType)}
|
||||
isPlayable={isPlayable}
|
||||
isViewable={isViewable}
|
||||
onFileActionPress={this.onFileDownloadButtonPressed}
|
||||
onButtonLayout={() => this.setState({ downloadButtonShown: true })}
|
||||
/>
|
||||
)}
|
||||
{!fileInfo && (
|
||||
<FilePrice
|
||||
uri={claim && claim.permanent_url ? claim.permanent_url : uri}
|
||||
style={filePageStyle.filePriceContainer}
|
||||
textStyle={filePageStyle.filePriceText}
|
||||
/>
|
||||
)}
|
||||
|
||||
<TouchableOpacity style={filePageStyle.backButton} onPress={this.onBackButtonPressed}>
|
||||
<Icon name={'arrow-left'} size={18} style={filePageStyle.backButtonIcon} />
|
||||
</TouchableOpacity>
|
||||
</TouchableOpacity>
|
||||
{!innerContent && (this.state.streamingMode || (canLoadMedia && fileInfo && isPlayable)) && (
|
||||
<View
|
||||
style={playerBgStyle}
|
||||
ref={ref => {
|
||||
this.playerBackground = ref;
|
||||
}}
|
||||
onLayout={evt => {
|
||||
if (!this.state.playerBgHeight) {
|
||||
this.setState({ playerBgHeight: evt.nativeEvent.layout.height });
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{!innerContent &&
|
||||
(this.state.streamingMode || (canLoadMedia && fileInfo && isPlayable)) &&
|
||||
this.state.fullscreenMode && <View style={fsPlayerBgStyle} />}
|
||||
{!innerContent && (this.state.streamingMode || (canLoadMedia && fileInfo && isPlayable)) && (
|
||||
<MediaPlayer
|
||||
claim={claim}
|
||||
assignPlayer={ref => {
|
||||
this.player = ref;
|
||||
}}
|
||||
uri={uri}
|
||||
source={this.playerUriForFileInfo(fileInfo)}
|
||||
style={playerStyle}
|
||||
autoPlay
|
||||
onFullscreenToggled={this.handleFullscreenToggle}
|
||||
onLayout={evt => {
|
||||
if (!this.state.playerHeight) {
|
||||
this.setState({ playerHeight: evt.nativeEvent.layout.height });
|
||||
}
|
||||
}}
|
||||
onMediaLoaded={() => this.onMediaLoaded(channelName, title, uri)}
|
||||
onBackButtonPressed={this.onBackButtonPressed}
|
||||
onPlaybackStarted={this.onPlaybackStarted}
|
||||
onPlaybackFinished={this.onPlaybackFinished}
|
||||
thumbnail={thumbnail}
|
||||
position={position}
|
||||
/>
|
||||
)}
|
||||
|
||||
{!innerContent && (
|
||||
<ScrollView
|
||||
style={filePageStyle.scrollContainer}
|
||||
contentContainerstyle={showActions ? null : filePageStyle.scrollContent}
|
||||
@@ -1088,7 +1154,7 @@ class FilePage extends React.PureComponent {
|
||||
normalizeURI(shortChannelUri || fullChannelUri),
|
||||
null,
|
||||
false,
|
||||
fullChannelUri
|
||||
fullChannelUri,
|
||||
);
|
||||
}}
|
||||
/>
|
||||
@@ -1101,7 +1167,7 @@ class FilePage extends React.PureComponent {
|
||||
<DateTime
|
||||
style={filePageStyle.publishDate}
|
||||
textStyle={filePageStyle.publishDateText}
|
||||
uri={uri}
|
||||
uri={fullUri}
|
||||
formatOptions={{ day: 'numeric', month: 'long', year: 'numeric' }}
|
||||
show={DateTime.SHOW_DATE}
|
||||
/>
|
||||
@@ -1156,34 +1222,29 @@ class FilePage extends React.PureComponent {
|
||||
|
||||
<View onLayout={this.setRelatedContentPosition} />
|
||||
|
||||
{isSearchingRecommendContent && (
|
||||
<ActivityIndicator size="small" color={Colors.NextLbryGreen} style={filePageStyle.relatedLoading} />
|
||||
)}
|
||||
{!isSearchingRecommendContent && recommendedContent && recommendedContent.length > 0 && (
|
||||
<RelatedContent navigation={navigation} uri={uri} fullUri={fullUri} />
|
||||
{this.state.showRecommended && (
|
||||
<RelatedContent navigation={navigation} title={title} uri={fullUri} fullUri={fullUri} />
|
||||
)}
|
||||
</ScrollView>
|
||||
</View>
|
||||
)}
|
||||
{this.state.showTipView && (
|
||||
<ModalTipView
|
||||
claim={claim}
|
||||
channelName={channelName}
|
||||
contentName={title}
|
||||
onCancelPress={() => this.setState({ showTipView: false })}
|
||||
onOverlayPress={() => this.setState({ showTipView: false })}
|
||||
onSendTipSuccessful={() => this.setState({ showTipView: false })}
|
||||
/>
|
||||
)}
|
||||
{!this.state.fullscreenMode &&
|
||||
!this.state.showTipView &&
|
||||
!this.state.showImageViewer &&
|
||||
!this.state.showWebView && <FloatingWalletBalance navigation={navigation} />}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
{this.state.showTipView && (
|
||||
<ModalTipView
|
||||
claim={claim}
|
||||
channelName={channelName}
|
||||
contentName={title}
|
||||
onCancelPress={() => this.setState({ showTipView: false })}
|
||||
onOverlayPress={() => this.setState({ showTipView: false })}
|
||||
onSendTipSuccessful={() => this.setState({ showTipView: false })}
|
||||
/>
|
||||
)}
|
||||
{!this.state.fullscreenMode &&
|
||||
!this.state.showTipView &&
|
||||
!this.state.showImageViewer &&
|
||||
!this.state.showWebView && <FloatingWalletBalance navigation={navigation} />}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -228,7 +228,13 @@ class FirstRunScreen extends React.PureComponent {
|
||||
handleContinuePressed = () => {
|
||||
const { notify, user, hasSyncedWallet } = this.props;
|
||||
const pageIndex = FirstRunScreen.pages.indexOf(this.state.currentPage);
|
||||
if (Constants.FIRST_RUN_PAGE_WALLET === this.state.currentPage) {
|
||||
|
||||
if (Constants.FIRST_RUN_PAGE_WELCOME === this.state.currentPage) {
|
||||
// only show the welcome screen on first run
|
||||
this.closeFinalPage();
|
||||
}
|
||||
|
||||
/* if (Constants.FIRST_RUN_PAGE_WALLET === this.state.currentPage) {
|
||||
// do apply sync to check if the password is valid
|
||||
if (hasSyncedWallet) {
|
||||
this.checkWalletPassword();
|
||||
@@ -256,7 +262,7 @@ class FirstRunScreen extends React.PureComponent {
|
||||
} else {
|
||||
this.showNextPage();
|
||||
}
|
||||
}
|
||||
} */
|
||||
};
|
||||
|
||||
handleEmailCollectPageContinue() {
|
||||
@@ -500,7 +506,12 @@ class FirstRunScreen extends React.PureComponent {
|
||||
{Constants.FIRST_RUN_PAGE_SKIP_ACCOUNT !== this.state.currentPage &&
|
||||
Constants.FIRST_RUN_PAGE_EMAIL_VERIFY !== this.state.currentPage && (
|
||||
<Text style={firstRunStyle.buttonText}>
|
||||
{Constants.FIRST_RUN_PAGE_WALLET === this.state.currentPage ? __('Use LBRY') : __('Continue')} »
|
||||
{[Constants.FIRST_RUN_PAGE_WALLET, Constants.FIRST_RUN_PAGE_WELCOME].includes(
|
||||
this.state.currentPage
|
||||
)
|
||||
? __('Use LBRY')
|
||||
: __('Continue')}{' '}
|
||||
»
|
||||
</Text>
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
|
||||
+26
-18
@@ -196,7 +196,7 @@ class PublishPage extends React.PureComponent {
|
||||
},
|
||||
() => {
|
||||
NativeModules.Gallery.getVideos().then(videos => this.setState({ videos, loadingVideos: false }));
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
// Check if this is an edit action
|
||||
@@ -288,7 +288,7 @@ class PublishPage extends React.PureComponent {
|
||||
this.handleChannelChange(channelName);
|
||||
}
|
||||
pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH_FORM);
|
||||
}
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
@@ -356,18 +356,26 @@ class PublishPage extends React.PureComponent {
|
||||
}
|
||||
|
||||
if (!title || title.trim().length === 0) {
|
||||
notify({ message: __('Please provide a title') });
|
||||
notify({ message: __('Please provide a title'), isError: true });
|
||||
return;
|
||||
}
|
||||
|
||||
if (!name) {
|
||||
notify({ message: __('Please specify an address where people can find your content.') });
|
||||
notify({ message: __('Please specify an address where people can find your content.'), isError: true });
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isNameValid(name, false)) {
|
||||
notify({ message: __('Your content address contains invalid characters.'), isError: true });
|
||||
return;
|
||||
}
|
||||
|
||||
if (!currentMedia && !editMode) {
|
||||
// sanity check. normally shouldn't happen
|
||||
notify({ message: __('No file selected. Please select a video or take a photo before publishing.') });
|
||||
notify({
|
||||
message: __('No file selected. Please select a video or take a photo before publishing.'),
|
||||
isError: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -456,7 +464,7 @@ class PublishPage extends React.PureComponent {
|
||||
() => {
|
||||
this.handleNameChange(this.state.name);
|
||||
pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH_FORM);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -510,7 +518,7 @@ class PublishPage extends React.PureComponent {
|
||||
clearPublishFormState();
|
||||
// reset thumbnail
|
||||
updatePublishForm({ thumbnail: null });
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -537,7 +545,7 @@ class PublishPage extends React.PureComponent {
|
||||
},
|
||||
() => {
|
||||
NativeModules.UtilityModule.openDocumentPicker('*/*');
|
||||
}
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
@@ -583,7 +591,7 @@ class PublishPage extends React.PureComponent {
|
||||
() => {
|
||||
// upload a new thumbnail
|
||||
uploadImageAsset(fileUrl, this.handleThumbnailUploadSuccess, this.handleThumbnailUploadFailure);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@@ -634,7 +642,7 @@ class PublishPage extends React.PureComponent {
|
||||
videoRecordingMode: false,
|
||||
recordingVideo: false,
|
||||
},
|
||||
() => pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH_FORM)
|
||||
() => pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH_FORM),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -658,7 +666,7 @@ class PublishPage extends React.PureComponent {
|
||||
showCameraOverlay: false,
|
||||
videoRecordingMode: false,
|
||||
},
|
||||
() => pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH)
|
||||
() => pushDrawerStack(Constants.DRAWER_ROUTE_PUBLISH),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -777,8 +785,8 @@ class PublishPage extends React.PureComponent {
|
||||
uploadImageAsset(
|
||||
this.getFilePathFromUri(uri),
|
||||
this.handleThumbnailUploadSuccess,
|
||||
this.handleThumbnailUploadFailure
|
||||
)
|
||||
this.handleThumbnailUploadFailure,
|
||||
),
|
||||
);
|
||||
}
|
||||
} else if (mediaType === 'image' || mediaType === 'video') {
|
||||
@@ -791,7 +799,7 @@ class PublishPage extends React.PureComponent {
|
||||
this.setState({ currentThumbnailUri: `file://${path}`, updatingThumbnailUri: false });
|
||||
if (!this.state.uploadedThumbnailUri) {
|
||||
this.setState({ uploadThumbnailStarted: true }, () =>
|
||||
uploadImageAsset(path, this.handleThumbnailUploadSuccess, this.handleThumbnailUploadFailure)
|
||||
uploadImageAsset(path, this.handleThumbnailUploadSuccess, this.handleThumbnailUploadFailure),
|
||||
);
|
||||
}
|
||||
})
|
||||
@@ -817,7 +825,7 @@ class PublishPage extends React.PureComponent {
|
||||
},
|
||||
() => {
|
||||
this.handleNameChange(this.state.name);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -881,7 +889,7 @@ class PublishPage extends React.PureComponent {
|
||||
},
|
||||
() => {
|
||||
NativeModules.UtilityModule.openDocumentPicker('image/*');
|
||||
}
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1112,7 +1120,7 @@ class PublishPage extends React.PureComponent {
|
||||
{__('The address where people can find your content (ex. lbry://myvideo). ')}
|
||||
{this.state.editMode &&
|
||||
__(
|
||||
'You cannot change this address while editing your content. If you wish to use a new address, please republish the content.'
|
||||
'You cannot change this address while editing your content. If you wish to use a new address, please republish the content.',
|
||||
)}
|
||||
</Text>
|
||||
|
||||
@@ -1262,7 +1270,7 @@ class PublishPage extends React.PureComponent {
|
||||
</View>
|
||||
<Text style={publishStyle.successText}>
|
||||
{__(
|
||||
'Your content will be live in a few minutes. In the mean time, feel free to publish more content or explore the app.'
|
||||
'Your content will be live in a few minutes. In the mean time, feel free to publish more content or explore the app.',
|
||||
)}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import { connect } from 'react-redux';
|
||||
import {
|
||||
doClaimSearch,
|
||||
doResolveUris,
|
||||
doSearch,
|
||||
doUpdateSearchQuery,
|
||||
makeSelectSearchUris,
|
||||
selectClaimSearchByQuery,
|
||||
selectIsSearching,
|
||||
selectResolvingUris,
|
||||
selectSearchValue,
|
||||
makeSelectQueryWithOptions,
|
||||
selectSearchUrisByQuery,
|
||||
} from 'lbry-redux';
|
||||
import { doPushDrawerStack, doSetPlayerVisible } from 'redux/actions/drawer';
|
||||
import { selectCurrentRoute } from 'redux/selectors/drawer';
|
||||
@@ -22,19 +23,20 @@ const select = state => ({
|
||||
currentRoute: selectCurrentRoute(state),
|
||||
isSearching: selectIsSearching(state),
|
||||
query: selectSearchValue(state),
|
||||
resolvingUris: selectResolvingUris(state),
|
||||
uris: makeSelectSearchUris(makeSelectQueryWithOptions(null, numSearchResults)(state))(state),
|
||||
urisByQuery: selectSearchUrisByQuery(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
search: query => dispatch(doSearch(query, numSearchResults)),
|
||||
search: query => dispatch(doSearch(query, numSearchResults, null, false, false)),
|
||||
claimSearch: options => dispatch(doClaimSearch(options)),
|
||||
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),
|
||||
pushDrawerStack: () => dispatch(doPushDrawerStack(Constants.DRAWER_ROUTE_SEARCH)),
|
||||
resolveUris: uris => dispatch(doResolveUris(uris)),
|
||||
setPlayerVisible: () => dispatch(doSetPlayerVisible(false)),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
perform,
|
||||
)(SearchPage);
|
||||
+59
-21
@@ -26,6 +26,7 @@ class SearchPage extends React.PureComponent {
|
||||
showTagResult: false,
|
||||
claimSearchRun: false,
|
||||
claimSearchOptions: null,
|
||||
resultsResolved: false,
|
||||
};
|
||||
|
||||
static navigationOptions = {
|
||||
@@ -58,6 +59,7 @@ class SearchPage extends React.PureComponent {
|
||||
claimSearchOptions: null,
|
||||
claimSearchRun: false,
|
||||
showTagResult: false,
|
||||
resultsResolved: false,
|
||||
});
|
||||
search(searchQuery);
|
||||
}
|
||||
@@ -69,8 +71,8 @@ class SearchPage extends React.PureComponent {
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
const { currentRoute, query } = nextProps;
|
||||
const { currentRoute: prevRoute, search } = this.props;
|
||||
const { currentRoute, query, isSearching } = nextProps;
|
||||
const { currentRoute: prevRoute, search, isSearching: prevIsSearching } = this.props;
|
||||
|
||||
if (Constants.DRAWER_ROUTE_SEARCH === currentRoute && currentRoute !== prevRoute) {
|
||||
this.onComponentFocused();
|
||||
@@ -80,11 +82,44 @@ class SearchPage extends React.PureComponent {
|
||||
this.setState({
|
||||
currentQuery: query,
|
||||
currentUri: isURIValid(query) ? normalizeURI(query) : null,
|
||||
resultsResolved: false,
|
||||
});
|
||||
search(query);
|
||||
}
|
||||
}
|
||||
|
||||
allContentResolved(props) {
|
||||
const { uris, resolvingUris } = props;
|
||||
if (!this.state.resultsResolved) {
|
||||
return false;
|
||||
}
|
||||
if (uris) {
|
||||
let allResolved = true;
|
||||
uris.forEach(uri => {
|
||||
allResolved = allResolved && !resolvingUris.includes(uri);
|
||||
});
|
||||
return allResolved;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
shouldComponentUpdate(nextProps) {
|
||||
const { isSearching, uris } = this.props;
|
||||
return (isSearching && (!uris || uris.length === 0)) || (!isSearching && this.allContentResolved(this.props));
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
const { isSearching, resolveUris, uris } = this.props;
|
||||
if (!isSearching && !this.state.resultsResolved) {
|
||||
this.setState({ resultsResolved: true }, () => {
|
||||
if (uris && uris.length > 0) {
|
||||
resolveUris(uris);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
getSearchQuery() {
|
||||
const { navigation } = this.props;
|
||||
if (navigation && navigation.state && navigation.state.params) {
|
||||
@@ -100,6 +135,7 @@ class SearchPage extends React.PureComponent {
|
||||
claimSearchOptions: null,
|
||||
claimSearchRun: false,
|
||||
showTagResult: false,
|
||||
resultsResolved: false,
|
||||
});
|
||||
search(keywords);
|
||||
};
|
||||
@@ -130,11 +166,11 @@ class SearchPage extends React.PureComponent {
|
||||
this.setState({ claimSearchOptions: options, claimSearchRun: true }, () => claimSearch(options));
|
||||
}
|
||||
|
||||
if (this.state.claimSearchRun && this.state.claimSearchOptions) {
|
||||
/* if (this.state.claimSearchRun && this.state.claimSearchOptions) {
|
||||
const claimSearchKey = createNormalizedClaimSearchKey(this.state.claimSearchOptions);
|
||||
const claimSearchUris = claimSearchByQuery[claimSearchKey];
|
||||
this.setState({ showTagResult: claimSearchUris && claimSearchUris.length > 0 });
|
||||
}
|
||||
} */
|
||||
|
||||
return (
|
||||
<View>
|
||||
@@ -155,7 +191,7 @@ class SearchPage extends React.PureComponent {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { isSearching, navigation, query, uris, urisByQuery } = this.props;
|
||||
const { isSearching, navigation, query, uris } = this.props;
|
||||
|
||||
return (
|
||||
<View style={searchStyle.container}>
|
||||
@@ -167,22 +203,24 @@ class SearchPage extends React.PureComponent {
|
||||
</View>
|
||||
)}
|
||||
|
||||
<FlatList
|
||||
extraData={this.state}
|
||||
style={searchStyle.scrollContainer}
|
||||
contentContainerStyle={searchStyle.scrollPadding}
|
||||
keyboardShouldPersistTaps={'handled'}
|
||||
data={uris}
|
||||
keyExtractor={(item, index) => item}
|
||||
initialNumToRender={10}
|
||||
maxToRenderPerBatch={20}
|
||||
removeClippedSubviews
|
||||
ListEmptyComponent={!isSearching ? this.listEmptyComponent() : null}
|
||||
ListHeaderComponent={this.state.currentUri ? this.listHeaderComponent(this.state.showTagResult) : null}
|
||||
renderItem={({ item }) => (
|
||||
<FileListItem key={item} uri={item} style={searchStyle.resultItem} navigation={navigation} />
|
||||
)}
|
||||
/>
|
||||
{!isSearching && (
|
||||
<FlatList
|
||||
extraData={this.state}
|
||||
style={searchStyle.scrollContainer}
|
||||
contentContainerStyle={searchStyle.scrollPadding}
|
||||
keyboardShouldPersistTaps={'handled'}
|
||||
data={uris}
|
||||
keyExtractor={(item, index) => item}
|
||||
initialNumToRender={8}
|
||||
maxToRenderPerBatch={20}
|
||||
removeClippedSubviews
|
||||
ListEmptyComponent={!isSearching ? this.listEmptyComponent() : null}
|
||||
ListHeaderComponent={this.state.currentUri ? this.listHeaderComponent(this.state.showTagResult) : null}
|
||||
renderItem={({ item }) => (
|
||||
<FileListItem key={item} uri={item} style={searchStyle.resultItem} batchResolve navigation={navigation} />
|
||||
)}
|
||||
/>
|
||||
)}
|
||||
<FloatingWalletBalance navigation={navigation} />
|
||||
</View>
|
||||
);
|
||||
|
||||
@@ -269,8 +269,6 @@ class SplashScreen extends React.PureComponent {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
console.log('hermesInternal=' + (global.HermesInternal != null));
|
||||
|
||||
NativeModules.Firebase.track('app_launch', null);
|
||||
NativeModules.Firebase.setCurrentScreen('Splash');
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ class SubscriptionsPage extends React.PureComponent {
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
this.onComponentFocused();
|
||||
// this.onComponentFocused();
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@@ -115,7 +115,10 @@ class SubscriptionsPage extends React.PureComponent {
|
||||
unsubscribeShortChannelUrls = () => {
|
||||
// this should only have to happen once
|
||||
const { subscribedChannels, channelUnsubscribe } = this.props;
|
||||
const badSubs = subscribedChannels.filter(sub => sub.uri.split('#')[1].length < 5);
|
||||
const badSubs = subscribedChannels.filter(sub => {
|
||||
const parts = sub.uri.split('#');
|
||||
return parts.length === 1 || parts[1].length < 5;
|
||||
});
|
||||
if (badSubs.length > 0) {
|
||||
badSubs.forEach(sub => channelUnsubscribe(sub));
|
||||
}
|
||||
|
||||
@@ -94,6 +94,11 @@ const fileListStyle = StyleSheet.create({
|
||||
top: 8,
|
||||
left: 8,
|
||||
},
|
||||
featuredDownloadedIcon: {
|
||||
position: 'absolute',
|
||||
left: 16,
|
||||
top: 16,
|
||||
},
|
||||
fileItem: {
|
||||
marginLeft: 24,
|
||||
marginRight: 24,
|
||||
@@ -115,6 +120,22 @@ const fileListStyle = StyleSheet.create({
|
||||
marginLeft: 4,
|
||||
marginTop: 4,
|
||||
},
|
||||
filePriceContainer: {
|
||||
backgroundColor: Colors.NextLbryGreen,
|
||||
justifyContent: 'center',
|
||||
position: 'absolute',
|
||||
left: thumbnailWidth - 64,
|
||||
top: 8,
|
||||
width: 56,
|
||||
height: 24,
|
||||
borderRadius: 4,
|
||||
},
|
||||
filePriceText: {
|
||||
fontFamily: 'Inter-UI-Bold',
|
||||
fontSize: 12,
|
||||
textAlign: 'center',
|
||||
color: '#0c604b',
|
||||
},
|
||||
});
|
||||
|
||||
export default fileListStyle;
|
||||
@@ -27,11 +27,16 @@ const walletStyle = StyleSheet.create({
|
||||
},
|
||||
address: {
|
||||
fontFamily: 'Inter-UI-Regular',
|
||||
letterSpacing: 0.8,
|
||||
borderWidth: 1,
|
||||
borderRadius: 16,
|
||||
borderStyle: 'dashed',
|
||||
borderColor: '#cccccc',
|
||||
borderColor: '#e1e1e1',
|
||||
backgroundColor: '#f9f9f9',
|
||||
padding: 8,
|
||||
paddingTop: 8,
|
||||
paddingLeft: 8,
|
||||
paddingRight: 8,
|
||||
paddingBottom: 6,
|
||||
width: '85%',
|
||||
},
|
||||
button: {
|
||||
|
||||
Reference in new issue
Block a user