From 8518d637282bfcfc6376a8c8a0f3d161ef6533a4 Mon Sep 17 00:00:00 2001 From: Andre Pimenta Date: Wed, 3 Jun 2020 18:57:05 +0100 Subject: [PATCH] Splash screen on android (#1554) * splash screen installed and working on android * ios comment for more details * Update Podfile.lock * Fix no new line --- .../src/main/java/io/metamask/MainActivity.java | 3 +++ android/app/src/main/res/drawable/diamond.png | Bin 0 -> 3804 bytes .../app/src/main/res/layout/launch_screen.xml | 6 ++++++ app/components/Views/Entry/index.js | 2 ++ ios/MetaMask/AppDelegate.m | 3 +++ ios/Podfile.lock | 6 ++++++ package.json | 1 + yarn.lock | 4 ++++ 8 files changed, 25 insertions(+) create mode 100644 android/app/src/main/res/drawable/diamond.png create mode 100644 android/app/src/main/res/layout/launch_screen.xml diff --git a/android/app/src/main/java/io/metamask/MainActivity.java b/android/app/src/main/java/io/metamask/MainActivity.java index 6513f6fe731..2ebbf24abae 100644 --- a/android/app/src/main/java/io/metamask/MainActivity.java +++ b/android/app/src/main/java/io/metamask/MainActivity.java @@ -16,6 +16,8 @@ import androidx.annotation.NonNull; +import org.devio.rn.splashscreen.SplashScreen; + public class MainActivity extends ReactFragmentActivity { /** @@ -44,6 +46,7 @@ protected void onStart() { @Override protected void onCreate(Bundle savedInstanceState) { + SplashScreen.show(this); super.onCreate(null); } @Override diff --git a/android/app/src/main/res/drawable/diamond.png b/android/app/src/main/res/drawable/diamond.png new file mode 100644 index 0000000000000000000000000000000000000000..4044e364f087124399a4910bf1f3bf0532fbdf38 GIT binary patch literal 3804 zcmeHKiC0rs8h;6qCG3K-YEmdjF%T9t0!df~S*#F127(Stzz`{rLtF;c4#(57 z8wqWd&VUl6EJ}cu7BYt2IT9dHDu}ERSvw&C=0(xY{0noq@7#BP_q)IE_ucP1_r7!9 z%>aLIO}H@}002#2AI~5FfS^DuRaFMx9I0wJIKU|Ge(nHJU#Ko89RTOZ7@r_N07$b0 zfb8o4umzg3=KvtZ4geOS0KmBv01W7Np9W&Vh3jOZZ>*mmU=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T9;f>e1B2CwevuNBNqS6de6Gs*a8IBRVg3XX>+Cv!t2-H(7NUt&r7DZp7#s14a5>n!Y@C`+I8~&HsONnmuR|N zyGr(kup7;98&Ex?X4(+9Uaqb%w-=&a#`fhcBWB%=cS#NSV`5bUZg zxx0}hke(_L{M^9zAxGtO)cDGs{Lkx}9KUDRXn#RDpUW0c{qrWF_g=??!AJP9R2cIR zScg^CmC&4LVIi$&NG*&{Lyk%l3PQw*>OVhgtPT6Daq+^pFD9E7{}Opi$-B_0b?nf; zZhfe{i@HWNC9FpqYpU|AoLGRC*Ko*35(Le&;*^IkpNpesaEJ-%cEl$<6)+(cR9*xj zDy{fr%S=@5T{)v*U^gR8AoFNtzIYUGyV6g+hKWn#+5Q`PxpmbmAYp)wk7S7!%3T0>d=( zRk9?tk~Se{&pxYLVd<2Hx{>;h&uyR2>66uT*Rw>pdX{|6p1 + + + diff --git a/app/components/Views/Entry/index.js b/app/components/Views/Entry/index.js index ef1a080383b..67ceb750914 100644 --- a/app/components/Views/Entry/index.js +++ b/app/components/Views/Entry/index.js @@ -14,6 +14,7 @@ import { colors } from '../../../styles/common'; import DeeplinkManager from '../../../core/DeeplinkManager'; import Logger from '../../../util/Logger'; import Device from '../../../util/Device'; +import SplashScreen from 'react-native-splash-screen'; /** * Entry Screen that decides which screen to show @@ -90,6 +91,7 @@ class Entry extends PureComponent { async componentDidMount() { DeeplinkManager.init(this.props.navigation); this.unsubscribeFromBranch = Branch.subscribe(this.handleDeeplinks); + SplashScreen.hide(); const existingUser = await AsyncStorage.getItem('@MetaMask:existingUser'); if (existingUser !== null) { await this.unlockKeychain(); diff --git a/ios/MetaMask/AppDelegate.m b/ios/MetaMask/AppDelegate.m index 442bd80424d..ca6a61949f4 100644 --- a/ios/MetaMask/AppDelegate.m +++ b/ios/MetaMask/AppDelegate.m @@ -71,6 +71,9 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( launchScreenView.frame = self.window.bounds; rootView.loadingView = launchScreenView; + //Uncomment the following line to enable the splashscreen on ios + //[RNSplashScreen show]; + return YES; } diff --git a/ios/Podfile.lock b/ios/Podfile.lock index d6c73a83f6b..3c1ea015d8a 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -268,6 +268,8 @@ PODS: - React - react-native-randombytes (3.5.3): - React + - react-native-splash-screen (3.2.0): + - React - react-native-view-shot (3.1.2): - React - react-native-viewpager (3.3.0): @@ -422,6 +424,7 @@ DEPENDENCIES: - react-native-camera (from `../node_modules/react-native-camera`) - "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)" - react-native-randombytes (from `../node_modules/react-native-randombytes`) + - react-native-splash-screen (from `../node_modules/react-native-splash-screen`) - react-native-view-shot (from `../node_modules/react-native-view-shot`) - "react-native-viewpager (from `../node_modules/@react-native-community/viewpager`)" - react-native-webview (from `../node_modules/react-native-webview`) @@ -516,6 +519,8 @@ EXTERNAL SOURCES: :path: "../node_modules/@react-native-community/netinfo" react-native-randombytes: :path: "../node_modules/react-native-randombytes" + react-native-splash-screen: + :path: "../node_modules/react-native-splash-screen" react-native-view-shot: :path: "../node_modules/react-native-view-shot" react-native-viewpager: @@ -614,6 +619,7 @@ SPEC CHECKSUMS: react-native-camera: 5d4ee26d19ac5aa9a8d8663b50f53b1c1250597c react-native-netinfo: 0e563248a4b9a99c33ec29bd03c2d50767db22a6 react-native-randombytes: 3638d24759d67c68f6ccba60c52a7a8a8faa6a23 + react-native-splash-screen: 200d11d188e2e78cea3ad319964f6142b6384865 react-native-view-shot: 4475fde003fe8a210053d1f98fb9e06c1d834e1c react-native-viewpager: a7b438ca32c57b2614ece2a123e7fe116f743131 react-native-webview: 174e0f8f1bf547224a134215607c75c4bb0312b7 diff --git a/package.json b/package.json index 362abce8f5d..8e7322912e8 100644 --- a/package.json +++ b/package.json @@ -148,6 +148,7 @@ "react-native-scrollable-tab-view": "^1.0.0", "react-native-search-api": "ombori/react-native-search-api#8/head", "react-native-sensors": "5.3.0", + "react-native-splash-screen": "git+ssh://git@github.com/MetaMask/react-native-splash-screen.git", "react-native-share": "^3.2.0", "react-native-svg": "9.13.3", "react-native-swipe-gestures": "1.0.3", diff --git a/yarn.lock b/yarn.lock index 507d8e2ce53..5f3c7cdebad 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10535,6 +10535,10 @@ react-native-share@^3.2.0: resolved "https://registry.yarnpkg.com/react-native-share/-/react-native-share-3.3.2.tgz#06d1d3f14ba8eeb95e7e94e4db6a286e9902bd29" integrity sha512-Pvkr62TiCX511RMPL+wvy9Fofre4HQnvUT5zzgPPN3vszP/C8lUb7cmFu/8x5U14t3JQg+xW/svNK5eKNebJKw== +"react-native-splash-screen@git+ssh://git@github.com/MetaMask/react-native-splash-screen.git": + version "3.2.0" + resolved "git+ssh://git@github.com/MetaMask/react-native-splash-screen.git#1f45c08c0824cd94fdc6fb699529688a73614fee" + react-native-svg@9.13.3: version "9.13.3" resolved "https://registry.yarnpkg.com/react-native-svg/-/react-native-svg-9.13.3.tgz#6414b337d55af169ac2487ab70f3108404434446"