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

Use Rest API calls #558

Merged
merged 34 commits into from
Dec 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
3bea865
Login/resume working
diegolmello Nov 26, 2018
dd4ca53
settings and permissions
diegolmello Nov 26, 2018
c879696
custom emojis
diegolmello Nov 27, 2018
4d4c011
Merge branch 'develop' into new-sdk
diegolmello Nov 28, 2018
26fc03d
Api and ddp working
diegolmello Nov 28, 2018
ec28104
Room
diegolmello Nov 29, 2018
453f3b1
room actions
diegolmello Nov 29, 2018
02f19b5
Room members
diegolmello Nov 29, 2018
f8ba2cc
Streams
diegolmello Nov 29, 2018
5b49bd9
User data saved in asyncstorage refactored
diegolmello Nov 29, 2018
86300df
Create dm
diegolmello Nov 29, 2018
353e5d2
Load messages and join
diegolmello Nov 30, 2018
0a85905
React and fav
diegolmello Nov 30, 2018
5c0cca6
Login (error and totp)
diegolmello Nov 30, 2018
1aa80cd
Oauth, share, delete, edit, star, pin
diegolmello Dec 3, 2018
3f3ee54
Sort prefs
diegolmello Dec 3, 2018
266a635
Parse settings, custom emojis and roles on server select from local db
diegolmello Dec 3, 2018
41a2c3f
Forgot password
diegolmello Dec 3, 2018
daa5084
Enable unsecure websocket
diegolmello Dec 3, 2018
bf4b04a
Favicon
diegolmello Dec 3, 2018
c875f50
Register
diegolmello Dec 4, 2018
b64a399
Set username
diegolmello Dec 4, 2018
eb0d365
Remove login.token
diegolmello Dec 4, 2018
2f0d65f
Refactoring
diegolmello Dec 4, 2018
0e73a22
Detox
diegolmello Dec 4, 2018
0c2e448
Downgrade react-native-fast-image
diegolmello Dec 4, 2018
d9612b0
Refactoring
diegolmello Dec 4, 2018
bfbb486
Bug fixes
diegolmello Dec 4, 2018
f38723c
Use temp SDK
diegolmello Dec 4, 2018
b7b1f42
- Refactoring
diegolmello Dec 5, 2018
3136b36
Push token
diegolmello Dec 5, 2018
84c90c7
- Get rooms on resume
diegolmello Dec 5, 2018
bcae2bd
Remove react-native-meteor
diegolmello Dec 5, 2018
084ca7e
Downgrade react-native-image-crop-picker
diegolmello Dec 5, 2018
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
8 changes: 4 additions & 4 deletions __tests__/__snapshots__/Storyshots.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ exports[`Storyshots Avatar avatar 1`] = `
source={
Object {
"priority": "high",
"uri": "baseUrl/avatar/test?format=png&size=50",
"uri": "baseUrl/avatar/test?format=png&width=50&height=50",
}
}
style={
Expand Down Expand Up @@ -80,7 +80,7 @@ exports[`Storyshots Avatar avatar 1`] = `
source={
Object {
"priority": "high",
"uri": "baseUrl/avatar/aa?format=png&size=50",
"uri": "baseUrl/avatar/aa?format=png&width=50&height=50",
}
}
style={
Expand Down Expand Up @@ -126,7 +126,7 @@ exports[`Storyshots Avatar avatar 1`] = `
source={
Object {
"priority": "high",
"uri": "baseUrl/avatar/bb?format=png&size=50",
"uri": "baseUrl/avatar/bb?format=png&width=50&height=50",
}
}
style={
Expand Down Expand Up @@ -172,7 +172,7 @@ exports[`Storyshots Avatar avatar 1`] = `
source={
Object {
"priority": "high",
"uri": "baseUrl/avatar/test?format=png&size=50",
"uri": "baseUrl/avatar/test?format=png&width=50&height=50",
}
}
style={
Expand Down
1 change: 1 addition & 0 deletions app/ReactotronConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ if (__DEV__) {
// $ adb reverse tcp:9090 tcp:9090
Reactotron.clear();
console.warn = Reactotron.log;
console.log = Reactotron.log;
}
14 changes: 1 addition & 13 deletions app/actions/actionsTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,10 @@ function createRequestTypes(base, types = defaultTypes) {
// Login events
export const LOGIN = createRequestTypes('LOGIN', [
...defaultTypes,
'SET_TOKEN',
'RESTORE_TOKEN',
'SUBMIT',
'REGISTER_SUBMIT',
'REGISTER_REQUEST',
'SET_USERNAME_SUBMIT',
'SET_USERNAME_REQUEST',
'SET_USERNAME_SUCCESS',
'SET_SERVICES',
'SET_PREFERENCE',
'SET_SORT_PREFERENCE'
]);
export const FORGOT_PASSWORD = createRequestTypes('FORGOT_PASSWORD');
export const USER = createRequestTypes('USER', ['SET']);
export const ROOMS = createRequestTypes('ROOMS', [
...defaultTypes,
Expand Down Expand Up @@ -82,7 +73,7 @@ export const SERVER = createRequestTypes('SERVER', [
'INIT_ADD',
'FINISH_ADD'
]);
export const METEOR = createRequestTypes('METEOR_CONNECT', [...defaultTypes, 'DISCONNECT', 'DISCONNECT_BY_USER']);
export const METEOR = createRequestTypes('METEOR_CONNECT', [...defaultTypes, 'DISCONNECT']);
export const LOGOUT = 'LOGOUT'; // logout is always success
export const ACTIVE_USERS = createRequestTypes('ACTIVE_USERS', ['SET']);
export const ROLES = createRequestTypes('ROLES', ['SET']);
Expand All @@ -93,6 +84,3 @@ export const SNIPPETED_MESSAGES = createRequestTypes('SNIPPETED_MESSAGES', ['OPE
export const ROOM_FILES = createRequestTypes('ROOM_FILES', ['OPEN', 'READY', 'CLOSE', 'MESSAGES_RECEIVED']);
export const DEEP_LINKING = createRequestTypes('DEEP_LINKING', ['OPEN']);
export const SORT_PREFERENCES = createRequestTypes('SORT_PREFERENCES', ['SET_ALL', 'SET']);

export const INCREMENT = 'INCREMENT';
export const DECREMENT = 'DECREMENT';
12 changes: 0 additions & 12 deletions app/actions/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,9 @@ export function connectSuccess() {
};
}

export function connectFailure(err) {
return {
type: types.METEOR.FAILURE,
err
};
}

export function disconnect(err) {
return {
type: types.METEOR.DISCONNECT,
err
};
}
export function disconnect_by_user() {
return {
type: types.METEOR.DISCONNECT_BY_USER
};
}
91 changes: 4 additions & 87 deletions app/actions/login.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,16 @@
import * as types from './actionsTypes';

export function loginSubmit(credentials) {
return {
type: types.LOGIN.SUBMIT,
credentials
};
}
export function loginRequest(credentials) {
return {
type: types.LOGIN.REQUEST,
credentials
};
}

export function registerSubmit(credentials) {
return {
type: types.LOGIN.REGISTER_SUBMIT,
credentials
};
}

export function registerRequest(credentials) {
return {
type: types.LOGIN.REGISTER_REQUEST,
credentials
};
}

export function setUsernameSubmit(credentials) {
return {
type: types.LOGIN.SET_USERNAME_SUBMIT,
credentials
};
}

export function setUsernameRequest(credentials) {
return {
type: types.LOGIN.SET_USERNAME_REQUEST,
credentials
};
}

export function setUsernameSuccess() {
return {
type: types.LOGIN.SET_USERNAME_SUCCESS
};
}

export function loginSuccess(user) {
return {
type: types.LOGIN.SUCCESS,
user,
token: user.token
user
};
}

Expand All @@ -62,58 +21,16 @@ export function loginFailure(err) {
};
}

export function setToken(user = {}) {
return {
type: types.LOGIN.SET_TOKEN,
...user
};
}

export function restoreToken(token) {
return {
type: types.LOGIN.RESTORE_TOKEN,
token
};
}

export function logout() {
return {
type: types.LOGOUT
};
}

export function forgotPasswordInit() {
return {
type: types.FORGOT_PASSWORD.INIT
};
}

export function forgotPasswordRequest(email) {
return {
type: types.FORGOT_PASSWORD.REQUEST,
email
};
}

export function forgotPasswordSuccess() {
return {
type: types.FORGOT_PASSWORD.SUCCESS
};
}

export function forgotPasswordFailure(err) {
return {
type: types.FORGOT_PASSWORD.FAILURE,
err
};
}

export function setUser(action) {
export function setUser(user) {
return {
// do not change this params order
// since we use spread operator, sometimes `type` is overriden
...action,
type: types.USER.SET
type: types.USER.SET,
user
};
}

Expand Down
10 changes: 6 additions & 4 deletions app/actions/room.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,19 @@ export function closeRoom() {
};
}

export function leaveRoom(rid) {
export function leaveRoom(rid, t) {
return {
type: types.ROOM.LEAVE,
rid
rid,
t
};
}

export function eraseRoom(rid) {
export function eraseRoom(rid, t) {
return {
type: types.ROOM.ERASE,
rid
rid,
t
};
}

Expand Down
4 changes: 3 additions & 1 deletion app/constants/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export default {
},
UI_Use_Real_Name: {
type: 'valueAsBoolean'
},
Assets_favicon_512: {
type: null
}
};
export const settingsUpdatedAt = new Date('2018-11-14');
9 changes: 8 additions & 1 deletion app/containers/Avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,15 @@ export default class Avatar extends React.PureComponent {
borderRadius
};

if (!text && !avatar) {
return null;
}

const room = type === 'd' ? text : `@${ text }`;
const uri = avatar || `${ baseUrl }/avatar/${ room }?format=png&size=${ size === 100 ? 100 : 50 }`;
// Avoid requesting several sizes by having only two sizes on cache
const uriSize = size === 100 ? 100 : 50;
const uri = avatar || `${ baseUrl }/avatar/${ room }?format=png&width=${ uriSize }&height=${ uriSize }`;

const image = (
<FastImage
style={avatarStyle}
Expand Down
5 changes: 3 additions & 2 deletions app/containers/MessageActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,11 @@ export default class MessageActions extends React.Component {
showToast(I18n.t('Copied_to_clipboard'));
}

handleShare = () => {
handleShare = async() => {
const { actionMessage } = this.props;
const permalink = await this.getPermalink(actionMessage);
Share.share({
message: actionMessage.msg.content.replace(/<(?:.|\n)*?>/gm, '')
message: permalink
});
};

Expand Down
1 change: 0 additions & 1 deletion app/containers/MessageBox/Recording.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ export default class extends React.PureComponent {
}
} catch (err) {
this.finishRecording(false);
console.error(err);
}
}

Expand Down
4 changes: 1 addition & 3 deletions app/containers/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { connect } from 'react-redux';
import Icon from 'react-native-vector-icons/MaterialIcons';
import { Navigation } from 'react-native-navigation';

import { appStart as appStartAction, setStackRoot as setStackRootAction } from '../actions';
import { setStackRoot as setStackRootAction } from '../actions';
import { logout as logoutAction } from '../actions/login';
import Avatar from './Avatar';
import Status from './status';
Expand Down Expand Up @@ -95,7 +95,6 @@ const keyExtractor = item => item.id;
baseUrl: state.settings.Site_Url || state.server ? state.server.server : ''
}), dispatch => ({
logout: () => dispatch(logoutAction()),
appStart: () => dispatch(appStartAction('outside')),
setStackRoot: stackRoot => dispatch(setStackRootAction(stackRoot))
}))
export default class Sidebar extends Component {
Expand All @@ -106,7 +105,6 @@ export default class Sidebar extends Component {
stackRoot: PropTypes.string.isRequired,
user: PropTypes.object,
logout: PropTypes.func.isRequired,
appStart: PropTypes.func,
setStackRoot: PropTypes.func
}

Expand Down
2 changes: 1 addition & 1 deletion app/containers/message/Image.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class extends React.PureComponent {
const { baseUrl, file, user } = this.props;
const img = `${ baseUrl }${ file.image_url }?rc_uid=${ user.id }&rc_token=${ user.token }`;

if (!baseUrl) {
if (!img) {
return null;
}

Expand Down
4 changes: 2 additions & 2 deletions app/i18n/locales/en.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export default {
'1_online_member': '1 online member',
'1_person_reacted': '1 person reacted',
'1_user': '1 user',
'error-action-not-allowed': '{{action}} is not allowed',
Expand Down Expand Up @@ -184,6 +183,7 @@ export default {
Login_error: 'Your credentials were rejected! Please try again.',
Login_with: 'Login with',
Logout: 'Logout',
members: 'members',
Members: 'Members',
Mentioned_Messages: 'Mentioned Messages',
mentioned: 'mentioned',
Expand All @@ -198,7 +198,6 @@ export default {
Mute: 'Mute',
muted: 'muted',
My_servers: 'My servers',
N_online_members: '{{n}} online members',
N_people_reacted: '{{n}} people reacted',
N_users: '{{n}} users',
name: 'name',
Expand Down Expand Up @@ -254,6 +253,7 @@ export default {
Reply: 'Reply',
Resend: 'Resend',
Reset_password: 'Reset password',
resetting_password: 'resetting password',
RESET: 'RESET',
Roles: 'Roles',
Room_actions: 'Room actions',
Expand Down
5 changes: 2 additions & 3 deletions app/i18n/locales/pt-BR.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export default {
'1_online_member': '1 membro online',
'1_person_reacted': '1 pessoa reagiu',
'1_user': '1 usuário',
'error-action-not-allowed': '{{action}} não é permitido',
Expand Down Expand Up @@ -202,7 +201,6 @@ export default {
Microphone_Permission: 'Acesso ao Microfone',
Mute: 'Mudo',
muted: 'mudo',
N_online_members: '{{n}} membros online',
N_people_reacted: '{{n}} pessoas reagiram',
N_users: '{{n}} usuários',
name: 'nome',
Expand Down Expand Up @@ -257,6 +255,7 @@ export default {
Reply: 'Responder',
Resend: 'Reenviar',
Reset_password: 'Resetar senha',
resetting_password: 'redefinindo senha',
RESET: 'RESETAR',
Roles: 'Papéis',
Room_actions: 'Ações',
Expand Down Expand Up @@ -305,7 +304,7 @@ export default {
Take_a_photo: 'Tirar uma foto',
Terms_of_Service: ' Termos de Serviço ',
The_URL_is_invalid: 'A URL fornecida é inválida ou não acessível. Por favor tente novamente, mas com uma url diferente.',
There_was_an_error_while_action: 'Acontece um erro {{action}}!',
There_was_an_error_while_action: 'Aconteceu um erro {{action}}!',
This_room_is_blocked: 'Este quarto está bloqueado',
This_room_is_read_only: 'Este quarto é apenas de leitura',
Timezone: 'Fuso horário',
Expand Down
Loading