소스 검색

Fix #184

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 7 년 전
부모
커밋
5b93317440

+ 5 - 9
app/src/main/java/com/nextcloud/talk/activities/MainActivity.java

@@ -53,7 +53,6 @@ import org.greenrobot.eventbus.ThreadMode;
 import java.security.cert.CertificateParsingException;
 import java.security.cert.X509Certificate;
 import java.text.DateFormat;
-import java.util.ArrayList;
 import java.util.List;
 
 import javax.inject.Inject;
@@ -109,6 +108,11 @@ public final class MainActivity extends AppCompatActivity implements ActionBarPr
         }
 
         if (getIntent().hasExtra(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)) {
+            if (!router.hasRootController()) {
+                router.setRoot(RouterTransaction.with(new MagicBottomNavigationController())
+                        .pushChangeHandler(new HorizontalChangeHandler())
+                        .popChangeHandler(new HorizontalChangeHandler()));
+            }
             onNewIntent(getIntent());
         } else if (!router.hasRootController()) {
             if (hasDb) {
@@ -136,14 +140,6 @@ public final class MainActivity extends AppCompatActivity implements ActionBarPr
         super.onNewIntent(intent);
 
         if (intent.hasExtra(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL)) {
-            List<RouterTransaction> newBackstack = new ArrayList<>();
-
-            newBackstack.add(RouterTransaction.with(new MagicBottomNavigationController())
-                    .pushChangeHandler(new HorizontalChangeHandler())
-                    .popChangeHandler(new HorizontalChangeHandler()));
-
-            router.setBackstack(newBackstack, new HorizontalChangeHandler());
-
             router.pushController(RouterTransaction.with(new ChatController(intent.getExtras()))
                     .pushChangeHandler(new HorizontalChangeHandler())
                     .popChangeHandler(new HorizontalChangeHandler()));

+ 1 - 10
app/src/main/java/com/nextcloud/talk/controllers/ChatController.java

@@ -48,9 +48,6 @@ import android.widget.AbsListView;
 import android.widget.ImageView;
 
 import com.amulyakhare.textdrawable.TextDrawable;
-import com.bluelinelabs.conductor.RouterTransaction;
-import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler;
-import com.bluelinelabs.conductor.changehandler.VerticalChangeHandler;
 import com.bumptech.glide.load.DataSource;
 import com.bumptech.glide.load.engine.DiskCacheStrategy;
 import com.bumptech.glide.load.engine.GlideException;
@@ -494,13 +491,7 @@ public class ChatController extends BaseController implements MessagesListAdapte
 
                     @Override
                     public void onNext(GenericOverall genericOverall) {
-                        if (getRouter().hasRootController()) {
-                            getRouter().popToRoot(new VerticalChangeHandler());
-                        } else {
-                            getRouter().setRoot(RouterTransaction.with(new MagicBottomNavigationController())
-                                    .pushChangeHandler(new HorizontalChangeHandler())
-                                    .popChangeHandler(new HorizontalChangeHandler()));
-                        }
+                        getRouter().popToRoot();
                     }
 
                     @Override

+ 0 - 2
app/src/main/java/com/nextcloud/talk/jobs/NotificationJob.java

@@ -125,10 +125,8 @@ public class NotificationJob extends Job {
 
                             if (hasChatSupport) {
                                 intent = new Intent(context, MainActivity.class);
-                                intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
                             } else {
                                 intent = new Intent(context, CallActivity.class);
-                                bundle.putBoolean(BundleKeys.KEY_FROM_NOTIFICATION_START_CALL, true);
                             }
 
                             bundle.putString(BundleKeys.KEY_ROOM_ID, decryptedPushMessage.getId());