-
Notifications
You must be signed in to change notification settings - Fork 635
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/rainbow-me/rainbow into …
…brody/QR-code-scanner-fixes * 'develop' of https://github.com/rainbow-me/rainbow: v bump 1.9.11 (#5204) Simulation fixes (#5194) [Android]: Random bug fixes (#5195) revert onpress (#5193) wc: tx simulation (#5177) [APP-917]: Minimum recieved shown in wei not in ETH on eth to weth swap on Arbitrum in latest iOS prod (#5192) RPC Proxy (#5169) . (#5191) [Android] Fix: Hide Navigation & Status bar (#5150)
- Loading branch information
Showing
114 changed files
with
4,067 additions
and
151 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
176 changes: 176 additions & 0 deletions
176
...src/main/java/me/rainbow/NativeModules/SystemNavigationBar/SystemNavigationBarModule.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,176 @@ | ||
// Created by react-native-create-bridge | ||
|
||
package me.rainbow.NativeModules.SystemNavigationBar; | ||
|
||
import android.animation.ArgbEvaluator; | ||
import android.animation.ValueAnimator; | ||
import android.annotation.TargetApi; | ||
import android.graphics.Color; | ||
import android.os.Build; | ||
import android.app.Activity; | ||
import android.view.View; | ||
import android.view.Window; | ||
import android.view.WindowManager; | ||
import androidx.annotation.UiThread; | ||
import com.facebook.react.bridge.Arguments; | ||
import com.facebook.react.bridge.Promise; | ||
import com.facebook.react.bridge.ReactApplicationContext; | ||
import com.facebook.react.bridge.ReactContextBaseJavaModule; | ||
import com.facebook.react.bridge.ReactMethod; | ||
import com.facebook.react.bridge.UiThreadUtil; | ||
import com.facebook.react.bridge.WritableMap; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import com.facebook.react.uimanager.IllegalViewOperationException; | ||
import static com.facebook.react.bridge.UiThreadUtil.runOnUiThread; | ||
|
||
public class SystemNavigationBarModule extends ReactContextBaseJavaModule { | ||
public static final String REACT_CLASS = "NavigationBar"; | ||
private static final String ERROR_NO_ACTIVITY = "E_NO_ACTIVITY"; | ||
private static final String ERROR_NO_ACTIVITY_MESSAGE = "Tried to change the navigation bar while not attached to an Activity"; | ||
private static final String ERROR_API_LEVEL = "API_LEVEl"; | ||
private static final String ERROR_API_LEVEL_MESSAGE = "Only Android Oreo and above is supported"; | ||
private static ReactApplicationContext reactContext = null; | ||
private static final int UI_FLAG_HIDE_NAV_BAR = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | ||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | ||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar | ||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; | ||
|
||
public SystemNavigationBarModule(ReactApplicationContext context) { | ||
// Pass in the context to the constructor and save it so you can emit events | ||
// https://facebook.github.io/react-native/docs/native-modules-android.html#the-toast-module | ||
super(context); | ||
reactContext = context; | ||
} | ||
|
||
public void setNavigationBarTheme(Activity activity, Boolean light) { | ||
if (activity != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | ||
Window window = activity.getWindow(); | ||
int flags = window.getDecorView().getSystemUiVisibility(); | ||
if (light) { | ||
flags |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; | ||
} else { | ||
flags &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; | ||
} | ||
window.getDecorView().setSystemUiVisibility(flags); | ||
} | ||
} | ||
|
||
|
||
@Override | ||
public String getName() { | ||
// Tell React the name of the module | ||
// https://facebook.github.io/react-native/docs/native-modules-android.html#the-toast-module | ||
return REACT_CLASS; | ||
} | ||
|
||
@Override | ||
public Map<String, Object> getConstants() { | ||
// Export any constants to be used in your native module | ||
// https://facebook.github.io/react-native/docs/native-modules-android.html#the-toast-module | ||
final Map<String, Object> constants = new HashMap<>(); | ||
constants.put("EXAMPLE_CONSTANT", "example"); | ||
|
||
return constants; | ||
} | ||
|
||
@ReactMethod | ||
public void changeNavigationBarColor(final String color, final Boolean light, final Boolean animated, final Promise promise) { | ||
final WritableMap map = Arguments.createMap(); | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | ||
if (getCurrentActivity() != null) { | ||
try { | ||
final Window window = getCurrentActivity().getWindow(); | ||
runOnUiThread(new Runnable() { | ||
@Override | ||
public void run() { | ||
if (color.equals("transparent") || color.equals("translucent")) { | ||
window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); | ||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); | ||
if (color.equals("transparent")) { | ||
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); | ||
} else { | ||
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); | ||
} | ||
setNavigationBarTheme(getCurrentActivity(), light); | ||
map.putBoolean("success", true); | ||
promise.resolve(map); | ||
return; | ||
} else { | ||
window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); | ||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); | ||
} | ||
if (animated) { | ||
Integer colorFrom = window.getNavigationBarColor(); | ||
Integer colorTo = Color.parseColor(String.valueOf(color)); | ||
//window.setNavigationBarColor(colorTo); | ||
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo); | ||
colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { | ||
@Override | ||
public void onAnimationUpdate(ValueAnimator animator) { | ||
window.setNavigationBarColor((Integer) animator.getAnimatedValue()); | ||
} | ||
}); | ||
colorAnimation.start(); | ||
} else { | ||
window.setNavigationBarColor(Color.parseColor(String.valueOf(color))); | ||
} | ||
setNavigationBarTheme(getCurrentActivity(), light); | ||
WritableMap map = Arguments.createMap(); | ||
map.putBoolean("success", true); | ||
promise.resolve(map); | ||
} | ||
}); | ||
} catch (IllegalViewOperationException e) { | ||
map.putBoolean("success", false); | ||
promise.reject("error", e); | ||
} | ||
|
||
} else { | ||
promise.reject(ERROR_NO_ACTIVITY, new Throwable(ERROR_NO_ACTIVITY_MESSAGE)); | ||
|
||
} | ||
} else { | ||
promise.reject(ERROR_API_LEVEL, new Throwable(ERROR_API_LEVEL_MESSAGE)); | ||
} | ||
} | ||
|
||
@ReactMethod | ||
public void hideNavigationBar(Promise promise) { | ||
try { | ||
runOnUiThread(new Runnable() { | ||
@Override | ||
public void run() { | ||
if (getCurrentActivity() != null) { | ||
View decorView = getCurrentActivity().getWindow().getDecorView(); | ||
decorView.setSystemUiVisibility(UI_FLAG_HIDE_NAV_BAR); | ||
} | ||
} | ||
}); | ||
} catch (IllegalViewOperationException e) { | ||
WritableMap map = Arguments.createMap(); | ||
map.putBoolean("success", false); | ||
promise.reject("error", e); | ||
} | ||
} | ||
|
||
@ReactMethod | ||
public void showNavigationBar(Promise promise) { | ||
try { | ||
runOnUiThread(new Runnable() { | ||
@Override | ||
public void run() { | ||
if (getCurrentActivity() != null) { | ||
View decorView = getCurrentActivity().getWindow().getDecorView(); | ||
int uiOptions = View.SYSTEM_UI_FLAG_VISIBLE; | ||
decorView.setSystemUiVisibility(uiOptions); | ||
} | ||
} | ||
}); | ||
} catch (IllegalViewOperationException e) { | ||
WritableMap map = Arguments.createMap(); | ||
map.putBoolean("success", false); | ||
promise.reject("error", e); | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...rc/main/java/me/rainbow/NativeModules/SystemNavigationBar/SystemNavigationBarPackage.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,28 @@ | ||
package me.rainbow.NativeModules.SystemNavigationBar; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
import com.facebook.react.ReactPackage; | ||
import com.facebook.react.bridge.NativeModule; | ||
import com.facebook.react.bridge.ReactApplicationContext; | ||
import com.facebook.react.uimanager.ViewManager; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
public class SystemNavigationBarPackage implements ReactPackage { | ||
@NonNull | ||
@Override | ||
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) { | ||
List<NativeModule> modules = new ArrayList<>(); | ||
modules.add(new SystemNavigationBarModule(reactContext)); | ||
return modules; | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) { | ||
return Collections.emptyList(); | ||
} | ||
} |
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
23 changes: 23 additions & 0 deletions
23
ios/Images.xcassets/badges/arbitrum.imageset/Contents.json
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,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "arbitrum.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "base.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "bsc.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
ios/Images.xcassets/badges/ethereum.imageset/Contents.json
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,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "ethereum.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
ios/Images.xcassets/badges/optimism.imageset/Contents.json
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,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "optimism.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "[email protected]", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.