mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 06:25:14 +01:00
Bug fixes
This commit is contained in:
parent
5972d1d69f
commit
75d782181e
5 changed files with 25 additions and 13 deletions
|
@ -88,7 +88,11 @@ public class TextCell extends FrameLayout {
|
|||
valueTextView.layout(viewLeft, viewTop, viewLeft + valueTextView.getMeasuredWidth(), viewTop + valueTextView.getMeasuredHeight());
|
||||
|
||||
viewTop = (height - textView.getTextHeight()) / 2;
|
||||
viewLeft = !LocaleController.isRTL ? AndroidUtilities.dp(71) : AndroidUtilities.dp(24);
|
||||
if (LocaleController.isRTL) {
|
||||
viewLeft = getMeasuredWidth() - textView.getMeasuredWidth() - AndroidUtilities.dp(71);
|
||||
} else {
|
||||
viewLeft = AndroidUtilities.dp(71);
|
||||
}
|
||||
textView.layout(viewLeft, viewTop, viewLeft + textView.getMeasuredWidth(), viewTop + textView.getMeasuredHeight());
|
||||
|
||||
viewTop = AndroidUtilities.dp(5);
|
||||
|
|
|
@ -299,17 +299,15 @@ public class ExternalActionActivity extends Activity implements ActionBarLayout.
|
|||
progressDialog.setCancelable(false);
|
||||
|
||||
final int bot_id = intent.getIntExtra("bot_id", 0);
|
||||
String _payload=intent.getStringExtra("nonce");
|
||||
if(TextUtils.isEmpty(_payload))
|
||||
_payload=intent.getStringExtra("payload");
|
||||
final String payload = _payload;
|
||||
final String nonce = intent.getStringExtra("nonce");
|
||||
final String payload = intent.getStringExtra("payload");
|
||||
final TLRPC.TL_account_getAuthorizationForm req = new TLRPC.TL_account_getAuthorizationForm();
|
||||
req.bot_id = bot_id;
|
||||
req.scope = intent.getStringExtra("scope");
|
||||
req.public_key = intent.getStringExtra("public_key");
|
||||
final int[] requestId = {0};
|
||||
|
||||
if (bot_id == 0 || TextUtils.isEmpty(payload) || TextUtils.isEmpty(req.scope) || TextUtils.isEmpty(req.public_key)) {
|
||||
if (bot_id == 0 || TextUtils.isEmpty(payload) && TextUtils.isEmpty(nonce) || TextUtils.isEmpty(req.scope) || TextUtils.isEmpty(req.public_key)) {
|
||||
finish();
|
||||
return false;
|
||||
}
|
||||
|
@ -328,7 +326,7 @@ public class ExternalActionActivity extends Activity implements ActionBarLayout.
|
|||
if (response1 != null) {
|
||||
TLRPC.TL_account_password accountPassword = (TLRPC.TL_account_password) response1;
|
||||
MessagesController.getInstance(intentAccount).putUsers(authorizationForm.users, false);
|
||||
PassportActivity fragment = new PassportActivity(PassportActivity.TYPE_PASSWORD, req.bot_id, req.scope, req.public_key, payload, null, authorizationForm, accountPassword);
|
||||
PassportActivity fragment = new PassportActivity(PassportActivity.TYPE_PASSWORD, req.bot_id, req.scope, req.public_key, payload, nonce, null, authorizationForm, accountPassword);
|
||||
fragment.setNeedActivityResult(true);
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
layersActionBarLayout.addFragmentToStack(fragment);
|
||||
|
|
|
@ -1123,7 +1123,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
|||
auth = new HashMap<>();
|
||||
String scope = data.getQueryParameter("scope");
|
||||
if (!TextUtils.isEmpty(scope) && scope.startsWith("{") && scope.endsWith("}")) {
|
||||
auth.put("payload", data.getQueryParameter("nonce"));
|
||||
auth.put("nonce", data.getQueryParameter("nonce"));
|
||||
} else {
|
||||
auth.put("payload", data.getQueryParameter("payload"));
|
||||
}
|
||||
|
@ -1204,7 +1204,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
|||
auth = new HashMap<>();
|
||||
String scope = data.getQueryParameter("scope");
|
||||
if (!TextUtils.isEmpty(scope) && scope.startsWith("{") && scope.endsWith("}")) {
|
||||
auth.put("payload", data.getQueryParameter("nonce"));
|
||||
auth.put("nonce", data.getQueryParameter("nonce"));
|
||||
} else {
|
||||
auth.put("payload", data.getQueryParameter("payload"));
|
||||
}
|
||||
|
@ -1767,6 +1767,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
|||
return;
|
||||
}
|
||||
final String payload = auth.get("payload");
|
||||
final String nonce = auth.get("nonce");
|
||||
final String callbackUrl = auth.get("callback_url");
|
||||
final TLRPC.TL_account_getAuthorizationForm req = new TLRPC.TL_account_getAuthorizationForm();
|
||||
req.bot_id = bot_id;
|
||||
|
@ -1785,7 +1786,7 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
|||
if (response1 != null) {
|
||||
TLRPC.TL_account_password accountPassword = (TLRPC.TL_account_password) response1;
|
||||
MessagesController.getInstance(intentAccount).putUsers(authorizationForm.users, false);
|
||||
presentFragment(new PassportActivity(PassportActivity.TYPE_PASSWORD, req.bot_id, req.scope, req.public_key, payload, callbackUrl, authorizationForm, accountPassword));
|
||||
presentFragment(new PassportActivity(PassportActivity.TYPE_PASSWORD, req.bot_id, req.scope, req.public_key, payload, nonce, callbackUrl, authorizationForm, accountPassword));
|
||||
}
|
||||
}));
|
||||
} else {
|
||||
|
|
|
@ -189,6 +189,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter
|
|||
private int currentActivityType;
|
||||
private int currentBotId;
|
||||
private String currentPayload;
|
||||
private String currentNonce;
|
||||
private boolean useCurrentValue;
|
||||
private String currentScope;
|
||||
private String currentCallbackUrl;
|
||||
|
@ -659,10 +660,11 @@ public class PassportActivity extends BaseFragment implements NotificationCenter
|
|||
}
|
||||
}
|
||||
|
||||
public PassportActivity(int type, int botId, String scope, String publicKey, String payload, String callbackUrl, TLRPC.TL_account_authorizationForm form, TLRPC.TL_account_password accountPassword) {
|
||||
public PassportActivity(int type, int botId, String scope, String publicKey, String payload, String nonce, String callbackUrl, TLRPC.TL_account_authorizationForm form, TLRPC.TL_account_password accountPassword) {
|
||||
this(type, form, accountPassword, null, null, null, null, null, null);
|
||||
currentBotId = botId;
|
||||
currentPayload = payload;
|
||||
currentNonce = nonce;
|
||||
currentScope = scope;
|
||||
currentPublicKey = publicKey;
|
||||
currentCallbackUrl = callbackUrl;
|
||||
|
@ -1699,7 +1701,7 @@ public class PassportActivity extends BaseFragment implements NotificationCenter
|
|||
} else {
|
||||
type = TYPE_REQUEST;
|
||||
}
|
||||
PassportActivity activity = new PassportActivity(type, currentBotId, currentScope, currentPublicKey, currentPayload, currentCallbackUrl, currentForm, currentPassword);
|
||||
PassportActivity activity = new PassportActivity(type, currentBotId, currentScope, currentPublicKey, currentPayload, currentNonce, currentCallbackUrl, currentForm, currentPassword);
|
||||
activity.currentEmail = currentEmail;
|
||||
activity.currentAccount = currentAccount;
|
||||
activity.saltedPassword = saltedPassword;
|
||||
|
@ -2331,6 +2333,13 @@ public class PassportActivity extends BaseFragment implements NotificationCenter
|
|||
|
||||
}
|
||||
}
|
||||
if (currentNonce != null) {
|
||||
try {
|
||||
result.put("nonce", currentNonce);
|
||||
} catch (Exception ignore) {
|
||||
|
||||
}
|
||||
}
|
||||
String json = result.toString();
|
||||
|
||||
EncryptionResult encryptionResult = encryptData(AndroidUtilities.getStringBytes(json));
|
||||
|
|
|
@ -386,7 +386,7 @@ public class PrivacySettingsActivity extends BaseFragment implements Notificatio
|
|||
builder.setCustomView(linearLayout);
|
||||
showDialog(builder.create());
|
||||
} else if (position == passportRow) {
|
||||
presentFragment(new PassportActivity(PassportActivity.TYPE_PASSWORD, 0, "", "", null, null, null, null));
|
||||
presentFragment(new PassportActivity(PassportActivity.TYPE_PASSWORD, 0, "", "", null, null, null, null, null));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue