Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Drive Integration #867

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.org
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Orgzly is an outliner for taking notes and managing to-do lists.

You can keep notebooks stored in plain-text and have them synchronized
with a directory on your mobile device, SD card, WebDAV server or Dropbox.
with a directory on your mobile device, SD card, WebDAV server, Dropbox or Google Drive.

Notebooks are saved in /Org mode/'s file format. “Org mode is for
keeping notes, maintaining TODO lists, planning projects, and
Expand Down
23 changes: 21 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,22 @@ android {
premium {
buildConfigField "boolean", "IS_DROPBOX_ENABLED", "true"

buildConfigField "boolean", "IS_GOOGLE_DRIVE_ENABLED", "true"

buildConfigField "String", "VERSION_NAME_SUFFIX", '""'

dimension "store"
}

fdroid {
/*
* Disable Dropbox.
* Disable Dropbox and Google Drive.
* Properties file which contains the required API key is not included with the code.
*/
buildConfigField "boolean", "IS_DROPBOX_ENABLED", "false"

buildConfigField "boolean", "IS_GOOGLE_DRIVE_ENABLED", "false"

buildConfigField "String", "VERSION_NAME_SUFFIX", '" (fdroid)"'

dimension "store"
Expand All @@ -88,7 +92,6 @@ android {
kotlinOptions {
jvmTarget = 11
}

packagingOptions {
resources {
excludes += ['META-INF/DEPENDENCIES', 'plugin.properties']
Expand All @@ -99,6 +102,10 @@ android {
checkDependencies true
disable 'MissingTranslation', 'MissingQuantity', 'ImpliedQuantity', 'InvalidPackage'
}
lint {
disable 'MissingTranslation', 'MissingQuantity', 'ImpliedQuantity', 'InvalidPackage'
}

}

dependencies {
Expand Down Expand Up @@ -164,6 +171,18 @@ dependencies {

implementation "com.dropbox.core:dropbox-core-sdk:$versions.dropbox_core_sdk"

// Google Drive
implementation 'com.google.android.gms:play-services-auth:19.0.0'
implementation 'com.google.http-client:google-http-client-gson:1.26.0'
implementation('com.google.api-client:google-api-client-android:1.26.0') {
exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.apis:google-api-services-drive:v3-rev136-1.25.0') {
exclude group: 'org.apache.httpcomponents'
}
// just to avoid duplicate class build error
implementation 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'

implementation "com.googlecode.juniversalchardet:juniversalchardet:$versions.juniversalchardet"

implementation "joda-time:joda-time:$versions.joda_time"
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@
android:windowSoftInputMode="stateAlwaysHidden">
</activity>

<activity
android:name=".android.ui.repo.googledrive.GoogleDriveRepoActivity"
android:windowSoftInputMode="stateAlwaysHidden">
</activity>

<activity
android:name="com.dropbox.core.android.AuthActivity"
android:exported="true"
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/com/orgzly/android/db/OrgzlyDatabase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -486,9 +486,10 @@ abstract class OrgzlyDatabase : RoomDatabase() {
types[id] = when {
url.startsWith("mock") -> 1
url.startsWith("dropbox") -> 2
url.startsWith("file") -> 3
url.startsWith("content") -> 4
url.matches("^(webdav|dav|http)s?.*".toRegex()) -> 5
url.startsWith("google") -> 3
url.startsWith("file") -> 4
url.startsWith("content") -> 5
url.matches("^(webdav|dav|http)s?.*".toRegex()) -> 6
else -> throw IllegalArgumentException("Unknown repo $url")
}

Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/com/orgzly/android/di/AppComponent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import com.orgzly.android.ui.refile.RefileFragment
import com.orgzly.android.ui.repo.BrowserActivity
import com.orgzly.android.ui.repo.directory.DirectoryRepoActivity
import com.orgzly.android.ui.repo.dropbox.DropboxRepoActivity
import com.orgzly.android.ui.repo.googledrive.GoogleDriveRepoActivity
import com.orgzly.android.ui.repo.git.GitRepoActivity
import com.orgzly.android.ui.repo.webdav.WebdavRepoActivity
import com.orgzly.android.ui.repos.ReposActivity
Expand Down Expand Up @@ -51,6 +52,7 @@ interface AppComponent {
fun inject(arg: MainActivity)
fun inject(arg: ReposActivity)
fun inject(arg: DropboxRepoActivity)
fun inject(arg: GoogleDriveRepoActivity)
fun inject(arg: DirectoryRepoActivity)
fun inject(arg: WebdavRepoActivity)
fun inject(arg: GitRepoActivity)
Expand Down Expand Up @@ -84,4 +86,4 @@ interface AppComponent {
fun inject(arg: TimeChangeBroadcastReceiver)
fun inject(arg: RemindersBroadcastReceiver)
fun inject(arg: SharingShortcutsManager)
}
}
Loading