mirror of https://github.com/oxen-io/session-ios
parent
964eb28f1b
commit
75c7cc4abf
@ -0,0 +1,15 @@
|
||||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DebugUIPage.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class TSThread;
|
||||
|
||||
@interface DebugUIMisc : DebugUIPage
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -0,0 +1,90 @@
|
||||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DebugUIMisc.h"
|
||||
#import "Environment.h"
|
||||
#import "OWSCountryMetadata.h"
|
||||
#import "OWSTableViewController.h"
|
||||
#import "SecurityUtils.h"
|
||||
#import "Signal-Swift.h"
|
||||
#import "ThreadUtil.h"
|
||||
#import <AFNetworking/AFNetworking.h>
|
||||
#import <AxolotlKit/PreKeyBundle.h>
|
||||
#import <SignalServiceKit/OWSDisappearingConfigurationUpdateInfoMessage.h>
|
||||
#import <SignalServiceKit/OWSDisappearingMessagesConfiguration.h>
|
||||
#import <SignalServiceKit/OWSVerificationStateChangeMessage.h>
|
||||
#import <SignalServiceKit/TSCall.h>
|
||||
#import <SignalServiceKit/TSInvalidIdentityKeyReceivingErrorMessage.h>
|
||||
#import <SignalServiceKit/TSStorageManager+SessionStore.h>
|
||||
#import <SignalServiceKit/TSThread.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@implementation DebugUIMisc
|
||||
|
||||
#pragma mark - Logging
|
||||
|
||||
+ (NSString *)tag
|
||||
{
|
||||
return [NSString stringWithFormat:@"[%@]", self.class];
|
||||
}
|
||||
|
||||
- (NSString *)tag
|
||||
{
|
||||
return self.class.tag;
|
||||
}
|
||||
|
||||
#pragma mark - Factory Methods
|
||||
|
||||
- (NSString *)name
|
||||
{
|
||||
return @"Misc.";
|
||||
}
|
||||
|
||||
- (nullable OWSTableSection *)sectionForThread:(nullable TSThread *)thread
|
||||
{
|
||||
OWSAssert(thread);
|
||||
|
||||
NSMutableArray<OWSTableItem *> *items = [NSMutableArray new];
|
||||
[items addObject:[OWSTableItem itemWithTitle:@"Enable Manual Censorship Circumvention"
|
||||
actionBlock:^{
|
||||
[DebugUIMisc setManualCensorshipCircumventionEnabled:YES];
|
||||
}]];
|
||||
[items addObject:[OWSTableItem itemWithTitle:@"Disable Manual Censorship Circumvention"
|
||||
actionBlock:^{
|
||||
[DebugUIMisc setManualCensorshipCircumventionEnabled:NO];
|
||||
}]];
|
||||
return [OWSTableSection sectionWithTitle:self.name items:items];
|
||||
}
|
||||
|
||||
+ (void)setManualCensorshipCircumventionEnabled:(BOOL)isEnabled
|
||||
{
|
||||
OWSCountryMetadata *countryMetadata = nil;
|
||||
NSString *countryCode = OWSSignalService.sharedInstance.manualCensorshipCircumventionCountryCode;
|
||||
if (countryCode) {
|
||||
countryMetadata = [OWSCountryMetadata countryMetadataForCountryCode:countryCode];
|
||||
}
|
||||
|
||||
if (!countryMetadata) {
|
||||
countryCode = [NSLocale.currentLocale objectForKey:NSLocaleCountryCode];
|
||||
if (countryCode) {
|
||||
countryMetadata = [OWSCountryMetadata countryMetadataForCountryCode:countryCode];
|
||||
}
|
||||
}
|
||||
|
||||
if (!countryMetadata) {
|
||||
countryCode = @"US";
|
||||
countryMetadata = [OWSCountryMetadata countryMetadataForCountryCode:countryCode];
|
||||
}
|
||||
|
||||
OWSAssert(countryMetadata);
|
||||
OWSSignalService.sharedInstance.manualCensorshipCircumventionCountryCode = countryCode;
|
||||
OWSSignalService.sharedInstance.manualCensorshipCircumventionDomain = countryMetadata.googleDomain;
|
||||
|
||||
OWSSignalService.sharedInstance.isCensorshipCircumventionManuallyActivated = isEnabled;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
Loading…
Reference in New Issue