Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #774 from sfroment/dev/sfroment/splash-screen
feat(client): add berty splash screen
- Loading branch information
Showing
26 changed files
with
464 additions
and
63 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
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
18 changes: 18 additions & 0 deletions
18
client/react-native/android/app/src/main/java/chat/berty/main/SplashActivity.java
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,18 @@ | ||
package chat.berty.main; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
|
||
import chat.berty.main.MainActivity; | ||
|
||
public class SplashActivity extends AppCompatActivity { | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
Intent intent = new Intent(this, MainActivity.class); | ||
startActivity(intent); | ||
finish(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
client/react-native/android/app/src/main/res/drawable/background_splash.xml
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,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<item | ||
android:drawable="@color/white"/> | ||
|
||
<item | ||
android:width="200dp" | ||
android:height="200dp" | ||
android:drawable="@mipmap/berty_square" | ||
android:gravity="center" /> | ||
|
||
|
||
</layer-list> |
Binary file added
BIN
+26.1 KB
client/react-native/android/app/src/main/res/mipmap-hdpi/berty_square.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12 KB
client/react-native/android/app/src/main/res/mipmap-mdpi/berty_square.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41.8 KB
client/react-native/android/app/src/main/res/mipmap-xhdpi/berty_square.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41.8 KB
client/react-native/android/app/src/main/res/mipmap-xxhdpi/berty_square.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,82 @@ | ||
import { Linking, Platform } from 'react-native' | ||
import { SafeAreaView } from 'react-navigation' | ||
import KeyboardSpacer from 'react-native-keyboard-spacer' | ||
import React, { PureComponent } from 'react' | ||
import { parse as parseUrl } from '../helpers/url' | ||
|
||
import { Loader } from './Library' | ||
import Accounts from './Screens/Accounts' | ||
|
||
export default class App extends PureComponent { | ||
state = { | ||
loading: true, | ||
deepLink: { | ||
routeName: 'main', | ||
params: {}, | ||
}, | ||
} | ||
|
||
componentDidMount () { | ||
Linking.getInitialURL() | ||
.then(url => { | ||
if (url !== null) { | ||
this.handleOpenURL({ url }) | ||
} | ||
}) | ||
.catch(() => {}) | ||
|
||
if (this._handleOpenURL === undefined) { | ||
this._handleOpenURL = this.handleOpenURL.bind(this) | ||
} | ||
|
||
Linking.addEventListener('url', this._handleOpenURL) | ||
this.setState({ loading: false }) | ||
} | ||
|
||
componentWillUnmount () { | ||
if (this._handleOpenURL !== undefined) { | ||
Linking.removeEventListener('url', this._handleOpenURL) | ||
} | ||
} | ||
|
||
handleOpenURL (event) { | ||
let url = parseUrl(event.url.replace('berty://', 'https://berty.tech/')) | ||
|
||
switch (url.pathname) { | ||
case '/add-contact': | ||
this.setState({ | ||
deepLink: { | ||
routeName: 'modal/contacts/add/by-public-key', | ||
params: { | ||
initialKey: url.hashParts['public-key'] || '', | ||
initialName: url.hashParts['display-name'] || '', | ||
}, | ||
}, | ||
}) | ||
break | ||
default: | ||
console.warn(`Unhandled deep link, URL: ${event.url}`) | ||
break | ||
} | ||
} | ||
|
||
render () { | ||
const { loading, deepLink } = this.state | ||
if (loading) { | ||
return <Loader /> | ||
} | ||
return ( | ||
<SafeAreaView style={{ flex: 1 }} forceInset={{ bottom: 'never' }}> | ||
<Accounts | ||
ref={nav => { | ||
this.navigation = nav | ||
}} | ||
screenProps={{ | ||
deepLink, | ||
}} | ||
/> | ||
{Platform.OS === 'ios' && <KeyboardSpacer />} | ||
</SafeAreaView> | ||
) | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
client/react-native/common/static/animation/BertyAnimation.json
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.