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

Integrate google photos #964

Draft
wants to merge 42 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
5488b52
FullScreenDialog for Google photos gallery
tomivm May 27, 2021
3d73aaa
get Authoriation and success on first googlePhotosAPI request
tomivm Jun 1, 2021
d2b0d3c
getAlbums data and include photo gallery
tomivm Jun 8, 2021
068d225
add editingTiles array to redux-store
tomivm Jun 11, 2021
65d3c46
Use redux to store AuthToken and resolve wrong import
tomivm Jun 14, 2021
0b3181b
Add Hunk Middleware
tomivm Jun 15, 2021
73b1ef5
refactor thunk logic and add try cath to google auth project
tomivm Jun 15, 2021
44a974d
fix AddNewTile Error
tomivm Jun 17, 2021
ed01d1a
Loading screen and select image.
tomivm Jun 22, 2021
8924439
send baseUrl of selected img to cboard-api
tomivm Jun 23, 2021
8867b52
Show Loading state. Manage errors. Some fixes
tomivm Jun 25, 2021
20eba73
get next page of albums and prevent upload of videos
tomivm Jun 25, 2021
7747c92
Feature to filter data
tomivm Jun 28, 2021
42d1783
refactor of nextPage feature
tomivm Jun 28, 2021
1082145
refactor render of view
tomivm Jun 28, 2021
b189139
implement search recent content
tomivm Jun 28, 2021
4083dc5
save active edit step on reducer
tomivm Jun 29, 2021
f5713f1
prevent change of contentData state after change the view.
tomivm Jun 29, 2021
84efc7e
add css styles and support translations
tomivm Jun 29, 2021
a004cc2
prevent use of cordova devices. connect to google btn acording UXguide
tomivm Jun 30, 2021
040e057
improve responsive design
tomivm Jun 30, 2021
9af1d88
Merge branch 'master' into feature/integrate-with-googlePhotos
tomivm Jun 30, 2021
dafb053
resolve merge conflicts
tomivm Jun 30, 2021
eb8b3ba
Merge branch 'master' into feature/integrate-with-googlePhotos
martinbedouret Jul 6, 2021
bb43a5a
Rename googlePhotosFilter.component.js to GooglePhotosFilter.componen…
tomivm Jul 8, 2021
0864f58
requested changes
tomivm Jul 8, 2021
fb85c24
Merge remote-tracking branch 'tomivm/feature/integrate-with-googlePho…
martinbedouret Jul 8, 2021
89c2046
Merge branch 'master' into feature/integrate-with-googlePhotos
martinbedouret Jul 13, 2021
743572c
Merge branch 'master' into feature/integrate-with-googlePhotos
martinbedouret Jul 18, 2021
f86aa6f
Merge branch 'master' into feature/integrate-with-googlePhotos
martinbedouret Jul 20, 2021
a5ad528
Merge branch 'master' into feature/integrate-with-googlePhotos
martinbedouret Jul 30, 2021
136acbe
Merge branch 'master' into feature/integrate-with-googlePhotos
martinbedouret Aug 19, 2021
d197702
resolve Material Ui deprecations
tomivm Aug 27, 2021
f61c22c
Remove Secrets of FrontEnd
tomivm Sep 3, 2021
416be73
prevent Error.
tomivm Sep 7, 2021
2b89200
Merge branch 'master' into feature/integrate-with-googlePhotos
martinbedouret Sep 8, 2021
9001b08
Merge branch 'cboard-org:master' into feature/integrate-with-googlePh…
tomivm Oct 6, 2021
db8cffb
issue with async await use.
tomivm Oct 6, 2021
597405e
prevent expired token and manage try Again btn
tomivm Oct 6, 2021
0890e90
Avoid concatenation of ternary operators
tomivm Oct 7, 2021
8e0d56b
avoid videos after get content
tomivm Oct 7, 2021
8d9ae11
WIP
tomivm Oct 13, 2021
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
1,096 changes: 676 additions & 420 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"file-saver": "^2.0.5",
"fontsource-roboto": "^4.0.0",
"formik": "^1.3.2",
"google-auth-library": "^7.1.0",
"i18n-iso-countries": "4.3.1",
"intl": "^1.2.5",
"is-url": "1.2.4",
Expand Down
3 changes: 3 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
https://www.youtube.com/
https://*.cloudfront.net/
https://*.visualstudio.com/
https://content-photoslibrary.googleapis.com/
https://photoslibrary.googleapis.com/
https://oauth2.googleapis.com/token
blob:
tomivm marked this conversation as resolved.
Show resolved Hide resolved
gap:
data:;
Expand Down
18 changes: 18 additions & 0 deletions src/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,24 @@ class API {
return response.data.url;
}

async uploadFromUrlOnApi(url) {
tomivm marked this conversation as resolved.
Show resolved Hide resolved
const authToken = getAuthToken();
if (!(authToken && authToken.length)) {
throw new Error('Need to be authenticated to perform this request');
}

const headers = {
Authorization: `Bearer ${authToken}`,
'Content-Type': 'application/json'
};

const response = await this.axiosInstance.post('media/url', {url}, {
headers
});

return response.data.url;
}

