Merge branch 'develop' into julioromano/poll_history_entry_point

This commit is contained in:
ganfra 2023-12-13 17:22:55 +01:00
commit 72cdc0eee0
738 changed files with 9387 additions and 1581 deletions

View file

@ -38,7 +38,7 @@ if (requiresChangelog) {
const changelogFiles = editedFiles.filter(file => file.startsWith("changelog.d/"))
if (changelogFiles.length == 0) {
warn("Please add a changelog. See instructions [here](https://github.com/vector-im/element-android/blob/develop/CONTRIBUTING.md#changelog)")
warn("Please add a changelog. See instructions [here](https://github.com/element-hq/element-android/blob/develop/CONTRIBUTING.md#changelog)")
} else {
const validTowncrierExtensions = [
"bugfix",
@ -48,7 +48,7 @@ if (requiresChangelog) {
"wip",
]
if (!changelogFiles.every(file => validTowncrierExtensions.includes(file.split(".").pop()))) {
fail("Invalid extension for changelog. See instructions [here](https://github.com/vector-im/element-android/blob/develop/CONTRIBUTING.md#changelog)")
fail("Invalid extension for changelog. See instructions [here](https://github.com/element-hq/element-android/blob/develop/CONTRIBUTING.md#changelog)")
}
}
}
@ -107,11 +107,11 @@ if (allowList.includes(user)) {
signoff_unneeded("allow-list")
} else {
// github.api.rest.orgs.checkMembershipForUser({
// org: "vector-im",
// org: "element-hq",
// username: user,
// }).then((result) => {
github.api.rest.teams.getMembershipForUserInOrg({
org: "vector-im",
org: "element-hq",
team_slug: "vector-core",
username: user,
}).then((result) => {
@ -172,7 +172,7 @@ const translationAllowList = [
if (!translationAllowList.includes(user)) {
if (editedFiles.some(file => file.endsWith("strings.xml") && !file.endsWith("values/strings.xml"))) {
fail("Some translation files have been edited. Only user `RiotTranslateBot` (i.e. translations coming from Weblate) or `github-actions[bot]` (i.e. translations coming from automation) are allowed to do that.\nPlease read more about translations management [in the doc](https://github.com/vector-im/element-android/blob/develop/CONTRIBUTING.md#internationalisation).")
fail("Some translation files have been edited. Only user `RiotTranslateBot` (i.e. translations coming from Weblate) or `github-actions[bot]` (i.e. translations coming from automation) are allowed to do that.\nPlease read more about translations management [in the doc](https://github.com/element-hq/element-android/blob/develop/CONTRIBUTING.md#internationalisation).")
}
// Check that new strings are not added to `values/strings.xml`

View file

@ -65,7 +65,7 @@ if args.verbose:
print(args)
# Split the artifact URL to get information
# Ex: https://github.com/vector-im/element-android/suites/9293388174/artifacts/435942121
# Ex: https://github.com/element-hq/element-android/suites/9293388174/artifacts/435942121
artifactUrl = args.artifactUrl
if not artifactUrl.startswith('https://github.com/'):
print("❌ Invalid parameter --artifactUrl %s. Must start with 'https://github.com/'" % artifactUrl)

View file

@ -116,7 +116,8 @@
"screen_dm_details_.*",
"screen_room_notification_settings_.*",
"screen_notification_settings_edit_failed_updating_default_mode",
"screen_polls_history_title"
"screen_polls_history_title",
"screen_start_chat_error_starting_chat"
]
},
{

View file

@ -46,6 +46,14 @@ if [[ $allFiles == 1 ]]; then
find . -name 'translations.xml' -print0 -exec bash -c "echo \"\" >> \"{}\"" \; >> /dev/null
fi
set +e
echo "Moving files from values-id to values-in..."
find . -type d -name 'values-id' -execdir mv {}/translations.xml {}/../values-in/translations.xml 2> /dev/null \;
echo "Deleting all the folders values-id..."
find . -type d -name 'values-id' -exec rm -rf {} 2> /dev/null \;
set -e
echo "Removing the generated config"
rm ./tools/localazy/localazy.json

View file

@ -31,7 +31,7 @@ baseAction = {
}
}
# Store all regex specific to module, to eclude the corresponding keyx from the common string module
# Store all regex specific to module, to exclude the corresponding key from the common string module
allRegexToExcludeFromMainModule = []
# All actions that will be serialized in the localazy config
allActions = []

View file

@ -166,7 +166,7 @@ printf -v versionMinor2Digits "%02d" ${versionMinor}
printf -v versionPatch2Digits "%02d" ${versionPatch}
fastlaneFile="4${versionMajor2Digits}${versionMinor2Digits}${versionPatch2Digits}0.txt"
fastlanePathFile="./fastlane/metadata/android/en-US/changelogs/${fastlaneFile}"
printf "Main changes in this version: TODO.\nFull changelog: https://github.com/vector-im/element-x-android/releases" > ${fastlanePathFile}
printf "Main changes in this version: TODO.\nFull changelog: https://github.com/element-hq/element-x-android/releases" > ${fastlanePathFile}
read -p "I have created the file ${fastlanePathFile}, please edit it and press enter to continue. "
git add ${fastlanePathFile}
@ -217,7 +217,7 @@ else
fi
printf "\n================================================================================\n"
printf "Wait for the GitHub action https://github.com/vector-im/element-x-android/actions/workflows/release.yml?query=branch%%3Amain to build the 'main' branch.\n"
printf "Wait for the GitHub action https://github.com/element-hq/element-x-android/actions/workflows/release.yml?query=branch%%3Amain to build the 'main' branch.\n"
read -p "After GHA is finished, please enter the artifact URL (for 'elementx-app-bundle-unsigned'): " artifactUrl
printf "\n================================================================================\n"
@ -292,7 +292,7 @@ else
fi
printf "\n================================================================================\n"
githubCreateReleaseLink="https://github.com/vector-im/element-x-android/releases/new?tag=v${version}&title=Element%20X%20Android%20v${version}&body=${changelogUrlEncoded}"
githubCreateReleaseLink="https://github.com/element-hq/element-x-android/releases/new?tag=v${version}&title=Element%20X%20Android%20v${version}&body=${changelogUrlEncoded}"
printf "Creating the release on gitHub.\n"
printf -- "Open this link: %s\n" ${githubCreateReleaseLink}
printf "Then\n"
@ -303,7 +303,7 @@ read -p ". Press enter to continue. "
printf "\n================================================================================\n"
printf "Message for the Android internal room:\n\n"
message="@room Element X Android ${version} is ready to be tested. You can get it from https://github.com/vector-im/element-x-android/releases/tag/v${version}. Installation instructions can be found [here](https://github.com/vector-im/element-x-android/blob/develop/docs/install_from_github_release.md). Please report any feedback. Thanks!"
message="@room Element X Android ${version} is ready to be tested. You can get it from https://github.com/element-hq/element-x-android/releases/tag/v${version}. Installation instructions can be found [here](https://github.com/element-hq/element-x-android/blob/develop/docs/install_from_github_release.md). Please report any feedback. Thanks!"
printf "${message}\n\n"
if [[ -z "${elementBotToken}" ]]; then

83
tools/sas/import_sas_emojis.py Executable file
View file

@ -0,0 +1,83 @@
#!/usr/bin/env python3
# Copyright (c) 2020 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import argparse
import json
import os
import os.path
# Run `pip3 install requests` if not installed yet
import requests
### Arguments
parser = argparse.ArgumentParser(description='Download sas string from matrix-doc.')
parser.add_argument('-v',
'--verbose',
help="increase output verbosity.",
action="store_true")
args = parser.parse_args()
if args.verbose:
print("Argument:")
print(args)
base_url = "https://raw.githubusercontent.com/matrix-org/matrix-spec/main/data-definitions/sas-emoji.json"
base_emoji_url = "https://raw.githubusercontent.com/twitter/twemoji/master/assets/svg/"
print("Downloading " + base_url + "")
r0 = requests.get(base_url)
data0 = json.loads(r0.content.decode())
if args.verbose:
print("Json data:")
print(data0)
print()
scripts_dir = os.path.dirname(os.path.abspath(__file__))
data_defs_dir = os.path.join(scripts_dir, "../../tmp/emoji/")
def handle_emoji(dict):
print("Handle emoji " + str(dict["number"]) + " (" + dict["description"] + ")…")
if args.verbose:
print("With")
print(dict)
# Transform dict["unicode"] from "U+2601U+FE0F" to "2601U"
emoji = dict["unicode"].split("U+")[1].lower()
url = base_emoji_url + emoji + ".svg"
file = os.path.join(data_defs_dir, "ic_verification_" + format(dict["number"], '02d') + ".svg")
print("Downloading " + url + " to " + file + "")
r = requests.get(url)
if r.status_code != 200:
print("Fatal: " + str(r.status_code))
# Stop script with error
sys.exit(1)
os.makedirs(os.path.dirname(file), exist_ok=True)
with open(file, "w") as f:
f.write(r.content.decode())
for emoji in data0:
handle_emoji(emoji)
print()
print("Success!")
print()
print("To convert to vector drawable, download tool from https://www.androiddesignpatterns.com/2018/11/android-studio-svg-to-vector-cli.html")
print("unzip it, and run:")
print("vd-tool/bin/vd-tool -c -in ./tmp/emoji -out features/verifysession/impl/src/main/res/drawable")

113
tools/sas/import_sas_strings.py Executable file
View file

@ -0,0 +1,113 @@
#!/usr/bin/env python3
# Copyright (c) 2020 New Vector Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import argparse
import json
import os
import os.path
# Run `pip3 install requests` if not installed yet
import requests
### Arguments
parser = argparse.ArgumentParser(description='Download sas string from matrix-doc.')
parser.add_argument('-v',
'--verbose',
help="increase output verbosity.",
action="store_true")
args = parser.parse_args()
if args.verbose:
print("Argument:")
print(args)
base_url = "https://raw.githubusercontent.com/matrix-org/matrix-spec/main/data-definitions/sas-emoji.json"
print("Downloading " + base_url + "")
r0 = requests.get(base_url)
data0 = json.loads(r0.content.decode())
if args.verbose:
print("Json data:")
print(data0)
print()
# number -> translation
default = dict()
# Language -> emoji -> translation
cumul = dict()
for emoji in data0:
d = dict()
number = emoji["number"]
d["description"] = emoji["description"]
d["emoji"] = emoji["emoji"]
d["unicode"] = emoji["unicode"]
if args.verbose:
print("Dict: " + str(d))
default[number] = d
for lang in emoji["translated_descriptions"]:
if args.verbose:
print("Lang: " + lang)
if not (lang in cumul):
cumul[lang] = dict()
d = dict()
d["description"] = emoji["translated_descriptions"][lang]
cumul[lang][number] = d
if args.verbose:
print(default)
print(cumul)
def write_file(file, dict):
print("Writing file " + file)
if args.verbose:
print("With")
print(dict)
os.makedirs(os.path.dirname(file), exist_ok=True)
with open(file, mode="w", encoding="utf8") as o:
o.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
o.write("<resources>\n")
o.write(" <!-- Generated file, do not edit -->\n")
for key in dict:
if dict[key] is None:
continue
if dict[key]["description"] is None:
continue
o.write(" <string name=\"verification_emoji_" + format(key, '02d') + "\">" + dict[key]["description"].replace("'", "\\'") + "</string>\n")
o.write("</resources>\n")
scripts_dir = os.path.dirname(os.path.abspath(__file__))
data_defs_dir = os.path.join(scripts_dir, "../../features/verifysession/impl/src/main/res")
# Write default file
write_file(os.path.join(data_defs_dir, "values/strings_sas.xml"), default)
# Write each language file
for lang in cumul:
androidLang = lang \
.replace("_", "-r") \
.replace("zh-rHans", "zh-rCN") \
.replace("zh-rHant", "zh-rTW") \
.replace("id", "in")
write_file(os.path.join(data_defs_dir, "values-" + androidLang + "/strings_sas.xml"), cumul[lang])
print()
print("Success!")