package im.actor.messenger.app.activity;

import android.content.Intent;
import android.os.Bundle;

import net.hockeyapp.android.UpdateManager;

import im.actor.messenger.app.core.Core;
import im.actor.messenger.app.activity.base.ControllerActivity;
import im.actor.messenger.app.activity.controllers.MainBaseController;
import im.actor.messenger.app.activity.controllers.MainPhoneController;
import im.actor.messenger.app.fragment.tour.TourActivity;
import im.actor.core.AuthState;
import im.actor.core.entity.Dialog;

import static im.actor.messenger.app.core.Core.messenger;

public class MainActivity extends ControllerActivity<MainBaseController> {

    @Override
    public MainBaseController onCreateController() {
        return new MainPhoneController(this);
    }

    @Override
    public void onCreate(Bundle savedInstance) {

        super.onCreate(savedInstance);


        checkForUpdates();

        if (messenger().getAuthState() != AuthState.LOGGED_IN) {
            startActivity(new Intent(this, TourActivity.class));
            finish();
            return;
        }

        // getWindow().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.bg_main)));
        getWindow().setBackgroundDrawable(null);
    }

    @Override
    protected void onResume() {
        super.onResume();
        messenger().trackMainScreensOpen();
    }

    @Override
    protected void onPause() {
        super.onPause();
        messenger().trackMainScreensClosed();
    }

    public void onDialogClicked(Dialog item) {
        getController().onItemClicked(item);
    }

    private void checkForUpdates() {
        if (Core.core().getHockeyToken() != null) {
            UpdateManager.register(this, Core.core().getHockeyToken());
        }
    }
}

@@ -97,52 +97,8 @@
 e;%0A%0A
-import net.hockeyapp.android.UpdateManager;%0A
 %0Aimp
@@ -833,36 +833,8 @@
 ;%0A%0A%0A
-        checkForUpdates();%0A%0A
     
@@ -1524,183 +1524,7 @@
  %7D%0A%0A
-    private void checkForUpdates() %7B%0A        if (Core.core().getHockeyToken() != null) %7B%0A            UpdateManager.register(this, Core.core().getHockeyToken());%0A        %7D%0A    %7D
 %0A%7D%0A

remove Hockey