Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thalia
ThaliApp
Commits
e13eda68
Verified
Commit
e13eda68
authored
Jun 21, 2019
by
Sébastiaan Versteeg
Browse files
Open photos deeplink with slug
parent
faf5955a
Changes
8
Hide whitespace changes
Inline
Side-by-side
__tests__/ui/components/loadingScreen/__snapshots__/LoadingScreen.spec.js.snap
View file @
e13eda68
...
...
@@ -5,7 +5,7 @@ exports[`LoadingScreen component renders correctly 1`] = `
style={
Object {
"alignItems": "center",
"backgroundColor": "#F
FFFFF
",
"backgroundColor": "#F
AFAFA
",
"flex": 1,
"justifyContent": "center",
}
...
...
__tests__/ui/components/navigator/__snapshots__/Sidebar.spec.js.snap
View file @
e13eda68
...
...
@@ -472,7 +472,7 @@ exports[`Sidebar component renders correctly 1`] = `
]
}
>
</Text>
<Text
style={
...
...
@@ -489,7 +489,7 @@ exports[`Sidebar component renders correctly 1`] = `
]
}
>
Setting
s
Photo
s
</Text>
</View>
</View>
...
...
@@ -537,10 +537,7 @@ exports[`Sidebar component renders correctly 1`] = `
}
>
<Text
accessible={true}
allowFontScaling={false}
ellipsizeMode="tail"
onPress={[Function]}
style={
Array [
Object {
...
...
@@ -562,19 +559,19 @@ exports[`Sidebar component renders correctly 1`] = `
"fontStyle": "normal",
"fontWeight": "normal",
},
Object {},
]
}
>
</Text>
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
style={
Array [
Object {
"backgroundColor": "transparent",
"color": "#313131",
"fontFamily": "System",
"fontSize": 14,
"fontWeight": "600",
},
Object {
...
...
@@ -583,20 +580,13 @@ exports[`Sidebar component renders correctly 1`] = `
]
}
>
Photo
s
Setting
s
</Text>
</View>
</View>
<View
accessibilityComponentType={undefined}
accessibilityLabel={undefined}
accessibilityTraits={undefined}
accessible={true}
hasTVPreferredFocus={undefined}
hitSlop={undefined}
isTVSelectable={true}
nativeID={undefined}
onLayout={undefined}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
...
...
@@ -614,8 +604,6 @@ exports[`Sidebar component renders correctly 1`] = `
},
]
}
testID={undefined}
tvParallaxProperties={undefined}
>
<View
style={
...
...
android/app/src/main/AndroidManifest.xml
View file @
e13eda68
...
...
@@ -36,6 +36,7 @@
<data
android:host=
"thalia.nu"
/>
<data
android:path=
"/pizzas/"
/>
<data
android:pathPattern=
"/events/.*/"
/>
<data
android:pathPattern=
"/photos/.*/"
/>
</intent-filter>
</activity>
<activity
android:name=
"com.facebook.react.devsupport.DevSettingsActivity"
/>
...
...
app/actions/photos.js
View file @
e13eda68
...
...
@@ -46,6 +46,13 @@ export function openAlbum(pk) {
};
}
export
function
openAlbumWithSlug
(
slug
)
{
return
{
type
:
PHOTOS_ALBUM_OPEN
,
payload
:
{
slug
},
};
}
export
function
successAlbum
(
album
)
{
return
{
type
:
PHOTOS_ALBUM_SUCCESS
,
...
...
app/app.js
View file @
e13eda68
import
React
,
{
Component
}
from
'
react
'
;
import
{
Linking
,
Platform
,
NativeModules
,
Alert
,
Alert
,
Linking
,
NativeModules
,
Platform
,
}
from
'
react-native
'
;
import
{
applyMiddleware
,
createStore
}
from
'
redux
'
;
import
{
Provider
}
from
'
react-redux
'
;
import
{
I18nextProvider
,
withTranslation
}
from
'
react-i18next
'
;
import
{
I18nextProvider
}
from
'
react-i18next
'
;
import
createSagaMiddleware
from
'
redux-saga
'
;
import
firebase
from
'
react-native-firebase
'
;
import
DeviceInfo
from
'
react-native-device-info
'
;
import
Moment
from
'
moment
'
;
import
'
moment/locale/nl
'
;
import
PropTypes
from
'
prop-types
'
;
import
{
i18n
as
i18next
}
from
'
i18next
'
;
import
reducers
from
'
./reducers
'
;
import
i18n
from
'
./utils/i18n
'
;
...
...
@@ -74,12 +74,13 @@ class Main extends Component {
};
showNotification
=
(
notification
)
=>
{
const
t
=
i18next
.
getFixedT
(
undefined
,
'
app
'
);
let
buttons
;
if
(
notification
.
data
.
url
)
{
buttons
=
[
{
text
:
this
.
props
.
t
(
'
Dismiss
'
)
},
{
text
:
t
(
'
Dismiss
'
)
},
{
text
:
this
.
props
.
t
(
'
Open
'
),
text
:
t
(
'
Open
'
),
onPress
:
()
=>
store
.
dispatch
(
deepLinkingActions
.
deepLink
(
notification
.
data
.
url
,
false
),
),
...
...
@@ -128,8 +129,4 @@ class Main extends Component {
}
}
Main
.
propTypes
=
{
t
:
PropTypes
.
func
.
isRequired
,
};
export
default
withTranslation
(
'
app
'
)(
Main
);
export
default
Main
;
app/sagas/deepLinking.js
View file @
e13eda68
...
...
@@ -67,8 +67,8 @@ const deepLink = function* deepLink(action) {
args
:
[],
},
{
regexp
:
new
RegExp
(
'
^/photos/([
0-9
]+)/$
'
),
action
:
photosActions
.
openAlbum
,
regexp
:
new
RegExp
(
'
^/photos/([
-
\\
w
]+)/$
'
),
action
:
photosActions
.
openAlbum
WithSlug
,
args
:
[],
},
{
...
...
app/sagas/photos.js
View file @
e13eda68
...
...
@@ -35,7 +35,7 @@ function* loadAlbums() {
}
function
*
loadAlbum
(
action
)
{
const
{
pk
}
=
action
.
payload
;
const
{
pk
,
slug
}
=
action
.
payload
;
const
token
=
yield
select
(
tokenSelector
);
yield
put
(
photosActions
.
fetchingAlbum
());
...
...
@@ -50,9 +50,21 @@ function* loadAlbum(action) {
};
try
{
const
album
=
yield
call
(
apiRequest
,
`photos/albums/
${
pk
}
`
,
data
);
let
album
;
if
(
pk
!==
undefined
)
{
album
=
yield
call
(
apiRequest
,
`photos/albums/
${
pk
}
`
,
data
);
}
else
{
const
albums
=
yield
call
(
apiRequest
,
'
photos/albums
'
,
data
,
{
search
:
slug
,
});
album
=
yield
call
(
apiRequest
,
`photos/albums/
${
albums
[
0
].
pk
}
`
,
data
);
}
yield
put
(
photosActions
.
successAlbum
(
album
));
if
(
album
!==
undefined
)
{
yield
put
(
photosActions
.
successAlbum
(
album
));
}
else
{
yield
put
(
photosActions
.
failureAlbum
());
}
}
catch
(
error
)
{
yield
put
(
photosActions
.
failureAlbum
());
}
...
...
app/utils/url.js
View file @
e13eda68
...
...
@@ -3,7 +3,7 @@ import DeviceInfo from 'react-native-device-info';
let
server
=
'
https://thalia.nu
'
;
/* istanbul ignore next line */
if
(
__DEV__
)
{
// eslint-disable-line no-undef
//
server = 'http://localhost:8000';
server
=
'
http://localhost:8000
'
;
}
export
const
url
=
server
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment