Commit d9b0a1c7 authored by Ahmed Shehata's avatar Ahmed Shehata
Browse files

Merge branch 'development' into 'master'

Account backup and restore

See merge request !11
parents 128380b4 863ec844
......@@ -29,5 +29,8 @@ xcuserdata/
*.dSYM.zip
*.dSYM
*.p8
*/cert_mainnet
*/GoogleService-Info.plist
Sources/Integration/Resources/udContact-test.bin
Sources/Integration/Resources/ud.elixxir.io.crt
Sources/GoogleDriveFeature/Resources/GoogleDrive-Keys.plist
Sources/DropboxFeature/Resources/Dropbox-Keys.plist
App/client-ios/Resources/GoogleService-Info.plist
\ No newline at end of file
......@@ -68,6 +68,8 @@ class NotificationService: UNNotificationServiceExtension {
content.title = "New media received"
case "groupRq":
content.title = "Group request received"
case "reset":
content.title = "One of your contacts has restored their account"
default:
break
}
......
......@@ -15,6 +15,8 @@
32179BAC26410149008B26EC /* NotificationExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 32179BA526410149008B26EC /* NotificationExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
3273327126C7391D0027D79D /* App in Frameworks */ = {isa = PBXBuildFile; productRef = 3273327026C7391D0027D79D /* App */; };
32824C8F26EAE13D005D3FAC /* Bindings in Frameworks */ = {isa = PBXBuildFile; productRef = 32824C8E26EAE13D005D3FAC /* Bindings */; };
32C194E02808C65500876917 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 32C194DF2808C65500876917 /* GoogleService-Info.plist */; };
32C194E12808C65500876917 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 32C194DF2808C65500876917 /* GoogleService-Info.plist */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
......@@ -53,6 +55,7 @@
32179BA526410149008B26EC /* NotificationExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = NotificationExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
32179BA726410149008B26EC /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
32179BA926410149008B26EC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
32C194DF2808C65500876917 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
32DB0549264DD42000FDCCEB /* NotificationExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = NotificationExtension.entitlements; sourceTree = "<group>"; };
/* End PBXFileReference section */
......@@ -82,6 +85,7 @@
children = (
02CB8FEB2326B5BE00A39834 /* client-ios.entitlements */,
02FDD06C21EDA39B000F1286 /* Assets.xcassets */,
32C194DF2808C65500876917 /* GoogleService-Info.plist */,
02FDD07121EDA39B000F1286 /* Info.plist */,
);
path = Resources;
......@@ -145,8 +149,8 @@
02FDD05E21EDA39A000F1286 /* Sources */,
02FDD05F21EDA39A000F1286 /* Frameworks */,
02FDD06021EDA39A000F1286 /* Resources */,
028B1320260A99C800054510 /* ShellScript */,
32179BAD26410149008B26EC /* Embed App Extensions */,
3289935B27DB3EEF003E1407 /* ShellScript */,
);
buildRules = (
);
......@@ -168,7 +172,6 @@
32179BA126410149008B26EC /* Sources */,
32179BA226410149008B26EC /* Frameworks */,
32179BA326410149008B26EC /* Resources */,
32151006264CAE8700A0F50D /* ShellScript */,
);
buildRules = (
);
......@@ -234,6 +237,7 @@
files = (
02FDD07021EDA39B000F1286 /* LaunchScreen.storyboard in Resources */,
02FDD06D21EDA39B000F1286 /* Assets.xcassets in Resources */,
32C194E02808C65500876917 /* GoogleService-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -241,13 +245,14 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
32C194E12808C65500876917 /* GoogleService-Info.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
028B1320260A99C800054510 /* ShellScript */ = {
3289935B27DB3EEF003E1407 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
......@@ -262,24 +267,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "$SRCROOT/set_build_number.sh\n";
};
32151006264CAE8700A0F50D /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "$SRCROOT/set_build_number.sh\n";
shellScript = "${BUILD_DIR%Build/*}SourcePackages/checkouts/firebase-ios-sdk/Crashlytics/run\n";
};
/* End PBXShellScriptBuildPhase section */
......@@ -368,6 +356,7 @@
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
"SWIFT_PACKAGE=1",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
......@@ -381,6 +370,7 @@
ONLY_ACTIVE_ARCH = YES;
OTHER_SWIFT_FLAGS = "";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "SWIFT_PACKAGE DEBUG";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
......@@ -427,6 +417,7 @@
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = "SWIFT_PACKAGE=1";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
......@@ -438,6 +429,7 @@
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = SWIFT_PACKAGE;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
......@@ -456,7 +448,7 @@
CODE_SIGN_ENTITLEMENTS = "client-ios/Resources/client-ios.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 0;
CURRENT_PROJECT_VERSION = 48;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = S6JDM2WW29;
ENABLE_BITCODE = NO;
......@@ -471,7 +463,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.5;
MARKETING_VERSION = 1.0.7;
OTHER_SWIFT_FLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = xx.messenger.mock;
PRODUCT_NAME = "$(TARGET_NAME)";
......@@ -495,7 +487,7 @@
CODE_SIGN_ENTITLEMENTS = "client-ios/Resources/client-ios.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 0;
CURRENT_PROJECT_VERSION = 48;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = S6JDM2WW29;
ENABLE_BITCODE = NO;
......@@ -511,7 +503,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.5;
MARKETING_VERSION = 1.0.7;
OTHER_SWIFT_FLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = xx.messenger;
PRODUCT_NAME = "$(TARGET_NAME)";
......@@ -530,7 +522,7 @@
CODE_SIGN_ENTITLEMENTS = NotificationExtension/NotificationExtension.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 0;
CURRENT_PROJECT_VERSION = 48;
DEVELOPMENT_TEAM = S6JDM2WW29;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
......@@ -544,7 +536,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.5;
MARKETING_VERSION = 1.0.7;
PRODUCT_BUNDLE_IDENTIFIER = xx.messenger.mock.notifications;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
......@@ -561,7 +553,7 @@
CODE_SIGN_ENTITLEMENTS = NotificationExtension/NotificationExtension.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 0;
CURRENT_PROJECT_VERSION = 48;
DEVELOPMENT_TEAM = S6JDM2WW29;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
......@@ -575,7 +567,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.5;
MARKETING_VERSION = 1.0.7;
PRODUCT_BUNDLE_IDENTIFIER = xx.messenger.notifications;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string></string>
<key>REVERSED_CLIENT_ID</key>
<string></string>
<key>ANDROID_CLIENT_ID</key>
<string></string>
<key>API_KEY</key>
<string></string>
<key>GCM_SENDER_ID</key>
<string></string>
<key>PLIST_VERSION</key>
<string></string>
<key>BUNDLE_ID</key>
<string></string>
<key>PROJECT_ID</key>
<string></string>
<key>STORAGE_BUCKET</key>
<string></string>
<key>IS_ADS_ENABLED</key>
<false/>
<key>IS_ANALYTICS_ENABLED</key>
<false/>
<key>IS_APPINVITE_ENABLED</key>
<false/>
<key>IS_GCM_ENABLED</key>
<false/>
<key>IS_SIGNIN_ENABLED</key>
<false/>
<key>GOOGLE_APP_ID</key>
<string></string>
</dict>
</plist>
......@@ -24,6 +24,14 @@
<string>$(MARKETING_VERSION)</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string></string>
<key>CFBundleURLSchemes</key>
<array>
<string>db-ppx0de5f16p9aq2</string>
</array>
</dict>
<dict>
<key>CFBundleURLName</key>
<string>xxmessenger</string>
......@@ -32,6 +40,14 @@
<string>xxmessenger</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.662236151640-30i07ubg6ukodg15u0bnpk322p030u3j</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
......@@ -39,7 +55,8 @@
<false/>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>prelixxir</string>
<string>dbapi-8-emm</string>
<string>dbapi-2</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
......@@ -58,6 +75,18 @@
<string>This permission is required to create voice notes</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This permission is required to send photos in chat and change your profile avatar.</string>
<key>NSUbiquitousContainers</key>
<dict>
<key>iCloud.xxm-icloud</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerName</key>
<string>xx messenger</string>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>Any</string>
</dict>
</dict>
<key>UIBackgroundModes</key>
<array>
<string>processing</string>
......
......@@ -2,12 +2,24 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.usernotifications.filtering</key>
<true/>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.icloud-container-identifiers</key>
<array>
<string>iCloud.xxm-cloud</string>
</array>
<key>com.apple.developer.icloud-services</key>
<array>
<string>CloudDocuments</string>
</array>
<key>com.apple.developer.networking.multipath</key>
<true/>
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array>
<string>iCloud.xxm-cloud</string>
</array>
<key>com.apple.developer.usernotifications.filtering</key>
<true/>
<key>com.apple.security.application-groups</key>
<array>
<string>group.io.xxlabs.notification</string>
......
......@@ -30,11 +30,15 @@ let package = Package(
.library(name: "ChatFeature", targets: ["ChatFeature"]),
.library(name: "CrashService", targets: ["CrashService"]),
.library(name: "Presentation", targets: ["Presentation"]),
.library(name: "BackupFeature", targets: ["BackupFeature"]),
.library(name: "iCloudFeature", targets: ["iCloudFeature"]),
.library(name: "SearchFeature", targets: ["SearchFeature"]),
.library(name: "RestoreFeature", targets: ["RestoreFeature"]),
.library(name: "CrashReporting", targets: ["CrashReporting"]),
.library(name: "ProfileFeature", targets: ["ProfileFeature"]),
.library(name: "ContactFeature", targets: ["ContactFeature"]),
.library(name: "NetworkMonitor", targets: ["NetworkMonitor"]),
.library(name: "DropboxFeature", targets: ["DropboxFeature"]),
.library(name: "VersionChecking", targets: ["VersionChecking"]),
.library(name: "SettingsFeature", targets: ["SettingsFeature"]),
.library(name: "ChatListFeature", targets: ["ChatListFeature"]),
......@@ -42,6 +46,7 @@ let package = Package(
.library(name: "ChatInputFeature", targets: ["ChatInputFeature"]),
.library(name: "PushNotifications", targets: ["PushNotifications"]),
.library(name: "OnboardingFeature", targets: ["OnboardingFeature"]),
.library(name: "GoogleDriveFeature", targets: ["GoogleDriveFeature"]),
.library(name: "ContactListFeature", targets: ["ContactListFeature"]),
.library(name: "DependencyInjection", targets: ["DependencyInjection"])
],
......@@ -61,11 +66,26 @@ let package = Package(
url: "https://github.com/Quick/Nimble",
from: "9.0.0"
),
.package(
name: "FilesProvider",
url: "https://github.com/amosavian/FileProvider.git",
from: "0.26.0"
),
.package(
name: "GRDB",
url: "https://github.com/groue/GRDB.swift",
from: "5.3.0"
),
.package(
name: "GoogleSignIn",
url: "https://github.com/google/GoogleSignIn-iOS",
from: "6.1.0"
),
.package(
name: "GoogleAPIClientForREST",
url: "https://github.com/google/google-api-objectivec-client-for-rest",
from: "1.6.0"
),
.package(
name: "SnapKit",
url: "https://github.com/SnapKit/SnapKit",
......@@ -81,6 +101,11 @@ let package = Package(
url: "https://github.com/apple/swift-protobuf",
from: "1.14.0"
),
.package(
name: "SwiftyDropbox",
url: "https://github.com/dropbox/SwiftyDropbox.git",
from: "8.2.1"
),
.package(
name: "KeychainAccess",
url: "https://github.com/kishikawakatsumi/KeychainAccess",
......@@ -128,14 +153,19 @@ let package = Package(
"ChatFeature",
"MenuFeature",
"CrashService",
"BackupFeature",
"SearchFeature",
"iCloudFeature",
"DropboxFeature",
"ContactFeature",
"RestoreFeature",
"ProfileFeature",
"CrashReporting",
"ChatListFeature",
"SettingsFeature",
"PushNotifications",
"OnboardingFeature",
"GoogleDriveFeature",
"ContactListFeature"
]
),
......@@ -236,6 +266,48 @@ let package = Package(
]
),
// MARK: - GoogleDriveFeature
.target(
name: "GoogleDriveFeature",
dependencies: [
.product(
name: "GoogleSignIn",
package: "GoogleSignIn"
),
.product(
name: "GoogleAPIClientForREST_Drive",
package: "GoogleAPIClientForREST"
)
],
resources: [.process("Resources")]
),
// MARK: - iCloudFeature
.target(
name: "iCloudFeature",
dependencies: [
.product(
name: "FilesProvider",
package: "FilesProvider"
)
]
),
// MARK: - DropboxFeature
.target(
name: "DropboxFeature",
dependencies: [
.product(
name: "SwiftyDropbox",
package: "SwiftyDropbox"
)
],
resources: [.process("Resources")]
),
// MARK: - Countries
.target(
......@@ -346,6 +418,7 @@ let package = Package(
"Shared",
"Database",
"Bindings",
"BackupFeature",
"CrashReporting",
"NetworkMonitor",
"DependencyInjection",
......@@ -384,6 +457,22 @@ let package = Package(
]
),
// MARK: - RestoreFeature
.target(
name: "RestoreFeature",
dependencies: [
"HUD",
"Shared",
"Integration",
"Presentation",
"iCloudFeature",
"DropboxFeature",
"GoogleDriveFeature",
"DependencyInjection"
]
),
// MARK: - ContactFeature
.target(
......@@ -560,6 +649,22 @@ let package = Package(
]
),
// MARK: - BackupFeature
.target(
name: "BackupFeature",
dependencies: [
"HUD",
"Shared",
"Models",
"Presentation",
"GoogleDriveFeature",
"iCloudFeature",
"DropboxFeature",
"DependencyInjection"
]
),
// MARK: - ScanFeature
.target(
......
......@@ -6,17 +6,20 @@ import Theme
import XXLogger
import Defaults
import Integration
import SwiftyDropbox
import CrashReporting
import PushNotifications
import DependencyInjection
import OnboardingFeature
import DropboxFeature
let logger = Logger(subsystem: "logs_xxmessenger", category: "AppDelegate.swift")
public class AppDelegate: UIResponder, UIApplicationDelegate {
@Dependency private var pushHandler: PushHandling
@Dependency private var crashReporter: CrashReporter
@Dependency private var dropboxService: DropboxInterface
@KeyObject(.hideAppList, defaultValue: false) var hideAppList: Bool
@KeyObject(.recordingLogs, defaultValue: true) var recordingLogs: Bool
......@@ -148,6 +151,10 @@ public class AppDelegate: UIResponder, UIApplicationDelegate {
application.applicationIconBadgeNumber = 0
coverView?.removeFromSuperview()
}
public func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
dropboxService.handleOpenUrl(url)
}
}
// MARK: Notifications
......
// MARK: SDK
import UIKit
import Network
import QuickLook
import MobileCoreServices
// MARK: Isolated features
......@@ -10,22 +13,28 @@ import Bindings
import XXLogger
import Keychain
import Defaults
import Countries
import Voxophone
import Integration
import Permissions
import CrashService
import iCloudFeature
import CrashReporting
import NetworkMonitor
import DropboxFeature
import VersionChecking
import PushNotifications
import GoogleDriveFeature
import DependencyInjection
import Voxophone
// MARK: UI Features
import ScanFeature
import ChatFeature
import MenuFeature
import BackupFeature
import SearchFeature
import RestoreFeature
import ContactFeature
import ProfileFeature
import ChatListFeature
......@@ -49,21 +58,36 @@ struct DependencyRegistrator {
container.register(MockPushHandler() as PushHandling)
container.register(MockKeychainHandler() as KeychainHandling)
container.register(MockPermissionHandler() as PermissionHandling)
/// Restore / Backup
container.register(iCloudServiceMock() as iCloudInterface)
container.register(DropboxServiceMock() as DropboxInterface)
container.register(GoogleDriveServiceMock() as GoogleDriveInterface)
registerCommonDependencies()
}
// MARK: LIVE
static func registerForLive() {
container.register(KeyObjectStore.userDefaults)
container.register(XXLogger.live())
container.register(CrashReporter.live)
container.register(VersionChecker.live())
container.register(XXNetwork<BindingsClient>() as XXNetworking)
container.register(NetworkMonitor() as NetworkMonitoring)
container.register(KeyObjectStore.userDefaults)
container.register(PushHandler() as PushHandling)
container.register(KeychainHandler() as KeychainHandling)
container.register(PermissionHandler() as PermissionHandling)
/// Restore / Backup
container.register(iCloudService() as iCloudInterface)
container.register(DropboxService() as DropboxInterface)
container.register(GoogleDriveService() as GoogleDriveInterface)
registerCommonDependencies()
}