feat: add QR code login and enhance chat experience
- Add QR code login flow with scanner and confirmation screens - Implement swipe-to-reply in chat with SwipeableMessageBubble - Replace FlatList with FlashList for chat performance optimization - Add Schedule stack navigator with CourseDetail screen support - Configure deep linking for QR code login (carrotbbs://qrcode/login/:sessionId) - Update branding from 胡萝卜 to 萝卜社区 - Display dynamic app version in settings
This commit is contained in:
@@ -432,5 +432,63 @@ class AuthService {
|
||||
}
|
||||
}
|
||||
|
||||
// ── 二维码登录相关接口 ──
|
||||
|
||||
export interface QRCodeSession {
|
||||
session_id: string;
|
||||
qrcode_url: string;
|
||||
expires_in: number;
|
||||
expires_at: number;
|
||||
}
|
||||
|
||||
export interface ScanResponse {
|
||||
user: {
|
||||
id: string;
|
||||
nickname: string;
|
||||
avatar: string;
|
||||
};
|
||||
}
|
||||
|
||||
// 二维码登录 API(扩展 AuthService)
|
||||
export const qrcodeApi = {
|
||||
/**
|
||||
* 获取二维码
|
||||
*/
|
||||
getQRCode: async (): Promise<QRCodeSession> => {
|
||||
const response = await api.get<QRCodeSession>('/auth/qrcode');
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 扫描二维码
|
||||
*/
|
||||
scan: async (sessionId: string): Promise<ScanResponse> => {
|
||||
const response = await api.post<ScanResponse>('/auth/qrcode/scan', {
|
||||
session_id: sessionId,
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 确认登录
|
||||
*/
|
||||
confirm: async (sessionId: string): Promise<{ success: boolean }> => {
|
||||
const response = await api.post<{ success: boolean }>('/auth/qrcode/confirm', {
|
||||
session_id: sessionId,
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 取消登录
|
||||
*/
|
||||
cancel: async (sessionId: string): Promise<{ success: boolean }> => {
|
||||
const response = await api.post<{ success: boolean }>('/auth/qrcode/cancel', {
|
||||
session_id: sessionId,
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
};
|
||||
|
||||
// 导出认证服务实例
|
||||
export const authService = new AuthService();
|
||||
|
||||
Reference in New Issue
Block a user