GoodDollar / GoodDAPP

GoodDollar.org Wallet is the simplest access point to Claim your daily G$. It Is based on web3 and React native web.
good-dapp.vercel.app
MIT License
106 stars 55 forks source link

Create separate eToro instance for wallet.gooddollar.org #3982

Open johnsmith-gooddollar opened 1 year ago

johnsmith-gooddollar commented 1 year ago

Issues

  1. [x] looks like realmdb, celo rpc and torus endpoint have no delta.gooddollar.org in the whitelisted origins which causes CORS errors @sirpy

image.png

johnsmith-gooddollar commented 1 year ago
  1. custom wallet instance available at https://delta.gooddollar.org
  2. what had been adjusted:
    • no "Switch to Safari or Chrome" banner at boot screen, browser compatibility check been disabled
    • no "smart banner" - suggestion to install app from the Google Play
    • no banner with proposition to add app icon to the home screen
  3. All analytics events and logs propagating through the ReactNativeWebView.postMessage interface

Log messages shape:

{
  type: <one of log levels, lowecased> https://github.com/jonnyreeves/js-logger/blob/master/src/logger.js#L50,
  name: <name of the component, hook or api/service>
  messages: [array, of, args, been, logged]
}

Event shape:

{
  type: 'event',
  event: <one of the GD analytics events predefined> https://github.com/GoodDollar/GoodDAPP/blob/master/src/lib/analytics/constants.js,
  data?: <custom data object>
}

Not that implementation is strictly tied to RN WebView. Data is sent/received as JSON-stringified text

Example app:

import React, { useMemo, useEffect, useCallback } from 'react';
import { useColorScheme, SafeAreaView, ScrollView, StatusBar, View, Text, Dimensions } from 'react-native'
import { WebView } from 'react-native-webview'

function App(): JSX.Element {
  const { width, height } = useMemo(() => Dimensions.get('window'), [])
  const isDarkMode = useColorScheme() === 'dark';

  const backgroundStyle = {
    backgroundColor: isDarkMode ? '#222' : '#444',
  };

  const webViewStyle = {
    flex: 1,
    backgroundColor: '#fff',
    width,
    height,
  }

  const onMessage = useCallback(({ nativeEvent }) => console.log(JSON.parse(nativeEvent.data)), [])

  return (
    <SafeAreaView style={backgroundStyle}>
      <StatusBar
        barStyle={isDarkMode ? 'light-content' : 'dark-content'}
        backgroundColor={backgroundStyle.backgroundColor}
      />
      <ScrollView
        contentInsetAdjustmentBehavior="automatic"
        style={backgroundStyle}
      >
        <WebView
          style={webViewStyle}
          title={"GoodDollar Wallet"}      
          source={{ uri: "https://delta.gooddollar.org" }}
          scrollEnabled={true}        
          originWhitelist={['*']}
          onMessage={onMessage}
        />
      </ScrollView>
    </SafeAreaView>
  );
}

export default App;

To allow send form iframe - ask me for updated solution @peterfo-tr @sunela-tr Also ask me regarding handling urls (deep links ?)

johnsmith-gooddollar commented 1 year ago

image

I see GOTO_CHOOSEAUTH and SIGNIN_METHOD_SELECTED but don’t immediately see an event when the user actually signed in and the below screen is displayed. Is there one I should see?

Will give an answer during the day. In short words - as we’re reloading app after login/logout there’s two options a) to handle last screen of auth flow (when you just have logged) b) to handle AppRouter effect tracking isLoggedIn (after app been reloaded) I’ll search for proper events or debug logs to track

johnsmith-gooddollar commented 1 year ago

Breaking changes

{
  type: 'identify',
  email: user's email
  identifier?: user's ID (only for signed users, not available during signup)
  signup: true|false
}

About your issue

  1. To catch a moment when user exactly logs in, You need to track the following events:
  1. To catch a moment when the screen from above is shown after login, track for the next one identify event Listen for type = 'identify' and signup = false
sirpy commented 1 year ago

@johnsmith-gooddollar added domain to pokt and mongodb

johnsmith-gooddollar commented 1 year ago

@sirpy Thanks. Checked Google & FB, awaiting for eToro's confirmation

johnsmith-gooddollar commented 1 year ago

@sirpy they have issues with password less:

It seems delta.gooddollar.org still not enabled on 0auth PROD redirect uri should be exactly like for wallet.gooddollar.org just domain is delta. https://wallet.gooddollar.org/Welcome/Auth is used for Torus as I remember so it should be https://delta.gooddollar.org/Welcome/Auth