cable-service/noise2cable.sh

76 lines
2.7 KiB
Bash
Executable file

#!/bin/bash
### Change the applicationId (i.d., rename the app)
sed -i 's/applicationId "co\.copperhead\.noise"/applicationId "im.cable.cableim"/' build.gradle
### Change other strings:
sed -i 's/Noise/Cable/' res/layout/reminder_header.xml
find res -iname '*.xml' -exec sed -i '
s/Noise /Cable /g;
s/Noise,/Cable,/g;
s/Noise)/Cable)/g;
s/Noise!/Cable!/g;
s/Noise</Cable</g;
s/Noise\./Cable\./g;
s/Noise\\/Cable\\/g;
s/Noise:/Cable:/g;
s/Noise$/Cable/g' {} +
sed -i 's/Your (Signal|TextSecure) verification code:/Your (Cable) verification code:/' src/org/thoughtcrime/securesms/service/SmsListener.java
# Change the server addresses
sed -i '/SIGNAL_URL/ s|textsecure-service\.whispersystems\.org|cable-service.cable.im|' build.gradle
sed -i '/REDPHONE_MASTER_URL/ s|redphone-master\.whispersystems\.org|redphone-master.cable.im|' build.gradle
sed -i '/REDPHONE_RELAY_HOST/ s|relay\.whispersystems\.org|redphone-relay.cable.im|' build.gradle
sed -i '/REDPHONE_PREFIX_NAME/ s|\.whispersystems\.org|.cable.im|' build.gradle
# Change the user agent
sed -i '/USER_AGENT/ s/OWA/CBL/' build.gradle
### The following are needed to install Cable in parallel with Signal or Noise:
sed -i 's/org\.thoughtcrime\.provider\.securesms/im.cable.provider.cableim/' \
AndroidManifest.xml \
src/org/thoughtcrime/securesms/providers/PartProvider.java \
src/org/thoughtcrime/securesms/providers/MmsBodyProvider.java
sed -i 's/org\.thoughtcrime\.securesms\.ACCESS_SECRETS/im.cable.cableim.ACCESS_SECRETS/' \
AndroidManifest.xml \
src/org/thoughtcrime/securesms/service/KeyCachingService.java
# Probably deprecated and not used, could be removed altogether
sed -i 's/org\.thoughtcrime\.securesms\.permission\.C2D_MESSAGE/im.cable.cableim.permission.C2D_MESSAGE/' \
AndroidManifest.xml
### The Signal and Cable address books should be independent:
sed -i 's/vnd\.org\.thoughtcrime\.securesms\.contact/vnd.im.cable.cableim.contact/' \
AndroidManifest.xml \
res/xml/contactsformat.xml \
src/org/thoughtcrime/securesms/contacts/ContactsDatabase.java
sed -i 's/vnd\.org\.thoughtcrime\.securesms\.call/vnd.im.cable.cableim.call/' \
AndroidManifest.xml \
res/xml/contactsformat.xml \
src/org/thoughtcrime/securesms/contacts/ContactsDatabase.java
sed -i 's/"org\.thoughtcrime\.securesms"/"im.cable.cableim"/' \
src/org/thoughtcrime/securesms/util/DirectoryHelper.java \
res/xml/authenticator.xml \
res/xml/syncadapter.xml
### Change the giphy api key.
# Let's use the public beta key for now
# See: https://github.com/Giphy/GiphyAPI
sed -i 's/3o6ZsYH6U6Eri53TXy/dc6zaTOxFJmzC/' \
src/org/thoughtcrime/securesms/giph/net/GiphyGifLoader.java \
src/org/thoughtcrime/securesms/giph/net/GiphyStickerLoader.java