Skip to content
Snippets Groups Projects
Commit cc0946dc authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Merge branch 'development' into feature/messenger-send-file

# Conflicts:
#	Sources/XXMessengerClient/Messenger/MessengerEnvironment.swift
parents 5acba553 47b3ab24
No related branches found
No related tags found
2 merge requests!122Messenger send file,!102Release 1.0.0
Showing
with 737 additions and 48 deletions
before_script:
- for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts
- for ip in $(dig @8.8.8.8 git.xx.network +short); do ssh-keyscan git.xx.network,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts
- echo $CI_BUILD_REF
- echo $CI_PROJECT_DIR
- echo $PWD
- swift --version
- xcodebuild -version
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan -t rsa $GITLAB_SERVER > ~/.ssh/known_hosts
stages:
- test
......
......@@ -36,10 +36,10 @@
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "XXClientTests"
......@@ -50,10 +50,10 @@
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "XXMessengerClientTests"
......
......@@ -4,7 +4,7 @@
## ▶️ Instantiate messenger
Example:
### Example
```swift
// setup environment:
......@@ -24,7 +24,7 @@ let messenger: Messenger = .live(environment)
## 🚀 Start messenger
Example:
### Example
```swift
// allow cancellation of callbacks:
......@@ -84,7 +84,7 @@ func start(messenger: Messenger) throws {
## 🛠 Use client components directly
Example:
### Example
```swift
// get cMix:
......@@ -95,4 +95,64 @@ let e2e = messenger.e2e()
// get UserDicovery:
let ud = messenger.ud()
// get Backup:
let backup = messenger.backup()
```
## 💾 Backup
### Make backup
```swift
// start receiving backup data before starting or resuming backup:
let cancellable = messenger.registerBackupCallback(.init { data in
// handle backup data, save on disk, upload to cloud, etc.
})
// check if backup is already running:
if messenger.isBackupRunning() == false {
do {
// try to resume previous backup:
try messenger.resumeBackup()
} catch {
// try to start a new backup:
let params: BackupParams = ...
try messenger.startBackup(
password: "backup-passphrase",
params: params
)
}
}
// update params in the backup:
let params: BackupParams = ...
try messenger.backupParams(params)
// stop the backup:
try messenger.stopBackup()
// optionally stop receiving backup data
cancellable.cancel()
```
When starting a new backup you must provide `BackupParams` to prevent creating backups that does not contain it.
The registered backup callback can be reused later when a new backup is started. There is no need to cancel it and register a new callback in such a case.
### Restore from backup
```swift
let result = try messenger.restoreBackup(
backupData: ...,
backupPassphrase: "backup-passphrase"
)
// handle restoration result:
let restoredUsername = result.restoredParams.username
let facts = try messenger.ud.tryGet().getFacts()
let restoredEmail = facts.get(.email)?.value
let restoredPhone = facts.get(.phone)?.value
```
If no error was thrown during restoration, the `Messenger` is already loaded, started, connected, and logged in.
\ No newline at end of file
// swift-tools-version:5.6
// swift-tools-version:5.7
// This file makes Xcode doesn't display this directory inside swift package.
import PackageDescription
let package = Package(name: "", products: [], targets: [])
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BackupFeature"
BuildableName = "BackupFeature"
BlueprintName = "BackupFeature"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BackupFeatureTests"
BuildableName = "BackupFeatureTests"
BlueprintName = "BackupFeatureTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BackupFeature"
BuildableName = "BackupFeature"
BlueprintName = "BackupFeature"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ContactLookupFeature"
BuildableName = "ContactLookupFeature"
BlueprintName = "ContactLookupFeature"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ContactLookupFeatureTests"
BuildableName = "ContactLookupFeatureTests"
BlueprintName = "ContactLookupFeatureTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ContactLookupFeature"
BuildableName = "ContactLookupFeature"
BlueprintName = "ContactLookupFeature"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "MyContactFeature"
BuildableName = "MyContactFeature"
BlueprintName = "MyContactFeature"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "MyContactFeatureTests"
BuildableName = "MyContactFeatureTests"
BlueprintName = "MyContactFeatureTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "MyContactFeature"
BuildableName = "MyContactFeature"
BlueprintName = "MyContactFeature"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ResetAuthFeature"
BuildableName = "ResetAuthFeature"
BlueprintName = "ResetAuthFeature"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ResetAuthFeatureTests"
BuildableName = "ResetAuthFeatureTests"
BlueprintName = "ResetAuthFeatureTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ResetAuthFeature"
BuildableName = "ResetAuthFeature"
BlueprintName = "ResetAuthFeature"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
// swift-tools-version: 5.6
// swift-tools-version: 5.7
import PackageDescription
let swiftSettings: [SwiftSetting] = [
.unsafeFlags(
[
// "-Xfrontend", "-warn-concurrency",
// "-Xfrontend", "-debug-time-function-bodies",
// "-Xfrontend", "-debug-time-expression-type-checking",
],
.when(configuration: .debug)
),
//.unsafeFlags(["-Xfrontend", "-warn-concurrency"], .when(configuration: .debug)),
//.unsafeFlags(["-Xfrontend", "-debug-time-function-bodies"], .when(configuration: .debug)),
//.unsafeFlags(["-Xfrontend", "-debug-time-expression-type-checking"], .when(configuration: .debug)),
]
let package = Package(
......@@ -20,13 +15,17 @@ let package = Package(
products: [
.library(name: "AppCore", targets: ["AppCore"]),
.library(name: "AppFeature", targets: ["AppFeature"]),
.library(name: "BackupFeature", targets: ["BackupFeature"]),
.library(name: "ChatFeature", targets: ["ChatFeature"]),
.library(name: "CheckContactAuthFeature", targets: ["CheckContactAuthFeature"]),
.library(name: "ConfirmRequestFeature", targets: ["ConfirmRequestFeature"]),
.library(name: "ContactFeature", targets: ["ContactFeature"]),
.library(name: "ContactLookupFeature", targets: ["ContactLookupFeature"]),
.library(name: "ContactsFeature", targets: ["ContactsFeature"]),
.library(name: "HomeFeature", targets: ["HomeFeature"]),
.library(name: "MyContactFeature", targets: ["MyContactFeature"]),
.library(name: "RegisterFeature", targets: ["RegisterFeature"]),
.library(name: "ResetAuthFeature", targets: ["ResetAuthFeature"]),
.library(name: "RestoreFeature", targets: ["RestoreFeature"]),
.library(name: "SendRequestFeature", targets: ["SendRequestFeature"]),
.library(name: "UserSearchFeature", targets: ["UserSearchFeature"]),
......@@ -39,11 +38,11 @@ let package = Package(
),
.package(
url: "https://github.com/pointfreeco/swift-composable-architecture.git",
.upToNextMajor(from: "0.40.1")
.upToNextMajor(from: "0.40.2")
),
.package(
url: "https://git.xx.network/elixxir/client-ios-db.git",
.upToNextMajor(from: "1.1.0")
.upToNextMajor(from: "1.2.0")
),
.package(
url: "https://github.com/darrarski/swift-composable-presentation.git",
......@@ -51,13 +50,26 @@ let package = Package(
),
.package(
url: "https://github.com/pointfreeco/xctest-dynamic-overlay.git",
.upToNextMajor(from: "0.4.0")
.upToNextMajor(from: "0.4.1")
),
.package(
url: "https://github.com/pointfreeco/swift-custom-dump.git",
.upToNextMajor(from: "0.5.2")
),
.package(
url: "https://github.com/apple/swift-log.git",
.upToNextMajor(from: "1.4.4")
),
.package(
url: "https://github.com/kean/Pulse.git",
.upToNextMajor(from: "2.1.2")
),
],
targets: [
.target(
name: "AppCore",
dependencies: [
.product(name: "Logging", package: "swift-log"),
.product(name: "XCTestDynamicOverlay", package: "xctest-dynamic-overlay"),
.product(name: "XXClient", package: "elixxir-dapps-sdk-swift"),
.product(name: "XXDatabase", package: "client-ios-db"),
......@@ -69,7 +81,8 @@ let package = Package(
.testTarget(
name: "AppCoreTests",
dependencies: [
.target(name: "AppCore")
.target(name: "AppCore"),
.product(name: "CustomDump", package: "swift-custom-dump"),
],
swiftSettings: swiftSettings
),
......@@ -77,13 +90,17 @@ let package = Package(
name: "AppFeature",
dependencies: [
.target(name: "AppCore"),
.target(name: "BackupFeature"),
.target(name: "ChatFeature"),
.target(name: "CheckContactAuthFeature"),
.target(name: "ConfirmRequestFeature"),
.target(name: "ContactFeature"),
.target(name: "ContactLookupFeature"),
.target(name: "ContactsFeature"),
.target(name: "HomeFeature"),
.target(name: "MyContactFeature"),
.target(name: "RegisterFeature"),
.target(name: "ResetAuthFeature"),
.target(name: "RestoreFeature"),
.target(name: "SendRequestFeature"),
.target(name: "UserSearchFeature"),
......@@ -91,6 +108,9 @@ let package = Package(
.target(name: "WelcomeFeature"),
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "ComposablePresentation", package: "swift-composable-presentation"),
.product(name: "Logging", package: "swift-log"),
.product(name: "PulseLogHandler", package: "Pulse"),
.product(name: "PulseUI", package: "Pulse"),
.product(name: "XXMessengerClient", package: "elixxir-dapps-sdk-swift"),
.product(name: "XXModels", package: "client-ios-db"),
],
......@@ -100,6 +120,22 @@ let package = Package(
name: "AppFeatureTests",
dependencies: [
.target(name: "AppFeature"),
.product(name: "CustomDump", package: "swift-custom-dump"),
],
swiftSettings: swiftSettings
),
.target(
name: "BackupFeature",
dependencies: [
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "XXMessengerClient", package: "elixxir-dapps-sdk-swift"),
],
swiftSettings: swiftSettings
),
.testTarget(
name: "BackupFeatureTests",
dependencies: [
.target(name: "BackupFeature"),
],
swiftSettings: swiftSettings
),
......@@ -118,6 +154,7 @@ let package = Package(
name: "ChatFeatureTests",
dependencies: [
.target(name: "ChatFeature"),
.product(name: "CustomDump", package: "swift-custom-dump"),
],
swiftSettings: swiftSettings
),
......@@ -135,6 +172,7 @@ let package = Package(
name: "CheckContactAuthFeatureTests",
dependencies: [
.target(name: "CheckContactAuthFeature"),
.product(name: "CustomDump", package: "swift-custom-dump"),
]
),
.target(
......@@ -151,6 +189,7 @@ let package = Package(
name: "ConfirmRequestFeatureTests",
dependencies: [
.target(name: "ConfirmRequestFeature"),
.product(name: "CustomDump", package: "swift-custom-dump"),
]
),
.target(
......@@ -160,6 +199,8 @@ let package = Package(
.target(name: "ChatFeature"),
.target(name: "CheckContactAuthFeature"),
.target(name: "ConfirmRequestFeature"),
.target(name: "ContactLookupFeature"),
.target(name: "ResetAuthFeature"),
.target(name: "SendRequestFeature"),
.target(name: "VerifyContactFeature"),
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
......@@ -173,6 +214,25 @@ let package = Package(
name: "ContactFeatureTests",
dependencies: [
.target(name: "ContactFeature"),
.product(name: "CustomDump", package: "swift-custom-dump"),
],
swiftSettings: swiftSettings
),
.target(
name: "ContactLookupFeature",
dependencies: [
.target(name: "AppCore"),
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "XXMessengerClient", package: "elixxir-dapps-sdk-swift"),
.product(name: "XXModels", package: "client-ios-db"),
],
swiftSettings: swiftSettings
),
.testTarget(
name: "ContactLookupFeatureTests",
dependencies: [
.target(name: "ContactLookupFeature"),
.product(name: "CustomDump", package: "swift-custom-dump"),
],
swiftSettings: swiftSettings
),
......@@ -181,6 +241,7 @@ let package = Package(
dependencies: [
.target(name: "AppCore"),
.target(name: "ContactFeature"),
.target(name: "MyContactFeature"),
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "ComposablePresentation", package: "swift-composable-presentation"),
.product(name: "XXClient", package: "elixxir-dapps-sdk-swift"),
......@@ -193,6 +254,7 @@ let package = Package(
name: "ContactsFeatureTests",
dependencies: [
.target(name: "ContactsFeature"),
.product(name: "CustomDump", package: "swift-custom-dump"),
],
swiftSettings: swiftSettings
),
......@@ -200,11 +262,13 @@ let package = Package(
name: "HomeFeature",
dependencies: [
.target(name: "AppCore"),
.target(name: "BackupFeature"),
.target(name: "ContactsFeature"),
.target(name: "RegisterFeature"),
.target(name: "UserSearchFeature"),
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "ComposablePresentation", package: "swift-composable-presentation"),
.product(name: "XXClient", package: "elixxir-dapps-sdk-swift"),
.product(name: "XXMessengerClient", package: "elixxir-dapps-sdk-swift"),
],
swiftSettings: swiftSettings
......@@ -213,6 +277,26 @@ let package = Package(
name: "HomeFeatureTests",
dependencies: [
.target(name: "HomeFeature"),
.product(name: "CustomDump", package: "swift-custom-dump"),
],
swiftSettings: swiftSettings
),
.target(
name: "MyContactFeature",
dependencies: [
.target(name: "AppCore"),
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "XXClient", package: "elixxir-dapps-sdk-swift"),
.product(name: "XXMessengerClient", package: "elixxir-dapps-sdk-swift"),
.product(name: "XXModels", package: "client-ios-db"),
],
swiftSettings: swiftSettings
),
.testTarget(
name: "MyContactFeatureTests",
dependencies: [
.target(name: "MyContactFeature"),
.product(name: "CustomDump", package: "swift-custom-dump"),
],
swiftSettings: swiftSettings
),
......@@ -231,13 +315,34 @@ let package = Package(
name: "RegisterFeatureTests",
dependencies: [
.target(name: "RegisterFeature"),
.product(name: "CustomDump", package: "swift-custom-dump"),
],
swiftSettings: swiftSettings
),
.target(
name: "ResetAuthFeature",
dependencies: [
.target(name: "AppCore"),
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "XXClient", package: "elixxir-dapps-sdk-swift"),
.product(name: "XXMessengerClient", package: "elixxir-dapps-sdk-swift"),
],
swiftSettings: swiftSettings
),
.testTarget(
name: "ResetAuthFeatureTests",
dependencies: [
.target(name: "ResetAuthFeature"),
],
swiftSettings: swiftSettings
),
.target(
name: "RestoreFeature",
dependencies: [
.target(name: "AppCore"),
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "XXMessengerClient", package: "elixxir-dapps-sdk-swift"),
.product(name: "XXModels", package: "client-ios-db"),
],
swiftSettings: swiftSettings
),
......@@ -245,6 +350,7 @@ let package = Package(
name: "RestoreFeatureTests",
dependencies: [
.target(name: "RestoreFeature"),
.product(name: "CustomDump", package: "swift-custom-dump"),
],
swiftSettings: swiftSettings
),
......@@ -263,6 +369,7 @@ let package = Package(
name: "SendRequestFeatureTests",
dependencies: [
.target(name: "SendRequestFeature"),
.product(name: "CustomDump", package: "swift-custom-dump"),
],
swiftSettings: swiftSettings
),
......@@ -282,6 +389,7 @@ let package = Package(
name: "UserSearchFeatureTests",
dependencies: [
.target(name: "UserSearchFeature"),
.product(name: "CustomDump", package: "swift-custom-dump"),
],
swiftSettings: swiftSettings
),
......@@ -299,11 +407,13 @@ let package = Package(
name: "VerifyContactFeatureTests",
dependencies: [
.target(name: "VerifyContactFeature"),
.product(name: "CustomDump", package: "swift-custom-dump"),
]
),
.target(
name: "WelcomeFeature",
dependencies: [
.target(name: "AppCore"),
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "XXMessengerClient", package: "elixxir-dapps-sdk-swift"),
],
......@@ -313,6 +423,7 @@ let package = Package(
name: "WelcomeFeatureTests",
dependencies: [
.target(name: "WelcomeFeature"),
.product(name: "CustomDump", package: "swift-custom-dump"),
],
swiftSettings: swiftSettings
),
......
......@@ -12,8 +12,9 @@
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
31964B8A28A6D37100BBDC17 /* XXMessenger.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = XXMessenger.app; sourceTree = BUILT_PRODUCTS_DIR; };
31964B8A28A6D37100BBDC17 /* XXME.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = XXME.app; sourceTree = BUILT_PRODUCTS_DIR; };
31964B9128A6D37200BBDC17 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
31EF69BC28F035DE00BD83FC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -39,7 +40,7 @@
31964B8B28A6D37100BBDC17 /* Products */ = {
isa = PBXGroup;
children = (
31964B8A28A6D37100BBDC17 /* XXMessenger.app */,
31964B8A28A6D37100BBDC17 /* XXME.app */,
);
name = Products;
sourceTree = "<group>";
......@@ -48,6 +49,7 @@
isa = PBXGroup;
children = (
31964B9128A6D37200BBDC17 /* Assets.xcassets */,
31EF69BC28F035DE00BD83FC /* Info.plist */,
);
path = XXMessenger;
sourceTree = "<group>";
......@@ -72,7 +74,7 @@
313CFFF928B632E40050B10D /* AppFeature */,
);
productName = XXMessenger;
productReference = 31964B8A28A6D37100BBDC17 /* XXMessenger.app */;
productReference = 31964B8A28A6D37100BBDC17 /* XXME.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
......@@ -163,7 +165,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0;
CURRENT_PROJECT_VERSION = 2;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
......@@ -226,7 +228,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 0;
CURRENT_PROJECT_VERSION = 2;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
......@@ -256,9 +258,11 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = S6JDM2WW29;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = XXMessenger/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
......@@ -270,7 +274,11 @@
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = xx.network.XXMessengerExample;
PRODUCT_NAME = "$(TARGET_NAME)";
PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)";
PRODUCT_NAME = XXME;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
......@@ -283,9 +291,11 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = S6JDM2WW29;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = XXMessenger/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
......@@ -297,7 +307,11 @@
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = xx.network.XXMessengerExample;
PRODUCT_NAME = "$(TARGET_NAME)";
PRODUCT_MODULE_NAME = "$(TARGET_NAME:c99extidentifier)";
PRODUCT_NAME = XXME;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 1;
......
......@@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "31964B8928A6D37100BBDC17"
BuildableName = "XXMessenger.app"
BuildableName = "XXME.app"
BlueprintName = "XXMessenger"
ReferencedContainer = "container:XXMessenger.xcodeproj">
</BuildableReference>
......@@ -49,6 +49,16 @@
ReferencedContainer = "container:..">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BackupFeatureTests"
BuildableName = "BackupFeatureTests"
BlueprintName = "BackupFeatureTests"
ReferencedContainer = "container:..">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
......@@ -89,6 +99,16 @@
ReferencedContainer = "container:..">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ContactLookupFeatureTests"
BuildableName = "ContactLookupFeatureTests"
BlueprintName = "ContactLookupFeatureTests"
ReferencedContainer = "container:..">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
......@@ -109,6 +129,16 @@
ReferencedContainer = "container:..">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "MyContactFeatureTests"
BuildableName = "MyContactFeatureTests"
BlueprintName = "MyContactFeatureTests"
ReferencedContainer = "container:..">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
......@@ -119,6 +149,16 @@
ReferencedContainer = "container:..">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ResetAuthFeatureTests"
BuildableName = "ResetAuthFeatureTests"
BlueprintName = "ResetAuthFeatureTests"
ReferencedContainer = "container:..">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
......@@ -186,7 +226,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "31964B8928A6D37100BBDC17"
BuildableName = "XXMessenger.app"
BuildableName = "XXME.app"
BlueprintName = "XXMessenger"
ReferencedContainer = "container:XXMessenger.xcodeproj">
</BuildableReference>
......@@ -203,7 +243,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "31964B8928A6D37100BBDC17"
BuildableName = "XXMessenger.app"
BuildableName = "XXME.app"
BlueprintName = "XXMessenger"
ReferencedContainer = "container:XXMessenger.xcodeproj">
</BuildableReference>
......
<?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>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>NSLocalNetworkUsageDescription</key>
<string>Network usage required for debugging purposes </string>
<key>NSBonjourServices</key>
<array>
<string>_pulse._tcp</string>
</array>
</dict>
</plist>
......@@ -18,7 +18,7 @@ extension AuthCallbackHandlerReset {
guard var dbContact = try db().fetchContacts(.init(id: [id])).first else {
return
}
dbContact.authStatus = .stranger
dbContact.authStatus = .friend
dbContact = try db().saveContact(dbContact)
}
}
......
import Foundation
import XXModels
public struct DBManager {
......@@ -8,7 +9,12 @@ public struct DBManager {
}
extension DBManager {
public static func live() -> DBManager {
public static func live(
url: URL = FileManager.default
.urls(for: .applicationSupportDirectory, in: .userDomainMask)
.first!
.appendingPathComponent("database")
) -> DBManager {
class Container {
var db: Database?
}
......@@ -17,9 +23,9 @@ extension DBManager {
return DBManager(
hasDB: .init { container.db != nil },
makeDB: .live(setDB: { container.db = $0 }),
makeDB: .live(url: url, setDB: { container.db = $0 }),
getDB: .live(getDB: { container.db }),
removeDB: .live(getDB: { container.db }, unsetDB: { container.db = nil })
removeDB: .live(url: url, getDB: { container.db }, unsetDB: { container.db = nil })
)
}
}
......
......@@ -13,18 +13,14 @@ public struct DBManagerMakeDB {
extension DBManagerMakeDB {
public static func live(
url: URL,
setDB: @escaping (Database) -> Void
) -> DBManagerMakeDB {
DBManagerMakeDB {
let dbDirectoryURL = FileManager.default
.urls(for: .applicationSupportDirectory, in: .userDomainMask)
.first!
.appendingPathComponent("database")
try? FileManager.default
.createDirectory(at: dbDirectoryURL, withIntermediateDirectories: true)
.createDirectory(at: url, withIntermediateDirectories: true)
let dbFilePath = dbDirectoryURL
let dbFilePath = url
.appendingPathComponent("db")
.appendingPathExtension("sqlite")
.path
......
......@@ -13,12 +13,18 @@ public struct DBManagerRemoveDB {
extension DBManagerRemoveDB {
public static func live(
url: URL,
getDB: @escaping () -> Database?,
unsetDB: @escaping () -> Void
) -> DBManagerRemoveDB {
DBManagerRemoveDB {
try getDB()?.drop()
let db = getDB()
unsetDB()
try db?.drop()
let fm = FileManager.default
if fm.fileExists(atPath: url.path) {
try fm.removeItem(atPath: url.path)
}
}
}
}
......
import Foundation
import Logging
import XCTestDynamicOverlay
public struct Logger {
public enum Message: Equatable {
case error(NSError)
}
public var run: (Message, String, String, UInt) -> Void
public func callAsFunction(
_ msg: Message,
file: String = #file,
function: String = #function,
line: UInt = #line
) {
run(msg, file, function, line)
}
}
extension Logger {
public static func live() -> Logger {
let logger = Logging.Logger(label: "xx.network.XXMessengerExample")
return Logger { msg, file, function, line in
switch msg {
case .error(let error):
logger.error(
.init(stringLiteral: error.localizedDescription),
file: file,
function: function,
line: line
)
}
}
}
}
extension Logger {
public static let unimplemented = Logger(
run: XCTUnimplemented("\(Self.self).error")
)
}
import SwiftUI
public struct AppVersionText: View {
public init() {}
public var body: some View {
Text("v\(version) (\(build))")
}
var version: String = Bundle.main.shortVersionString ?? "0.0.0"
var build: String = Bundle.main.versionString ?? "0"
}
private extension Bundle {
var shortVersionString: String? {
infoDictionary?["CFBundleShortVersionString"] as? String
}
var versionString: String? {
infoDictionary?["CFBundleVersion"] as? String
}
}
#if DEBUG
struct AppVersionText_Previews: PreviewProvider {
static var previews: some View {
AppVersionText()
.padding()
.previewLayout(.sizeThatFits)
}
}
#endif
import Foundation
extension Data {
public func hexString(bytesSeparator: String = " ") -> String {
map { String(format: "%02hhx\(bytesSeparator)", $0) }.joined()
}
}
import SwiftUI
struct ShakeViewModifier: ViewModifier {
var action: () -> Void
func body(content: Content) -> some View {
content.onReceive(
NotificationCenter.default.publisher(
for: UIDevice.deviceDidShakeNotification
),
perform: { _ in
action()
}
)
}
}
extension View {
public func onShake(perform action: @escaping () -> Void) -> some View {
modifier(ShakeViewModifier(action: action))
}
}
extension UIDevice {
static let deviceDidShakeNotification = Notification.Name(
rawValue: "deviceDidShakeNotification"
)
}
extension UIWindow {
open override func motionEnded(
_ motion: UIEvent.EventSubtype,
with event: UIEvent?
) {
super.motionEnded(motion, with: event)
guard motion == .motionShake else { return }
NotificationCenter.default.post(
name: UIDevice.deviceDidShakeNotification,
object: nil
)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment