[READ ONLY MIRROR] Open Source TikTok alternative built on AT Protocol github.com/sprksocial/client
flutter atproto video dart
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update ProfileScreen.tsx

C3B 577670c0 72335c31

+1 -34
+1 -34
app/(tabs)/ProfileScreen.tsx
··· 64 64 const colorScheme = useColorScheme(); 65 65 const route = useRouter(); 66 66 67 - // Get actual login status and user data from useAtProto hook 68 67 const { isLoggedIn, session, agent, logout } = useAtProto(); 69 68 70 - // This is the user's own profile if logged in 71 69 const isMine = !true; 72 70 73 - // User's DID comes from session when logged in, otherwise use mock DID 74 71 const userDid = isLoggedIn && session ? session.did : did; 75 72 76 73 const [userData, setUserData] = useState<UserProps | null>(null); ··· 78 75 79 76 const loadVideoPosts = async () => { 80 77 try { 81 - // Use the actual user DID when logged in 82 78 const mediaPosts = await getProfileMedia(userDid, 'video'); 83 79 const posts = mediaPosts.map((item: any) => item.post); 84 80 setVideoPosts(posts); ··· 91 87 if (isLoggedIn || (!isLoggedIn && !isMine)) { 92 88 const loadProfileData = async () => { 93 89 try { 94 - // Use the actual user DID when logged in 95 90 const profileData = await getProfile(userDid); 96 91 if (profileData) { 97 92 setUserData({ ··· 117 112 } catch (error) { 118 113 console.error('Error loading profile:', error); 119 114 120 - // If there's an error loading the profile but we're logged in, 121 - // at least display some basic info from the session 122 115 if (isLoggedIn && session) { 123 116 setUserData({ 124 117 id: session.did, ··· 182 175 } 183 176 } 184 177 185 - // Handle logout 186 178 const handleLogout = async () => { 187 179 try { 188 180 await logout(); 189 - // You might want to navigate to a different screen or refresh the UI 190 181 console.log('User logged out'); 191 182 } catch (error) { 192 183 console.error('Error logging out:', error); ··· 255 246 width: '100%', 256 247 }, 257 248 profileActionButtonsVertical: { 249 + display: 'flex', 258 250 flexDirection: 'column', 259 - justifyContent: 'center', 260 251 alignItems: 'center', 261 252 gap: 10, 262 253 width: '100%', 263 254 }, 264 - loginStatusContainer: { 265 - flexDirection: 'row', 266 - alignItems: 'center', 267 - marginTop: 10, 268 - }, 269 - loginStatusIndicator: { 270 - width: 10, 271 - height: 10, 272 - borderRadius: 5, 273 - backgroundColor: Colors[colorScheme ?? 'light'].selectedIcon, 274 - marginRight: 5, 275 - }, 276 - loginStatusText: { 277 - color: Colors[colorScheme ?? 'light'].text, 278 - }, 279 255 }); 280 256 281 257 return ( ··· 319 295 {userData && <ProfilePicture userData={userData} />} 320 296 {userData && <ProfileInfo userData={userData} />} 321 297 322 - {/* Login status indicator */} 323 - {isLoggedIn && ( 324 - <View style={styles.loginStatusContainer}> 325 - <View style={styles.loginStatusIndicator} /> 326 - <ThemedText style={styles.loginStatusText}>Logged in as {session?.handle}</ThemedText> 327 - </View> 328 - )} 329 - 330 298 { 331 299 !isLoggedIn && isMine && ( 332 300 <View style={styles.profileActionButtonsVertical}> ··· 369 337 } 370 338 { 371 339 isLoggedIn && isMine && ( 372 - // Logged in and viewing own profile => Show logout button 373 340 <View style={styles.profileActionButtons}> 374 341 <ActionButton 375 342 type="outline"