Skip to content

Commit

Permalink
Revert onMessageEvent functions
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 committed Nov 10, 2023
1 parent 9c5e45a commit ae72d9b
Showing 1 changed file with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
import com.owncloud.android.ui.dialog.SortingOrderDialogFragment;
import com.owncloud.android.ui.dialog.StoragePermissionDialogFragment;
import com.owncloud.android.ui.events.SearchEvent;
import com.owncloud.android.ui.events.SyncEventFinished;
import com.owncloud.android.ui.events.TokenPushEvent;
import com.owncloud.android.ui.fragment.FileDetailFragment;
import com.owncloud.android.ui.fragment.FileFragment;
Expand All @@ -131,10 +132,13 @@
import com.owncloud.android.utils.FileSortOrder;
import com.owncloud.android.utils.MimeTypeUtil;
import com.owncloud.android.utils.PermissionUtil;
import com.owncloud.android.utils.PushUtils;
import com.owncloud.android.utils.StringUtils;
import com.owncloud.android.utils.theme.CapabilityUtils;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.io.File;
import java.util.ArrayList;
Expand Down Expand Up @@ -2292,6 +2296,45 @@ public void showFiles(boolean onDeviceOnly) {
}
}

@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onMessageEvent(final SearchEvent event) {
if (SearchRemoteOperation.SearchType.PHOTO_SEARCH == event.getSearchType()) {
Log_OC.d(this, "Switch to photo search fragment");
setLeftFragment(new GalleryFragment());
} else if (event.getSearchType() == SearchRemoteOperation.SearchType.SHARED_FILTER) {
Log_OC.d(this, "Switch to Shared fragment");
setLeftFragment(new SharedListFragment());
}
}

// Do not delete these functions
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageEvent(SyncEventFinished event) {
Bundle bundle = event.getIntent().getExtras();
if (event.getIntent().getBooleanExtra(TEXT_PREVIEW, false)) {
startTextPreview((OCFile) bundle.get(EXTRA_FILE), true);
} else if (bundle.containsKey(PreviewMediaFragment.EXTRA_START_POSITION)) {
startMediaPreview((OCFile) bundle.get(EXTRA_FILE),
(long) bundle.get(PreviewMediaFragment.EXTRA_START_POSITION),
(boolean) bundle.get(PreviewMediaFragment.EXTRA_AUTOPLAY), true, true);
} else if (bundle.containsKey(PreviewImageActivity.EXTRA_VIRTUAL_TYPE)) {
startImagePreview((OCFile) bundle.get(EXTRA_FILE),
(VirtualFolderType) bundle.get(PreviewImageActivity.EXTRA_VIRTUAL_TYPE),
true);
} else {
startImagePreview((OCFile) bundle.get(EXTRA_FILE), true);
}
}

@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onMessageEvent(TokenPushEvent event) {
if (!preferences.isKeysReInitEnabled()) {
PushUtils.reinitKeys(getUserAccountManager());
} else {
PushUtils.pushRegistrationToServer(getUserAccountManager(), preferences.getPushToken());
}
}

@Override
public void onStart() {
super.onStart();
Expand Down

0 comments on commit ae72d9b

Please sign in to comment.