mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-12 09:27:01 +00:00
Update themes, use PUBNET instead of testnet
This commit is contained in:
parent
f7741fa043
commit
58364a6c88
5 changed files with 219 additions and 565 deletions
Binary file not shown.
Binary file not shown.
|
@ -1498,8 +1498,6 @@ class StackTheme {
|
|||
// cheat build runner into adding this at end of property id list in isar
|
||||
@Name("zAssetsV3")
|
||||
late final ThemeAssetsV3? assetsV3;
|
||||
@Name("zAssetsV4")
|
||||
late final ThemeAssetsV4? assetsV4;
|
||||
|
||||
@ignore
|
||||
IThemeAssets get assets => assetsV3 ?? assetsV2 ?? assetsV1!;
|
||||
|
@ -1535,12 +1533,6 @@ class StackTheme {
|
|||
themeId: json["id"] as String,
|
||||
)
|
||||
: null
|
||||
..assetsV4 = version >= 4
|
||||
? ThemeAssetsV4.fromJson(
|
||||
json: Map<String, dynamic>.from(json["assets"] as Map),
|
||||
themeId: json["id"] as String,
|
||||
)
|
||||
: null
|
||||
..themeId = json["id"] as String
|
||||
..name = json["name"] as String
|
||||
..brightnessString = json["brightness"] as String
|
||||
|
@ -1929,7 +1921,6 @@ class ThemeAssets implements IThemeAssets {
|
|||
late final String wownero;
|
||||
late final String namecoin;
|
||||
late final String particl;
|
||||
late final String stellar;
|
||||
late final String bitcoinImage;
|
||||
late final String bitcoincashImage;
|
||||
late final String dogecoinImage;
|
||||
|
@ -1941,7 +1932,6 @@ class ThemeAssets implements IThemeAssets {
|
|||
late final String wowneroImage;
|
||||
late final String namecoinImage;
|
||||
late final String particlImage;
|
||||
late final String stellarImage;
|
||||
late final String bitcoinImageSecondary;
|
||||
late final String bitcoincashImageSecondary;
|
||||
late final String dogecoinImageSecondary;
|
||||
|
@ -1953,7 +1943,6 @@ class ThemeAssets implements IThemeAssets {
|
|||
late final String wowneroImageSecondary;
|
||||
late final String namecoinImageSecondary;
|
||||
late final String particlImageSecondary;
|
||||
late final String stellarImageSecondary;
|
||||
@override
|
||||
late final String? loadingGif;
|
||||
@override
|
||||
|
@ -1999,7 +1988,6 @@ class ThemeAssets implements IThemeAssets {
|
|||
..wownero = "$themeId/assets/${json["wownero"] as String}"
|
||||
..namecoin = "$themeId/assets/${json["namecoin"] as String}"
|
||||
..particl = "$themeId/assets/${json["particl"] as String}"
|
||||
..stellar = "$themeId/assets/${json["stellar"] as String}"
|
||||
..bitcoinImage = "$themeId/assets/${json["bitcoin_image"] as String}"
|
||||
..bitcoincashImage =
|
||||
"$themeId/assets/${json["bitcoincash_image"] as String}"
|
||||
|
@ -2012,7 +2000,6 @@ class ThemeAssets implements IThemeAssets {
|
|||
..wowneroImage = "$themeId/assets/${json["wownero_image"] as String}"
|
||||
..namecoinImage = "$themeId/assets/${json["namecoin_image"] as String}"
|
||||
..particlImage = "$themeId/assets/${json["particl_image"] as String}"
|
||||
..stellarImage = "$themeId/assets/${json["stellar_image"] as String}"
|
||||
..bitcoinImageSecondary =
|
||||
"$themeId/assets/${json["bitcoin_image_secondary"] as String}"
|
||||
..bitcoincashImageSecondary =
|
||||
|
@ -2035,8 +2022,6 @@ class ThemeAssets implements IThemeAssets {
|
|||
"$themeId/assets/${json["namecoin_image_secondary"] as String}"
|
||||
..particlImageSecondary =
|
||||
"$themeId/assets/${json["particl_image_secondary"] as String}"
|
||||
..stellarImageSecondary =
|
||||
"$themeId/assets/${json["stellar_image_secondary"] as String}"
|
||||
..loadingGif = json["loading_gif"] is String
|
||||
? "$themeId/assets/${json["loading_gif"] as String}"
|
||||
: null
|
||||
|
@ -2564,345 +2549,6 @@ class ThemeAssetsV3 implements IThemeAssets {
|
|||
}
|
||||
}
|
||||
|
||||
@Embedded(inheritance: false)
|
||||
class ThemeAssetsV4 implements IThemeAssets {
|
||||
@Name("bellNew")
|
||||
late final String bellNewRelative;
|
||||
@override
|
||||
@ignore
|
||||
String get bellNew => prependIfNeeded(bellNewRelative);
|
||||
|
||||
@Name("buy")
|
||||
late final String buyRelative;
|
||||
@override
|
||||
@ignore
|
||||
String get buy => prependIfNeeded(buyRelative);
|
||||
|
||||
@Name("exchange")
|
||||
late final String exchangeRelative;
|
||||
@override
|
||||
@ignore
|
||||
String get exchange => prependIfNeeded(exchangeRelative);
|
||||
|
||||
@Name("personaIncognito")
|
||||
late final String personaIncognitoRelative;
|
||||
@override
|
||||
@ignore
|
||||
String get personaIncognito => prependIfNeeded(personaIncognitoRelative);
|
||||
|
||||
@Name("personaEasy")
|
||||
late final String personaEasyRelative;
|
||||
@override
|
||||
@ignore
|
||||
String get personaEasy => prependIfNeeded(personaEasyRelative);
|
||||
|
||||
@Name("stack")
|
||||
late final String stackRelative;
|
||||
@override
|
||||
@ignore
|
||||
String get stack => prependIfNeeded(stackRelative);
|
||||
|
||||
@Name("stackIcon")
|
||||
late final String stackIconRelative;
|
||||
@override
|
||||
@ignore
|
||||
String get stackIcon => prependIfNeeded(stackIconRelative);
|
||||
|
||||
@Name("receive")
|
||||
late final String receiveRelative;
|
||||
@override
|
||||
@ignore
|
||||
String get receive => prependIfNeeded(receiveRelative);
|
||||
|
||||
@Name("receivePending")
|
||||
late final String receivePendingRelative;
|
||||
@override
|
||||
@ignore
|
||||
String get receivePending => prependIfNeeded(receivePendingRelative);
|
||||
|
||||
@Name("receiveCancelled")
|
||||
late final String receiveCancelledRelative;
|
||||
@override
|
||||
@ignore
|
||||
String get receiveCancelled => prependIfNeeded(receiveCancelledRelative);
|
||||
|
||||
@Name("send")
|
||||
late final String sendRelative;
|
||||
@override
|
||||
@ignore
|
||||
String get send => prependIfNeeded(sendRelative);
|
||||
|
||||
@Name("sendPending")
|
||||
late final String sendPendingRelative;
|
||||
@override
|
||||
@ignore
|
||||
String get sendPending => prependIfNeeded(sendPendingRelative);
|
||||
|
||||
@Name("sendCancelled")
|
||||
late final String sendCancelledRelative;
|
||||
@override
|
||||
@ignore
|
||||
String get sendCancelled => prependIfNeeded(sendCancelledRelative);
|
||||
|
||||
@Name("themeSelector")
|
||||
late final String themeSelectorRelative;
|
||||
@override
|
||||
@ignore
|
||||
String get themeSelector => prependIfNeeded(themeSelectorRelative);
|
||||
|
||||
@Name("themePreview")
|
||||
late final String themePreviewRelative;
|
||||
@override
|
||||
@ignore
|
||||
String get themePreview => prependIfNeeded(themePreviewRelative);
|
||||
|
||||
@Name("txExchange")
|
||||
late final String txExchangeRelative;
|
||||
@override
|
||||
@ignore
|
||||
String get txExchange => prependIfNeeded(txExchangeRelative);
|
||||
|
||||
@Name("txExchangePending")
|
||||
late final String txExchangePendingRelative;
|
||||
@override
|
||||
@ignore
|
||||
String get txExchangePending => prependIfNeeded(txExchangePendingRelative);
|
||||
|
||||
@Name("txExchangeFailed")
|
||||
late final String txExchangeFailedRelative;
|
||||
@override
|
||||
@ignore
|
||||
String get txExchangeFailed => prependIfNeeded(txExchangeFailedRelative);
|
||||
|
||||
@Name("loadingGif")
|
||||
late final String? loadingGifRelative;
|
||||
@override
|
||||
@ignore
|
||||
String? get loadingGif =>
|
||||
loadingGifRelative != null ? prependIfNeeded(loadingGifRelative!) : null;
|
||||
|
||||
@Name("background")
|
||||
late final String? backgroundRelative;
|
||||
@override
|
||||
@ignore
|
||||
String? get background =>
|
||||
backgroundRelative != null ? prependIfNeeded(backgroundRelative!) : null;
|
||||
|
||||
@Name("coinPlaceholder")
|
||||
late final String coinPlaceholderRelative;
|
||||
@ignore
|
||||
String get coinPlaceholder => prependIfNeeded(coinPlaceholderRelative);
|
||||
|
||||
// Added some future proof params in case we want to add anything else
|
||||
// This should provide some buffer in stead of creating assetsV4 etc
|
||||
@Name("otherStringParam2")
|
||||
late final String? dummy2;
|
||||
@Name("otherStringParam3")
|
||||
late final String? dummy3;
|
||||
|
||||
@ignore
|
||||
Map<Coin, String> get coinIcons => _coinIcons ??= parseCoinAssetsString(
|
||||
coinIconsString,
|
||||
placeHolder: coinPlaceholder,
|
||||
);
|
||||
@ignore
|
||||
Map<Coin, String>? _coinIcons;
|
||||
late final String coinIconsString;
|
||||
|
||||
@ignore
|
||||
Map<Coin, String> get coinImages => _coinImages ??= parseCoinAssetsString(
|
||||
coinImagesString,
|
||||
placeHolder: coinPlaceholder,
|
||||
);
|
||||
@ignore
|
||||
Map<Coin, String>? _coinImages;
|
||||
late final String coinImagesString;
|
||||
|
||||
@ignore
|
||||
Map<Coin, String> get coinSecondaryImages =>
|
||||
_coinSecondaryImages ??= parseCoinAssetsString(
|
||||
coinSecondaryImagesString,
|
||||
placeHolder: coinPlaceholder,
|
||||
);
|
||||
@ignore
|
||||
Map<Coin, String>? _coinSecondaryImages;
|
||||
late final String coinSecondaryImagesString;
|
||||
|
||||
@ignore
|
||||
Map<Coin, String>? get coinCardImages =>
|
||||
_coinCardImages ??= coinCardImagesString == null
|
||||
? null
|
||||
: parseCoinAssetsString(
|
||||
coinCardImagesString!,
|
||||
placeHolder: coinPlaceholder,
|
||||
);
|
||||
@ignore
|
||||
Map<Coin, String>? _coinCardImages;
|
||||
late final String? coinCardImagesString;
|
||||
|
||||
@ignore
|
||||
Map<Coin, String>? get coinCardFavoritesImages =>
|
||||
_coinCardFavoritesImages ??= coinCardFavoritesImagesString == null
|
||||
? null
|
||||
: parseCoinAssetsString(
|
||||
coinCardFavoritesImagesString!,
|
||||
placeHolder: coinPlaceholder,
|
||||
);
|
||||
@ignore
|
||||
Map<Coin, String>? _coinCardFavoritesImages;
|
||||
@Name("otherStringParam1")
|
||||
late final String? coinCardFavoritesImagesString;
|
||||
|
||||
ThemeAssetsV4();
|
||||
|
||||
factory ThemeAssetsV4.fromJson({
|
||||
required Map<String, dynamic> json,
|
||||
required String themeId,
|
||||
}) {
|
||||
return ThemeAssetsV4()
|
||||
..bellNewRelative = "$themeId/assets/${json["bell_new"] as String}"
|
||||
..buyRelative = "$themeId/assets/${json["buy"] as String}"
|
||||
..exchangeRelative = "$themeId/assets/${json["exchange"] as String}"
|
||||
..personaIncognitoRelative =
|
||||
"$themeId/assets/${json["persona_incognito"] as String}"
|
||||
..personaEasyRelative =
|
||||
"$themeId/assets/${json["persona_easy"] as String}"
|
||||
..stackRelative = "$themeId/assets/${json["stack"] as String}"
|
||||
..stackIconRelative = "$themeId/assets/${json["stack_icon"] as String}"
|
||||
..receiveRelative = "$themeId/assets/${json["receive"] as String}"
|
||||
..receivePendingRelative =
|
||||
"$themeId/assets/${json["receive_pending"] as String}"
|
||||
..receiveCancelledRelative =
|
||||
"$themeId/assets/${json["receive_cancelled"] as String}"
|
||||
..sendRelative = "$themeId/assets/${json["send"] as String}"
|
||||
..sendPendingRelative =
|
||||
"$themeId/assets/${json["send_pending"] as String}"
|
||||
..sendCancelledRelative =
|
||||
"$themeId/assets/${json["send_cancelled"] as String}"
|
||||
..themeSelectorRelative =
|
||||
"$themeId/assets/${json["theme_selector"] as String}"
|
||||
..themePreviewRelative =
|
||||
"$themeId/assets/${json["theme_preview"] as String}"
|
||||
..txExchangeRelative = "$themeId/assets/${json["tx_exchange"] as String}"
|
||||
..txExchangePendingRelative =
|
||||
"$themeId/assets/${json["tx_exchange_pending"] as String}"
|
||||
..txExchangeFailedRelative =
|
||||
"$themeId/assets/${json["tx_exchange_failed"] as String}"
|
||||
..coinPlaceholderRelative =
|
||||
"$themeId/assets/${json["coin_placeholder"] as String}"
|
||||
..coinIconsString = createCoinAssetsString(
|
||||
"$themeId/assets",
|
||||
Map<String, dynamic>.from(json["coins"]["icons"] as Map),
|
||||
)
|
||||
..coinImagesString = createCoinAssetsString(
|
||||
"$themeId/assets",
|
||||
Map<String, dynamic>.from(json["coins"]["images"] as Map),
|
||||
)
|
||||
..coinSecondaryImagesString = createCoinAssetsString(
|
||||
"$themeId/assets",
|
||||
Map<String, dynamic>.from(json["coins"]["secondaries"] as Map),
|
||||
)
|
||||
..coinCardImagesString = json["coins"]["cards"] is Map
|
||||
? createCoinAssetsString(
|
||||
"$themeId/assets",
|
||||
Map<String, dynamic>.from(json["coins"]["cards"] as Map),
|
||||
)
|
||||
: null
|
||||
..coinCardFavoritesImagesString = json["coins"]["favoriteCards"] is Map
|
||||
? createCoinAssetsString(
|
||||
"$themeId/assets",
|
||||
Map<String, dynamic>.from(json["coins"]["favoriteCards"] as Map),
|
||||
)
|
||||
: null
|
||||
..loadingGifRelative = json["loading_gif"] is String
|
||||
? "$themeId/assets/${json["loading_gif"] as String}"
|
||||
: null
|
||||
..backgroundRelative = json["background"] is String
|
||||
? "$themeId/assets/${json["background"] as String}"
|
||||
: null
|
||||
..dummy2 = null
|
||||
..dummy3 = null;
|
||||
}
|
||||
|
||||
static String prependIfNeeded(String relativePath) {
|
||||
final path = StackFileSystem.themesDir!.path;
|
||||
|
||||
if (relativePath.startsWith(path)) {
|
||||
return relativePath;
|
||||
} else {
|
||||
if (Platform.isIOS) {
|
||||
const pattern = "/var/mobile/Containers/Data/Application/";
|
||||
if (relativePath.startsWith(pattern)) {
|
||||
final parts = relativePath.split("/Library/themes/");
|
||||
if (parts.isNotEmpty) {
|
||||
return "$path/${parts.last}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "$path/$relativePath";
|
||||
}
|
||||
}
|
||||
|
||||
static String createCoinAssetsString(String path, Map<String, dynamic> json) {
|
||||
final Map<String, dynamic> map = {};
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = "$path/${entry.value as String}";
|
||||
}
|
||||
return jsonEncode(map);
|
||||
}
|
||||
|
||||
static Map<Coin, String> parseCoinAssetsString(
|
||||
String jsonString, {
|
||||
required String placeHolder,
|
||||
}) {
|
||||
final json = jsonDecode(jsonString) as Map;
|
||||
final map = Map<String, dynamic>.from(json);
|
||||
|
||||
final Map<Coin, String> result = {};
|
||||
|
||||
for (final coin in Coin.values) {
|
||||
result[coin] = map[coin.name] as String? ?? placeHolder;
|
||||
|
||||
result[coin] = prependIfNeeded(result[coin]!);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ThemeAssetsV4('
|
||||
'bellNew: $bellNew, '
|
||||
'buy: $buy, '
|
||||
'exchange: $exchange, '
|
||||
'personaIncognito: $personaIncognito, '
|
||||
'personaEasy: $personaEasy, '
|
||||
'stack: $stack, '
|
||||
'stackIcon: $stackIcon, '
|
||||
'receive: $receive, '
|
||||
'receivePending: $receivePending, '
|
||||
'receiveCancelled: $receiveCancelled, '
|
||||
'send: $send, '
|
||||
'sendPending: $sendPending, '
|
||||
'sendCancelled: $sendCancelled, '
|
||||
'themeSelector: $themeSelector, '
|
||||
'themePreview: $themePreview, '
|
||||
'txExchange: $txExchange, '
|
||||
'txExchangePending: $txExchangePending, '
|
||||
'txExchangeFailed: $txExchangeFailed, '
|
||||
'loadingGif: $loadingGif, '
|
||||
'background: $background, '
|
||||
'coinPlaceholder: $coinPlaceholder, '
|
||||
'coinIcons: $coinIcons, '
|
||||
'coinImages: $coinImages, '
|
||||
'coinSecondaryImages: $coinSecondaryImages, '
|
||||
'coinCardImages: $coinCardImages'
|
||||
'coinCardFavoritesImages: $coinCardFavoritesImages'
|
||||
')';
|
||||
}
|
||||
}
|
||||
|
||||
abstract class IThemeAssets {
|
||||
String get bellNew;
|
||||
String get buy;
|
||||
|
|
|
@ -61,7 +61,7 @@ class StellarWallet extends CoinServiceAPI
|
|||
late final TransactionNotificationTracker txTracker;
|
||||
late SecureStorageInterface _secureStore;
|
||||
|
||||
final StellarSDK stellarSdk = StellarSDK.TESTNET;
|
||||
final StellarSDK stellarSdk = StellarSDK.PUBLIC;
|
||||
|
||||
@override
|
||||
bool get isFavorite => _isFavorite ??= getCachedIsFavorite();
|
||||
|
@ -199,7 +199,7 @@ class StellarWallet extends CoinServiceAPI
|
|||
.build()
|
||||
).build();
|
||||
}
|
||||
transaction.sign(senderKeyPair, Network.TESTNET);
|
||||
transaction.sign(senderKeyPair, Network.PUBLIC);
|
||||
try {
|
||||
SubmitTransactionResponse response = await stellarSdk.submitTransaction(transaction);
|
||||
|
||||
|
@ -256,9 +256,11 @@ class StellarWallet extends CoinServiceAPI
|
|||
}
|
||||
|
||||
@override
|
||||
Future<void> exit() {
|
||||
// TODO: implement exit
|
||||
throw UnimplementedError();
|
||||
Future<void> exit() async {
|
||||
_hasCalledExit = true;
|
||||
timer?.cancel();
|
||||
timer = null;
|
||||
stopNetworkAlivePinging();
|
||||
}
|
||||
|
||||
NodeModel? _xlmNode;
|
||||
|
@ -427,7 +429,13 @@ class StellarWallet extends CoinServiceAPI
|
|||
}
|
||||
|
||||
@override
|
||||
Future<void> recoverFromMnemonic({required String mnemonic, String? mnemonicPassphrase, required int maxUnusedAddressGap, required int maxNumberOfIndexesToCheck, required int height}) async {
|
||||
Future<void> recoverFromMnemonic({
|
||||
required String mnemonic,
|
||||
String? mnemonicPassphrase,
|
||||
required int maxUnusedAddressGap,
|
||||
required int maxNumberOfIndexesToCheck,
|
||||
required int height
|
||||
}) async {
|
||||
if ((await mnemonicString) != null ||
|
||||
(await this.mnemonicPassphrase) != null) {
|
||||
throw Exception("Attempted to overwrite mnemonic on restore!");
|
||||
|
@ -472,7 +480,8 @@ class StellarWallet extends CoinServiceAPI
|
|||
.order(RequestBuilderOrder.DESC)
|
||||
.limit(1)
|
||||
.execute()
|
||||
.then((value) => value.records!.first.sequence);
|
||||
.then((value) => value.records!.first.sequence).onError((error, stackTrace) =>
|
||||
throw("Error getting chain height"));
|
||||
await updateCachedChainHeight(height);
|
||||
}
|
||||
|
||||
|
@ -484,8 +493,7 @@ class StellarWallet extends CoinServiceAPI
|
|||
Page<OperationResponse> payments = await stellarSdk.payments
|
||||
.forAccount(await getAddressSW()).order(RequestBuilderOrder.DESC)
|
||||
.execute().onError((error, stackTrace) =>
|
||||
throw("Could not fetch transactions")
|
||||
);
|
||||
throw("Could not fetch transactions"));
|
||||
|
||||
for (OperationResponse response in payments.records!) {
|
||||
// PaymentOperationResponse por;
|
||||
|
|
|
@ -182,7 +182,7 @@ abstract class DefaultNodes {
|
|||
isDown: false);
|
||||
|
||||
static NodeModel get stellar => NodeModel(
|
||||
host: "https://horizon-testnet.stellar.org",
|
||||
host: "https://horizon.stellar.org",
|
||||
port: 443,
|
||||
name: defaultName,
|
||||
id: _nodeId(Coin.stellar),
|
||||
|
|
Loading…
Reference in a new issue