Skip to content
Merged
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ While there are many things that could be done to further improve this app, the
We would be more than excited if you would like to collaborate with us. We will merge pull requests for new features and fixes. We also would love to welcome co-maintainers.

If there is a strong business case for any development of this app, we will consider your wishes for our roadmap. Please [contact your account manager](https://nextcloud.com/enterprise/) to talk about the possibilities.

## Limitations

This app can not migrate Google photos files due to limitations in the Google Photos API making it too complex for end users.
For more information please visit [the Google Photos Documentation.](https://developers.google.com/photos/support/updates#affected-scopes-methods)
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<id>integration_google</id>
<name>Google integration</name>
<summary>Import Google data into Nextcloud</summary>
<description><![CDATA[Google integration allows you to automatically migrate your Google calendars, contacts, photos and files into Nextcloud.]]></description>
<description><![CDATA[Google integration allows you to automatically migrate your Google calendars, contacts, and files into Nextcloud.]]></description>
<version>4.0.0-dev</version>
<licence>agpl</licence>
<author>Julien Veyssier</author>
Expand Down
3 changes: 0 additions & 3 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@
['name' => 'googleAPI#getDriveSize', 'url' => '/drive-size', 'verb' => 'GET'],
['name' => 'googleAPI#getCalendarList', 'url' => '/calendars', 'verb' => 'GET'],
['name' => 'googleAPI#getContactNumber', 'url' => '/contact-number', 'verb' => 'GET'],
['name' => 'googleAPI#getPhotoNumber', 'url' => '/photo-number', 'verb' => 'GET'],
['name' => 'googleAPI#importCalendar', 'url' => '/import-calendar', 'verb' => 'GET'],
['name' => 'googleAPI#importContacts', 'url' => '/import-contacts', 'verb' => 'GET'],
['name' => 'googleAPI#importPhotos', 'url' => '/import-photos', 'verb' => 'GET'],
['name' => 'googleAPI#getImportPhotosInformation', 'url' => '/import-photos-info', 'verb' => 'GET'],
['name' => 'googleAPI#importDrive', 'url' => '/import-files', 'verb' => 'GET'],
['name' => 'googleAPI#getImportDriveInformation', 'url' => '/import-files-info', 'verb' => 'GET'],
]
Expand Down
39 changes: 0 additions & 39 deletions lib/BackgroundJob/ImportPhotosJob.php

This file was deleted.

2 changes: 0 additions & 2 deletions lib/Controller/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class ConfigController extends Controller {
public const CONTACTS_OTHER_SCOPE = 'https://www.googleapis.com/auth/contacts.other.readonly';
public const CALENDAR_SCOPE = 'https://www.googleapis.com/auth/calendar.readonly';
public const CALENDAR_EVENTS_SCOPE = 'https://www.googleapis.com/auth/calendar.events.readonly';
public const PHOTOS_SCOPE = 'https://www.googleapis.com/auth/photoslibrary.readonly';

public function __construct(
string $appName,
Expand Down Expand Up @@ -179,7 +178,6 @@ public function oauthRedirect(string $code = '', string $state = '', string $sco
'can_access_drive' => in_array(self::DRIVE_SCOPE, $scopes) ? 1 : 0,
'can_access_contacts' => in_array(self::CONTACTS_SCOPE, $scopes) ? 1 : 0,
'can_access_other_contacts' => in_array(self::CONTACTS_OTHER_SCOPE, $scopes) ? 1 : 0,
'can_access_photos' => in_array(self::PHOTOS_SCOPE, $scopes) ? 1 : 0,
'can_access_calendar' => (in_array(self::CALENDAR_SCOPE, $scopes) && in_array(self::CALENDAR_EVENTS_SCOPE, $scopes)) ? 1 : 0,
];

Expand Down
56 changes: 0 additions & 56 deletions lib/Controller/GoogleAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use OCA\Google\Service\GoogleCalendarAPIService;
use OCA\Google\Service\GoogleContactsAPIService;
use OCA\Google\Service\GoogleDriveAPIService;
use OCA\Google\Service\GooglePhotosAPIService;
use OCA\Google\Service\SecretService;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\DataResponse;
Expand All @@ -31,7 +30,6 @@ public function __construct(
string $appName,
IRequest $request,
private IConfig $config,
private GooglePhotosAPIService $googlePhotosAPIService,
private GoogleContactsAPIService $googleContactsAPIService,
private GoogleDriveAPIService $googleDriveAPIService,
private GoogleCalendarAPIService $googleCalendarAPIService,
Expand All @@ -42,22 +40,6 @@ public function __construct(
$this->accessToken = $this->userId !== null ? $this->secretService->getEncryptedUserValue($this->userId, 'token') : '';
}

/**
* @NoAdminRequired
*
* @return DataResponse
*/
public function getImportPhotosInformation(): DataResponse {
if ($this->accessToken === '') {
return new DataResponse([], 400);
}
return new DataResponse([
'importing_photos' => $this->config->getUserValue($this->userId, Application::APP_ID, 'importing_photos') === '1',
'last_import_timestamp' => (int)$this->config->getUserValue($this->userId, Application::APP_ID, 'last_import_timestamp', '0'),
'nb_imported_photos' => (int)$this->config->getUserValue($this->userId, Application::APP_ID, 'nb_imported_photos', '0'),
]);
}

/**
* @NoAdminRequired
*
Expand All @@ -75,25 +57,6 @@ public function getImportDriveInformation(): DataResponse {
]);
}

/**
* @NoAdminRequired
*
* @return DataResponse
*/
public function getPhotoNumber(): DataResponse {
if ($this->accessToken === '' || $this->userId === null) {
return new DataResponse([], 400);
}
/** @var array{error?:string} $result */
$result = $this->googlePhotosAPIService->getPhotoNumber($this->userId);
if (isset($result['error'])) {
$response = new DataResponse($result['error'], 401);
} else {
$response = new DataResponse($result);
}
return $response;
}

/**
* @NoAdminRequired
*
Expand Down Expand Up @@ -151,25 +114,6 @@ public function getDriveSize(): DataResponse {
return $response;
}

/**
* @NoAdminRequired
*
* @return DataResponse
*/
public function importPhotos(): DataResponse {
if ($this->accessToken === '' || $this->userId === null) {
return new DataResponse([], 400);
}
/** @var array{error?:string} $result */
$result = $this->googlePhotosAPIService->startImportPhotos($this->userId);
if (isset($result['error'])) {
$response = new DataResponse($result['error'], 401);
} else {
$response = new DataResponse($result);
}
return $response;
}

/**
* @NoAdminRequired
*
Expand Down
12 changes: 0 additions & 12 deletions lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,6 @@ public function prepare(INotification $notification, string $languageCode): INot
$l = $this->factory->get('integration_google', $languageCode);

switch ($notification->getSubject()) {
case 'import_photos_finished':
/** @var array{nbImported?:string, targetPath: string} $p */
$p = $notification->getSubjectParameters();
$nbImported = (int)($p['nbImported'] ?? 0);
$targetPath = $p['targetPath'];
$content = $l->n('%n photo was imported from Google.', '%n photos were imported from Google.', $nbImported);

$notification->setParsedSubject($content)
->setIcon($this->url->getAbsoluteURL($this->url->imagePath(Application::APP_ID, 'app-dark.svg')))
->setLink($this->url->linkToRouteAbsolute('files.view.index', ['dir' => $targetPath]));
return $notification;

case 'import_drive_finished':
/** @var array{nbImported?:string, targetPath: string} $p */
$p = $notification->getSubjectParameters();
Expand Down
Loading