Skip to content

Commit

Permalink
Make widgets build on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
garthvh committed Mar 4, 2023
1 parent 7121a79 commit c0916b3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 21 deletions.
13 changes: 7 additions & 6 deletions Meshtastic.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
DDDE59F929AF163D00490C6C /* WidgetsBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDE59F829AF163D00490C6C /* WidgetsBundle.swift */; };
DDDE59FB29AF163D00490C6C /* WidgetsLiveActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDE59FA29AF163D00490C6C /* WidgetsLiveActivity.swift */; };
DDDE59FD29AF163D00490C6C /* Widgets.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDE59FC29AF163D00490C6C /* Widgets.swift */; };
DDDE5A0329AF163E00490C6C /* WidgetsExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = DDDE59F429AF163D00490C6C /* WidgetsExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
DDDE5A0329AF163E00490C6C /* WidgetsExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = DDDE59F429AF163D00490C6C /* WidgetsExtension.appex */; platformFilter = ios; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
DDDE5A1029AFE69700490C6C /* MeshActivityAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDE5A0F29AFE69700490C6C /* MeshActivityAttributes.swift */; };
DDDE5A1129AFE69700490C6C /* MeshActivityAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = DDDE5A0F29AFE69700490C6C /* MeshActivityAttributes.swift */; };
DDDE5A1329AFEAB900490C6C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DDDE5A1229AFEAB900490C6C /* Assets.xcassets */; };
Expand Down Expand Up @@ -512,7 +512,6 @@
DDC2E14B26CE248E0042C5E4 = {
isa = PBXGroup;
children = (
DDDE5A0429AF163E00490C6C /* WidgetsExtension.entitlements */,
DDCDC6CD29481FCC004C1DDA /* Localizable.strings */,
DD3CC6BA28E366DF00FA9159 /* Meshtastic.xcdatamodeld */,
DDC2E15626CE248E0042C5E4 /* Meshtastic */,
Expand Down Expand Up @@ -670,6 +669,7 @@
DDDE59F729AF163D00490C6C /* Widgets */ = {
isa = PBXGroup;
children = (
DDDE5A0429AF163E00490C6C /* WidgetsExtension.entitlements */,
DDDE5A1229AFEAB900490C6C /* Assets.xcassets */,
DDDE59F829AF163D00490C6C /* WidgetsBundle.swift */,
DDDE59FA29AF163D00490C6C /* WidgetsLiveActivity.swift */,
Expand Down Expand Up @@ -1024,6 +1024,7 @@
};
DDDE5A0229AF163E00490C6C /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
platformFilter = ios;
target = DDDE59F329AF163D00490C6C /* WidgetsExtension */;
targetProxy = DDDE5A0129AF163E00490C6C /* PBXContainerItemProxy */;
};
Expand Down Expand Up @@ -1095,7 +1096,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -1151,7 +1152,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
IPHONEOS_DEPLOYMENT_TARGET = 16.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -1325,7 +1326,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CODE_SIGN_ENTITLEMENTS = WidgetsExtension.entitlements;
CODE_SIGN_ENTITLEMENTS = Widgets/WidgetsExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = GCH7VS5Y9R;
Expand Down Expand Up @@ -1356,7 +1357,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CODE_SIGN_ENTITLEMENTS = WidgetsExtension.entitlements;
CODE_SIGN_ENTITLEMENTS = Widgets/WidgetsExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = GCH7VS5Y9R;
Expand Down
23 changes: 8 additions & 15 deletions Meshtastic/Views/Bluetooth/Connect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,25 @@ struct Connect: View {
.contextMenu{

if node != nil {

#if !targetEnvironment(macCatalyst)
if #available(iOS 16.2, *) {
Button {
if !liveActivityStarted {
#if canImport(ActivityKit)
#if canImport(ActivityKit)
print("Start live activity.")
startNodeActivity()
#endif
#endif
} else {
#if canImport(ActivityKit)
#if canImport(ActivityKit)
print("Stop live activity.")
endActivity()
#endif
#endif
}
} label: {
Label("Mesh Live Activity", systemImage: liveActivityStarted ? "stop" : "play")
}
}
#endif
Text("Num: \(String(node!.num))")
Text("Short Name: \(node?.user?.shortName ?? "????")")
Text("Long Name: \(node?.user?.longName ?? NSLocalizedString("unknown", comment: "Unknown"))")
Expand Down Expand Up @@ -205,29 +206,21 @@ struct Connect: View {

HStack(alignment: .center) {
Spacer()

#if targetEnvironment(macCatalyst)

#if targetEnvironment(macCatalyst)
if bleManager.connectedPeripheral != nil {

Button(role: .destructive, action: {

if bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.peripheral.state == CBPeripheralState.connected {
bleManager.disconnectPeripheral(reconnect: false)
isPreferredRadio = false
}

}) {

Label("disconnect", systemImage: "antenna.radiowaves.left.and.right.slash")

}
.buttonStyle(.bordered)
.buttonBorderShape(.capsule)
.controlSize(.large)
.padding()
}
#endif
#endif
Spacer()
}
.padding(.bottom, 10)
Expand Down
File renamed without changes.

0 comments on commit c0916b3

Please sign in to comment.