Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions migrator.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
1B05074D2B0612B500384CD5 /* MigratorPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MigratorPage.swift; sourceTree = "<group>"; };
1B05074F2B06130800384CD5 /* WelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeView.swift; sourceTree = "<group>"; };
1B0507512B06133800384CD5 /* MigrationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MigrationView.swift; sourceTree = "<group>"; };
1B4C5BB02B035EBA00D4BD0B /* IBM Data Shift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "IBM Data Shift.app"; sourceTree = BUILT_PRODUCTS_DIR; };
1B4C5BB02B035EBA00D4BD0B /* Data Shift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Data Shift.app"; sourceTree = BUILT_PRODUCTS_DIR; };
1B4C5BB32B035EBA00D4BD0B /* MigratorApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MigratorApp.swift; sourceTree = "<group>"; };
1B4C5BB52B035EBA00D4BD0B /* ServerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerView.swift; sourceTree = "<group>"; };
1B4C5BB72B035EBD00D4BD0B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
Expand Down Expand Up @@ -282,7 +282,7 @@
1B4C5BB12B035EBA00D4BD0B /* Products */ = {
isa = PBXGroup;
children = (
1B4C5BB02B035EBA00D4BD0B /* IBM Data Shift.app */,
1B4C5BB02B035EBA00D4BD0B /* Data Shift.app */,
1B4C5BC12B035EBD00D4BD0B /* migratorTests.xctest */,
1B4C5BCB2B035EBD00D4BD0B /* migratorUITests.xctest */,
);
Expand Down Expand Up @@ -483,9 +483,9 @@
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
1B4C5BAF2B035EBA00D4BD0B /* IBM Data Shift */ = {
1B4C5BAF2B035EBA00D4BD0B /* Data Shift */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1B4C5BD52B035EBD00D4BD0B /* Build configuration list for PBXNativeTarget "IBM Data Shift" */;
buildConfigurationList = 1B4C5BD52B035EBD00D4BD0B /* Build configuration list for PBXNativeTarget "Data Shift" */;
buildPhases = (
5351C1E12E828B9000043122 /* Generate Build Identity File */,
1B4C5BAC2B035EBA00D4BD0B /* Sources */,
Expand All @@ -498,9 +498,9 @@
);
dependencies = (
);
name = "IBM Data Shift";
name = "Data Shift";
productName = migrator;
productReference = 1B4C5BB02B035EBA00D4BD0B /* IBM Data Shift.app */;
productReference = 1B4C5BB02B035EBA00D4BD0B /* Data Shift.app */;
productType = "com.apple.product-type.application";
};
1B4C5BC02B035EBD00D4BD0B /* migratorTests */ = {
Expand Down Expand Up @@ -576,7 +576,7 @@
projectDirPath = "";
projectRoot = "";
targets = (
1B4C5BAF2B035EBA00D4BD0B /* IBM Data Shift */,
1B4C5BAF2B035EBA00D4BD0B /* Data Shift */,
1B4C5BC02B035EBD00D4BD0B /* migratorTests */,
1B4C5BCA2B035EBD00D4BD0B /* migratorUITests */,
);
Expand Down Expand Up @@ -783,12 +783,12 @@
/* Begin PBXTargetDependency section */
1B4C5BC32B035EBD00D4BD0B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 1B4C5BAF2B035EBA00D4BD0B /* IBM Data Shift */;
target = 1B4C5BAF2B035EBA00D4BD0B /* Data Shift */;
targetProxy = 1B4C5BC22B035EBD00D4BD0B /* PBXContainerItemProxy */;
};
1B4C5BCD2B035EBD00D4BD0B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 1B4C5BAF2B035EBA00D4BD0B /* IBM Data Shift */;
target = 1B4C5BAF2B035EBA00D4BD0B /* Data Shift */;
targetProxy = 1B4C5BCC2B035EBD00D4BD0B /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
Expand Down Expand Up @@ -925,7 +925,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 170;
CURRENT_PROJECT_VERSION = 172;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"migrator/Preview Content\"";
DEVELOPMENT_TEAM = "";
Expand All @@ -946,7 +946,7 @@
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.3.0;
PRODUCT_BUNDLE_IDENTIFIER = com.ibm.cio.be.migrator;
PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.datashift;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -964,7 +964,7 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 170;
CURRENT_PROJECT_VERSION = 172;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"migrator/Preview Content\"";
DEVELOPMENT_TEAM = "";
Expand All @@ -985,7 +985,7 @@
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.3.0;
PRODUCT_BUNDLE_IDENTIFIER = com.ibm.cio.be.migrator;
PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.datashift;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down Expand Up @@ -1082,7 +1082,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1B4C5BD52B035EBD00D4BD0B /* Build configuration list for PBXNativeTarget "IBM Data Shift" */ = {
1B4C5BD52B035EBD00D4BD0B /* Build configuration list for PBXNativeTarget "Data Shift" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1B4C5BD62B035EBD00D4BD0B /* Debug */,
Expand Down
12 changes: 6 additions & 6 deletions migrator.xcodeproj/xcshareddata/xcschemes/Data Shift.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1B4C5BAF2B035EBA00D4BD0B"
BuildableName = "IBM Data Shift.app"
BlueprintName = "IBM Data Shift"
BuildableName = "Data Shift.app"
BlueprintName = "Data Shift"
ReferencedContainer = "container:migrator.xcodeproj">
</BuildableReference>
</BuildActionEntry>
Expand Down Expand Up @@ -68,8 +68,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1B4C5BAF2B035EBA00D4BD0B"
BuildableName = "IBM Data Shift.app"
BlueprintName = "IBM Data Shift"
BuildableName = "Data Shift.app"
BlueprintName = "Data Shift"
ReferencedContainer = "container:migrator.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
Expand All @@ -85,8 +85,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1B4C5BAF2B035EBA00D4BD0B"
BuildableName = "IBM Data Shift.app"
BlueprintName = "IBM Data Shift"
BuildableName = "Data Shift.app"
BlueprintName = "Data Shift"
ReferencedContainer = "container:migrator.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
Expand Down
4 changes: 2 additions & 2 deletions migrator/Controllers/JamfReconManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Foundation
/// The JamfReconManager actor is designed to manage and monitor the execution of a specific Jamf policy,
/// particularly related to inventory updates (recon), using AppleScript to interact with system processes.
actor JamfReconManager {

// MARK: - Constants

/// Logger instance for logging events and messages
Expand All @@ -24,7 +24,7 @@ actor JamfReconManager {
var reconPolicyID: String {
switch DeviceManagementHelper.shared.state {
case .managed(env: let env):
return env.reconPolicyID
return env.reconPolicyID ?? "null"
default:
return ""
}
Expand Down
39 changes: 38 additions & 1 deletion migrator/Controllers/MigrationReportController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ struct MigrationReportData {
let migrationSizeInBytes: Int64?
let sourceDeviceName: String?
let targetDeviceName: String?
let transferMethod: String?
let chosenMigrationOption: String?
let migratedFiles: [String]
let migratedApps: [String]
let errors: [String]
Expand All @@ -35,6 +37,8 @@ final class MigrationReportController {
private var migrationSizeInBytes: Int64 = 0
private var sourceDeviceName: String?
private var targetDeviceName: String?
private var transferMethod: String?
private var chosenMigrationOption: String?
private var migratedFiles: [String] = []
private var migratedApps: [String] = []
private var errors: [String] = []
Expand All @@ -59,16 +63,19 @@ final class MigrationReportController {

func setMigrationStart(_ date: Date = .now) {
self.migrationStart = date
self.saveToUserDefaults(key: .lastMigrationStartDate, value: date as NSDate)
self.generateAndSavePDF()
}

func setMigrationEnd(_ date: Date = .now) {
self.migrationEnd = date
self.saveToUserDefaults(key: .lastMigrationEndDate, value: date as NSDate)
self.generateAndSavePDF()
}

func setTargetDevice(_ target: String) {
self.targetDeviceName = target
self.saveToUserDefaults(key: .lastMigrationTargetDevice, value: target as NSString)
self.generateAndSavePDF()
}

Expand All @@ -86,11 +93,25 @@ final class MigrationReportController {

func addError(_ errorMessage: String) {
self.errors.append(errorMessage)
self.saveToUserDefaults(key: .lastMigrationErrors, value: errors as NSArray)
self.generateAndSavePDF()
}

func setMigrationSize(_ bytes: Int64) {
self.migrationSizeInBytes = bytes
self.saveToUserDefaults(key: .lastMigrationSize, value: bytes as NSNumber)
self.generateAndSavePDF()
}

func setMigrationTransferMethod(_ method: String) {
self.transferMethod = method
self.saveToUserDefaults(key: .lastMigrationTransferMethod, value: method as NSString)
self.generateAndSavePDF()
}

func setMigrationChosenOption(_ option: String) {
self.chosenMigrationOption = option
self.saveToUserDefaults(key: .lastMigrationChosenOption, value: option as NSString)
self.generateAndSavePDF()
}

Expand Down Expand Up @@ -158,6 +179,16 @@ final class MigrationReportController {
addLine("Target Device: \(data.targetDeviceName ?? "N/P")")
addLine("")

if let option = data.chosenMigrationOption, !option.isEmpty {
addLine("Selected Migration Option: \(option)")
addLine("")
}

if let method = data.transferMethod, !method.isEmpty {
addLine("Transfer Method: \(method)")
addLine("")
}

addHeading("Migrated Files/Directories")
if data.migratedFiles.isEmpty {
addLine("None")
Expand Down Expand Up @@ -202,6 +233,8 @@ final class MigrationReportController {
migrationSizeInBytes: self.migrationSizeInBytes,
sourceDeviceName: self.sourceDeviceName,
targetDeviceName: self.targetDeviceName,
transferMethod: self.transferMethod,
chosenMigrationOption: self.chosenMigrationOption,
migratedFiles: self.migratedFiles,
migratedApps: self.migratedApps,
errors: self.errors
Expand All @@ -215,7 +248,7 @@ final class MigrationReportController {

private func savePDF(pdfData: Data) {
logger.log("migrationReportcontroller.savePDF: Saving PDF report to \(reportURL.relativePath)", type: .debug)

// If the file exists, remove it first to avoid createFile failure
if FileManager.default.fileExists(atPath: reportURL.relativePath) {
logger.log("migrationReportcontroller.savePDF: Existing report file found, removing it", type: .debug)
Expand All @@ -234,4 +267,8 @@ final class MigrationReportController {
}
logger.log("migrationReportcontroller.savePDF: PDF report saved successfully!", type: .debug)
}

private func saveToUserDefaults(key: Utils.UserDefaultsHelpers.ReportKeys, value: Any) {
UserDefaults.standard.set(value, forKey: key.rawValue)
}
}
Loading
Loading