-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Torified webview in react-native #247
Merged
Reckless-Satoshi
merged 17 commits into
RoboSats:android-webview-app-ts-2
from
KoalaSat:android-tor-requests
Sep 28, 2022
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
340bcf8
Add android build workflow
Reckless-Satoshi 49f5c69
Android Tor Requests
KoalaSat 7ab6cc2
Fetching internal files (i18n)
KoalaSat 433871a
react-native-tor does not implement PUT
KoalaSat fc782f0
Get Files from Tor
KoalaSat 55358d8
Revert "Add android build workflow"
KoalaSat b6bcd75
Fix Rebase Removals
KoalaSat 2d2c55a
External sources
KoalaSat e54132a
react-native-tor crashes
KoalaSat 85b0882
Last Refactor
KoalaSat 3e17ec6
Fix/revert setup guide
Reckless-Satoshi d356fa2
Add /mobile as volume to npm-dev container
Reckless-Satoshi 0df6ab2
Fix UsafeAlert
KoalaSat 1e70c7d
Run prettier
Reckless-Satoshi 9a180c7
Run lint:fix
Reckless-Satoshi 0fa911d
Main Profile Image fix
KoalaSat 5e51c99
Remove Tor Requests limitation
KoalaSat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ import { getCookie, writeCookie, deleteCookie } from '../utils/cookies'; | |
import { saveAsJson } from '../utils/saveFile'; | ||
import { copyToClipboard } from '../utils/clipboard'; | ||
import { apiClient } from '../services/api/index'; | ||
import RobotAvatar from './Robots/RobotAvatar'; | ||
|
||
class UserGenPage extends Component { | ||
constructor(props) { | ||
|
@@ -48,7 +49,6 @@ class UserGenPage extends Component { | |
this.setState({ | ||
nickname: this.props.nickname, | ||
token: this.props.token ? this.props.token : '', | ||
avatarUrl: '/static/assets/avatars/' + this.props.nickname + '.png', | ||
loadingRobot: false, | ||
}); | ||
} else { | ||
|
@@ -75,13 +75,11 @@ class UserGenPage extends Component { | |
ref_code: refCode, | ||
}; | ||
}); | ||
|
||
requestBody.then((body) => | ||
apiClient.post('/api/user/', body).then((data) => { | ||
this.setState({ | ||
nickname: data.nickname, | ||
bit_entropy: data.token_bits_entropy, | ||
avatarUrl: '/static/assets/avatars/' + data.nickname + '.png', | ||
shannon_entropy: data.token_shannon_entropy, | ||
bad_request: data.bad_request, | ||
found: data.found, | ||
|
@@ -193,7 +191,7 @@ class UserGenPage extends Component { | |
align='center' | ||
sx={{ width: 370 * fontSizeFactor, height: 260 * fontSizeFactor }} | ||
> | ||
{this.props.avatarLoaded && this.state.avatarUrl ? ( | ||
{this.props.avatarLoaded && this.state.nickname ? ( | ||
<div> | ||
<Grid item xs={12} align='center'> | ||
<Typography component='h5' variant='h5'> | ||
|
@@ -231,20 +229,19 @@ class UserGenPage extends Component { | |
</Typography> | ||
</Grid> | ||
<Grid item xs={12} align='center'> | ||
<Tooltip enterTouchDelay={0} title={t('This is your trading avatar')}> | ||
<div style={{ maxWidth: 200 * fontSizeFactor, maxHeight: 200 * fontSizeFactor }}> | ||
<SmoothImage | ||
src={this.state.avatarUrl} | ||
imageStyles={{ | ||
borderRadius: '50%', | ||
border: '2px solid #555', | ||
filter: 'drop-shadow(1px 1px 1px #000000)', | ||
height: `${195 * fontSizeFactor}px`, | ||
width: `${200 * fontSizeFactor}px`, | ||
}} | ||
/> | ||
</div> | ||
</Tooltip> | ||
<RobotAvatar | ||
nickname={this.state.nickname} | ||
style={{ maxWidth: 200 * fontSizeFactor, maxHeight: 200 * fontSizeFactor }} | ||
imageStyle={{ | ||
transform: '', | ||
border: '2px solid #555', | ||
filter: 'drop-shadow(1px 1px 1px #000000)', | ||
height: `${195 * fontSizeFactor}px`, | ||
width: `${200 * fontSizeFactor}px`, | ||
}} | ||
smooth={true} | ||
tooltip={t('This is your trading avatar')} | ||
/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I missed this one on the Refactor, should be checked on frontend |
||
<br /> | ||
</Grid> | ||
</div> | ||
|
@@ -299,8 +296,10 @@ class UserGenPage extends Component { | |
<IconButton | ||
color='primary' | ||
disabled={ | ||
!(getCookie('robot_token') == this.state.token) || | ||
!this.props.avatarLoaded | ||
!this.props.avatarLoaded || ( | ||
!window.NativeRobosats && | ||
!(getCookie('robot_token') === this.state.token) | ||
) | ||
} | ||
onClick={() => | ||
saveAsJson(this.state.nickname + '.json', this.createJsonFile()) | ||
|
@@ -318,8 +317,10 @@ class UserGenPage extends Component { | |
<IconButton | ||
color={this.props.copiedToken ? 'inherit' : 'primary'} | ||
disabled={ | ||
!(getCookie('robot_token') == this.state.token) || | ||
!this.props.avatarLoaded | ||
!this.props.avatarLoaded || ( | ||
!window.NativeRobosats && | ||
!(getCookie('robot_token') === this.state.token) | ||
) | ||
} | ||
onClick={() => | ||
copyToClipboard(getCookie('robot_token')) & | ||
|
@@ -374,8 +375,10 @@ class UserGenPage extends Component { | |
<ButtonGroup variant='contained' aria-label='outlined primary button group'> | ||
<Button | ||
disabled={ | ||
this.state.loadingRobot || | ||
!(this.props.token ? getCookie('robot_token') == this.props.token : true) | ||
this.state.loadingRobot !== false || ( | ||
!window.NativeRobosats && | ||
!(this.props.token ? getCookie('robot_token') === this.props.token : true) | ||
) | ||
} | ||
color='primary' | ||
to='/make/' | ||
|
@@ -393,8 +396,10 @@ class UserGenPage extends Component { | |
/> | ||
<Button | ||
disabled={ | ||
this.state.loadingRobot || | ||
!(this.props.token ? getCookie('robot_token') == this.props.token : true) | ||
this.state.loadingRobot !== false || ( | ||
!window.NativeRobosats && | ||
!(this.props.token ? getCookie('robot_token') === this.props.token : true) | ||
) | ||
} | ||
color='secondary' | ||
to='/book/' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import i18n from 'i18next'; | ||
import LanguageDetector from 'i18next-browser-languagedetector'; | ||
import { initReactI18next } from 'react-i18next'; | ||
import HttpApi from 'i18next-http-backend'; | ||
|
||
import translationEN from "../../static/locales/en.json"; | ||
import translationES from "../../static/locales/es.json"; | ||
import translationDE from "../../static/locales/de.json"; | ||
import translationRU from "../../static/locales/ru.json"; | ||
import translationPL from "../../static/locales/pl.json"; | ||
import translationFR from "../../static/locales/fr.json"; | ||
import translationCA from "../../static/locales/ca.json"; | ||
import translationIT from "../../static/locales/it.json"; | ||
import translationPT from "../../static/locales/pt.json"; | ||
import translationEU from "../../static/locales/th.json"; | ||
|
||
const config = { | ||
resources: { | ||
en: {translations: translationEN}, | ||
es: {translations: translationES}, | ||
ru: {translations: translationRU}, | ||
de: {translations: translationDE}, | ||
pl: {translations: translationPL}, | ||
fr: {translations: translationFR}, | ||
ca: {translations: translationCA}, | ||
it: {translations: translationIT}, | ||
pt: {translations: translationPT}, | ||
eu: {translations: translationEU}, | ||
}, | ||
fallbackLng: 'en', | ||
debug: false, | ||
// have a common namespace used around the full app | ||
ns: ['translations'], | ||
defaultNS: 'translations', | ||
keySeparator: false, // we use content as keys | ||
interpolation: { | ||
escapeValue: false, | ||
formatSeparator: ',', | ||
}, | ||
react: { | ||
useSuspense: false, | ||
}, | ||
} | ||
|
||
|
||
i18n | ||
.use(HttpApi) | ||
.use(LanguageDetector) | ||
.use(initReactI18next) | ||
.init(config); | ||
|
||
export default i18n; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Reckless-Satoshi A gentle
try...catch
did the job :)