Skip to content

Commit

Permalink
Fixes after merging upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
gruve-p committed Nov 11, 2024
1 parent b175304 commit bc3972d
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 74 deletions.
4 changes: 2 additions & 2 deletions blue_modules/currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ function getBTCFormatter(): Intl.NumberFormat {
minimumFractionDigits: 8,
maximumFractionDigits: 8,
});
console.debug('Created new BTC formatter');
console.debug('Created new GRS formatter');
} else {
console.debug('Using cached BTC formatter');
console.debug('Using cached GRS formatter');
}
return btcFormatter;
}
Expand Down
14 changes: 7 additions & 7 deletions ios/BlueWallet/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -155,22 +155,22 @@ - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull N
{
NSDictionary *userActivityData = @{@"activityType": userActivity.activityType, @"userInfo": userActivity.userInfo};
[self.userDefaultsGroup setValue:userActivityData forKey:@"onUserActivityOpen"];

// Check if the activity type matches the allowed types
if ([userActivity.activityType isEqualToString:@"io.bluewallet.bluewallet.receiveonchain"] ||
[userActivity.activityType isEqualToString:@"io.bluewallet.bluewallet.xpub"] ||
[userActivity.activityType isEqualToString:@"io.bluewallet.bluewallet.blockexplorer"]) {
if ([userActivity.activityType isEqualToString:@"org.groestlcoin.bluewallet123.receiveonchain"] ||
[userActivity.activityType isEqualToString:@"org.groestlcoin.bluewallet123.xpub"] ||
[userActivity.activityType isEqualToString:@"org.groestlcoin.bluewallet123.blockexplorer"]) {

[EventEmitter.sharedInstance sendUserActivity:userActivityData];
return YES;
}

if (userActivity.activityType == NSUserActivityTypeBrowsingWeb) {
return [RCTLinkingManager application:application
continueUserActivity:userActivity
restorationHandler:restorationHandler];
}

// If activity type does not match any of the specified types, do nothing
return NO;
}
Expand Down
8 changes: 4 additions & 4 deletions ios/BlueWallet/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.jpeg</string>
Expand Down Expand Up @@ -213,9 +213,9 @@
<key>INIntentClassName</key>
<string>PriceView</string>
<key>IntentName</key>
<string>Bitcoin Price</string>
<string>Groestlcoin Price</string>
<key>IntentDescription</key>
<string>Quickly view the current Bitcoin market rate.</string>
<string>Quickly view the current Groestlcoin market rate.</string>
</dict>
</array>
<key>UIRequiredDeviceCapabilities</key>
Expand Down Expand Up @@ -349,4 +349,4 @@
<key>FIREBASE_MESSAGING_AUTO_INIT_ENABLED</key>
<false/>
</dict>
</plist>
</plist>
24 changes: 12 additions & 12 deletions ios/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
"Balance" : {

},
"Bitcoin (%@)" : {
"Groestlcoin (%@)" : {

},
"Bitcoin price: %@" : {
"Groestlcoin price: %@" : {

},
"Brazil (Brazilian Real)" : {

},
"BTC" : {
"GRS" : {

},
"Canada (Canadian Dollar)" : {
Expand Down Expand Up @@ -67,10 +67,10 @@
"Currency: %@" : {

},
"Current Bitcoin Market Rate" : {
"Current Groestlcoin Market Rate" : {

},
"Current Bitcoin Price: %@" : {
"Current Groestlcoin Price: %@" : {

},
"Czech Republic (Czech Koruna)" : {
Expand All @@ -82,7 +82,7 @@
"European Union (Euro)" : {

},
"Failed to retrieve the Bitcoin market rate." : {
"Failed to retrieve the Groestlcoin market rate." : {

},
"Fiat Currency" : {
Expand Down Expand Up @@ -266,22 +266,22 @@
"Venezuela (Venezuelan Bolívar Soberano)" : {

},
"View the current Bitcoin market rate in your preferred currency." : {
"View the current Groestlcoin market rate in your preferred currency." : {

},
"View the current Bitcoin market rate in your preferred fiat currency." : {
"View the current Groestlcoin market rate in your preferred fiat currency." : {

},
"View the current Bitcoin market rate." : {
"View the current Groestlcoin market rate." : {

},
"View the current market information." : {

},
"View the current price of Bitcoin" : {
"View the current price of Groestlcoin" : {

},
"View the current price of Bitcoin." : {
"View the current price of Groestlcoin." : {

},
"View your accumulated balance." : {
Expand Down Expand Up @@ -351,4 +351,4 @@
}
},
"version" : "1.0"
}
}
2 changes: 1 addition & 1 deletion ios/Widgets/PriceWidget/CompactPriceView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct CompactPriceView: View {
.bold()
.multilineTextAlignment(.center)
.dynamicTypeSize(.large ... .accessibility5)
.accessibilityLabel("Bitcoin price: \(price)")
.accessibilityLabel("Groestlcoin price: \(price)")

VStack(alignment: .center, spacing: 8) {
Text("\(code)")
Expand Down
26 changes: 13 additions & 13 deletions ios/Widgets/PriceWidget/PriceIntent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import SwiftUI
@available(iOS 16.0, *)
struct PriceIntent: AppIntent {
// MARK: - Intent Metadata

static var title: LocalizedStringResource = "Market Rate"
static var description = IntentDescription("View the current Bitcoin market rate in your preferred currency.")
static var description = IntentDescription("View the current Groestlcoin market rate in your preferred currency.")
static var openAppWhenRun: Bool { false }

// MARK: - Parameters

@Parameter(
title: "Currency",
description: "Choose your preferred currency."
Expand All @@ -29,14 +29,14 @@ struct PriceIntent: AppIntent {
} else {
print("fiatCurrency parameter not provided. Proceeding with fallback logic.")
}

// Determine the fiat currency to use:
// 1. Use the fiatCurrency parameter if provided
// 2. Fallback to Shared Group UserDefaults
// 3. Fallback to Device's preferred currency
// 4. Default to USD
let selectedFiatCurrency: FiatUnitEnum

if let fiat = fiatCurrency {
selectedFiatCurrency = fiat
print("Using fiatCurrency parameter: \(selectedFiatCurrency.rawValue)")
Expand All @@ -52,7 +52,7 @@ struct PriceIntent: AppIntent {
selectedFiatCurrency = .USD
print("Defaulting to USD.")
}

let dataSource = selectedFiatCurrency.source
print("Data Source: \(dataSource)")

Expand Down Expand Up @@ -85,7 +85,7 @@ struct PriceIntent: AppIntent {

return .result(
value: 0.0,
dialog: "Failed to retrieve the Bitcoin market rate.",
dialog: "Failed to retrieve the Groestlcoin market rate.",
view: errorView
)
}
Expand All @@ -105,13 +105,13 @@ struct PriceIntent: AppIntent {

return .result(
value: priceDouble,
dialog: "Current Bitcoin Market Rate",
dialog: "Current Groestlcoin Market Rate",
view: view
)
}

// MARK: - Helper Methods

private func formattedDate(from isoString: String?) -> String {
guard let isoString = isoString else { return "--" }
let isoFormatter = ISO8601DateFormatter()
Expand All @@ -123,13 +123,13 @@ struct PriceIntent: AppIntent {
}
return "--"
}

private func formatPrice(_ price: Double, currencyCode: String) -> String {
let formatter = NumberFormatter()
formatter.numberStyle = .currency
formatter.locale = Locale.current // Use device's current locale
formatter.currencyCode = currencyCode

// Omit cents if price is a whole number
if price.truncatingRemainder(dividingBy: 1) == 0 {
formatter.maximumFractionDigits = 0
Expand All @@ -145,15 +145,15 @@ struct PriceIntent: AppIntent {

return formattedNumber
}

private func getCurrencySymbol(for currencyCode: String) -> String {
let formatter = NumberFormatter()
formatter.numberStyle = .currency
formatter.locale = Locale.current // Use device's current locale
formatter.currencyCode = currencyCode
return formatter.currencySymbol
}

private func getSharedCurrencyCode() -> String? {
let sharedDefaults = UserDefaults(suiteName: UserDefaultsGroupKey.GroupName.rawValue)
return sharedDefaults?.string(forKey: UserDefaultsGroupKey.PreferredCurrency.rawValue)
Expand Down
Loading

0 comments on commit bc3972d

Please sign in to comment.