-
-
Notifications
You must be signed in to change notification settings - Fork 1
add web3 sign in #38
base: main
Are you sure you want to change the base?
add web3 sign in #38
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest using two separate Android Activities for SignInWithGoogleActivity
and SignInWithGoogleActivity
, so that we avoid mixing the code used for each sign-in provider.
app/src/main/java/ai/elimu/crowdsource/ui/authentication/SignInActivity.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hhio618 I tried compiling the code, but got this error:
./gradlew clean build
> Task :app:testDebugUnitTest FAILED
ai.elimu.crowdsource.ExampleUnitTest > web3recover_SanityCheck FAILED
java.lang.AssertionError at ExampleUnitTest.java:22
@nya-elimuai Just added a new commit. fixed the test case so you can build the project. also, I tested the sign-in process using TrustWallet and AlphaWallet (as they support web3 & WalletConnect). but Metamask doesn't seem to work completely, could be a problem with Metamask or the WalletConnect library I used. I forked the library If that's the problem I'll try to find a fix for that. |
@hhio618 Thanks. Updated, and tried again. The compilation is still not working for me:
|
@nya-elimuai fixed. |
@nya-elimuai tested using Alphawallet! also, looks like trust wallet doesn't support Unicode chars in the input message(the thumbs up emoji)! |
@hhio618 I downloaded the latest version of the branch, and code is not compiling for me:
> Task :app:testDebugUnitTest
ai.elimu.crowdsource.ExampleUnitTest > web3recover_SanityCheck FAILED
java.lang.AssertionError at ExampleUnitTest.java:21 expected:<[B@17503f6b> but was:<0x438d6abe3d60b1a1f3f1e0c606ba249bc30e221001b9269f96be450c393c2f7c>
Expected :[B@17503f6b
Actual :0x438d6abe3d60b1a1f3f1e0c606ba249bc30e221001b9269f96be450c393c2f7c Does it work on your machine? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was unable to launch the app, due to compilation error: #38 (comment)
@nya-elimuai fixed, as I used android studio run tools didn't see that :D |
@hhio618 I updated the code and tried again locally, but compilation still fails: https://github.com/elimu-ai/crowdsource/runs/6648804215?check_suite_focus=true You can see the command used for compilation at https://github.com/elimu-ai/crowdsource/blob/main/README.md#development- and in the GitHub Action: https://github.com/elimu-ai/crowdsource/blob/main/.github/workflows/ci_pr.yml#L18 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nya-elimuai Although I couldn't reproduce it locally (for me it happens only on the CI pipeline), I updated the Timber Library back to 5.0.1 now works fine! |
Thank you, @hhio618! 🙌🏽 I was now able to compile the code and launch it on a device. Question: What will happen if the user does not have any Web3 wallet app installed on their device? I haven't tested scenario yet. |
@nya-elimuai you're welcome!
How about notifying/redirecting the user to install a web3 wallet? |
@hhio618 Yes, I think that would make sense, because that way it would work similarly as in our webapp. If no Web3 wallet app is found, perhaps we could redirect the user to MetaMask's Google Play page? https://play.google.com/store/apps/details?id=io.metamask Here is the error message I'm getting on an Android emulator (no Web3 wallet app installed): 2022-06-01 19:17:21.210 3089-3089/ai.elimu.crowdsource.debug I/SignInWithWeb3Activity: onCreate
2022-06-01 19:17:21.362 3089-3089/ai.elimu.crowdsource.debug I/SignInWithWeb3Activity: onStart
2022-06-01 19:17:24.848 3089-3089/ai.elimu.crowdsource.debug D/AndroidRuntime: Shutting down VM
2022-06-01 19:17:24.855 3089-3089/ai.elimu.crowdsource.debug E/AndroidRuntime: FATAL EXCEPTION: main
Process: ai.elimu.crowdsource.debug, PID: 3089
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=wc:ffeb70b1-a244-4e51-a89c-c8a4c6209956@1?bridge=http://localhost:55380&key=9EDFD65F84A68C8619AA2E9ACB7914C95D2A01E7801E170014F90A86DA7DA2C8 }
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2067)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1727)
at android.app.Activity.startActivityForResult(Activity.java:5314)
at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:597)
at android.app.Activity.startActivityForResult(Activity.java:5272)
at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:583)
at android.app.Activity.startActivity(Activity.java:5658)
at android.app.Activity.startActivity(Activity.java:5611)
at ai.elimu.crowdsource.ui.authentication.SignInWithWeb3Activity.lambda$onCreate$0$ai-elimu-crowdsource-ui-authentication-SignInWithWeb3Activity(SignInWithWeb3Activity.java:76)
at ai.elimu.crowdsource.ui.authentication.SignInWithWeb3Activity$$ExternalSyntheticLambda0.onClick(Unknown Source:2) |
Description
Add web3 sign-in button
close #37