Skip to content

Commit

Permalink
feat: macos support, that works. To some extend.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCyjaneK committed Apr 1, 2024
1 parent 4e4a72b commit 27f7465
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 12 deletions.
19 changes: 18 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ import 'package:stackwallet/wallets/isar/providers/all_wallets_info_provider.dar
import 'package:stackwallet/widgets/crypto_notifications.dart';
import 'package:window_size/window_size.dart';
import 'package:monero/monero.dart' as monero_dart;
import 'package:monero/monero.dart' as wownero_dart;
import 'package:monero/wownero.dart' as wownero_dart;

final openedFromSWBFileStringStateProvider =
StateProvider<String?>((ref) => null);
Expand All @@ -87,6 +87,23 @@ final openedFromSWBFileStringStateProvider =
void main(List<String> args) async {
monero_dart.printStarts = true;
wownero_dart.printStarts = true;

// await Future.delayed(Duration(seconds: 1));
// final wptr = wownero_dart.WalletManagerFactory_getWalletManager();
// final w = wownero_dart.WalletManager_createWallet(wptr, path: '/tmp/${DateTime.now()}', password: '');
// final a = wownero_dart.Wallet_address(w);
// print("wow: $a");
// final wptr0 = monero_dart.WalletManagerFactory_getWalletManager();
// final w0 = monero_dart.WalletManager_createWallet(wptr0, path: '/tmp/${DateTime.now()}', password: '');
// final a0 = monero_dart.Wallet_address(w0);
// print("xmr: $a0");
// final wptr1 = wownero_dart.WalletManagerFactory_getWalletManager();
// final w1 = wownero_dart.WalletManager_createWallet(wptr1, path: '/tmp/${DateTime.now()}', password: '');
// final a1 = wownero_dart.Wallet_address(w1);
// print("wow: $a1");
// await Future.delayed(Duration(seconds: 1));
// exit(0);

WidgetsFlutterBinding.ensureInitialized();

if (Util.isDesktop && args.length == 2 && args.first == "-d") {
Expand Down
2 changes: 1 addition & 1 deletion lib/wallets/wallet/impl/monerodart_wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class MoneroDartWallet extends Wallet with MnemonicInterface {
"${TorService.sharedInstance.getProxyInfo().host.address}:${TorService.sharedInstance.getProxyInfo().port}" : "";
print("proxy: $proxy");
monero.Wallet_init(xmrwPtr!, daemonAddress: "$host:${node.port}", proxyAddress: proxy);
monero.Wallet_init3(xmrwPtr!, argv0: '', defaultLogBaseName: 'moneroc', console: true, logPath: '/dev/shm/log.txt');
monero.Wallet_init3(xmrwPtr!, argv0: '', defaultLogBaseName: 'moneroc', console: true, logPath: '/tmp/log-monero.txt');
syncCheckTimer?.cancel();
syncCheckTimer = Timer.periodic(const Duration(seconds: 2), (timer) {
refreshSyncTimer();
Expand Down
4 changes: 2 additions & 2 deletions lib/wallets/wallet/impl/wownerodart_wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ class WowneroDartWallet extends Wallet with MnemonicInterface {
final proxy = (TorService.sharedInstance.status == TorConnectionStatus.connected) ?
"${TorService.sharedInstance.getProxyInfo().host.address}:${TorService.sharedInstance.getProxyInfo().port}" : "";
print("proxy: $proxy");
wownero.Wallet_init(wowwPtr!, daemonAddress: "$host:${node.port}", proxyAddress: proxy);
wownero.Wallet_init3(wowwPtr!, argv0: '', defaultLogBaseName: 'wowneroc', console: true, logPath: '/dev/shm/log.txt');
wownero.Wallet_init(wowwPtr!, daemonAddress: "node.suchwow.xyz:34568", proxyAddress: proxy);
wownero.Wallet_init3(wowwPtr!, argv0: '', defaultLogBaseName: 'wowneroc', console: true, logPath: '/tmp/log-wownero.txt');
syncCheckTimer?.cancel();
syncCheckTimer = Timer.periodic(const Duration(seconds: 2), (timer) {
refreshSyncTimer();
Expand Down
18 changes: 18 additions & 0 deletions macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
B98151822A67402A009D013C /* mobileliblelantus.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = B98151802A674022009D013C /* mobileliblelantus.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
B98151842A674143009D013C /* libsqlite3.0.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = B98151832A674143009D013C /* libsqlite3.0.tbd */; };
BFD0376C00E1FFD46376BB9D /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9206484E84CB0AD93E3E68CA /* Pods_RunnerTests.framework */; };
CE9E461B2BBB049A008A49E4 /* monero_libwallet2_api_c.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = CE9E461A2BBB049A008A49E4 /* monero_libwallet2_api_c.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
CE9E461D2BBB04A8008A49E4 /* wownero_libwallet2_api_c.dylib in CopyFiles */ = {isa = PBXBuildFile; fileRef = CE9E461C2BBB04A8008A49E4 /* wownero_libwallet2_api_c.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
F653CA022D33E8B60E11A9F3 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6036BF01BF05EA773C76D22 /* Pods_Runner.framework */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -63,6 +65,17 @@
name = "Bundle Framework";
runOnlyForDeploymentPostprocessing = 0;
};
CE9E46192BBB047B008A49E4 /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 12;
dstPath = "";
dstSubfolderSpec = 10;
files = (
CE9E461D2BBB04A8008A49E4 /* wownero_libwallet2_api_c.dylib in CopyFiles */,
CE9E461B2BBB049A008A49E4 /* monero_libwallet2_api_c.dylib in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -93,6 +106,8 @@
B98151802A674022009D013C /* mobileliblelantus.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = mobileliblelantus.framework; path = ../crypto_plugins/flutter_liblelantus/scripts/macos/mobileliblelantus/mobileliblelantus.framework; sourceTree = "<group>"; };
B98151832A674143009D013C /* libsqlite3.0.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.0.tbd; path = usr/lib/libsqlite3.0.tbd; sourceTree = SDKROOT; };
BF5E76865ACB46314AC27D8F /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
CE9E461A2BBB049A008A49E4 /* monero_libwallet2_api_c.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = monero_libwallet2_api_c.dylib; sourceTree = "<group>"; };
CE9E461C2BBB04A8008A49E4 /* wownero_libwallet2_api_c.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = wownero_libwallet2_api_c.dylib; sourceTree = "<group>"; };
E6036BF01BF05EA773C76D22 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -140,6 +155,8 @@
33CC10E42044A3C60003C045 = {
isa = PBXGroup;
children = (
CE9E461C2BBB04A8008A49E4 /* wownero_libwallet2_api_c.dylib */,
CE9E461A2BBB049A008A49E4 /* monero_libwallet2_api_c.dylib */,
33FAB671232836740065AC1E /* Runner */,
33CEB47122A05771004F2AC0 /* Flutter */,
331C80D6294CF71000263BE5 /* RunnerTests */,
Expand Down Expand Up @@ -250,6 +267,7 @@
33CC110E2044A8840003C045 /* Bundle Framework */,
3399D490228B24CF009A79C7 /* ShellScript */,
529691D83C3BADE14E2EAC03 /* [CP] Embed Pods Frameworks */,
CE9E46192BBB047B008A49E4 /* CopyFiles */,
);
buildRules = (
);
Expand Down
1 change: 1 addition & 0 deletions macos/monero_libwallet2_api_c.dylib
1 change: 1 addition & 0 deletions macos/wownero_libwallet2_api_c.dylib
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ packages:
source: path
version: "0.0.1"
cw_monero:
dependency: "direct main"
dependency: transitive
description:
path: "crypto_plugins/flutter_libmonero/cw_monero"
relative: true
Expand All @@ -382,7 +382,7 @@ packages:
source: path
version: "0.0.1"
cw_wownero:
dependency: "direct main"
dependency: transitive
description:
path: "crypto_plugins/flutter_libmonero/cw_wownero"
relative: true
Expand Down
6 changes: 0 additions & 6 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ dependencies:
flutter_libmonero:
path: ./crypto_plugins/flutter_libmonero

cw_monero:
path: ./crypto_plugins/flutter_libmonero/cw_monero

cw_wownero:
path: ./crypto_plugins/flutter_libmonero/cw_wownero

cw_core:
path: ./crypto_plugins/flutter_libmonero/cw_core

Expand Down

0 comments on commit 27f7465

Please sign in to comment.