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
12 changes: 6 additions & 6 deletions AirCasting.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -4078,7 +4078,7 @@
CODE_SIGN_ENTITLEMENTS = AirCasting/AirCasting.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = LXAGXH6CF6;
ENABLE_PREVIEWS = YES;
Expand All @@ -4088,7 +4088,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.22.0;
MARKETING_VERSION = 1.22.1;
PRODUCT_BUNDLE_IDENTIFIER = org.habitatmap.AirCasting;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -4106,7 +4106,7 @@
CODE_SIGN_ENTITLEMENTS = AirCasting/AirCasting.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = LXAGXH6CF6;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = AirCasting/Info.plist;
Expand All @@ -4115,7 +4115,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.22.0;
MARKETING_VERSION = 1.22.1;
PRODUCT_BUNDLE_IDENTIFIER = org.habitatmap.AirCasting;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -4194,7 +4194,7 @@
CODE_SIGN_ENTITLEMENTS = AirCasting/AirCasting.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 3;
DEVELOPMENT_TEAM = LXAGXH6CF6;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = AirCasting/Info.plist;
Expand All @@ -4203,7 +4203,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.22.0;
MARKETING_VERSION = 1.22.1;
PRODUCT_BUNDLE_IDENTIFIER = org.habitatmap.AirCasting;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class ChooseSessionTypeViewModel: ObservableObject {
func fixedSessionButtonTapped() {
createNewSession(isSessionFixed: true)
switch fixedSessionNextStep() {
case.location: isTurnLocationOnLinkActive = true
case .airBeam: isPowerABLinkActive = true
case .bluetooth: isTurnBluetoothOnLinkActive = true
default: return
Expand Down Expand Up @@ -95,6 +96,7 @@ class ChooseSessionTypeViewModel: ObservableObject {
}

private func fixedSessionNextStep() -> ProceedToView {
guard locationAuthorization.locationState == .granted else { return .location }
guard !bluetoothHandler.isBluetoothDenied() else { return .bluetooth }
return .airBeam
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct TurnOnLocationView: View {
var proceedToBluetoothView: some View {
NavigationLink(
destination: TurnOnBluetoothView(creatingSessionFlowContinues: $creatingSessionFlowContinues,
sdSyncContinues: .constant(false),
sdSyncContinues: .constant(viewModel.isSDSyncProcess),
isSDClearProcess: viewModel.isSDClearProcess),
isActive: $viewModel.isTurnBluetoothOnLinkActive,
label: {
Expand All @@ -92,7 +92,7 @@ struct TurnOnLocationView: View {
NavigationLink(
destination: SelectDeviceView(creatingSessionFlowContinues: $creatingSessionFlowContinues,
sdSyncContinues: .constant(false)),
isActive: $viewModel.isMobileLinkActive,
isActive: $viewModel.isProceedToSelectDeviceTypeLinkActive,
label: {
EmptyView()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ enum TurnOnLocationUiProcess {
class TurnOnLocationViewModel: ObservableObject {
@Published var isPowerABLinkActive = false
@Published var isTurnBluetoothOnLinkActive = false
@Published var isMobileLinkActive = false
@Published var isProceedToSelectDeviceTypeLinkActive = false
@Published var restartABLink = false
@Published var unplugABLink = false
@Published var alert: AlertInfo?
Expand All @@ -32,6 +32,10 @@ class TurnOnLocationViewModel: ObservableObject {
return if case .sdClear = process { true } else { false }
}

var isSDSyncProcess: Bool {
return if case .sdSync = process { true } else { false }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't return case .sdSync = process work?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It says "case label can only appear inside a switch statement"

}

var shouldShowAlert: Bool {
locationAuthorization.locationState == .denied
}
Expand All @@ -45,22 +49,35 @@ class TurnOnLocationViewModel: ObservableObject {
showRequestLocationAlert()
} else {
switch process {
case .sdClear:
restartABLink.toggle()
case .sdSync:
unplugABLink.toggle()
case .sdClear, .sdSync:
handleBluetoothOrToggle(for: process)

case .createSession(let sessionContext):
if sessionContext.isMobileSession {
isMobileLinkActive = true
} else if bluetoothHandler.isBluetoothDenied() {
isTurnBluetoothOnLinkActive = true
isProceedToSelectDeviceTypeLinkActive = true
Comment on lines 56 to +57
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is here essentially because the UI is structured in the way that when you go to create a mobile session:

  1. You are asked for location permission
  2. You choose the device type (Mic or AB)
  3. You are asked for bluetooth permission if you've chosen AB

} else {
isPowerABLinkActive.toggle()
handleBluetoothOrToggle(for: process)
}
}
}
}

private func handleBluetoothOrToggle(for process: TurnOnLocationUiProcess) {
if bluetoothHandler.isBluetoothDenied() {
isTurnBluetoothOnLinkActive = true
return
}

switch process {
case .sdClear:
restartABLink.toggle()
case .sdSync:
unplugABLink.toggle()
case .createSession:
isPowerABLinkActive.toggle()
}
}

private func showRequestLocationAlert() {
alert = InAppAlerts.locationAlert()
}
Expand Down
Loading