-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreplace.py
More file actions
15 lines (12 loc) · 754 Bytes
/
replace.py
File metadata and controls
15 lines (12 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
with open('app/src/main/java/com/example/wave/ui/screens/SecureScanScreen.kt', 'r') as f:
text = f.read()
import re
old_text = r'val bodyText = errorMessage \?: payload \?: "Tag programmed successfully!"'
new_text = r'''val bodyText = if (isSuccessWrite && errorMessage == null) {
if (payload != null) "Tag programmed successfully!\n\nHere's what is written on to the NFC tag:\n" + payload else "Tag programmed successfully!\n\nHere's what is written on to the NFC tag."
} else {
errorMessage ?: payload ?: "Tag programmed successfully!"
}'''
text = re.sub(old_text, new_text, text)
with open('app/src/main/java/com/example/wave/ui/screens/SecureScanScreen.kt', 'w') as f:
f.write(text)