mirror of
https://github.com/nostrlabs-io/zap-stream-flutter.git
synced 2025-06-16 20:08:50 +00:00
Compare commits
1 Commits
v1.0.0
...
8e3a4cbd41
Author | SHA1 | Date | |
---|---|---|---|
8e3a4cbd41
|
@ -4,9 +4,9 @@
|
|||||||
/// To regenerate, run: `dart run slang`
|
/// To regenerate, run: `dart run slang`
|
||||||
///
|
///
|
||||||
/// Locales: 22
|
/// Locales: 22
|
||||||
/// Strings: 1650 (75 per locale)
|
/// Strings: 1653 (75 per locale)
|
||||||
///
|
///
|
||||||
/// Built on 2025-05-29 at 10:02 UTC
|
/// Built on 2025-05-29 at 11:29 UTC
|
||||||
|
|
||||||
// coverage:ignore-file
|
// coverage:ignore-file
|
||||||
// ignore_for_file: type=lint, unused_import
|
// ignore_for_file: type=lint, unused_import
|
||||||
|
@ -52,6 +52,8 @@ class Translations implements BaseTranslations<AppLocale, Translations> {
|
|||||||
/// An anonymous user
|
/// An anonymous user
|
||||||
String get anon => 'Anon';
|
String get anon => 'Anon';
|
||||||
|
|
||||||
|
String full_amount_sats({required num n}) => '${NumberFormat.decimalPattern('en').format(n)} sats';
|
||||||
|
|
||||||
/// Number of viewers of the stream
|
/// Number of viewers of the stream
|
||||||
String viewers({required num n}) => (_root.$meta.cardinalResolver ?? PluralResolvers.cardinal('en'))(n,
|
String viewers({required num n}) => (_root.$meta.cardinalResolver ?? PluralResolvers.cardinal('en'))(n,
|
||||||
one: '1 viewer',
|
one: '1 viewer',
|
||||||
@ -290,6 +292,8 @@ class TranslationsSettingsWalletEn {
|
|||||||
String get disconnect_wallet => 'Disconnect Wallet';
|
String get disconnect_wallet => 'Disconnect Wallet';
|
||||||
String get connect_1tap => '1-Tap Connection';
|
String get connect_1tap => '1-Tap Connection';
|
||||||
String get paste => 'Paste URL';
|
String get paste => 'Paste URL';
|
||||||
|
String get balance => 'Balance';
|
||||||
|
String get name => 'Wallet';
|
||||||
late final TranslationsSettingsWalletErrorEn error = TranslationsSettingsWalletErrorEn.internal(_root);
|
late final TranslationsSettingsWalletErrorEn error = TranslationsSettingsWalletErrorEn.internal(_root);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,6 +385,7 @@ extension on Translations {
|
|||||||
case 'most_zapped_streamers': return 'Most Zapped Streamers';
|
case 'most_zapped_streamers': return 'Most Zapped Streamers';
|
||||||
case 'no_user_found': return 'No user found';
|
case 'no_user_found': return 'No user found';
|
||||||
case 'anon': return 'Anon';
|
case 'anon': return 'Anon';
|
||||||
|
case 'full_amount_sats': return ({required num n}) => '${NumberFormat.decimalPattern('en').format(n)} sats';
|
||||||
case 'viewers': return ({required num n}) => (_root.$meta.cardinalResolver ?? PluralResolvers.cardinal('en'))(n,
|
case 'viewers': return ({required num n}) => (_root.$meta.cardinalResolver ?? PluralResolvers.cardinal('en'))(n,
|
||||||
one: '1 viewer',
|
one: '1 viewer',
|
||||||
other: '${NumberFormat.decimalPattern('en').format(n)} viewers',
|
other: '${NumberFormat.decimalPattern('en').format(n)} viewers',
|
||||||
@ -458,6 +463,8 @@ extension on Translations {
|
|||||||
case 'settings.wallet.disconnect_wallet': return 'Disconnect Wallet';
|
case 'settings.wallet.disconnect_wallet': return 'Disconnect Wallet';
|
||||||
case 'settings.wallet.connect_1tap': return '1-Tap Connection';
|
case 'settings.wallet.connect_1tap': return '1-Tap Connection';
|
||||||
case 'settings.wallet.paste': return 'Paste URL';
|
case 'settings.wallet.paste': return 'Paste URL';
|
||||||
|
case 'settings.wallet.balance': return 'Balance';
|
||||||
|
case 'settings.wallet.name': return 'Wallet';
|
||||||
case 'settings.wallet.error.logged_out': return 'Cant connect wallet when logged out';
|
case 'settings.wallet.error.logged_out': return 'Cant connect wallet when logged out';
|
||||||
case 'settings.wallet.error.nwc_auth_event_not_found': return 'No wallet auth event found';
|
case 'settings.wallet.error.nwc_auth_event_not_found': return 'No wallet auth event found';
|
||||||
case 'login.username': return 'Username';
|
case 'login.username': return 'Username';
|
||||||
|
@ -8,6 +8,7 @@ no_user_found: No user found
|
|||||||
"@no_user_found":
|
"@no_user_found":
|
||||||
description: No user found when searching
|
description: No user found when searching
|
||||||
anon: Anon
|
anon: Anon
|
||||||
|
full_amount_sats: ${n:decimalPattern} sats
|
||||||
viewers:
|
viewers:
|
||||||
one: 1 viewer
|
one: 1 viewer
|
||||||
other: ${n:decimalPattern} viewers
|
other: ${n:decimalPattern} viewers
|
||||||
@ -122,6 +123,8 @@ settings:
|
|||||||
disconnect_wallet: Disconnect Wallet
|
disconnect_wallet: Disconnect Wallet
|
||||||
connect_1tap: 1-Tap Connection
|
connect_1tap: 1-Tap Connection
|
||||||
paste: Paste URL
|
paste: Paste URL
|
||||||
|
balance: Balance
|
||||||
|
name: Wallet
|
||||||
error:
|
error:
|
||||||
logged_out: Cant connect wallet when logged out
|
logged_out: Cant connect wallet when logged out
|
||||||
nwc_auth_event_not_found: No wallet auth event found
|
nwc_auth_event_not_found: No wallet auth event found
|
||||||
|
@ -38,8 +38,16 @@ class WalletConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class WalletInfo {
|
||||||
|
final String name;
|
||||||
|
final int balance;
|
||||||
|
|
||||||
|
const WalletInfo({required this.name, required this.balance});
|
||||||
|
}
|
||||||
|
|
||||||
abstract class SimpleWallet {
|
abstract class SimpleWallet {
|
||||||
Future<String> payInvoice(String pr);
|
Future<String> payInvoice(String pr);
|
||||||
|
Future<WalletInfo> getInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
class NWCWrapper extends SimpleWallet {
|
class NWCWrapper extends SimpleWallet {
|
||||||
@ -60,6 +68,13 @@ class NWCWrapper extends SimpleWallet {
|
|||||||
return rsp.preimage!;
|
return rsp.preimage!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<WalletInfo> getInfo() async {
|
||||||
|
final info = await ndk.nwc.getInfo(_conn);
|
||||||
|
final balance = await ndk.nwc.getBalance(_conn);
|
||||||
|
return WalletInfo(name: info.alias, balance: balance.balanceSats);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LoginAccount {
|
class LoginAccount {
|
||||||
|
@ -87,7 +87,7 @@ class _Inner extends State<SettingsWalletPage> with ProtocolListener {
|
|||||||
queryParameters: {
|
queryParameters: {
|
||||||
"relay": nwcRelays,
|
"relay": nwcRelays,
|
||||||
"name": "zap.stream",
|
"name": "zap.stream",
|
||||||
"request_methods": "pay_invoice",
|
"request_methods": "pay_invoice get_info get_balance",
|
||||||
"icon": "https://zap.stream/logo.png",
|
"icon": "https://zap.stream/logo.png",
|
||||||
"return_to": nwaHandlerUrl,
|
"return_to": nwaHandlerUrl,
|
||||||
},
|
},
|
||||||
@ -174,13 +174,43 @@ class _Inner extends State<SettingsWalletPage> with ProtocolListener {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return BasicButton.text(
|
return FutureBuilder(
|
||||||
t.settings.wallet.disconnect_wallet,
|
future: () async {
|
||||||
onTap: (context) {
|
final wallet = await state!.getWallet();
|
||||||
_setWallet(null);
|
return await wallet?.getInfo();
|
||||||
if (context.mounted) {
|
}(),
|
||||||
context.pop();
|
builder: (context, state) {
|
||||||
}
|
return Column(
|
||||||
|
spacing: 8,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Wallet: ${state.data?.name ?? ""}",
|
||||||
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 24),
|
||||||
|
),
|
||||||
|
Text.rich(
|
||||||
|
TextSpan(
|
||||||
|
style: TextStyle(fontWeight: FontWeight.w500),
|
||||||
|
children: [
|
||||||
|
TextSpan(text: t.settings.wallet.balance),
|
||||||
|
TextSpan(text: ": "),
|
||||||
|
TextSpan(
|
||||||
|
text: t.full_amount_sats(n: state.data?.balance ?? 0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
BasicButton.text(
|
||||||
|
t.settings.wallet.disconnect_wallet,
|
||||||
|
onTap: (context) {
|
||||||
|
_setWallet(null);
|
||||||
|
if (context.mounted) {
|
||||||
|
context.pop();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user