diff --git a/MediaServiceCore b/MediaServiceCore index 77f96011a..058c32b88 160000 --- a/MediaServiceCore +++ b/MediaServiceCore @@ -1 +1 @@ -Subproject commit 77f96011a2636d9a78e58b76f1c2b187c3be6c95 +Subproject commit 058c32b887ee7a201e70a4ff6e0634c52d959601 diff --git a/common/build.gradle b/common/build.gradle index ded16c9ad..2fcb228d6 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -58,6 +58,7 @@ dependencies { implementation project(':fragment-1.1.0') implementation project(':mediaserviceinterfaces') implementation project(':youtubeapi') + implementation project(':googleapi') implementation 'io.reactivex.rxjava2:rxandroid:' + rxAndroidVersion implementation 'io.reactivex.rxjava2:rxjava:' + rxJavaVersion diff --git a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/misc/GDriveBackupManager.java b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/misc/GDriveBackupManager.java new file mode 100644 index 000000000..7b7f916bd --- /dev/null +++ b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/misc/GDriveBackupManager.java @@ -0,0 +1,52 @@ +package com.liskovsoft.smartyoutubetv2.common.misc; + +import android.content.Context; + +import com.liskovsoft.googleapi.service.GDriveService; +import com.liskovsoft.googleapi.service.GoogleSignInService; + +public class GDriveBackupManager { + private final Context mContext; + private final String mBackupFolder; + private final GoogleSignInService mSignInService; + private final GDriveService mDriveService; + + public GDriveBackupManager(Context context) { + mContext = context; + mBackupFolder = String.format("SmartTubeBackup/%s", context.getPackageName()); + mSignInService = GoogleSignInService.instance(); + mDriveService = GDriveService.instance(); + } + + public void backup() { + if (mSignInService.isSigned()) { + startBackup(); + } else { + logIn(this::startBackup); + } + } + + public void restore() { + if (mSignInService.isSigned()) { + startRestore(); + } else { + logIn(this::startRestore); + } + } + + public boolean hasBackup() { + return false; + } + + private void startBackup() { + + } + + private void startRestore() { + + } + + private void logIn(Runnable onDone) { + + } +}