Skip to content

Commit

Permalink
Fix some issues with mobile and new arch
Browse files Browse the repository at this point in the history
  • Loading branch information
jthoward64 committed Nov 18, 2024
1 parent 06855e8 commit 4511890
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 17 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"codegen",
"collapsable",
"cooldown",
"DANCEBLUE",
"datasource",
"ddns",
"Errorable",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/lib/api/scalars/GlobalId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { GraphQLScalarType, Kind } from "graphql";
import type { Result } from "ts-results-es";
import { Err, Ok } from "ts-results-es";

import { InvalidArgumentError } from "../../error/direct.js";
import { InvalidArgumentError } from "../../error/index.js";
import {
arrayToBase64String,
base64StringToArray,
Expand Down
4 changes: 2 additions & 2 deletions packages/common/lib/error/control.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { AuthorizationRule } from "@ukdanceblue/common";
import { prettyPrintAuthorizationRule } from "@ukdanceblue/common";
import type { GraphQLResolveInfo } from "graphql";
import type { Path } from "graphql/jsutils/Path.js";

import type { AuthorizationRule } from "../authorization/accessControl.js";
import { prettyPrintAuthorizationRule } from "../authorization/accessControl.js";
import { ConcreteError } from "./error.js";
import * as ErrorCode from "./errorCode.js";

Expand Down
7 changes: 4 additions & 3 deletions packages/common/lib/error/luxon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import type { DateTime, Duration, Interval } from "luxon";
import type { Result } from "ts-results-es";
import { Err, Ok } from "ts-results-es";

import { ConcreteError, ErrorCode } from "./index.js";
import { ConcreteError } from "./error.js";
import { LuxonError as ErrorCodeLuxonError } from "./errorCode.js";

export class LuxonError extends ConcreteError {
constructor(
Expand All @@ -22,8 +23,8 @@ export class LuxonError extends ConcreteError {
return this.value.invalidExplanation ?? this.message;
}

get tag(): ErrorCode.LuxonError {
return ErrorCode.LuxonError;
get tag(): ErrorCodeLuxonError {
return ErrorCodeLuxonError;
}

readonly expose = true;
Expand Down
4 changes: 2 additions & 2 deletions packages/common/lib/error/option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Err, None, Ok, Some } from "ts-results-es";

import type { NotFoundError } from "./direct.js";
import type { ConcreteError } from "./error.js";
import { ErrorCode } from "./index.js";
import { NotFound as ErrorCodeNotFound } from "./errorCode.js";

export function optionOf<T>(value: T | null | undefined): Option<T> {
return value == null ? None : Some(value);
Expand All @@ -17,7 +17,7 @@ export function extractNotFound<T, E extends ConcreteError>(
): Result<Option<T>, E> {
return result.isErr()
? result.orElse((error) =>
error.tag === ErrorCode.NotFound ? Ok(None) : Err(error)
error.tag === ErrorCodeNotFound ? Ok(None) : Err(error)
)
: result.map((value) => optionOf(value));
}
15 changes: 12 additions & 3 deletions packages/mobile/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ To bump the app's version:
const bundleVersion: Version = {
major: 2,
minor: 8,
patch: 0,
patch: 1,
} as const;
const nativeVersion: Version = {
major: 2,
minor: 8,
patch: 0,
patch: 1,
} as const;

// Both the sum of version.patch + buildsThisVersion and the sum of baseBuildCount + buildsThisVersion must increase each time a native build is submitted.
const baseBuildCount = 44;
const baseBuildCount = 45;
const buildsThisVersion = 1;

/*
Expand Down Expand Up @@ -93,6 +93,7 @@ export default ({ config }: ConfigContext): ExpoConfig => {
iosBuildString: buildNumber,
runtimeVersion,
qualifiedName,
allowHttp: IS_DEV,
});
};

Expand All @@ -112,6 +113,7 @@ function makeExpoConfig({
iosBuildString,
runtimeVersion,
qualifiedName,
allowHttp,
}: {
baseConfig: Partial<ExpoConfig>;
name: "DB DEV CLIENT" | "DanceBlue";
Expand All @@ -121,6 +123,7 @@ function makeExpoConfig({
iosBuildString: SemVer;
runtimeVersion: SemVer;
qualifiedName: DanceBlueQualifiedName;
allowHttp: boolean;
}): ExpoConfig {
const iosConfig = baseConfig.ios ?? {};
const androidConfig = baseConfig.android ?? {};
Expand All @@ -130,6 +133,12 @@ function makeExpoConfig({
androidConfig.versionCode = androidBuildNumber;

iosConfig.bundleIdentifier = qualifiedName;
iosConfig.infoPlist = {
...iosConfig.infoPlist,
NSAppTransportSecurity: {
NSAllowsArbitraryLoads: allowHttp,
},
};
androidConfig.package = qualifiedName;

return {
Expand Down
6 changes: 4 additions & 2 deletions packages/mobile/babel.config.cjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/**
*
* @param {import('@babel/core').ConfigAPI} api
* @returns {import('@babel/core').TransformOptions}
*/
module.exports = function babel() {
module.exports = function babel(api) {
api.cache.forever();

return {
presets: ["babel-preset-expo"],
plugins: ["react-native-reanimated/plugin"],
Expand Down
3 changes: 1 addition & 2 deletions packages/mobile/src/common/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import { useLoading } from "@/context/useLoading";

import { API_BASE_URL } from "./apiUrl";
import { Logger } from "./logger/Logger";

export const DANCEBLUE_TOKEN_KEY = "danceblue-auth-token";
import { DANCEBLUE_TOKEN_KEY } from "./storage-tokens";

function getLoginUrl(source: AuthSource): string {
let urlComponent = "";
Expand Down
1 change: 1 addition & 0 deletions packages/mobile/src/common/storage-tokens.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const DANCEBLUE_TOKEN_KEY = "danceblue-auth-token";
2 changes: 1 addition & 1 deletion packages/mobile/src/context/urql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { createContext, useContext, useMemo, useReducer } from "react";
import { cacheExchange, Client, fetchExchange, Provider } from "urql";

import { API_BASE_URL } from "@/common/apiUrl";
import { DANCEBLUE_TOKEN_KEY } from "@/common/auth";
import { DANCEBLUE_TOKEN_KEY } from "@/common/storage-tokens";

const invalidateCacheContext = createContext<() => void>(() => undefined);

Expand Down
9 changes: 9 additions & 0 deletions packages/mobile/src/graphql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,15 @@ export const FundraisingEntryResolverStringFilterKeys = {

export type FundraisingEntryResolverStringFilterKeys =
(typeof FundraisingEntryResolverStringFilterKeys)[keyof typeof FundraisingEntryResolverStringFilterKeys];
export const FundraisingEntryType = {
Cash: "Cash",
Check: "Check",
Legacy: "Legacy",
Online: "Online",
} as const;

export type FundraisingEntryType =
(typeof FundraisingEntryType)[keyof typeof FundraisingEntryType];
export const ImageResolverAllKeys = {
Alt: "alt",
CreatedAt: "createdAt",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { universalCatch } from "@/common/logging";
import type { FragmentType } from "@/graphql/index";
import { getFragmentData } from "@/graphql/index";

import { ProfileScreenAuthFragment } from ".";
import { ProfileScreenAuthFragment } from "./ProfileScreen";

export const ProfileFooter = ({
profileScreenAuthFragment,
Expand Down

0 comments on commit 4511890

Please sign in to comment.