Enhance content management and user interaction features
- Introduced a new content source toggle in the profile and app header to switch between IndeeHub and TopDoc films. - Updated the content fetching logic to dynamically load content based on the selected source. - Enhanced the seeding process to include a combined catalog of IndeeHub and TopDoc films, ensuring diverse content availability. - Improved user interaction by preventing duplicate reactions and ensuring a smoother voting experience across comments and content. - Added support for Amber login (NIP-55) for Android users, integrating it into the existing authentication flow. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { ref, computed, onUnmounted } from 'vue'
|
||||
import { Accounts } from 'applesauce-accounts'
|
||||
import { accountManager } from '../lib/accounts'
|
||||
import { accountManager, AmberClipboardSigner, AmberClipboardAccount } from '../lib/accounts'
|
||||
import { TEST_PERSONAS, TASTEMAKER_PERSONAS } from '../data/testPersonas'
|
||||
import type { Subscription } from 'rxjs'
|
||||
|
||||
@@ -101,6 +101,35 @@ export function useAccounts() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Amber signer is supported on this platform (Android + clipboard)
|
||||
*/
|
||||
const isAmberSupported = computed(() => !!AmberClipboardSigner.SUPPORTED)
|
||||
|
||||
/**
|
||||
* Login with Amber (NIP-55 Android Signer).
|
||||
* Uses the AmberClipboardSigner to request the pubkey via Android intents.
|
||||
* The signer is retained for future event signing (comments, reactions, etc.)
|
||||
*/
|
||||
async function loginWithAmber() {
|
||||
isLoggingIn.value = true
|
||||
loginError.value = null
|
||||
try {
|
||||
const signer = new AmberClipboardSigner()
|
||||
const pubkey = await signer.getPublicKey()
|
||||
const account = new AmberClipboardAccount(pubkey, signer)
|
||||
accountManager.addAccount(account)
|
||||
accountManager.setActive(account)
|
||||
return pubkey
|
||||
} catch (err: any) {
|
||||
loginError.value = err.message || 'Amber login failed'
|
||||
console.error('Amber login error:', err)
|
||||
throw err
|
||||
} finally {
|
||||
isLoggingIn.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Logout current account
|
||||
*/
|
||||
@@ -142,8 +171,12 @@ export function useAccounts() {
|
||||
loginWithExtension,
|
||||
loginWithPersona,
|
||||
loginWithPrivateKey,
|
||||
loginWithAmber,
|
||||
logout,
|
||||
|
||||
// Platform checks
|
||||
isAmberSupported,
|
||||
|
||||
// Personas for dev UI
|
||||
testPersonas,
|
||||
tastemakerPersonas,
|
||||
|
||||
Reference in New Issue
Block a user