async createCommunicator(communicator) {
const authToken = getAuthToken();
if (!(authToken && authToken.length)) {
Expand Down
44 changes: 44 additions & 0 deletions src/components/App/App.actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@ import {
UPDATE_DISPLAY_SETTINGS,
UPDATE_NAVIGATION_SETTINGS,
UPDATE_USER_DATA,
LOG_IN_GOOGLE_PHOTOS,
LOG_OUT_GOOGLE_PHOTOS,
DISABLE_TOUR
} from './App.constants';

import {
getAuthtoken,
refreshAuthToken
} from '../Board/GooglePhotosSearch/googlePhotosSearch.auth';

export function updateDisplaySettings(payload = {}) {
return {
type: UPDATE_DISPLAY_SETTINGS,
Expand Down Expand Up @@ -38,3 +45,40 @@ export function updateUserData(userData) {
userData
};
}

export function logInGooglePhotosAuth({ googlePhotosCode, refreshToken }) {
return dispatch =>
new Promise(resolve => {
if (googlePhotosCode) {
getAuthtoken(googlePhotosCode)
.then(googlePhotosAuth => {
dispatch({
type: LOG_IN_GOOGLE_PHOTOS,
googlePhotosAuth: googlePhotosAuth.tokens
});
resolve();
})
.catch(error => {
throw error;
});
} else if (refreshToken) {
refreshAuthToken(refreshToken)
.then(googlePhotosAuth => {
dispatch({
type: LOG_IN_GOOGLE_PHOTOS,
googlePhotosAuth: googlePhotosAuth
});
resolve();
})
.catch(error => {
throw error;
});
}
});
}

export function logOutGooglePhotos() {
return {
type: LOG_OUT_GOOGLE_PHOTOS
};
}
2 changes: 2 additions & 0 deletions src/components/App/App.constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export const UPDATE_DISPLAY_SETTINGS = 'cboard/App/UPDATE_DISPLAY_SETTINGS';
export const UPDATE_NAVIGATION_SETTINGS =
'cboard/App/UPDATE_NAVIGATION_SETTINGS';
export const UPDATE_USER_DATA = 'cboard/App/UPDATE_USER_DATA';
export const LOG_IN_GOOGLE_PHOTOS = 'cboard/App/LOG_IN_GOOGLE_PHOTOS';
export const LOG_OUT_GOOGLE_PHOTOS = 'cboard/App/LOG_OUT_GOOGLE_PHOTOS';

// language constants
export const DEFAULT_LANG = 'en-US';
Expand Down
18 changes: 18 additions & 0 deletions src/components/App/App.reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {
UPDATE_DISPLAY_SETTINGS,
UPDATE_NAVIGATION_SETTINGS,
UPDATE_USER_DATA,
LOG_IN_GOOGLE_PHOTOS,
LOG_OUT_GOOGLE_PHOTOS,
DISABLE_TOUR
} from './App.constants';
import { LOGIN_SUCCESS, LOGOUT } from '../Account/Login/Login.constants';
Expand Down Expand Up @@ -101,6 +103,22 @@ function appReducer(state = initialState, action) {
...state,
userData: action.userData
};
case LOG_IN_GOOGLE_PHOTOS:
return {
...state,
userData: {
...state.userData,
googlePhotosAuth: action.googlePhotosAuth
}
};
case LOG_OUT_GOOGLE_PHOTOS:
return {
...state,
userData: {
...state.userData,
googlePhotosAuth: null
}
};
default:
return state;
}
Expand Down
41 changes: 40 additions & 1 deletion src/components/Board/Board.actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ import {
DOWNLOAD_IMAGES_FAILURE,
DOWNLOAD_IMAGES_STARTED,
DOWNLOAD_IMAGE_SUCCESS,
DOWNLOAD_IMAGE_FAILURE
DOWNLOAD_IMAGE_FAILURE,
SET_EDITING_TILES,
CLEAR_EDITING_TILES,
UPDATE_EDITING_TILES,
EDITING_TILES_NEXT_STEP,
EDITING_TILES_PREV_STEP
} from './Board.constants';

import API from '../../api';
Expand Down Expand Up @@ -165,6 +170,40 @@ export function focusTile(tileId, boardId) {
};
}

export function setEditingTiles(editingTiles) {
return {
type: SET_EDITING_TILES,
editingTiles
};
}

export function clearEditingTiles() {
return {
type: CLEAR_EDITING_TILES
};
}

export function updateEditingTiles(id, property, value) {
return {
type: UPDATE_EDITING_TILES,
id,
property,
value
};
}

export function editingTilesNextStep() {
return {
type: EDITING_TILES_NEXT_STEP
};
}

export function editingTilesPrevStep() {
return {
type: EDITING_TILES_PREV_STEP
};
}

export function clickSymbol(symbolLabel) {
return {
type: CLICK_SYMBOL,
Expand Down
9 changes: 9 additions & 0 deletions src/components/Board/Board.constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,14 @@ export const DOWNLOAD_IMAGES_FAILURE = 'cboard/Board/DOWNLOAD_IMAGES_FAILURE';
export const DOWNLOAD_IMAGES_STARTED = 'cboard/Board/DOWNLOAD_IMAGES_STARTED';
export const DOWNLOAD_IMAGE_SUCCESS = 'cboard/Board/DOWNLOAD_IMAGE_SUCCESS';
export const DOWNLOAD_IMAGE_FAILURE = 'cboard/Board/DOWNLOAD_IMAGE_FAILURE';
export const SET_EDITING_TILES = 'cboard/Board/TileEditor/SET_EDITING_TILES';
export const CLEAR_EDITING_TILES =
'cboard/Board/TileEditor/CLEAR_EDITING_TILES';
export const UPDATE_EDITING_TILES =
'cboard/Board/TileEditor/UPDATE_EDITING_TILES';
export const EDITING_TILES_NEXT_STEP =
'cboard/Board/TileEditor/EDITING_TILES_NEXT_STEP';
export const EDITING_TILES_PREV_STEP =
'cboard/Board/TileEditor/EDITING_TILES_PREV_STEP';
export const DEFAULT_ROWS_NUMBER = 5;
export const DEFAULT_COLUMNS_NUMBER = 5;
Loading