-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] New Architecture: mobile-wallet-adapter-protocol (#1037)
* New Architecture: mobile-wallet-adapter-protocol * attempt to fix gradle wrapper * revert comment change (used to force git change) --------- Co-authored-by: funkatronics <funkatronicsmail@gmail.com>
- Loading branch information
1 parent
3c122da
commit 91a34c3
Showing
9 changed files
with
230 additions
and
133 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
33 changes: 26 additions & 7 deletions
33
...java/com/solanamobile/mobilewalletadapter/reactnative/SolanaMobileWalletAdapterPackage.kt
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 |
---|---|---|
@@ -1,16 +1,35 @@ | ||
package com.solanamobile.mobilewalletadapter.reactnative | ||
|
||
import com.facebook.react.ReactPackage | ||
import com.facebook.react.TurboReactPackage | ||
import com.facebook.react.bridge.NativeModule | ||
import com.facebook.react.bridge.ReactApplicationContext | ||
import com.facebook.react.uimanager.ViewManager | ||
import com.facebook.react.module.model.ReactModuleInfo | ||
import com.facebook.react.module.model.ReactModuleInfoProvider | ||
import java.util.HashMap | ||
|
||
class SolanaMobileWalletAdapterPackage : ReactPackage { | ||
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> { | ||
return listOf(SolanaMobileWalletAdapterModule(reactContext)) | ||
class SolanaMobileWalletAdapterModulePackage : TurboReactPackage() { | ||
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? { | ||
return if (name == SolanaMobileWalletAdapterModule.NAME) { | ||
SolanaMobileWalletAdapterModule(reactContext) | ||
} else { | ||
null | ||
} | ||
} | ||
|
||
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> { | ||
return emptyList() | ||
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider { | ||
return ReactModuleInfoProvider { | ||
val moduleInfos: MutableMap<String, ReactModuleInfo> = HashMap() | ||
moduleInfos[SolanaMobileWalletAdapterModule.NAME] = | ||
ReactModuleInfo( | ||
SolanaMobileWalletAdapterModule.NAME, | ||
SolanaMobileWalletAdapterModule.NAME, | ||
false, // canOverrideExistingModule | ||
false, // needsEagerInit | ||
true, // hasConstants | ||
false, // isCxxModule | ||
true // isTurboModule | ||
) | ||
moduleInfos | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
js/packages/mobile-wallet-adapter-protocol/android/src/newarch/SolanaMobileWalletAdapter.kt
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,7 @@ | ||
package com.solanamobile.mobilewalletadapter.reactnative | ||
|
||
import com.facebook.react.bridge.ReactApplicationContext | ||
|
||
abstract class SolanaMobileWalletAdapterSpec | ||
internal constructor(context: ReactApplicationContext) : | ||
NativeSolanaMobileWalletAdapterSpec(context) {} |
16 changes: 16 additions & 0 deletions
16
js/packages/mobile-wallet-adapter-protocol/android/src/oldarch/SolanaMobileWalletAdapter.kt
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,16 @@ | ||
package com.solanamobile.mobilewalletadapter.reactnative | ||
|
||
import com.facebook.react.bridge.Promise | ||
import com.facebook.react.bridge.ReactApplicationContext | ||
import com.facebook.react.bridge.ReactContextBaseJavaModule | ||
import com.facebook.react.bridge.ReadableMap | ||
|
||
abstract class SolanaMobileWalletAdapterSpec | ||
internal constructor(context: ReactApplicationContext) : ReactContextBaseJavaModule(context) { | ||
|
||
abstract fun startSession(config: ReadableMap?, promise: Promise) | ||
|
||
abstract fun invoke(method: String, params: ReadableMap?, promise: Promise) | ||
|
||
abstract fun endSession(promise: Promise) | ||
} |
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.