Skip to content

Commit d963da6

Browse files
github-actions[bot]Copilotleofelix077
authored
v1.13.25 (#776)
* chore: bump app version to v1.13.25 * chore: trigger CI tests (empty commit) (#779) * Initial plan * chore: trigger CI tests --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> * [QA 1.13.25] - Fix network fetch concurrency and redirection on account delete (#782) * fix concurrency issue on delete account and selecting network * fix nav redirection after full logout * fix analytics initialize concurrency * add unit tests and rename load network function * adjust mock-dapp to allow for https tunnel --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: leofelix077 <leonardoaalf077@hotmail.com>
1 parent 273148c commit d963da6

12 files changed

Lines changed: 838 additions & 717 deletions

File tree

__tests__/ducks/auth.test.ts

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ describe("auth duck", () => {
260260
selectAccount: useAuthenticationStore.getState().selectAccount,
261261
setNavigationRef: useAuthenticationStore.getState().setNavigationRef,
262262
signIn: useAuthenticationStore.getState().signIn,
263+
initializeNetwork: useAuthenticationStore.getState().initializeNetwork,
263264
};
264265

265266
beforeEach(() => {
@@ -280,6 +281,7 @@ describe("auth duck", () => {
280281
useAuthenticationStore.getState().getAllAccounts = jest.fn();
281282
useAuthenticationStore.getState().selectAccount = jest.fn();
282283
useAuthenticationStore.getState().clearError = jest.fn();
284+
useAuthenticationStore.getState().initializeNetwork = jest.fn();
283285

284286
// Reset the store state
285287
act(() => {
@@ -1457,6 +1459,53 @@ describe("auth duck", () => {
14571459
STORAGE_KEYS.COLLECTIBLES_LIST,
14581460
);
14591461
});
1462+
1463+
it("should call resetRoot to AUTH_STACK on logout(true) even though ...initialState clears navigationRef", async () => {
1464+
const { result } = renderHook(() => useAuthenticationStore());
1465+
1466+
(dataStorage.getItem as jest.Mock).mockImplementation((key) => {
1467+
if (key === STORAGE_KEYS.ACCOUNT_LIST) {
1468+
return Promise.resolve(JSON.stringify([mockAccount]));
1469+
}
1470+
return Promise.resolve(null);
1471+
});
1472+
1473+
act(() => {
1474+
useAuthenticationStore.setState({
1475+
authStatus: AUTH_STATUS.AUTHENTICATED,
1476+
account: mockAccount,
1477+
logout: originalStoreMethods.logout,
1478+
setNavigationRef: originalStoreMethods.setNavigationRef,
1479+
});
1480+
});
1481+
1482+
act(() => {
1483+
result.current.setNavigationRef(mockNavigationRef);
1484+
});
1485+
1486+
// Confirm navigationRef is in the store before calling logout
1487+
expect(useAuthenticationStore.getState().navigationRef).toBe(
1488+
mockNavigationRef,
1489+
);
1490+
1491+
await act(async () => {
1492+
result.current.logout(true);
1493+
await new Promise((resolve) => {
1494+
setTimeout(resolve, 300);
1495+
});
1496+
});
1497+
1498+
// Key regression: navigationRef is captured before ...initialState clears
1499+
// it to null, so resetRoot must still be called with AUTH_STACK.
1500+
expect(mockNavigationRef.resetRoot).toHaveBeenCalledWith({
1501+
index: 0,
1502+
routes: [{ name: ROOT_NAVIGATOR_ROUTES.AUTH_STACK }],
1503+
});
1504+
// State should reflect NOT_AUTHENTICATED after deletion
1505+
expect(useAuthenticationStore.getState().authStatus).toBe(
1506+
AUTH_STATUS.NOT_AUTHENTICATED,
1507+
);
1508+
});
14601509
});
14611510

14621511
describe("getAuthStatus with LOCKED state", () => {
@@ -1877,4 +1926,51 @@ describe("auth duck", () => {
18771926
});
18781927
});
18791928
});
1929+
1930+
describe("initializeNetwork", () => {
1931+
it("should load TESTNET from ACTIVE_NETWORK storage and update network in store", async () => {
1932+
const { result } = renderHook(() => useAuthenticationStore());
1933+
1934+
(dataStorage.getItem as jest.Mock).mockImplementation((key) => {
1935+
if (key === STORAGE_KEYS.ACTIVE_NETWORK) {
1936+
return Promise.resolve(NETWORKS.TESTNET);
1937+
}
1938+
return Promise.resolve(null);
1939+
});
1940+
1941+
act(() => {
1942+
useAuthenticationStore.setState({
1943+
network: NETWORKS.PUBLIC,
1944+
initializeNetwork: originalStoreMethods.initializeNetwork,
1945+
});
1946+
});
1947+
1948+
await act(async () => {
1949+
await result.current.initializeNetwork();
1950+
});
1951+
1952+
expect(result.current.network).toBe(NETWORKS.TESTNET);
1953+
});
1954+
1955+
it("should keep PUBLIC network when ACTIVE_NETWORK is not in storage", async () => {
1956+
const { result } = renderHook(() => useAuthenticationStore());
1957+
1958+
(dataStorage.getItem as jest.Mock).mockImplementation(() =>
1959+
Promise.resolve(null),
1960+
);
1961+
1962+
act(() => {
1963+
useAuthenticationStore.setState({
1964+
network: NETWORKS.PUBLIC,
1965+
initializeNetwork: originalStoreMethods.initializeNetwork,
1966+
});
1967+
});
1968+
1969+
await act(async () => {
1970+
await result.current.initializeNetwork();
1971+
});
1972+
1973+
expect(result.current.network).toBe(NETWORKS.PUBLIC);
1974+
});
1975+
});
18801976
});

android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ android {
141141
minSdkVersion rootProject.ext.minSdkVersion
142142
targetSdkVersion rootProject.ext.targetSdkVersion
143143
versionCode 1234567890
144-
versionName "1.12.25"
144+
versionName "1.13.25"
145145
}
146146

147147
buildTypes {

ios/freighter-mobile.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@
505505
"$(inherited)",
506506
"@executable_path/Frameworks",
507507
);
508-
MARKETING_VERSION = 1.12.25;
508+
MARKETING_VERSION = 1.13.25;
509509
OTHER_LDFLAGS = (
510510
"$(inherited)",
511511
"-ObjC",
@@ -542,7 +542,7 @@
542542
"$(inherited)",
543543
"@executable_path/Frameworks",
544544
);
545-
MARKETING_VERSION = 1.12.25;
545+
MARKETING_VERSION = 1.13.25;
546546
OTHER_LDFLAGS = (
547547
"$(inherited)",
548548
"-ObjC",
@@ -740,7 +740,7 @@
740740
"$(inherited)",
741741
"@executable_path/Frameworks",
742742
);
743-
MARKETING_VERSION = 1.12.25;
743+
MARKETING_VERSION = 1.13.25;
744744
OTHER_LDFLAGS = (
745745
"$(inherited)",
746746
"-ObjC",
@@ -775,7 +775,7 @@
775775
"$(inherited)",
776776
"@executable_path/Frameworks",
777777
);
778-
MARKETING_VERSION = 1.12.25;
778+
MARKETING_VERSION = 1.13.25;
779779
OTHER_LDFLAGS = (
780780
"$(inherited)",
781781
"-ObjC",

ios/freighter-mobile/Info-Dev.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.12.25</string>
20+
<string>1.13.25</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleURLTypes</key>

ios/freighter-mobile/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.12.25</string>
20+
<string>1.13.25</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleURLTypes</key>

mock-dapp/.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ WALLET_KIT_PROJECT_ID=your-project-id-here
77
PORT=3001
88
HOST=127.0.0.1
99

10+
# Public URL shown to wallets in the WalletConnect session proposal.
11+
# Set this to your ngrok (or other tunnel) HTTPS URL when testing over a tunnel.
12+
# Example: PUBLIC_URL=https://hairy-nongelatinous-baylee.ngrok-free.app
13+
# Defaults to http://localhost:PORT if not set.
14+
# PUBLIC_URL=https://your-ngrok-subdomain.ngrok-free.app
15+
16+
1017
# Logging
1118
LOG_LEVEL=debug
1219

mock-dapp/src/server.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ async function startServer(): Promise<void> {
8282
console.log("🌐 Mock WalletConnect dApp Server");
8383
console.log("━".repeat(60));
8484
console.log(`📍 URL: http://${HOST}:${PORT}`);
85+
if (process.env.PUBLIC_URL) {
86+
console.log(`🌍 Public URL: ${process.env.PUBLIC_URL}`);
87+
}
8588
console.log(`🔌 Project ID: ${PROJECT_ID!.substring(0, 12)}...`);
8689
console.log(
8790
`📱 App Scheme: ${process.env.MOBILE_APP_SCHEME || "freighterdev"}`,

mock-dapp/src/walletconnect.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,14 @@ export class MockWalletConnectClient {
5353
* Initialize WalletConnect SignClient
5454
*/
5555
async initialize(): Promise<void> {
56+
const dappUrl =
57+
process.env.PUBLIC_URL || `http://localhost:${process.env.PORT || 3001}`;
5658
this.client = await SignClient.init({
5759
projectId: this.projectId,
5860
metadata: {
5961
name: "Mock WalletConnect dApp",
6062
description: "E2E testing mock dApp for Freighter Mobile",
61-
url: "http://localhost:3001",
63+
url: dappUrl,
6264
icons: ["https://docs.freighter.app/images/logo.png"],
6365
},
6466
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "freighter-mobile",
3-
"version": "1.12.25",
3+
"version": "1.13.25",
44
"license": "Apache-2.0",
55
"scripts": {
66
"android": "yarn android-dev",

0 commit comments

Comments
 (0)