Skip to content

Commit

Permalink
appcheck (#1375)
Browse files Browse the repository at this point in the history
* feat: appcheck

* fix ios build issue

* auth/config fixes

* todo

* revert attempted fix

* revert to info.plist firebase initialization

* fix pod install bug again

not sure how this keeps cropping up

* initialization is too cumbersome for now and these are safe to commit so doing so

* firebase plist files in source control for simplicity - can revisit later

* typescript fixes

* remove firebase instructions

* Update AppDelegate.mm

* Update Podfile

* Update NewAccountEphemeraScreen.tsx

* chatgpt assisted fixes

* update pods to match podfile lock in eas

* pr feedback

* code cleanup

* upgrade bundler;ruby

* Update JoinGroup.client.ts

* Update JoinGroup.client.ts

* asdf

* add android appcheck debug token

* fix ios physical device -> local backend; cleanup env management; check off todo

* use env utils everywhere

* fix typescript; rename var

* im dumb and app.config.ts can't import typescript

* script to send apk to android physical device

* update exit codes

* fix auth deduping
  • Loading branch information
technoplato authored Dec 20, 2024
1 parent 9df24dc commit 13b0666
Show file tree
Hide file tree
Showing 37 changed files with 1,683 additions and 422 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ ios/Converse.xcworkspace/xcshareddata/swiftpm/Package.resolved

# Android
/android/
build-*.apk
5 changes: 5 additions & 0 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { privySecureStorage } from "./utils/keychain/helpers";
import { initSentry } from "./utils/sentry";
import "./utils/splash/splash";
import "./features/notifications/utils";
import { setupAppAttest } from "@utils/appCheck";

LogBox.ignoreLogs([
"Privy: Expected status code 200, received 400", // Privy
Expand All @@ -65,6 +66,10 @@ const App = () => {
const styles = useStyles();
const debugRef = useRef();

useEffect(() => {
setupAppAttest();
}, []);

useCoinbaseWalletListener(true, coinbaseUrl);

useEffect(() => {
Expand Down
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ Until then Converse web will only show 1 to 1 conversations and the majority of
Web support is an end goal and the team is happy to fix any issues that are reported

### Install JS/React Native Dependencies

```
yarn
```

### Building the Web App

```
yarn start
```
Expand All @@ -72,13 +74,15 @@ yarn start
```

# Linting

```
yarn lint
```

# Testing

## Running Jest tests

Before running the tests make sure that you have a `.env` file setup with the variables variable set

```sh
Expand All @@ -88,13 +92,15 @@ yarn test
## Running Performance Tests

Capture baselines for performance tests

```sh
yarn test:perf:baseline
```

Make changes to the code to see the performance impact

Run the performance tests again to see the changes

```sh
yarn test:perf
```
Expand All @@ -103,22 +109,22 @@ yarn test:perf

Frames are expected to follow the Open Frames Standard https://github.com/open-frames/standard



# Release Processes

### Main Branch

Represents the current production code.

### Release Branches

Each release branch is based off of `main` or the release branch before it. It is used to prepare and stabilize the code for a specific release version (e.g., `release/2.0.8`).

### Feature Branches

Feature branches are longer-lived features or refactors expected to take additional time. They should be based off of the targeted feature release branch.

This structure allows code to flow **from `main` to release branches to feature branches**.


![Merge Diagram](docs/image.png)

---
Expand All @@ -128,6 +134,7 @@ This structure allows code to flow **from `main` to release branches to feature
Assuming your branch is `feature/scw`, and your feature is targeted for release `2.1.0`, follow these steps to rebase:

1. First, checkout the feature branch:

```bash
git fetch origin
git branch feature/scw -D
Expand All @@ -141,7 +148,9 @@ Assuming your branch is `feature/scw`, and your feature is targeted for release
```

### Exceptions

There are certain times where this flow does not work as intended. For example:
* Build scripts: These may need to be run off of the default main branch instead of feature or release branches.
* Read me updates: These are not required to be on a branch and can be committed directly to main.
* Bug fixes that can be OTA updated: These can be committed directly to main to perform an OTA update.

- Build scripts: These may need to be run off of the default main branch instead of feature or release branches.
- Read me updates: These are not required to be on a branch and can be committed directly to main.
- Bug fixes that can be OTA updated: These can be committed directly to main to perform an OTA update.
2 changes: 2 additions & 0 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
url: "https://sentry.io/",
},
],
["@react-native-firebase/app-check"],

"./scripts/build/android/notifeeExpoPlugin.js", // See https://github.com/invertase/notifee/issues/350
"./scripts/build/android/androidDependenciesExpoPlugin.js", // Handle some conflicting dependencies manually
"./scripts/build/android/buildGradleProperties.js", // Increase memory for building android in EAS
Expand Down
24 changes: 16 additions & 8 deletions config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { DEFAULT_SUPPORTED_CHAINS } from "@utils/evm/wallets";
import { XmtpEnv } from "@xmtp/xmtp-js";
import Constants from "expo-constants";
import { Platform } from "react-native";
import { base, baseSepolia } from "wagmi/chains";
import { getApiUri } from "./utils/apiConfig";
import { Environments, isDev, isPreview } from "./utils/getEnv";

declare const process: {
env: {
Expand Down Expand Up @@ -53,12 +54,14 @@ const defaultConfig = {

const isAndroid = Platform.OS === "android";

const apiURI = getApiUri();

const ENV = {
dev: {
...defaultConfig,
env: "dev",
apiURI,
env: Environments.dev,
xmtpEnv: (process.env.EXPO_PUBLIC_DEV_XMTP_ENV || "dev") as XmtpEnv,
apiURI: process.env.EXPO_PUBLIC_DEV_API_URI || "",
debugMenu: true,
bundleId: "com.converse.dev",
appleAppGroup: "group.com.converse.dev",
Expand All @@ -70,10 +73,13 @@ const ENV = {
),
alphaGroupChatUrl:
"https://converse.xyz/group-invite/UDv3aYZONQGc6_XPJY6Ch",
appCheckDebugToken: isAndroid
? process.env.EXPO_PUBLIC_FIREBASE_APP_CHECK_DEBUG_TOKEN_ANDROID
: process.env.EXPO_PUBLIC_FIREBASE_APP_CHECK_DEBUG_TOKEN_IOS,
},
preview: {
...defaultConfig,
env: "preview",
env: Environments.preview,
xmtpEnv: "dev",
apiURI: "https://backend-staging.converse.xyz",
debugMenu: true,
Expand All @@ -88,10 +94,11 @@ const ENV = {
].flatMap((domain) => [`https://${domain}`, `http://${domain}`, domain]),
alphaGroupChatUrl:
"https://converse.xyz/group-invite/eQAvo-WvwrdBTsHINuSMJ",
appCheckDebugToken: undefined,
},
prod: {
...defaultConfig,
env: "prod",
env: Environments.prod,
xmtpEnv: "production",
apiURI: "https://backend-prod.converse.xyz",
debugMenu: false,
Expand Down Expand Up @@ -121,13 +128,14 @@ const ENV = {
},
alphaGroupChatUrl:
"https://converse.xyz/group-invite/eQAvo-WvwrdBTsHINuSMJ",
appCheckDebugToken: undefined,
},
} as const;

const getConfig = () => {
if (__DEV__) {
export const getConfig = () => {
if (isDev) {
return ENV.dev;
} else if (Constants.expoConfig?.extra?.ENV === "preview") {
} else if (isPreview) {
return ENV.preview;
} else {
return ENV.prod;
Expand Down
4 changes: 2 additions & 2 deletions eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"node": "20.15.1",
"ios": {
"cocoapods": "1.14.3"
"cocoapods": "1.16.2"
},
"android": {
"resourceClass": "medium"
Expand All @@ -29,7 +29,7 @@
"node": "20.15.1",
"ios": {
"resourceClass": "large",
"cocoapods": "1.14.3"
"cocoapods": "1.16.2"
}
},
"production-android": {
Expand Down
1 change: 0 additions & 1 deletion features/GroupInvites/joinGroup/JoinGroup.client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { IGroupConsentOptions } from "@hooks/useGroupConsent";
import { createGroupJoinRequest, getGroupJoinRequest } from "@utils/api";
import { GroupInvite } from "@utils/api.types";
// import { getGroupIdFromTopic } from "@utils/groupUtils/groupId";
import { getV3IdFromTopic } from "@/utils/groupUtils/groupId";
import logger from "@utils/logger";
import {
Expand Down
Loading

0 comments on commit 13b0666

Please sign in to comment.