Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Add the option for setting installation URL (#126)
* Add action/reducer for url settings * Add screen for configuring the installation url * Add navigation helper controlling the navigation from outside of component * Add url helper for setting the base url in API call * Add configure url in router * Add some locale texts * Add helper for URL validation * Add change url option in login screen * Fix some prop warnings * Navigate to configure url screen on logout * Remove hard coded values * Release android/ios beta version 0.0.24 * Add brightness for thumbnail background color * Release android/ios beta version 0.0.25
- Loading branch information
Showing
20 changed files
with
370 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.6.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { | ||
SET_URL, | ||
SET_URL_ERROR, | ||
SET_URL_SUCCESS, | ||
RESET_SETTINGS, | ||
} from '../constants/actions'; | ||
import * as RootNavigation from '../helpers/NavigationHelper'; | ||
|
||
export const setInstallationUrl = ({ url }) => async (dispatch) => { | ||
try { | ||
dispatch({ type: SET_URL }); | ||
dispatch({ type: SET_URL_SUCCESS, payload: `https://${url}/` }); | ||
RootNavigation.navigate('Login'); | ||
} catch (error) { | ||
dispatch({ type: SET_URL_ERROR, payload: error }); | ||
} | ||
}; | ||
|
||
export const resetSettings = () => async (dispatch) => { | ||
dispatch({ type: RESET_SETTINGS }); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import * as React from 'react'; | ||
|
||
export const navigationRef = React.createRef(); | ||
|
||
export function navigate(name, params) { | ||
navigationRef.current?.navigate(name, params); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { store } from '../store'; | ||
|
||
export const getBaseUrl = async () => { | ||
try { | ||
const state = await store.getState(); | ||
const { installationUrl } = state.settings; | ||
return installationUrl; | ||
} catch (error) {} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { | ||
SET_URL, | ||
SET_URL_SUCCESS, | ||
SET_URL_ERROR, | ||
RESET_SETTINGS, | ||
} from '../constants/actions'; | ||
const initialState = { | ||
installationUrl: null, | ||
isUrlSet: false, | ||
isSettingUrl: false, | ||
error: {}, | ||
}; | ||
export default (state = initialState, action) => { | ||
switch (action.type) { | ||
case SET_URL: | ||
return { ...state, isSettingUrl: true }; | ||
|
||
case SET_URL_SUCCESS: | ||
return { | ||
...state, | ||
isSettingUrl: false, | ||
isUrlSet: true, | ||
installationUrl: action.payload, | ||
error: {}, | ||
}; | ||
case SET_URL_ERROR: | ||
return { | ||
...state, | ||
isSettingUrl: true, | ||
isUrlSet: false, | ||
error: action.payload, | ||
installationUrl: null, | ||
}; | ||
|
||
case RESET_SETTINGS: | ||
return initialState; | ||
|
||
default: | ||
return state; | ||
} | ||
}; |
Oops, something went wrong.