Partially disable settings for slave devices
This commit is contained in:
parent
30c60d728e
commit
8c3a5f6bd8
|
@ -362,7 +362,9 @@ final class SeedVC : OnboardingBaseViewController, DeviceLinkingModalDelegate {
|
|||
|
||||
func handleDeviceLinkAuthorized(_ deviceLink: DeviceLink) {
|
||||
linkingRequestMessageSendingTimer?.invalidate()
|
||||
UserDefaults.standard.set(true, forKey: "didUpdateForMainnet")
|
||||
let userDefaults = UserDefaults.standard
|
||||
userDefaults.set(true, forKey: "didUpdateForMainnet")
|
||||
userDefaults.set(deviceLink.master.hexEncodedPublicKey, forKey: "masterDeviceHexEncodedPublicKey")
|
||||
onboardingController.verificationDidComplete(fromView: self)
|
||||
Analytics.shared.track("Device Linked Successfully")
|
||||
}
|
||||
|
|
|
@ -13,7 +13,12 @@ final class QRCodeModal : Modal {
|
|||
label.textColor = UIColor.ows_white
|
||||
// Image view
|
||||
let imageView = UIImageView()
|
||||
let hexEncodedPublicKey = OWSIdentityManager.shared().identityKeyPair()!.hexEncodedPublicKey
|
||||
let hexEncodedPublicKey: String
|
||||
if let masterDeviceHexEncodedPublicKey = UserDefaults.standard.string(forKey: "masterDeviceHexEncodedPublicKey") {
|
||||
hexEncodedPublicKey = masterDeviceHexEncodedPublicKey
|
||||
} else {
|
||||
hexEncodedPublicKey = OWSIdentityManager.shared().identityKeyPair()!.hexEncodedPublicKey
|
||||
}
|
||||
let data = hexEncodedPublicKey.data(using: .utf8)
|
||||
let filter = CIFilter(name: "CIQRCodeGenerator")!
|
||||
filter.setValue(data, forKey: "inputMessage")
|
||||
|
|
|
@ -112,6 +112,8 @@
|
|||
|
||||
- (void)updateTableContents
|
||||
{
|
||||
NSString *masterDeviceHexEncodedPublicKey = [NSUserDefaults.standardUserDefaults stringForKey:@"masterDeviceHexEncodedPublicKey"];
|
||||
BOOL isMasterDevice = (masterDeviceHexEncodedPublicKey == nil);
|
||||
OWSTableContents *contents = [OWSTableContents new];
|
||||
|
||||
__weak AppSettingsViewController *weakSelf = self;
|
||||
|
@ -123,14 +125,16 @@
|
|||
#endif
|
||||
|
||||
OWSTableSection *section = [OWSTableSection new];
|
||||
[section addItem:[OWSTableItem itemWithCustomCellBlock:^{
|
||||
return [weakSelf profileHeaderCell];
|
||||
if (isMasterDevice) {
|
||||
[section addItem:[OWSTableItem itemWithCustomCellBlock:^{
|
||||
return [weakSelf profileHeaderCell];
|
||||
}
|
||||
customRowHeight:100.f
|
||||
actionBlock:^{
|
||||
[weakSelf showProfile];
|
||||
}]];
|
||||
}
|
||||
customRowHeight:100.f
|
||||
actionBlock:^{
|
||||
[weakSelf showProfile];
|
||||
}]];
|
||||
|
||||
|
||||
if (OWSSignalService.sharedInstance.isCensorshipCircumventionActive) {
|
||||
[section
|
||||
addItem:[OWSTableItem disclosureItemWithText:
|
||||
|
@ -244,8 +248,10 @@
|
|||
|
||||
[section addItem:[OWSTableItem itemWithTitle:NSLocalizedString(@"Share Public Key", @"") actionBlock:^{ [weakSelf sharePublicKey]; }]];
|
||||
[section addItem:[OWSTableItem itemWithTitle:NSLocalizedString(@"Show QR Code", @"") actionBlock:^{ [weakSelf showQRCode]; }]];
|
||||
[section addItem:[OWSTableItem itemWithTitle:NSLocalizedString(@"Link Device", @"") actionBlock:^{ [weakSelf linkDevice]; }]];
|
||||
[section addItem:[OWSTableItem itemWithTitle:NSLocalizedString(@"Show Seed", @"") actionBlock:^{ [weakSelf showSeed]; }]];
|
||||
if (isMasterDevice) {
|
||||
[section addItem:[OWSTableItem itemWithTitle:NSLocalizedString(@"Link Device", @"") actionBlock:^{ [weakSelf linkDevice]; }]];
|
||||
[section addItem:[OWSTableItem itemWithTitle:NSLocalizedString(@"Show Seed", @"") actionBlock:^{ [weakSelf showSeed]; }]];
|
||||
}
|
||||
[section addItem:[OWSTableItem itemWithTitle:NSLocalizedString(@"Clear All Data", @"") actionBlock:^{ [weakSelf clearAllData]; }]];
|
||||
|
||||
if (TSAccountManager.sharedInstance.isDeregistered) {
|
||||
|
@ -504,7 +510,13 @@
|
|||
|
||||
- (void)sharePublicKey
|
||||
{
|
||||
NSString *hexEncodedPublicKey = OWSIdentityManager.sharedManager.identityKeyPair.hexEncodedPublicKey;
|
||||
NSString *hexEncodedPublicKey;
|
||||
NSString *masterDeviceHexEncodedPublicKey = [NSUserDefaults.standardUserDefaults stringForKey:@"masterDeviceHexEncodedPublicKey"];
|
||||
if (masterDeviceHexEncodedPublicKey != nil) {
|
||||
hexEncodedPublicKey = masterDeviceHexEncodedPublicKey;
|
||||
} else {
|
||||
hexEncodedPublicKey = OWSIdentityManager.sharedManager.identityKeyPair.hexEncodedPublicKey;
|
||||
}
|
||||
UIActivityViewController *shareVC = [[UIActivityViewController alloc] initWithActivityItems:@[ hexEncodedPublicKey ] applicationActivities:nil];
|
||||
[self presentViewController:shareVC animated:YES completion:nil];
|
||||
[LKAnalytics.shared track:@"Public Key Shared"];
|
||||
|
|
|
@ -39,7 +39,9 @@ public final class LokiAPI : NSObject {
|
|||
@objc(kind)
|
||||
public let objc_kind: String
|
||||
|
||||
public var kind: Kind { return Kind(rawValue: objc_kind)! }
|
||||
public var kind: Kind {
|
||||
return Kind(rawValue: objc_kind)!
|
||||
}
|
||||
|
||||
public enum Kind : String { case master, slave }
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
@objc public var isGroupChatMessage: Bool {
|
||||
do {
|
||||
let contentProto = try SSKProtoContent.parseData(self.content!)
|
||||
return contentProto.dataMessage!.group != nil
|
||||
return contentProto.dataMessage?.group != nil
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue