More cleanups

Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-01-28 22:53:38 +01:00
parent 924bd7be3a
commit 507f9909fa
8 changed files with 27 additions and 27 deletions

View File

@ -239,8 +239,8 @@ public class CallActivity extends AppCompatActivity {
.setRepeatCount(PulseAnimation.INFINITE)
.setRepeatMode(PulseAnimation.REVERSE);
roomToken = getIntent().getExtras().getString("roomToken", "");
userEntity = Parcels.unwrap(getIntent().getExtras().getParcelable("userEntity"));
roomToken = getIntent().getExtras().getString(BundleKeys.KEY_ROOM_TOKEN, "");
userEntity = Parcels.unwrap(getIntent().getExtras().getParcelable(BundleKeys.KEY_USER_ENTITY));
callSession = getIntent().getExtras().getString(BundleKeys.KEY_CALL_SESSION, "0");
credentials = ApiHelper.getCredentials(userEntity.getUsername(), userEntity.getToken());

View File

@ -319,21 +319,18 @@ public class AccountVerificationController extends BaseController {
} else {
ApplicationWideMessageHolder.getInstance().setMessageType(
ApplicationWideMessageHolder.MessageType.FAILED_TO_IMPORT_ACCOUNT);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (getRouter().hasRootController()) {
getRouter().popToRoot();
new Handler().postDelayed(() -> {
if (getRouter().hasRootController()) {
getRouter().popToRoot();
} else {
if (userUtils.anyUserExists()) {
getRouter().setRoot(RouterTransaction.with(new MagicBottomNavigationController())
.pushChangeHandler(new HorizontalChangeHandler())
.popChangeHandler(new HorizontalChangeHandler()));
} else {
if (userUtils.anyUserExists()) {
getRouter().setRoot(RouterTransaction.with(new MagicBottomNavigationController())
.pushChangeHandler(new HorizontalChangeHandler())
.popChangeHandler(new HorizontalChangeHandler()));
} else {
getRouter().setRoot(RouterTransaction.with(new ServerSelectionController())
.pushChangeHandler(new HorizontalChangeHandler())
.popChangeHandler(new HorizontalChangeHandler()));
}
getRouter().setRoot(RouterTransaction.with(new ServerSelectionController())
.pushChangeHandler(new HorizontalChangeHandler())
.popChangeHandler(new HorizontalChangeHandler()));
}
}
}, 7500);

View File

@ -442,8 +442,8 @@ public class CallsListController extends BaseController implements SearchView.On
if (callItem != null && getActivity() != null) {
Room room = callItem.getModel();
Bundle bundle = new Bundle();
bundle.putString("roomToken", callItem.getModel().getToken());
bundle.putParcelable("userEntity", Parcels.wrap(userEntity));
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, callItem.getModel().getToken());
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(userEntity));
if (room.hasPassword && (room.participantType.equals(Participant.ParticipantType.GUEST) ||
room.participantType.equals(Participant.ParticipantType.USER_FOLLOWING_LINK))) {

View File

@ -457,8 +457,8 @@ public class ContactsController extends BaseController implements SearchView.OnQ
overridePopHandler(new NoOpControllerChangeHandler());
Intent callIntent = new Intent(getActivity(), CallActivity.class);
Bundle bundle = new Bundle();
bundle.putString("roomToken", roomOverall.getOcs().getData().getToken());
bundle.putParcelable("userEntity", Parcels.wrap(userEntity));
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, roomOverall.getOcs().getData().getToken());
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(userEntity));
callIntent.putExtras(bundle);
startActivity(callIntent);
}

View File

@ -123,7 +123,7 @@ public class EntryMenuController extends BaseController {
eventBus.post(new BottomSheetLockEvent(false, 0, false, false));
bundle = new Bundle();
bundle.putParcelable(BundleKeys.KEY_ROOM, Parcels.wrap(room));
bundle.putParcelable("userEntity", Parcels.wrap(userEntity));
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(userEntity));
bundle.putString(BundleKeys.KEY_CALL_PASSWORD, editText.getText().toString());
getRouter().pushController(RouterTransaction.with(new OperationsMenuController(bundle)));
}

View File

@ -102,8 +102,8 @@ public class OperationsMenuController extends BaseController {
this.room = Parcels.unwrap(args.getParcelable(BundleKeys.KEY_ROOM));
this.callPassword = args.getString(BundleKeys.KEY_CALL_PASSWORD, "");
if (args.containsKey("userEntity")) {
this.userEntity = Parcels.unwrap(args.getParcelable("userEntity"));
if (args.containsKey(BundleKeys.KEY_USER_ENTITY)) {
this.userEntity = Parcels.unwrap(args.getParcelable(BundleKeys.KEY_USER_ENTITY));
}
}
@ -255,8 +255,8 @@ public class OperationsMenuController extends BaseController {
showResultImage(true);
} else {
Bundle bundle = new Bundle();
bundle.putString("roomToken", room.getToken());
bundle.putParcelable("userEntity", Parcels.wrap(userEntity));
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, room.getToken());
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(userEntity));
bundle.putString(BundleKeys.KEY_CALL_SESSION, ((CallOverall) o).getOcs().getData().getSessionId());
overridePushHandler(new NoOpControllerChangeHandler());
overridePopHandler(new NoOpControllerChangeHandler());

View File

@ -45,6 +45,7 @@ import com.nextcloud.talk.api.models.json.push.PushMessage;
import com.nextcloud.talk.models.SignatureVerification;
import com.nextcloud.talk.utils.NotificationUtils;
import com.nextcloud.talk.utils.PushUtils;
import com.nextcloud.talk.utils.bundle.BundleKeys;
import org.parceler.Parcels;
@ -94,8 +95,8 @@ public class MagicFirebaseMessagingService extends FirebaseMessagingService {
Intent intent = new Intent(this, CallActivity.class);
Bundle bundle = new Bundle();
bundle.putString("roomToken", decryptedPushMessage.getId());
bundle.putParcelable("userEntity", Parcels.wrap(signatureVerification
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, decryptedPushMessage.getId());
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(signatureVerification
.getUserEntity()));
bundle.putBoolean("fromNotification", true);
intent.putExtras(bundle);

View File

@ -34,4 +34,6 @@ public class BundleKeys {
public static final String KEY_APP_ITEM_NAME = "KEY_APP_ITEM_NAME";
public static final String KEY_CALL_PASSWORD = "KEY_CALL_PASSWORD";
public static final String KEY_CALL_SESSION = "KEY_CALL_SESSION";
public static final String KEY_ROOM_TOKEN = "KEY_ROOM_TOKEN";
public static final String KEY_USER_ENTITY = "KEY_USER_ENTITY";
}