Commit 5141fc1c authored by DrKLO's avatar DrKLO

Preparation to move dev branch to github

yep, it's finally here
parent 4ede3110
.idea/ .idea/
.gradle/ .gradle/
build/ build/
obj/
*.iml *.iml
local.properties local.properties
*.keystore
gradle.properties
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
package jawnae.pyronet; package jawnae.pyronet;
import org.telegram.messenger.ConnectionsManager; import org.telegram.messenger.BuildVars;
import org.telegram.messenger.FileLog; import org.telegram.messenger.FileLog;
import java.io.IOException; import java.io.IOException;
...@@ -30,14 +30,14 @@ public class PyroClientAdapter implements PyroClientListener { ...@@ -30,14 +30,14 @@ public class PyroClientAdapter implements PyroClientListener {
} }
public void unconnectableClient(PyroClient client, Exception cause) { public void unconnectableClient(PyroClient client, Exception cause) {
if (ConnectionsManager.DEBUG_VERSION) { if (BuildVars.DEBUG_VERSION) {
FileLog.e("tmessages", "unconnectable"); FileLog.e("tmessages", "unconnectable");
} }
} }
public void droppedClient(PyroClient client, IOException cause) { public void droppedClient(PyroClient client, IOException cause) {
if (cause != null) { if (cause != null) {
if (ConnectionsManager.DEBUG_VERSION) { if (BuildVars.DEBUG_VERSION) {
FileLog.e("tmessages", this.getClass().getSimpleName() + ".droppedClient() caught exception: " + cause); FileLog.e("tmessages", this.getClass().getSimpleName() + ".droppedClient() caught exception: " + cause);
} }
} }
......
/*
* This is the source code of Telegram for Android v. 1.3.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-2014.
*/
package org.telegram.messenger;
public class BuildVars {
public static boolean DEBUG_VERSION = true;
public static int APP_ID = 2458;
public static String APP_HASH = "5bce48dc7d331e62c955669eb7233217";
public static String HOCKEY_APP_HASH = "your-hockeyapp-api-key-here";
public static String GCM_SENDER_ID = "760348033672";
public static String SEND_LOGS_EMAIL = "email@gmail.com";
}
...@@ -30,13 +30,6 @@ import java.util.regex.Matcher; ...@@ -30,13 +30,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.TcpConnectionDelegate { public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.TcpConnectionDelegate {
public static boolean DEBUG_VERSION = true;
public static int APP_ID = 2458;
public static String APP_HASH = "5bce48dc7d331e62c955669eb7233217";
public static String HOCKEY_APP_HASH = "your-hockeyapp-api-key-here";
public static String GCM_SENDER_ID = "760348033672";
public static String SEND_LOGS_EMAIL = "email@gmail.com";
private HashMap<Integer, Datacenter> datacenters = new HashMap<Integer, Datacenter>(); private HashMap<Integer, Datacenter> datacenters = new HashMap<Integer, Datacenter>();
private HashMap<Long, ArrayList<Long>> processedMessageIdsSet = new HashMap<Long, ArrayList<Long>>(); private HashMap<Long, ArrayList<Long>> processedMessageIdsSet = new HashMap<Long, ArrayList<Long>>();
private HashMap<Long, Integer> nextSeqNoInSession = new HashMap<Long, Integer>(); private HashMap<Long, Integer> nextSeqNoInSession = new HashMap<Long, Integer>();
...@@ -728,7 +721,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. ...@@ -728,7 +721,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
request.initRequest = true; request.initRequest = true;
TLRPC.initConnection invoke = new TLRPC.initConnection(); TLRPC.initConnection invoke = new TLRPC.initConnection();
invoke.query = object; invoke.query = object;
invoke.api_id = APP_ID; invoke.api_id = BuildVars.APP_ID;
try { try {
invoke.lang_code = Locale.getDefault().getCountry(); invoke.lang_code = Locale.getDefault().getCountry();
invoke.device_model = Build.MANUFACTURER + Build.MODEL; invoke.device_model = Build.MANUFACTURER + Build.MODEL;
...@@ -1637,7 +1630,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. ...@@ -1637,7 +1630,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
NetworkMessage networkMessage = messages.get(0); NetworkMessage networkMessage = messages.get(0);
TLRPC.TL_protoMessage message = networkMessage.protoMessage; TLRPC.TL_protoMessage message = networkMessage.protoMessage;
if (DEBUG_VERSION) { if (BuildVars.DEBUG_VERSION) {
if (message.body instanceof TLRPC.invokeWithLayer12) { if (message.body instanceof TLRPC.invokeWithLayer12) {
FileLog.d("tmessages", sessionId + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer12)message.body).query); FileLog.d("tmessages", sessionId + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer12)message.body).query);
} else if (message.body instanceof TLRPC.initConnection) { } else if (message.body instanceof TLRPC.initConnection) {
...@@ -1677,7 +1670,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. ...@@ -1677,7 +1670,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
for (NetworkMessage networkMessage : messages) { for (NetworkMessage networkMessage : messages) {
TLRPC.TL_protoMessage message = networkMessage.protoMessage; TLRPC.TL_protoMessage message = networkMessage.protoMessage;
containerMessages.add(message); containerMessages.add(message);
if (DEBUG_VERSION) { if (BuildVars.DEBUG_VERSION) {
if (message.body instanceof TLRPC.invokeWithLayer12) { if (message.body instanceof TLRPC.invokeWithLayer12) {
FileLog.d("tmessages", sessionId + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer12)message.body).query); FileLog.d("tmessages", sessionId + ":DC" + datacenter.datacenterId + "> Send message (" + message.seqno + ", " + message.msg_id + "): " + ((TLRPC.invokeWithLayer12)message.body).query);
} else if (message.body instanceof TLRPC.initConnection) { } else if (message.body instanceof TLRPC.initConnection) {
...@@ -2445,7 +2438,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection. ...@@ -2445,7 +2438,7 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
} else { } else {
connectionState = 1; connectionState = 1;
} }
if (DEBUG_VERSION) { if (BuildVars.DEBUG_VERSION) {
try { try {
ConnectivityManager cm = (ConnectivityManager)ApplicationLoader.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE); ConnectivityManager cm = (ConnectivityManager)ApplicationLoader.applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo[] networkInfos = cm.getAllNetworkInfo(); NetworkInfo[] networkInfos = cm.getAllNetworkInfo();
......
...@@ -514,7 +514,7 @@ public class ContactsController { ...@@ -514,7 +514,7 @@ public class ContactsController {
Utilities.RunOnUIThread(new Runnable() { Utilities.RunOnUIThread(new Runnable() {
@Override @Override
public void run() { public void run() {
if (ConnectionsManager.DEBUG_VERSION) { if (BuildVars.DEBUG_VERSION) {
FileLog.e("tmessages", "need delete contacts"); FileLog.e("tmessages", "need delete contacts");
for (HashMap.Entry<Integer, Contact> c : contactHashMap.entrySet()) { for (HashMap.Entry<Integer, Contact> c : contactHashMap.entrySet()) {
Contact contact = c.getValue(); Contact contact = c.getValue();
...@@ -590,7 +590,7 @@ public class ContactsController { ...@@ -590,7 +590,7 @@ public class ContactsController {
if (request) { if (request) {
if (!toImport.isEmpty()) { if (!toImport.isEmpty()) {
if (ConnectionsManager.DEBUG_VERSION) { if (BuildVars.DEBUG_VERSION) {
FileLog.e("tmessages", "start import contacts"); FileLog.e("tmessages", "start import contacts");
for (TLRPC.TL_inputPhoneContact contact : toImport) { for (TLRPC.TL_inputPhoneContact contact : toImport) {
FileLog.e("tmessages", "add contact " + contact.first_name + " " + contact.last_name + " " + contact.phone); FileLog.e("tmessages", "add contact " + contact.first_name + " " + contact.last_name + " " + contact.phone);
...@@ -613,7 +613,7 @@ public class ContactsController { ...@@ -613,7 +613,7 @@ public class ContactsController {
MessagesStorage.getInstance().putCachedPhoneBook(contactsMap); MessagesStorage.getInstance().putCachedPhoneBook(contactsMap);
} }
TLRPC.TL_contacts_importedContacts res = (TLRPC.TL_contacts_importedContacts)response; TLRPC.TL_contacts_importedContacts res = (TLRPC.TL_contacts_importedContacts)response;
if (ConnectionsManager.DEBUG_VERSION) { if (BuildVars.DEBUG_VERSION) {
for (TLRPC.User user : res.users) { for (TLRPC.User user : res.users) {
FileLog.e("tmessages", "received user " + user.first_name + " " + user.last_name + " " + user.phone); FileLog.e("tmessages", "received user " + user.first_name + " " + user.last_name + " " + user.phone);
} }
...@@ -776,7 +776,7 @@ public class ContactsController { ...@@ -776,7 +776,7 @@ public class ContactsController {
if (user != null) { if (user != null) {
usersDict.put(user.id, user); usersDict.put(user.id, user);
if (ConnectionsManager.DEBUG_VERSION) { if (BuildVars.DEBUG_VERSION) {
FileLog.e("tmessages", "loaded user contact " + user.first_name + " " + user.last_name + " " + user.phone); FileLog.e("tmessages", "loaded user contact " + user.first_name + " " + user.last_name + " " + user.phone);
} }
} }
...@@ -1398,7 +1398,7 @@ public class ContactsController { ...@@ -1398,7 +1398,7 @@ public class ContactsController {
contactsParams.add(c); contactsParams.add(c);
req.contacts = contactsParams; req.contacts = contactsParams;
req.replace = false; req.replace = false;
if (ConnectionsManager.DEBUG_VERSION) { if (BuildVars.DEBUG_VERSION) {
FileLog.e("tmessages", "add contact " + user.first_name + " " + user.last_name + " " + user.phone); FileLog.e("tmessages", "add contact " + user.first_name + " " + user.last_name + " " + user.phone);
} }
ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() { ConnectionsManager.getInstance().performRpc(req, new RPCRequest.RPCRequestDelegate() {
...@@ -1410,7 +1410,7 @@ public class ContactsController { ...@@ -1410,7 +1410,7 @@ public class ContactsController {
final TLRPC.TL_contacts_importedContacts res = (TLRPC.TL_contacts_importedContacts)response; final TLRPC.TL_contacts_importedContacts res = (TLRPC.TL_contacts_importedContacts)response;
MessagesStorage.getInstance().putUsersAndChats(res.users, null, true, true); MessagesStorage.getInstance().putUsersAndChats(res.users, null, true, true);
if (ConnectionsManager.DEBUG_VERSION) { if (BuildVars.DEBUG_VERSION) {
for (TLRPC.User user : res.users) { for (TLRPC.User user : res.users) {
FileLog.e("tmessages", "received user " + user.first_name + " " + user.last_name + " " + user.phone); FileLog.e("tmessages", "received user " + user.first_name + " " + user.last_name + " " + user.phone);
} }
......
...@@ -40,7 +40,7 @@ public class FileLog { ...@@ -40,7 +40,7 @@ public class FileLog {
} }
public FileLog() { public FileLog() {
if (!ConnectionsManager.DEBUG_VERSION) { if (!BuildVars.DEBUG_VERSION) {
return; return;
} }
dateFormat = FastDateFormat.getInstance("dd_MM_yyyy_HH_mm_ss", Locale.US); dateFormat = FastDateFormat.getInstance("dd_MM_yyyy_HH_mm_ss", Locale.US);
...@@ -70,7 +70,7 @@ public class FileLog { ...@@ -70,7 +70,7 @@ public class FileLog {
} }
public static void e(final String tag, final String message, final Throwable exception) { public static void e(final String tag, final String message, final Throwable exception) {
if (!ConnectionsManager.DEBUG_VERSION) { if (!BuildVars.DEBUG_VERSION) {
return; return;
} }
Log.e(tag, message, exception); Log.e(tag, message, exception);
...@@ -91,7 +91,7 @@ public class FileLog { ...@@ -91,7 +91,7 @@ public class FileLog {
} }
public static void e(final String tag, final String message) { public static void e(final String tag, final String message) {
if (!ConnectionsManager.DEBUG_VERSION) { if (!BuildVars.DEBUG_VERSION) {
return; return;
} }
Log.e(tag, message); Log.e(tag, message);
...@@ -111,7 +111,7 @@ public class FileLog { ...@@ -111,7 +111,7 @@ public class FileLog {
} }
public static void e(final String tag, final Exception e) { public static void e(final String tag, final Exception e) {
if (!ConnectionsManager.DEBUG_VERSION) { if (!BuildVars.DEBUG_VERSION) {
return; return;
} }
e.printStackTrace(); e.printStackTrace();
...@@ -137,7 +137,7 @@ public class FileLog { ...@@ -137,7 +137,7 @@ public class FileLog {
} }
public static void d(final String tag, final String message) { public static void d(final String tag, final String message) {
if (!ConnectionsManager.DEBUG_VERSION) { if (!BuildVars.DEBUG_VERSION) {
return; return;
} }
Log.d(tag, message); Log.d(tag, message);
......
...@@ -27,6 +27,7 @@ import com.google.android.gms.common.ConnectionResult; ...@@ -27,6 +27,7 @@ import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesUtil; import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.gcm.GoogleCloudMessaging; import com.google.android.gms.gcm.GoogleCloudMessaging;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.ConnectionsManager; import org.telegram.messenger.ConnectionsManager;
import org.telegram.messenger.FileLog; import org.telegram.messenger.FileLog;
import org.telegram.messenger.MessagesController; import org.telegram.messenger.MessagesController;
...@@ -228,7 +229,7 @@ public class ApplicationLoader extends Application { ...@@ -228,7 +229,7 @@ public class ApplicationLoader extends Application {
while (count < 1000) { while (count < 1000) {
try { try {
count++; count++;
regid = gcm.register(ConnectionsManager.GCM_SENDER_ID); regid = gcm.register(BuildVars.GCM_SENDER_ID);
sendRegistrationIdToBackend(true); sendRegistrationIdToBackend(true);
storeRegistrationId(applicationContext, regid); storeRegistrationId(applicationContext, regid);
return true; return true;
......
...@@ -35,6 +35,7 @@ import android.widget.TextView; ...@@ -35,6 +35,7 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import org.telegram.PhoneFormat.PhoneFormat; import org.telegram.PhoneFormat.PhoneFormat;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.ConnectionsManager; import org.telegram.messenger.ConnectionsManager;
import org.telegram.messenger.FileLog; import org.telegram.messenger.FileLog;
import org.telegram.messenger.MessagesController; import org.telegram.messenger.MessagesController;
...@@ -526,12 +527,12 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen ...@@ -526,12 +527,12 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
} }
private void checkForCrashes() { private void checkForCrashes() {
CrashManager.register(this, ConnectionsManager.HOCKEY_APP_HASH); CrashManager.register(this, BuildVars.HOCKEY_APP_HASH);
} }
private void checkForUpdates() { private void checkForUpdates() {
if (ConnectionsManager.DEBUG_VERSION) { if (BuildVars.DEBUG_VERSION) {
UpdateManager.register(this, ConnectionsManager.HOCKEY_APP_HASH); UpdateManager.register(this, BuildVars.HOCKEY_APP_HASH);
} }
} }
......
...@@ -26,6 +26,7 @@ import android.widget.EditText; ...@@ -26,6 +26,7 @@ import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
import org.telegram.PhoneFormat.PhoneFormat; import org.telegram.PhoneFormat.PhoneFormat;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.LocaleController; import org.telegram.messenger.LocaleController;
import org.telegram.messenger.TLObject; import org.telegram.messenger.TLObject;
import org.telegram.messenger.TLRPC; import org.telegram.messenger.TLRPC;
...@@ -328,8 +329,8 @@ public class LoginActivityPhoneView extends SlideView implements AdapterView.OnI ...@@ -328,8 +329,8 @@ public class LoginActivityPhoneView extends SlideView implements AdapterView.OnI
TLRPC.TL_auth_sendCode req = new TLRPC.TL_auth_sendCode(); 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); ConnectionsManager.getInstance().applyCountryPortNumber(phone);
req.api_hash = ConnectionsManager.APP_HASH; req.api_hash = BuildVars.APP_HASH;
req.api_id = ConnectionsManager.APP_ID; req.api_id = BuildVars.APP_ID;
req.sms_type = 0; req.sms_type = 0;
req.phone_number = phone; req.phone_number = phone;
req.lang_code = Locale.getDefault().getCountry(); req.lang_code = Locale.getDefault().getCountry();
......
...@@ -34,6 +34,7 @@ import android.widget.TextView; ...@@ -34,6 +34,7 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import org.telegram.PhoneFormat.PhoneFormat; import org.telegram.PhoneFormat.PhoneFormat;
import org.telegram.messenger.BuildVars;
import org.telegram.messenger.LocaleController; import org.telegram.messenger.LocaleController;
import org.telegram.messenger.SerializedData; import org.telegram.messenger.SerializedData;
import org.telegram.messenger.TLClassStore; import org.telegram.messenger.TLClassStore;
...@@ -169,7 +170,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter ...@@ -169,7 +170,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
textSizeRow = rowCount++; textSizeRow = rowCount++;
sendByEnterRow = rowCount++; sendByEnterRow = rowCount++;
supportSectionRow = rowCount++; supportSectionRow = rowCount++;
if (ConnectionsManager.DEBUG_VERSION) { if (BuildVars.DEBUG_VERSION) {
sendLogsRow = rowCount++; sendLogsRow = rowCount++;
clearLogsRow = rowCount++; clearLogsRow = rowCount++;
} }
...@@ -484,7 +485,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter ...@@ -484,7 +485,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
} }
Intent i = new Intent(Intent.ACTION_SEND_MULTIPLE); Intent i = new Intent(Intent.ACTION_SEND_MULTIPLE);
i.setType("message/rfc822") ; i.setType("message/rfc822") ;
i.putExtra(Intent.EXTRA_EMAIL, new String[]{ConnectionsManager.SEND_LOGS_EMAIL}); i.putExtra(Intent.EXTRA_EMAIL, new String[]{BuildVars.SEND_LOGS_EMAIL});
i.putExtra(Intent.EXTRA_SUBJECT, "last logs"); i.putExtra(Intent.EXTRA_SUBJECT, "last logs");
i.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); i.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
startActivity(Intent.createChooser(i, "Select email application.")); startActivity(Intent.createChooser(i, "Select email application."));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment