mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Upload test file to CloudKit.
This commit is contained in:
parent
d06ad25d77
commit
593f7da72d
20 changed files with 1486 additions and 68 deletions
|
@ -34,6 +34,10 @@
|
||||||
340FC8BB204DAC8D007AEB0F /* OWSAddToContactViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 340FC8A1204DAC8D007AEB0F /* OWSAddToContactViewController.m */; };
|
340FC8BB204DAC8D007AEB0F /* OWSAddToContactViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 340FC8A1204DAC8D007AEB0F /* OWSAddToContactViewController.m */; };
|
||||||
340FC8BC204DAC8D007AEB0F /* FingerprintViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 340FC8A2204DAC8D007AEB0F /* FingerprintViewController.m */; };
|
340FC8BC204DAC8D007AEB0F /* FingerprintViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 340FC8A2204DAC8D007AEB0F /* FingerprintViewController.m */; };
|
||||||
340FC8BD204DAC8D007AEB0F /* ShowGroupMembersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 340FC8A6204DAC8D007AEB0F /* ShowGroupMembersViewController.m */; };
|
340FC8BD204DAC8D007AEB0F /* ShowGroupMembersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 340FC8A6204DAC8D007AEB0F /* ShowGroupMembersViewController.m */; };
|
||||||
|
340FC8C0204DB7D2007AEB0F /* OWSBackupExport.m in Sources */ = {isa = PBXBuildFile; fileRef = 340FC8BF204DB7D2007AEB0F /* OWSBackupExport.m */; };
|
||||||
|
340FC8C2204DDF67007AEB0F /* CloudKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 340FC8C1204DDF66007AEB0F /* CloudKit.framework */; };
|
||||||
|
340FC8C5204DE223007AEB0F /* DebugUIBackup.m in Sources */ = {isa = PBXBuildFile; fileRef = 340FC8C4204DE223007AEB0F /* DebugUIBackup.m */; };
|
||||||
|
340FC8C7204DE64D007AEB0F /* OWSBackupAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 340FC8C6204DE64D007AEB0F /* OWSBackupAPI.swift */; };
|
||||||
341F2C0F1F2B8AE700D07D6B /* DebugUIMisc.m in Sources */ = {isa = PBXBuildFile; fileRef = 341F2C0E1F2B8AE700D07D6B /* DebugUIMisc.m */; };
|
341F2C0F1F2B8AE700D07D6B /* DebugUIMisc.m in Sources */ = {isa = PBXBuildFile; fileRef = 341F2C0E1F2B8AE700D07D6B /* DebugUIMisc.m */; };
|
||||||
3430FE181F7751D4000EC51B /* GiphyAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3430FE171F7751D4000EC51B /* GiphyAPI.swift */; };
|
3430FE181F7751D4000EC51B /* GiphyAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3430FE171F7751D4000EC51B /* GiphyAPI.swift */; };
|
||||||
34330A5A1E7875FB00DF2FB9 /* fontawesome-webfont.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 34330A591E7875FB00DF2FB9 /* fontawesome-webfont.ttf */; };
|
34330A5A1E7875FB00DF2FB9 /* fontawesome-webfont.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 34330A591E7875FB00DF2FB9 /* fontawesome-webfont.ttf */; };
|
||||||
|
@ -567,6 +571,12 @@
|
||||||
340FC8A4204DAC8D007AEB0F /* AddToGroupViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddToGroupViewController.h; sourceTree = "<group>"; };
|
340FC8A4204DAC8D007AEB0F /* AddToGroupViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddToGroupViewController.h; sourceTree = "<group>"; };
|
||||||
340FC8A5204DAC8D007AEB0F /* FingerprintViewScanController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FingerprintViewScanController.h; sourceTree = "<group>"; };
|
340FC8A5204DAC8D007AEB0F /* FingerprintViewScanController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FingerprintViewScanController.h; sourceTree = "<group>"; };
|
||||||
340FC8A6204DAC8D007AEB0F /* ShowGroupMembersViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShowGroupMembersViewController.m; sourceTree = "<group>"; };
|
340FC8A6204DAC8D007AEB0F /* ShowGroupMembersViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShowGroupMembersViewController.m; sourceTree = "<group>"; };
|
||||||
|
340FC8BE204DB7D1007AEB0F /* OWSBackupExport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSBackupExport.h; sourceTree = "<group>"; };
|
||||||
|
340FC8BF204DB7D2007AEB0F /* OWSBackupExport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSBackupExport.m; sourceTree = "<group>"; };
|
||||||
|
340FC8C1204DDF66007AEB0F /* CloudKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CloudKit.framework; path = System/Library/Frameworks/CloudKit.framework; sourceTree = SDKROOT; };
|
||||||
|
340FC8C3204DE223007AEB0F /* DebugUIBackup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugUIBackup.h; sourceTree = "<group>"; };
|
||||||
|
340FC8C4204DE223007AEB0F /* DebugUIBackup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DebugUIBackup.m; sourceTree = "<group>"; };
|
||||||
|
340FC8C6204DE64D007AEB0F /* OWSBackupAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OWSBackupAPI.swift; sourceTree = "<group>"; };
|
||||||
341458471FBE11C4005ABCF9 /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = translations/fa.lproj/Localizable.strings; sourceTree = "<group>"; };
|
341458471FBE11C4005ABCF9 /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = translations/fa.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||||
341F2C0D1F2B8AE700D07D6B /* DebugUIMisc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugUIMisc.h; sourceTree = "<group>"; };
|
341F2C0D1F2B8AE700D07D6B /* DebugUIMisc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugUIMisc.h; sourceTree = "<group>"; };
|
||||||
341F2C0E1F2B8AE700D07D6B /* DebugUIMisc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DebugUIMisc.m; sourceTree = "<group>"; };
|
341F2C0E1F2B8AE700D07D6B /* DebugUIMisc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DebugUIMisc.m; sourceTree = "<group>"; };
|
||||||
|
@ -1118,6 +1128,7 @@
|
||||||
70377AAB1918450100CAF501 /* MobileCoreServices.framework in Frameworks */,
|
70377AAB1918450100CAF501 /* MobileCoreServices.framework in Frameworks */,
|
||||||
B9EB5ABD1884C002007CBB57 /* MessageUI.framework in Frameworks */,
|
B9EB5ABD1884C002007CBB57 /* MessageUI.framework in Frameworks */,
|
||||||
453518991FC63DBF00210559 /* SignalMessaging.framework in Frameworks */,
|
453518991FC63DBF00210559 /* SignalMessaging.framework in Frameworks */,
|
||||||
|
340FC8C2204DDF67007AEB0F /* CloudKit.framework in Frameworks */,
|
||||||
76C87F19181EFCE600C4ACAB /* MediaPlayer.framework in Frameworks */,
|
76C87F19181EFCE600C4ACAB /* MediaPlayer.framework in Frameworks */,
|
||||||
768A1A2B17FC9CD300E00ED8 /* libz.dylib in Frameworks */,
|
768A1A2B17FC9CD300E00ED8 /* libz.dylib in Frameworks */,
|
||||||
A11CD70D17FA230600A2D1B1 /* QuartzCore.framework in Frameworks */,
|
A11CD70D17FA230600A2D1B1 /* QuartzCore.framework in Frameworks */,
|
||||||
|
@ -1624,11 +1635,14 @@
|
||||||
34D8C0221ED3673300188D7C /* DebugUI */ = {
|
34D8C0221ED3673300188D7C /* DebugUI */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
340FC8C3204DE223007AEB0F /* DebugUIBackup.h */,
|
||||||
|
340FC8C4204DE223007AEB0F /* DebugUIBackup.m */,
|
||||||
45638BDB1F3DD0D400128435 /* DebugUICalling.swift */,
|
45638BDB1F3DD0D400128435 /* DebugUICalling.swift */,
|
||||||
34D8C0291ED3685800188D7C /* DebugUIContacts.h */,
|
34D8C0291ED3685800188D7C /* DebugUIContacts.h */,
|
||||||
34D8C02A1ED3685800188D7C /* DebugUIContacts.m */,
|
34D8C02A1ED3685800188D7C /* DebugUIContacts.m */,
|
||||||
34E3EF0B1EFC235B007F6822 /* DebugUIDiskUsage.h */,
|
34E3EF0B1EFC235B007F6822 /* DebugUIDiskUsage.h */,
|
||||||
34E3EF0C1EFC235B007F6822 /* DebugUIDiskUsage.m */,
|
34E3EF0C1EFC235B007F6822 /* DebugUIDiskUsage.m */,
|
||||||
|
45B27B852037FFB400A539DF /* DebugUIFileBrowser.swift */,
|
||||||
34D8C0231ED3673300188D7C /* DebugUIMessages.h */,
|
34D8C0231ED3673300188D7C /* DebugUIMessages.h */,
|
||||||
34D8C0241ED3673300188D7C /* DebugUIMessages.m */,
|
34D8C0241ED3673300188D7C /* DebugUIMessages.m */,
|
||||||
341F2C0D1F2B8AE700D07D6B /* DebugUIMisc.h */,
|
341F2C0D1F2B8AE700D07D6B /* DebugUIMisc.h */,
|
||||||
|
@ -1645,7 +1659,6 @@
|
||||||
343A65941FC47D5E000477A1 /* DebugUISyncMessages.m */,
|
343A65941FC47D5E000477A1 /* DebugUISyncMessages.m */,
|
||||||
34D8C0251ED3673300188D7C /* DebugUITableViewController.h */,
|
34D8C0251ED3673300188D7C /* DebugUITableViewController.h */,
|
||||||
34D8C0261ED3673300188D7C /* DebugUITableViewController.m */,
|
34D8C0261ED3673300188D7C /* DebugUITableViewController.m */,
|
||||||
45B27B852037FFB400A539DF /* DebugUIFileBrowser.swift */,
|
|
||||||
);
|
);
|
||||||
path = DebugUI;
|
path = DebugUI;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -1920,6 +1933,9 @@
|
||||||
34D99C911F2937CC00D284D6 /* OWSAnalytics.swift */,
|
34D99C911F2937CC00D284D6 /* OWSAnalytics.swift */,
|
||||||
34A9105E1FFEB113000C4745 /* OWSBackup.h */,
|
34A9105E1FFEB113000C4745 /* OWSBackup.h */,
|
||||||
34A9105F1FFEB114000C4745 /* OWSBackup.m */,
|
34A9105F1FFEB114000C4745 /* OWSBackup.m */,
|
||||||
|
340FC8C6204DE64D007AEB0F /* OWSBackupAPI.swift */,
|
||||||
|
340FC8BE204DB7D1007AEB0F /* OWSBackupExport.h */,
|
||||||
|
340FC8BF204DB7D2007AEB0F /* OWSBackupExport.m */,
|
||||||
4579431C1E7C8CE9008ED0C0 /* Pastelog.h */,
|
4579431C1E7C8CE9008ED0C0 /* Pastelog.h */,
|
||||||
4579431D1E7C8CE9008ED0C0 /* Pastelog.m */,
|
4579431D1E7C8CE9008ED0C0 /* Pastelog.m */,
|
||||||
450DF2041E0D74AC003D14BE /* Platform.swift */,
|
450DF2041E0D74AC003D14BE /* Platform.swift */,
|
||||||
|
@ -2119,6 +2135,7 @@
|
||||||
D221A08C169C9E5E00537ABF /* Frameworks */ = {
|
D221A08C169C9E5E00537ABF /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
340FC8C1204DDF66007AEB0F /* CloudKit.framework */,
|
||||||
455A16DB1F1FEA0000F86704 /* Metal.framework */,
|
455A16DB1F1FEA0000F86704 /* Metal.framework */,
|
||||||
455A16DC1F1FEA0000F86704 /* MetalKit.framework */,
|
455A16DC1F1FEA0000F86704 /* MetalKit.framework */,
|
||||||
45847E861E4283C30080EAB3 /* Intents.framework */,
|
45847E861E4283C30080EAB3 /* Intents.framework */,
|
||||||
|
@ -3066,6 +3083,7 @@
|
||||||
450DF2091E0DD2C6003D14BE /* UserNotificationsAdaptee.swift in Sources */,
|
450DF2091E0DD2C6003D14BE /* UserNotificationsAdaptee.swift in Sources */,
|
||||||
34D1F0821F8678AA0066283D /* ConversationHeaderView.m in Sources */,
|
34D1F0821F8678AA0066283D /* ConversationHeaderView.m in Sources */,
|
||||||
34D1F0AB1F867BFC0066283D /* OWSContactOffersCell.m in Sources */,
|
34D1F0AB1F867BFC0066283D /* OWSContactOffersCell.m in Sources */,
|
||||||
|
340FC8C7204DE64D007AEB0F /* OWSBackupAPI.swift in Sources */,
|
||||||
343A65981FC4CFE7000477A1 /* ConversationScrollButton.m in Sources */,
|
343A65981FC4CFE7000477A1 /* ConversationScrollButton.m in Sources */,
|
||||||
34D1F0A91F867BFC0066283D /* ConversationViewCell.m in Sources */,
|
34D1F0A91F867BFC0066283D /* ConversationViewCell.m in Sources */,
|
||||||
4505C2BF1E648EA300CEBF41 /* ExperienceUpgrade.swift in Sources */,
|
4505C2BF1E648EA300CEBF41 /* ExperienceUpgrade.swift in Sources */,
|
||||||
|
@ -3147,6 +3165,7 @@
|
||||||
45FBC5D11DF8592E00E9B410 /* SignalCall.swift in Sources */,
|
45FBC5D11DF8592E00E9B410 /* SignalCall.swift in Sources */,
|
||||||
340FC8BB204DAC8D007AEB0F /* OWSAddToContactViewController.m in Sources */,
|
340FC8BB204DAC8D007AEB0F /* OWSAddToContactViewController.m in Sources */,
|
||||||
4523149E1F7E916B003A428C /* SlideOffAnimatedTransition.swift in Sources */,
|
4523149E1F7E916B003A428C /* SlideOffAnimatedTransition.swift in Sources */,
|
||||||
|
340FC8C0204DB7D2007AEB0F /* OWSBackupExport.m in Sources */,
|
||||||
340FC8A7204DAC8D007AEB0F /* RegistrationViewController.m in Sources */,
|
340FC8A7204DAC8D007AEB0F /* RegistrationViewController.m in Sources */,
|
||||||
452C468F1E427E200087B011 /* OutboundCallInitiator.swift in Sources */,
|
452C468F1E427E200087B011 /* OutboundCallInitiator.swift in Sources */,
|
||||||
45F170BB1E2FC5D3003FC1F2 /* CallAudioService.swift in Sources */,
|
45F170BB1E2FC5D3003FC1F2 /* CallAudioService.swift in Sources */,
|
||||||
|
@ -3175,6 +3194,7 @@
|
||||||
4521C3C01F59F3BA00B4C582 /* TextFieldHelper.swift in Sources */,
|
4521C3C01F59F3BA00B4C582 /* TextFieldHelper.swift in Sources */,
|
||||||
34B3F87E1E8DF1700035BE1A /* InboxTableViewCell.m in Sources */,
|
34B3F87E1E8DF1700035BE1A /* InboxTableViewCell.m in Sources */,
|
||||||
340FC8AC204DAC8D007AEB0F /* PrivacySettingsTableViewController.m in Sources */,
|
340FC8AC204DAC8D007AEB0F /* PrivacySettingsTableViewController.m in Sources */,
|
||||||
|
340FC8C5204DE223007AEB0F /* DebugUIBackup.m in Sources */,
|
||||||
340FC8AE204DAC8D007AEB0F /* OWSSoundSettingsViewController.m in Sources */,
|
340FC8AE204DAC8D007AEB0F /* OWSSoundSettingsViewController.m in Sources */,
|
||||||
4579431E1E7C8CE9008ED0C0 /* Pastelog.m in Sources */,
|
4579431E1E7C8CE9008ED0C0 /* Pastelog.m in Sources */,
|
||||||
34B3F8941E8DF1710035BE1A /* HomeViewController.m in Sources */,
|
34B3F8941E8DF1710035BE1A /* HomeViewController.m in Sources */,
|
||||||
|
|
|
@ -12,12 +12,10 @@
|
||||||
</array>
|
</array>
|
||||||
<key>com.apple.developer.icloud-services</key>
|
<key>com.apple.developer.icloud-services</key>
|
||||||
<array>
|
<array>
|
||||||
<string>CloudDocuments</string>
|
<string>CloudKit</string>
|
||||||
</array>
|
|
||||||
<key>com.apple.developer.ubiquity-container-identifiers</key>
|
|
||||||
<array>
|
|
||||||
<string>iCloud.$(CFBundleIdentifier)</string>
|
|
||||||
</array>
|
</array>
|
||||||
|
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
|
||||||
|
<string>$(TeamIdentifierPrefix)$(CFBundleIdentifier)</string>
|
||||||
<key>com.apple.security.application-groups</key>
|
<key>com.apple.security.application-groups</key>
|
||||||
<array>
|
<array>
|
||||||
<string>group.org.whispersystems.signal.group</string>
|
<string>group.org.whispersystems.signal.group</string>
|
||||||
|
|
|
@ -92,7 +92,8 @@
|
||||||
[self updateTableContents];
|
[self updateTableContents];
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[self showBackup];
|
// [self showBackup];
|
||||||
|
[self showDebugUI];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
13
Signal/src/ViewControllers/DebugUI/DebugUIBackup.h
Normal file
13
Signal/src/ViewControllers/DebugUI/DebugUIBackup.h
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
//
|
||||||
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "DebugUIPage.h"
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface DebugUIBackup : DebugUIPage
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
76
Signal/src/ViewControllers/DebugUI/DebugUIBackup.m
Normal file
76
Signal/src/ViewControllers/DebugUI/DebugUIBackup.m
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
//
|
||||||
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "DebugUIBackup.h"
|
||||||
|
#import "OWSBackup.h"
|
||||||
|
|
||||||
|
//#import "OWSCountryMetadata.h"
|
||||||
|
#import "OWSTableViewController.h"
|
||||||
|
|
||||||
|
//#import "RegistrationViewController.h"
|
||||||
|
#import "Signal-Swift.h"
|
||||||
|
|
||||||
|
//#import "ThreadUtil.h"
|
||||||
|
//#import <AxolotlKit/PreKeyBundle.h>
|
||||||
|
//#import <SignalMessaging/AttachmentSharing.h>
|
||||||
|
//#import <SignalMessaging/Environment.h>
|
||||||
|
//#import <SignalMessaging/UIImage+OWS.h>
|
||||||
|
//#import <SignalServiceKit/OWSDisappearingConfigurationUpdateInfoMessage.h>
|
||||||
|
//#import <SignalServiceKit/OWSDisappearingMessagesConfiguration.h>
|
||||||
|
//#import <SignalServiceKit/OWSPrimaryStorage+SessionStore.h>
|
||||||
|
//#import <SignalServiceKit/OWSVerificationStateChangeMessage.h>
|
||||||
|
//#import <SignalServiceKit/SecurityUtils.h>
|
||||||
|
//#import <SignalServiceKit/TSCall.h>
|
||||||
|
//#import <SignalServiceKit/TSInvalidIdentityKeyReceivingErrorMessage.h>
|
||||||
|
//#import <SignalServiceKit/TSThread.h>
|
||||||
|
//#import <CloudKit/CloudKit.h>
|
||||||
|
#import <Curve25519Kit/Randomness.h>
|
||||||
|
|
||||||
|
@import CloudKit;
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@implementation DebugUIBackup
|
||||||
|
|
||||||
|
#pragma mark - Factory Methods
|
||||||
|
|
||||||
|
- (NSString *)name
|
||||||
|
{
|
||||||
|
return @"Backup";
|
||||||
|
}
|
||||||
|
|
||||||
|
- (nullable OWSTableSection *)sectionForThread:(nullable TSThread *)thread
|
||||||
|
{
|
||||||
|
NSMutableArray<OWSTableItem *> *items = [NSMutableArray new];
|
||||||
|
[items addObject:[OWSTableItem itemWithTitle:@"Backup test file @ CloudKit"
|
||||||
|
actionBlock:^{
|
||||||
|
[DebugUIBackup backupTestFile];
|
||||||
|
}]];
|
||||||
|
|
||||||
|
return [OWSTableSection sectionWithTitle:self.name items:items];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (void)backupTestFile
|
||||||
|
{
|
||||||
|
DDLogInfo(@"%@ backupTestFile.", self.logTag);
|
||||||
|
|
||||||
|
NSData *_Nullable data = [Randomness generateRandomBytes:32];
|
||||||
|
OWSAssert(data);
|
||||||
|
NSString *filePath = [OWSFileSystem temporaryFilePathWithFileExtension:@"pdf"];
|
||||||
|
BOOL success = [data writeToFile:filePath atomically:YES];
|
||||||
|
OWSAssert(success);
|
||||||
|
|
||||||
|
[OWSBackupAPI checkCloudKitAccessWithCompletion:^(BOOL hasAccess) {
|
||||||
|
if (hasAccess) {
|
||||||
|
[OWSBackupAPI saveTestFileToCloudWithFileUrl:[NSURL fileURLWithPath:filePath]
|
||||||
|
completion:^(NSError *_Nullable error){
|
||||||
|
// Do nothing, the API method will log for us.
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
|
@ -693,12 +693,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
{
|
{
|
||||||
OWSAssert(size % 4 == 0);
|
OWSAssert(size % 4 == 0);
|
||||||
|
|
||||||
NSMutableData *data = [NSMutableData dataWithCapacity:size];
|
return [Randomness generateRandomBytes:size];
|
||||||
for (size_t i = 0; i < size / 4; ++i) {
|
|
||||||
u_int32_t randomBits = arc4random();
|
|
||||||
[data appendBytes:(void *)&randomBits length:4];
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void)sendRandomAttachment:(TSThread *)thread uti:(NSString *)uti
|
+ (void)sendRandomAttachment:(TSThread *)thread uti:(NSString *)uti
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
//
|
//
|
||||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "DebugUIPage.h"
|
#import "DebugUIPage.h"
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@class TSThread;
|
|
||||||
|
|
||||||
@interface DebugUIMisc : DebugUIPage
|
@interface DebugUIMisc : DebugUIPage
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#import "DebugUITableViewController.h"
|
#import "DebugUITableViewController.h"
|
||||||
|
#import "DebugUIBackup.h"
|
||||||
#import "DebugUIContacts.h"
|
#import "DebugUIContacts.h"
|
||||||
#import "DebugUIDiskUsage.h"
|
#import "DebugUIDiskUsage.h"
|
||||||
#import "DebugUIMessages.h"
|
#import "DebugUIMessages.h"
|
||||||
|
@ -110,6 +111,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
}];
|
}];
|
||||||
[subsectionItems addObject:documentsFileBrowserItem];
|
[subsectionItems addObject:documentsFileBrowserItem];
|
||||||
[subsectionItems addObject:[self itemForSubsection:[DebugUIMisc new] viewController:viewController thread:thread]];
|
[subsectionItems addObject:[self itemForSubsection:[DebugUIMisc new] viewController:viewController thread:thread]];
|
||||||
|
[subsectionItems
|
||||||
|
addObject:[self itemForSubsection:[DebugUIBackup new] viewController:viewController thread:thread]];
|
||||||
|
|
||||||
[contents addSection:[OWSTableSection sectionWithTitle:@"Sections" items:subsectionItems]];
|
[contents addSection:[OWSTableSection sectionWithTitle:@"Sections" items:subsectionItems]];
|
||||||
|
|
||||||
|
@ -135,6 +138,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
[subsectionItems
|
[subsectionItems
|
||||||
addObject:[self itemForSubsection:[DebugUISyncMessages new] viewController:viewController thread:nil]];
|
addObject:[self itemForSubsection:[DebugUISyncMessages new] viewController:viewController thread:nil]];
|
||||||
[subsectionItems addObject:[self itemForSubsection:[DebugUIMisc new] viewController:viewController thread:nil]];
|
[subsectionItems addObject:[self itemForSubsection:[DebugUIMisc new] viewController:viewController thread:nil]];
|
||||||
|
[subsectionItems addObject:[self itemForSubsection:[DebugUIBackup new] viewController:viewController thread:nil]];
|
||||||
[contents addSection:[OWSTableSection sectionWithTitle:@"Sections" items:subsectionItems]];
|
[contents addSection:[OWSTableSection sectionWithTitle:@"Sections" items:subsectionItems]];
|
||||||
|
|
||||||
viewController.contents = contents;
|
viewController.contents = contents;
|
||||||
|
|
|
@ -188,7 +188,7 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect
|
||||||
|
|
||||||
bottomBanner.autoPinEdge(toSuperviewEdge: .top)
|
bottomBanner.autoPinEdge(toSuperviewEdge: .top)
|
||||||
bottomBanner.autoPinWidthToSuperview()
|
bottomBanner.autoPinWidthToSuperview()
|
||||||
self.autoPinView(toBottomGuideOrKeyboard:bottomBanner)
|
self.autoPinView(toBottomGuideOrKeyboard: bottomBanner)
|
||||||
|
|
||||||
// The Giphy API requires us to "show their trademark prominently" in our GIF experience.
|
// The Giphy API requires us to "show their trademark prominently" in our GIF experience.
|
||||||
let logoImage = UIImage(named: "giphy_logo")
|
let logoImage = UIImage(named: "giphy_logo")
|
||||||
|
@ -454,9 +454,7 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect
|
||||||
progressiveSearchTimer = nil
|
progressiveSearchTimer = nil
|
||||||
|
|
||||||
guard let text = searchBar.text else {
|
guard let text = searchBar.text else {
|
||||||
OWSAlerts.showAlert(title: NSLocalizedString("ALERT_ERROR_TITLE",
|
OWSAlerts.showErrorAlert(withMessage: NSLocalizedString("GIF_PICKER_VIEW_MISSING_QUERY",
|
||||||
comment: ""),
|
|
||||||
message: NSLocalizedString("GIF_PICKER_VIEW_MISSING_QUERY",
|
|
||||||
comment: "Alert message shown when user tries to search for GIFs without entering any search terms."))
|
comment: "Alert message shown when user tries to search for GIFs without entering any search terms."))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -728,8 +728,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
if ([MFMessageComposeViewController canSendText]) {
|
if ([MFMessageComposeViewController canSendText]) {
|
||||||
[inviteFlow sendSMSToPhoneNumbers:@[ phoneNumber ]];
|
[inviteFlow sendSMSToPhoneNumbers:@[ phoneNumber ]];
|
||||||
} else {
|
} else {
|
||||||
[OWSAlerts showAlertWithTitle:NSLocalizedString(@"ALERT_ERROR_TITLE", @"")
|
[OWSAlerts showErrorAlertWithMessage:NSLocalizedString(@"UNSUPPORTED_FEATURE_ERROR", @"")];
|
||||||
message:NSLocalizedString(@"UNSUPPORTED_FEATURE_ERROR", @"")];
|
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
|
|
@ -322,10 +322,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
// Clear the PIN so that the user can try again.
|
// Clear the PIN so that the user can try again.
|
||||||
self.pinTextfield.text = nil;
|
self.pinTextfield.text = nil;
|
||||||
|
|
||||||
[OWSAlerts
|
[OWSAlerts showErrorAlertWithMessage:
|
||||||
showAlertWithTitle:NSLocalizedString(@"ALERT_ERROR_TITLE", @"")
|
NSLocalizedString(@"ENABLE_2FA_VIEW_PIN_DOES_NOT_MATCH",
|
||||||
message:NSLocalizedString(@"ENABLE_2FA_VIEW_PIN_DOES_NOT_MATCH",
|
@"Error indicating that the entered 'two-factor auth PINs' do not match.")];
|
||||||
@"Error indicating that the entered 'two-factor auth PINs' do not match.")];
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -370,11 +369,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
[modalActivityIndicator dismissWithCompletion:^{
|
[modalActivityIndicator dismissWithCompletion:^{
|
||||||
[weakSelf updateTableContents];
|
[weakSelf updateTableContents];
|
||||||
|
|
||||||
[OWSAlerts
|
[OWSAlerts showErrorAlertWithMessage:
|
||||||
showAlertWithTitle:NSLocalizedString(@"ALERT_ERROR_TITLE", @"")
|
NSLocalizedString(@"ENABLE_2FA_VIEW_COULD_NOT_DISABLE_2FA",
|
||||||
message:NSLocalizedString(@"ENABLE_2FA_VIEW_COULD_NOT_DISABLE_2FA",
|
@"Error indicating that attempt to disable 'two-factor "
|
||||||
@"Error indicating that attempt to disable 'two-factor "
|
@"auth' failed.")];
|
||||||
@"auth' failed.")];
|
|
||||||
}];
|
}];
|
||||||
}];
|
}];
|
||||||
}];
|
}];
|
||||||
|
@ -407,11 +405,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
[weakSelf updateTableContents];
|
[weakSelf updateTableContents];
|
||||||
|
|
||||||
[OWSAlerts
|
[OWSAlerts showErrorAlertWithMessage:
|
||||||
showAlertWithTitle:NSLocalizedString(@"ENABLE_2FA_VIEW_COULD_NOT_ENABLE_2FA",
|
NSLocalizedString(@"ENABLE_2FA_VIEW_COULD_NOT_ENABLE_2FA",
|
||||||
@"Error indicating that attempt to enable 'two-factor "
|
@"Error indicating that attempt to enable 'two-factor "
|
||||||
@"auth' failed.")
|
@"auth' failed.")];
|
||||||
message:error.localizedDescription];
|
|
||||||
}];
|
}];
|
||||||
}];
|
}];
|
||||||
}];
|
}];
|
||||||
|
|
|
@ -367,8 +367,8 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
|
||||||
|
|
||||||
NSString *normalizedProfileName = [self normalizedProfileName];
|
NSString *normalizedProfileName = [self normalizedProfileName];
|
||||||
if ([OWSProfileManager.sharedManager isProfileNameTooLong:normalizedProfileName]) {
|
if ([OWSProfileManager.sharedManager isProfileNameTooLong:normalizedProfileName]) {
|
||||||
[OWSAlerts showAlertWithTitle:NSLocalizedString(@"ALERT_ERROR_TITLE", @"")
|
[OWSAlerts
|
||||||
message:NSLocalizedString(@"PROFILE_VIEW_ERROR_PROFILE_NAME_TOO_LONG",
|
showErrorAlertWithMessage:NSLocalizedString(@"PROFILE_VIEW_ERROR_PROFILE_NAME_TOO_LONG",
|
||||||
@"Error message shown when user tries to update profile with a profile name "
|
@"Error message shown when user tries to update profile with a profile name "
|
||||||
@"that is too long.")];
|
@"that is too long.")];
|
||||||
return;
|
return;
|
||||||
|
@ -396,14 +396,11 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
|
||||||
[alertController
|
[alertController
|
||||||
dismissViewControllerAnimated:NO
|
dismissViewControllerAnimated:NO
|
||||||
completion:^{
|
completion:^{
|
||||||
[OWSAlerts
|
[OWSAlerts showErrorAlertWithMessage:
|
||||||
showAlertWithTitle:NSLocalizedString(
|
NSLocalizedString(
|
||||||
@"ALERT_ERROR_TITLE", @"")
|
@"PROFILE_VIEW_ERROR_UPDATE_FAILED",
|
||||||
message:
|
@"Error message shown when a "
|
||||||
NSLocalizedString(
|
@"profile update fails.")];
|
||||||
@"PROFILE_VIEW_ERROR_UPDATE_FAILED",
|
|
||||||
@"Error message shown when a "
|
|
||||||
@"profile update fails.")];
|
|
||||||
}];
|
}];
|
||||||
}];
|
}];
|
||||||
}];
|
}];
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
|
|
||||||
//#import "NSUserDefaults+OWS.h"
|
//#import "NSUserDefaults+OWS.h"
|
||||||
//#import "Signal-Swift.h"
|
//#import "Signal-Swift.h"
|
||||||
#import "zlib.h"
|
//#import "zlib.h"
|
||||||
|
|
||||||
//#import <SAMKeychain/SAMKeychain.h>
|
//#import <SAMKeychain/SAMKeychain.h>
|
||||||
#import <SSZipArchive/SSZipArchive.h>
|
//#import <SSZipArchive/SSZipArchive.h>
|
||||||
|
|
||||||
//#import <SignalMessaging/SignalMessaging-Swift.h>
|
//#import <SignalMessaging/SignalMessaging-Swift.h>
|
||||||
//#import <SignalServiceKit/Cryptography.h>
|
//#import <SignalServiceKit/Cryptography.h>
|
||||||
|
@ -17,7 +17,10 @@
|
||||||
|
|
||||||
//#import <SignalServiceKit/OWSPrimaryStorage.h>
|
//#import <SignalServiceKit/OWSPrimaryStorage.h>
|
||||||
#import "NSNotificationCenter+OWS.h"
|
#import "NSNotificationCenter+OWS.h"
|
||||||
|
#import "OWSBackupExport.h"
|
||||||
|
#import <SignalServiceKit/AppContext.h>
|
||||||
#import <SignalServiceKit/OWSBackupStorage.h>
|
#import <SignalServiceKit/OWSBackupStorage.h>
|
||||||
|
#import <SignalServiceKit/TSAccountManager.h>
|
||||||
#import <SignalServiceKit/YapDatabaseConnection+OWS.h>
|
#import <SignalServiceKit/YapDatabaseConnection+OWS.h>
|
||||||
|
|
||||||
NSString *const NSNotificationNameBackupStateDidChange = @"NSNotificationNameBackupStateDidChange";
|
NSString *const NSNotificationNameBackupStateDidChange = @"NSNotificationNameBackupStateDidChange";
|
||||||
|
@ -50,15 +53,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@property (nonatomic, readonly) YapDatabaseConnection *dbConnection;
|
@property (nonatomic, readonly) YapDatabaseConnection *dbConnection;
|
||||||
|
|
||||||
//- (NSData *)databasePassword;
|
// This property should only be accessed on the main thread.
|
||||||
//
|
@property (nonatomic, nullable) OWSBackupExport *backupExport;
|
||||||
//+ (void)storeDatabasePassword:(NSString *)password;
|
|
||||||
|
|
||||||
@end
|
//<SSZipArchiveDelegate>
|
||||||
|
|
||||||
#pragma mark -
|
|
||||||
|
|
||||||
@interface OWSBackup () <SSZipArchiveDelegate>
|
|
||||||
|
|
||||||
//@property (nonatomic) OWSBackupState backupState;
|
//@property (nonatomic) OWSBackupState backupState;
|
||||||
//
|
//
|
||||||
|
@ -114,6 +112,15 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
OWSSingletonAssert();
|
OWSSingletonAssert();
|
||||||
|
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
|
selector:@selector(applicationDidBecomeActive:)
|
||||||
|
name:OWSApplicationDidBecomeActiveNotification
|
||||||
|
object:nil];
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||||
|
selector:@selector(registrationStateDidChange)
|
||||||
|
name:RegistrationStateDidChangeNotification
|
||||||
|
object:nil];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,10 +131,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
//- (void)observeNotifications
|
//- (void)observeNotifications
|
||||||
//{
|
//{
|
||||||
// [[NSNotificationCenter defaultCenter] addObserver:self
|
|
||||||
// selector:@selector(applicationDidBecomeActive:)
|
|
||||||
// name:OWSApplicationDidBecomeActiveNotification
|
|
||||||
// object:nil];
|
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//- (void)dealloc
|
//- (void)dealloc
|
||||||
|
@ -167,6 +170,56 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
userInfo:nil];
|
userInfo:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)shouldHaveBackupExport
|
||||||
|
{
|
||||||
|
if (!self.isBackupEnabled) {
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
if (UIApplication.sharedApplication.applicationState != UIApplicationStateActive) {
|
||||||
|
// Only start backups when app is in the background.
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
if (![TSAccountManager isRegistered]) {
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: There's probably other conditions that affect this decision.
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)ensureBackupExportState
|
||||||
|
{
|
||||||
|
OWSAssertIsOnMainThread();
|
||||||
|
|
||||||
|
if (!self.shouldHaveBackupExport && self.backupExport) {
|
||||||
|
[self.backupExport cancel];
|
||||||
|
self.backupExport = nil;
|
||||||
|
} else if (self.shouldHaveBackupExport && !self.backupExport) {
|
||||||
|
self.backupExport =
|
||||||
|
[[OWSBackupExport alloc] initWithDelegate:self primaryStorage:[OWSPrimaryStorage sharedManager]];
|
||||||
|
[self.backupExport start];
|
||||||
|
}
|
||||||
|
|
||||||
|
// BOOL shouldHaveBackupExport
|
||||||
|
// OWSBackupExport *backupExport
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark -
|
||||||
|
|
||||||
|
- (void)applicationDidBecomeActive:(NSNotification *)notification
|
||||||
|
{
|
||||||
|
OWSAssertIsOnMainThread();
|
||||||
|
|
||||||
|
[self ensureBackupExportState];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)registrationStateDidChange
|
||||||
|
{
|
||||||
|
OWSAssertIsOnMainThread();
|
||||||
|
|
||||||
|
[self ensureBackupExportState];
|
||||||
|
}
|
||||||
|
|
||||||
//- (void)setBackupProgress:(CGFloat)backupProgress
|
//- (void)setBackupProgress:(CGFloat)backupProgress
|
||||||
//{
|
//{
|
||||||
// _backupProgress = backupProgress;
|
// _backupProgress = backupProgress;
|
||||||
|
|
98
Signal/src/util/OWSBackupAPI.swift
Normal file
98
Signal/src/util/OWSBackupAPI.swift
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
//
|
||||||
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import SignalServiceKit
|
||||||
|
import CloudKit
|
||||||
|
|
||||||
|
//func FormatAnalyticsLocation(file: String, function: String) -> NSString {
|
||||||
|
// return "\((file as NSString).lastPathComponent):\(function)" as NSString
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//func OWSProdError(_ eventName: String, file: String, function: String, line: Int32) {
|
||||||
|
// let location = FormatAnalyticsLocation(file: file, function: function)
|
||||||
|
// OWSAnalytics
|
||||||
|
// .logEvent(eventName, severity: .error, parameters: nil, location: location.utf8String!, line:line)
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
//func OWSProdInfo(_ eventName: String, file: String, function: String, line: Int32) {
|
||||||
|
// let location = FormatAnalyticsLocation(file: file, function: function)
|
||||||
|
// OWSAnalytics
|
||||||
|
// .logEvent(eventName, severity: .info, parameters: nil, location: location.utf8String!, line:line)
|
||||||
|
//}
|
||||||
|
|
||||||
|
@objc public class OWSBackupAPI: NSObject {
|
||||||
|
@objc
|
||||||
|
public class func recordIdForTest() -> String {
|
||||||
|
return "test-\(NSUUID().uuidString)"
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc
|
||||||
|
public class func recordIdForAttachmentStream(value: TSAttachmentStream) -> String {
|
||||||
|
return "attachment-stream-\(value.uniqueId)"
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc
|
||||||
|
public class func saveTestFileToCloud(fileUrl: NSURL,
|
||||||
|
completion: @escaping (Error?) -> Swift.Void) {
|
||||||
|
saveFileToCloud(fileUrl: fileUrl,
|
||||||
|
recordId: recordIdForTest(),
|
||||||
|
recordType: "test",
|
||||||
|
completion: completion)
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc
|
||||||
|
public class func saveFileToCloud(fileUrl: NSURL,
|
||||||
|
recordId: String,
|
||||||
|
recordType: String,
|
||||||
|
completion: @escaping (Error?) -> Swift.Void) {
|
||||||
|
let recordID = CKRecordID(recordName: recordId)
|
||||||
|
let record = CKRecord(recordType: recordType, recordID: recordID)
|
||||||
|
// artworkRecord["title"] = "MacKerricher State Park" as NSString
|
||||||
|
// artworkRecord["artist"] = "Mei Chen" as NSString
|
||||||
|
// artworkRecord["address"] = "Fort Bragg, CA" as NSString
|
||||||
|
// artworkRecord[@"title" ] = @"MacKerricher State Park";
|
||||||
|
// artworkRecord[@"artist"] = @"Mei Chen";
|
||||||
|
// artworkRecord[@"address"] = @"Fort Bragg, CA";
|
||||||
|
|
||||||
|
let myContainer = CKContainer.default()
|
||||||
|
let privateDatabase = myContainer.privateCloudDatabase
|
||||||
|
privateDatabase.save(record) {
|
||||||
|
(record, error) in
|
||||||
|
|
||||||
|
if let error = error {
|
||||||
|
Logger.error("\(self.logTag) error saving record: \(error)")
|
||||||
|
completion(error)
|
||||||
|
} else {
|
||||||
|
Logger.info("\(self.logTag) saved record.")
|
||||||
|
completion(nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc
|
||||||
|
public class func checkCloudKitAccess(completion: @escaping (Bool) -> Swift.Void) {
|
||||||
|
CKContainer.default().accountStatus(completionHandler: { (accountStatus, error) in
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
switch accountStatus {
|
||||||
|
case .couldNotDetermine:
|
||||||
|
Logger.error("\(self.logTag) could not determine CloudKit account status:\(error).")
|
||||||
|
OWSAlerts.showErrorAlert(withMessage: NSLocalizedString("CLOUDKIT_STATUS_COULD_NOT_DETERMINE", comment: "Error indicating that the app could not determine that user's CloudKit account status"))
|
||||||
|
completion(false)
|
||||||
|
case .noAccount:
|
||||||
|
Logger.error("\(self.logTag) no CloudKit account.")
|
||||||
|
OWSAlerts.showErrorAlert(withMessage: NSLocalizedString("CLOUDKIT_STATUS_NO_ACCOUNT", comment: "Error indicating that user does not have an iCloud account."))
|
||||||
|
completion(false)
|
||||||
|
case .restricted:
|
||||||
|
Logger.error("\(self.logTag) restricted CloudKit account.")
|
||||||
|
OWSAlerts.showErrorAlert(withMessage: NSLocalizedString("CLOUDKIT_STATUS_RESTRICTED", comment: "Error indicating that the app was prevented from accessing the user's CloudKit account."))
|
||||||
|
completion(false)
|
||||||
|
case .available:
|
||||||
|
Logger.error("\(self.logTag) no CloudKit account.")
|
||||||
|
completion(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
70
Signal/src/util/OWSBackupExport.h
Normal file
70
Signal/src/util/OWSBackupExport.h
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
//
|
||||||
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
// extern NSString *const OWSBackup_FileExtension;
|
||||||
|
|
||||||
|
// extern NSString *const NSNotificationNameBackupStateDidChange;
|
||||||
|
|
||||||
|
@protocol OWSBackupExportDelegate <NSObject>
|
||||||
|
|
||||||
|
- (void)backupExportDidSucceed;
|
||||||
|
|
||||||
|
- (void)backupExportDidFailWithError:(NSError *)error;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
//#pragma mark -
|
||||||
|
|
||||||
|
// typedef NS_ENUM(NSUInteger, OWSBackupState) {
|
||||||
|
// OWSBackupState_AtRest = 0,
|
||||||
|
// OWSBackupState_InProgress,
|
||||||
|
// // OWSBackupState_Cancelled,
|
||||||
|
// OWSBackupState_Failed,
|
||||||
|
//};
|
||||||
|
|
||||||
|
@class OWSPrimaryStorage;
|
||||||
|
|
||||||
|
@interface OWSBackupExport : NSObject
|
||||||
|
|
||||||
|
- (instancetype)init NS_UNAVAILABLE;
|
||||||
|
|
||||||
|
- (instancetype)initWithDelegate:(id<OWSBackupExportDelegate>)delegate
|
||||||
|
primaryStorage:(OWSPrimaryStorage *)primaryStorage;
|
||||||
|
|
||||||
|
- (void)start;
|
||||||
|
|
||||||
|
- (void)cancel;
|
||||||
|
|
||||||
|
//@property (nonatomic, readonly) OWSBackupState backupExportState;
|
||||||
|
//
|
||||||
|
////@property (nonatomic, readonly) CGFloat backupProgress;
|
||||||
|
////
|
||||||
|
////// If non-nil, backup is encrypted.
|
||||||
|
////@property (nonatomic, nullable, readonly) NSString *backupPassword;
|
||||||
|
////
|
||||||
|
////// Only applies to "backup export" task.
|
||||||
|
////@property (nonatomic, nullable, readonly) TSThread *currentThread;
|
||||||
|
////
|
||||||
|
////@property (nonatomic, readonly) NSString *backupZipPath;
|
||||||
|
////
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//+ (instancetype)sharedManager;
|
||||||
|
//
|
||||||
|
//- (BOOL)isBackupEnabled;
|
||||||
|
//- (void)setIsBackupEnabled:(BOOL)value;
|
||||||
|
|
||||||
|
//- (void)exportBackup:(nullable TSThread *)currentThread skipPassword:(BOOL)skipPassword;
|
||||||
|
//
|
||||||
|
//- (void)importBackup:(NSString *)backupZipPath password:(NSString *_Nullable)password;
|
||||||
|
//
|
||||||
|
//- (void)cancel;
|
||||||
|
//
|
||||||
|
//+ (void)applicationDidFinishLaunching;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
1096
Signal/src/util/OWSBackupExport.m
Normal file
1096
Signal/src/util/OWSBackupExport.m
Normal file
File diff suppressed because it is too large
Load diff
|
@ -338,10 +338,8 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
|
||||||
[modalActivityIndicator
|
[modalActivityIndicator
|
||||||
dismissViewControllerAnimated:NO
|
dismissViewControllerAnimated:NO
|
||||||
completion:^{
|
completion:^{
|
||||||
[OWSAlerts showAlertWithTitle:
|
[OWSAlerts
|
||||||
NSLocalizedString(@"ALERT_ERROR_TITLE",
|
showErrorAlertWithMessage:error.localizedDescription];
|
||||||
@"Title for a generic error alert.")
|
|
||||||
message:error.localizedDescription];
|
|
||||||
}];
|
}];
|
||||||
}];
|
}];
|
||||||
}];
|
}];
|
||||||
|
|
|
@ -132,8 +132,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
if ([error.domain isEqualToString:NSOSStatusErrorDomain]
|
if ([error.domain isEqualToString:NSOSStatusErrorDomain]
|
||||||
&& (error.code == kAudioFileInvalidFileError || error.code == kAudioFileStreamError_InvalidFile)) {
|
&& (error.code == kAudioFileInvalidFileError || error.code == kAudioFileStreamError_InvalidFile)) {
|
||||||
[OWSAlerts showAlertWithTitle:NSLocalizedString(@"ALERT_ERROR_TITLE", @"")
|
[OWSAlerts
|
||||||
message:NSLocalizedString(@"INVALID_AUDIO_FILE_ALERT_ERROR_MESSAGE",
|
showErrorAlertWithMessage:NSLocalizedString(@"INVALID_AUDIO_FILE_ALERT_ERROR_MESSAGE",
|
||||||
@"Message for the alert indicating that an audio file is invalid.")];
|
@"Message for the alert indicating that an audio file is invalid.")];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,11 +12,13 @@ import Foundation
|
||||||
@objc
|
@objc
|
||||||
static public let dismissButton = NSLocalizedString("DISMISS_BUTTON_TEXT", comment: "Short text to dismiss current modal / actionsheet / screen")
|
static public let dismissButton = NSLocalizedString("DISMISS_BUTTON_TEXT", comment: "Short text to dismiss current modal / actionsheet / screen")
|
||||||
@objc
|
@objc
|
||||||
static public let cancelButton = NSLocalizedString("TXT_CANCEL_TITLE", comment:"Label for the cancel button in an alert or action sheet.")
|
static public let cancelButton = NSLocalizedString("TXT_CANCEL_TITLE", comment: "Label for the cancel button in an alert or action sheet.")
|
||||||
@objc
|
@objc
|
||||||
static public let retryButton = NSLocalizedString("RETRY_BUTTON_TEXT", comment:"Generic text for button that retries whatever the last action was.")
|
static public let retryButton = NSLocalizedString("RETRY_BUTTON_TEXT", comment: "Generic text for button that retries whatever the last action was.")
|
||||||
@objc
|
@objc
|
||||||
static public let openSettingsButton = NSLocalizedString("OPEN_SETTINGS_BUTTON", comment: "Button text which opens the settings app")
|
static public let openSettingsButton = NSLocalizedString("OPEN_SETTINGS_BUTTON", comment: "Button text which opens the settings app")
|
||||||
|
@objc
|
||||||
|
static public let errorAlertTitle = NSLocalizedString("ALERT_ERROR_TITLE", comment: "")
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc public class MessageStrings: NSObject {
|
@objc public class MessageStrings: NSObject {
|
||||||
|
|
|
@ -54,6 +54,11 @@ import Foundation
|
||||||
CurrentAppContext().frontmostViewController()?.present(alert, animated: true, completion: nil)
|
CurrentAppContext().frontmostViewController()?.present(alert, animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc
|
||||||
|
public class func showErrorAlert(withMessage message: String) {
|
||||||
|
self.showAlert(withTitle: CommonStrings.errorAlertTitle, message: message, buttonTitle: nil)
|
||||||
|
}
|
||||||
|
|
||||||
@objc
|
@objc
|
||||||
public class var cancelAction: UIAlertAction {
|
public class var cancelAction: UIAlertAction {
|
||||||
let action = UIAlertAction(title: CommonStrings.cancelButton, style: .cancel) { _ in
|
let action = UIAlertAction(title: CommonStrings.cancelButton, style: .cancel) { _ in
|
||||||
|
|
Loading…
Reference in a new issue