Skip to content

Commit

Permalink
Add "#issue_XXXX" and "#solved_XXXX" to default templates
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenlagus committed Oct 11, 2014
1 parent 64fa0b8 commit a01df8c
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -810,9 +810,7 @@ public boolean includeDeviceData() {
}

public static void checkForUpdates(Activity context) {
if (BuildVars.DEBUG_VERSION) {
UpdateManager.register(context, BuildVars.HOCKEY_APP_HASH);
}
UpdateManager.register(context, BuildVars.HOCKEY_APP_HASH);
}

public static boolean isTablet(Context context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ public static interface ChatActivityEnterViewDelegate {
private int minMessageId = Integer.MIN_VALUE;
private int maxDate = Integer.MIN_VALUE;
private static Pattern pattern = Pattern.compile("((?:[^\\s(]+\\()|(?:\\.{2}[^\\s\\.]+\\.{2}))");
private static Pattern patternContact = Pattern.compile("^contact:(\\+[0-9]+)\\s*(\\S+)\\s*([^\\n]+)(\\n|$)");
private static Pattern patternIssue = Pattern.compile("^#issue:([\\w]+)$");
private static Pattern patternIssueSolved = Pattern.compile("^^#solved:([\\w]+)$");

private int keyboardHeight = 0;
private int keyboardHeightLand = 0;
Expand Down Expand Up @@ -397,20 +400,33 @@ public boolean processSendingText(String text) {
else
text = getTrimmedString(text);
if (text.length() != 0) {
int count = (int)Math.ceil(text.length() / 2048.0f);
for (int a = 0; a < count; a++) {
String mess = text.substring(a * 2048, Math.min((a + 1) * 2048, text.length()));
Pattern pattern = Pattern.compile("^contact:(\\+[0-9]+)\\s*(\\S+)\\s*([^\\n]+)(\\n|$)");
Matcher matcher = pattern.matcher(mess);
Matcher matcher = patternIssue.matcher(text);
if (matcher.find()) {
String issueId = matcher.group(1);
String message = LocaleController.getString("IssueNoted", R.string.IssueNoted).replace("@id",issueId);
MessagesController.getInstance().sendMessage(message, dialog_id);
} else {
matcher = patternIssueSolved.matcher(text);
if (matcher.find()) {
String number = matcher.group(1);
String name = matcher.group(2);
String surname = matcher.group(3);
mess = mess.replace(matcher.group(),"");
MessagesController.getInstance().sendMessage(mess, dialog_id);
MessagesController.getInstance().sendMessageSupport(number, name, surname, dialog_id, "");
String issueId = matcher.group(1);
String message = LocaleController.getString("IssueSolved", R.string.IssueSolved).replace("@id", issueId);
MessagesController.getInstance().sendMessage(message, dialog_id);
} else {
MessagesController.getInstance().sendMessage(mess, dialog_id);
int count = (int) Math.ceil(text.length() / 2048.0f);
for (int a = 0; a < count; a++) {
String mess = text.substring(a * 2048, Math.min((a + 1) * 2048, text.length()));
matcher = patternContact.matcher(mess);
if (matcher.find()) {
String number = matcher.group(1);
String name = matcher.group(2);
String surname = matcher.group(3);
mess = mess.replace(matcher.group(), "");
MessagesController.getInstance().sendMessage(mess, dialog_id);
MessagesController.getInstance().sendMessageSupport(number, name, surname, dialog_id, "");
} else {
MessagesController.getInstance().sendMessage(mess, dialog_id);
}
}
}
}
return true;
Expand Down
1 change: 1 addition & 0 deletions TMessagesProj/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -471,5 +471,6 @@
<string name="PasswordEdited">Password saved</string>
<string name="PasswordRemoved">Password removed</string>
<string name="NoMoreResults">No more results found</string>
<string name="IssueNoted">Your issue #@id has been recorded and we get back to you as soon as it\'s fixed.\n\nSorry for the inconvenience!</string>

</resources>
1 change: 1 addition & 0 deletions TMessagesProj/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -471,4 +471,5 @@
<string name="PasswordEdited">Password saved</string>
<string name="PasswordRemoved">Password removed</string>
<string name="NoMoreResults">No more results found</string>
<string name="IssueNoted">Your issue #@id has been recorded and we get back to you as soon as it\'s fixed.\n\nSorry for the inconvenience!</string>
</resources>
7 changes: 4 additions & 3 deletions TMessagesProj/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,9 @@
<string name="template">Plantilla</string>
<string name="templatesRemoved">Todas las plantillas han sido eliminadas</string>
<string name="loadtemplatesfromfile">El archivo que deseas cargar debe tener formato KEYS-VALUE, en caso contrario, las plantillas se cargarán mal.</string>
<string name="ConversationOwnedByOther">Otro miembro de TSF está respondiendo esta pregunta, ten cuidado.</string>
<string name="ConversationOwnedByOther">Otro miembro de TSF está respondiendo este chat</string>
<string name="ConversationOwnedByMe">Tienes asignada esta conversación.</string>
<string name="ConversationOwnedNotSupported">Tu dispositivo no soporta la asignación de conversaciones, ten cuidado.</string>
<string name="ConversationOwnedNotSupported">Tu dispositivo no es compatible con "Asignar chat".</string>
<string name="ConversationOwnedDelete">Esta conversación ya no está asignada</string>
<string name="searching">Buscando...</string>
<string name="hashtags">Hashtags</string>
Expand All @@ -469,5 +469,6 @@
<string name="MinPasswordLengh">La contraseña debe tener 4 dígitos como mínimo</string>
<string name="PasswordEdited">Contraseña guardada</string>
<string name="PasswordRemoved">Contraseña eliminada</string>
<string name="NoMoreResults">No more results found</string>
<string name="NoMoreResults">Ningún resultado más</string>
<string name="IssueNoted">Your issue #@id has been recorded and we get back to you as soon as it\'s fixed.\n\nSorry for the inconvenience!</string>
</resources>
1 change: 1 addition & 0 deletions TMessagesProj/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -470,4 +470,5 @@
<string name="PasswordEdited">Password salvata</string>
<string name="PasswordRemoved">Password rimossa</string>
<string name="NoMoreResults">No more results found</string>
<string name="IssueNoted">Your issue #@id has been recorded and we get back to you as soon as it\'s fixed.\n\nSorry for the inconvenience!</string>
</resources>
1 change: 1 addition & 0 deletions TMessagesProj/src/main/res/values-nl/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -471,4 +471,5 @@
<string name="PasswordEdited">Password saved</string>
<string name="PasswordRemoved">Password removed</string>
<string name="NoMoreResults">No more results found</string>
<string name="IssueNoted">Your issue #@id has been recorded and we get back to you as soon as it\'s fixed.\n\nSorry for the inconvenience!</string>
</resources>
1 change: 1 addition & 0 deletions TMessagesProj/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -471,4 +471,5 @@
<string name="PasswordEdited">Password saved</string>
<string name="PasswordRemoved">Password removed</string>
<string name="NoMoreResults">No more results found</string>
<string name="IssueNoted">Your issue #@id has been recorded and we get back to you as soon as it\'s fixed.\n\nSorry for the inconvenience!</string>
</resources>
1 change: 1 addition & 0 deletions TMessagesProj/src/main/res/values-pt-rPT/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -475,4 +475,5 @@
<string name="PasswordEdited">Password saved</string>
<string name="PasswordRemoved">Password removed</string>
<string name="NoMoreResults">No more results found</string>
<string name="IssueNoted">Your issue #@id has been recorded and we get back to you as soon as it\'s fixed.\n\nSorry for the inconvenience!</string>
</resources>
3 changes: 2 additions & 1 deletion TMessagesProj/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -470,5 +470,6 @@
<string name="PasswordEdited">Password saved</string>
<string name="PasswordRemoved">Password removed</string>
<string name="NoMoreResults">No more results found</string>

<string name="IssueNoted">Your issue #issue_@id has been recorded and we get back to you as soon as it\'s fixed.\n\nSorry for the inconvenience!</string>
<string name="IssueSolved">Hello there!\n\nJust a quick info that we were able to fix your issue #issue_@id.\n\nSorry for the delay. Please update Telegram as soon as possible to get our latest version and let us know if you have any further questions.</string>
</resources>

0 comments on commit a01df8c

Please sign in to comment.