Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nostr connect #1227

Open
wants to merge 68 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
ddcafa7
comments platform
sarthak13gupta Jul 22, 2023
4d1c991
merge changes
sarthak13gupta Jul 22, 2023
5062f78
toggle comments check
sarthak13gupta Jul 23, 2023
cc0cdc8
adding nostr screen
sarthak13gupta Jul 25, 2023
2926867
Merge remote-tracking branch 'origin/toggle_comments_check' into nost…
sarthak13gupta Jul 25, 2023
4ddc46b
nostr screen login/logout
sarthak13gupta Jul 27, 2023
e93e05a
Merge branch 'master' of https://github.com/breez/breezmobile into co…
sarthak13gupta Jul 27, 2023
ea79bd3
Merge branch 'master' of https://github.com/breez/breezmobile into to…
sarthak13gupta Jul 27, 2023
93a0761
toggle comments changes
sarthak13gupta Jul 27, 2023
5f7e0da
Disable Nostr title corrected
sarthak13gupta Jul 27, 2023
87cffd5
Merge branch 'toggle_comments_check' of https://github.com/sarthak13g…
sarthak13gupta Jul 29, 2023
610bed5
anytime ref changes
sarthak13gupta Jul 29, 2023
71ec1b8
Merge branch 'master' of https://github.com/sarthak13gupta/breezmobil…
sarthak13gupta Jul 29, 2023
1a66294
Merge branch 'nostr_screen_check' of https://github.com/sarthak13gupt…
sarthak13gupta Jul 29, 2023
050959a
Merge branch 'comments_platform' of https://github.com/sarthak13gupta…
sarthak13gupta Jul 29, 2023
69a2d14
Merge branch 'nostr_screen' of https://github.com/sarthak13gupta/bree…
sarthak13gupta Jul 29, 2023
a4e1dfb
anytime ref
sarthak13gupta Jul 29, 2023
c7df79c
Merge branch 'nostr_screen' of https://github.com/sarthak13gupta/bree…
sarthak13gupta Jul 29, 2023
7d180ca
login via comments platform
sarthak13gupta Jul 29, 2023
2896791
login from snort
sarthak13gupta Jul 29, 2023
00768ff
Merge branch 'master' into comments_platform
sarthak13gupta Aug 3, 2023
d129527
added primal and publishing relays
sarthak13gupta Aug 6, 2023
3cb85da
merge changes
sarthak13gupta Aug 6, 2023
0b5c827
previous primal logo removed
sarthak13gupta Aug 6, 2023
9100324
commentsBloc -> NostrCommentBloc
sarthak13gupta Aug 11, 2023
111cba4
Merge branch 'comments_platform' of https://github.com/sarthak13gupta…
sarthak13gupta Aug 11, 2023
7c89fcb
Merge branch 'master' of https://github.com/sarthak13gupta/breezmobil…
sarthak13gupta Aug 11, 2023
fece6dd
nostr-connect
sarthak13gupta Aug 11, 2023
232c075
merge_conflicts
sarthak13gupta Aug 11, 2023
a38365a
mobile scanner -> 3.3.0
sarthak13gupta Aug 11, 2023
8b06da9
saving relays in preferences
sarthak13gupta Aug 11, 2023
36716be
anytime ref changes
sarthak13gupta Aug 11, 2023
0a6682b
removing unwanted comments
sarthak13gupta Aug 11, 2023
5a834e0
nostr_connecting changes added back
sarthak13gupta Aug 11, 2023
7ee847b
connecting an app
sarthak13gupta Aug 14, 2023
c534252
listening to pubkey and sign_event requests
sarthak13gupta Aug 15, 2023
e24e7a2
review changes part-1
sarthak13gupta Aug 15, 2023
22e0afe
anytime ref changes
sarthak13gupta Aug 15, 2023
f37483d
making nostrPrivateKey a private field in the NostrBloc class
sarthak13gupta Aug 18, 2023
5cfabec
merge changes nostr_preferences
sarthak13gupta Aug 18, 2023
9b0b60f
removing secure_storage
sarthak13gupta Aug 19, 2023
032060e
LoginWithImportedNostrKey-> StoreNostrKey
sarthak13gupta Aug 23, 2023
bff6f67
moving nostrSettings inside nostrBloc (part-1)
sarthak13gupta Aug 25, 2023
43ee2e6
moving nostrSettings inside nostrBloc (part-2) completed
sarthak13gupta Aug 25, 2023
225aa13
nip04 operations corrected
sarthak13gupta Aug 25, 2023
f2d5954
nip04 operations corrected(nostrBloc)
sarthak13gupta Aug 25, 2023
f898084
injecting nostrComments from BreezMobile to Anytime(without toggling)
sarthak13gupta Sep 5, 2023
40ed1d7
toggling comments added
sarthak13gupta Sep 6, 2023
46fad4e
Merge branch 'master' into comments_platform
sarthak13gupta Sep 7, 2023
5304183
merge conflicts
sarthak13gupta Sep 7, 2023
d8abd95
aligning nostrComments with nostr_preferences
sarthak13gupta Sep 7, 2023
5019311
Merge branch 'master' into nostr_preferences
sarthak13gupta Sep 16, 2023
d6413f7
mobile_scanner 3.3.0 changes
sarthak13gupta Sep 17, 2023
c257cd0
merge conflicts
sarthak13gupta Sep 17, 2023
528a4e8
nip04encrypt and nip04decrypt changes
sarthak13gupta Sep 26, 2023
7f1d0b4
nostr connect bloc changes
sarthak13gupta Sep 26, 2023
3bc4a06
error changes
sarthak13gupta Sep 26, 2023
615db33
nostr connect complete(saving apps connected)
sarthak13gupta Oct 1, 2023
ca35ef3
nostr connect complete
sarthak13gupta Oct 8, 2023
433f399
cleaning up code
sarthak13gupta Oct 9, 2023
eb105fa
nostr connect merge changes
sarthak13gupta Oct 9, 2023
7386fec
nostr_preferences merge changes
sarthak13gupta Oct 9, 2023
0a59d5b
merge changes
sarthak13gupta Oct 9, 2023
52b9441
merge changes from nostr_preferences
sarthak13gupta Oct 9, 2023
1097d31
added nostr back to the preferences(error caused via merge)
sarthak13gupta Oct 11, 2023
d447a5e
added anytime ref
sarthak13gupta Oct 11, 2023
f4856f2
Merge branch 'master' into nostr_connect
sarthak13gupta Oct 19, 2023
dc10259
Merge branch 'master' into nostr_connect
sarthak13gupta Nov 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/bloc/app_blocs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:breez/bloc/connect_pay/connect_pay_bloc.dart';
import 'package:breez/bloc/fastbitcoins/fastbitcoins_bloc.dart';
import 'package:breez/bloc/lnurl/lnurl_bloc.dart';
import 'package:breez/bloc/marketplace/marketplace_bloc.dart';
import 'package:breez/bloc/nostr/nostr_bloc.dart';
import 'package:breez/bloc/payment_options/payment_options_bloc.dart';
import 'package:breez/bloc/podcast_clip/podcast_clip_bloc.dart';
import 'package:breez/bloc/podcast_history/podcast_history_bloc.dart';
Expand All @@ -26,6 +27,7 @@ class AppBlocs {
final InvoiceBloc invoicesBloc;
final ConnectPayBloc connectPayBloc;
final BackupBloc backupBloc;
final NostrBloc nostrBloc;
final MarketplaceBloc marketplaceBloc;
final FastbitcoinsBloc fastbitcoinsBloc;
final LSPBloc lspBloc;
Expand Down Expand Up @@ -72,8 +74,12 @@ class AppBlocs {
ConnectPayBloc(userProfileBloc.userStream, accountBloc.accountStream,
accountBloc.userActionsSink),
blocsByType);
MarketplaceBloc marketplaceBloc =
_registerBloc(MarketplaceBloc(), blocsByType);
NostrBloc nostrBloc = _registerBloc(NostrBloc(), blocsByType);
MarketplaceBloc marketplaceBloc = _registerBloc(
MarketplaceBloc(
nostrBloc.nostrSettingsStream,
),
blocsByType);
LSPBloc lspBloc =
_registerBloc(LSPBloc(accountBloc.accountStream), blocsByType);
LNUrlBloc lnurlBloc = _registerBloc(LNUrlBloc(), blocsByType);
Expand Down Expand Up @@ -110,6 +116,7 @@ class AppBlocs {
invoicesBloc,
connectPayBloc,
backupBloc,
nostrBloc,
marketplaceBloc,
fastbitcoinsBloc,
lspBloc,
Expand All @@ -129,6 +136,7 @@ class AppBlocs {
this.invoicesBloc,
this.connectPayBloc,
this.backupBloc,
this.nostrBloc,
this.marketplaceBloc,
this.fastbitcoinsBloc,
this.lspBloc,
Expand Down
28 changes: 8 additions & 20 deletions lib/bloc/marketplace/marketplace_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,27 @@ import 'dart:async';
import 'dart:convert';

import 'package:breez/bloc/marketplace/vendor_model.dart';
import 'package:breez/bloc/nostr/nostr_model.dart';
import 'package:flutter/services.dart';
import 'package:rxdart/rxdart.dart';
import 'package:shared_preferences/shared_preferences.dart';

import 'nostr_settings.dart';

class MarketplaceBloc {
final _vendorController = BehaviorSubject<List<VendorModel>>();
Stream<List<VendorModel>> get vendorsStream => _vendorController.stream;

bool _isSnortToggled;
SharedPreferences pref;

final _nostrSettingsController = BehaviorSubject<NostrSettings>();
Stream<NostrSettings> get nostrSettingsStream =>
_nostrSettingsController.stream;
Sink<NostrSettings> get nostrSettingsSettingsSink =>
_nostrSettingsController.sink;

MarketplaceBloc() {
MarketplaceBloc(Stream<NostrSettings> nostrSettingsStream) {
loadVendors();

_listenNostrSettings();
_initNostrSettings();
}

_initNostrSettings() async {
_nostrSettingsController.add(NostrSettings.initial());
_listenNostrSettings(nostrSettingsStream);
}

_listenNostrSettings() async {
SharedPreferences pref = await SharedPreferences.getInstance();
_listenNostrSettings(Stream<NostrSettings> nostrSettingsStream) async {
pref = await SharedPreferences.getInstance();
nostrSettingsStream.listen((settings) async {
_isSnortToggled = settings.showSnort;
_isSnortToggled = settings.enableNostr;
pref.setString(NostrSettings.NOSTR_SETTINGS_PREFERENCES_KEY,
json.encode(settings.toJson()));
await loadVendors();
Expand All @@ -48,6 +36,7 @@ class MarketplaceBloc {
List<VendorModel> vendorList = vendorListFromJson(jsonVendors);
if (_isSnortToggled) {
vendorList.removeWhere((element) => element.displayName == "Snort");
vendorList.removeWhere((element) => element.displayName == "Primal");
_vendorController.add(vendorList);
} else {
_vendorController.add(vendorListFromJson(jsonVendors));
Expand All @@ -57,6 +46,5 @@ class MarketplaceBloc {

close() {
_vendorController.close();
_nostrSettingsController.close();
}
}
43 changes: 0 additions & 43 deletions lib/bloc/marketplace/nostr_settings.dart

This file was deleted.

54 changes: 50 additions & 4 deletions lib/bloc/nostr/nostr_actions.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import 'package:breez/bloc/async_action.dart';
import 'package:breez/utils/nostrConnect.dart';

import 'nostr_bloc.dart';

class GetPublicKey extends AsyncAction {
GetPublicKey();
}

class SignEvent extends AsyncAction {
final Map<String, dynamic> eventObject;
final String privateKey;

SignEvent(this.eventObject, this.privateKey);
SignEvent(
this.eventObject,
);
}

class GetRelays extends AsyncAction {}
Expand All @@ -17,12 +21,54 @@ class Nip04Encrypt extends AsyncAction {
final String data;
final String publicKey;

Nip04Encrypt(this.data, this.publicKey);
Nip04Encrypt(
this.data,
this.publicKey,
);
}

class Nip04Decrypt extends AsyncAction {
final String encryptedData;
final String publicKey;

Nip04Decrypt(
this.encryptedData,
this.publicKey,
);
}

class StoreImportedPrivateKey extends AsyncAction {
final String privateKey;
StoreImportedPrivateKey({
this.privateKey,
});
}

class DeleteKey extends AsyncAction {
DeleteKey();
}

class PublishRelays extends AsyncAction {
final List<String> userRelayList;
PublishRelays({
this.userRelayList,
});
}

class Nip46Connect extends AsyncAction {
final ConnectUri connectUri;
final NostrBloc nostrBloc;
Nip46Connect({
this.connectUri,
this.nostrBloc,
});
}

Nip04Decrypt(this.encryptedData, this.privateKey);
class Nip46Disconnect extends AsyncAction {
final ConnectUri connectUri;
final NostrBloc nostrBloc;
Nip46Disconnect({
this.connectUri,
this.nostrBloc,
});
}
Loading
Loading