Skip to content

Commit

Permalink
Merge pull request #3850 from tloncorp/promote-6-2
Browse files Browse the repository at this point in the history
ops: promote 6.2
  • Loading branch information
arthyn authored Aug 20, 2024
2 parents 5937233 + 72e503c commit 4113e0b
Show file tree
Hide file tree
Showing 501 changed files with 20,467 additions and 7,255 deletions.
28 changes: 20 additions & 8 deletions apps/tlon-mobile/.env.sample
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
# Should only need these two to get started
# running locally
NOTIFY_PROVIDER=wannec-dozzod-marnus
NOTIFY_SERVICE=groups-native-dev
NOTIFY_SERVICE=tlon-preview-debug

# Prefills auth flow for quicker logins
DEFAULT_TLON_LOGIN_EMAIL=
DEFAULT_TLON_LOGIN_PASSWORD=
DEFAULT_SHIP_LOGIN_URL=
DEFAULT_SHIP_LOGIN_ACCESS_CODE=

# If you have to run against the hosting test cluster, use
# these (should leave blank in most cases)
API_URL=https://test.tlon.systems
SHIP_URL_PATTERN=https://{shipId}.test.tlon.systems

# Other env vars that are set in production, use as needed
# for local testing
POST_HOG_API_KEY=
API_AUTH_USERNAME=
API_AUTH_PASSWORD=
API_URL=https://test.tlon.systems
SHIP_URL_PATTERN=https://{shipId}.test.tlon.systems
DEFAULT_LURE=
DEFAULT_PRIORITY_TOKEN=
RECAPTCHA_SITE_KEY_ANDROID=
RECAPTCHA_SITE_KEY_IOS=
DEFAULT_TLON_LOGIN_EMAIL=
DEFAULT_TLON_LOGIN_PASSWORD=
DEFAULT_SHIP_LOGIN_URL=
DEFAULT_SHIP_LOGIN_ACCESS_CODE=
ENABLED_LOGGERS=query,sync
IGNORE_COSMOS=false
TLON_EMPLOYEE_GROUP=
TLON_EMPLOYEE_GROUP=
BRANCH_KEY=
BRANCH_DOMAIN=
18 changes: 16 additions & 2 deletions apps/tlon-mobile/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ sdk.dir = /Users/<user>/Library/Android/sdk
Create a keystore file for Android

```sh
cd android/app
cd apps/tlon-mobile/android/app
keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000
```

