Commit 65ba43e3 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk Committed by Alexandre Lision

account: replace registered name with ringID

On main page we draw the ringID instead of registered name. Purpose
of this change is to share ringID when scanning QRcode instead of
sharing the blockchain username.

Change-Id: Ia159eed8815472b35d7d8d5a38f04d9edee30ddb
Reviewed-by: default avatarAlexandre Lision <alexandre.lision@savoirfairelinux.com>
parent 8ac5c84c
......@@ -164,16 +164,17 @@ static NSString* const kPreferencesIdentifier = @"PreferencesIdentifier";
}
}
}
auto name = finalChoice->registeredName();
NSString* uriToDisplay = nullptr;
if (!name.isNull() && !name.isEmpty()) {
[ringIDLabel setStringValue:[[NSString alloc] initWithFormat:@"%@", name.toNSString()]];
uriToDisplay = name.toNSString();
} else {
[ringIDLabel setStringValue:[[NSString alloc] initWithFormat:@"%@", finalChoice->username().toNSString()]];
uriToDisplay = finalChoice->username().toNSString();
}
if (qrcodeView.alphaValue == 1) {
[self drawQRCode];
}
[ringIDLabel setStringValue:uriToDisplay];
[self drawQRCode:finalChoice->username().toNSString()];
}
- (IBAction)shareRingID:(id)sender {
......@@ -187,23 +188,15 @@ static NSString* const kPreferencesIdentifier = @"PreferencesIdentifier";
- (IBAction)toggleQRCode:(id)sender {
// Toggle pressed state of QRCode button
[sender setPressed:![sender isPressed]];
if (![sender isPressed]) {
// Recenter welcome view
[self showQRCode:NO];
return;
}
[self drawQRCode];
[self showQRCode:YES];
[self showQRCode:[sender isPressed]];
}
/**
* Draw the QRCode in the qrCodeView
*/
- (void)drawQRCode
- (void)drawQRCode:(NSString*) uriToDraw
{
auto qrCode = QRcode_encodeString(ringIDLabel.stringValue.UTF8String,
auto qrCode = QRcode_encodeString(uriToDraw.UTF8String,
0,
QR_ECLEVEL_L, // Lowest level of error correction
QR_MODE_8, // 8-bit data mode
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment