Commit 0040eb30 authored by Tiago Cunha's avatar Tiago Cunha

Small "clean up"

parent 127f5fec
...@@ -69,7 +69,6 @@ import chat.rocket.core.interactors.MessageInteractor; ...@@ -69,7 +69,6 @@ import chat.rocket.core.interactors.MessageInteractor;
import chat.rocket.core.interactors.SessionInteractor; import chat.rocket.core.interactors.SessionInteractor;
import chat.rocket.core.models.Message; import chat.rocket.core.models.Message;
import chat.rocket.core.models.Room; import chat.rocket.core.models.Room;
import chat.rocket.core.repositories.UserRepository;
import chat.rocket.persistence.realm.repositories.RealmMessageRepository; import chat.rocket.persistence.realm.repositories.RealmMessageRepository;
import chat.rocket.persistence.realm.repositories.RealmRoomRepository; import chat.rocket.persistence.realm.repositories.RealmRoomRepository;
import chat.rocket.persistence.realm.repositories.RealmServerInfoRepository; import chat.rocket.persistence.realm.repositories.RealmServerInfoRepository;
...@@ -115,6 +114,9 @@ public class RoomFragment extends AbstractChatRoomFragment ...@@ -115,6 +114,9 @@ public class RoomFragment extends AbstractChatRoomFragment
protected RoomContract.Presenter presenter; protected RoomContract.Presenter presenter;
private RealmRoomRepository roomRepository; private RealmRoomRepository roomRepository;
private RealmUserRepository userRepository;
private MethodCallHelper methodCallHelper;
private AbsoluteUrlHelper absoluteUrlHelper;
public RoomFragment() { public RoomFragment() {
} }
...@@ -148,22 +150,24 @@ public class RoomFragment extends AbstractChatRoomFragment ...@@ -148,22 +150,24 @@ public class RoomFragment extends AbstractChatRoomFragment
roomRepository roomRepository
); );
RealmUserRepository userRepository = new RealmUserRepository(hostname); userRepository = new RealmUserRepository(hostname);
AbsoluteUrlHelper absoluteUrlHelper = new AbsoluteUrlHelper( absoluteUrlHelper = new AbsoluteUrlHelper(
hostname, hostname,
new RealmServerInfoRepository(), new RealmServerInfoRepository(),
userRepository, userRepository,
new SessionInteractor(new RealmSessionRepository(hostname)) new SessionInteractor(new RealmSessionRepository(hostname))
); );
methodCallHelper = new MethodCallHelper(getContext(), hostname);
presenter = new RoomPresenter( presenter = new RoomPresenter(
roomId, roomId,
userRepository, userRepository,
messageInteractor, messageInteractor,
roomRepository, roomRepository,
absoluteUrlHelper, absoluteUrlHelper,
new MethodCallHelper(getContext(), hostname), methodCallHelper,
ConnectivityManager.getInstance(getContext()) ConnectivityManager.getInstance(getContext())
); );
...@@ -302,8 +306,8 @@ public class RoomFragment extends AbstractChatRoomFragment ...@@ -302,8 +306,8 @@ public class RoomFragment extends AbstractChatRoomFragment
} }
}, },
Logger::report Logger::report
); )
) );
} }
} }
...@@ -327,12 +331,10 @@ public class RoomFragment extends AbstractChatRoomFragment ...@@ -327,12 +331,10 @@ public class RoomFragment extends AbstractChatRoomFragment
autocompleteManager = autocompleteManager =
new AutocompleteManager((ViewGroup) rootView.findViewById(R.id.message_list_root)); new AutocompleteManager((ViewGroup) rootView.findViewById(R.id.message_list_root));
final MethodCallHelper methodCallHelper = new MethodCallHelper(getContext(), hostname);
autocompleteManager.registerSource( autocompleteManager.registerSource(
new ChannelSource( new ChannelSource(
new AutocompleteChannelInteractor( new AutocompleteChannelInteractor(
new RealmRoomRepository(hostname), roomRepository,
new RealmSpotlightRoomRepository(hostname), new RealmSpotlightRoomRepository(hostname),
new DeafultTempSpotlightRoomCaller(methodCallHelper) new DeafultTempSpotlightRoomCaller(methodCallHelper)
), ),
...@@ -341,15 +343,6 @@ public class RoomFragment extends AbstractChatRoomFragment ...@@ -341,15 +343,6 @@ public class RoomFragment extends AbstractChatRoomFragment
) )
); );
final UserRepository userRepository = new RealmUserRepository(hostname);
final AbsoluteUrlHelper absoluteUrlHelper = new AbsoluteUrlHelper(
hostname,
new RealmServerInfoRepository(),
userRepository,
new SessionInteractor(new RealmSessionRepository(hostname))
);
Disposable disposable = Single.zip( Disposable disposable = Single.zip(
absoluteUrlHelper.getRocketChatAbsoluteUrl(), absoluteUrlHelper.getRocketChatAbsoluteUrl(),
roomRepository.getById(roomId).first(Optional.absent()), roomRepository.getById(roomId).first(Optional.absent()),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment