Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: weshnet integration for mobile apps #803

Closed
wants to merge 70 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
2546daa
feat:app build
sakul-budhathoki Nov 30, 2023
def4111
fix: depcheck
sakul-budhathoki Nov 30, 2023
00444e8
fix: undefined window on app
sakul-budhathoki Dec 1, 2023
10bc483
fix: revert tsconfig changes
sakul-budhathoki Dec 1, 2023
0c35ecc
feat:app build
sakul-budhathoki Nov 30, 2023
b954d73
fix: depcheck
sakul-budhathoki Nov 30, 2023
0cd7d09
fix: revert tsconfig changes
sakul-budhathoki Dec 1, 2023
d9c9371
wip: make it work
omniwired Dec 4, 2023
29bc4d5
fix(iOS): "text should be wrapped" in <Text>
omniwired Dec 5, 2023
4aff87e
fix(iOS): toripunks fonts
omniwired Dec 5, 2023
9f88b5b
fix(iOS): layout and other rendering fixes
omniwired Dec 5, 2023
67ab14c
fix: VirtualizedLists nested error for Marketplace and Stake screen
sakul-budhathoki Dec 11, 2023
3d59903
chore: patch multiformats to fix import issue on react native
sakul-budhathoki Dec 11, 2023
8912e49
fix: social feed view crash
sakul-budhathoki Dec 11, 2023
b6e7cea
feat: Drawer navigation for mobile apps
sakul-budhathoki Dec 11, 2023
156858c
fix: insets and sidebar scroll on android
sakul-budhathoki Dec 12, 2023
9b259d8
Merge branch 'main' of https://github.com/TERITORI/teritori-dapp into…
AtosGuru Dec 14, 2023
38e68f6
Merge branch 'main' of https://github.com/TERITORI/teritori-dapp into…
AtosGuru Dec 14, 2023
615f15e
fix: lint issue fixed
AtosGuru Dec 14, 2023
e84c3a7
fix: networks.json added
AtosGuru Dec 14, 2023
845a8e7
fix: lint issue fixed
AtosGuru Dec 14, 2023
98ab680
fix: depcheck done
AtosGuru Dec 14, 2023
de1c66b
fix: yarn lock has been changed
AtosGuru Dec 14, 2023
012b89f
fix: package.json add eas-cli and 1 module
AtosGuru Dec 14, 2023
93ff070
fix: package.json remove unused dep
AtosGuru Dec 14, 2023
567b146
fix: check package.json and lock file
AtosGuru Dec 14, 2023
52e91c4
feat: add networks.json
AtosGuru Dec 14, 2023
4f524b5
fix: plausible
AtosGuru Dec 15, 2023
a9bde1d
Merge branch 'main' of https://github.com/TERITORI/teritori-dapp into…
AtosGuru Dec 15, 2023
052735d
Merge remote-tracking branch 'teritori/main' into feat/app
n0izn0iz Dec 27, 2023
24dc308
fix: make the app semi-usable on simulator
n0izn0iz Dec 27, 2023
1df583d
chore: remove unused dep
n0izn0iz Dec 28, 2023
9b963eb
fix: web screen layout
n0izn0iz Dec 28, 2023
c5a01fd
feat: weshnet integration for mobile apps
sakul-budhathoki Dec 10, 2023
5e8448b
fix: message screen ui
sakul-budhathoki Dec 11, 2023
cd8fd70
message ui fix and app builds
sakul-budhathoki Dec 20, 2023
868da82
fix github action
sakul-budhathoki Dec 20, 2023
e01801c
run github action on macos
sakul-budhathoki Dec 20, 2023
1138135
fix: github action
sakul-budhathoki Dec 20, 2023
0d49c1f
fix: github action download framework from google drive
sakul-budhathoki Dec 20, 2023
88c1dfe
fix: github action issue
sakul-budhathoki Dec 20, 2023
d97fe2a
fix: github action
sakul-budhathoki Dec 20, 2023
8b40069
fix: ci
sakul-budhathoki Dec 21, 2023
3f89229
fix: github action
sakul-budhathoki Dec 21, 2023
3817e9f
fix: wesh module update for github action
sakul-budhathoki Dec 21, 2023
884b909
fix: cmd
sakul-budhathoki Dec 21, 2023
e44db79
fix: command
sakul-budhathoki Dec 21, 2023
ebd0d96
fix: eas build
sakul-budhathoki Dec 21, 2023
89a5351
fix: action
sakul-budhathoki Dec 21, 2023
aa17492
fix: action
sakul-budhathoki Dec 21, 2023
ac4a566
fix: action
sakul-budhathoki Dec 21, 2023
b4611cc
fix: cmd
sakul-budhathoki Dec 21, 2023
07623ce
try with latest xcode
sakul-budhathoki Dec 21, 2023
4f90382
fix: eas submit android
sakul-budhathoki Dec 21, 2023
7d58380
disable eas submit for now
sakul-budhathoki Dec 21, 2023
1060cc2
view xcode
sakul-budhathoki Dec 21, 2023
274321e
select xcode
sakul-budhathoki Dec 21, 2023
e2b0ea2
fix: ios
sakul-budhathoki Dec 21, 2023
cba4ded
fix: xcode version
sakul-budhathoki Dec 21, 2023
c622994
fix: xcode version
sakul-budhathoki Dec 21, 2023
3d3965c
fix: build weshframework on ci
sakul-budhathoki Dec 21, 2023
289b602
refactor: Update Toast code
sakul-budhathoki Dec 27, 2023
45f8cb6
fix: outside click, and network icon fix
sakul-budhathoki Dec 28, 2023
4053d04
fix: lint, unused-package
sakul-budhathoki Dec 29, 2023
8ef93bc
fix: tori punk font fix
sakul-budhathoki Dec 29, 2023
1ca6615
fix: regression issues
sakul-budhathoki Dec 29, 2023
332bd76
fix: dropdowns and ui fixes
sakul-budhathoki Jan 2, 2024
9373c52
fix: lint
sakul-budhathoki Jan 2, 2024
be04642
refactor: removes frameworks download from gdrive
sakul-budhathoki Jan 23, 2024
880ac7d
chore: retry ci cd build
sakul-budhathoki Jan 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .depcheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ ignores: [
"electron",
"rimraf",
"assert",
"@dotlottie/react-player",
"@lottiefiles/react-lottie-player",
"crypto",
"expo-constants",
"metro-config"
]
ignorePatterns: [
"/cache",
Expand Down
113 changes: 113 additions & 0 deletions .github/workflows/mobile-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
name: Build Mobile App

on:
push:
branches:
- main
pull_request:

jobs:
prepare:
runs-on: ubuntu-latest
steps:
- name: Set up matrix
run: echo "starting...."
build:
needs: prepare
strategy:
matrix:
include:
- platform: android
runner: ubuntu-latest
build-cmd: eas build --local --non-interactive --platform=android
- platform: ios
runner: macos-13
build-cmd: eas build --local --non-interactive --platform=ios
runs-on: ${{ matrix.runner }}
continue-on-error: true
steps:
- uses: maxim-lobanov/setup-xcode@v1
if: matrix.platform == 'ios'
with:
xcode-version: "15.1.0"

- name: Select xcode
if: matrix.platform == 'ios'
run: sudo xcode-select -s /Applications/Xcode_15.1.app

- uses: actions/setup-go@v3
with:
go-version: "1.19"

- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
cache: "yarn"
node-version: 18

- name: Fix gitignore
run: node ./cmd/fix-app-build.js

- name: Fix package.json
run: yarn remove @lottiefiles/react-lottie-player

- name: Install node modules
run: yarn install

- name: Build ios weshframework
if: matrix.platform == 'ios'
run: make check-ios-weshframework

- name: Build android weshframework
if: matrix.platform == 'android'
run: make check-android-weshframework

- name: Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

- name: Build ${{ matrix.platform }}
run: ${{ matrix.build-cmd }}

- name: EAS Submit iOS IPA
if: matrix.platform == 'ios'
run: |
IPA_FILE=$(find ./ -name 'build-*.ipa' -type f)
if [ -z "$IPA_FILE" ]; then
echo "Error: IPA file not found."
exit 1
fi

# eas submit --platform=ios --path=$IPA_FILE
echo "IPA_FILE=$IPA_FILE" >> $GITHUB_ENV

- name: Upload IPA
uses: actions/upload-artifact@v3
if: matrix.platform == 'ios'
with:
name: teritori-${{ github.sha }}-${{ matrix.platform }}.ipa
path: ${{ env.IPA_FILE }}
if-no-files-found: error

- name: EAS Submit aab
if: matrix.platform == 'android'
run: |
AAB_FILE=$(find ./ -name 'build-*.aab' -type f)
if [ -z "$AAB_FILE" ]; then
echo "Error: apk file not found."
exit 1
fi

# eas submit --platform=android --path=$AAB_FILE
echo "AAB_FILE=$AAB_FILE" >> $GITHUB_ENV

- name: Upload aab
uses: actions/upload-artifact@v3
if: matrix.platform == 'android'
with:
name: teritori-${{ github.sha }}-${{ matrix.platform }}.aab
path: ${{ env.AAB_FILE }}
if-no-files-found: error
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ web-build/
.idea/
.vscode/
/cache/
/ios
/android
/weshd/ios/Frameworks/
/weshd/android/libs/
/app-build/

# macOS
.DS_Store
Expand Down Expand Up @@ -89,3 +94,5 @@ buck-out/

# eslint
/.eslintcache


12 changes: 12 additions & 0 deletions .yarn/patches/multiformats-npm-12.1.3-dbaa26037a.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/package.json b/package.json
index 3843b15fe499bc682d81ad0680ec364b820406d6..b17cdccd376126cfdcbaa44976655964f094ecc7 100644
--- a/package.json
+++ b/package.json
@@ -5,6 +5,7 @@
"author": "Mikeal Rogers <[email protected]> (https://www.mikealrogers.com/)",
"license": "Apache-2.0 OR MIT",
"homepage": "https://github.com/multiformats/js-multiformats#readme",
+ "main": "dist/index.min.js",
"repository": {
"type": "git",
"url": "git+https://github.com/multiformats/js-multiformats.git"
18 changes: 18 additions & 0 deletions App.native.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { grpc } from "@improbable-eng/grpc-web";
import { ReactNativeTransport } from "@improbable-eng/grpc-web-react-native-transport";
import "node-libs-react-native/globals";
import "@react-native-anywhere/polyfill-base64";
import "text-encoding-polyfill";
import "react-native-url-polyfill/auto";
import "react-native-get-random-values";
import "react-native-gesture-handler";
import Constants from "expo-constants";

import Root from "./Root";

Object.entries(Constants.expoConfig?.extra?.env).forEach(([key, value]) => {
process.env[key] = `${value}`;
});

grpc.setDefaultTransport(ReactNativeTransport({}));
export default Root;
202 changes: 2 additions & 200 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,201 +1,3 @@
import {
useFonts,
Exo_600SemiBold,
Exo_500Medium,
Exo_700Bold,
} from "@expo-google-fonts/exo";
import { NavigationContainer } from "@react-navigation/native";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { StatusBar } from "expo-status-bar";
import { MetaMaskProvider } from "metamask-react";
import Plausible from "plausible-tracker";
import React, { ReactNode, memo, useEffect } from "react";
import { useForm, FormProvider } from "react-hook-form";
import { Platform, View, Text, TextStyle } from "react-native";
import { enableLegacyWebImplementation } from "react-native-gesture-handler";
import { MenuProvider } from "react-native-popup-menu";
import { SafeAreaProvider } from "react-native-safe-area-context";
import { Provider as ReduxProvider } from "react-redux";
import { PersistGate } from "redux-persist/integration/react";
import Root from "./Root";

import { MultisigDeauth } from "./packages/components/multisig/MultisigDeauth";
import { Navigator } from "./packages/components/navigation/Navigator";
import { DropdownsContextProvider } from "./packages/context/DropdownsProvider";
import { FeedbacksContextProvider } from "./packages/context/FeedbacksProvider";
import { MediaPlayerContextProvider } from "./packages/context/MediaPlayerProvider";
import { MessageContextProvider } from "./packages/context/MessageProvider";
import { SearchBarContextProvider } from "./packages/context/SearchBarProvider";
import { TNSMetaDataListContextProvider } from "./packages/context/TNSMetaDataListProvider";
import { TNSContextProvider } from "./packages/context/TNSProvider";
import { TransactionModalsProvider } from "./packages/context/TransactionModalsProvider";
import {
WalletsProvider,
useWallets,
} from "./packages/context/WalletsProvider";
import { useSelectedNetworkId } from "./packages/hooks/useSelectedNetwork";
import useSelectedWallet from "./packages/hooks/useSelectedWallet";
import { getAvailableApps } from "./packages/screens/DAppStore/query/getFromFile";
import { setAvailableApps } from "./packages/store/slices/dapps-store";
import { setSelectedWalletId } from "./packages/store/slices/settings";
import { persistor, store, useAppDispatch } from "./packages/store/store";
import { linking } from "./packages/utils/navigation";

const plausible = Plausible({
domain: "app.teritori.com",
});
plausible.enableAutoPageviews();

const queryClient = new QueryClient();

// it's here just to fix a TS2589 error
type DefaultForm = {
novalue: string;
};
// this is required for react-native-gesture-handler to work on web
enableLegacyWebImplementation(true);
// ^ required for drog and drop on the dAppStore

export default function App() {
const methods = useForm<DefaultForm>();
const [fontsLoaded] = useFonts({
Exo_500Medium,
Exo_600SemiBold,
Exo_700Bold,
});

// FIXME: Fonts don't load on electron
if (Platform.OS !== "web" && !fontsLoaded) {
return null;
}

return (
<ErrorBoundary>
<ReduxProvider store={store}>
<PersistGate
loading={
<View
style={{
width: "100%",
height: "100%",
backgroundColor: "black",
}}
/>
}
persistor={persistor}
>
<QueryClientProvider client={queryClient}>
<FormProvider<DefaultForm> {...methods}>
<MetaMaskProvider>
<NavigationContainer linking={linking}>
<SafeAreaProvider>
<FeedbacksContextProvider>
<DropdownsContextProvider>
<WalletsProvider>
<WalletSyncer />
<DappStoreApps />
<MultisigDeauth />
<SearchBarContextProvider>
<TransactionModalsProvider>
<TNSContextProvider>
<TNSMetaDataListContextProvider>
<MenuProvider>
<MessageContextProvider>
<MediaPlayerContextProvider>
<StatusBar style="inverted" />
<Navigator />
</MediaPlayerContextProvider>
</MessageContextProvider>
</MenuProvider>
</TNSMetaDataListContextProvider>
</TNSContextProvider>
</TransactionModalsProvider>
</SearchBarContextProvider>
</WalletsProvider>
</DropdownsContextProvider>
</FeedbacksContextProvider>
</SafeAreaProvider>
</NavigationContainer>
</MetaMaskProvider>
</FormProvider>
</QueryClientProvider>
</PersistGate>
</ReduxProvider>
</ErrorBoundary>
);
}

class ErrorBoundary extends React.Component<{ children: ReactNode }> {
state: {
hasError: boolean;
error?: unknown;
catchError?: unknown;
catchInfo?: React.ErrorInfo;
};

constructor(props: { children: ReactNode }) {
super(props);
this.state = { hasError: false };
}

static getDerivedStateFromError(error: unknown) {
console.log("derived state from error");
return { hasError: true, error };
}

componentDidCatch(error: unknown, info: React.ErrorInfo) {
console.log("did catch");
console.error(error, info);
this.setState({ catchError: error, catchInfo: info });
}

render() {
if (this.state.hasError) {
console.log("rendering error boundary");
// You can render any custom fallback UI
return (
<View style={{ backgroundColor: "black", height: "100%" }}>
<Text style={errorBoundaryTextCStyle}>{`${this.state.error}`}</Text>
{this.state.error !== this.state.catchError && (
<Text
style={errorBoundaryTextCStyle}
>{`${this.state.catchError}`}</Text>
)}
<Text style={errorBoundaryTextCStyle}>
{this.state.catchInfo?.componentStack}
</Text>
</View>
);
}

return this.props.children;
}
}

const errorBoundaryTextCStyle: TextStyle = { color: "white" };

const WalletSyncer: React.FC = memo(() => {
const selectedWallet = useSelectedWallet();
const selectedNetworkId = useSelectedNetworkId();
const { wallets } = useWallets();
const dispatch = useAppDispatch();
useEffect(() => {
if (!selectedWallet || selectedWallet.networkId !== selectedNetworkId) {
const newWallet = wallets.find((w) => w.networkId === selectedNetworkId);
console.log("syncing wallet", newWallet);
dispatch(setSelectedWalletId(newWallet?.id));
}
}, [dispatch, selectedNetworkId, selectedWallet, wallets]);
return null;
});

const DappStoreApps: React.FC = () => {
const dispatch = useAppDispatch();

useEffect(() => {
const dAppStoreValues = getAvailableApps();

dispatch(setAvailableApps(dAppStoreValues));
}, [dispatch]);

return null;
};
export default Root;
Loading