-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Issue-281]: Implement Wallet Connect
- Loading branch information
dominhquang
committed
Aug 7, 2023
1 parent
1a0691d
commit 36f12dd
Showing
135 changed files
with
2,060 additions
and
1,149 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
27 changes: 27 additions & 0 deletions
27
android/app/src/main/java/app/subwallet/mobile/nativeModules/RCTMinimizer.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,27 @@ | ||
package app.subwallet.mobile.nativeModules; | ||
|
||
import com.facebook.react.bridge.ReactApplicationContext; | ||
import com.facebook.react.bridge.ReactContextBaseJavaModule; | ||
import com.facebook.react.bridge.ReactMethod; | ||
import android.util.Log; | ||
|
||
public class RCTMinimizer extends ReactContextBaseJavaModule { | ||
private ReactApplicationContext reactContext; | ||
RCTMinimizer(ReactApplicationContext context) { | ||
super(context); | ||
this.reactContext = reactContext; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "Minimizer"; | ||
} | ||
|
||
@ReactMethod | ||
public void goBack() { | ||
android.app.Activity activity = getCurrentActivity(); | ||
if (activity != null) { | ||
activity.moveTaskToBack(true); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
android/app/src/main/java/app/subwallet/mobile/nativeModules/RCTMinimizerPackage.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,29 @@ | ||
package app.subwallet.mobile.nativeModules; | ||
|
||
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 RCTMinimizerPackage implements ReactPackage { | ||
|
||
@Override | ||
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { | ||
return Collections.emptyList(); | ||
} | ||
|
||
@Override | ||
public List<NativeModule> createNativeModules( | ||
ReactApplicationContext reactContext) { | ||
List<NativeModule> modules = new ArrayList<>(); | ||
|
||
modules.add(new RCTMinimizer(reactContext)); | ||
|
||
return modules; | ||
} | ||
|
||
} |
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
15 changes: 15 additions & 0 deletions
15
ios/SubWalletMobile/NativeModules/RCTMinimizer/RCTMinimizer.h
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,15 @@ | ||
// | ||
// RCTMinimizer.h | ||
// SubWalletMobile | ||
// | ||
// Created by Do Minh Quang on 27/07/2023. | ||
// | ||
|
||
#ifndef RCTMinimizer_h | ||
#define RCTMinimizer_h | ||
|
||
#import <React/RCTBridgeModule.h> | ||
@interface RCTMinimizer : NSObject <RCTBridgeModule> | ||
@end | ||
|
||
#endif /* RCTMinimizer_h */ |
30 changes: 30 additions & 0 deletions
30
ios/SubWalletMobile/NativeModules/RCTMinimizer/RCTMinimizer.m
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,30 @@ | ||
#import <Foundation/Foundation.h> | ||
#import "RCTMinimizer.h" | ||
|
||
@import UIKit; | ||
@import ObjectiveC.runtime; | ||
|
||
@interface UISystemNavigationAction : NSObject | ||
@property(nonatomic, readonly, nonnull) NSArray<NSNumber*>* destinations; | ||
-(BOOL)sendResponseForDestination:(NSUInteger)destination; | ||
@end | ||
|
||
|
||
@implementation RCTMinimizer | ||
|
||
RCT_EXPORT_METHOD(goBack) | ||
{ | ||
Ivar sysNavIvar = class_getInstanceVariable(UIApplication.class, "_systemNavigationAction"); | ||
UIApplication* app = UIApplication.sharedApplication; | ||
UISystemNavigationAction* action = object_getIvar(app, sysNavIvar); | ||
if (!action) { | ||
return; | ||
} | ||
NSUInteger destination = action.destinations.firstObject.unsignedIntegerValue; | ||
[action sendResponseForDestination:destination]; | ||
return; | ||
} | ||
|
||
RCT_EXPORT_MODULE(); | ||
|
||
@end |
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
Oops, something went wrong.