Expand Down Expand Up @@ -88,6 +88,20 @@ If your Metro bundler is running the `io.tlon.groups` package instead, you can e
pnpm bundler --dev-client --scheme io.tlon.groups.preview
```

#### Troubleshooting

If you see this while trying to run on an Android device

```
INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package io.tlon.groups signatures do not match the previously installed version; ignoring!
```

you first need to uninstall the existing app from the device using `adb`:

```sh
adb uninstall io.tlon.groups
```

## Debugging

### Dev tools
Expand All @@ -114,7 +128,7 @@ See `.env.sample` for other configurable env variables.
Update environment variables to use one of the following debug notify services for testing push notifications when building to devices:

```
# Preview Debug
# Preview Debug (preferred for now)
NOTIFY_PROVIDER=wannec-dozzod-marnus
NOTIFY_SERVICE=tlon-preview-debug
```
Expand Down
3 changes: 3 additions & 0 deletions apps/tlon-mobile/__mocks__/@dev-plugins/async-storage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { jest } from '@jest/globals';

export const useAsyncStorageDevTools = jest.fn();
3 changes: 3 additions & 0 deletions apps/tlon-mobile/__mocks__/@dev-plugins/react-navigation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { jest } from '@jest/globals';

export const useReactNavigationDevTools = jest.fn();
3 changes: 3 additions & 0 deletions apps/tlon-mobile/__mocks__/@dev-plugins/react-query.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { jest } from '@jest/globals';

export const useReactQueryDevTools = jest.fn();
12 changes: 12 additions & 0 deletions apps/tlon-mobile/__mocks__/@op-engineering/op-sqlite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { jest } from '@jest/globals';
// Mock OPSQLite modules to use better-sqlite3 instead.
import Database from 'better-sqlite3';

module.exports = {
// Disregard requested database name; use an in-memory database
open: () => new Database(),

// https://github.com/OP-Engineering/op-sqlite/issues/98#issuecomment-2122820151
isSQLCipher: jest.fn(),
moveAssetsDatabase: jest.fn(),
};
33 changes: 33 additions & 0 deletions apps/tlon-mobile/__mocks__/@react-native-community/netinfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import {
NetInfoState,
NetInfoStateType,
} from '@react-native-community/netinfo';

type Fetch = (requestedInterface?: string) => Promise<NetInfoState>;

export const fetch: Fetch = async (_requestedInterface) => {
return {
type: NetInfoStateType.wifi,
isConnected: true,
isInternetReachable: true,
details: {
ssid: null,
bssid: null,
strength: null,
ipAddress: null,
subnet: null,
frequency: null,
linkSpeed: null,
rxLinkSpeed: null,
txLinkSpeed: null,
isConnectionExpensive: false,
},
};
};

export const addEventListener = jest.fn(() => {
const unsubscribe = () => {};
return unsubscribe;
});

export default { addEventListener };
9 changes: 9 additions & 0 deletions apps/tlon-mobile/__mocks__/react-native-branch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { jest } from '@jest/globals';

export default {
subscribe: jest.fn(() => {
// return an unsubscribe mock
return jest.fn();
}),
disableTracking: jest.fn(),
};
15 changes: 15 additions & 0 deletions apps/tlon-mobile/__mocks__/react-native-screens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { jest } from '@jest/globals';
import { View } from 'react-native';

export const enableScreens = jest.fn();
export const ScreenContainer = View;
export const Screen = View;
export const NativeScreen = View;
export const NativeScreenContainer = View;
export const ScreenStack = View;
export const ScreenStackHeaderConfig = View;
export const ScreenStackHeaderSubview = View;
export const ScreenStackHeaderRightView = View;
export const ScreenStackHeaderLeftView = View;
export const ScreenStackHeaderTitleView = View;
export const ScreenStackHeaderCenterView = View;
7 changes: 7 additions & 0 deletions apps/tlon-mobile/__mocks__/react-native-webview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// https://github.com/react-native-webview/react-native-webview/issues/2959#issuecomment-1695757917
import React from 'react';
import { View } from 'react-native';

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const WebView = (props: any) => <View {...props} />;
export default WebView;
24 changes: 24 additions & 0 deletions apps/tlon-mobile/__mocks__/react-native.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { jest } from '@jest/globals';

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const originalModule = jest.requireActual('react-native') as any;

originalModule.NativeModules.SettingsManager = {
settings: {
AppleLocale: 'en-US',
AppleLanguages: ['fr-FR', 'en-US'],
},
};

originalModule.NativeModules.UrbitModule = {
clearUrbit: jest.fn(),
setUrbit: jest.fn(),
};

Object.defineProperty(originalModule, 'Settings', {
get: jest.fn(() => {
return { get: jest.fn(), set: jest.fn(), watchKeys: jest.fn() };
}),
});

module.exports = originalModule;
2 changes: 2 additions & 0 deletions apps/tlon-mobile/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
enabledLoggers: process.env.ENABLED_LOGGERS,
ignoreCosmos: process.env.IGNORE_COSMOS,
TlonEmployeeGroup: process.env.TLON_EMPLOYEE_GROUP,
branchKey: process.env.BRANCH_KEY,
branchDomain: process.env.BRANCH_DOMAIN,
},
ios: {
runtimeVersion: '4.0.1',
Expand Down
4 changes: 2 additions & 2 deletions apps/tlon-mobile/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
presets: [['babel-preset-expo', { jsxRuntime: 'automatic' }]],
plugins: [
// Allow sql imports so that we can bundle drizzle migrations.
[
Expand All @@ -14,9 +14,9 @@ module.exports = function (api) {
[
'@tamagui/babel-plugin',
{
exclude: /node_modules/,
config: './tamagui.config.ts',
components: ['@tloncorp/ui', 'tamagui'],
experimentalFlattenThemesOnNative: true,
},
],
],
Expand Down
Loading

0 comments on commit 4113e0b

Please sign in to comment.