青竹传媒 v1.0.0版本的 MD5 值为:d5ec664fe20c17fd4f187bc728262336
以下内容为反编译后的 LaunchActivity.java 源代码,内容仅作参考
package im.jpeoubogmn.ui;
import android.app.ActivityManager;
import android.app.NotificationManager;
import android.app.role.RoleManager;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.os.StatFs;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import android.view.ActionMode;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.view.PointerIconCompat;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.bjz.comm.net.premission.PermissionUtils;
import com.bjz.comm.net.utils.AppPreferenceUtil;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.text.ttml.TtmlNode;
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
import com.google.android.exoplayer2.util.MimeTypes;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.common.internal.ImagesContract;
import im.jpeoubogmn.javaBean.fc.FollowedFcListBean;
import im.jpeoubogmn.javaBean.fc.HomeFcListBean;
import im.jpeoubogmn.javaBean.fc.RecommendFcListBean;
import im.jpeoubogmn.messenger.AccountInstance;
import im.jpeoubogmn.messenger.AndroidUtilities;
import im.jpeoubogmn.messenger.ApplicationLoader;
import im.jpeoubogmn.messenger.BuildVars;
import im.jpeoubogmn.messenger.ChatObject;
import im.jpeoubogmn.messenger.ContactsController;
import im.jpeoubogmn.messenger.FileLoader;
import im.jpeoubogmn.messenger.FileLog;
import im.jpeoubogmn.messenger.ImageLoader;
import im.jpeoubogmn.messenger.LocaleController;
import im.jpeoubogmn.messenger.LocationController;
import im.jpeoubogmn.messenger.MediaController;
import im.jpeoubogmn.messenger.MediaDataController;
import im.jpeoubogmn.messenger.MessageObject;
import im.jpeoubogmn.messenger.MessagesController;
import im.jpeoubogmn.messenger.MessagesStorage;
import im.jpeoubogmn.messenger.NotificationCenter;
import im.jpeoubogmn.messenger.R;
import im.jpeoubogmn.messenger.SendMessagesHelper;
import im.jpeoubogmn.messenger.SharedConfig;
import im.jpeoubogmn.messenger.UserConfig;
import im.jpeoubogmn.messenger.UserObject;
import im.jpeoubogmn.messenger.Utilities;
import im.jpeoubogmn.messenger.browser.Browser;
import im.jpeoubogmn.messenger.camera.CameraController;
import im.jpeoubogmn.messenger.utils.PlayerUtils;
import im.jpeoubogmn.tel.CallApiBelow26And28Service;
import im.jpeoubogmn.tgnet.ConnectionsManager;
import im.jpeoubogmn.tgnet.RequestDelegate;
import im.jpeoubogmn.tgnet.TLObject;
import im.jpeoubogmn.tgnet.TLRPC;
import im.jpeoubogmn.tgnet.TLRPCCall;
import im.jpeoubogmn.ui.DialogsActivity;
import im.jpeoubogmn.ui.NewLocationActivity;
import im.jpeoubogmn.ui.PhoneBookSelectActivity;
import im.jpeoubogmn.ui.WallpapersListActivity;
import im.jpeoubogmn.ui.actionbar.ActionBarLayout;
import im.jpeoubogmn.ui.actionbar.AlertDialog;
import im.jpeoubogmn.ui.actionbar.BaseFragment;
import im.jpeoubogmn.ui.actionbar.DrawerLayoutContainer;
import im.jpeoubogmn.ui.actionbar.Theme;
import im.jpeoubogmn.ui.actionbar.XAlertDialog;
import im.jpeoubogmn.ui.adapters.DrawerLayoutAdapter;
import im.jpeoubogmn.ui.cells.DrawerUserCell;
import im.jpeoubogmn.ui.cells.LanguageCell;
import im.jpeoubogmn.ui.cells.ThemesHorizontalListCell;
import im.jpeoubogmn.ui.components.AlertsCreator;
import im.jpeoubogmn.ui.components.AudioPlayerAlert;
import im.jpeoubogmn.ui.components.BlockingUpdateView;
import im.jpeoubogmn.ui.components.EmbedBottomSheet;
import im.jpeoubogmn.ui.components.JoinGroupAlert;
import im.jpeoubogmn.ui.components.LayoutHelper;
import im.jpeoubogmn.ui.components.PasscodeView;
import im.jpeoubogmn.ui.components.PipRoundVideoView;
import im.jpeoubogmn.ui.components.RecyclerListView;
import im.jpeoubogmn.ui.components.SharingLocationsAlert;
import im.jpeoubogmn.ui.components.StickersAlert;
import im.jpeoubogmn.ui.components.TermsOfServiceView;
import im.jpeoubogmn.ui.components.ThemeEditorView;
import im.jpeoubogmn.ui.components.UpdateAppAlertDialog;
import im.jpeoubogmn.ui.components.toast.ToastUtils;
import im.jpeoubogmn.ui.hui.chats.NewProfileActivity;
import im.jpeoubogmn.ui.hui.contacts.AddContactsInfoActivity;
import im.jpeoubogmn.ui.hui.contacts.NewFriendsActivity;
import im.jpeoubogmn.ui.hui.discoveryweb.DiscoveryJumpPausedFloatingView;
import im.jpeoubogmn.ui.hui.friendscircle_v1.helper.DatabaseInstance;
import im.jpeoubogmn.ui.hui.friendscircle_v1.helper.FcDBHelper;
import im.jpeoubogmn.ui.hui.friendscircle_v1.ui.ImagePreviewActivity;
import im.jpeoubogmn.ui.hui.login.LoginContronllerActivity;
import im.jpeoubogmn.ui.hui.visualcall.AVideoCallInterface;
import im.jpeoubogmn.ui.hui.visualcall.RingUtils;
import im.jpeoubogmn.ui.hui.visualcall.VisualCallActivity;
import im.jpeoubogmn.ui.hui.visualcall.VisualCallReceiveActivity;
import im.jpeoubogmn.ui.hui.visualcall.VisualCallRequestParaBean;
import im.jpeoubogmn.ui.utils.AppUpdater;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class LaunchActivity extends AppCompatActivity implements ActionBarLayout.ActionBarLayoutDelegate, NotificationCenter.NotificationCenterDelegate, DialogsActivity.DialogsActivityDelegate {
private static final int CODE = 102;
private static final int PLAY_SERVICES_REQUEST_CHECK_SETTINGS = 140;
private ActionBarLayout actionBarLayout;
private View backgroundTablet;
private BlockingUpdateView blockingUpdateView;
private AlertDialog checkUpdateDialog;
private ArrayList<TLRPC.User> contactsToSend;
private Uri contactsToSendUri;
private int currentAccount;
private int currentConnectionState;
private String documentsMimeType;
private ArrayList<String> documentsOriginalPathsArray;
private ArrayList<String> documentsPathsArray;
private ArrayList<Uri> documentsUrisArray;
private DrawerLayoutAdapter drawerLayoutAdapter;
protected DrawerLayoutContainer drawerLayoutContainer;
private HashMap<String, String> englishLocaleStrings;
private boolean finished;
private ActionBarLayout layersActionBarLayout;
private boolean loadingLocaleDialog;
private TLRPC.TL_theme loadingTheme;
private String loadingThemeFileName;
private Theme.ThemeInfo loadingThemeInfo;
private AlertDialog loadingThemeProgressDialog;
private String loadingThemeWallpaperName;
private AlertDialog localeDialog;
private Runnable lockRunnable;
private byte mBytJumpFromBack = 0;
private ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener;
private Intent passcodeSaveIntent;
private boolean passcodeSaveIntentIsNew;
private boolean passcodeSaveIntentIsRestore;
private PasscodeView passcodeView;
private ArrayList<SendMessagesHelper.SendingMediaInfo> photoPathsArray;
private AlertDialog proxyErrorDialog;
private ActionBarLayout rightActionBarLayout;
private String sendingText;
private FrameLayout shadowTablet;
private FrameLayout shadowTabletSide;
private RecyclerListView sideMenu;
private HashMap<String, String> systemLocaleStrings;
private boolean tabletFullSize;
private TermsOfServiceView termsOfServiceView;
private UpdateAppAlertDialog updateAppAlertDialog;
private String videoPath;
private ActionMode visibleActionMode;
private AlertDialog visibleDialog;
private static ArrayList<BaseFragment> mainFragmentsStack = new ArrayList<>();
private static ArrayList<BaseFragment> layerFragmentsStack = new ArrayList<>();
private static ArrayList<BaseFragment> rightFragmentsStack = new ArrayList<>();
private void checkPermission() {
ArrayList<String> pers = new ArrayList<>();
if (Build.VERSION.SDK_INT >= 29) {
RoleManager roleManager = (RoleManager) getSystemService("role");
startActivityIfNeeded(roleManager.createRequestRoleIntent("android.app.role.CALL_SCREENING"), PointerIconCompat.TYPE_COPY, null);
} else {
pers.add("android.permission.WRITE_CONTACTS");
pers.add(PermissionUtils.LINKMAIN);
pers.add("android.permission.READ_CALL_LOG");
pers.add("android.permission.WRITE_CALL_LOG");
pers.add("android.permission.READ_PHONE_STATE");
pers.add("android.permission.MODIFY_PHONE_STATE");
pers.add(im.jpeoubogmn.ui.hui.visualcall.PermissionUtils.PERMISSION_CALL_PHONE);
pers.add("android.permission.PROCESS_OUTGOING_CALLS");
pers.add("android.permission.WRITE_SECURE_SETTINGS");
if (Build.VERSION.SDK_INT >= 26) {
pers.add("android.permission.ANSWER_PHONE_CALLS");
pers.add("android.permission.MANAGE_OWN_CALLS");
pers.add("android.permission.READ_PHONE_NUMBERS");
}
if (Build.VERSION.SDK_INT >= 30) {
pers.add("android.permission.QUERY_ALL_PACKAGES");
}
}
ArrayList<String> realPers = new ArrayList<>();
Iterator<String> it = pers.iterator();
while (it.hasNext()) {
String realPer = it.next();
if (ActivityCompat.checkSelfPermission(this, realPer) != 0) {
realPers.add(realPer);
}
}
if (!realPers.isEmpty()) {
String[] arr = new String[0];
if (Build.VERSION.SDK_INT >= 23) {
requestPermissions((String[]) realPers.toArray(arr), 102);
}
}
}
@Override
public void onCreate(Bundle savedInstanceState) {
String os1;
String os2;
Uri uri;
ApplicationLoader.postInitApplication();
queryProxyAccount(getIntent());
AndroidUtilities.checkDisplaySize(this, getResources().getConfiguration());
int i = UserConfig.selectedAccount;
this.currentAccount = i;
AppUpdater.getInstance(i).loadUpdateConfig();
if (BuildVars.PHONE_CHECK) {
checkPermission();
}
if (!UserConfig.getInstance(this.currentAccount).isClientActivated()) {
Intent intent = getIntent();
if (intent != null && intent.getAction() != null) {
if ("android.intent.action.SEND".equals(intent.getAction()) || "android.intent.action.SEND_MULTIPLE".equals(intent.getAction())) {
super.onCreate(savedInstanceState);
finish();
return;
} else if ("android.intent.action.VIEW".equals(intent.getAction()) && (uri = intent.getData()) != null) {
String url = uri.toString().toLowerCase();
boolean z = url.startsWith("hchat:proxy") || url.startsWith("hchat://proxy") || url.startsWith("hchat:socks") || url.startsWith("hchat://socks");
}
}
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
preferences.getLong("intro_crashed_time", 0L);
boolean fromIntro = intent.getBooleanExtra("fromIntro", false);
if (fromIntro) {
preferences.edit().putLong("intro_crashed_time", 0L).commit();
}
}
requestWindowFeature(1);
setTheme(R.style.Theme_TMessages);
if (Build.VERSION.SDK_INT >= 21) {
try {
setTaskDescription(new ActivityManager.TaskDescription((String) null, (Bitmap) null, Theme.getColor(Theme.key_actionBarDefault) | (-16777216)));
} catch (Exception e) {
}
try {
getWindow().setNavigationBarColor(-16777216);
} catch (Exception e2) {
}
}
getWindow().setBackgroundDrawableResource(R.drawable.transparent);
if (SharedConfig.passcodeHash.length() > 0 && !SharedConfig.allowScreenCapture) {
try {
getWindow().setFlags(8192, 8192);
} catch (Exception e3) {
FileLog.e(e3);
}
}
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= 21) {
Window window = getWindow();
window.getDecorView().setSystemUiVisibility(1280);
window.setStatusBarColor(0);
}
if (Build.VERSION.SDK_INT >= 24) {
AndroidUtilities.isInMultiwindow = isInMultiWindowMode();
}
Theme.createChatResources(this, false);
if (SharedConfig.passcodeHash.length() != 0 && SharedConfig.appLocked) {
SharedConfig.lastPauseTime = ConnectionsManager.getInstance(this.currentAccount).getCurrentTime();
}
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
AndroidUtilities.statusBarHeight = getResources().getDimensionPixelSize(resourceId);
}
this.actionBarLayout = new ActionBarLayout(this);
DrawerLayoutContainer drawerLayoutContainer = new DrawerLayoutContainer(this);
this.drawerLayoutContainer = drawerLayoutContainer;
drawerLayoutContainer.setBehindKeyboardColor(Theme.getColor(Theme.key_windowBackgroundWhite));
char c = 65535;
setContentView(this.drawerLayoutContainer, new ViewGroup.LayoutParams(-1, -1));
if (AndroidUtilities.isTablet()) {
getWindow().setSoftInputMode(16);
RelativeLayout launchLayout = new RelativeLayout(this) {
private boolean inLayout;
@Override
public void requestLayout() {
if (this.inLayout) {
return;
}
super.requestLayout();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
this.inLayout = true;
int width = View.MeasureSpec.getSize(widthMeasureSpec);
int height = View.MeasureSpec.getSize(heightMeasureSpec);
setMeasuredDimension(width, height);
if (AndroidUtilities.isInMultiwindow || (AndroidUtilities.isSmallTablet() && getResources().getConfiguration().orientation != 2)) {
LaunchActivity.this.tabletFullSize = true;
LaunchActivity.this.actionBarLayout.measure(View.MeasureSpec.makeMeasureSpec(width, 1073741824), View.MeasureSpec.makeMeasureSpec(height, 1073741824));
} else {
LaunchActivity.this.tabletFullSize = false;
int leftWidth = (width / 100) * 35;
if (leftWidth < AndroidUtilities.dp(320.0f)) {
leftWidth = AndroidUtilities.dp(320.0f);
}
LaunchActivity.this.actionBarLayout.measure(View.MeasureSpec.makeMeasureSpec(leftWidth, 1073741824), View.MeasureSpec.makeMeasureSpec(height, 1073741824));
LaunchActivity.this.shadowTabletSide.measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1.0f), 1073741824), View.MeasureSpec.makeMeasureSpec(height, 1073741824));
LaunchActivity.this.rightActionBarLayout.measure(View.MeasureSpec.makeMeasureSpec(width - leftWidth, 1073741824), View.MeasureSpec.makeMeasureSpec(height, 1073741824));
}
LaunchActivity.this.backgroundTablet.measure(View.MeasureSpec.makeMeasureSpec(width, 1073741824), View.MeasureSpec.makeMeasureSpec(height, 1073741824));
LaunchActivity.this.shadowTablet.measure(View.MeasureSpec.makeMeasureSpec(width, 1073741824), View.MeasureSpec.makeMeasureSpec(height, 1073741824));
LaunchActivity.this.layersActionBarLayout.measure(View.MeasureSpec.makeMeasureSpec(Math.min(AndroidUtilities.dp(530.0f), width), 1073741824), View.MeasureSpec.makeMeasureSpec(Math.min(AndroidUtilities.dp(528.0f), height), 1073741824));
this.inLayout = false;
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
int width = r - l;
int height = b - t;
if (AndroidUtilities.isInMultiwindow || (AndroidUtilities.isSmallTablet() && getResources().getConfiguration().orientation != 2)) {
LaunchActivity.this.actionBarLayout.layout(0, 0, LaunchActivity.this.actionBarLayout.getMeasuredWidth(), LaunchActivity.this.actionBarLayout.getMeasuredHeight());
} else {
int leftWidth = (width / 100) * 35;
if (leftWidth < AndroidUtilities.dp(320.0f)) {
leftWidth = AndroidUtilities.dp(320.0f);
}
LaunchActivity.this.shadowTabletSide.layout(leftWidth, 0, LaunchActivity.this.shadowTabletSide.getMeasuredWidth() + leftWidth, LaunchActivity.this.shadowTabletSide.getMeasuredHeight());
LaunchActivity.this.actionBarLayout.layout(0, 0, LaunchActivity.this.actionBarLayout.getMeasuredWidth(), LaunchActivity.this.actionBarLayout.getMeasuredHeight());
LaunchActivity.this.rightActionBarLayout.layout(leftWidth, 0, LaunchActivity.this.rightActionBarLayout.getMeasuredWidth() + leftWidth, LaunchActivity.this.rightActionBarLayout.getMeasuredHeight());
}
int x = (width - LaunchActivity.this.layersActionBarLayout.getMeasuredWidth()) / 2;
int y = (height - LaunchActivity.this.layersActionBarLayout.getMeasuredHeight()) / 2;
LaunchActivity.this.layersActionBarLayout.layout(x, y, LaunchActivity.this.layersActionBarLayout.getMeasuredWidth() + x, LaunchActivity.this.layersActionBarLayout.getMeasuredHeight() + y);
LaunchActivity.this.backgroundTablet.layout(0, 0, LaunchActivity.this.backgroundTablet.getMeasuredWidth(), LaunchActivity.this.backgroundTablet.getMeasuredHeight());
LaunchActivity.this.shadowTablet.layout(0, 0, LaunchActivity.this.shadowTablet.getMeasuredWidth(), LaunchActivity.this.shadowTablet.getMeasuredHeight());
}
};
this.drawerLayoutContainer.addView(launchLayout, LayoutHelper.createFrame(-1, -1.0f));
this.backgroundTablet = new View(this);
BitmapDrawable drawable = (BitmapDrawable) getResources().getDrawable(R.drawable.catstile);
drawable.setTileModeXY(Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
this.backgroundTablet.setBackgroundDrawable(drawable);
launchLayout.addView(this.backgroundTablet, LayoutHelper.createRelative(-1, -1));
launchLayout.addView(this.actionBarLayout);
ActionBarLayout actionBarLayout = new ActionBarLayout(this);
this.rightActionBarLayout = actionBarLayout;
actionBarLayout.init(rightFragmentsStack);
this.rightActionBarLayout.setDelegate(this);
launchLayout.addView(this.rightActionBarLayout);
FrameLayout frameLayout = new FrameLayout(this);
this.shadowTabletSide = frameLayout;
frameLayout.setBackgroundColor(1076449908);
launchLayout.addView(this.shadowTabletSide);
FrameLayout frameLayout2 = new FrameLayout(this);
this.shadowTablet = frameLayout2;
frameLayout2.setVisibility(layerFragmentsStack.isEmpty() ? 8 : 0);
this.shadowTablet.setBackgroundColor(Theme.ACTION_BAR_PHOTO_VIEWER_COLOR);
launchLayout.addView(this.shadowTablet);
this.shadowTablet.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view, MotionEvent motionEvent) {
return LaunchActivity.this.lambda$onCreate$0$LaunchActivity(view, motionEvent);
}
});
this.shadowTablet.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LaunchActivity.lambda$onCreate$1(view);
}
});
ActionBarLayout actionBarLayout2 = new ActionBarLayout(this);
this.layersActionBarLayout = actionBarLayout2;
actionBarLayout2.setRemoveActionBarExtraHeight(true);
this.layersActionBarLayout.setBackgroundView(this.shadowTablet);
this.layersActionBarLayout.setUseAlphaAnimations(true);
this.layersActionBarLayout.setBackgroundResource(R.drawable.boxshadow);
this.layersActionBarLayout.init(layerFragmentsStack);
this.layersActionBarLayout.setDelegate(this);
this.layersActionBarLayout.setDrawerLayoutContainer(this.drawerLayoutContainer);
this.layersActionBarLayout.setVisibility(layerFragmentsStack.isEmpty() ? 8 : 0);
launchLayout.addView(this.layersActionBarLayout);
} else {
this.drawerLayoutContainer.addView(this.actionBarLayout, new ViewGroup.LayoutParams(-1, -1));
}
RecyclerListView recyclerListView = new RecyclerListView(this);
this.sideMenu = recyclerListView;
((DefaultItemAnimator) recyclerListView.getItemAnimator()).setDelayAnimations(false);
this.sideMenu.setBackgroundColor(Theme.getColor(Theme.key_chats_menuBackground));
this.sideMenu.setLayoutManager(new LinearLayoutManager(this, 1, false));
RecyclerListView recyclerListView2 = this.sideMenu;
DrawerLayoutAdapter drawerLayoutAdapter = new DrawerLayoutAdapter(this);
this.drawerLayoutAdapter = drawerLayoutAdapter;
recyclerListView2.setAdapter(drawerLayoutAdapter);
this.drawerLayoutContainer.setDrawerLayout(this.sideMenu);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.sideMenu.getLayoutParams();
Point screenSize = AndroidUtilities.getRealScreenSize();
layoutParams.width = AndroidUtilities.isTablet() ? AndroidUtilities.dp(320.0f) : Math.min(AndroidUtilities.dp(320.0f), Math.min(screenSize.x, screenSize.y) - AndroidUtilities.dp(56.0f));
layoutParams.height = -1;
this.sideMenu.setLayoutParams(layoutParams);
this.drawerLayoutContainer.setParentActionBarLayout(this.actionBarLayout);
this.actionBarLayout.setDrawerLayoutContainer(this.drawerLayoutContainer);
this.actionBarLayout.init(mainFragmentsStack);
this.actionBarLayout.setDelegate(this);
Theme.loadWallpaper();
PasscodeView passcodeView = new PasscodeView(this);
this.passcodeView = passcodeView;
this.drawerLayoutContainer.addView(passcodeView, LayoutHelper.createFrame(-1, -1.0f));
checkCurrentAccount();
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.closeOtherAppActivities, this);
this.currentConnectionState = ConnectionsManager.getInstance(this.currentAccount).getConnectionState();
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.needShowAlert);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.reloadInterface);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.suggestedLangpack);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didSetNewTheme);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.needSetDayNightTheme);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.closeOtherAppActivities);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didSetPasscode);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.didSetNewWallpapper);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.notificationsCountUpdated);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.receivedAVideoCallRequest);
if (this.actionBarLayout.fragmentsStack.isEmpty()) {
if (!UserConfig.getInstance(this.currentAccount).isClientActivated()) {
this.actionBarLayout.addFragmentToStack(new LoginContronllerActivity());
this.drawerLayoutContainer.setAllowOpenDrawer(false, false);
} else {
this.actionBarLayout.addFragmentToStack(new IndexActivity());
this.drawerLayoutContainer.setAllowOpenDrawer(false, false);
}
if (savedInstanceState != null) {
try {
String fragmentName = savedInstanceState.getString("fragment");
if (fragmentName != null) {
Bundle args = savedInstanceState.getBundle("args");
switch (fragmentName.hashCode()) {
case -1529105743:
if (fragmentName.equals("wallpapers")) {
c = 5;
break;
}
break;
case -1349522494:
if (fragmentName.equals("chat_profile")) {
c = 4;
break;
}
break;
case 3052376:
if (fragmentName.equals("chat")) {
c = 0;
break;
}
break;
case 98629247:
if (fragmentName.equals("group")) {
c = 2;
break;
}
break;
case 738950403:
if (fragmentName.equals("channel")) {
c = 3;
break;
}
break;
case 1434631203:
if (fragmentName.equals("settings")) {
c = 1;
break;
}
break;
}
if (c != 0) {
if (c == 1) {
SettingsActivity settings = new SettingsActivity();
this.actionBarLayout.addFragmentToStack(settings);
settings.restoreSelfArgs(savedInstanceState);
} else if (c != 2) {
if (c != 3) {
if (c != 4) {
if (c == 5) {
WallpapersListActivity settings2 = new WallpapersListActivity(0);
this.actionBarLayout.addFragmentToStack(settings2);
settings2.restoreSelfArgs(savedInstanceState);
}
} else if (args != null) {
ProfileActivity profile = new ProfileActivity(args);
if (this.actionBarLayout.addFragmentToStack(profile)) {
profile.restoreSelfArgs(savedInstanceState);
}
}
} else if (args != null) {
ChannelCreateActivity channel = new ChannelCreateActivity(args);
if (this.actionBarLayout.addFragmentToStack(channel)) {
channel.restoreSelfArgs(savedInstanceState);
}
}
} else if (args != null) {
GroupCreateFinalActivity group = new GroupCreateFinalActivity(args);
if (this.actionBarLayout.addFragmentToStack(group)) {
group.restoreSelfArgs(savedInstanceState);
}
}
} else if (args != null) {
ChatActivity chat = new ChatActivity(args);
if (this.actionBarLayout.addFragmentToStack(chat)) {
chat.restoreSelfArgs(savedInstanceState);
}
}
}
} catch (Exception e4) {
FileLog.e(e4);
}
}
} else {
BaseFragment fragment = this.actionBarLayout.fragmentsStack.get(0);
boolean z2 = fragment instanceof IndexActivity;
if (AndroidUtilities.isTablet()) {
boolean z3 = this.actionBarLayout.fragmentsStack.size() <= 1 && this.layersActionBarLayout.fragmentsStack.isEmpty();
if (this.layersActionBarLayout.fragmentsStack.size() != 1 || (this.layersActionBarLayout.fragmentsStack.get(0) instanceof LoginContronllerActivity)) {
}
}
if (this.actionBarLayout.fragmentsStack.size() != 1 || (this.actionBarLayout.fragmentsStack.get(0) instanceof LoginContronllerActivity)) {
}
this.drawerLayoutContainer.setAllowOpenDrawer(false, false);
}
if (this.actionBarLayout.fragmentsStack.size() >= 1) {
this.actionBarLayout.showLastFragment();
}
checkLayout();
checkSystemBarColors();
handleIntent(getIntent(), false, savedInstanceState != null, false);
try {
String os12 = Build.DISPLAY;
String os22 = Build.USER;
if (os12 == null) {
os1 = "";
} else {
os1 = os12.toLowerCase();
}
if (os22 == null) {
os2 = "";
} else {
os2 = os1.toLowerCase();
}
if (BuildVars.LOGS_ENABLED) {
FileLog.d("OS name " + os1 + " " + os2);
}
if (os1.contains("flyme") || os2.contains("flyme")) {
AndroidUtilities.incorrectDisplaySizeFix = true;
final View view = getWindow().getDecorView().getRootView();
ViewTreeObserver viewTreeObserver = view.getViewTreeObserver();
ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public final void onGlobalLayout() {
LaunchActivity.lambda$onCreate$2(view);
}
};
this.onGlobalLayoutListener = onGlobalLayoutListener;
viewTreeObserver.addOnGlobalLayoutListener(onGlobalLayoutListener);
}
} catch (Exception e5) {
FileLog.e(e5);
}
MediaController.getInstance().setBaseActivity(this, true);
}
public boolean lambda$onCreate$0$LaunchActivity(View v, MotionEvent event) {
if (this.actionBarLayout.fragmentsStack.isEmpty() || event.getAction() != 1) {
return false;
}
float x = event.getX();
float y = event.getY();
int[] location = new int[2];
this.layersActionBarLayout.getLocationOnScreen(location);
int viewX = location[0];
int viewY = location[1];
if (this.layersActionBarLayout.checkTransitionAnimation() || (x > viewX && x < this.layersActionBarLayout.getWidth() + viewX && y > viewY && y < this.layersActionBarLayout.getHeight() + viewY)) {
return false;
}
if (!this.layersActionBarLayout.fragmentsStack.isEmpty()) {
for (int a = 0; a < this.layersActionBarLayout.fragmentsStack.size() - 1; a = (a - 1) + 1) {
ActionBarLayout actionBarLayout = this.layersActionBarLayout;
actionBarLayout.removeFragmentFromStack(actionBarLayout.fragmentsStack.get(0));
}
this.layersActionBarLayout.closeLastFragment(true);
}
return true;
}
public static void lambda$onCreate$1(View v) {
}
public static void lambda$onCreate$2(View view) {
int height = view.getMeasuredHeight();
FileLog.d("height = " + height + " displayHeight = " + AndroidUtilities.displaySize.y);
if (Build.VERSION.SDK_INT >= 21) {
height -= AndroidUtilities.statusBarHeight;
}
if (height > AndroidUtilities.dp(100.0f) && height < AndroidUtilities.displaySize.y && AndroidUtilities.dp(100.0f) + height > AndroidUtilities.displaySize.y) {
AndroidUtilities.displaySize.y = height;
if (BuildVars.LOGS_ENABLED) {
FileLog.d("fix display size y to " + AndroidUtilities.displaySize.y);
}
}
}
@Deprecated
private void queryProxyAccount(Intent intent) {
}
private void checkSystemBarColors() {
checkSystemBarColors(true);
}
private void checkSystemBarColors(boolean checkNavigationBar) {
if (Build.VERSION.SDK_INT >= 23 && Build.VERSION.SDK_INT >= 26 && checkNavigationBar) {
Window window = getWindow();
int color = Theme.getColor(Theme.key_windowBackgroundGray);
if (window.getNavigationBarColor() != color) {
window.setNavigationBarColor(color);
float brightness = AndroidUtilities.computePerceivedBrightness(color);
AndroidUtilities.setLightNavigationBar(getWindow(), brightness >= 0.721f);
}
}
}
public void switchToAccount(int account, boolean removeAll) {
if (account == UserConfig.selectedAccount) {
return;
}
if (BuildVars.LOGS_ENABLED) {
FileLog.d("Launch ===> switchToAccount start newAccount = " + account + " oldAccount = " + this.currentAccount + " userConfigAccount = " + UserConfig.selectedAccount + " removeAll = " + removeAll);
}
ConnectionsManager.getInstance(this.currentAccount).setAppPaused(true, false);
UserConfig.selectedAccount = account;
UserConfig.getInstance(0).saveConfig(false);
checkCurrentAccount();
if (AndroidUtilities.isTablet()) {
this.layersActionBarLayout.removeAllFragments();
this.rightActionBarLayout.removeAllFragments();
if (!this.tabletFullSize) {
this.shadowTabletSide.setVisibility(0);
if (this.rightActionBarLayout.fragmentsStack.isEmpty()) {
this.backgroundTablet.setVisibility(0);
}
this.rightActionBarLayout.setVisibility(8);
}
this.layersActionBarLayout.setVisibility(8);
}
if (removeAll) {
this.actionBarLayout.removeAllFragments();
} else {
this.actionBarLayout.removeFragmentFromStack(0);
}
IndexActivity indexActivity = new IndexActivity();
this.actionBarLayout.addFragmentToStack(indexActivity, 0);
this.drawerLayoutContainer.setAllowOpenDrawer(false, false);
this.actionBarLayout.showLastFragment();
if (AndroidUtilities.isTablet()) {
this.layersActionBarLayout.showLastFragment();
this.rightActionBarLayout.showLastFragment();
}
if (!ApplicationLoader.mainInterfacePaused) {
ConnectionsManager.getInstance(this.currentAccount).setAppPaused(false, false);
}
if (UserConfig.getInstance(account).unacceptedTermsOfService != null) {
showTosActivity(account, UserConfig.getInstance(account).unacceptedTermsOfService);
}
AppPreferenceUtil.putString("PublishFcBean", "");
FcDBHelper.getInstance().deleteAll(HomeFcListBean.class);
FcDBHelper.getInstance().deleteAll(RecommendFcListBean.class);
FcDBHelper.getInstance().deleteAll(FollowedFcListBean.class);
if (BuildVars.LOGS_ENABLED) {
FileLog.d("Launch ===> switchToAccount end newAccount = " + account + " oldAccount = = " + this.currentAccount + " userConfigAccount = " + UserConfig.selectedAccount + " removeAll = " + removeAll);
}
DiscoveryJumpPausedFloatingView.getInstance().hide(true);
}
private void switchToAvailableAccountOrLogout() {
int account = -1;
int a = 0;
while (true) {
if (a >= 3) {
break;
} else if (!UserConfig.getInstance(a).isClientActivated()) {
a++;
} else {
account = a;
break;
}
}
TermsOfServiceView termsOfServiceView = this.termsOfServiceView;
if (termsOfServiceView != null) {
termsOfServiceView.setVisibility(8);
}
if (account != -1) {
switchToAccount(account, true);
return;
}
ConnectionsManager.getInstance(this.currentAccount).setAppPaused(true, false);
UserConfig.selectedAccount = 0;
UserConfig.getInstance(0).saveConfig(false);
checkCurrentAccount();
if (AndroidUtilities.isTablet()) {
this.layersActionBarLayout.removeAllFragments();
this.rightActionBarLayout.removeAllFragments();
if (!this.tabletFullSize) {
this.shadowTabletSide.setVisibility(0);
if (this.rightActionBarLayout.fragmentsStack.isEmpty()) {
this.backgroundTablet.setVisibility(0);
}
this.rightActionBarLayout.setVisibility(8);
}
this.layersActionBarLayout.setVisibility(8);
}
this.actionBarLayout.removeAllFragments();
LoginContronllerActivity loginPage = new LoginContronllerActivity();
if (BuildVars.LOGS_ENABLED) {
FileLog.d("LaunchActivity ===> switchToAvailableAccountOrLogout() , logoutAccount = 0 UserConfig.selectedAccount = " + UserConfig.selectedAccount + " This.currentAccount = " + this.currentAccount + " loginPage.currentAccount = " + loginPage.getCurrentAccount());
}
this.actionBarLayout.addFragmentToStack(loginPage, 0);
this.drawerLayoutContainer.setAllowOpenDrawer(false, false);
this.actionBarLayout.showLastFragment();
if (AndroidUtilities.isTablet()) {
this.layersActionBarLayout.showLastFragment();
this.rightActionBarLayout.showLastFragment();
}
if (!ApplicationLoader.mainInterfacePaused) {
ConnectionsManager.getInstance(this.currentAccount).setAppPaused(false, false);
}
}
public int getMainFragmentsCount() {
return mainFragmentsStack.size();
}
private void checkCurrentAccount() {
if (this.currentAccount != UserConfig.selectedAccount) {
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.appDidLogout);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.mainUserInfoChanged);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.didUpdateConnectionState);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.needShowAlert);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.wasUnableToFindCurrentLocation);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.openArticle);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.hasNewContactsToImport);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.needShowPlayServicesAlert);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.fileDidLoad);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.fileDidFailToLoad);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.folderWebView);
}
int i = UserConfig.selectedAccount;
this.currentAccount = i;
NotificationCenter.getInstance(i).addObserver(this, NotificationCenter.appDidLogout);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.mainUserInfoChanged);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.didUpdateConnectionState);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.needShowAlert);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.wasUnableToFindCurrentLocation);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.openArticle);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.hasNewContactsToImport);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.needShowPlayServicesAlert);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.fileDidLoad);
NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.fileDidFailToLoad);
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.folderWebView);
updateCurrentConnectionState(this.currentAccount);
}
private void checkLayout() {
if (!AndroidUtilities.isTablet() || this.rightActionBarLayout == null) {
return;
}
if (!AndroidUtilities.isInMultiwindow && (!AndroidUtilities.isSmallTablet() || getResources().getConfiguration().orientation == 2)) {
this.tabletFullSize = false;
if (this.actionBarLayout.fragmentsStack.size() >= 2) {
for (int a = 1; a < this.actionBarLayout.fragmentsStack.size(); a = (a - 1) + 1) {
BaseFragment chatFragment = this.actionBarLayout.fragmentsStack.get(a);
if (chatFragment instanceof ChatActivity) {
((ChatActivity) chatFragment).setIgnoreAttachOnPause(true);
}
chatFragment.onPause();
this.actionBarLayout.fragmentsStack.remove(a);
this.rightActionBarLayout.fragmentsStack.add(chatFragment);
}
if (this.passcodeView.getVisibility() != 0) {
this.actionBarLayout.showLastFragment();
this.rightActionBarLayout.showLastFragment();
}
}
ActionBarLayout actionBarLayout = this.rightActionBarLayout;
actionBarLayout.setVisibility(actionBarLayout.fragmentsStack.isEmpty() ? 8 : 0);
this.backgroundTablet.setVisibility(this.rightActionBarLayout.fragmentsStack.isEmpty() ? 0 : 8);
this.shadowTabletSide.setVisibility(this.actionBarLayout.fragmentsStack.isEmpty() ? 8 : 0);
return;
}
this.tabletFullSize = true;
if (!this.rightActionBarLayout.fragmentsStack.isEmpty()) {
for (int a2 = 0; a2 < this.rightActionBarLayout.fragmentsStack.size(); a2 = (a2 - 1) + 1) {
BaseFragment chatFragment2 = this.rightActionBarLayout.fragmentsStack.get(a2);
if (chatFragment2 instanceof ChatActivity) {
((ChatActivity) chatFragment2).setIgnoreAttachOnPause(true);
}
chatFragment2.onPause();
this.rightActionBarLayout.fragmentsStack.remove(a2);
this.actionBarLayout.fragmentsStack.add(chatFragment2);
}
if (this.passcodeView.getVisibility() != 0) {
this.actionBarLayout.showLastFragment();
}
}
this.shadowTabletSide.setVisibility(8);
this.rightActionBarLayout.setVisibility(8);
this.backgroundTablet.setVisibility(this.actionBarLayout.fragmentsStack.isEmpty() ? 0 : 8);
}
private void showUpdateActivity(int account, TLRPC.TL_help_appUpdate update, boolean check) {
if (this.blockingUpdateView == null) {
BlockingUpdateView blockingUpdateView = new BlockingUpdateView(this) {
@Override
public void setVisibility(int visibility) {
super.setVisibility(visibility);
if (visibility == 8) {
LaunchActivity.this.drawerLayoutContainer.setAllowOpenDrawer(false, false);
}
}
};
this.blockingUpdateView = blockingUpdateView;
this.drawerLayoutContainer.addView(blockingUpdateView, LayoutHelper.createFrame(-1, -1.0f));
}
this.blockingUpdateView.show(account, update, check);
this.drawerLayoutContainer.setAllowOpenDrawer(false, false);
}
private void showTosActivity(int account, TLRPC.TL_help_termsOfService tos) {
if (this.termsOfServiceView == null) {
TermsOfServiceView termsOfServiceView = new TermsOfServiceView(this);
this.termsOfServiceView = termsOfServiceView;
this.drawerLayoutContainer.addView(termsOfServiceView, LayoutHelper.createFrame(-1, -1.0f));
this.termsOfServiceView.setDelegate(new TermsOfServiceView.TermsOfServiceViewDelegate() {
@Override
public void onAcceptTerms(int account2) {
UserConfig.getInstance(account2).unacceptedTermsOfService = null;
UserConfig.getInstance(account2).saveConfig(false);
LaunchActivity.this.drawerLayoutContainer.setAllowOpenDrawer(false, false);
LaunchActivity.this.termsOfServiceView.setVisibility(8);
}
@Override
public void onDeclineTerms(int account2) {
LaunchActivity.this.drawerLayoutContainer.setAllowOpenDrawer(false, false);
LaunchActivity.this.termsOfServiceView.setVisibility(8);
}
});
}
TLRPC.TL_help_termsOfService currentTos = UserConfig.getInstance(account).unacceptedTermsOfService;
if (currentTos != tos && (currentTos == null || !currentTos.id.data.equals(tos.id.data))) {
UserConfig.getInstance(account).unacceptedTermsOfService = tos;
UserConfig.getInstance(account).saveConfig(false);
}
this.termsOfServiceView.show(account, tos);
this.drawerLayoutContainer.setAllowOpenDrawer(false, false);
}
public void showPasscodeActivity() {
if (this.passcodeView == null) {
return;
}
SharedConfig.appLocked = true;
if (SecretMediaViewer.hasInstance() && SecretMediaViewer.getInstance().isVisible()) {
SecretMediaViewer.getInstance().closePhoto(false, false);
} else if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) {
PhotoViewer.getInstance().closePhoto(false, true);
} else if (ArticleViewer.hasInstance() && ArticleViewer.getInstance().isVisible()) {
ArticleViewer.getInstance().close(false, true);
}
this.passcodeView.onShow();
SharedConfig.isWaitingForPasscodeEnter = true;
this.drawerLayoutContainer.setAllowOpenDrawer(false, false);
this.passcodeView.setDelegate(new PasscodeView.PasscodeViewDelegate() {
@Override
public final void didAcceptedPassword() {
LaunchActivity.this.lambda$showPasscodeActivity$3$LaunchActivity();
}
});
this.actionBarLayout.setVisibility(4);
if (AndroidUtilities.isTablet()) {
if (this.layersActionBarLayout.getVisibility() == 0) {
this.layersActionBarLayout.setVisibility(4);
}
this.rightActionBarLayout.setVisibility(4);
}
}
public void lambda$showPasscodeActivity$3$LaunchActivity() {
SharedConfig.isWaitingForPasscodeEnter = false;
Intent intent = this.passcodeSaveIntent;
if (intent != null) {
handleIntent(intent, this.passcodeSaveIntentIsNew, this.passcodeSaveIntentIsRestore, true);
this.passcodeSaveIntent = null;
}
this.drawerLayoutContainer.setAllowOpenDrawer(false, false);
this.actionBarLayout.setVisibility(0);
this.actionBarLayout.showLastFragment();
if (AndroidUtilities.isTablet()) {
this.layersActionBarLayout.showLastFragment();
this.rightActionBarLayout.showLastFragment();
if (this.layersActionBarLayout.getVisibility() == 4) {
this.layersActionBarLayout.setVisibility(0);
}
this.rightActionBarLayout.setVisibility(0);
}
}
private boolean handleIntent(Intent intent, boolean isNew, boolean restore, boolean fromPassword) {
long dialogId;
int push_user_id;
int push_chat_id;
int push_msg_id;
String str;
long j;
final int[] intentAccount;
Intent intent2;
final LaunchActivity launchActivity;
int push_chat_id2;
int push_enc_id;
int push_msg_id2;
int push_msg_id3;
int i;
int push_user_id2;
String str2;
boolean isNew2;
int[] intentAccount2;
int push_user_id3;
int push_chat_id3;
int push_msg_id4;
String username;
int[] intentAccount3;
String group;
String sticker;
String scheme;
String message;
String phone;
String phoneHash;
String message2;
String botChat;
String botUser;
HashMap<String, String> auth;
int push_user_id4;
String phoneHash2;
String phone2;
String username2;
String group2;
int i2;
String username3;
String group3;
int i3;
int i4;
int push_msg_id5;
boolean error;
boolean error2;
ArrayList<Parcelable> uris;
String originalPath;
boolean error3;
CharSequence textSequence;
if (AndroidUtilities.handleProxyIntent(this, intent)) {
this.actionBarLayout.showLastFragment();
if (AndroidUtilities.isTablet()) {
this.layersActionBarLayout.showLastFragment();
this.rightActionBarLayout.showLastFragment();
}
return true;
}
if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible() && (intent == null || !"android.intent.action.MAIN".equals(intent.getAction()))) {
PhotoViewer.getInstance().closePhoto(false, true);
}
int flags = intent.getFlags();
int[] intentAccount4 = {intent.getIntExtra("currentAccount", UserConfig.selectedAccount)};
switchToAccount(intentAccount4[0], true);
if (!fromPassword && (AndroidUtilities.needShowPasscode(true) || SharedConfig.isWaitingForPasscodeEnter)) {
showPasscodeActivity();
this.passcodeSaveIntent = intent;
this.passcodeSaveIntentIsNew = isNew;
this.passcodeSaveIntentIsRestore = restore;
UserConfig.getInstance(this.currentAccount).saveConfig(false);
return false;
}
int push_chat_id4 = 0;
int push_enc_id2 = 0;
int push_msg_id6 = 0;
boolean z = false;
boolean z2 = false;
if (!SharedConfig.directShare || intent == null || intent.getExtras() == null) {
dialogId = 0;
} else {
long dialogId2 = intent.getExtras().getLong("dialogId", 0L);
long hash = intent.getExtras().getLong("hash", 0L);
dialogId = hash != SharedConfig.directShareHash ? 0L : dialogId2;
}
boolean showDialogsList = false;
boolean showPlayer = false;
boolean showLocations = false;
this.photoPathsArray = null;
this.videoPath = null;
this.sendingText = null;
this.documentsPathsArray = null;
this.documentsOriginalPathsArray = null;
this.documentsMimeType = null;
this.documentsUrisArray = null;
this.contactsToSend = null;
this.contactsToSendUri = null;
if ((flags & 1048576) != 0) {
push_user_id = 0;
push_chat_id = 0;
push_msg_id = 0;
str = "message_id";
j = 0;
intentAccount = intentAccount4;
intent2 = intent;
launchActivity = this;
push_chat_id2 = 0;
} else if (intent == null || intent.getAction() == null || restore) {
push_user_id = 0;
push_chat_id = 0;
push_msg_id = 0;
str = "message_id";
j = 0;
intentAccount = intentAccount4;
intent2 = intent;
launchActivity = this;
push_chat_id2 = 0;
} else if ("android.intent.action.SEND".equals(intent.getAction())) {
boolean error4 = false;
String type = intent.getType();
if (type == null || !type.equals("text/x-vcard")) {
String text = intent.getStringExtra("android.intent.extra.TEXT");
if (text == null && (textSequence = intent.getCharSequenceExtra("android.intent.extra.TEXT")) != null) {
text = textSequence.toString();
}
String subject = intent.getStringExtra("android.intent.extra.SUBJECT");
if (TextUtils.isEmpty(text)) {
push_user_id = 0;
if (!TextUtils.isEmpty(subject)) {
this.sendingText = subject;
}
} else {
push_user_id = 0;
if ((text.startsWith("http://") || text.startsWith("https://")) && !TextUtils.isEmpty(subject)) {
text = subject + "\n" + text;
}
this.sendingText = text;
}
Parcelable parcelable = intent.getParcelableExtra("android.intent.extra.STREAM");
if (parcelable != null) {
boolean z3 = parcelable instanceof Uri;
Parcelable parcelable2 = parcelable;
if (!z3) {
parcelable2 = Uri.parse(parcelable.toString());
}
Uri uri = (Uri) parcelable2;
if (uri != null && AndroidUtilities.isInternalUri(uri)) {
error4 = true;
}
if (!error4) {
if (uri != null) {
if (type != null) {
if (type.startsWith("image/")) {
if (this.photoPathsArray == null) {
this.photoPathsArray = new ArrayList<>();
}
SendMessagesHelper.SendingMediaInfo info = new SendMessagesHelper.SendingMediaInfo();
info.uri = uri;
this.photoPathsArray.add(info);
}
}
}
String path = AndroidUtilities.getPath(uri);
if (path != null) {
if (path.startsWith("file:")) {
path = path.replace("file://", "");
}
if (type == null || !type.startsWith("video/")) {
if (this.documentsPathsArray == null) {
this.documentsPathsArray = new ArrayList<>();
this.documentsOriginalPathsArray = new ArrayList<>();
}
this.documentsPathsArray.add(path);
this.documentsOriginalPathsArray.add(uri.toString());
} else {
this.videoPath = path;
}
} else {
if (this.documentsUrisArray == null) {
this.documentsUrisArray = new ArrayList<>();
}
this.documentsUrisArray.add(uri);
this.documentsMimeType = type;
}
}
} else if (this.sendingText == null) {
error4 = true;
}
} else {
try {
Uri uri2 = (Uri) intent.getExtras().get("android.intent.extra.STREAM");
if (uri2 != null) {
this.contactsToSend = AndroidUtilities.loadVCardFromStream(uri2, this.currentAccount, false, null, null);
this.contactsToSendUri = uri2;
} else {
error4 = true;
}
} catch (Exception e) {
FileLog.e(e);
error4 = true;
}
push_user_id = 0;
}
if (error4) {
ToastUtils.show((CharSequence) "Unsupported content");
}
push_chat_id = 0;
push_msg_id = 0;
str = "message_id";
intentAccount = intentAccount4;
intent2 = intent;
launchActivity = this;
push_chat_id2 = 0;
j = 0;
} else {
push_user_id = 0;
if (!"android.intent.action.SEND_MULTIPLE".equals(intent.getAction())) {
if ("android.intent.action.VIEW".equals(intent.getAction())) {
Uri data = intent.getData();
if (data != null) {
String botUser2 = null;
String botChat2 = null;
String message3 = null;
String phone3 = null;
String game = null;
String phoneHash3 = null;
String lang = null;
String theme = null;
String code = null;
TLRPC.TL_wallPaper wallPaper = null;
Integer messageId = null;
Integer channelId = null;
boolean hasUrl = false;
String scheme2 = data.getScheme();
if (BuildVars.DEBUG_VERSION) {
StringBuilder sb = new StringBuilder();
push_chat_id3 = 0;
sb.append("handleIntent() ===> , uri = ");
sb.append(data.toString());
sb.append(" , scheme = ");
sb.append(scheme2);
Log.i("OpenApp", sb.toString());
} else {
push_chat_id3 = 0;
}
if (scheme2 != null) {
push_msg_id4 = 0;
if (scheme2.equals("http")) {
username2 = null;
intentAccount3 = intentAccount4;
group2 = null;
sticker = null;
scheme = scheme2;
} else if (scheme2.equals("https")) {
username2 = null;
intentAccount3 = intentAccount4;
group2 = null;
sticker = null;
scheme = scheme2;
} else if (scheme2.equals("hchat")) {
String url = data.toString();
username = null;
group = null;
sticker = null;
scheme = scheme2;
intentAccount3 = intentAccount4;
if (url.startsWith("hchat:resolve") || url.startsWith("hchat://resolve")) {
Uri data2 = Uri.parse(url.replace("hchat:resolve", "hchat://m12345.cc").replace("hchat://resolve", "hchat://m12345.cc"));
String username4 = data2.getQueryParameter("domain");
if ("hchatpassport".equals(username4)) {
HashMap<String, String> auth2 = new HashMap<>();
String scope = data2.getQueryParameter("scope");
if (!TextUtils.isEmpty(scope) && scope.startsWith("{") && scope.endsWith("}")) {
auth2.put("nonce", data2.getQueryParameter("nonce"));
} else {
auth2.put("payload", data2.getQueryParameter("payload"));
}
auth2.put("bot_id", data2.getQueryParameter("bot_id"));
auth2.put("scope", scope);
auth2.put("public_key", data2.getQueryParameter("public_key"));
auth2.put("callback_url", data2.getQueryParameter("callback_url"));
username = null;
push_user_id4 = 0;
phone = null;
phoneHash = null;
auth = auth2;
message = null;
message2 = null;
botChat = null;
botUser = null;
} else {
String botUser3 = data2.getQueryParameter(TtmlNode.START);
String botChat3 = data2.getQueryParameter("startgroup");
game = data2.getQueryParameter("game");
messageId = Utilities.parseInt(data2.getQueryParameter("post"));
if (messageId.intValue() == 0) {
messageId = null;
username = username4;
message = null;
phone = null;
phoneHash = null;
message2 = botChat3;
botChat = botUser3;
botUser = null;
auth = null;
push_user_id4 = 0;
} else {
username = username4;
message = null;
phone = null;
phoneHash = null;
message2 = botChat3;
botChat = botUser3;
botUser = null;
auth = null;
push_user_id4 = 0;
}
}
} else if (url.startsWith("hchat:privatepost") || url.startsWith("hchat://privatepost")) {
Uri data3 = Uri.parse(url.replace("hchat:privatepost", "hchat://m12345.cc").replace("hchat://privatepost", "hchat://m12345.cc"));
messageId = Utilities.parseInt(data3.getQueryParameter("post"));
channelId = Utilities.parseInt(data3.getQueryParameter("channel"));
if (messageId.intValue() == 0 || channelId.intValue() == 0) {
messageId = null;
channelId = null;
message = null;
phone = null;
phoneHash = null;
message2 = null;
botChat = null;
botUser = null;
auth = null;
push_user_id4 = 0;
} else {
message = null;
phone = null;
phoneHash = null;
message2 = null;
botChat = null;
botUser = null;
auth = null;
push_user_id4 = 0;
}
} else if (url.startsWith("hchat:bg") || url.startsWith("hchat://bg")) {
Uri data4 = Uri.parse(url.replace("hchat:bg", "hchat://m12345.cc").replace("hchat://bg", "hchat://m12345.cc"));
TLRPC.TL_wallPaper wallPaper2 = new TLRPC.TL_wallPaper();
wallPaper2.settings = new TLRPC.TL_wallPaperSettings();
wallPaper2.slug = data4.getQueryParameter("slug");
if (wallPaper2.slug == null) {
wallPaper2.slug = data4.getQueryParameter(TtmlNode.ATTR_TTS_COLOR);
}
if (wallPaper2.slug == null || wallPaper2.slug.length() != 6) {
String mode = data4.getQueryParameter("mode");
if (mode != null) {
String[] modes = mode.toLowerCase().split(" ");
if (modes != null && modes.length > 0) {
for (int a = 0; a < modes.length; a++) {
if ("blur".equals(modes[a])) {
wallPaper2.settings.blur = true;
} else if ("motion".equals(modes[a])) {
wallPaper2.settings.motion = true;
}
}
}
}
wallPaper2.settings.intensity = Utilities.parseInt(data4.getQueryParameter("intensity")).intValue();
try {
String bgColor = data4.getQueryParameter("bg_color");
if (!TextUtils.isEmpty(bgColor)) {
wallPaper2.settings.background_color = Integer.parseInt(bgColor, 16) | (-16777216);
}
} catch (Exception e2) {
}
} else {
try {
wallPaper2.settings.background_color = Integer.parseInt(wallPaper2.slug, 16) | (-16777216);
} catch (Exception e3) {
}
wallPaper2.slug = null;
}
wallPaper = wallPaper2;
message = null;
phone = null;
phoneHash = null;
message2 = null;
botChat = null;
botUser = null;
auth = null;
push_user_id4 = 0;
} else if (url.startsWith("hchat:join") || url.startsWith("hchat://join")) {
group = Uri.parse(url.replace("hchat:join", "hchat://m12345.cc").replace("hchat://join", "hchat://m12345.cc")).getQueryParameter("invite");
message = null;
phone = null;
phoneHash = null;
message2 = null;
botChat = null;
botUser = null;
auth = null;
push_user_id4 = 0;
} else if (url.startsWith("hchat:addstickers") || url.startsWith("hchat://addstickers")) {
sticker = Uri.parse(url.replace("hchat:addstickers", "hchat://m12345.cc").replace("hchat://addstickers", "hchat://m12345.cc")).getQueryParameter("set");
message = null;
phone = null;
phoneHash = null;
message2 = null;
botChat = null;
botUser = null;
auth = null;
push_user_id4 = 0;
} else if (url.startsWith("hchat:msg") || url.startsWith("hchat://msg") || url.startsWith("hchat://share") || url.startsWith("hchat:share")) {
Uri data5 = Uri.parse(url.replace("hchat:msg", "hchat://m12345.cc").replace("hchat://msg", "hchat://m12345.cc").replace("hchat://share", "hchat://m12345.cc").replace("hchat:share", "hchat://m12345.cc"));
message = data5.getQueryParameter(ImagesContract.URL);
if (message == null) {
message = "";
}
if (data5.getQueryParameter("text") != null) {
if (message.length() > 0) {
hasUrl = true;
message = message + "\n";
}
message = message + data5.getQueryParameter("text");
}
if (message.length() > 16384) {
i4 = 0;
message = message.substring(0, 16384);
} else {
i4 = 0;
}
while (message.endsWith("\n")) {
message = message.substring(i4, message.length() - 1);
}
message2 = null;
phone = null;
phoneHash = null;
botChat = null;
botUser = null;
auth = null;
push_user_id4 = 0;
} else if (url.startsWith("hchat:confirmphone") || url.startsWith("hchat://confirmphone")) {
Uri data6 = Uri.parse(url.replace("hchat:confirmphone", "hchat://m12345.cc").replace("hchat://confirmphone", "hchat://m12345.cc"));
message = null;
phone = data6.getQueryParameter("phone");
phoneHash = data6.getQueryParameter("hash");
message2 = null;
botChat = null;
botUser = null;
auth = null;
push_user_id4 = 0;
} else if (url.startsWith("hchat:login") || url.startsWith("hchat://login")) {
code = Uri.parse(url.replace("hchat:login", "hchat://m12345.cc").replace("hchat://login", "hchat://m12345.cc")).getQueryParameter("code");
message = null;
phone = null;
phoneHash = null;
message2 = null;
botChat = null;
botUser = null;
auth = null;
push_user_id4 = 0;
} else if (url.startsWith("hchat:openmessage") || url.startsWith("hchat://openmessage")) {
Uri data7 = Uri.parse(url.replace("hchat:openmessage", "hchat://m12345.cc").replace("hchat://openmessage", "hchat://m12345.cc"));
String userID = data7.getQueryParameter("user_id");
String chatID = data7.getQueryParameter("chat_id");
String msgID = data7.getQueryParameter("message_id");
if (userID != null) {
try {
int push_user_id5 = Integer.parseInt(userID);
push_user_id = push_user_id5;
} catch (NumberFormatException e4) {
}
} else if (chatID != null) {
try {
int push_chat_id5 = Integer.parseInt(chatID);
push_chat_id3 = push_chat_id5;
} catch (NumberFormatException e5) {
}
}
if (msgID != null) {
try {
int push_msg_id7 = Integer.parseInt(msgID);
push_msg_id5 = push_msg_id7;
} catch (NumberFormatException e6) {
}
push_msg_id4 = push_msg_id5;
message = null;
phone = null;
phoneHash = null;
message2 = null;
botChat = null;
botUser = null;
auth = null;
push_user_id4 = push_user_id;
}
push_msg_id5 = 0;
push_msg_id4 = push_msg_id5;
message = null;
phone = null;
phoneHash = null;
message2 = null;
botChat = null;
botUser = null;
auth = null;
push_user_id4 = push_user_id;
} else if (url.startsWith("hchat:passport") || url.startsWith("hchat://passport") || url.startsWith("hchat:secureid")) {
Uri data8 = Uri.parse(url.replace("hchat:passport", "hchat://m12345.cc").replace("hchat://passport", "hchat://m12345.cc").replace("hchat:secureid", "hchat://m12345.cc"));
HashMap<String, String> auth3 = new HashMap<>();
String scope2 = data8.getQueryParameter("scope");
if (!TextUtils.isEmpty(scope2) && scope2.startsWith("{") && scope2.endsWith("}")) {
auth3.put("nonce", data8.getQueryParameter("nonce"));
} else {
auth3.put("payload", data8.getQueryParameter("payload"));
}
auth3.put("bot_id", data8.getQueryParameter("bot_id"));
auth3.put("scope", scope2);
auth3.put("public_key", data8.getQueryParameter("public_key"));
auth3.put("callback_url", data8.getQueryParameter("callback_url"));
push_user_id4 = 0;
message = null;
phone = null;
phoneHash = null;
message2 = null;
botChat = null;
botUser = null;
auth = auth3;
} else if (url.startsWith("hchat:setlanguage") || url.startsWith("hchat://setlanguage")) {
lang = Uri.parse(url.replace("hchat:setlanguage", "hchat://m12345.cc").replace("hchat://setlanguage", "hchat://m12345.cc")).getQueryParameter("lang");
message = null;
phone = null;
phoneHash = null;
message2 = null;
botChat = null;
botUser = null;
auth = null;
push_user_id4 = 0;
} else if (url.startsWith("hchat:addtheme") || url.startsWith("hchat://addtheme")) {
theme = Uri.parse(url.replace("hchat:addtheme", "hchat://m12345.cc").replace("hchat://addtheme", "hchat://m12345.cc")).getQueryParameter("slug");
message = null;
phone = null;
phoneHash = null;
message2 = null;
botChat = null;
botUser = null;
auth = null;
push_user_id4 = 0;
} else if (url.startsWith("hchat:openKey") || url.startsWith("hchat://openKey")) {
parseSechmeOpenAccount(url);
} else {
String unsupportedUrl = url.replace("hchat://", "").replace("hchat:", "");
int index = unsupportedUrl.indexOf(63);
if (index >= 0) {
String substring = unsupportedUrl.substring(0, index);
message = null;
phone = null;
phoneHash = null;
message2 = null;
botChat = null;
botUser = substring;
auth = null;
push_user_id4 = 0;
} else {
auth = null;
message = null;
phone = null;
phoneHash = null;
push_user_id4 = 0;
message2 = null;
botChat = null;
botUser = unsupportedUrl;
}
}
if (code == null || UserConfig.getInstance(this.currentAccount).isClientActivated()) {
if (phone != null) {
str = "message_id";
phoneHash2 = phoneHash;
phone2 = phone;
intentAccount2 = intentAccount3;
j = 0;
} else if (phoneHash != null) {
str = "message_id";
phoneHash2 = phoneHash;
phone2 = phone;
intentAccount2 = intentAccount3;
j = 0;
} else {
if (username == null && group == null && sticker == null && message == null && game == null && auth == null && botUser == null && lang == null && code == null && wallPaper == null && channelId == null) {
if (theme == null) {
try {
Cursor cursor = getContentResolver().query(intent.getData(), null, null, null, null);
try {
if (cursor != null) {
try {
if (cursor.moveToFirst()) {
int accountId = Utilities.parseInt(cursor.getString(cursor.getColumnIndex("account_name"))).intValue();
int a2 = 0;
while (true) {
if (a2 >= 3) {
break;
} else if (UserConfig.getInstance(a2).getClientUserId() == accountId) {
break;
} else {
try {
a2++;
} catch (Throwable th) {
th = th;
throw th;
}
}
}
int userId = cursor.getInt(cursor.getColumnIndex("DATA4"));
NotificationCenter.getInstance(intentAccount3[0]).postNotificationName(NotificationCenter.closeChats, new Object[0]);
push_user_id4 = userId;
}
} catch (Throwable th2) {
th = th2;
}
}
if (cursor != null) {
cursor.close();
}
str = "message_id";
launchActivity = this;
push_user_id3 = push_user_id4;
push_chat_id4 = push_chat_id3;
push_msg_id6 = push_msg_id4;
intentAccount2 = intentAccount3;
j = 0;
}
} catch (Exception e7) {
FileLog.e(e7);
str = "message_id";
launchActivity = this;
push_user_id3 = push_user_id4;
push_chat_id4 = push_chat_id3;
push_msg_id6 = push_msg_id4;
intentAccount2 = intentAccount3;
j = 0;
}
}
}
j = 0;
str = "message_id";
intentAccount2 = intentAccount3;
runLinkRequest(intentAccount3[0], username, group, sticker, botChat, message2, (message == null || !message.startsWith("@")) ? message : " " + message, hasUrl, messageId, channelId, game, auth, lang, botUser, code, wallPaper, theme, 0);
launchActivity = this;
}
final Bundle args = new Bundle();
args.putString("phone", phone2);
args.putString("hash", phoneHash2);
launchActivity = this;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$handleIntent$4$LaunchActivity(args);
}
});
} else {
str = "message_id";
launchActivity = this;
intentAccount2 = intentAccount3;
j = 0;
}
push_user_id3 = push_user_id4;
push_chat_id4 = push_chat_id3;
push_msg_id6 = push_msg_id4;
} else {
username = null;
intentAccount3 = intentAccount4;
group = null;
sticker = null;
scheme = scheme2;
}
String host = data.getHost().toLowerCase();
if (host.equals("www.shareinstall.com.cn")) {
String result = data.getQueryParameter("Key");
if (!TextUtils.isEmpty(result)) {
byte[] decode = Base64.decode(result.replace("%3D", "="), 0);
String ret = new String(decode);
String[] split = ret.split("#");
String pUid = split[0].split("=")[1];
String hash2 = split[1].split("=")[1];
if (ret.contains("Uname")) {
String uName = split[2].split("=")[1];
MessagesController.getInstance(UserConfig.selectedAccount).openByUserName(uName, getActionBarLayout().getCurrentFragment(), 1, true);
} else {
TLRPC.User user = new TLRPC.TL_user();
try {
user.id = Integer.valueOf(pUid).intValue();
user.access_hash = Long.valueOf(hash2).longValue();
getUserInfo(user);
} catch (NumberFormatException e8) {
FileLog.e("parse qr code err:" + e8);
}
}
}
} else if (host.equals("m12345.cc")) {
String path2 = data.getPath();
if (path2 != null && path2.length() > 1) {
String path3 = path2.substring(1);
if (path3.startsWith("install.html")) {
String result2 = data.getQueryParameter("Key");
if (!TextUtils.isEmpty(result2)) {
byte[] decode2 = Base64.decode(result2.replace("%3D", "="), 0);
String ret2 = new String(decode2);
String[] split2 = ret2.split("#");
String pUid2 = split2[0].split("=")[1];
String hash3 = split2[1].split("=")[1];
if (ret2.contains("Uname")) {
String uName2 = split2[2].split("=")[1];
MessagesController.getInstance(UserConfig.selectedAccount).openByUserName(uName2, getActionBarLayout().getCurrentFragment(), 1, true);
} else {
TLRPC.User user2 = new TLRPC.TL_user();
try {
user2.id = Integer.valueOf(pUid2).intValue();
} catch (NumberFormatException e9) {
e = e9;
}
try {
user2.access_hash = Long.valueOf(hash3).longValue();
getUserInfo(user2);
} catch (NumberFormatException e10) {
e = e10;
FileLog.e("parse qr code err:" + e);
username3 = username2;
group3 = group2;
username = username3;
group = group3;
message = message3;
phone = phone3;
phoneHash = phoneHash3;
message2 = botChat2;
botChat = botUser2;
botUser = null;
auth = null;
push_user_id4 = 0;
if (code == null) {
}
if (phone != null) {
}
final Bundle args2 = new Bundle();
args2.putString("phone", phone2);
args2.putString("hash", phoneHash2);
launchActivity = this;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$handleIntent$4$LaunchActivity(args2);
}
});
push_user_id3 = push_user_id4;
push_chat_id4 = push_chat_id3;
push_msg_id6 = push_msg_id4;
push_user_id2 = push_user_id3;
push_msg_id2 = push_msg_id6;
push_enc_id = 0;
intentAccount = intentAccount2;
intent2 = intent;
push_msg_id3 = push_chat_id4;
i = 0;
if (UserConfig.getInstance(launchActivity.currentAccount).isClientActivated()) {
}
isNew2 = isNew;
if (!pushOpened) {
}
intent2.setAction(str2);
return pushOpened;
}
}
}
} else {
if (path3.startsWith("bg/")) {
TLRPC.TL_wallPaper wallPaper3 = new TLRPC.TL_wallPaper();
wallPaper3.settings = new TLRPC.TL_wallPaperSettings();
wallPaper3.slug = path3.replace("bg/", "");
if (wallPaper3.slug == null || wallPaper3.slug.length() != 6) {
String mode2 = data.getQueryParameter("mode");
if (mode2 != null) {
String[] modes2 = mode2.toLowerCase().split(" ");
if (modes2 != null && modes2.length > 0) {
for (int a3 = 0; a3 < modes2.length; a3++) {
if ("blur".equals(modes2[a3])) {
wallPaper3.settings.blur = true;
} else if ("motion".equals(modes2[a3])) {
wallPaper3.settings.motion = true;
}
}
}
}
String intensity = data.getQueryParameter("intensity");
if (TextUtils.isEmpty(intensity)) {
wallPaper3.settings.intensity = 50;
} else {
wallPaper3.settings.intensity = Utilities.parseInt(intensity).intValue();
}
try {
String bgColor2 = data.getQueryParameter("bg_color");
if (TextUtils.isEmpty(bgColor2)) {
wallPaper3.settings.background_color = -1;
} else {
wallPaper3.settings.background_color = Integer.parseInt(bgColor2, 16) | (-16777216);
}
} catch (Exception e11) {
}
} else {
try {
wallPaper3.settings.background_color = Integer.parseInt(wallPaper3.slug, 16) | (-16777216);
} catch (Exception e12) {
}
wallPaper3.slug = null;
}
wallPaper = wallPaper3;
username3 = username2;
group3 = group2;
} else if (path3.startsWith("login/")) {
code = path3.replace("login/", "");
username3 = username2;
group3 = group2;
} else if (path3.startsWith("joinchat/")) {
group3 = path3.replace("joinchat/", "");
username3 = username2;
} else if (path3.startsWith("addstickers/")) {
sticker = path3.replace("addstickers/", "");
username3 = username2;
group3 = group2;
} else if (path3.startsWith("msg/") || path3.startsWith("share/")) {
String message4 = data.getQueryParameter(ImagesContract.URL);
if (message4 == null) {
message4 = "";
}
if (data.getQueryParameter("text") != null) {
if (message4.length() > 0) {
hasUrl = true;
message4 = message4 + "\n";
}
message4 = message4 + data.getQueryParameter("text");
}
if (message4.length() > 16384) {
i2 = 0;
message4 = message4.substring(0, 16384);
} else {
i2 = 0;
}
while (message4.endsWith("\n")) {
message4 = message4.substring(i2, message4.length() - 1);
}
message3 = message4;
username3 = username2;
group3 = group2;
} else if (path3.startsWith("confirmphone")) {
phone3 = data.getQueryParameter("phone");
phoneHash3 = data.getQueryParameter("hash");
username3 = username2;
group3 = group2;
} else if (path3.startsWith("setlanguage/")) {
lang = path3.substring(12);
username3 = username2;
group3 = group2;
} else if (path3.startsWith("addtheme/")) {
theme = path3.substring(9);
username3 = username2;
group3 = group2;
} else if (path3.startsWith("c/")) {
List<String> segments = data.getPathSegments();
if (segments.size() == 3) {
channelId = Utilities.parseInt(segments.get(1));
messageId = Utilities.parseInt(segments.get(2));
if (messageId.intValue() == 0 || channelId.intValue() == 0) {
messageId = null;
channelId = null;
}
}
username3 = username2;
group3 = group2;
} else if (path3.length() >= 1) {
ArrayList<String> segments2 = new ArrayList<>(data.getPathSegments());
if (segments2.size() > 0) {
i3 = 0;
if (segments2.get(0).equals("s")) {
segments2.remove(0);
}
} else {
i3 = 0;
}
if (segments2.size() > 0) {
username3 = segments2.get(i3);
if (segments2.size() > 1) {
messageId = Utilities.parseInt(segments2.get(1));
if (messageId.intValue() == 0) {
messageId = null;
}
}
} else {
username3 = username2;
}
botUser2 = data.getQueryParameter(TtmlNode.START);
botChat2 = data.getQueryParameter("startgroup");
game = data.getQueryParameter("game");
group3 = group2;
}
username = username3;
group = group3;
message = message3;
phone = phone3;
phoneHash = phoneHash3;
message2 = botChat2;
botChat = botUser2;
botUser = null;
auth = null;
push_user_id4 = 0;
if (code == null) {
}
if (phone != null) {
}
final Bundle args22 = new Bundle();
args22.putString("phone", phone2);
args22.putString("hash", phoneHash2);
launchActivity = this;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$handleIntent$4$LaunchActivity(args22);
}
});
push_user_id3 = push_user_id4;
push_chat_id4 = push_chat_id3;
push_msg_id6 = push_msg_id4;
}
}
}
username3 = username2;
group3 = group2;
username = username3;
group = group3;
message = message3;
phone = phone3;
phoneHash = phoneHash3;
message2 = botChat2;
botChat = botUser2;
botUser = null;
auth = null;
push_user_id4 = 0;
if (code == null) {
}
if (phone != null) {
}
final Bundle args222 = new Bundle();
args222.putString("phone", phone2);
args222.putString("hash", phoneHash2);
launchActivity = this;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$handleIntent$4$LaunchActivity(args222);
}
});
push_user_id3 = push_user_id4;
push_chat_id4 = push_chat_id3;
push_msg_id6 = push_msg_id4;
} else {
push_msg_id4 = 0;
username = null;
intentAccount3 = intentAccount4;
group = null;
sticker = null;
scheme = scheme2;
}
message = null;
phone = null;
phoneHash = null;
message2 = null;
botChat = null;
botUser = null;
auth = null;
push_user_id4 = 0;
if (code == null) {
}
if (phone != null) {
}
final Bundle args2222 = new Bundle();
args2222.putString("phone", phone2);
args2222.putString("hash", phoneHash2);
launchActivity = this;
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$handleIntent$4$LaunchActivity(args2222);
}
});
push_user_id3 = push_user_id4;
push_chat_id4 = push_chat_id3;
push_msg_id6 = push_msg_id4;
} else {
str = "message_id";
intentAccount2 = intentAccount4;
launchActivity = this;
j = 0;
push_user_id3 = 0;
}
push_user_id2 = push_user_id3;
push_msg_id2 = push_msg_id6;
push_enc_id = 0;
intentAccount = intentAccount2;
intent2 = intent;
push_msg_id3 = push_chat_id4;
i = 0;
} else {
push_chat_id = 0;
push_msg_id = 0;
str = "message_id";
launchActivity = this;
j = 0;
if (intent.getAction().equals("im.jpeoubogmn.messenger.OPEN_ACCOUNT")) {
z = true;
intent2 = intent;
push_user_id2 = 0;
push_enc_id = 0;
push_msg_id3 = 0;
push_msg_id2 = 0;
intentAccount = intentAccount4;
i = 0;
} else if (intent.getAction().equals("new_dialog")) {
z2 = true;
intent2 = intent;
push_user_id2 = 0;
push_enc_id = 0;
push_msg_id3 = 0;
push_msg_id2 = 0;
intentAccount = intentAccount4;
i = 0;
} else if (intent.getAction().startsWith("com.tmessages.openchat")) {
intent2 = intent;
i = 0;
int chatId = intent2.getIntExtra("chatId", 0);
int userId2 = intent2.getIntExtra("userId", 0);
int encId = intent2.getIntExtra("encId", 0);
if (chatId != 0) {
intentAccount = intentAccount4;
NotificationCenter.getInstance(intentAccount[0]).postNotificationName(NotificationCenter.closeChats, new Object[0]);
push_chat_id = chatId;
} else {
intentAccount = intentAccount4;
if (userId2 != 0) {
NotificationCenter.getInstance(intentAccount[0]).postNotificationName(NotificationCenter.closeChats, new Object[0]);
push_user_id = userId2;
} else if (encId != 0) {
NotificationCenter.getInstance(intentAccount[0]).postNotificationName(NotificationCenter.closeChats, new Object[0]);
push_enc_id2 = encId;
} else {
showDialogsList = true;
}
}
push_user_id2 = push_user_id;
push_enc_id = push_enc_id2;
push_msg_id3 = push_chat_id;
push_msg_id2 = 0;
} else {
intent2 = intent;
intentAccount = intentAccount4;
push_chat_id2 = 0;
i = 0;
i = 0;
if (intent.getAction().equals("com.tmessages.openplayer")) {
showPlayer = true;
push_user_id2 = 0;
push_enc_id = 0;
push_msg_id3 = 0;
push_msg_id2 = 0;
} else if (intent.getAction().equals("org.tmessages.openlocations")) {
showLocations = true;
push_user_id2 = 0;
push_enc_id = 0;
push_msg_id3 = 0;
push_msg_id2 = 0;
} else if (intent.getAction().equals("im.jpeoubogmn.contacts.add")) {
launchActivity.lambda$runLinkRequest$28$LaunchActivity(new NewFriendsActivity());
return false;
}
}
}
if (UserConfig.getInstance(launchActivity.currentAccount).isClientActivated()) {
if (push_user_id2 != 0) {
Bundle args3 = new Bundle();
args3.putInt("user_id", push_user_id2);
if (push_msg_id2 != 0) {
args3.putInt(str, push_msg_id2);
}
if (!mainFragmentsStack.isEmpty()) {
MessagesController messagesController = MessagesController.getInstance(intentAccount[i]);
ArrayList<BaseFragment> arrayList = mainFragmentsStack;
}
if (launchActivity.actionBarLayout.presentFragment(new ChatActivity(args3), false, true, true, false)) {
pushOpened = true;
}
isNew2 = isNew;
str2 = null;
} else {
String str3 = str;
if (push_msg_id3 != 0) {
Bundle args4 = new Bundle();
args4.putInt("chat_id", push_msg_id3);
if (push_msg_id2 != 0) {
args4.putInt(str3, push_msg_id2);
}
if (!mainFragmentsStack.isEmpty()) {
MessagesController messagesController2 = MessagesController.getInstance(intentAccount[i]);
ArrayList<BaseFragment> arrayList2 = mainFragmentsStack;
}
if (launchActivity.actionBarLayout.presentFragment(new ChatActivity(args4), false, true, true, false)) {
pushOpened = true;
}
isNew2 = isNew;
str2 = null;
} else if (push_enc_id != 0) {
Bundle args5 = new Bundle();
args5.putInt("enc_id", push_enc_id);
pushOpened = launchActivity.actionBarLayout.presentFragment(new ChatActivity(args5), false, true, true, false);
isNew2 = isNew;
str2 = null;
} else if (showDialogsList) {
if (!AndroidUtilities.isTablet()) {
launchActivity.actionBarLayout.removeAllFragments();
} else if (!launchActivity.layersActionBarLayout.fragmentsStack.isEmpty()) {
for (int a4 = 0; a4 < launchActivity.layersActionBarLayout.fragmentsStack.size() - 1; a4 = (a4 - 1) + 1) {
ActionBarLayout actionBarLayout = launchActivity.layersActionBarLayout;
actionBarLayout.removeFragmentFromStack(actionBarLayout.fragmentsStack.get(i));
}
launchActivity.layersActionBarLayout.closeLastFragment(i);
}
pushOpened = false;
isNew2 = false;
str2 = null;
} else if (showPlayer) {
if (!launchActivity.actionBarLayout.fragmentsStack.isEmpty()) {
launchActivity.actionBarLayout.fragmentsStack.get(i).showDialog(new AudioPlayerAlert(launchActivity));
}
pushOpened = false;
isNew2 = isNew;
str2 = null;
} else if (showLocations) {
if (!launchActivity.actionBarLayout.fragmentsStack.isEmpty()) {
launchActivity.actionBarLayout.fragmentsStack.get(i).showDialog(new SharingLocationsAlert(launchActivity, new SharingLocationsAlert.SharingLocationsAlertDelegate() {
@Override
public final void didSelectLocation(LocationController.SharingLocationInfo sharingLocationInfo) {
LaunchActivity.this.lambda$handleIntent$6$LaunchActivity(intentAccount, sharingLocationInfo);
}
}));
}
pushOpened = false;
isNew2 = isNew;
str2 = null;
} else if (launchActivity.videoPath != null || launchActivity.photoPathsArray != null || launchActivity.sendingText != null || launchActivity.documentsPathsArray != null || launchActivity.contactsToSend != null || launchActivity.documentsUrisArray != null) {
if (!AndroidUtilities.isTablet()) {
NotificationCenter.getInstance(intentAccount[i]).postNotificationName(NotificationCenter.closeChats, new Object[i]);
}
if (dialogId == j) {
Bundle args6 = new Bundle();
args6.putBoolean("onlySelect", true);
args6.putInt("dialogsType", 3);
args6.putBoolean("allowSwitchAccount", true);
ArrayList<TLRPC.User> arrayList3 = launchActivity.contactsToSend;
if (arrayList3 == null) {
args6.putString("selectAlertString", LocaleController.getString("SendMessagesTo", R.string.SendMessagesTo));
args6.putString("selectAlertStringGroup", LocaleController.getString("SendMessagesToGroup", R.string.SendMessagesToGroup));
} else if (arrayList3.size() != 1) {
args6.putString("selectAlertString", LocaleController.getString("SendContactTo", R.string.SendMessagesTo));
args6.putString("selectAlertStringGroup", LocaleController.getString("SendContactToGroup", R.string.SendContactToGroup));
}
DialogsActivity fragment = new DialogsActivity(args6);
fragment.setDelegate(launchActivity);
launchActivity.actionBarLayout.presentFragment(fragment, false, true, true, false);
pushOpened = true;
if (SecretMediaViewer.hasInstance() && SecretMediaViewer.getInstance().isVisible()) {
SecretMediaViewer.getInstance().closePhoto(i, i);
} else if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) {
PhotoViewer.getInstance().closePhoto(i, true);
} else if (ArticleViewer.hasInstance() && ArticleViewer.getInstance().isVisible()) {
ArticleViewer.getInstance().close(i, true);
}
launchActivity.drawerLayoutContainer.setAllowOpenDrawer(i, i);
if (AndroidUtilities.isTablet()) {
launchActivity.actionBarLayout.showLastFragment();
launchActivity.rightActionBarLayout.showLastFragment();
} else {
launchActivity.drawerLayoutContainer.setAllowOpenDrawer(i, i);
}
isNew2 = isNew;
str2 = null;
} else {
ArrayList<Long> dids = new ArrayList<>();
dids.add(Long.valueOf(dialogId));
str2 = null;
launchActivity.didSelectDialogs(null, dids, null, i);
}
} else if (z) {
launchActivity.actionBarLayout.presentFragment(new SettingsActivity(), false, true, true, false);
if (AndroidUtilities.isTablet()) {
launchActivity.actionBarLayout.showLastFragment();
launchActivity.rightActionBarLayout.showLastFragment();
launchActivity.drawerLayoutContainer.setAllowOpenDrawer(i, i);
} else {
launchActivity.drawerLayoutContainer.setAllowOpenDrawer(i, i);
}
pushOpened = true;
isNew2 = isNew;
str2 = null;
} else if (z2) {
Bundle args7 = new Bundle();
args7.putBoolean("destroyAfterSelect", true);
launchActivity.actionBarLayout.presentFragment(new ContactsActivity(args7), false, true, true, false);
if (AndroidUtilities.isTablet()) {
launchActivity.actionBarLayout.showLastFragment();
launchActivity.rightActionBarLayout.showLastFragment();
launchActivity.drawerLayoutContainer.setAllowOpenDrawer(i, i);
} else {
launchActivity.drawerLayoutContainer.setAllowOpenDrawer(i, i);
}
pushOpened = true;
isNew2 = isNew;
str2 = null;
} else {
str2 = null;
}
}
if (!pushOpened && !isNew2) {
if (AndroidUtilities.isTablet()) {
if (launchActivity.actionBarLayout.fragmentsStack.isEmpty()) {
if (UserConfig.getInstance(launchActivity.currentAccount).isClientActivated()) {
IndexActivity indexActivity = new IndexActivity();
launchActivity.actionBarLayout.addFragmentToStack(indexActivity);
launchActivity.drawerLayoutContainer.setAllowOpenDrawer(i, i);
} else {
launchActivity.actionBarLayout.addFragmentToStack(new LoginContronllerActivity());
launchActivity.drawerLayoutContainer.setAllowOpenDrawer(i, i);
}
}
} else if (UserConfig.getInstance(launchActivity.currentAccount).isClientActivated()) {
if (launchActivity.actionBarLayout.fragmentsStack.isEmpty()) {
IndexActivity indexActivity2 = new IndexActivity();
launchActivity.actionBarLayout.addFragmentToStack(indexActivity2);
launchActivity.drawerLayoutContainer.setAllowOpenDrawer(i, i);
}
} else if (launchActivity.layersActionBarLayout.fragmentsStack.isEmpty()) {
launchActivity.layersActionBarLayout.addFragmentToStack(new LoginContronllerActivity());
launchActivity.drawerLayoutContainer.setAllowOpenDrawer(i, i);
}
launchActivity.actionBarLayout.showLastFragment();
if (AndroidUtilities.isTablet()) {
launchActivity.layersActionBarLayout.showLastFragment();
launchActivity.rightActionBarLayout.showLastFragment();
}
}
intent2.setAction(str2);
return pushOpened;
}
str2 = null;
isNew2 = isNew;
if (!pushOpened) {
if (AndroidUtilities.isTablet()) {
}
launchActivity.actionBarLayout.showLastFragment();
if (AndroidUtilities.isTablet()) {
}
}
intent2.setAction(str2);
return pushOpened;
}
boolean error5 = false;
try {
ArrayList<Parcelable> uris2 = intent.getParcelableArrayListExtra("android.intent.extra.STREAM");
String type2 = intent.getType();
if (uris2 != null) {
int a5 = 0;
while (a5 < uris2.size()) {
try {
Parcelable parcelable3 = uris2.get(a5);
if (!(parcelable3 instanceof Uri)) {
parcelable3 = Uri.parse(parcelable3.toString());
}
Uri uri3 = (Uri) parcelable3;
if (uri3 != null && AndroidUtilities.isInternalUri(uri3)) {
uris2.remove(a5);
a5--;
}
a5++;
} catch (Exception e13) {
e = e13;
FileLog.e(e);
error = true;
if (error) {
}
push_chat_id = 0;
push_msg_id = 0;
str = "message_id";
intentAccount = intentAccount4;
intent2 = intent;
launchActivity = this;
push_chat_id2 = 0;
j = 0;
push_user_id2 = push_user_id;
push_enc_id = 0;
push_msg_id3 = push_chat_id;
push_msg_id2 = push_msg_id;
i = push_chat_id2;
if (UserConfig.getInstance(launchActivity.currentAccount).isClientActivated()) {
}
isNew2 = isNew;
if (!pushOpened) {
}
intent2.setAction(str2);
return pushOpened;
}
}
if (uris2.isEmpty()) {
uris2 = null;
}
}
if (uris2 != null) {
if (type2 == null || !type2.startsWith("image/")) {
int a6 = 0;
while (a6 < uris2.size()) {
Parcelable parcelable4 = uris2.get(a6);
if (!(parcelable4 instanceof Uri)) {
parcelable4 = Uri.parse(parcelable4.toString());
}
Uri uri4 = (Uri) parcelable4;
String path4 = AndroidUtilities.getPath(uri4);
String originalPath2 = parcelable4.toString();
if (originalPath2 == null) {
uris = uris2;
originalPath = path4;
} else {
uris = uris2;
originalPath = originalPath2;
}
if (path4 != null) {
error3 = error5;
try {
if (path4.startsWith("file:")) {
path4 = path4.replace("file://", "");
}
if (this.documentsPathsArray == null) {
this.documentsPathsArray = new ArrayList<>();
this.documentsOriginalPathsArray = new ArrayList<>();
}
this.documentsPathsArray.add(path4);
this.documentsOriginalPathsArray.add(originalPath);
} catch (Exception e14) {
e = e14;
FileLog.e(e);
error = true;
if (error) {
}
push_chat_id = 0;
push_msg_id = 0;
str = "message_id";
intentAccount = intentAccount4;
intent2 = intent;
launchActivity = this;
push_chat_id2 = 0;
j = 0;
push_user_id2 = push_user_id;
push_enc_id = 0;
push_msg_id3 = push_chat_id;
push_msg_id2 = push_msg_id;
i = push_chat_id2;
if (UserConfig.getInstance(launchActivity.currentAccount).isClientActivated()) {
}
isNew2 = isNew;
if (!pushOpened) {
}
intent2.setAction(str2);
return pushOpened;
}
} else {
error3 = error5;
if (this.documentsUrisArray == null) {
this.documentsUrisArray = new ArrayList<>();
}
this.documentsUrisArray.add(uri4);
this.documentsMimeType = type2;
}
a6++;
error5 = error3;
uris2 = uris;
}
error2 = error5;
} else {
for (int a7 = 0; a7 < uris2.size(); a7++) {
Parcelable parcelable5 = uris2.get(a7);
if (!(parcelable5 instanceof Uri)) {
parcelable5 = Uri.parse(parcelable5.toString());
}
Uri uri5 = (Uri) parcelable5;
if (this.photoPathsArray == null) {
this.photoPathsArray = new ArrayList<>();
}
SendMessagesHelper.SendingMediaInfo info2 = new SendMessagesHelper.SendingMediaInfo();
info2.uri = uri5;
this.photoPathsArray.add(info2);
}
error2 = false;
}
error = error2;
} else {
error = true;
}
} catch (Exception e15) {
e = e15;
}
if (error) {
ToastUtils.show((CharSequence) "Unsupported content");
}
push_chat_id = 0;
push_msg_id = 0;
str = "message_id";
intentAccount = intentAccount4;
intent2 = intent;
launchActivity = this;
push_chat_id2 = 0;
j = 0;
}
push_user_id2 = push_user_id;
push_enc_id = 0;
push_msg_id3 = push_chat_id;
push_msg_id2 = push_msg_id;
i = push_chat_id2;
if (UserConfig.getInstance(launchActivity.currentAccount).isClientActivated()) {
}
isNew2 = isNew;
if (!pushOpened) {
}
intent2.setAction(str2);
return pushOpened;
}
public void lambda$handleIntent$4$LaunchActivity(Bundle args) {
lambda$runLinkRequest$28$LaunchActivity(new CancelAccountDeletionActivity(args));
}
public void lambda$handleIntent$6$LaunchActivity(int[] intentAccount, final LocationController.SharingLocationInfo info) {
intentAccount[0] = info.messageObject.currentAccount;
switchToAccount(intentAccount[0], true);
NewLocationActivity locationActivity = new NewLocationActivity(3, info.messageObject);
final long dialog_id = info.messageObject.getDialogId();
locationActivity.setDelegate(new NewLocationActivity.LocationActivityDelegate() {
@Override
public final void didSelectLocation(TLRPC.MessageMedia messageMedia, int i, boolean z, int i2) {
SendMessagesHelper.getInstance(LocationController.SharingLocationInfo.this.messageObject.currentAccount).sendMessage(messageMedia, dialog_id, (MessageObject) null, (TLRPC.ReplyMarkup) null, (HashMap<String, String>) null, z, i2);
}
});
lambda$runLinkRequest$28$LaunchActivity(locationActivity);
}
private void getUserInfo(TLRPC.User user) {
TLRPC.TL_users_getFullUser req = new TLRPC.TL_users_getFullUser();
req.id = MessagesController.getInstance(UserConfig.selectedAccount).getInputUser(user);
final XAlertDialog progressDialog = new XAlertDialog(this, 4);
progressDialog.setLoadingText(LocaleController.getString(R.string.Loading));
int reqId = ConnectionsManager.getInstance(UserConfig.selectedAccount).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LaunchActivity.this.lambda$getUserInfo$8$LaunchActivity(progressDialog, tLObject, tL_error);
}
});
progressDialog.show();
ConnectionsManager.getInstance(UserConfig.selectedAccount).bindRequestToGuid(reqId, getActionBarLayout().getCurrentFragment().getClassGuid());
}
public void lambda$getUserInfo$8$LaunchActivity(XAlertDialog progressDialog, final TLObject response, TLRPC.TL_error error) {
progressDialog.dismiss();
if (error == null) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$null$7$LaunchActivity(response);
}
});
} else if ("USERNOTEXITST".equals(error.text)) {
AlertsCreator.showSimpleAlert(getActionBarLayout().getCurrentFragment(), LocaleController.getString("UserNotExist", R.string.UserNotExist));
}
}
public void lambda$null$7$LaunchActivity(TLObject response) {
TLRPC.UserFull userFull = (TLRPC.UserFull) response;
MessagesController.getInstance(UserConfig.selectedAccount).putUser(userFull.user, false);
if (userFull.user == null) {
return;
}
if (userFull.user.self || userFull.user.contact) {
Bundle bundle = new Bundle();
bundle.putInt("user_id", userFull.user.id);
lambda$runLinkRequest$28$LaunchActivity(new NewProfileActivity(bundle));
return;
}
Bundle bundle2 = new Bundle();
bundle2.putInt("from_type", 4);
lambda$runLinkRequest$28$LaunchActivity(new AddContactsInfoActivity(bundle2, userFull.user));
}
private void runLinkRequest(final int intentAccount, final String username, final String group, final String sticker, final String botUser, final String botChat, final String message, final boolean hasUrl, final Integer messageId, final Integer channelId, final String game, final HashMap<String, String> auth, final String lang, final String unsupportedUrl, final String code, final TLRPC.TL_wallPaper wallPaper, final String theme, int state) {
final int i;
final int[] requestId;
final AlertDialog progressDialog;
if (state == 0 && UserConfig.getActivatedAccountsCount() >= 2 && auth != null) {
AlertsCreator.createAccountSelectDialog(this, new AlertsCreator.AccountSelectDelegate() {
@Override
public final void didSelectAccount(int i2) {
LaunchActivity.this.lambda$runLinkRequest$9$LaunchActivity(intentAccount, username, group, sticker, botUser, botChat, message, hasUrl, messageId, channelId, game, auth, lang, unsupportedUrl, code, wallPaper, theme, i2);
}
}).show();
return;
}
BaseFragment baseFragment = null;
if (code == null) {
final AlertDialog progressDialog2 = new AlertDialog(this, 3);
int[] requestId2 = {0};
Runnable cancelRunnable = null;
if (username != null) {
TLRPC.TL_contacts_resolveUsername req = new TLRPC.TL_contacts_resolveUsername();
req.username = username;
requestId2[0] = ConnectionsManager.getInstance(intentAccount).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LaunchActivity.this.lambda$runLinkRequest$13$LaunchActivity(progressDialog2, game, intentAccount, botChat, botUser, messageId, tLObject, tL_error);
}
});
requestId = requestId2;
progressDialog = progressDialog2;
i = intentAccount;
} else if (group == null) {
i = intentAccount;
requestId = requestId2;
if (sticker != null) {
if (!mainFragmentsStack.isEmpty()) {
TLRPC.TL_inputStickerSetShortName stickerset = new TLRPC.TL_inputStickerSetShortName();
stickerset.short_name = sticker;
ArrayList<BaseFragment> arrayList = mainFragmentsStack;
BaseFragment fragment = arrayList.get(arrayList.size() - 1);
fragment.showDialog(new StickersAlert(this, fragment, stickerset, null, null));
return;
}
return;
} else if (message != null) {
Bundle args = new Bundle();
args.putBoolean("onlySelect", true);
DialogsActivity fragment2 = new DialogsActivity(args);
fragment2.setDelegate(new DialogsActivity.DialogsActivityDelegate() {
@Override
public final void didSelectDialogs(DialogsActivity dialogsActivity, ArrayList arrayList2, CharSequence charSequence, boolean z) {
LaunchActivity.this.lambda$runLinkRequest$19$LaunchActivity(hasUrl, i, message, dialogsActivity, arrayList2, charSequence, z);
}
});
presentFragment(fragment2, false, true);
progressDialog = progressDialog2;
} else if (auth == null) {
progressDialog = progressDialog2;
if (unsupportedUrl != null) {
TLRPC.TL_help_getDeepLinkInfo req2 = new TLRPC.TL_help_getDeepLinkInfo();
req2.path = unsupportedUrl;
requestId[0] = ConnectionsManager.getInstance(this.currentAccount).sendRequest(req2, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LaunchActivity.this.lambda$runLinkRequest$25$LaunchActivity(progressDialog, tLObject, tL_error);
}
});
} else if (lang != null) {
TLRPC.TL_langpack_getLanguage req3 = new TLRPC.TL_langpack_getLanguage();
req3.lang_code = lang;
req3.lang_pack = "android";
requestId[0] = ConnectionsManager.getInstance(this.currentAccount).sendRequest(req3, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LaunchActivity.this.lambda$runLinkRequest$27$LaunchActivity(progressDialog, tLObject, tL_error);
}
});
} else if (wallPaper != null) {
boolean ok = false;
if (TextUtils.isEmpty(wallPaper.slug)) {
try {
WallpapersListActivity.ColorWallpaper colorWallpaper = new WallpapersListActivity.ColorWallpaper(-100L, wallPaper.settings.background_color);
final WallpaperActivity wallpaperActivity = new WallpaperActivity(colorWallpaper, null);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$runLinkRequest$28$LaunchActivity(wallpaperActivity);
}
});
ok = true;
} catch (Exception e) {
FileLog.e(e);
}
}
if (!ok) {
TLRPC.TL_account_getWallPaper req4 = new TLRPC.TL_account_getWallPaper();
TLRPC.TL_inputWallPaperSlug inputWallPaperSlug = new TLRPC.TL_inputWallPaperSlug();
inputWallPaperSlug.slug = wallPaper.slug;
req4.wallpaper = inputWallPaperSlug;
requestId[0] = ConnectionsManager.getInstance(this.currentAccount).sendRequest(req4, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LaunchActivity.this.lambda$runLinkRequest$30$LaunchActivity(progressDialog, wallPaper, tLObject, tL_error);
}
});
}
} else if (theme != null) {
Runnable cancelRunnable2 = new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$runLinkRequest$31$LaunchActivity();
}
};
TLRPC.TL_account_getTheme req5 = new TLRPC.TL_account_getTheme();
req5.format = "android";
TLRPC.TL_inputThemeSlug inputThemeSlug = new TLRPC.TL_inputThemeSlug();
inputThemeSlug.slug = theme;
req5.theme = inputThemeSlug;
requestId[0] = ConnectionsManager.getInstance(this.currentAccount).sendRequest(req5, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LaunchActivity.this.lambda$runLinkRequest$33$LaunchActivity(progressDialog, tLObject, tL_error);
}
});
cancelRunnable = cancelRunnable2;
} else if (channelId != null && messageId != null) {
final Bundle args2 = new Bundle();
args2.putInt("chat_id", channelId.intValue());
args2.putInt("message_id", messageId.intValue());
if (!mainFragmentsStack.isEmpty()) {
ArrayList<BaseFragment> arrayList2 = mainFragmentsStack;
baseFragment = arrayList2.get(arrayList2.size() - 1);
}
final BaseFragment lastFragment = baseFragment;
if (lastFragment == null || MessagesController.getInstance(intentAccount).checkCanOpenChat(args2, lastFragment)) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$runLinkRequest$36$LaunchActivity(args2, channelId, requestId, progressDialog, lastFragment, intentAccount);
}
});
}
}
} else {
int bot_id = Utilities.parseInt(auth.get("bot_id")).intValue();
if (bot_id == 0) {
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 req6 = new TLRPC.TL_account_getAuthorizationForm();
req6.bot_id = bot_id;
req6.scope = auth.get("scope");
req6.public_key = auth.get("public_key");
progressDialog = progressDialog2;
requestId[0] = ConnectionsManager.getInstance(intentAccount).sendRequest(req6, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LaunchActivity.this.lambda$runLinkRequest$23$LaunchActivity(requestId, intentAccount, progressDialog2, req6, payload, nonce, callbackUrl, tLObject, tL_error);
}
});
}
} else if (state == 0) {
TLRPC.TL_messages_checkChatInvite req7 = new TLRPC.TL_messages_checkChatInvite();
req7.hash = group;
requestId = requestId2;
requestId[0] = ConnectionsManager.getInstance(intentAccount).sendRequest(req7, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LaunchActivity.this.lambda$runLinkRequest$16$LaunchActivity(progressDialog2, intentAccount, group, username, sticker, botUser, botChat, message, hasUrl, messageId, channelId, game, auth, lang, unsupportedUrl, code, wallPaper, theme, tLObject, tL_error);
}
}, 2);
i = intentAccount;
progressDialog = progressDialog2;
} else {
requestId = requestId2;
if (state == 1) {
TLRPC.TL_messages_importChatInvite req8 = new TLRPC.TL_messages_importChatInvite();
req8.hash = group;
i = intentAccount;
ConnectionsManager.getInstance(intentAccount).sendRequest(req8, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LaunchActivity.this.lambda$runLinkRequest$18$LaunchActivity(i, progressDialog2, tLObject, tL_error);
}
}, 2);
progressDialog = progressDialog2;
} else {
i = intentAccount;
progressDialog = progressDialog2;
}
}
if (requestId[0] != 0) {
final Runnable cancelRunnableFinal = cancelRunnable;
progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public final void onCancel(DialogInterface dialogInterface) {
LaunchActivity.lambda$runLinkRequest$37(i, requestId, cancelRunnableFinal, dialogInterface);
}
});
try {
progressDialog.show();
} catch (Exception e2) {
}
}
} else if (!NotificationCenter.getGlobalInstance().hasObservers(NotificationCenter.didReceiveSmsCode)) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(AndroidUtilities.replaceTags(LocaleController.formatString("OtherLoginCode", R.string.OtherLoginCode, code)));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
showAlertDialog(builder);
} else {
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didReceiveSmsCode, code);
}
}
public void lambda$runLinkRequest$9$LaunchActivity(int intentAccount, String username, String group, String sticker, String botUser, String botChat, String message, boolean hasUrl, Integer messageId, Integer channelId, String game, HashMap auth, String lang, String unsupportedUrl, String code, TLRPC.TL_wallPaper wallPaper, String theme, int account) {
if (account != intentAccount) {
switchToAccount(account, true);
}
runLinkRequest(account, username, group, sticker, botUser, botChat, message, hasUrl, messageId, channelId, game, auth, lang, unsupportedUrl, code, wallPaper, theme, 1);
}
public void lambda$runLinkRequest$13$LaunchActivity(final AlertDialog progressDialog, final String game, final int intentAccount, final String botChat, final String botUser, final Integer messageId, final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$null$12$LaunchActivity(progressDialog, response, error, game, intentAccount, botChat, botUser, messageId);
}
});
}
public void lambda$null$12$LaunchActivity(AlertDialog progressDialog, TLObject response, TLRPC.TL_error error, final String game, final int intentAccount, final String botChat, String botUser, Integer messageId) {
long dialog_id;
boolean removeLast;
if (!isFinishing()) {
try {
progressDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
final TLRPC.TL_contacts_resolvedPeer res = (TLRPC.TL_contacts_resolvedPeer) response;
if (error != null || this.actionBarLayout == null || (game != null && (game == null || res.users.isEmpty()))) {
try {
AlertsCreator.createSimpleAlert(this, LocaleController.getString("JoinToGroupErrorNotExist", R.string.JoinToGroupErrorNotExist)).show();
return;
} catch (Exception e2) {
FileLog.e(e2);
return;
}
}
MessagesController.getInstance(intentAccount).putUsers(res.users, false);
MessagesController.getInstance(intentAccount).putChats(res.chats, false);
MessagesStorage.getInstance(intentAccount).putUsersAndChats(res.users, res.chats, false, true);
if (game != null) {
Bundle args = new Bundle();
args.putBoolean("onlySelect", true);
args.putBoolean("cantSendToChannels", true);
args.putInt("dialogsType", 1);
args.putString("selectAlertString", LocaleController.getString("SendGameTo", R.string.SendGameTo));
args.putString("selectAlertStringGroup", LocaleController.getString("SendGameToGroup", R.string.SendGameToGroup));
DialogsActivity fragment = new DialogsActivity(args);
fragment.setDelegate(new DialogsActivity.DialogsActivityDelegate() {
@Override
public final void didSelectDialogs(DialogsActivity dialogsActivity, ArrayList arrayList, CharSequence charSequence, boolean z) {
LaunchActivity.this.lambda$null$10$LaunchActivity(game, intentAccount, res, dialogsActivity, arrayList, charSequence, z);
}
});
if (AndroidUtilities.isTablet()) {
removeLast = this.layersActionBarLayout.fragmentsStack.size() > 0 && (this.layersActionBarLayout.fragmentsStack.get(this.layersActionBarLayout.fragmentsStack.size() - 1) instanceof IndexActivity);
} else {
removeLast = this.actionBarLayout.fragmentsStack.size() > 1 && (this.actionBarLayout.fragmentsStack.get(this.actionBarLayout.fragmentsStack.size() - 1) instanceof IndexActivity);
}
this.actionBarLayout.presentFragment(fragment, removeLast, true, true, false);
if (SecretMediaViewer.hasInstance() && SecretMediaViewer.getInstance().isVisible()) {
SecretMediaViewer.getInstance().closePhoto(false, false);
} else if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) {
PhotoViewer.getInstance().closePhoto(false, true);
} else if (ArticleViewer.hasInstance() && ArticleViewer.getInstance().isVisible()) {
ArticleViewer.getInstance().close(false, true);
}
this.drawerLayoutContainer.setAllowOpenDrawer(false, false);
if (AndroidUtilities.isTablet()) {
this.actionBarLayout.showLastFragment();
this.rightActionBarLayout.showLastFragment();
return;
}
this.drawerLayoutContainer.setAllowOpenDrawer(false, false);
return;
}
BaseFragment baseFragment = null;
if (botChat != null) {
final TLRPC.User user = res.users.isEmpty() ? null : res.users.get(0);
if (user == null || (user.bot && user.bot_nochats)) {
try {
ToastUtils.show((int) R.string.BotCantJoinGroups);
return;
} catch (Exception e3) {
FileLog.e(e3);
return;
}
}
Bundle args2 = new Bundle();
args2.putBoolean("onlySelect", true);
args2.putInt("dialogsType", 2);
args2.putString("addToGroupAlertString", LocaleController.formatString("AddToTheGroupTitle", R.string.AddToTheGroupTitle, UserObject.getName(user), "%1$s"));
DialogsActivity fragment2 = new DialogsActivity(args2);
fragment2.setDelegate(new DialogsActivity.DialogsActivityDelegate() {
@Override
public final void didSelectDialogs(DialogsActivity dialogsActivity, ArrayList arrayList, CharSequence charSequence, boolean z) {
LaunchActivity.this.lambda$null$11$LaunchActivity(intentAccount, user, botChat, dialogsActivity, arrayList, charSequence, z);
}
});
lambda$runLinkRequest$28$LaunchActivity(fragment2);
return;
}
boolean isBot = false;
Bundle args3 = new Bundle();
if (!res.chats.isEmpty()) {
args3.putInt("chat_id", res.chats.get(0).id);
dialog_id = -res.chats.get(0).id;
} else {
args3.putInt("user_id", res.users.get(0).id);
dialog_id = res.users.get(0).id;
}
if (botUser != null && res.users.size() > 0 && res.users.get(0).bot) {
args3.putString("botUser", botUser);
isBot = true;
}
if (messageId != null) {
args3.putInt("message_id", messageId.intValue());
}
if (!mainFragmentsStack.isEmpty()) {
ArrayList<BaseFragment> arrayList = mainFragmentsStack;
baseFragment = arrayList.get(arrayList.size() - 1);
}
BaseFragment lastFragment = baseFragment;
if (lastFragment == null || MessagesController.getInstance(intentAccount).checkCanOpenChat(args3, lastFragment)) {
if (isBot && (lastFragment instanceof ChatActivity) && ((ChatActivity) lastFragment).getDialogId() == dialog_id) {
((ChatActivity) lastFragment).setBotUser(botUser);
} else {
this.actionBarLayout.presentFragment(new ChatActivity(args3));
}
}
}
}
public void lambda$null$10$LaunchActivity(String game, int intentAccount, TLRPC.TL_contacts_resolvedPeer res, DialogsActivity fragment1, ArrayList dids, CharSequence message1, boolean param) {
long did = ((Long) dids.get(0)).longValue();
TLRPC.TL_inputMediaGame inputMediaGame = new TLRPC.TL_inputMediaGame();
inputMediaGame.id = new TLRPC.TL_inputGameShortName();
inputMediaGame.id.short_name = game;
inputMediaGame.id.bot_id = MessagesController.getInstance(intentAccount).getInputUser(res.users.get(0));
SendMessagesHelper.getInstance(intentAccount).sendGame(MessagesController.getInstance(intentAccount).getInputPeer((int) did), inputMediaGame, 0L, 0L);
Bundle args1 = new Bundle();
args1.putBoolean("scrollToTopOnResume", true);
int lower_part = (int) did;
int high_id = (int) (did >> 32);
if (lower_part != 0) {
if (lower_part > 0) {
args1.putInt("user_id", lower_part);
} else if (lower_part < 0) {
args1.putInt("chat_id", -lower_part);
}
} else {
args1.putInt("enc_id", high_id);
}
if (MessagesController.getInstance(intentAccount).checkCanOpenChat(args1, fragment1)) {
NotificationCenter.getInstance(intentAccount).postNotificationName(NotificationCenter.closeChats, new Object[0]);
this.actionBarLayout.presentFragment(new ChatActivity(args1), true, false, true, false);
}
}
public void lambda$null$11$LaunchActivity(int intentAccount, TLRPC.User user, String botChat, DialogsActivity fragment12, ArrayList dids, CharSequence message1, boolean param) {
long did = ((Long) dids.get(0)).longValue();
Bundle args12 = new Bundle();
args12.putBoolean("scrollToTopOnResume", true);
args12.putInt("chat_id", -((int) did));
if (!mainFragmentsStack.isEmpty()) {
MessagesController messagesController = MessagesController.getInstance(intentAccount);
ArrayList<BaseFragment> arrayList = mainFragmentsStack;
if (!messagesController.checkCanOpenChat(args12, arrayList.get(arrayList.size() - 1))) {
return;
}
}
NotificationCenter.getInstance(intentAccount).postNotificationName(NotificationCenter.closeChats, new Object[0]);
MessagesController.getInstance(intentAccount).addUserToChat(-((int) did), user, null, 0, botChat, null, null);
this.actionBarLayout.presentFragment(new ChatActivity(args12), true, false, true, false);
}
public void lambda$runLinkRequest$16$LaunchActivity(final AlertDialog progressDialog, final int intentAccount, final String group, final String username, final String sticker, final String botUser, final String botChat, final String message, final boolean hasUrl, final Integer messageId, final Integer channelId, final String game, final HashMap auth, final String lang, final String unsupportedUrl, final String code, final TLRPC.TL_wallPaper wallPaper, final String theme, final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$null$15$LaunchActivity(progressDialog, error, response, intentAccount, group, username, sticker, botUser, botChat, message, hasUrl, messageId, channelId, game, auth, lang, unsupportedUrl, code, wallPaper, theme);
}
});
}
public void lambda$null$15$LaunchActivity(AlertDialog progressDialog, TLRPC.TL_error error, TLObject response, final int intentAccount, final String group, final String username, final String sticker, final String botUser, final String botChat, final String message, final boolean hasUrl, final Integer messageId, final Integer channelId, final String game, final HashMap auth, final String lang, final String unsupportedUrl, final String code, final TLRPC.TL_wallPaper wallPaper, final String theme) {
if (!isFinishing()) {
try {
progressDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
if (error != null || this.actionBarLayout == null) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
if (error.text.startsWith("FLOOD_WAIT")) {
builder.setMessage(LocaleController.getString("FloodWait", R.string.FloodWait));
} else {
builder.setMessage(LocaleController.getString("JoinToGroupErrorNotExist", R.string.JoinToGroupErrorNotExist));
}
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
showAlertDialog(builder);
return;
}
TLRPC.ChatInvite invite = (TLRPC.ChatInvite) response;
if (invite.chat != null && (!ChatObject.isLeftFromChat(invite.chat) || (!invite.chat.kicked && !TextUtils.isEmpty(invite.chat.username)))) {
MessagesController.getInstance(intentAccount).putChat(invite.chat, false);
ArrayList<TLRPC.Chat> chats = new ArrayList<>();
chats.add(invite.chat);
MessagesStorage.getInstance(intentAccount).putUsersAndChats(null, chats, false, true);
Bundle args = new Bundle();
args.putInt("chat_id", invite.chat.id);
if (!mainFragmentsStack.isEmpty()) {
MessagesController messagesController = MessagesController.getInstance(intentAccount);
ArrayList<BaseFragment> arrayList = mainFragmentsStack;
}
ChatActivity fragment = new ChatActivity(args);
NotificationCenter.getInstance(intentAccount).postNotificationName(NotificationCenter.closeChats, new Object[0]);
this.actionBarLayout.presentFragment(fragment, false, true, true, false);
} else {
if (invite.chat != null || (invite.channel && !invite.megagroup)) {
if (invite.chat != null) {
if (ChatObject.isChannel(invite.chat) && !invite.chat.megagroup) {
AlertDialog.Builder builder2 = new AlertDialog.Builder(this);
builder2.setTitle(LocaleController.getString("AppName", R.string.AppName));
Object[] objArr = new Object[1];
objArr[0] = invite.chat != null ? invite.chat.title : invite.title;
builder2.setMessage(LocaleController.formatString("ChannelJoinTo", R.string.ChannelJoinTo, objArr));
builder2.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LaunchActivity.this.lambda$null$14$LaunchActivity(intentAccount, username, group, sticker, botUser, botChat, message, hasUrl, messageId, channelId, game, auth, lang, unsupportedUrl, code, wallPaper, theme, dialogInterface, i);
}
});
builder2.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showAlertDialog(builder2);
}
}
AlertDialog.Builder builder22 = new AlertDialog.Builder(this);
builder22.setTitle(LocaleController.getString("AppName", R.string.AppName));
Object[] objArr2 = new Object[1];
objArr2[0] = invite.chat != null ? invite.chat.title : invite.title;
builder22.setMessage(LocaleController.formatString("ChannelJoinTo", R.string.ChannelJoinTo, objArr2));
builder22.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LaunchActivity.this.lambda$null$14$LaunchActivity(intentAccount, username, group, sticker, botUser, botChat, message, hasUrl, messageId, channelId, game, auth, lang, unsupportedUrl, code, wallPaper, theme, dialogInterface, i);
}
});
builder22.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showAlertDialog(builder22);
}
if (!mainFragmentsStack.isEmpty()) {
ArrayList<BaseFragment> arrayList2 = mainFragmentsStack;
BaseFragment fragment2 = arrayList2.get(arrayList2.size() - 1);
fragment2.showDialog(new JoinGroupAlert(this, invite, group, fragment2));
}
AlertDialog.Builder builder222 = new AlertDialog.Builder(this);
builder222.setTitle(LocaleController.getString("AppName", R.string.AppName));
Object[] objArr22 = new Object[1];
objArr22[0] = invite.chat != null ? invite.chat.title : invite.title;
builder222.setMessage(LocaleController.formatString("ChannelJoinTo", R.string.ChannelJoinTo, objArr22));
builder222.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LaunchActivity.this.lambda$null$14$LaunchActivity(intentAccount, username, group, sticker, botUser, botChat, message, hasUrl, messageId, channelId, game, auth, lang, unsupportedUrl, code, wallPaper, theme, dialogInterface, i);
}
});
builder222.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showAlertDialog(builder222);
}
}
}
public void lambda$null$14$LaunchActivity(int intentAccount, String username, String group, String sticker, String botUser, String botChat, String message, boolean hasUrl, Integer messageId, Integer channelId, String game, HashMap auth, String lang, String unsupportedUrl, String code, TLRPC.TL_wallPaper wallPaper, String theme, DialogInterface dialogInterface, int i) {
runLinkRequest(intentAccount, username, group, sticker, botUser, botChat, message, hasUrl, messageId, channelId, game, auth, lang, unsupportedUrl, code, wallPaper, theme, 1);
}
public void lambda$runLinkRequest$18$LaunchActivity(final int intentAccount, final AlertDialog progressDialog, final TLObject response, final TLRPC.TL_error error) {
if (error == null) {
TLRPC.Updates updates = (TLRPC.Updates) response;
MessagesController.getInstance(intentAccount).processUpdates(updates, false);
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$null$17$LaunchActivity(progressDialog, error, response, intentAccount);
}
});
}
public void lambda$null$17$LaunchActivity(AlertDialog progressDialog, TLRPC.TL_error error, TLObject response, int intentAccount) {
if (!isFinishing()) {
try {
progressDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
if (error == null) {
if (this.actionBarLayout != null) {
TLRPC.Updates updates = (TLRPC.Updates) response;
if (!updates.chats.isEmpty()) {
TLRPC.Chat chat = updates.chats.get(0);
chat.left = false;
chat.kicked = false;
MessagesController.getInstance(intentAccount).putUsers(updates.users, false);
MessagesController.getInstance(intentAccount).putChats(updates.chats, false);
Bundle args = new Bundle();
args.putInt("chat_id", chat.id);
if (!mainFragmentsStack.isEmpty()) {
MessagesController messagesController = MessagesController.getInstance(intentAccount);
ArrayList<BaseFragment> arrayList = mainFragmentsStack;
if (!messagesController.checkCanOpenChat(args, arrayList.get(arrayList.size() - 1))) {
return;
}
}
ChatActivity fragment = new ChatActivity(args);
NotificationCenter.getInstance(intentAccount).postNotificationName(NotificationCenter.closeChats, new Object[0]);
this.actionBarLayout.presentFragment(fragment, false, true, true, false);
return;
}
return;
}
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
if (error.text.startsWith("FLOOD_WAIT")) {
builder.setMessage(LocaleController.getString("FloodWait", R.string.FloodWait));
} else if (error.text.equals("USERS_TOO_MUCH")) {
builder.setMessage(LocaleController.getString("JoinToGroupErrorFull", R.string.JoinToGroupErrorFull));
} else {
builder.setMessage(LocaleController.getString("JoinToGroupErrorNotExist", R.string.JoinToGroupErrorNotExist));
}
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
showAlertDialog(builder);
}
}
public void lambda$runLinkRequest$19$LaunchActivity(boolean hasUrl, int intentAccount, String message, DialogsActivity fragment13, ArrayList dids, CharSequence m, boolean param) {
long did = ((Long) dids.get(0)).longValue();
Bundle args13 = new Bundle();
args13.putBoolean("scrollToTopOnResume", true);
args13.putBoolean("hasUrl", hasUrl);
int lower_part = (int) did;
int high_id = (int) (did >> 32);
if (lower_part != 0) {
if (lower_part > 0) {
args13.putInt("user_id", lower_part);
} else if (lower_part < 0) {
args13.putInt("chat_id", -lower_part);
}
} else {
args13.putInt("enc_id", high_id);
}
if (MessagesController.getInstance(intentAccount).checkCanOpenChat(args13, fragment13)) {
NotificationCenter.getInstance(intentAccount).postNotificationName(NotificationCenter.closeChats, new Object[0]);
MediaDataController.getInstance(intentAccount).saveDraft(did, message, null, null, false);
this.actionBarLayout.presentFragment(new ChatActivity(args13), true, false, true, false);
}
}
public void lambda$runLinkRequest$23$LaunchActivity(int[] requestId, final int intentAccount, final AlertDialog progressDialog, final TLRPC.TL_account_getAuthorizationForm req, final String payload, final String nonce, final String callbackUrl, TLObject response, final TLRPC.TL_error error) {
final TLRPC.TL_account_authorizationForm authorizationForm = (TLRPC.TL_account_authorizationForm) response;
if (authorizationForm != null) {
TLRPC.TL_account_getPassword req2 = new TLRPC.TL_account_getPassword();
requestId[0] = ConnectionsManager.getInstance(intentAccount).sendRequest(req2, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LaunchActivity.this.lambda$null$21$LaunchActivity(progressDialog, intentAccount, authorizationForm, req, payload, nonce, callbackUrl, tLObject, tL_error);
}
});
return;
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$null$22$LaunchActivity(progressDialog, error);
}
});
}
public void lambda$null$21$LaunchActivity(final AlertDialog progressDialog, final int intentAccount, final TLRPC.TL_account_authorizationForm authorizationForm, final TLRPC.TL_account_getAuthorizationForm req, final String payload, final String nonce, final String callbackUrl, final TLObject response1, TLRPC.TL_error error1) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$null$20$LaunchActivity(progressDialog, response1, intentAccount, authorizationForm, req, payload, nonce, callbackUrl);
}
});
}
public void lambda$null$20$LaunchActivity(AlertDialog progressDialog, TLObject response1, int intentAccount, TLRPC.TL_account_authorizationForm authorizationForm, TLRPC.TL_account_getAuthorizationForm req, String payload, String nonce, String callbackUrl) {
try {
progressDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
if (response1 != null) {
TLRPC.TL_account_password accountPassword = (TLRPC.TL_account_password) response1;
MessagesController.getInstance(intentAccount).putUsers(authorizationForm.users, false);
lambda$runLinkRequest$28$LaunchActivity(new PassportActivity(5, req.bot_id, req.scope, req.public_key, payload, nonce, callbackUrl, authorizationForm, accountPassword));
}
}
public void lambda$null$22$LaunchActivity(AlertDialog progressDialog, TLRPC.TL_error error) {
try {
progressDialog.dismiss();
if ("APP_VERSION_OUTDATED".equals(error.text)) {
AlertsCreator.showUpdateAppAlert(this, LocaleController.getString("UpdateAppAlert", R.string.UpdateAppAlert), true);
} else {
showAlertDialog(AlertsCreator.createSimpleAlert(this, LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + error.text));
}
} catch (Exception e) {
FileLog.e(e);
}
}
public void lambda$runLinkRequest$25$LaunchActivity(final AlertDialog progressDialog, final TLObject response, TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$null$24$LaunchActivity(progressDialog, response);
}
});
}
public void lambda$null$24$LaunchActivity(AlertDialog progressDialog, TLObject response) {
try {
progressDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
if (response instanceof TLRPC.TL_help_deepLinkInfo) {
TLRPC.TL_help_deepLinkInfo res = (TLRPC.TL_help_deepLinkInfo) response;
AlertsCreator.showUpdateAppAlert(this, res.message, res.update_app);
}
}
public void lambda$runLinkRequest$27$LaunchActivity(final AlertDialog progressDialog, final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$null$26$LaunchActivity(progressDialog, response, error);
}
});
}
public void lambda$null$26$LaunchActivity(AlertDialog progressDialog, TLObject response, TLRPC.TL_error error) {
try {
progressDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
if (response instanceof TLRPC.TL_langPackLanguage) {
TLRPC.TL_langPackLanguage res = (TLRPC.TL_langPackLanguage) response;
showAlertDialog(AlertsCreator.createLanguageAlert(this, res));
} else if (error != null) {
if ("LANG_CODE_NOT_SUPPORTED".equals(error.text)) {
showAlertDialog(AlertsCreator.createSimpleAlert(this, LocaleController.getString("LanguageUnsupportedError", R.string.LanguageUnsupportedError)));
return;
}
showAlertDialog(AlertsCreator.createSimpleAlert(this, LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + error.text));
}
}
public void lambda$runLinkRequest$30$LaunchActivity(final AlertDialog progressDialog, final TLRPC.TL_wallPaper wallPaper, final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$null$29$LaunchActivity(progressDialog, response, wallPaper, error);
}
});
}
public void lambda$null$29$LaunchActivity(AlertDialog progressDialog, TLObject response, TLRPC.TL_wallPaper wallPaper, TLRPC.TL_error error) {
Object object;
try {
progressDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
if (response instanceof TLRPC.TL_wallPaper) {
TLRPC.TL_wallPaper res = (TLRPC.TL_wallPaper) response;
if (res.pattern) {
WallpapersListActivity.ColorWallpaper colorWallpaper = new WallpapersListActivity.ColorWallpaper(-1L, wallPaper.settings.background_color, res.id, wallPaper.settings.intensity / 100.0f, wallPaper.settings.motion, null);
colorWallpaper.pattern = res;
object = colorWallpaper;
} else {
object = res;
}
WallpaperActivity wallpaperActivity = new WallpaperActivity(object, null);
wallpaperActivity.setInitialModes(wallPaper.settings.blur, wallPaper.settings.motion);
lambda$runLinkRequest$28$LaunchActivity(wallpaperActivity);
return;
}
showAlertDialog(AlertsCreator.createSimpleAlert(this, LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred) + "\n" + error.text));
}
public void lambda$runLinkRequest$31$LaunchActivity() {
this.loadingThemeFileName = null;
this.loadingThemeWallpaperName = null;
this.loadingThemeInfo = null;
this.loadingThemeProgressDialog = null;
this.loadingTheme = null;
}
public void lambda$runLinkRequest$33$LaunchActivity(final AlertDialog progressDialog, final TLObject response, final TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$null$32$LaunchActivity(response, progressDialog, error);
}
});
}
public void lambda$null$32$LaunchActivity(TLObject response, AlertDialog progressDialog, TLRPC.TL_error error) {
int notFound = 2;
if (response instanceof TLRPC.TL_theme) {
TLRPC.TL_theme t = (TLRPC.TL_theme) response;
if (t.document != null) {
this.loadingTheme = t;
this.loadingThemeFileName = FileLoader.getAttachFileName(t.document);
this.loadingThemeProgressDialog = progressDialog;
FileLoader.getInstance(this.currentAccount).loadFile(this.loadingTheme.document, t, 1, 1);
notFound = 0;
} else {
notFound = 1;
}
} else if (error != null && "THEME_FORMAT_INVALID".equals(error.text)) {
notFound = 1;
}
if (notFound != 0) {
try {
progressDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
if (notFound == 1) {
showAlertDialog(AlertsCreator.createSimpleAlert(this, LocaleController.getString("Theme", R.string.Theme), LocaleController.getString("ThemeNotSupported", R.string.ThemeNotSupported)));
} else {
showAlertDialog(AlertsCreator.createSimpleAlert(this, LocaleController.getString("Theme", R.string.Theme), LocaleController.getString("ThemeNotFound", R.string.ThemeNotFound)));
}
}
}
public void lambda$runLinkRequest$36$LaunchActivity(final Bundle args, Integer channelId, int[] requestId, final AlertDialog progressDialog, final BaseFragment lastFragment, final int intentAccount) {
if (!this.actionBarLayout.presentFragment(new ChatActivity(args))) {
TLRPC.TL_channels_getChannels req = new TLRPC.TL_channels_getChannels();
TLRPC.TL_inputChannel inputChannel = new TLRPC.TL_inputChannel();
inputChannel.channel_id = channelId.intValue();
req.id.add(inputChannel);
requestId[0] = ConnectionsManager.getInstance(this.currentAccount).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LaunchActivity.this.lambda$null$35$LaunchActivity(progressDialog, lastFragment, intentAccount, args, tLObject, tL_error);
}
});
}
}
public void lambda$null$35$LaunchActivity(final AlertDialog progressDialog, final BaseFragment lastFragment, final int intentAccount, final Bundle args, final TLObject response, TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$null$34$LaunchActivity(progressDialog, response, lastFragment, intentAccount, args);
}
});
}
public void lambda$null$34$LaunchActivity(AlertDialog progressDialog, TLObject response, BaseFragment lastFragment, int intentAccount, Bundle args) {
try {
progressDialog.dismiss();
} catch (Exception e) {
FileLog.e(e);
}
boolean notFound = true;
if (response instanceof TLRPC.TL_messages_chats) {
TLRPC.TL_messages_chats res = (TLRPC.TL_messages_chats) response;
if (!res.chats.isEmpty()) {
notFound = false;
MessagesController.getInstance(this.currentAccount).putChats(res.chats, false);
res.chats.get(0);
if (lastFragment == null || MessagesController.getInstance(intentAccount).checkCanOpenChat(args, lastFragment)) {
this.actionBarLayout.presentFragment(new ChatActivity(args));
}
}
}
if (notFound) {
showAlertDialog(AlertsCreator.createSimpleAlert(this, LocaleController.getString("LinkNotFound", R.string.LinkNotFound)));
}
}
public static void lambda$runLinkRequest$37(int intentAccount, int[] requestId, Runnable cancelRunnableFinal, DialogInterface dialog) {
ConnectionsManager.getInstance(intentAccount).cancelRequest(requestId[0], true);
if (cancelRunnableFinal != null) {
cancelRunnableFinal.run();
}
}
public void checkAppUpdate(final boolean isClick) {
if (isClick) {
showCheckUpdateDialog();
}
AppUpdater.getInstance(this.currentAccount).checkAppUpdate(new AppUpdater.OnForceUpdateCallback() {
@Override
public void onForce(TLRPC.TL_help_appUpdate res) {
LaunchActivity.this.dismissCheckUpdateDialog();
if (LaunchActivity.this.updateAppAlertDialog != null && LaunchActivity.this.updateAppAlertDialog.isShowing()) {
return;
}
LaunchActivity launchActivity = LaunchActivity.this;
LaunchActivity launchActivity2 = LaunchActivity.this;
launchActivity.updateAppAlertDialog = new UpdateAppAlertDialog(launchActivity2, res, launchActivity2.currentAccount);
LaunchActivity.this.updateAppAlertDialog.show();
}
@Override
public void onNormal(TLRPC.TL_help_appUpdate res) {
LaunchActivity.this.dismissCheckUpdateDialog();
if (LaunchActivity.this.updateAppAlertDialog != null && LaunchActivity.this.updateAppAlertDialog.isShowing()) {
return;
}
LaunchActivity launchActivity = LaunchActivity.this;
LaunchActivity launchActivity2 = LaunchActivity.this;
launchActivity.updateAppAlertDialog = new UpdateAppAlertDialog(launchActivity2, res, launchActivity2.currentAccount);
LaunchActivity.this.updateAppAlertDialog.show();
}
@Override
public void onNoUpdate() {
LaunchActivity.this.dismissCheckUpdateDialog();
LaunchActivity.this.dismissUpdateAppAlertDialog();
if (isClick) {
ToastUtils.show((int) R.string.NoUpdate);
}
}
}, isClick);
}
private void showCheckUpdateDialog() {
dismissCheckUpdateDialog();
AlertDialog alertDialog = new AlertDialog(this, 3);
this.checkUpdateDialog = alertDialog;
alertDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public final void onDismiss(DialogInterface dialogInterface) {
LaunchActivity.this.lambda$showCheckUpdateDialog$38$LaunchActivity(dialogInterface);
}
});
this.checkUpdateDialog.show();
}
public void lambda$showCheckUpdateDialog$38$LaunchActivity(DialogInterface dialog) {
AppUpdater.getInstance(this.currentAccount).cancel();
}
public void dismissCheckUpdateDialog() {
AlertDialog alertDialog = this.checkUpdateDialog;
if (alertDialog != null) {
alertDialog.dismiss();
this.checkUpdateDialog = null;
}
}
public void dismissUpdateAppAlertDialog() {
UpdateAppAlertDialog updateAppAlertDialog = this.updateAppAlertDialog;
if (updateAppAlertDialog != null) {
updateAppAlertDialog.dismiss();
this.updateAppAlertDialog = null;
}
}
public AlertDialog showAlertDialog(AlertDialog.Builder builder) {
return showAlertDialog(builder.show());
}
public AlertDialog showAlertDialog(AlertDialog dialog) {
try {
if (this.visibleDialog != null) {
this.visibleDialog.dismiss();
this.visibleDialog = null;
}
} catch (Exception e) {
FileLog.e(e);
}
try {
this.visibleDialog = dialog;
dialog.setCanceledOnTouchOutside(true);
this.visibleDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog2) {
if (LaunchActivity.this.visibleDialog != null) {
if (LaunchActivity.this.visibleDialog != LaunchActivity.this.localeDialog) {
if (LaunchActivity.this.visibleDialog == LaunchActivity.this.proxyErrorDialog) {
MessagesController.getGlobalMainSettings();
SharedPreferences.Editor editor = MessagesController.getGlobalMainSettings().edit();
editor.putBoolean("proxy_enabled", false);
editor.putBoolean("proxy_enabled_calls", false);
editor.commit();
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.proxySettingsChanged);
ConnectionsManager.setProxySettings(false, "", 1080, "", "", "");
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.proxySettingsChanged, new Object[0]);
LaunchActivity.this.proxyErrorDialog = null;
}
} else {
try {
String shorname = LocaleController.getInstance().getCurrentLocaleInfo().shortName;
ToastUtils.show((CharSequence) LaunchActivity.this.getStringForLanguageAlert(shorname.equals("en") ? LaunchActivity.this.englishLocaleStrings : LaunchActivity.this.systemLocaleStrings, "ChangeLanguageLater", R.string.ChangeLanguageLater));
} catch (Exception e2) {
FileLog.e(e2);
}
LaunchActivity.this.localeDialog = null;
}
}
LaunchActivity.this.visibleDialog = null;
}
});
return this.visibleDialog;
} catch (Exception e2) {
FileLog.e(e2);
return null;
}
}
@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
queryProxyAccount(intent);
handleIntent(intent, true, false, false);
}
@Override
public void didSelectDialogs(DialogsActivity dialogsFragment, ArrayList<Long> dids, CharSequence message, boolean param) {
int attachesCount;
long did;
int i;
final long did2 = dids.get(0).longValue();
int lower_part = (int) did2;
int high_id = (int) (did2 >> 32);
ArrayList<TLRPC.User> arrayList = this.contactsToSend;
int attachesCount2 = arrayList != null ? 0 + arrayList.size() : 0;
if (this.videoPath != null) {
attachesCount2++;
}
ArrayList<SendMessagesHelper.SendingMediaInfo> arrayList2 = this.photoPathsArray;
if (arrayList2 != null) {
attachesCount2 += arrayList2.size();
}
ArrayList<String> arrayList3 = this.documentsPathsArray;
if (arrayList3 != null) {
attachesCount2 += arrayList3.size();
}
ArrayList<Uri> arrayList4 = this.documentsUrisArray;
if (arrayList4 != null) {
attachesCount2 += arrayList4.size();
}
if (this.videoPath == null && this.photoPathsArray == null && this.documentsPathsArray == null && this.documentsUrisArray == null && this.sendingText != null) {
attachesCount = attachesCount2 + 1;
} else {
attachesCount = attachesCount2;
}
if (AlertsCreator.checkSlowMode(this, this.currentAccount, did2, attachesCount > 1)) {
return;
}
Bundle args = new Bundle();
final int account = dialogsFragment != null ? dialogsFragment.getCurrentAccount() : this.currentAccount;
args.putBoolean("scrollToTopOnResume", true);
if (!AndroidUtilities.isTablet()) {
NotificationCenter.getInstance(account).postNotificationName(NotificationCenter.closeChats, new Object[0]);
}
if (lower_part != 0) {
if (lower_part > 0) {
args.putInt("user_id", lower_part);
} else if (lower_part < 0) {
args.putInt("chat_id", -lower_part);
}
} else {
args.putInt("enc_id", high_id);
}
if (!MessagesController.getInstance(account).checkCanOpenChat(args, dialogsFragment)) {
return;
}
final ChatActivity fragment = new ChatActivity(args);
ArrayList<TLRPC.User> arrayList5 = this.contactsToSend;
if (arrayList5 != null && arrayList5.size() == 1) {
if (this.contactsToSend.size() == 1) {
PhonebookShareActivity contactFragment = new PhonebookShareActivity(null, this.contactsToSendUri, null, null);
contactFragment.setDelegate(new PhoneBookSelectActivity.PhoneBookSelectActivityDelegate() {
@Override
public final void didSelectContact(TLRPC.User user, boolean z, int i2) {
LaunchActivity.this.lambda$didSelectDialogs$39$LaunchActivity(fragment, account, did2, user, z, i2);
}
});
this.actionBarLayout.presentFragment(contactFragment, dialogsFragment != null, dialogsFragment == null, true, false);
}
} else {
AccountInstance accountInstance = AccountInstance.getInstance(UserConfig.selectedAccount);
this.actionBarLayout.presentFragment(fragment, dialogsFragment != null, dialogsFragment == null, true, false);
String str = this.videoPath;
if (str != null) {
fragment.openVideoEditor(str, this.sendingText);
this.sendingText = null;
}
if (this.photoPathsArray != null) {
String str2 = this.sendingText;
if (str2 != null && str2.length() <= 1024 && this.photoPathsArray.size() == 1) {
this.photoPathsArray.get(0).caption = this.sendingText;
this.sendingText = null;
}
i = 1;
did = did2;
SendMessagesHelper.prepareSendingMedia(accountInstance, this.photoPathsArray, did2, null, null, false, false, null, true, 0, false);
} else {
did = did2;
i = 1;
}
if (this.documentsPathsArray != null || this.documentsUrisArray != null) {
String caption = null;
String str3 = this.sendingText;
if (str3 != null && str3.length() <= 1024) {
ArrayList<String> arrayList6 = this.documentsPathsArray;
int size = arrayList6 != null ? arrayList6.size() : 0;
ArrayList<Uri> arrayList7 = this.documentsUrisArray;
if (size + (arrayList7 != null ? arrayList7.size() : 0) == i) {
caption = this.sendingText;
this.sendingText = null;
}
}
SendMessagesHelper.prepareSendingDocuments(accountInstance, this.documentsPathsArray, this.documentsOriginalPathsArray, this.documentsUrisArray, caption, this.documentsMimeType, did, null, null, null, true, 0);
}
String str4 = this.sendingText;
if (str4 != null) {
SendMessagesHelper.prepareSendingText(accountInstance, str4, did, true, 0);
}
ArrayList<TLRPC.User> arrayList8 = this.contactsToSend;
if (arrayList8 != null && !arrayList8.isEmpty()) {
for (int a = 0; a < this.contactsToSend.size(); a++) {
TLRPC.User user = this.contactsToSend.get(a);
SendMessagesHelper.getInstance(account).sendMessage(user, did, (MessageObject) null, (TLRPC.ReplyMarkup) null, (HashMap<String, String>) null, true, 0);
}
}
}
this.photoPathsArray = null;
this.videoPath = null;
this.sendingText = null;
this.documentsPathsArray = null;
this.documentsOriginalPathsArray = null;
this.contactsToSend = null;
this.contactsToSendUri = null;
}
public void lambda$didSelectDialogs$39$LaunchActivity(ChatActivity fragment, int account, long did, TLRPC.User user, boolean notify, int scheduleDate) {
this.actionBarLayout.presentFragment(fragment, true, false, true, false);
SendMessagesHelper.getInstance(account).sendMessage(user, did, (MessageObject) null, (TLRPC.ReplyMarkup) null, (HashMap<String, String>) null, notify, scheduleDate);
}
private void onFinish() {
if (this.finished) {
return;
}
this.finished = true;
Runnable runnable = this.lockRunnable;
if (runnable != null) {
AndroidUtilities.cancelRunOnUIThread(runnable);
this.lockRunnable = null;
}
int i = this.currentAccount;
if (i != -1) {
NotificationCenter.getInstance(i).removeObserver(this, NotificationCenter.appDidLogout);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.mainUserInfoChanged);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.didUpdateConnectionState);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.needShowAlert);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.wasUnableToFindCurrentLocation);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.openArticle);
NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.hasNewContactsToImport);
}
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.needShowAlert);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didSetNewWallpapper);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.suggestedLangpack);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.reloadInterface);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didSetNewTheme);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.needSetDayNightTheme);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.closeOtherAppActivities);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.didSetPasscode);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.notificationsCountUpdated);
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.receivedAVideoCallRequest);
}
public void lambda$runLinkRequest$28$LaunchActivity(BaseFragment fragment) {
this.actionBarLayout.presentFragment(fragment);
}
public boolean presentFragment(BaseFragment fragment, boolean removeLast, boolean forceWithoutAnimation) {
return this.actionBarLayout.presentFragment(fragment, removeLast, forceWithoutAnimation, true, false);
}
public ActionBarLayout getActionBarLayout() {
return this.actionBarLayout;
}
public ActionBarLayout getLayersActionBarLayout() {
return this.layersActionBarLayout;
}
public ActionBarLayout getRightActionBarLayout() {
return this.rightActionBarLayout;
}
private void parseSechmeOpenAccount(String url) {
if (TextUtils.isEmpty(url)) {
return;
}
String url2 = url.replace("hchat:openKey=", "").replace("hchat://openKey=", "");
if (!TextUtils.isEmpty(url2)) {
String result = url2.replace("%3D", "=");
byte[] decode = Base64.decode(result, 0);
String ret = new String(decode);
String[] split = ret.split("#");
String pUid = split[0].split("=")[1];
String hash = split[1].split("=")[1];
if (ret.contains("Uname")) {
String uName = split[2].split("=")[1];
boolean closeLast = true;
if (getActionBarLayout().fragmentsStack != null && getActionBarLayout().fragmentsStack.size() > 1) {
closeLast = false;
}
MessagesController.getInstance(UserConfig.selectedAccount).openByUserName(uName, getActionBarLayout().getCurrentFragment(), 1, closeLast);
return;
}
TLRPC.User user = new TLRPC.TL_user();
try {
user.id = Integer.valueOf(pUid).intValue();
user.access_hash = Long.valueOf(hash).longValue();
getUserInfo(user);
} catch (NumberFormatException e) {
FileLog.e("parse qr code err:" + e);
}
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (SharedConfig.passcodeHash.length() != 0 && SharedConfig.lastPauseTime != 0) {
SharedConfig.lastPauseTime = 0;
UserConfig.getInstance(this.currentAccount).saveConfig(false);
}
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PLAY_SERVICES_REQUEST_CHECK_SETTINGS) {
LocationController.getInstance(this.currentAccount).startFusedLocationRequest(resultCode == -1);
return;
}
ThemeEditorView editorView = ThemeEditorView.getInstance();
if (editorView != null) {
editorView.onActivityResult(requestCode, resultCode, data);
}
if (this.actionBarLayout.fragmentsStack.size() != 0) {
BaseFragment fragment = this.actionBarLayout.fragmentsStack.get(this.actionBarLayout.fragmentsStack.size() - 1);
fragment.onActivityResultFragment(requestCode, resultCode, data);
}
if (AndroidUtilities.isTablet()) {
if (this.rightActionBarLayout.fragmentsStack.size() != 0) {
BaseFragment fragment2 = this.rightActionBarLayout.fragmentsStack.get(this.rightActionBarLayout.fragmentsStack.size() - 1);
fragment2.onActivityResultFragment(requestCode, resultCode, data);
}
if (this.layersActionBarLayout.fragmentsStack.size() != 0) {
BaseFragment fragment3 = this.layersActionBarLayout.fragmentsStack.get(this.layersActionBarLayout.fragmentsStack.size() - 1);
fragment3.onActivityResultFragment(requestCode, resultCode, data);
}
}
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
boolean granted = grantResults.length > 0 && grantResults[0] == 0;
if (requestCode == 4 || requestCode == 17) {
if (!granted) {
showPermissionErrorAlert(LocaleController.getString("PermissionStorage", R.string.PermissionStorage));
} else {
ImageLoader.getInstance().checkMediaPaths();
}
} else if (requestCode == 5) {
if (!granted) {
ContactsController.getInstance(this.currentAccount).forceImportContacts();
} else {
showPermissionErrorAlert(LocaleController.getString("PermissionContacts", R.string.PermissionContacts));
return;
}
} else if (requestCode == 3) {
boolean audioGranted = true;
boolean cameraGranted = true;
int size = permissions.length;
for (int i = 0; i < size; i++) {
if ("android.permission.RECORD_AUDIO".equals(permissions[i])) {
audioGranted = grantResults[i] == 0;
} else if ("android.permission.CAMERA".equals(permissions[i])) {
cameraGranted = grantResults[i] == 0;
}
}
if (!audioGranted) {
showPermissionErrorAlert(LocaleController.getString("PermissionNoAudio", R.string.PermissionNoAudio));
} else if (!cameraGranted) {
showPermissionErrorAlert(LocaleController.getString("PermissionNoCamera", R.string.PermissionNoCamera));
} else if (SharedConfig.inappCamera) {
CameraController.getInstance().initCamera(null);
return;
} else {
return;
}
} else if (requestCode == 18 || requestCode == 19 || requestCode == 20 || requestCode == 22) {
if (!granted) {
showPermissionErrorAlert(LocaleController.getString("PermissionNoCamera", R.string.PermissionNoCamera));
}
} else if (requestCode == 2 && granted) {
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.locationPermissionGranted, new Object[0]);
}
if (requestCode == 102 && Build.VERSION.SDK_INT < 29) {
boolean needStartService = true;
for (int i2 = 0; i2 < permissions.length; i2++) {
String per = permissions[i2];
boolean result = grantResults[i2] == 0;
if (!result && (per == "android.permission.READ_CALL_LOG" || per == "android.permission.WRITE_CALL_LOG")) {
needStartService = false;
break;
}
}
if (needStartService) {
if (Build.VERSION.SDK_INT < 26 || Build.VERSION.SDK_INT == 28) {
Intent interceptor = new Intent(this, CallApiBelow26And28Service.class);
startService(interceptor);
} else if (Build.VERSION.SDK_INT == 26 || Build.VERSION.SDK_INT == 27) {
Intent intent = new Intent("android.telecom.action.CHANGE_DEFAULT_DIALER");
intent.putExtra("android.telecom.extra.CHANGE_DEFAULT_DIALER_PACKAGE_NAME", getApplicationContext().getPackageName());
intent.addFlags(C.ENCODING_PCM_MU_LAW);
startActivity(intent);
}
}
}
if (this.actionBarLayout.fragmentsStack.size() != 0) {
BaseFragment fragment = this.actionBarLayout.fragmentsStack.get(this.actionBarLayout.fragmentsStack.size() - 1);
fragment.onRequestPermissionsResultFragment(requestCode, permissions, grantResults);
}
if (AndroidUtilities.isTablet()) {
if (this.rightActionBarLayout.fragmentsStack.size() != 0) {
BaseFragment fragment2 = this.rightActionBarLayout.fragmentsStack.get(this.rightActionBarLayout.fragmentsStack.size() - 1);
fragment2.onRequestPermissionsResultFragment(requestCode, permissions, grantResults);
}
if (this.layersActionBarLayout.fragmentsStack.size() != 0) {
BaseFragment fragment3 = this.layersActionBarLayout.fragmentsStack.get(this.layersActionBarLayout.fragmentsStack.size() - 1);
fragment3.onRequestPermissionsResultFragment(requestCode, permissions, grantResults);
}
}
}
private void showPermissionErrorAlert(String message) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(message);
builder.setNegativeButton(LocaleController.getString("PermissionOpenSettings", R.string.PermissionOpenSettings), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LaunchActivity.this.lambda$showPermissionErrorAlert$40$LaunchActivity(dialogInterface, i);
}
});
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
builder.show();
}
public void lambda$showPermissionErrorAlert$40$LaunchActivity(DialogInterface dialog, int which) {
try {
Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
intent.setData(Uri.parse("package:" + ApplicationLoader.applicationContext.getPackageName()));
startActivity(intent);
} catch (Exception e) {
FileLog.e(e);
}
}
@Override
public void onPause() {
super.onPause();
if (BuildVars.LOGS_ENABLED) {
FileLog.d("LaunchActivity ---> onPause");
}
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.stopAllHeavyOperations, 4096);
SharedConfig.lastAppPauseTime = System.currentTimeMillis();
ApplicationLoader.mainInterfacePaused = true;
Utilities.stageQueue.postRunnable(new Runnable() {
@Override
public final void run() {
LaunchActivity.lambda$onPause$41();
}
});
onPasscodePause();
this.actionBarLayout.onPause();
if (AndroidUtilities.isTablet()) {
this.rightActionBarLayout.onPause();
this.layersActionBarLayout.onPause();
}
PasscodeView passcodeView = this.passcodeView;
if (passcodeView != null) {
passcodeView.onPause();
}
ConnectionsManager.getInstance(this.currentAccount).setAppPaused(true, false);
if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) {
PhotoViewer.getInstance().onPause();
}
}
public static void lambda$onPause$41() {
ApplicationLoader.mainInterfacePausedStageQueue = true;
ApplicationLoader.mainInterfacePausedStageQueueTime = 0L;
}
@Override
public void onStart() {
super.onStart();
Browser.bindCustomTabsService(this);
}
@Override
public void onStop() {
super.onStop();
if (!AndroidUtilities.isAppOnForeground(this)) {
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.hideAVideoFloatWindow, 1);
this.mBytJumpFromBack = (byte) 1;
clearNotification();
}
Browser.unbindCustomTabsService(this);
}
@Override
public void onDestroy() {
if (PhotoViewer.getPipInstance() != null) {
PhotoViewer.getPipInstance().destroyPhotoViewer();
}
if (PhotoViewer.hasInstance()) {
PhotoViewer.getInstance().destroyPhotoViewer();
}
if (ImagePreviewActivity.getPipInstance() != null) {
ImagePreviewActivity.getPipInstance().destroyPhotoViewer();
}
if (ImagePreviewActivity.hasInstance()) {
ImagePreviewActivity.getInstance().destroyPhotoViewer();
}
if (PlayerUtils.getPlayer() != null) {
PlayerUtils.getPlayer().pause();
PlayerUtils.getPlayer().destroy();
}
if (SecretMediaViewer.hasInstance()) {
SecretMediaViewer.getInstance().destroyPhotoViewer();
}
if (ArticleViewer.hasInstance()) {
ArticleViewer.getInstance().destroyArticleViewer();
}
if (ContentPreviewViewer.hasInstance()) {
ContentPreviewViewer.getInstance().destroy();
}
PipRoundVideoView pipRoundVideoView = PipRoundVideoView.getInstance();
MediaController.getInstance().setBaseActivity(this, false);
MediaController.getInstance().setFeedbackView(this.actionBarLayout, false);
if (pipRoundVideoView != null) {
pipRoundVideoView.close(false);
}
Theme.destroyResources();
EmbedBottomSheet embedBottomSheet = EmbedBottomSheet.getInstance();
if (embedBottomSheet != null) {
embedBottomSheet.destroy();
}
ThemeEditorView editorView = ThemeEditorView.getInstance();
if (editorView != null) {
editorView.destroy();
}
DiscoveryJumpPausedFloatingView.destroy();
try {
if (this.visibleDialog != null) {
this.visibleDialog.dismiss();
this.visibleDialog = null;
}
} catch (Exception e) {
FileLog.e(e);
}
try {
if (this.onGlobalLayoutListener != null) {
View view = getWindow().getDecorView().getRootView();
view.getViewTreeObserver().removeOnGlobalLayoutListener(this.onGlobalLayoutListener);
}
} catch (Exception e2) {
FileLog.e(e2);
}
super.onDestroy();
onFinish();
}
private void clearNotification() {
NotificationManager service = (NotificationManager) getSystemService("notification");
if (service != null) {
service.cancelAll();
}
}
@Override
public void onResume() {
MessageObject messageObject;
super.onResume();
byte b = this.mBytJumpFromBack;
if (b == 1 || b == 0) {
clearNotification();
}
this.mBytJumpFromBack = (byte) 2;
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.startAllHeavyOperations, 4096);
MediaController.getInstance().setFeedbackView(this.actionBarLayout, true);
ApplicationLoader.mainInterfacePaused = false;
showLanguageAlert(false);
Utilities.stageQueue.postRunnable(new Runnable() {
@Override
public final void run() {
LaunchActivity.lambda$onResume$42();
}
});
checkFreeDiscSpace();
MediaController.checkGallery();
onPasscodeResume();
if (this.passcodeView.getVisibility() != 0) {
this.actionBarLayout.onResume();
if (AndroidUtilities.isTablet()) {
this.rightActionBarLayout.onResume();
this.layersActionBarLayout.onResume();
}
} else {
this.actionBarLayout.dismissDialogs();
if (AndroidUtilities.isTablet()) {
this.rightActionBarLayout.dismissDialogs();
this.layersActionBarLayout.dismissDialogs();
}
this.passcodeView.onResume();
}
ConnectionsManager.getInstance(this.currentAccount).setAppPaused(false, false);
updateCurrentConnectionState(this.currentAccount);
if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) {
PhotoViewer.getInstance().onResume();
}
PipRoundVideoView pipRoundVideoView = PipRoundVideoView.getInstance();
if (pipRoundVideoView != null && MediaController.getInstance().isMessagePaused() && (messageObject = MediaController.getInstance().getPlayingMessageObject()) != null) {
MediaController.getInstance().seekToProgress(messageObject, messageObject.audioProgress);
}
if (UserConfig.getInstance(UserConfig.selectedAccount).unacceptedTermsOfService != null) {
showTosActivity(UserConfig.selectedAccount, UserConfig.getInstance(UserConfig.selectedAccount).unacceptedTermsOfService);
} else if (AppUpdater.pendingAppUpdate != null) {
dismissCheckUpdateDialog();
UpdateAppAlertDialog updateAppAlertDialog = this.updateAppAlertDialog;
if (updateAppAlertDialog != null && updateAppAlertDialog.isShowing()) {
return;
}
UpdateAppAlertDialog updateAppAlertDialog2 = new UpdateAppAlertDialog(this, AppUpdater.pendingAppUpdate, this.currentAccount);
this.updateAppAlertDialog = updateAppAlertDialog2;
updateAppAlertDialog2.show();
}
checkAppUpdate(false);
processVisualCallRequest();
RingUtils.stopMediaPlayerRing();
try {
if (ApplicationLoader.mbytAVideoCallBusy != 1) {
if (ApplicationLoader.mbytAVideoCallBusy == 2) {
startActivity(new Intent(this, VisualCallActivity.class));
} else if (ApplicationLoader.mbytAVideoCallBusy == 3 || ApplicationLoader.mbytAVideoCallBusy == 4) {
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.hideAVideoFloatWindow, 0);
}
} else {
startActivity(new Intent(this, VisualCallReceiveActivity.class));
}
} catch (Exception e) {
}
}
public static void lambda$onResume$42() {
ApplicationLoader.mainInterfacePausedStageQueue = false;
ApplicationLoader.mainInterfacePausedStageQueueTime = System.currentTimeMillis();
}
private void processVisualCallRequest() {
final ArrayList<VisualCallRequestParaBean> arrayList = DatabaseInstance.queryVisualCallRequest();
if (arrayList.size() > 0) {
this.actionBarLayout.postDelayed(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$processVisualCallRequest$43$LaunchActivity(arrayList);
}
}, 500L);
}
}
public void lambda$processVisualCallRequest$43$LaunchActivity(ArrayList arrayList) {
DatabaseInstance.deleteVisualCallRequest();
VisualCallRequestParaBean paraBean = (VisualCallRequestParaBean) arrayList.get(0);
Intent actIntent = new Intent(this, VisualCallReceiveActivity.class);
actIntent.putExtra(MimeTypes.BASE_TYPE_VIDEO, paraBean.isVideo());
actIntent.putExtra(TtmlNode.ATTR_ID, paraBean.getStrId());
actIntent.putExtra("admin_id", paraBean.getAdmin_id());
if (BuildVars.LOGS_ENABLED) {
FileLog.d("Launch call ===> processVisualCallRequest admin_id = " + paraBean.getAdmin_id());
}
actIntent.putExtra("app_id", paraBean.getApp_id());
actIntent.putExtra("token", paraBean.getToken());
List<String> a = Arrays.asList(paraBean.getGslb().split(","));
actIntent.putStringArrayListExtra("gslb", new ArrayList<>(a));
actIntent.putExtra("json", paraBean.getJson());
actIntent.putExtra("from", 1);
actIntent.addFlags(C.ENCODING_PCM_MU_LAW);
startActivity(actIntent);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
AndroidUtilities.checkDisplaySize(this, newConfig);
super.onConfigurationChanged(newConfig);
checkLayout();
PipRoundVideoView pipRoundVideoView = PipRoundVideoView.getInstance();
if (pipRoundVideoView != null) {
pipRoundVideoView.onConfigurationChanged();
}
EmbedBottomSheet embedBottomSheet = EmbedBottomSheet.getInstance();
if (embedBottomSheet != null) {
embedBottomSheet.onConfigurationChanged(newConfig);
}
PhotoViewer photoViewer = PhotoViewer.getPipInstance();
if (photoViewer != null) {
photoViewer.onConfigurationChanged(newConfig);
}
ThemeEditorView editorView = ThemeEditorView.getInstance();
if (editorView != null) {
editorView.onConfigurationChanged();
}
}
@Override
public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
AndroidUtilities.isInMultiwindow = isInMultiWindowMode;
checkLayout();
}
@Override
public void didReceivedNotification(int id, final int account, Object... args) {
View child;
if (id == NotificationCenter.appDidLogout) {
switchToAvailableAccountOrLogout();
return;
}
boolean z = false;
if (id == NotificationCenter.closeOtherAppActivities) {
if (args[0] != this) {
onFinish();
finish();
}
} else if (id == NotificationCenter.didUpdateConnectionState) {
int state = ConnectionsManager.getInstance(account).getConnectionState();
if (this.currentConnectionState != state) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("switch to state " + state);
}
this.currentConnectionState = state;
updateCurrentConnectionState(account);
}
} else if (id == NotificationCenter.mainUserInfoChanged) {
this.drawerLayoutAdapter.notifyDataSetChanged();
} else if (id == NotificationCenter.needShowAlert) {
Integer reason = (Integer) args[0];
if (reason.intValue() == 3 && this.proxyErrorDialog != null) {
return;
}
if (reason.intValue() == 4) {
showTosActivity(account, (TLRPC.TL_help_termsOfService) args[1]);
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
if (reason.intValue() != 2 && reason.intValue() != 3) {
builder.setNegativeButton(LocaleController.getString("MoreInfo", R.string.MoreInfo), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LaunchActivity.lambda$didReceivedNotification$44(account, dialogInterface, i);
}
});
}
if (reason.intValue() == 5) {
builder.setMessage(LocaleController.getString("NobodyLikesSpam3", R.string.NobodyLikesSpam3));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
} else if (reason.intValue() == 0) {
builder.setMessage(LocaleController.getString("NobodyLikesSpam1", R.string.NobodyLikesSpam1));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
} else if (reason.intValue() == 1) {
builder.setMessage(LocaleController.getString("NobodyLikesSpam2", R.string.NobodyLikesSpam2));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
} else if (reason.intValue() == 2) {
if ("ErrorSendMessageTooFreq".equals((String) args[1])) {
builder.setMessage(LocaleController.getString(R.string.ErrorSendMessageTooFreq));
} else {
builder.setMessage((String) args[1]);
}
String type = (String) args[2];
if (type.startsWith("AUTH_KEY_DROP_")) {
builder.setPositiveButton(LocaleController.getString("Cancel", R.string.Cancel), null);
builder.setNegativeButton(LocaleController.getString("LogOut", R.string.LogOut), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LaunchActivity.this.lambda$didReceivedNotification$45$LaunchActivity(dialogInterface, i);
}
});
} else {
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
}
} else if (reason.intValue() == 3) {
builder.setMessage(LocaleController.getString("UseProxyErrorTips", R.string.UseProxyErrorTips));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
this.proxyErrorDialog = showAlertDialog(builder);
return;
}
if (!mainFragmentsStack.isEmpty()) {
ArrayList<BaseFragment> arrayList = mainFragmentsStack;
arrayList.get(arrayList.size() - 1).showDialog(builder.create());
}
} else if (id == NotificationCenter.wasUnableToFindCurrentLocation) {
final HashMap<String, MessageObject> waitingForLocation = (HashMap) args[0];
AlertDialog.Builder builder2 = new AlertDialog.Builder(this);
builder2.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder2.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
builder2.setNegativeButton(LocaleController.getString("ShareYouLocationUnableManually", R.string.ShareYouLocationUnableManually), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LaunchActivity.this.lambda$didReceivedNotification$47$LaunchActivity(waitingForLocation, account, dialogInterface, i);
}
});
builder2.setMessage(LocaleController.getString("ShareYouLocationUnable", R.string.ShareYouLocationUnable));
if (!mainFragmentsStack.isEmpty()) {
ArrayList<BaseFragment> arrayList2 = mainFragmentsStack;
arrayList2.get(arrayList2.size() - 1).showDialog(builder2.create());
}
} else if (id == NotificationCenter.didSetNewWallpapper) {
RecyclerListView recyclerListView = this.sideMenu;
if (recyclerListView != null && (child = recyclerListView.getChildAt(0)) != null) {
child.invalidate();
}
} else if (id == NotificationCenter.didSetPasscode) {
if (SharedConfig.passcodeHash.length() > 0 && !SharedConfig.allowScreenCapture) {
try {
getWindow().setFlags(8192, 8192);
} catch (Exception e) {
FileLog.e(e);
}
} else if (!MediaController.getInstance().hasFlagSecureFragment()) {
try {
getWindow().clearFlags(8192);
} catch (Exception e2) {
FileLog.e(e2);
}
}
} else if (id == NotificationCenter.reloadInterface) {
if (mainFragmentsStack.size() > 1) {
ArrayList<BaseFragment> arrayList3 = mainFragmentsStack;
if (arrayList3.get(arrayList3.size() - 1) instanceof SettingsActivity) {
z = true;
}
}
boolean last = z;
rebuildAllFragments(last);
} else if (id == NotificationCenter.suggestedLangpack) {
showLanguageAlert(false);
} else if (id == NotificationCenter.openArticle) {
if (mainFragmentsStack.isEmpty()) {
return;
}
ArticleViewer articleViewer = ArticleViewer.getInstance();
ArrayList<BaseFragment> arrayList4 = mainFragmentsStack;
articleViewer.setParentActivity(this, arrayList4.get(arrayList4.size() - 1));
ArticleViewer.getInstance().open((TLRPC.TL_webPage) args[0], (String) args[1]);
} else if (id == NotificationCenter.hasNewContactsToImport) {
ActionBarLayout actionBarLayout = this.actionBarLayout;
if (actionBarLayout == null || actionBarLayout.fragmentsStack.isEmpty()) {
return;
}
((Integer) args[0]).intValue();
final HashMap<String, ContactsController.Contact> contactHashMap = (HashMap) args[1];
final boolean first = ((Boolean) args[2]).booleanValue();
final boolean schedule = ((Boolean) args[3]).booleanValue();
BaseFragment fragment = this.actionBarLayout.fragmentsStack.get(this.actionBarLayout.fragmentsStack.size() - 1);
AlertDialog.Builder builder3 = new AlertDialog.Builder(this);
builder3.setTitle(LocaleController.getString("UpdateContactsTitle", R.string.UpdateContactsTitle));
builder3.setMessage(LocaleController.getString("UpdateContactsMessage", R.string.UpdateContactsMessage));
builder3.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ContactsController.getInstance(account).syncPhoneBookByAlert(contactHashMap, first, schedule, false);
}
});
builder3.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ContactsController.getInstance(account).syncPhoneBookByAlert(contactHashMap, first, schedule, true);
}
});
builder3.setOnBackButtonListener(new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
ContactsController.getInstance(account).syncPhoneBookByAlert(contactHashMap, first, schedule, true);
}
});
AlertDialog dialog = builder3.create();
fragment.showDialog(dialog);
dialog.setCanceledOnTouchOutside(false);
} else if (id == NotificationCenter.didSetNewTheme) {
Boolean nightTheme = (Boolean) args[0];
if (!nightTheme.booleanValue()) {
RecyclerListView recyclerListView2 = this.sideMenu;
if (recyclerListView2 != null) {
recyclerListView2.setBackgroundColor(Theme.getColor(Theme.key_chats_menuBackground));
this.sideMenu.setGlowColor(Theme.getColor(Theme.key_chats_menuBackground));
this.sideMenu.setListSelectorColor(Theme.getColor(Theme.key_listSelector));
this.sideMenu.getAdapter().notifyDataSetChanged();
}
if (Build.VERSION.SDK_INT >= 21) {
try {
setTaskDescription(new ActivityManager.TaskDescription((String) null, (Bitmap) null, Theme.getColor(Theme.key_actionBarDefault) | (-16777216)));
} catch (Exception e3) {
}
}
}
this.drawerLayoutContainer.setBehindKeyboardColor(Theme.getColor(Theme.key_windowBackgroundWhite));
} else if (id == NotificationCenter.needSetDayNightTheme) {
Theme.ThemeInfo theme = (Theme.ThemeInfo) args[0];
boolean nigthTheme = ((Boolean) args[1]).booleanValue();
this.actionBarLayout.animateThemedValues(theme, nigthTheme);
if (AndroidUtilities.isTablet()) {
this.layersActionBarLayout.animateThemedValues(theme, nigthTheme);
this.rightActionBarLayout.animateThemedValues(theme, nigthTheme);
}
} else if (id == NotificationCenter.notificationsCountUpdated) {
RecyclerListView recyclerListView3 = this.sideMenu;
if (recyclerListView3 != null) {
Integer accountNum = (Integer) args[0];
int count = recyclerListView3.getChildCount();
for (int a = 0; a < count; a++) {
View child2 = this.sideMenu.getChildAt(a);
if ((child2 instanceof DrawerUserCell) && ((DrawerUserCell) child2).getAccountNumber() == accountNum.intValue()) {
child2.invalidate();
return;
}
}
}
} else if (id == NotificationCenter.needShowPlayServicesAlert) {
try {
Status status = (Status) args[0];
status.startResolutionForResult(this, PLAY_SERVICES_REQUEST_CHECK_SETTINGS);
} catch (Throwable th) {
}
} else if (id == NotificationCenter.fileDidLoad) {
String str = this.loadingThemeFileName;
if (str != null) {
if (str.equals((String) args[0])) {
this.loadingThemeFileName = null;
File filesDirFixed = ApplicationLoader.getFilesDirFixed();
File locFile = new File(filesDirFixed, "remote" + this.loadingTheme.id + ".attheme");
final Theme.ThemeInfo themeInfo = Theme.fillThemeValues(locFile, this.loadingTheme.title, this.loadingTheme);
if (themeInfo != null) {
if (themeInfo.pathToWallpaper != null) {
File file = new File(themeInfo.pathToWallpaper);
if (!file.exists()) {
TLRPC.TL_account_getWallPaper req = new TLRPC.TL_account_getWallPaper();
TLRPC.TL_inputWallPaperSlug inputWallPaperSlug = new TLRPC.TL_inputWallPaperSlug();
inputWallPaperSlug.slug = themeInfo.slug;
req.wallpaper = inputWallPaperSlug;
ConnectionsManager.getInstance(themeInfo.account).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LaunchActivity.this.lambda$didReceivedNotification$52$LaunchActivity(themeInfo, tLObject, tL_error);
}
});
return;
}
}
Theme.ThemeInfo finalThemeInfo = Theme.applyThemeFile(locFile, this.loadingTheme.title, this.loadingTheme, true);
if (finalThemeInfo != null) {
lambda$runLinkRequest$28$LaunchActivity(new ThemePreviewActivity(finalThemeInfo, true, 0, false));
}
}
onThemeLoadFinish();
return;
}
return;
}
String str2 = this.loadingThemeWallpaperName;
if (str2 != null && str2.equals((String) args[0])) {
this.loadingThemeWallpaperName = null;
final File file2 = (File) args[1];
Utilities.globalQueue.postRunnable(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$didReceivedNotification$54$LaunchActivity(file2);
}
});
}
} else if (id == NotificationCenter.fileDidFailToLoad) {
String path = (String) args[0];
if (path.equals(this.loadingThemeFileName) || path.equals(this.loadingThemeWallpaperName)) {
onThemeLoadFinish();
}
} else if (id == NotificationCenter.receivedAVideoCallRequest) {
TLRPCCall.TL_UpdateMeetCallRequested requested = (TLRPCCall.TL_UpdateMeetCallRequested) args[0];
if (BuildVars.LOGS_ENABLED) {
FileLog.d("Launch call ===> receive video call , type = " + ((int) ApplicationLoader.mbytAVideoCallBusy));
}
if (requested != null) {
if (!isExistMainActivity(VisualCallReceiveActivity.class)) {
Intent intent = new Intent(this, VisualCallReceiveActivity.class);
intent.putExtra(MimeTypes.BASE_TYPE_VIDEO, false);
intent.putExtra(TtmlNode.ATTR_ID, requested.id);
intent.putExtra("admin_id", requested.admin_id);
intent.putExtra("app_id", requested.appid);
intent.putExtra("token", requested.token);
intent.putStringArrayListExtra("gslb", requested.gslb);
intent.putExtra("json", requested.data.data);
startActivity(intent);
ApplicationLoader.mbytAVideoCallBusy = (byte) 1;
return;
}
AVideoCallInterface.IsBusyingNow(requested.id);
}
} else if (id == NotificationCenter.folderWebView) {
createGamePlayingFloatingView();
}
}
public static void lambda$didReceivedNotification$44(int account, DialogInterface dialogInterface, int i) {
if (!mainFragmentsStack.isEmpty()) {
MessagesController messagesController = MessagesController.getInstance(account);
ArrayList<BaseFragment> arrayList = mainFragmentsStack;
messagesController.openByUserName("spambot", arrayList.get(arrayList.size() - 1), 1);
}
}
public void lambda$didReceivedNotification$45$LaunchActivity(DialogInterface dialog, int which) {
MessagesController.getInstance(this.currentAccount).performLogout(2);
}
public void lambda$didReceivedNotification$47$LaunchActivity(final HashMap waitingForLocation, final int account, DialogInterface dialogInterface, int i) {
if (mainFragmentsStack.isEmpty()) {
return;
}
if (Build.VERSION.SDK_INT >= 23 && checkSelfPermission(im.jpeoubogmn.ui.hui.visualcall.PermissionUtils.PERMISSION_ACCESS_COARSE_LOCATION) != 0) {
requestPermissions(new String[]{im.jpeoubogmn.ui.hui.visualcall.PermissionUtils.PERMISSION_ACCESS_COARSE_LOCATION, "android.permission.ACCESS_FINE_LOCATION"}, 2);
return;
}
NewLocationActivity activity = new NewLocationActivity(0);
activity.setDelegate(new NewLocationActivity.LocationActivityDelegate() {
@Override
public final void didSelectLocation(TLRPC.MessageMedia messageMedia, int i2, boolean z, int i3) {
LaunchActivity.lambda$null$46(waitingForLocation, account, messageMedia, i2, z, i3);
}
});
lambda$runLinkRequest$28$LaunchActivity(activity);
}
public static void lambda$null$46(HashMap waitingForLocation, int account, TLRPC.MessageMedia location, int locationType, boolean notify, int scheduleDate) {
for (Map.Entry<String, MessageObject> entry : waitingForLocation.entrySet()) {
MessageObject messageObject = entry.getValue();
SendMessagesHelper.getInstance(account).sendMessage(location, messageObject.getDialogId(), messageObject, (TLRPC.ReplyMarkup) null, (HashMap<String, String>) null, notify, scheduleDate);
}
}
public void lambda$didReceivedNotification$52$LaunchActivity(final Theme.ThemeInfo themeInfo, final TLObject response, TLRPC.TL_error error) {
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$null$51$LaunchActivity(response, themeInfo);
}
});
}
public void lambda$null$51$LaunchActivity(TLObject response, Theme.ThemeInfo themeInfo) {
if (response instanceof TLRPC.TL_wallPaper) {
TLRPC.TL_wallPaper wallPaper = (TLRPC.TL_wallPaper) response;
this.loadingThemeInfo = themeInfo;
this.loadingThemeWallpaperName = FileLoader.getAttachFileName(wallPaper.document);
FileLoader.getInstance(themeInfo.account).loadFile(wallPaper.document, wallPaper, 1, 1);
return;
}
onThemeLoadFinish();
}
public void lambda$didReceivedNotification$54$LaunchActivity(File file) {
try {
Bitmap bitmap = ThemesHorizontalListCell.getScaledBitmap(AndroidUtilities.dp(640.0f), AndroidUtilities.dp(360.0f), file.getAbsolutePath(), null, 0);
if (this.loadingThemeInfo.isBlured) {
bitmap = Utilities.blurWallpaper(bitmap);
}
FileOutputStream stream = new FileOutputStream(this.loadingThemeInfo.pathToWallpaper);
bitmap.compress(Bitmap.CompressFormat.JPEG, 87, stream);
stream.close();
} catch (Throwable e) {
FileLog.e(e);
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$null$53$LaunchActivity();
}
});
}
public void lambda$null$53$LaunchActivity() {
File filesDirFixed = ApplicationLoader.getFilesDirFixed();
File locFile = new File(filesDirFixed, "remote" + this.loadingTheme.id + ".attheme");
Theme.ThemeInfo finalThemeInfo = Theme.applyThemeFile(locFile, this.loadingTheme.title, this.loadingTheme, true);
if (finalThemeInfo != null) {
lambda$runLinkRequest$28$LaunchActivity(new ThemePreviewActivity(finalThemeInfo, true, 0, false));
}
onThemeLoadFinish();
}
private boolean isExistMainActivity(Class<?> activity) {
return ApplicationLoader.mbytAVideoCallBusy == 1;
}
public String getStringForLanguageAlert(HashMap<String, String> map, String key, int intKey) {
String value = map.get(key);
if (value == null) {
return LocaleController.getString(key, intKey);
}
return value;
}
private void onThemeLoadFinish() {
AlertDialog alertDialog = this.loadingThemeProgressDialog;
if (alertDialog != null) {
try {
alertDialog.dismiss();
} finally {
this.loadingThemeProgressDialog = null;
}
}
this.loadingThemeWallpaperName = null;
this.loadingThemeInfo = null;
this.loadingThemeFileName = null;
this.loadingTheme = null;
}
private void checkFreeDiscSpace() {
SharedConfig.checkKeepMedia();
if (Build.VERSION.SDK_INT >= 26) {
return;
}
Utilities.globalQueue.postRunnable(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$checkFreeDiscSpace$56$LaunchActivity();
}
}, AdaptiveTrackSelection.DEFAULT_MIN_TIME_BETWEEN_BUFFER_REEVALUTATION_MS);
}
public void lambda$checkFreeDiscSpace$56$LaunchActivity() {
File path;
long freeSpace;
if (!UserConfig.getInstance(this.currentAccount).isClientActivated()) {
return;
}
try {
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
if (Math.abs(preferences.getLong("last_space_check", 0L) - System.currentTimeMillis()) < 259200000 || (path = FileLoader.getDirectory(4)) == null) {
return;
}
StatFs statFs = new StatFs(path.getAbsolutePath());
if (Build.VERSION.SDK_INT < 18) {
freeSpace = Math.abs(statFs.getAvailableBlocks() * statFs.getBlockSize());
} else {
long freeSpace2 = statFs.getAvailableBlocksLong();
freeSpace = freeSpace2 * statFs.getBlockSizeLong();
}
if (freeSpace < 104857600) {
preferences.edit().putLong("last_space_check", System.currentTimeMillis()).commit();
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$null$55$LaunchActivity();
}
});
}
} catch (Throwable th) {
}
}
public void lambda$null$55$LaunchActivity() {
try {
AlertsCreator.createFreeSpaceDialog(this).show();
} catch (Throwable th) {
}
}
private void showLanguageAlertInternal(LocaleController.LocaleInfo systemInfo, LocaleController.LocaleInfo englishInfo, String systemLang) {
boolean firstSystem;
int i;
int a;
try {
this.loadingLocaleDialog = false;
try {
} catch (Exception e) {
e = e;
FileLog.e(e);
return;
}
try {
if (!systemInfo.builtIn && !LocaleController.getInstance().isCurrentLocalLocale()) {
firstSystem = false;
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getStringForLanguageAlert(this.systemLocaleStrings, "ChooseYourLanguage", R.string.ChooseYourLanguage));
builder.setSubtitle(getStringForLanguageAlert(this.englishLocaleStrings, "ChooseYourLanguage", R.string.ChooseYourLanguage));
LinearLayout linearLayout = new LinearLayout(this);
linearLayout.setOrientation(1);
final LanguageCell[] cells = new LanguageCell[2];
final LocaleController.LocaleInfo[] selectedLanguage = new LocaleController.LocaleInfo[1];
LocaleController.LocaleInfo[] locales = new LocaleController.LocaleInfo[2];
String englishName = getStringForLanguageAlert(this.systemLocaleStrings, "English", R.string.English);
locales[0] = !firstSystem ? systemInfo : englishInfo;
locales[1] = !firstSystem ? englishInfo : systemInfo;
selectedLanguage[0] = !firstSystem ? systemInfo : englishInfo;
a = 0;
for (i = 2; a < i; i = 2) {
cells[a] = new LanguageCell(this, true);
try {
cells[a].setLanguage(locales[a], locales[a] == englishInfo ? englishName : null, true);
cells[a].setTag(Integer.valueOf(a));
cells[a].setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_dialogButtonSelector), 2));
cells[a].setLanguageSelected(a == 0);
linearLayout.addView(cells[a], LayoutHelper.createLinear(-1, 50));
cells[a].setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LaunchActivity.lambda$showLanguageAlertInternal$57(selectedLanguage, cells, view);
}
});
a++;
} catch (Exception e2) {
e = e2;
FileLog.e(e);
return;
}
}
LanguageCell cell = new LanguageCell(this, true);
cell.setValue(getStringForLanguageAlert(this.systemLocaleStrings, "ChooseYourLanguageOther", R.string.ChooseYourLanguageOther), getStringForLanguageAlert(this.englishLocaleStrings, "ChooseYourLanguageOther", R.string.ChooseYourLanguageOther));
cell.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LaunchActivity.this.lambda$showLanguageAlertInternal$58$LaunchActivity(view);
}
});
linearLayout.addView(cell, LayoutHelper.createLinear(-1, 50));
builder.setView(linearLayout);
builder.setNegativeButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
LaunchActivity.this.lambda$showLanguageAlertInternal$59$LaunchActivity(selectedLanguage, dialogInterface, i2);
}
});
this.localeDialog = showAlertDialog(builder);
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
preferences.edit().putString("language_showed2", systemLang).commit();
return;
}
preferences.edit().putString("language_showed2", systemLang).commit();
return;
} catch (Exception e3) {
e = e3;
FileLog.e(e);
return;
}
firstSystem = true;
AlertDialog.Builder builder2 = new AlertDialog.Builder(this);
builder2.setTitle(getStringForLanguageAlert(this.systemLocaleStrings, "ChooseYourLanguage", R.string.ChooseYourLanguage));
builder2.setSubtitle(getStringForLanguageAlert(this.englishLocaleStrings, "ChooseYourLanguage", R.string.ChooseYourLanguage));
LinearLayout linearLayout2 = new LinearLayout(this);
linearLayout2.setOrientation(1);
final LanguageCell[] cells2 = new LanguageCell[2];
final LocaleController.LocaleInfo[] selectedLanguage2 = new LocaleController.LocaleInfo[1];
LocaleController.LocaleInfo[] locales2 = new LocaleController.LocaleInfo[2];
String englishName2 = getStringForLanguageAlert(this.systemLocaleStrings, "English", R.string.English);
locales2[0] = !firstSystem ? systemInfo : englishInfo;
locales2[1] = !firstSystem ? englishInfo : systemInfo;
selectedLanguage2[0] = !firstSystem ? systemInfo : englishInfo;
a = 0;
while (a < i) {
}
LanguageCell cell2 = new LanguageCell(this, true);
cell2.setValue(getStringForLanguageAlert(this.systemLocaleStrings, "ChooseYourLanguageOther", R.string.ChooseYourLanguageOther), getStringForLanguageAlert(this.englishLocaleStrings, "ChooseYourLanguageOther", R.string.ChooseYourLanguageOther));
cell2.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LaunchActivity.this.lambda$showLanguageAlertInternal$58$LaunchActivity(view);
}
});
linearLayout2.addView(cell2, LayoutHelper.createLinear(-1, 50));
builder2.setView(linearLayout2);
builder2.setNegativeButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i2) {
LaunchActivity.this.lambda$showLanguageAlertInternal$59$LaunchActivity(selectedLanguage2, dialogInterface, i2);
}
});
this.localeDialog = showAlertDialog(builder2);
SharedPreferences preferences2 = MessagesController.getGlobalMainSettings();
} catch (Exception e4) {
e = e4;
}
}
public static void lambda$showLanguageAlertInternal$57(LocaleController.LocaleInfo[] selectedLanguage, LanguageCell[] cells, View v) {
Integer tag = (Integer) v.getTag();
selectedLanguage[0] = ((LanguageCell) v).getCurrentLocale();
int a1 = 0;
while (a1 < cells.length) {
cells[a1].setLanguageSelected(a1 == tag.intValue());
a1++;
}
}
public void lambda$showLanguageAlertInternal$58$LaunchActivity(View v) {
this.localeDialog = null;
this.drawerLayoutContainer.closeDrawer(true);
lambda$runLinkRequest$28$LaunchActivity(new LanguageSelectActivity());
AlertDialog alertDialog = this.visibleDialog;
if (alertDialog != null) {
alertDialog.dismiss();
this.visibleDialog = null;
}
}
public void lambda$showLanguageAlertInternal$59$LaunchActivity(LocaleController.LocaleInfo[] selectedLanguage, DialogInterface dialog, int which) {
LocaleController.getInstance().applyLanguage(selectedLanguage[0], true, false, this.currentAccount);
rebuildAllFragments(true);
}
private void showLanguageAlert(boolean force) {
String alias;
char c;
try {
if (!this.loadingLocaleDialog && !ApplicationLoader.mainInterfacePaused) {
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
String showedLang = preferences.getString("language_showed2", "");
final String systemLang = MessagesController.getInstance(this.currentAccount).suggestedLangCode;
if (!force && showedLang.equals(systemLang)) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("alert already showed for " + showedLang);
return;
}
return;
}
final LocaleController.LocaleInfo[] infos = new LocaleController.LocaleInfo[2];
String arg = systemLang.contains("-") ? systemLang.split("-")[0] : systemLang;
if ("in".equals(arg)) {
alias = TtmlNode.ATTR_ID;
} else if ("iw".equals(arg)) {
alias = "he";
} else if ("jw".equals(arg)) {
alias = "jv";
} else {
alias = null;
}
for (int a = 0; a < LocaleController.getInstance().languages.size(); a++) {
LocaleController.LocaleInfo info = LocaleController.getInstance().languages.get(a);
if (info.shortName.equals("en")) {
infos[0] = info;
}
if (!info.shortName.replace("_", "-").equals(systemLang) && !info.shortName.equals(arg) && !info.shortName.equals(alias)) {
c = 1;
if (infos[0] == null && infos[c] != null) {
break;
}
}
c = 1;
infos[1] = info;
if (infos[0] == null) {
}
}
if (infos[0] != null && infos[1] != null && infos[0] != infos[1]) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("show lang alert for " + infos[0].getKey() + " and " + infos[1].getKey());
}
this.systemLocaleStrings = null;
this.englishLocaleStrings = null;
this.loadingLocaleDialog = true;
TLRPC.TL_langpack_getStrings req = new TLRPC.TL_langpack_getStrings();
req.lang_code = infos[1].getLangCode();
req.keys.add("English");
req.keys.add("ChooseYourLanguage");
req.keys.add("ChooseYourLanguageOther");
req.keys.add("ChangeLanguageLater");
ConnectionsManager.getInstance(this.currentAccount).sendRequest(req, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LaunchActivity.this.lambda$showLanguageAlert$61$LaunchActivity(infos, systemLang, tLObject, tL_error);
}
}, 8);
TLRPC.TL_langpack_getStrings req2 = new TLRPC.TL_langpack_getStrings();
req2.lang_code = infos[0].getLangCode();
req2.keys.add("English");
req2.keys.add("ChooseYourLanguage");
req2.keys.add("ChooseYourLanguageOther");
req2.keys.add("ChangeLanguageLater");
ConnectionsManager.getInstance(this.currentAccount).sendRequest(req2, new RequestDelegate() {
@Override
public final void run(TLObject tLObject, TLRPC.TL_error tL_error) {
LaunchActivity.this.lambda$showLanguageAlert$63$LaunchActivity(infos, systemLang, tLObject, tL_error);
}
}, 8);
}
}
} catch (Exception e) {
FileLog.e(e);
}
}
public void lambda$showLanguageAlert$61$LaunchActivity(final LocaleController.LocaleInfo[] infos, final String systemLang, TLObject response, TLRPC.TL_error error) {
final HashMap<String, String> keys = new HashMap<>();
if (response != null) {
TLRPC.Vector vector = (TLRPC.Vector) response;
for (int a = 0; a < vector.objects.size(); a++) {
TLRPC.LangPackString string = (TLRPC.LangPackString) vector.objects.get(a);
keys.put(string.key, string.value);
}
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$null$60$LaunchActivity(keys, infos, systemLang);
}
});
}
public void lambda$null$60$LaunchActivity(HashMap keys, LocaleController.LocaleInfo[] infos, String systemLang) {
this.systemLocaleStrings = keys;
if (this.englishLocaleStrings != null && keys != null) {
showLanguageAlertInternal(infos[1], infos[0], systemLang);
}
}
public void lambda$showLanguageAlert$63$LaunchActivity(final LocaleController.LocaleInfo[] infos, final String systemLang, TLObject response, TLRPC.TL_error error) {
final HashMap<String, String> keys = new HashMap<>();
if (response != null) {
TLRPC.Vector vector = (TLRPC.Vector) response;
for (int a = 0; a < vector.objects.size(); a++) {
TLRPC.LangPackString string = (TLRPC.LangPackString) vector.objects.get(a);
keys.put(string.key, string.value);
}
}
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.lambda$null$62$LaunchActivity(keys, infos, systemLang);
}
});
}
public void lambda$null$62$LaunchActivity(HashMap keys, LocaleController.LocaleInfo[] infos, String systemLang) {
this.englishLocaleStrings = keys;
if (keys != null && this.systemLocaleStrings != null) {
showLanguageAlertInternal(infos[1], infos[0], systemLang);
}
}
private void onPasscodePause() {
Runnable runnable = this.lockRunnable;
if (runnable != null) {
AndroidUtilities.cancelRunOnUIThread(runnable);
this.lockRunnable = null;
}
if (SharedConfig.passcodeHash.length() != 0) {
SharedConfig.lastPauseTime = ConnectionsManager.getInstance(this.currentAccount).getCurrentTime();
this.lockRunnable = new Runnable() {
@Override
public void run() {
if (LaunchActivity.this.lockRunnable == this) {
if (AndroidUtilities.needShowPasscode(true)) {
if (BuildVars.LOGS_ENABLED) {
FileLog.d("lock app");
}
LaunchActivity.this.showPasscodeActivity();
} else if (BuildVars.LOGS_ENABLED) {
FileLog.d("didn't pass lock check");
}
LaunchActivity.this.lockRunnable = null;
}
}
};
if (SharedConfig.appLocked) {
AndroidUtilities.runOnUIThread(this.lockRunnable, 1000L);
} else if (SharedConfig.autoLockIn != 0) {
AndroidUtilities.runOnUIThread(this.lockRunnable, (SharedConfig.autoLockIn * 1000) + 1000);
}
} else {
SharedConfig.lastPauseTime = 0;
}
SharedConfig.saveConfig();
}
private void onPasscodeResume() {
Runnable runnable = this.lockRunnable;
if (runnable != null) {
AndroidUtilities.cancelRunOnUIThread(runnable);
this.lockRunnable = null;
}
if (AndroidUtilities.needShowPasscode(true)) {
showPasscodeActivity();
}
if (SharedConfig.lastPauseTime != 0) {
SharedConfig.lastPauseTime = 0;
SharedConfig.saveConfig();
}
}
private void updateCurrentConnectionState(int account) {
if (this.actionBarLayout == null) {
return;
}
String title = null;
int titleId = 0;
Runnable action = null;
int connectionState = ConnectionsManager.getInstance(this.currentAccount).getConnectionState();
this.currentConnectionState = connectionState;
if (connectionState == 2) {
title = "WaitingForNetwork";
titleId = R.string.WaitingForNetwork;
} else if (connectionState == 5) {
title = "Updating";
titleId = R.string.Updating;
} else if (connectionState == 4) {
title = "ConnectingToProxy";
titleId = R.string.ConnectingToProxy;
} else if (connectionState == 1) {
title = "Connecting";
titleId = R.string.Connecting;
}
int i = this.currentConnectionState;
if (i == 1 || i == 4) {
action = new Runnable() {
@Override
public void run() {
BaseFragment lastFragment = null;
if (AndroidUtilities.isTablet()) {
if (!LaunchActivity.layerFragmentsStack.isEmpty()) {
lastFragment = (BaseFragment) LaunchActivity.layerFragmentsStack.get(LaunchActivity.layerFragmentsStack.size() - 1);
}
} else if (!LaunchActivity.mainFragmentsStack.isEmpty()) {
lastFragment = (BaseFragment) LaunchActivity.mainFragmentsStack.get(LaunchActivity.mainFragmentsStack.size() - 1);
}
if ((lastFragment instanceof ProxyListActivity) || (lastFragment instanceof ProxySettingsActivity)) {
}
}
};
}
this.actionBarLayout.setTitleOverlayText(title, titleId, action);
}
public void hideVisibleActionMode() {
ActionMode actionMode = this.visibleActionMode;
if (actionMode == null) {
return;
}
actionMode.finish();
}
@Override
public void onSaveInstanceState(Bundle outState) {
try {
super.onSaveInstanceState(outState);
BaseFragment lastFragment = null;
if (AndroidUtilities.isTablet()) {
if (!this.layersActionBarLayout.fragmentsStack.isEmpty()) {
lastFragment = this.layersActionBarLayout.fragmentsStack.get(this.layersActionBarLayout.fragmentsStack.size() - 1);
} else if (!this.rightActionBarLayout.fragmentsStack.isEmpty()) {
lastFragment = this.rightActionBarLayout.fragmentsStack.get(this.rightActionBarLayout.fragmentsStack.size() - 1);
} else if (!this.actionBarLayout.fragmentsStack.isEmpty()) {
lastFragment = this.actionBarLayout.fragmentsStack.get(this.actionBarLayout.fragmentsStack.size() - 1);
}
} else if (!this.actionBarLayout.fragmentsStack.isEmpty()) {
lastFragment = this.actionBarLayout.fragmentsStack.get(this.actionBarLayout.fragmentsStack.size() - 1);
}
if (lastFragment != null) {
Bundle args = lastFragment.getArguments();
if ((lastFragment instanceof ChatActivity) && args != null) {
outState.putBundle("args", args);
outState.putString("fragment", "chat");
} else if (lastFragment instanceof SettingsActivity) {
outState.putString("fragment", "settings");
} else if ((lastFragment instanceof GroupCreateFinalActivity) && args != null) {
outState.putBundle("args", args);
outState.putString("fragment", "group");
} else if (lastFragment instanceof WallpapersListActivity) {
outState.putString("fragment", "wallpapers");
} else if ((lastFragment instanceof ProfileActivity) && ((ProfileActivity) lastFragment).isChat() && args != null) {
outState.putBundle("args", args);
outState.putString("fragment", "chat_profile");
} else if ((lastFragment instanceof ChannelCreateActivity) && args != null && args.getInt("step") == 0) {
outState.putBundle("args", args);
outState.putString("fragment", "channel");
}
lastFragment.saveSelfArgs(outState);
}
} catch (Exception e) {
FileLog.e(e);
}
}
@Override
public void onBackPressed() {
if (this.passcodeView.getVisibility() == 0) {
finish();
} else if (SecretMediaViewer.hasInstance() && SecretMediaViewer.getInstance().isVisible()) {
SecretMediaViewer.getInstance().closePhoto(true, false);
} else if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) {
PhotoViewer.getInstance().closePhoto(true, false);
} else if (ArticleViewer.hasInstance() && ArticleViewer.getInstance().isVisible()) {
ArticleViewer.getInstance().close(true, false);
} else if (this.drawerLayoutContainer.isDrawerOpened()) {
this.drawerLayoutContainer.closeDrawer(false);
} else if (AndroidUtilities.isTablet()) {
if (this.layersActionBarLayout.getVisibility() == 0) {
this.layersActionBarLayout.onBackPressed();
return;
}
boolean cancel = false;
if (this.rightActionBarLayout.getVisibility() == 0 && !this.rightActionBarLayout.fragmentsStack.isEmpty()) {
BaseFragment lastFragment = this.rightActionBarLayout.fragmentsStack.get(this.rightActionBarLayout.fragmentsStack.size() - 1);
cancel = true ^ lastFragment.onBackPressed();
}
if (!cancel) {
this.actionBarLayout.onBackPressed();
}
} else {
this.actionBarLayout.onBackPressed();
}
}
@Override
public void onLowMemory() {
super.onLowMemory();
this.actionBarLayout.onLowMemory();
if (AndroidUtilities.isTablet()) {
this.rightActionBarLayout.onLowMemory();
this.layersActionBarLayout.onLowMemory();
}
}
@Override
public void onActionModeStarted(ActionMode mode) {
super.onActionModeStarted(mode);
this.visibleActionMode = mode;
try {
Menu menu = mode.getMenu();
if (menu != null) {
boolean extended = this.actionBarLayout.extendActionMode(menu);
if (!extended && AndroidUtilities.isTablet()) {
boolean extended2 = this.rightActionBarLayout.extendActionMode(menu);
if (!extended2) {
this.layersActionBarLayout.extendActionMode(menu);
}
}
}
} catch (Exception e) {
FileLog.e(e);
}
if (Build.VERSION.SDK_INT >= 23 && mode.getType() == 1) {
return;
}
this.actionBarLayout.onActionModeStarted(mode);
if (AndroidUtilities.isTablet()) {
this.rightActionBarLayout.onActionModeStarted(mode);
this.layersActionBarLayout.onActionModeStarted(mode);
}
}
@Override
public void onActionModeFinished(ActionMode mode) {
super.onActionModeFinished(mode);
if (this.visibleActionMode == mode) {
this.visibleActionMode = null;
}
if (Build.VERSION.SDK_INT >= 23 && mode.getType() == 1) {
return;
}
this.actionBarLayout.onActionModeFinished(mode);
if (AndroidUtilities.isTablet()) {
this.rightActionBarLayout.onActionModeFinished(mode);
this.layersActionBarLayout.onActionModeFinished(mode);
}
}
@Override
public boolean onPreIme() {
if (SecretMediaViewer.hasInstance() && SecretMediaViewer.getInstance().isVisible()) {
SecretMediaViewer.getInstance().closePhoto(true, false);
return true;
} else if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) {
PhotoViewer.getInstance().closePhoto(true, false);
return true;
} else if (ArticleViewer.hasInstance() && ArticleViewer.getInstance().isVisible()) {
ArticleViewer.getInstance().close(true, false);
return true;
} else {
return false;
}
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
event.getKeyCode();
if (!mainFragmentsStack.isEmpty() && ((!PhotoViewer.hasInstance() || !PhotoViewer.getInstance().isVisible()) && event.getRepeatCount() == 0 && event.getAction() == 0 && (event.getKeyCode() == 24 || event.getKeyCode() == 25))) {
ArrayList<BaseFragment> arrayList = mainFragmentsStack;
BaseFragment fragment = arrayList.get(arrayList.size() - 1);
if ((fragment instanceof ChatActivity) && ((ChatActivity) fragment).maybePlayVisibleVideo()) {
return true;
}
if (AndroidUtilities.isTablet() && !rightFragmentsStack.isEmpty()) {
ArrayList<BaseFragment> arrayList2 = rightFragmentsStack;
BaseFragment fragment2 = arrayList2.get(arrayList2.size() - 1);
if ((fragment2 instanceof ChatActivity) && ((ChatActivity) fragment2).maybePlayVisibleVideo()) {
return true;
}
}
}
return super.dispatchKeyEvent(event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == 82 && !SharedConfig.isWaitingForPasscodeEnter) {
if (PhotoViewer.hasInstance() && PhotoViewer.getInstance().isVisible()) {
return super.onKeyUp(keyCode, event);
}
if (ArticleViewer.hasInstance() && ArticleViewer.getInstance().isVisible()) {
return super.onKeyUp(keyCode, event);
}
if (AndroidUtilities.isTablet()) {
if (this.layersActionBarLayout.getVisibility() == 0 && !this.layersActionBarLayout.fragmentsStack.isEmpty()) {
this.layersActionBarLayout.onKeyUp(keyCode, event);
} else if (this.rightActionBarLayout.getVisibility() == 0 && !this.rightActionBarLayout.fragmentsStack.isEmpty()) {
this.rightActionBarLayout.onKeyUp(keyCode, event);
} else {
this.actionBarLayout.onKeyUp(keyCode, event);
}
} else if (this.actionBarLayout.fragmentsStack.size() == 1) {
if (this.drawerLayoutContainer.isDrawerOpened()) {
this.drawerLayoutContainer.closeDrawer(false);
} else {
if (getCurrentFocus() != null) {
AndroidUtilities.hideKeyboard(getCurrentFocus());
}
this.drawerLayoutContainer.openDrawer(false);
}
} else {
this.actionBarLayout.onKeyUp(keyCode, event);
}
}
if (keyCode == 4 && event.getAction() == 1 && ApplicationLoader.mbytLiving == 1 && this.actionBarLayout.fragmentsStack.size() == 1 && (this.actionBarLayout.fragmentsStack.get(0) instanceof IndexActivity)) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage("您正在直播中,确定要退出吗?");
builder.setNegativeButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
LaunchActivity.this.lambda$onKeyUp$64$LaunchActivity(dialogInterface, i);
}
});
builder.setPositiveButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showAlertDialog(builder);
return true;
}
return super.onKeyUp(keyCode, event);
}
public void lambda$onKeyUp$64$LaunchActivity(DialogInterface dialog, int which) {
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.livefinishnotify, new Object[0]);
AndroidUtilities.runOnUIThread(new Runnable() {
@Override
public final void run() {
LaunchActivity.this.finish();
}
}, 1000L);
}
@Override
public boolean needPresentFragment(BaseFragment fragment, boolean removeLast, boolean forceWithoutAnimation, ActionBarLayout layout) {
ActionBarLayout actionBarLayout;
ActionBarLayout actionBarLayout2;
ActionBarLayout actionBarLayout3;
if (ArticleViewer.hasInstance() && ArticleViewer.getInstance().isVisible()) {
ArticleViewer.getInstance().close(false, true);
}
if (AndroidUtilities.isTablet()) {
this.drawerLayoutContainer.setAllowOpenDrawer(false, true);
if (fragment instanceof IndexActivity) {
IndexActivity indexActivity = (IndexActivity) fragment;
ActionBarLayout actionBarLayout4 = this.actionBarLayout;
if (layout != actionBarLayout4) {
actionBarLayout4.removeAllFragments();
this.actionBarLayout.presentFragment(fragment, removeLast, forceWithoutAnimation, false, false);
this.layersActionBarLayout.removeAllFragments();
this.layersActionBarLayout.setVisibility(8);
this.drawerLayoutContainer.setAllowOpenDrawer(false, false);
if (!this.tabletFullSize) {
this.shadowTabletSide.setVisibility(0);
if (this.rightActionBarLayout.fragmentsStack.isEmpty()) {
this.backgroundTablet.setVisibility(0);
}
}
return false;
}
}
if ((fragment instanceof ChatActivity) && !((ChatActivity) fragment).isInScheduleMode()) {
if ((!this.tabletFullSize && layout == this.rightActionBarLayout) || (this.tabletFullSize && layout == this.actionBarLayout)) {
boolean result = (this.tabletFullSize && layout == (actionBarLayout3 = this.actionBarLayout) && actionBarLayout3.fragmentsStack.size() == 1) ? false : true;
if (!this.layersActionBarLayout.fragmentsStack.isEmpty()) {
for (int a = 0; a < this.layersActionBarLayout.fragmentsStack.size() - 1; a = (a - 1) + 1) {
ActionBarLayout actionBarLayout5 = this.layersActionBarLayout;
actionBarLayout5.removeFragmentFromStack(actionBarLayout5.fragmentsStack.get(0));
}
this.layersActionBarLayout.closeLastFragment(!forceWithoutAnimation);
}
if (!result) {
this.actionBarLayout.presentFragment(fragment, false, forceWithoutAnimation, false, false);
}
return result;
}
if (!this.tabletFullSize && layout != (actionBarLayout2 = this.rightActionBarLayout)) {
actionBarLayout2.setVisibility(0);
this.backgroundTablet.setVisibility(8);
this.rightActionBarLayout.removeAllFragments();
this.rightActionBarLayout.presentFragment(fragment, removeLast, true, false, false);
if (!this.layersActionBarLayout.fragmentsStack.isEmpty()) {
for (int a2 = 0; a2 < this.layersActionBarLayout.fragmentsStack.size() - 1; a2 = (a2 - 1) + 1) {
ActionBarLayout actionBarLayout6 = this.layersActionBarLayout;
actionBarLayout6.removeFragmentFromStack(actionBarLayout6.fragmentsStack.get(0));
}
this.layersActionBarLayout.closeLastFragment(!forceWithoutAnimation);
}
return false;
} else if (this.tabletFullSize && layout != (actionBarLayout = this.actionBarLayout)) {
actionBarLayout.presentFragment(fragment, actionBarLayout.fragmentsStack.size() > 1, forceWithoutAnimation, false, false);
if (!this.layersActionBarLayout.fragmentsStack.isEmpty()) {
for (int a3 = 0; a3 < this.layersActionBarLayout.fragmentsStack.size() - 1; a3 = (a3 - 1) + 1) {
ActionBarLayout actionBarLayout7 = this.layersActionBarLayout;
actionBarLayout7.removeFragmentFromStack(actionBarLayout7.fragmentsStack.get(0));
}
this.layersActionBarLayout.closeLastFragment(!forceWithoutAnimation);
}
return false;
} else {
if (!this.layersActionBarLayout.fragmentsStack.isEmpty()) {
for (int a4 = 0; a4 < this.layersActionBarLayout.fragmentsStack.size() - 1; a4 = (a4 - 1) + 1) {
ActionBarLayout actionBarLayout8 = this.layersActionBarLayout;
actionBarLayout8.removeFragmentFromStack(actionBarLayout8.fragmentsStack.get(0));
}
this.layersActionBarLayout.closeLastFragment(!forceWithoutAnimation);
}
ActionBarLayout actionBarLayout9 = this.actionBarLayout;
actionBarLayout9.presentFragment(fragment, actionBarLayout9.fragmentsStack.size() > 1, forceWithoutAnimation, false, false);
return false;
}
}
ActionBarLayout actionBarLayout10 = this.layersActionBarLayout;
if (layout != actionBarLayout10) {
actionBarLayout10.setVisibility(0);
this.drawerLayoutContainer.setAllowOpenDrawer(false, true);
if (fragment instanceof LoginContronllerActivity) {
this.backgroundTablet.setVisibility(0);
this.shadowTabletSide.setVisibility(8);
this.shadowTablet.setBackgroundColor(0);
} else {
this.shadowTablet.setBackgroundColor(Theme.ACTION_BAR_PHOTO_VIEWER_COLOR);
}
this.layersActionBarLayout.presentFragment(fragment, removeLast, forceWithoutAnimation, false, false);
return false;
}
return true;
}
if (fragment instanceof LoginContronllerActivity) {
if (mainFragmentsStack.size() == 0) {
}
} else if ((fragment instanceof CountrySelectActivity) && mainFragmentsStack.size() == 1) {
}
this.drawerLayoutContainer.setAllowOpenDrawer(false, false);
return true;
}
@Override
public boolean needAddFragmentToStack(BaseFragment fragment, ActionBarLayout layout) {
ActionBarLayout actionBarLayout;
ActionBarLayout actionBarLayout2;
if (AndroidUtilities.isTablet()) {
this.drawerLayoutContainer.setAllowOpenDrawer(false, true);
if (fragment instanceof IndexActivity) {
IndexActivity indexActivity = (IndexActivity) fragment;
ActionBarLayout actionBarLayout3 = this.actionBarLayout;
if (layout != actionBarLayout3) {
actionBarLayout3.removeAllFragments();
this.actionBarLayout.addFragmentToStack(fragment);
this.layersActionBarLayout.removeAllFragments();
this.layersActionBarLayout.setVisibility(8);
this.drawerLayoutContainer.setAllowOpenDrawer(false, false);
if (!this.tabletFullSize) {
this.shadowTabletSide.setVisibility(0);
if (this.rightActionBarLayout.fragmentsStack.isEmpty()) {
this.backgroundTablet.setVisibility(0);
}
}
return false;
}
} else if ((fragment instanceof ChatActivity) && !((ChatActivity) fragment).isInScheduleMode()) {
if (!this.tabletFullSize && layout != (actionBarLayout2 = this.rightActionBarLayout)) {
actionBarLayout2.setVisibility(0);
this.backgroundTablet.setVisibility(8);
this.rightActionBarLayout.removeAllFragments();
this.rightActionBarLayout.addFragmentToStack(fragment);
if (!this.layersActionBarLayout.fragmentsStack.isEmpty()) {
for (int a = 0; a < this.layersActionBarLayout.fragmentsStack.size() - 1; a = (a - 1) + 1) {
ActionBarLayout actionBarLayout4 = this.layersActionBarLayout;
actionBarLayout4.removeFragmentFromStack(actionBarLayout4.fragmentsStack.get(0));
}
this.layersActionBarLayout.closeLastFragment(true);
}
return false;
} else if (this.tabletFullSize && layout != (actionBarLayout = this.actionBarLayout)) {
actionBarLayout.addFragmentToStack(fragment);
if (!this.layersActionBarLayout.fragmentsStack.isEmpty()) {
for (int a2 = 0; a2 < this.layersActionBarLayout.fragmentsStack.size() - 1; a2 = (a2 - 1) + 1) {
ActionBarLayout actionBarLayout5 = this.layersActionBarLayout;
actionBarLayout5.removeFragmentFromStack(actionBarLayout5.fragmentsStack.get(0));
}
this.layersActionBarLayout.closeLastFragment(true);
}
return false;
}
} else {
ActionBarLayout actionBarLayout6 = this.layersActionBarLayout;
if (layout != actionBarLayout6) {
actionBarLayout6.setVisibility(0);
this.drawerLayoutContainer.setAllowOpenDrawer(false, true);
if (fragment instanceof LoginContronllerActivity) {
this.backgroundTablet.setVisibility(0);
this.shadowTabletSide.setVisibility(8);
this.shadowTablet.setBackgroundColor(0);
} else {
this.shadowTablet.setBackgroundColor(Theme.ACTION_BAR_PHOTO_VIEWER_COLOR);
}
this.layersActionBarLayout.addFragmentToStack(fragment);
return false;
}
}
return true;
}
if (fragment instanceof LoginContronllerActivity) {
if (mainFragmentsStack.size() == 0) {
}
} else if ((fragment instanceof CountrySelectActivity) && mainFragmentsStack.size() == 1) {
}
this.drawerLayoutContainer.setAllowOpenDrawer(false, false);
return true;
}
@Override
public boolean needCloseLastFragment(ActionBarLayout layout) {
if (AndroidUtilities.isTablet()) {
if (layout == this.actionBarLayout && layout.fragmentsStack.size() <= 1) {
onFinish();
finish();
return false;
} else if (layout == this.rightActionBarLayout) {
if (!this.tabletFullSize) {
this.backgroundTablet.setVisibility(0);
}
} else if (layout == this.layersActionBarLayout && this.actionBarLayout.fragmentsStack.isEmpty() && this.layersActionBarLayout.fragmentsStack.size() == 1) {
onFinish();
finish();
return false;
}
} else if (layout.fragmentsStack.size() <= 1) {
onFinish();
finish();
return false;
} else if (layout.fragmentsStack.size() >= 2 && !(layout.fragmentsStack.get(0) instanceof LoginContronllerActivity)) {
this.drawerLayoutContainer.setAllowOpenDrawer(false, false);
}
return true;
}
public void rebuildAllFragments(boolean last) {
ActionBarLayout actionBarLayout = this.layersActionBarLayout;
if (actionBarLayout != null) {
actionBarLayout.rebuildAllFragmentViews(last, last);
} else {
this.actionBarLayout.rebuildAllFragmentViews(last, last);
}
}
@Override
public void onRebuildAllFragments(ActionBarLayout layout, boolean last) {
if (AndroidUtilities.isTablet() && layout == this.layersActionBarLayout) {
this.rightActionBarLayout.rebuildAllFragmentViews(last, last);
this.actionBarLayout.rebuildAllFragmentViews(last, last);
}
this.drawerLayoutAdapter.notifyDataSetChanged();
}
private void createGamePlayingFloatingView() {
if (this.drawerLayoutContainer == null) {
return;
}
DiscoveryJumpPausedFloatingView.getInstance().setContext(this).setRootViewContainer(this.drawerLayoutContainer).setActionBarLayout(this.actionBarLayout).show(true);
}
}