mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Remove unused Phone stuff.
This commit is contained in:
@@ -1,123 +0,0 @@
|
||||
// Copyright (c) 2012, Rick Maddy
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package org.telegram.PhoneFormat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class CallingCodeInfo {
|
||||
public ArrayList<String> countries = new ArrayList<>();
|
||||
public String callingCode = "";
|
||||
public ArrayList<String> trunkPrefixes = new ArrayList<>();
|
||||
public ArrayList<String> intlPrefixes = new ArrayList<>();
|
||||
public ArrayList<RuleSet> ruleSets = new ArrayList<>();
|
||||
//public ArrayList formatStrings;
|
||||
|
||||
String matchingAccessCode(String str) {
|
||||
for (String code : intlPrefixes) {
|
||||
if (str.startsWith(code)) {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
String matchingTrunkCode(String str) {
|
||||
for (String code : trunkPrefixes) {
|
||||
if (str.startsWith(code)) {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
String format(String orig) {
|
||||
String str = orig;
|
||||
String trunkPrefix = null;
|
||||
String intlPrefix = null;
|
||||
if (str.startsWith(callingCode)) {
|
||||
intlPrefix = callingCode;
|
||||
str = str.substring(intlPrefix.length());
|
||||
} else {
|
||||
String trunk = matchingTrunkCode(str);
|
||||
if (trunk != null) {
|
||||
trunkPrefix = trunk;
|
||||
str = str.substring(trunkPrefix.length());
|
||||
}
|
||||
}
|
||||
|
||||
for (RuleSet set : ruleSets) {
|
||||
String phone = set.format(str, intlPrefix, trunkPrefix, true);
|
||||
if (phone != null) {
|
||||
return phone;
|
||||
}
|
||||
}
|
||||
|
||||
for (RuleSet set : ruleSets) {
|
||||
String phone = set.format(str, intlPrefix, trunkPrefix, false);
|
||||
if (phone != null) {
|
||||
return phone;
|
||||
}
|
||||
}
|
||||
|
||||
if (intlPrefix != null && str.length() != 0) {
|
||||
return String.format("%s %s", intlPrefix, str);
|
||||
}
|
||||
|
||||
return orig;
|
||||
}
|
||||
|
||||
boolean isValidPhoneNumber(String orig) {
|
||||
String str = orig;
|
||||
String trunkPrefix = null;
|
||||
String intlPrefix = null;
|
||||
if (str.startsWith(callingCode)) {
|
||||
intlPrefix = callingCode;
|
||||
str = str.substring(intlPrefix.length());
|
||||
} else {
|
||||
String trunk = matchingTrunkCode(str);
|
||||
if (trunk != null) {
|
||||
trunkPrefix = trunk;
|
||||
str = str.substring(trunkPrefix.length());
|
||||
}
|
||||
}
|
||||
|
||||
for (RuleSet set : ruleSets) {
|
||||
boolean valid = set.isValid(str, intlPrefix, trunkPrefix, true);
|
||||
if (valid) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (RuleSet set : ruleSets) {
|
||||
boolean valid = set.isValid(str, intlPrefix, trunkPrefix, false);
|
||||
if (valid) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,417 +0,0 @@
|
||||
// Copyright (c) 2012, Rick Maddy
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package org.telegram.PhoneFormat;
|
||||
|
||||
import org.telegram.messenger.ApplicationLoader;
|
||||
import org.telegram.messenger.FileLog;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
public class PhoneFormat {
|
||||
public byte[] data;
|
||||
private boolean initialzed = false;
|
||||
public ByteBuffer buffer;
|
||||
public String defaultCountry;
|
||||
public String defaultCallingCode;
|
||||
public HashMap<String, Integer> callingCodeOffsets;
|
||||
public HashMap<String, ArrayList<String>> callingCodeCountries;
|
||||
public HashMap<String, CallingCodeInfo> callingCodeData;
|
||||
public HashMap<String, String> countryCallingCode;
|
||||
|
||||
private static volatile PhoneFormat Instance = null;
|
||||
public static PhoneFormat getInstance() {
|
||||
PhoneFormat localInstance = Instance;
|
||||
if (localInstance == null) {
|
||||
synchronized (PhoneFormat.class) {
|
||||
localInstance = Instance;
|
||||
if (localInstance == null) {
|
||||
Instance = localInstance = new PhoneFormat();
|
||||
}
|
||||
}
|
||||
}
|
||||
return localInstance;
|
||||
}
|
||||
|
||||
public static String strip(String str) {
|
||||
StringBuilder res = new StringBuilder(str);
|
||||
String phoneChars = "0123456789+*#";
|
||||
for (int i = res.length() - 1; i >= 0; i--) {
|
||||
if (!phoneChars.contains(res.substring(i, i + 1))) {
|
||||
res.deleteCharAt(i);
|
||||
}
|
||||
}
|
||||
return res.toString();
|
||||
}
|
||||
|
||||
public static String stripExceptNumbers(String str, boolean includePlus) {
|
||||
StringBuilder res = new StringBuilder(str);
|
||||
String phoneChars = "0123456789";
|
||||
if (includePlus) {
|
||||
phoneChars += "+";
|
||||
}
|
||||
for (int i = res.length() - 1; i >= 0; i--) {
|
||||
if (!phoneChars.contains(res.substring(i, i + 1))) {
|
||||
res.deleteCharAt(i);
|
||||
}
|
||||
}
|
||||
return res.toString();
|
||||
}
|
||||
|
||||
public static String stripExceptNumbers(String str) {
|
||||
return stripExceptNumbers(str, false);
|
||||
}
|
||||
|
||||
public PhoneFormat() {
|
||||
init(null);
|
||||
}
|
||||
|
||||
public PhoneFormat(String countryCode) {
|
||||
init(countryCode);
|
||||
}
|
||||
|
||||
public void init(String countryCode) {
|
||||
InputStream stream = null;
|
||||
ByteArrayOutputStream bos = null;
|
||||
try {
|
||||
stream = ApplicationLoader.applicationContext.getAssets().open("PhoneFormats.dat");
|
||||
bos = new ByteArrayOutputStream();
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = stream.read(buf, 0, 1024)) != -1) {
|
||||
bos.write(buf, 0, len);
|
||||
}
|
||||
data = bos.toByteArray();
|
||||
buffer = ByteBuffer.wrap(data);
|
||||
buffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
} finally {
|
||||
try {
|
||||
if (bos != null) {
|
||||
bos.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
}
|
||||
try {
|
||||
if (stream != null) {
|
||||
stream.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
}
|
||||
}
|
||||
|
||||
if (countryCode != null && countryCode.length() != 0) {
|
||||
defaultCountry = countryCode;
|
||||
} else {
|
||||
Locale loc = Locale.getDefault();
|
||||
defaultCountry = loc.getCountry().toLowerCase();
|
||||
}
|
||||
callingCodeOffsets = new HashMap<>(255);
|
||||
callingCodeCountries = new HashMap<>(255);
|
||||
callingCodeData = new HashMap<>(10);
|
||||
countryCallingCode = new HashMap<>(255);
|
||||
|
||||
parseDataHeader();
|
||||
initialzed = true;
|
||||
}
|
||||
|
||||
public String defaultCallingCode() {
|
||||
return callingCodeForCountryCode(defaultCountry);
|
||||
}
|
||||
|
||||
public String callingCodeForCountryCode(String countryCode) {
|
||||
return countryCallingCode.get(countryCode.toLowerCase());
|
||||
}
|
||||
|
||||
public ArrayList countriesForCallingCode(String callingCode) {
|
||||
if (callingCode.startsWith("+")) {
|
||||
callingCode = callingCode.substring(1);
|
||||
}
|
||||
|
||||
return callingCodeCountries.get(callingCode);
|
||||
}
|
||||
|
||||
public CallingCodeInfo findCallingCodeInfo(String str) {
|
||||
CallingCodeInfo res = null;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (i < str.length()) {
|
||||
res = callingCodeInfo(str.substring(0, i + 1));
|
||||
if (res != null) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public String format(String orig) {
|
||||
if (!initialzed) {
|
||||
return orig;
|
||||
}
|
||||
try {
|
||||
String str = strip(orig);
|
||||
|
||||
if (str.startsWith("+")) {
|
||||
String rest = str.substring(1);
|
||||
CallingCodeInfo info = findCallingCodeInfo(rest);
|
||||
if (info != null) {
|
||||
String phone = info.format(rest);
|
||||
return "+" + phone;
|
||||
} else {
|
||||
return orig;
|
||||
}
|
||||
} else {
|
||||
CallingCodeInfo info = callingCodeInfo(defaultCallingCode);
|
||||
if (info == null) {
|
||||
return orig;
|
||||
}
|
||||
|
||||
String accessCode = info.matchingAccessCode(str);
|
||||
if (accessCode != null) {
|
||||
String rest = str.substring(accessCode.length());
|
||||
String phone = rest;
|
||||
CallingCodeInfo info2 = findCallingCodeInfo(rest);
|
||||
if (info2 != null) {
|
||||
phone = info2.format(rest);
|
||||
}
|
||||
|
||||
if (phone.length() == 0) {
|
||||
return accessCode;
|
||||
} else {
|
||||
return String.format("%s %s", accessCode, phone);
|
||||
}
|
||||
} else {
|
||||
return info.format(str);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
return orig;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isPhoneNumberValid(String phoneNumber) {
|
||||
if (!initialzed) {
|
||||
return true;
|
||||
}
|
||||
String str = strip(phoneNumber);
|
||||
|
||||
if (str.startsWith("+")) {
|
||||
String rest = str.substring(1);
|
||||
CallingCodeInfo info = findCallingCodeInfo(rest);
|
||||
return info != null && info.isValidPhoneNumber(rest);
|
||||
} else {
|
||||
CallingCodeInfo info = callingCodeInfo(defaultCallingCode);
|
||||
if (info == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String accessCode = info.matchingAccessCode(str);
|
||||
if (accessCode != null) {
|
||||
String rest = str.substring(accessCode.length());
|
||||
if (rest.length() != 0) {
|
||||
CallingCodeInfo info2 = findCallingCodeInfo(rest);
|
||||
return info2 != null && info2.isValidPhoneNumber(rest);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return info.isValidPhoneNumber(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int value32(int offset) {
|
||||
if (offset + 4 <= data.length) {
|
||||
buffer.position(offset);
|
||||
return buffer.getInt();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
short value16(int offset) {
|
||||
if (offset + 2 <= data.length) {
|
||||
buffer.position(offset);
|
||||
return buffer.getShort();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public String valueString(int offset) {
|
||||
try {
|
||||
for (int a = offset; a < data.length; a++) {
|
||||
if (data[a] == '\0') {
|
||||
if (offset == a - offset) {
|
||||
return "";
|
||||
}
|
||||
return new String(data, offset, a - offset);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public CallingCodeInfo callingCodeInfo(String callingCode) {
|
||||
CallingCodeInfo res = callingCodeData.get(callingCode);
|
||||
if (res == null) {
|
||||
Integer num = callingCodeOffsets.get(callingCode);
|
||||
if (num != null) {
|
||||
final byte[] bytes = data;
|
||||
int start = num;
|
||||
int offset = start;
|
||||
res = new CallingCodeInfo();
|
||||
res.callingCode = callingCode;
|
||||
res.countries = callingCodeCountries.get(callingCode);
|
||||
callingCodeData.put(callingCode, res);
|
||||
|
||||
int block1Len = value16(offset);
|
||||
offset += 2;
|
||||
|
||||
offset += 2;
|
||||
int block2Len = value16(offset);
|
||||
offset += 2;
|
||||
|
||||
offset += 2;
|
||||
int setCnt = value16(offset);
|
||||
offset += 2;
|
||||
|
||||
offset += 2;
|
||||
|
||||
ArrayList<String> strs = new ArrayList<>(5);
|
||||
String str;
|
||||
while ((str = valueString(offset)).length() != 0) {
|
||||
strs.add(str);
|
||||
offset += str.length() + 1;
|
||||
}
|
||||
res.trunkPrefixes = strs;
|
||||
offset++;
|
||||
|
||||
strs = new ArrayList<>(5);
|
||||
while ((str = valueString(offset)).length() != 0) {
|
||||
strs.add(str);
|
||||
offset += str.length() + 1;
|
||||
}
|
||||
res.intlPrefixes = strs;
|
||||
|
||||
ArrayList<RuleSet> ruleSets = new ArrayList<>(setCnt);
|
||||
offset = start + block1Len;
|
||||
for (int s = 0; s < setCnt; s++) {
|
||||
RuleSet ruleSet = new RuleSet();
|
||||
ruleSet.matchLen = value16(offset);
|
||||
offset += 2;
|
||||
int ruleCnt = value16(offset);
|
||||
offset += 2;
|
||||
ArrayList<PhoneRule> rules = new ArrayList<>(ruleCnt);
|
||||
for (int r = 0; r < ruleCnt; r++) {
|
||||
PhoneRule rule = new PhoneRule();
|
||||
rule.minVal = value32(offset);
|
||||
offset += 4;
|
||||
rule.maxVal = value32(offset);
|
||||
offset += 4;
|
||||
rule.byte8 = (int)bytes[offset++];
|
||||
rule.maxLen = (int)bytes[offset++];
|
||||
rule.otherFlag = (int)bytes[offset++];
|
||||
rule.prefixLen = (int)bytes[offset++];
|
||||
rule.flag12 = (int)bytes[offset++];
|
||||
rule.flag13 = (int)bytes[offset++];
|
||||
int strOffset = value16(offset);
|
||||
offset += 2;
|
||||
rule.format = valueString(start + block1Len + block2Len + strOffset);
|
||||
|
||||
int openPos = rule.format.indexOf("[[");
|
||||
if (openPos != -1) {
|
||||
int closePos = rule.format.indexOf("]]");
|
||||
rule.format = String.format("%s%s", rule.format.substring(0, openPos), rule.format.substring(closePos + 2));
|
||||
}
|
||||
|
||||
rules.add(rule);
|
||||
|
||||
if (rule.hasIntlPrefix) {
|
||||
ruleSet.hasRuleWithIntlPrefix = true;
|
||||
}
|
||||
if (rule.hasTrunkPrefix) {
|
||||
ruleSet.hasRuleWithTrunkPrefix = true;
|
||||
}
|
||||
}
|
||||
ruleSet.rules = rules;
|
||||
ruleSets.add(ruleSet);
|
||||
}
|
||||
res.ruleSets = ruleSets;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public void parseDataHeader() {
|
||||
int count = value32(0);
|
||||
int base = count * 12 + 4;
|
||||
int spot = 4;
|
||||
for (int i = 0; i < count; i++) {
|
||||
String callingCode = valueString(spot);
|
||||
spot += 4;
|
||||
String country = valueString(spot);
|
||||
spot += 4;
|
||||
int offset = value32(spot) + base;
|
||||
spot += 4;
|
||||
|
||||
if (country.equals(defaultCountry)) {
|
||||
defaultCallingCode = callingCode;
|
||||
}
|
||||
|
||||
countryCallingCode.put(country, callingCode);
|
||||
|
||||
callingCodeOffsets.put(callingCode, offset);
|
||||
ArrayList<String> countries = callingCodeCountries.get(callingCode);
|
||||
if (countries == null) {
|
||||
countries = new ArrayList<>();
|
||||
callingCodeCountries.put(callingCode, countries);
|
||||
}
|
||||
countries.add(country);
|
||||
}
|
||||
|
||||
if (defaultCallingCode != null) {
|
||||
callingCodeInfo(defaultCallingCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
// Copyright (c) 2012, Rick Maddy
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package org.telegram.PhoneFormat;
|
||||
|
||||
public class PhoneRule {
|
||||
public int minVal;
|
||||
public int maxVal;
|
||||
public int byte8;
|
||||
public int maxLen;
|
||||
public int otherFlag;
|
||||
public int prefixLen;
|
||||
public int flag12;
|
||||
public int flag13;
|
||||
public String format;
|
||||
public boolean hasIntlPrefix;
|
||||
public boolean hasTrunkPrefix;
|
||||
|
||||
String format(String str, String intlPrefix, String trunkPrefix) {
|
||||
boolean hadC = false;
|
||||
boolean hadN = false;
|
||||
boolean hasOpen = false;
|
||||
int spot = 0;
|
||||
StringBuilder res = new StringBuilder(20);
|
||||
for (int i = 0; i < format.length(); i++) {
|
||||
char ch = format.charAt(i);
|
||||
switch (ch) {
|
||||
case 'c':
|
||||
hadC = true;
|
||||
if (intlPrefix != null) {
|
||||
res.append(intlPrefix);
|
||||
}
|
||||
break;
|
||||
case 'n':
|
||||
hadN = true;
|
||||
if (trunkPrefix != null) {
|
||||
res.append(trunkPrefix);
|
||||
}
|
||||
break;
|
||||
case '#':
|
||||
if (spot < str.length()) {
|
||||
res.append(str.substring(spot, spot + 1));
|
||||
spot++;
|
||||
} else if (hasOpen) {
|
||||
res.append(" ");
|
||||
}
|
||||
break;
|
||||
case '(':
|
||||
if (spot < str.length()) {
|
||||
hasOpen = true;
|
||||
}
|
||||
default:
|
||||
if (!(ch == ' ' && i > 0 && ((format.charAt(i - 1) == 'n' && trunkPrefix == null) || (format.charAt(i - 1) == 'c' && intlPrefix == null)))) {
|
||||
if (spot < str.length() || (hasOpen && ch == ')')) {
|
||||
res.append(format.substring(i, i + 1));
|
||||
if (ch == ')') {
|
||||
hasOpen = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (intlPrefix != null && !hadC) {
|
||||
res.insert(0, String.format("%s ", intlPrefix));
|
||||
} else if (trunkPrefix != null && !hadN) {
|
||||
res.insert(0, trunkPrefix);
|
||||
}
|
||||
|
||||
return res.toString();
|
||||
}
|
||||
|
||||
boolean hasIntlPrefix() {
|
||||
return (flag12 & 0x02) != 0;
|
||||
}
|
||||
|
||||
boolean hasTrunkPrefix() {
|
||||
return (flag12 & 0x01) != 0;
|
||||
}
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
// Copyright (c) 2012, Rick Maddy
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package org.telegram.PhoneFormat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class RuleSet {
|
||||
public int matchLen;
|
||||
public ArrayList<PhoneRule> rules = new ArrayList<PhoneRule>();
|
||||
public boolean hasRuleWithIntlPrefix;
|
||||
public boolean hasRuleWithTrunkPrefix;
|
||||
public static Pattern pattern = Pattern.compile("[0-9]+");
|
||||
|
||||
String format(String str, String intlPrefix, String trunkPrefix, boolean prefixRequired) {
|
||||
if (str.length() >= matchLen) {
|
||||
String begin = str.substring(0, matchLen);
|
||||
|
||||
int val = 0;
|
||||
Matcher matcher = pattern.matcher(begin);
|
||||
if (matcher.find()) {
|
||||
String num = matcher.group(0);
|
||||
val = Integer.parseInt(num);
|
||||
}
|
||||
|
||||
for (PhoneRule rule : rules) {
|
||||
if (val >= rule.minVal && val <= rule.maxVal && str.length() <= rule.maxLen) {
|
||||
if (prefixRequired) {
|
||||
if (((rule.flag12 & 0x03) == 0 && trunkPrefix == null && intlPrefix == null) || (trunkPrefix != null && (rule.flag12 & 0x01) != 0) || (intlPrefix != null && (rule.flag12 & 0x02) != 0)) {
|
||||
return rule.format(str, intlPrefix, trunkPrefix);
|
||||
}
|
||||
} else {
|
||||
if ((trunkPrefix == null && intlPrefix == null) || (trunkPrefix != null && (rule.flag12 & 0x01) != 0) || (intlPrefix != null && (rule.flag12 & 0x02) != 0)) {
|
||||
return rule.format(str, intlPrefix, trunkPrefix);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!prefixRequired) {
|
||||
if (intlPrefix != null) {
|
||||
for (PhoneRule rule : rules) {
|
||||
if (val >= rule.minVal && val <= rule.maxVal && str.length() <= rule.maxLen) {
|
||||
if (trunkPrefix == null || (rule.flag12 & 0x01) != 0) {
|
||||
return rule.format(str, intlPrefix, trunkPrefix);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (trunkPrefix != null) {
|
||||
for (PhoneRule rule : rules) {
|
||||
if (val >= rule.minVal && val <= rule.maxVal && str.length() <= rule.maxLen) {
|
||||
if (intlPrefix == null || (rule.flag12 & 0x02) != 0) {
|
||||
return rule.format(str, intlPrefix, trunkPrefix);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
boolean isValid(String str, String intlPrefix, String trunkPrefix, boolean prefixRequired) {
|
||||
if (str.length() >= matchLen) {
|
||||
String begin = str.substring(0, matchLen);
|
||||
int val = 0;
|
||||
Matcher matcher = pattern.matcher(begin);
|
||||
if (matcher.find()) {
|
||||
String num = matcher.group(0);
|
||||
val = Integer.parseInt(num);
|
||||
}
|
||||
|
||||
for (PhoneRule rule : rules) {
|
||||
if (val >= rule.minVal && val <= rule.maxVal && str.length() == rule.maxLen) {
|
||||
if (prefixRequired) {
|
||||
if (((rule.flag12 & 0x03) == 0 && trunkPrefix == null && intlPrefix == null) || (trunkPrefix != null && (rule.flag12 & 0x01) != 0) || (intlPrefix != null && (rule.flag12 & 0x02) != 0)) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if ((trunkPrefix == null && intlPrefix == null) || (trunkPrefix != null && (rule.flag12 & 0x01) != 0) || (intlPrefix != null && (rule.flag12 & 0x02) != 0)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!prefixRequired) {
|
||||
if (intlPrefix != null && !hasRuleWithIntlPrefix) {
|
||||
for (PhoneRule rule : rules) {
|
||||
if (val >= rule.minVal && val <= rule.maxVal && str.length() == rule.maxLen) {
|
||||
if (trunkPrefix == null || (rule.flag12 & 0x01) != 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (trunkPrefix != null && !hasRuleWithTrunkPrefix) {
|
||||
for (PhoneRule rule : rules) {
|
||||
if (val >= rule.minVal && val <= rule.maxVal && str.length() == rule.maxLen) {
|
||||
if (intlPrefix == null || (rule.flag12 & 0x02) != 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* This is the source code of Telegram for Android v. 3.x.x.
|
||||
* It is licensed under GNU GPL v. 2 or later.
|
||||
* You should have received a copy of the license in this archive (see LICENSE).
|
||||
*
|
||||
* Copyright Nikolai Kudashov, 2013-2016.
|
||||
*/
|
||||
|
||||
package org.telegram.messenger;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.telephony.PhoneStateListener;
|
||||
import android.telephony.TelephonyManager;
|
||||
|
||||
import org.telegram.PhoneFormat.PhoneFormat;
|
||||
|
||||
public class CallReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(final Context context, Intent intent) {
|
||||
TelephonyManager telephony = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
telephony.listen(new PhoneStateListener() {
|
||||
@Override
|
||||
public void onCallStateChanged(int state, String incomingNumber) {
|
||||
super.onCallStateChanged(state, incomingNumber);
|
||||
if (state == 1 && incomingNumber != null && incomingNumber.length() > 0) {
|
||||
NotificationCenter.getInstance().postNotificationName(NotificationCenter.didReceiveCall, PhoneFormat.stripExceptNumbers(incomingNumber));
|
||||
}
|
||||
}
|
||||
}, PhoneStateListener.LISTEN_CALL_STATE);
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,6 @@ import android.provider.ContactsContract;
|
||||
import android.text.TextUtils;
|
||||
import android.util.SparseArray;
|
||||
|
||||
import org.telegram.PhoneFormat.PhoneFormat;
|
||||
import org.telegram.tgnet.ConnectionsManager;
|
||||
import org.telegram.tgnet.RequestDelegate;
|
||||
import org.telegram.tgnet.TLObject;
|
||||
@@ -376,7 +375,7 @@ public class ContactsController {
|
||||
if (number == null || number.length() == 0) {
|
||||
continue;
|
||||
}
|
||||
number = PhoneFormat.stripExceptNumbers(number, true);
|
||||
number = "";//PhoneFormat.stripExceptNumbers(number, true);
|
||||
if (number.length() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import android.text.TextUtils;
|
||||
import android.util.SparseArray;
|
||||
import android.util.SparseIntArray;
|
||||
|
||||
import org.telegram.PhoneFormat.PhoneFormat;
|
||||
import org.telegram.SQLite.SQLiteCursor;
|
||||
import org.telegram.SQLite.SQLiteDatabase;
|
||||
import org.telegram.SQLite.SQLitePreparedStatement;
|
||||
@@ -2228,7 +2227,7 @@ public class MessagesStorage {
|
||||
continue;
|
||||
}
|
||||
if (sphone.length() == 8 && phone.length() != 8) {
|
||||
sphone = PhoneFormat.stripExceptNumbers(phone);
|
||||
sphone = "";//PhoneFormat.stripExceptNumbers(phone);
|
||||
}
|
||||
contact.shortPhones.add(sphone);
|
||||
contact.phoneDeleted.add(cursor.intValue(5));
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
package org.telegram.messenger;
|
||||
|
||||
import org.telegram.PhoneFormat.PhoneFormat;
|
||||
import org.telegram.tgnet.TLRPC;
|
||||
|
||||
public class UserObject {
|
||||
@@ -30,7 +29,7 @@ public class UserObject {
|
||||
return LocaleController.getString("HiddenName", R.string.HiddenName);
|
||||
}
|
||||
String name = ContactsController.formatName(user.first_name, user.last_name);
|
||||
return name.length() != 0 || user.phone == null || user.phone.length() == 0 ? name : PhoneFormat.getInstance().format("+" + user.phone);
|
||||
return name.length() != 0 || user.phone == null || user.phone.length() == 0 ? name : ""/*PhoneFormat.getInstance().format("+" + user.phone)*/;
|
||||
}
|
||||
|
||||
public static String getFirstName(TLRPC.User user) {
|
||||
|
||||
@@ -23,7 +23,6 @@ import android.widget.ListView;
|
||||
//import android.widget.ProgressBar; -- EDIT BY MR
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.telegram.PhoneFormat.PhoneFormat;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.tgnet.TLRPC;
|
||||
import org.telegram.messenger.MessagesController;
|
||||
@@ -275,7 +274,7 @@ public class BlockedUsersActivity extends BaseFragment implements NotificationCe
|
||||
if (user.bot) {
|
||||
number = LocaleController.getString("Bot", R.string.Bot).substring(0, 1).toUpperCase() + LocaleController.getString("Bot", R.string.Bot).substring(1);
|
||||
} else if (user.phone != null && user.phone.length() != 0) {
|
||||
number = PhoneFormat.getInstance().format("+" + user.phone);
|
||||
number = "";//PhoneFormat.getInstance().format("+" + user.phone);
|
||||
} else {
|
||||
number = LocaleController.getString("NumberUnknown", R.string.NumberUnknown);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import android.view.MotionEvent;
|
||||
import android.view.SoundEffectConstants;
|
||||
import android.view.ViewStructure;
|
||||
|
||||
import org.telegram.PhoneFormat.PhoneFormat;
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.ContactsController;
|
||||
import org.telegram.messenger.Emoji;
|
||||
@@ -2297,7 +2296,7 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
||||
|
||||
String phone = messageObject.messageOwner.media.phone_number;
|
||||
if (phone != null && phone.length() != 0) {
|
||||
phone = PhoneFormat.getInstance().format(phone);
|
||||
phone = "";//PhoneFormat.getInstance().format(phone);
|
||||
} else {
|
||||
phone = LocaleController.getString("NumberUnknown", R.string.NumberUnknown);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.telegram.PhoneFormat.PhoneFormat;
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.messenger.MrMailbox;
|
||||
|
||||
@@ -19,7 +19,6 @@ import android.text.TextPaint;
|
||||
import android.text.TextUtils;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import org.telegram.PhoneFormat.PhoneFormat;
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.ChatObject;
|
||||
import org.telegram.messenger.ImageReceiver;
|
||||
@@ -268,7 +267,7 @@ public class ProfileSearchCell extends BaseCell {
|
||||
}
|
||||
if (nameString.length() == 0) {
|
||||
if (user != null && user.phone != null && user.phone.length() != 0) {
|
||||
nameString = PhoneFormat.getInstance().format("+" + user.phone);
|
||||
nameString = "";//PhoneFormat.getInstance().format("+" + user.phone);
|
||||
} else {
|
||||
nameString = LocaleController.getString("HiddenName", R.string.HiddenName);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,6 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.PhoneFormat.PhoneFormat;
|
||||
import org.telegram.messenger.ChatObject;
|
||||
import org.telegram.messenger.Emoji;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
@@ -884,7 +883,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
args.putBoolean("addContact", true);
|
||||
presentFragment(new ContactAddActivity(args));
|
||||
} else {
|
||||
shareMyContact(replyingMessageObject);
|
||||
//shareMyContact(replyingMessageObject);
|
||||
}
|
||||
} else if (id == mute) {
|
||||
toggleMute(false);
|
||||
@@ -2907,6 +2906,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
public void shareMyContact(final MessageObject messageObject) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
||||
builder.setTitle(LocaleController.getString("ShareYouPhoneNumberTitle", R.string.ShareYouPhoneNumberTitle));
|
||||
@@ -2930,6 +2930,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
||||
showDialog(builder.create());
|
||||
}
|
||||
*/
|
||||
|
||||
private void showGifHint() {
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("mainconfig", Activity.MODE_PRIVATE);
|
||||
|
||||
@@ -2056,7 +2056,7 @@ public class ChatActivityEnterView extends FrameLayout implements NotificationCe
|
||||
} else if (button instanceof TLRPC.TL_keyboardButtonUrl) {
|
||||
parentFragment.showOpenUrlAlert(button.url);
|
||||
} else if (button instanceof TLRPC.TL_keyboardButtonRequestPhone) {
|
||||
parentFragment.shareMyContact(messageObject);
|
||||
//parentFragment.shareMyContact(messageObject);
|
||||
} else if (button instanceof TLRPC.TL_keyboardButtonRequestGeoLocation) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity);
|
||||
builder.setTitle(LocaleController.getString("ShareYouLocationTitle", R.string.ShareYouLocationTitle));
|
||||
|
||||
@@ -27,7 +27,6 @@ import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.PhoneFormat.PhoneFormat;
|
||||
import org.telegram.messenger.ContactsController;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.messenger.ApplicationLoader;
|
||||
@@ -248,7 +247,7 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
|
||||
if (user != null) {
|
||||
if (user.phone == null) {
|
||||
if (phone != null) {
|
||||
user.phone = PhoneFormat.stripExceptNumbers(phone);
|
||||
user.phone = "";//PhoneFormat.stripExceptNumbers(phone);
|
||||
}
|
||||
}
|
||||
firstNameField.setText(user.first_name);
|
||||
@@ -267,7 +266,7 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
nameTextView.setText(PhoneFormat.getInstance().format("+" + user.phone));
|
||||
nameTextView.setText(""/*PhoneFormat.getInstance().format("+" + user.phone)*/);
|
||||
onlineTextView.setText(LocaleController.formatUserStatus(user));
|
||||
|
||||
TLRPC.FileLocation photo = null;
|
||||
|
||||
@@ -37,7 +37,6 @@ import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.PhoneFormat.PhoneFormat;
|
||||
import org.telegram.messenger.ChatObject;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.messenger.UserObject;
|
||||
@@ -469,7 +468,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
|
||||
TextView text = (TextView)textView.findViewById(R.id.bubble_text_view);
|
||||
String name = UserObject.getUserName(user);
|
||||
if (name.length() == 0 && user.phone != null && user.phone.length() != 0) {
|
||||
name = PhoneFormat.getInstance().format("+" + user.phone);
|
||||
name = "";//PhoneFormat.getInstance().format("+" + user.phone);
|
||||
}
|
||||
text.setText(name + ", ");
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.PhoneFormat.PhoneFormat;
|
||||
import org.telegram.messenger.ChatObject;
|
||||
import org.telegram.messenger.ContactsController;
|
||||
import org.telegram.messenger.ImageLoader;
|
||||
@@ -604,7 +603,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
||||
}
|
||||
}
|
||||
} else if (args[0].startsWith("TEL")) {
|
||||
String phone = PhoneFormat.stripExceptNumbers(args[1], true);
|
||||
String phone = "";//PhoneFormat.stripExceptNumbers(args[1], true);
|
||||
if (phone.length() > 0) {
|
||||
currentData.phones.add(phone);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ import android.widget.LinearLayout;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.telegram.PhoneFormat.PhoneFormat;
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.messenger.ContactsController;
|
||||
import org.telegram.messenger.MessagesController;
|
||||
@@ -609,7 +608,7 @@ public class LoginActivity extends BaseFragment {
|
||||
return;
|
||||
}
|
||||
ignoreOnTextChange = true;
|
||||
String text = PhoneFormat.stripExceptNumbers(codeField.getText().toString());
|
||||
String text = "";//PhoneFormat.stripExceptNumbers(codeField.getText().toString());
|
||||
codeField.setText(text);
|
||||
if (text.length() == 0) {
|
||||
countryButton.setText(LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
|
||||
@@ -932,7 +931,7 @@ public class LoginActivity extends BaseFragment {
|
||||
|
||||
ConnectionsManager.getInstance().cleanup();
|
||||
final TLRPC.TL_auth_sendCode req = new TLRPC.TL_auth_sendCode();
|
||||
String phone = PhoneFormat.stripExceptNumbers("" + codeField.getText() + phoneField.getText());
|
||||
String phone = "";//PhoneFormat.stripExceptNumbers("" + codeField.getText() + phoneField.getText());
|
||||
ConnectionsManager.getInstance().applyCountryPortNumber(phone);
|
||||
req.api_hash = BuildVars.APP_HASH;
|
||||
req.api_id = BuildVars.APP_ID;
|
||||
@@ -946,7 +945,7 @@ public class LoginActivity extends BaseFragment {
|
||||
final Bundle params = new Bundle();
|
||||
params.putString("phone", "+" + codeField.getText() + phoneField.getText());
|
||||
try {
|
||||
params.putString("ephone", "+" + PhoneFormat.stripExceptNumbers(codeField.getText().toString()) + " " + PhoneFormat.stripExceptNumbers(phoneField.getText().toString()));
|
||||
params.putString("ephone", "+" /*+PhoneFormat.stripExceptNumbers(codeField.getText().toString()) + " " + PhoneFormat.stripExceptNumbers(phoneField.getText().toString())*/);
|
||||
} catch (Exception e) {
|
||||
FileLog.e("tmessages", e);
|
||||
params.putString("ephone", "+" + phone);
|
||||
@@ -1330,7 +1329,7 @@ public class LoginActivity extends BaseFragment {
|
||||
return;
|
||||
}
|
||||
|
||||
String number = PhoneFormat.getInstance().format(phone);
|
||||
String number = "";//PhoneFormat.getInstance().format(phone);
|
||||
CharSequence str = "";
|
||||
if (currentType == 1) {
|
||||
str = AndroidUtilities.replaceTags(LocaleController.getString("SentAppCode", R.string.SentAppCode));
|
||||
|
||||
@@ -42,7 +42,6 @@ import org.telegram.messenger.ContactsController;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.messenger.MediaController;
|
||||
import org.telegram.messenger.MessagesController;
|
||||
import org.telegram.PhoneFormat.PhoneFormat;
|
||||
import org.telegram.messenger.NotificationsController;
|
||||
import org.telegram.messenger.UserObject;
|
||||
import org.telegram.messenger.ApplicationLoader;
|
||||
@@ -1034,7 +1033,7 @@ public class PopupNotificationActivity extends Activity implements NotificationC
|
||||
}
|
||||
if (currentUser.id / 1000 != 777 && currentUser.id / 1000 != 333 && ContactsController.getInstance().contactsDict.get(currentUser.id) == null && (ContactsController.getInstance().contactsDict.size() != 0 || !ContactsController.getInstance().isLoadingContacts())) {
|
||||
if (currentUser.phone != null && currentUser.phone.length() != 0) {
|
||||
nameTextView.setText(PhoneFormat.getInstance().format("+" + currentUser.phone));
|
||||
nameTextView.setText(""/*PhoneFormat.getInstance().format("+" + currentUser.phone)*/);
|
||||
} else {
|
||||
nameTextView.setText(UserObject.getUserName(currentUser));
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import android.widget.FrameLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.telegram.PhoneFormat.PhoneFormat;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
import org.telegram.messenger.MessagesController;
|
||||
import org.telegram.messenger.NotificationCenter;
|
||||
@@ -285,7 +284,7 @@ public class PrivacyUsersActivity extends BaseFragment implements NotificationCe
|
||||
view = new UserCell(mContext, 1, 0, false);
|
||||
}
|
||||
TLRPC.User user = MessagesController.getInstance().getUser(uidArray.get(i));
|
||||
((UserCell)view).setData(user, null, user.phone != null && user.phone.length() != 0 ? PhoneFormat.getInstance().format("+" + user.phone) : LocaleController.getString("NumberUnknown", R.string.NumberUnknown), 0);
|
||||
((UserCell)view).setData(user, null, user.phone != null && user.phone.length() != 0 ? ""/*PhoneFormat.getInstance().format("+" + user.phone)*/ : LocaleController.getString("NumberUnknown", R.string.NumberUnknown), 0);
|
||||
} else if (type == 1) {
|
||||
if (view == null) {
|
||||
view = new TextInfoCell(mContext);
|
||||
|
||||
@@ -41,7 +41,6 @@ import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import org.telegram.messenger.AndroidUtilities;
|
||||
import org.telegram.PhoneFormat.PhoneFormat;
|
||||
import org.telegram.messenger.AnimatorListenerAdapterProxy;
|
||||
import org.telegram.messenger.ChatObject;
|
||||
import org.telegram.messenger.LocaleController;
|
||||
@@ -2050,7 +2049,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
}
|
||||
if (a == 0 && user.phone != null && user.phone.length() != 0 && user.id / 1000 != 777 && user.id / 1000 != 333 && ContactsController.getInstance().contactsDict.get(user.id) == null &&
|
||||
(ContactsController.getInstance().contactsDict.size() != 0 || !ContactsController.getInstance().isLoadingContacts())) {
|
||||
String phoneString = PhoneFormat.getInstance().format("+" + user.phone);
|
||||
String phoneString = "";//PhoneFormat.getInstance().format("+" + user.phone);
|
||||
if (!nameTextView[a].getText().equals(phoneString)) {
|
||||
nameTextView[a].setText(phoneString);
|
||||
}
|
||||
@@ -2404,7 +2403,7 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||
String text;
|
||||
final TLRPC.User user = MessagesController.getInstance().getUser(user_id);
|
||||
if (user.phone != null && user.phone.length() != 0) {
|
||||
text = PhoneFormat.getInstance().format("+" + user.phone);
|
||||
text = "";//PhoneFormat.getInstance().format("+" + user.phone);
|
||||
} else {
|
||||
text = LocaleController.getString("NumberUnknown", R.string.NumberUnknown);
|
||||
}
|
||||
|
||||
@@ -43,9 +43,6 @@
|
||||
<string name="WaitingForNetwork">Warte auf Netzwerk...</string>
|
||||
<string name="Connecting">Verbinde…</string>
|
||||
<string name="Updating">Aktualisiere…</string>
|
||||
<string name="AwaitingEncryption">Warte, bis %s online geht…</string>
|
||||
<string name="EncryptionRejected">Geheimer Chat beendet</string>
|
||||
<string name="EncryptionProcessing">Tausche Schlüssel aus…</string>
|
||||
<string name="ClearHistory">Verlauf löschen</string>
|
||||
<string name="ClearHistoryCache">Cache leeren</string>
|
||||
<string name="DeleteChat">Löschen und beenden</string>
|
||||
@@ -674,7 +671,6 @@
|
||||
<string name="Bot">Bot</string>
|
||||
<string name="BotShare">Teilen</string>
|
||||
<string name="BotInvite">Zu einer Gruppe hinzufügen</string>
|
||||
<string name="BotSettings">Einstellungen</string>
|
||||
<string name="BotHelp">Hilfe</string>
|
||||
<string name="BotStatusRead">Zugriff auf Nachrichten</string>
|
||||
<string name="BotStatusCantRead">kein Zugriff auf Nachrichten</string>
|
||||
@@ -768,10 +764,6 @@
|
||||
<string name="ShareYouLocationUnable">App kann deinen aktuellen Standort nicht bestimmen</string>
|
||||
<string name="ShareYouLocationUnableManually">Selbst wählen</string>
|
||||
<string name="ShareYouLocationInline">Dieser Bot möchte bei jeder Anfrage deinen Standort wissen. Das kann für standortabhängig aufbereitete Informationen benutzt werden.</string>
|
||||
<string name="ShareYouPhoneNumberTitle">Deine Telefonnummer teilen?</string>
|
||||
<string name="AreYouSureShareMyContactInfoBot">Der Bot wird deine Nummer sehen. Das kann für verschiedene Dienste nützlich sein.</string>
|
||||
<string name="AreYouSureShareMyContactInfoUser">Möchtest du wirklich deine Nummer %1$s mit <![CDATA[<b>]]>%2$s<![CDATA[</b>]]> teilen?</string>
|
||||
<string name="AreYouSureShareMyContactInfo">Möchtest du wirklich deine Telefonnummer teilen?</string>
|
||||
<string name="AreYouSureBlockContact">Diesen Kontakt wirklich blockieren?</string>
|
||||
<string name="AreYouSureUnblockContact">Blockierung für diesen Kontakt wirklich aufheben?</string>
|
||||
<string name="AreYouSureDeleteContact">Diesen Kontakt wirklich löschen?</string>
|
||||
@@ -974,7 +966,6 @@
|
||||
<string name="ContactSg">_ Kontakt</string>
|
||||
<string name="MemberSg">_ Mitglied</string>
|
||||
<string name="MemberPl">_ Mitglieder</string>
|
||||
<string name="Stranger">Unbekannte Absender</string>
|
||||
<string name="Strangers">Unbekannte Benutzer</string>
|
||||
<string name="StrangersExplain">Nachrichten von unbekannten Benutzern anzeigen</string>
|
||||
<string name="Media">Medien</string>
|
||||
|
||||
@@ -44,9 +44,6 @@
|
||||
<string name="Connecting">Conectando...</string>
|
||||
<string name="Updating">Actualizando...</string>
|
||||
<string name="NewSecretChat">Nuevo chat secreto</string>
|
||||
<string name="AwaitingEncryption">Esperando que %s se conecte...</string>
|
||||
<string name="EncryptionRejected">Chat secreto cancelado</string>
|
||||
<string name="EncryptionProcessing">Intercambiando claves de cifrado...</string>
|
||||
<string name="ClearHistory">Borrar historial</string>
|
||||
<string name="ClearHistoryCache">Eliminar de la caché</string>
|
||||
<string name="DeleteChat">Eliminar y salir</string>
|
||||
@@ -675,7 +672,6 @@
|
||||
<string name="Bot">bot</string>
|
||||
<string name="BotShare">Compartir</string>
|
||||
<string name="BotInvite">Añadir a un grupo</string>
|
||||
<string name="BotSettings">Ajustes</string>
|
||||
<string name="BotHelp">Ayuda</string>
|
||||
<string name="BotStatusRead">tiene acceso a los mensajes</string>
|
||||
<string name="BotStatusCantRead">no tiene acceso a los mensajes</string>
|
||||
@@ -769,10 +765,6 @@
|
||||
<string name="ShareYouLocationUnable">La aplicación no pudo determinar tu ubicación actual</string>
|
||||
<string name="ShareYouLocationUnableManually">Elegir manualmente</string>
|
||||
<string name="ShareYouLocationInline">Este bot podría querer saber tu ubicación cada vez que le envías una solicitud. Esto puede ser usado para entregar resultados específicos para tu ubicación.</string>
|
||||
<string name="ShareYouPhoneNumberTitle">¿Compartir tu número de teléfono?</string>
|
||||
<string name="AreYouSureShareMyContactInfoBot">El bot sabrá tu número de teléfono. Puede ser útil para la integración con otros servicios.</string>
|
||||
<string name="AreYouSureShareMyContactInfoUser">¿Quieres compartir tu número de teléfono %1$s con <![CDATA[<b>]]>%2$s<![CDATA[</b>]]>?</string>
|
||||
<string name="AreYouSureShareMyContactInfo">¿Quieres compartir tu número de teléfono?</string>
|
||||
<string name="AreYouSureBlockContact">¿Quieres bloquear este contacto?</string>
|
||||
<string name="AreYouSureUnblockContact">¿Quieres desbloquear este contacto?</string>
|
||||
<string name="AreYouSureDeleteContact">¿Quieres eliminar este contacto?</string>
|
||||
|
||||
@@ -44,9 +44,6 @@
|
||||
<string name="Connecting">Connetto…</string>
|
||||
<string name="Updating">Aggiorno…</string>
|
||||
<string name="NewSecretChat">Nuova chat segreta</string>
|
||||
<string name="AwaitingEncryption">Aspettando che %s si colleghi…</string>
|
||||
<string name="EncryptionRejected">Chat segreta annullata</string>
|
||||
<string name="EncryptionProcessing">Scambio delle chiavi di crittografia...</string>
|
||||
<string name="ClearHistory">Cancella cronologia</string>
|
||||
<string name="ClearHistoryCache">Elimina dalla cache</string>
|
||||
<string name="DeleteChat">Elimina ed esci</string>
|
||||
@@ -675,7 +672,6 @@
|
||||
<string name="Bot">bot</string>
|
||||
<string name="BotShare">Condividi</string>
|
||||
<string name="BotInvite">Aggiungi a un gruppo</string>
|
||||
<string name="BotSettings">Impostazioni</string>
|
||||
<string name="BotHelp">Aiuto</string>
|
||||
<string name="BotStatusRead">ha accesso ai messaggi</string>
|
||||
<string name="BotStatusCantRead">non ha accesso ai messaggi</string>
|
||||
@@ -769,10 +765,6 @@
|
||||
<string name="ShareYouLocationUnable">L\'app non è riuscita a determinare la tua posizione corrente</string>
|
||||
<string name="ShareYouLocationUnableManually">Scegli manualmente</string>
|
||||
<string name="ShareYouLocationInline">Questo bot vorrebbe sapere la tua posizione ogni volta che invii una richiesta. Questo può essere usato per fornire risultati specifici per la posizione.</string>
|
||||
<string name="ShareYouPhoneNumberTitle">Condividere il tuo numero di telefono?</string>
|
||||
<string name="AreYouSureShareMyContactInfoBot">Il bot saprà il tuo numero di telefono. Questo può essere utile per l\'integrazione con altri servizi.</string>
|
||||
<string name="AreYouSureShareMyContactInfoUser">Sicuro di voler condividere il tuo numero di telefono %1$s con <![CDATA[<b>]]>%2$s<![CDATA[</b>]]>?</string>
|
||||
<string name="AreYouSureShareMyContactInfo">Sei sicuro di voler condividere il tuo numero di telefono?</string>
|
||||
<string name="AreYouSureBlockContact">Vuoi bloccare questo contatto?</string>
|
||||
<string name="AreYouSureUnblockContact">Vuoi sbloccare questo contatto?</string>
|
||||
<string name="AreYouSureDeleteContact">Sei sicuro di voler eliminare questo contatto?</string>
|
||||
|
||||
@@ -44,9 +44,6 @@
|
||||
<string name="Connecting">Verbinden</string>
|
||||
<string name="Updating">Bijwerken</string>
|
||||
<string name="NewSecretChat">Nieuwe geheime chat</string>
|
||||
<string name="AwaitingEncryption">Wachten tot %s online komt</string>
|
||||
<string name="EncryptionRejected">Geheime chat geannuleerd</string>
|
||||
<string name="EncryptionProcessing">Encryptiesleutels uitwisselen</string>
|
||||
<string name="ClearHistory">Geschiedenis wissen</string>
|
||||
<string name="ClearHistoryCache">Cache opschonen</string>
|
||||
<string name="DeleteChat">Verwijder en verlaat</string>
|
||||
@@ -675,7 +672,6 @@
|
||||
<string name="Bot">bot</string>
|
||||
<string name="BotShare">Delen</string>
|
||||
<string name="BotInvite">Groepslid maken</string>
|
||||
<string name="BotSettings">Instellingen</string>
|
||||
<string name="BotHelp">Help</string>
|
||||
<string name="BotStatusRead">toegang tot berichten</string>
|
||||
<string name="BotStatusCantRead">geen toegang tot berichten</string>
|
||||
@@ -769,10 +765,6 @@
|
||||
<string name="ShareYouLocationUnable">Huidige locatie kon niet worden vastgesteld</string>
|
||||
<string name="ShareYouLocationUnableManually">Handmatig kiezen</string>
|
||||
<string name="ShareYouLocationInline">Deze bot wil toegang tot je locatie voor ieder verzoek dat je stuurt. Dit kan gebruikt worden voor locatiespecifieke resultaten.</string>
|
||||
<string name="ShareYouPhoneNumberTitle">Telefoonnummer delen?</string>
|
||||
<string name="AreYouSureShareMyContactInfoBot">De bot krijgt je telefoonnummer, dit kan handig zijn voor de integratie met andere diensten.</string>
|
||||
<string name="AreYouSureShareMyContactInfoUser">Telefoonnummer %1$s delen met <![CDATA[<b>]]>%2$s<![CDATA[</b>]]>?</string>
|
||||
<string name="AreYouSureShareMyContactInfo">Telefoonnummer echt delen?</string>
|
||||
<string name="AreYouSureBlockContact">Weet je zeker dat je deze persoon wilt blokkeren?</string>
|
||||
<string name="AreYouSureUnblockContact">Weet je zeker dat je deze persoon wilt deblokkeren?</string>
|
||||
<string name="AreYouSureDeleteContact">Contact echt verwijderen?</string>
|
||||
|
||||
@@ -44,9 +44,6 @@
|
||||
<string name="Connecting">Conectando...</string>
|
||||
<string name="Updating">Atualizando...</string>
|
||||
<string name="NewSecretChat">Novo Chat Secreto</string>
|
||||
<string name="AwaitingEncryption">Esperando %s se conectar...</string>
|
||||
<string name="EncryptionRejected">Chat secreto cancelado</string>
|
||||
<string name="EncryptionProcessing">Trocando chaves de criptografia...</string>
|
||||
<string name="ClearHistory">Limpar histórico</string>
|
||||
<string name="ClearHistoryCache">Apagar do cache</string>
|
||||
<string name="DeleteChat">Apagar e sair</string>
|
||||
@@ -675,7 +672,6 @@
|
||||
<string name="Bot">bot</string>
|
||||
<string name="BotShare">Compartilhar</string>
|
||||
<string name="BotInvite">Adicionar Ao Grupo</string>
|
||||
<string name="BotSettings">Configurações</string>
|
||||
<string name="BotHelp">Ajuda</string>
|
||||
<string name="BotStatusRead">tem acesso às mensagens</string>
|
||||
<string name="BotStatusCantRead">não tem acesso às mensagens</string>
|
||||
@@ -769,10 +765,6 @@
|
||||
<string name="ShareYouLocationUnable">O aplicativo foi impossibilitado de determinar sua localização atual.</string>
|
||||
<string name="ShareYouLocationUnableManually">Escolher manualmente</string>
|
||||
<string name="ShareYouLocationInline">Esse bot gostaria de saber sua localização todas as vezes que você enviá-lo uma mensagem. Isso pode ser utilizado para providenciar resultados específicos de localização.</string>
|
||||
<string name="ShareYouPhoneNumberTitle">Compartilhar seu número de telefone?</string>
|
||||
<string name="AreYouSureShareMyContactInfoBot">O bot saberá seu número de telefone. Isso pode ser útil para a integração com outros serviços.</string>
|
||||
<string name="AreYouSureShareMyContactInfoUser">Tem certeza que deseja compartilhar seu número de telefone %1$s com <![CDATA[<b>]]>%2$s<![CDATA[</b>]]>?</string>
|
||||
<string name="AreYouSureShareMyContactInfo">Tem certeza que deseja compartilhar seu número de telefone?</string>
|
||||
<string name="AreYouSureBlockContact">Você tem certeza que deseja bloquear este contato?</string>
|
||||
<string name="AreYouSureUnblockContact">Você tem certeza que deseja desbloquear este contato?</string>
|
||||
<string name="AreYouSureDeleteContact">Você tem certeza que deseja apagar este contato?</string>
|
||||
|
||||
@@ -44,9 +44,6 @@
|
||||
<string name="Connecting">Connecting...</string>
|
||||
<string name="Updating">Updating...</string>
|
||||
<string name="NewSecretChat">New Secret Chat</string>
|
||||
<string name="AwaitingEncryption">Waiting for %s to get online...</string>
|
||||
<string name="EncryptionRejected">Secret chat cancelled</string>
|
||||
<string name="EncryptionProcessing">Exchanging encryption keys...</string>
|
||||
<string name="ClearHistory">Clear history</string>
|
||||
<string name="ClearHistoryCache">Delete from cache</string>
|
||||
<string name="DeleteChat">Delete and exit</string>
|
||||
@@ -675,7 +672,6 @@
|
||||
<string name="Bot">bot</string>
|
||||
<string name="BotShare">Share</string>
|
||||
<string name="BotInvite">Add to group</string>
|
||||
<string name="BotSettings">Settings</string>
|
||||
<string name="BotHelp">Help</string>
|
||||
<string name="BotStatusRead">has access to messages</string>
|
||||
<string name="BotStatusCantRead">has no access to messages</string>
|
||||
@@ -769,10 +765,6 @@
|
||||
<string name="ShareYouLocationUnable">App was unable to determine your current location</string>
|
||||
<string name="ShareYouLocationUnableManually">Choose manually</string>
|
||||
<string name="ShareYouLocationInline">This bot would like to know your location each time you send it a request. This can be used to provide location-specific results.</string>
|
||||
<string name="ShareYouPhoneNumberTitle">Share your phone number?</string>
|
||||
<string name="AreYouSureShareMyContactInfoBot">The bot will know your phone number. This can be useful for integration with other services.</string>
|
||||
<string name="AreYouSureShareMyContactInfoUser">Are you sure you want to share your phone number %1$s with <![CDATA[<b>]]>%2$s<![CDATA[</b>]]>?</string>
|
||||
<string name="AreYouSureShareMyContactInfo">Are you sure you want to share your phone number?</string>
|
||||
<string name="AreYouSureBlockContact">Are you sure you want to block this contact?</string>
|
||||
<string name="AreYouSureUnblockContact">Are you sure you want to unblock this contact?</string>
|
||||
<string name="AreYouSureDeleteContact">Are you sure you want to delete this contact?</string>
|
||||
@@ -974,7 +966,6 @@
|
||||
<string name="MemberPl">_ members</string>
|
||||
<string name="ContactSg">_ contact</string>
|
||||
<string name="ContactPl">_ contacts</string>
|
||||
<string name="Stranger">Unknown senders</string>
|
||||
<string name="Strangers">Unknown users</string>
|
||||
<string name="StrangersExplain">Show messages from unknown useres</string>
|
||||
<string name="Media">Media</string>
|
||||
|
||||
Reference in New Issue
Block a user