mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-31 09:09:54 +08:00
1d36e2e4b2
#### PR Dependency Tree * **PR #15317** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Virtualized mobile navigation with shell navigation and interactive swipe menus; coordinated mobile back handling with interactive phases/state restoration. * Added shared auth request proxy and message-port based token handling across mobile and worker flows. * **Bug Fixes** * Hydrated remote worker error stacks for calls and observable errors. * Improved SQLite FTS/indexer and nbstore optional text handling; refined docs-search ref parsing and notification loading/retry. * **Refactor / UX** * Modal focus-preservation and pointer behavior updates; improved mobile menu controls and back gesture plugins. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
35 lines
965 B
TypeScript
35 lines
965 B
TypeScript
import { canonicalAuthEndpoint } from '@affine/mobile-shared/auth/endpoint';
|
|
import {
|
|
type AuthRequestProvider,
|
|
installAuthRequestProxy,
|
|
} from '@affine/mobile-shared/auth/request';
|
|
|
|
import { Auth } from './plugins/auth';
|
|
|
|
export const authRequestProvider: AuthRequestProvider = {
|
|
async getValidAccessToken(endpoint) {
|
|
const { token } = await Auth.getValidAccessToken({
|
|
endpoint: canonicalAuthEndpoint(endpoint),
|
|
});
|
|
return token ?? null;
|
|
},
|
|
async refreshAccessToken(endpoint) {
|
|
const { token } = await Auth.refreshAccessToken({
|
|
endpoint: canonicalAuthEndpoint(endpoint),
|
|
});
|
|
return token;
|
|
},
|
|
};
|
|
|
|
installAuthRequestProxy(authRequestProvider);
|
|
|
|
export function getValidAccessToken(endpoint: string) {
|
|
return authRequestProvider.getValidAccessToken(endpoint);
|
|
}
|
|
|
|
export async function clearEndpointSession(endpoint: string) {
|
|
await Auth.clearEndpointSession({
|
|
endpoint: canonicalAuthEndpoint(endpoint),
|
|
});
|
|
}
|