add inject for SyncedFolderProvider, more to come

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2023-05-08 07:06:46 +02:00 committed by Andy Scherzinger
parent c5a705d58f
commit da2676bd31
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
4 changed files with 14 additions and 12 deletions

View file

@ -58,6 +58,7 @@ import com.owncloud.android.authentication.PassCodeManager;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.SyncedFolderProvider;
import com.owncloud.android.datamodel.UploadsStorageManager;
import com.owncloud.android.ui.activities.data.activities.ActivitiesRepository;
import com.owncloud.android.ui.activities.data.activities.ActivitiesServiceApi;
@ -121,6 +122,13 @@ class AppModule {
return new ArbitraryDataProviderImpl(dao);
}
@Provides
SyncedFolderProvider syncedFolderProvider(ContentResolver contentResolver,
AppPreferences appPreferences,
Clock clock) {
return new SyncedFolderProvider(contentResolver, appPreferences, clock);
}
@Provides
ActivitiesServiceApi activitiesServiceApi(UserAccountManager accountManager) {
return new ActivitiesServiceApiImpl(accountManager);

View file

@ -52,8 +52,10 @@ class ShortcutUtil @Inject constructor(private val mContext: Context) {
* @param file The file/folder to which a pinned shortcut should be added to the home screen.
*/
fun addShortcutToHomescreen(
file: OCFile, viewThemeUtils: ViewThemeUtils,
user: User, syncedFolderProvider: SyncedFolderProvider
file: OCFile,
viewThemeUtils: ViewThemeUtils,
user: User,
syncedFolderProvider: SyncedFolderProvider
) {
if (ShortcutManagerCompat.isRequestPinShortcutSupported(mContext)) {
val intent = Intent(mContext, FileDisplayActivity::class.java)

View file

@ -26,7 +26,6 @@ import android.graphics.Bitmap;
import android.os.Bundle;
import com.nextcloud.client.account.User;
import com.nextcloud.client.core.Clock;
import com.nextcloud.java.util.Optional;
import com.owncloud.android.R;
import com.owncloud.android.databinding.ShareActivityBinding;
@ -59,10 +58,8 @@ public class ShareActivity extends FileActivity {
static final String TAG_SHARE_FRAGMENT = "SHARE_FRAGMENT";
private SyncedFolderProvider syncedFolderProvider;
@Inject
Clock clock;
SyncedFolderProvider syncedFolderProvider;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -71,8 +68,6 @@ public class ShareActivity extends FileActivity {
ShareActivityBinding binding = ShareActivityBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
syncedFolderProvider = new SyncedFolderProvider(getContentResolver(), preferences, clock);
OCFile file = getFile();
Optional<User> optionalUser = getUser();
if (!optionalUser.isPresent()) {

View file

@ -205,8 +205,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
@Inject EditorUtils editorUtils;
@Inject ShortcutUtil shortcutUtil;
@Inject Clock clock;
private SyncedFolderProvider syncedFolderProvider;
@Inject SyncedFolderProvider syncedFolderProvider;
protected FileFragment.ContainerActivity mContainerActivity;
@ -329,8 +328,6 @@ public class OCFileListFragment extends ExtendedListFragment implements
viewThemeUtils.material.themeFAB(mFabMain);
}
syncedFolderProvider = new SyncedFolderProvider(requireActivity().getContentResolver(), preferences, clock);
Log_OC.i(TAG, "onCreateView() end");
return v;
}