add ios social-app
This commit is contained in:
67
ios/patch_drawer_links.py
Normal file
67
ios/patch_drawer_links.py
Normal file
@@ -0,0 +1,67 @@
|
||||
import sys
|
||||
|
||||
file_path = sys.argv[1]
|
||||
with open(file_path, 'r') as f:
|
||||
lines = f.readlines()
|
||||
|
||||
new_lines = []
|
||||
in_extra_links = False
|
||||
extra_links_replaced = False
|
||||
|
||||
# We will replace the entire ExtraLinks function
|
||||
extra_links_code = """
|
||||
function ExtraLinks() {
|
||||
const {_} = useLingui()
|
||||
const t = useTheme()
|
||||
const kawaii = useKawaiiMode()
|
||||
const navigation = useNavigation<NavigationProp>()
|
||||
|
||||
return (
|
||||
<View style={[a.flex_col, a.gap_md, a.flex_wrap]}>
|
||||
<TouchableOpacity onPress={() => navigation.navigate('TermsOfService')}>
|
||||
<Text style={[a.text_md, t.atoms.text_contrast_medium]}>
|
||||
<Trans>Terms of Service</Trans>
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
<TouchableOpacity onPress={() => navigation.navigate('PrivacyPolicy')}>
|
||||
<Text style={[a.text_md, t.atoms.text_contrast_medium]}>
|
||||
<Trans>Privacy Policy</Trans>
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
{kawaii && (
|
||||
<Text style={t.atoms.text_contrast_medium}>
|
||||
<Trans>
|
||||
Logo by{' '}
|
||||
<InlineLinkText
|
||||
style={[a.text_md]}
|
||||
to="/profile/sawaratsuki.bsky.social"
|
||||
label="@sawaratsuki.bsky.social">
|
||||
@sawaratsuki.bsky.social
|
||||
</InlineLinkText>
|
||||
</Trans>
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
"""
|
||||
|
||||
for line in lines:
|
||||
if 'function ExtraLinks() {' in line:
|
||||
in_extra_links = True
|
||||
new_lines.append(extra_links_code)
|
||||
continue
|
||||
|
||||
if in_extra_links:
|
||||
if line.strip() == '}':
|
||||
in_extra_links = False
|
||||
# Don't append the closing brace because extra_links_code includes it?
|
||||
# Wait, extra_links_code includes the whole function.
|
||||
# So we skip everything until LAST closing brace of function.
|
||||
# Simple heuristic: indentation.
|
||||
continue
|
||||
|
||||
new_lines.append(line)
|
||||
|
||||
with open(file_path, 'w') as f:
|
||||
f.write(''.join(new_lines))
|
||||
Reference in New Issue
Block a user