From 5c59225ee10949cc58fccce4d968d1ede58be9b6 Mon Sep 17 00:00:00 2001 From: ivar Date: Mon, 20 Oct 2025 23:12:31 +0200 Subject: Change tabs, get started with camera --- "ios/H\303\246-appen.xcodeproj/project.pbxproj" | 23 ++++++++++++++++++++-- .../xcshareddata/swiftpm/Package.resolved" | 20 ++++++++++++++++++- "ios/H\303\246-appen/CameraContentView.swift" | 8 ++++++++ "ios/H\303\246-appen/CameraManager.swift" | 22 +++++++++++++++++++++ "ios/H\303\246-appen/MapContentView.swift" | 20 +++---------------- "ios/H\303\246-appen/TabBarView.swift" | 11 +++++++---- 6 files changed, 80 insertions(+), 24 deletions(-) create mode 100644 "ios/H\303\246-appen/CameraContentView.swift" create mode 100644 "ios/H\303\246-appen/CameraManager.swift" diff --git "a/ios/H\303\246-appen.xcodeproj/project.pbxproj" "b/ios/H\303\246-appen.xcodeproj/project.pbxproj" index d237a7b..12b0cf8 100644 --- "a/ios/H\303\246-appen.xcodeproj/project.pbxproj" +++ "b/ios/H\303\246-appen.xcodeproj/project.pbxproj" @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 1B9B791B2E7A06C300D5AF05 /* GISTools in Frameworks */ = {isa = PBXBuildFile; productRef = 1B9B791A2E7A06C300D5AF05 /* GISTools */; }; + 1B9E76382EA6DCD200170C86 /* MijickCamera in Frameworks */ = {isa = PBXBuildFile; productRef = 1B9E76372EA6DCD200170C86 /* MijickCamera */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -27,6 +28,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 1B9E76382EA6DCD200170C86 /* MijickCamera in Frameworks */, 1B9B791B2E7A06C300D5AF05 /* GISTools in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -71,6 +73,7 @@ name = "Hæ-appen"; packageProductDependencies = ( 1B9B791A2E7A06C300D5AF05 /* GISTools */, + 1B9E76372EA6DCD200170C86 /* MijickCamera */, ); productName = "Hæ-appen"; productReference = 1B9B79032E79DFB800D5AF05 /* Hæ-appen.app */; @@ -102,6 +105,7 @@ minimizedProjectReferenceProxies = 1; packageReferences = ( 1B9B79192E7A06C300D5AF05 /* XCRemoteSwiftPackageReference "gis-tools" */, + 1B9E76362EA6DCD200170C86 /* XCRemoteSwiftPackageReference "Camera" */, ); preferredProjectObjectVersion = 77; productRefGroup = 1B9B79042E79DFB800D5AF05 /* Products */; @@ -266,7 +270,8 @@ INFOPLIST_FILE = "H--appen-Info.plist"; INFOPLIST_KEY_CFBundleDisplayName = "Hæ"; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking"; - INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = ""; + INFOPLIST_KEY_NSCameraUsageDescription = "This app use the camera for allowing you to post pictures"; + INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "To show you on the, and to get your position when posting images"; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; @@ -307,7 +312,8 @@ INFOPLIST_FILE = "H--appen-Info.plist"; INFOPLIST_KEY_CFBundleDisplayName = "Hæ"; INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.social-networking"; - INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = ""; + INFOPLIST_KEY_NSCameraUsageDescription = "This app use the camera for allowing you to post pictures"; + INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "To show you on the, and to get your position when posting images"; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; @@ -367,6 +373,14 @@ minimumVersion = 1.3.0; }; }; + 1B9E76362EA6DCD200170C86 /* XCRemoteSwiftPackageReference "Camera" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/Mijick/Camera.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 3.0.3; + }; + }; /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ @@ -375,6 +389,11 @@ package = 1B9B79192E7A06C300D5AF05 /* XCRemoteSwiftPackageReference "gis-tools" */; productName = GISTools; }; + 1B9E76372EA6DCD200170C86 /* MijickCamera */ = { + isa = XCSwiftPackageProductDependency; + package = 1B9E76362EA6DCD200170C86 /* XCRemoteSwiftPackageReference "Camera" */; + productName = MijickCamera; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 1B9B78FB2E79DFB800D5AF05 /* Project object */; diff --git "a/ios/H\303\246-appen.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved" "b/ios/H\303\246-appen.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved" index 36b946c..8b323a8 100644 --- "a/ios/H\303\246-appen.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved" +++ "b/ios/H\303\246-appen.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved" @@ -1,6 +1,15 @@ { - "originHash" : "a1cca039aa1704ebabd161056262205e26a4daf8a42ebb77bc98b0b620ee8fb4", + "originHash" : "632a8f8853aa0d419765a7b78fcd66e62b7f9aa58329c89492d24f6985316ee5", "pins" : [ + { + "identity" : "camera", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Mijick/Camera.git", + "state" : { + "revision" : "0f02348fcc8fbbc9224c7fbf444f182dc25d0b40", + "version" : "3.0.3" + } + }, { "identity" : "gis-tools", "kind" : "remoteSourceControl", @@ -9,6 +18,15 @@ "revision" : "f7a4d2aa2acf771b79a91150f359bcd84de9ceac", "version" : "1.13.2" } + }, + { + "identity" : "timer", + "kind" : "remoteSourceControl", + "location" : "https://github.com/Mijick/Timer", + "state" : { + "revision" : "342371c33c3f084d82a4818447ba77d858064c85", + "version" : "2.0.0" + } } ], "version" : 3 diff --git "a/ios/H\303\246-appen/CameraContentView.swift" "b/ios/H\303\246-appen/CameraContentView.swift" new file mode 100644 index 0000000..0819097 --- /dev/null +++ "b/ios/H\303\246-appen/CameraContentView.swift" @@ -0,0 +1,8 @@ +// +// CameraContentView.swift +// Hæ-appen +// +// Created by Ivar Løvlie on 20/10/2025. +// +import SwiftUI + diff --git "a/ios/H\303\246-appen/CameraManager.swift" "b/ios/H\303\246-appen/CameraManager.swift" new file mode 100644 index 0000000..a2d5d39 --- /dev/null +++ "b/ios/H\303\246-appen/CameraManager.swift" @@ -0,0 +1,22 @@ +// +// CameraManager.swift +// Hæ-appen +// +// Created by Ivar Løvlie on 20/10/2025. +// + +import Foundation +import AVFoundation + +class CameraManager: NSObject { + // 1. + private let captureSession = AVCaptureSession() + // 2. + private var deviceInput: AVCaptureDeviceInput? + // 3. + private var videoOutput: AVCaptureVideoDataOutput? + // 4. + private let systemPreferredCamera = AVCaptureDevice.default(for: .auxiliaryPicture) + // 5. + private var sessionQueue = DispatchQueue(label: "video.preview.session") +} diff --git "a/ios/H\303\246-appen/MapContentView.swift" "b/ios/H\303\246-appen/MapContentView.swift" index 4d35dfe..e77c2b7 100644 --- "a/ios/H\303\246-appen/MapContentView.swift" +++ "b/ios/H\303\246-appen/MapContentView.swift" @@ -14,29 +14,15 @@ struct MapContentView: View { @State private var position: MapCameraPosition = .automatic var annotationStringKey: LocalizedStringKey = "Annotation" var annotationCoordinate: CLLocationCoordinate2D = CLLocationCoordinate2D.init() - let symbolSet: [String] = ["cloud.bolt.rain.fill", "sun.rain.fill", "moon.stars.fill", "moon.fill"] var body: some View { - if #available(iOS 26, *) { VStack { Map(initialPosition: .userLocation(fallback: position), scope: mapScope) - }.safeAreaInset(edge: .trailing) { - GlassEffectContainer(spacing: 10.0) { - HStack(spacing: 20.0) { - ForEach(symbolSet.indices, id: \.self) { item in - Image(systemName: symbolSet[item]) - .frame(width: 80.0, height: 80.0) - .font(.system(size: 36)) - .glassEffect() - .glassEffectUnion(id: item < 2 ? "1" : "2", namespace: mapScope) - } - } - } - }.mapScope(mapScope) - .task { + } + .task { LocationAuthorizer.shared.requestWhenInUse() } - } + } } diff --git "a/ios/H\303\246-appen/TabBarView.swift" "b/ios/H\303\246-appen/TabBarView.swift" index ed0a89c..aa12188 100644 --- "a/ios/H\303\246-appen/TabBarView.swift" +++ "b/ios/H\303\246-appen/TabBarView.swift" @@ -10,12 +10,15 @@ struct TabBarView : View { var body: some View { if #available(iOS 26, *) { TabView { - Tab("Hææ", systemImage: "house") { + Tab("Hæ", systemImage: "network") { + MapContentView() + } + Tab("Resten", systemImage: "option") { + MapContentView() + } + Tab("", systemImage: "camera.shutter.button.fill", role: .search) { MapContentView() } - } - .tabViewBottomAccessory { - Image(systemName: "person.fill") } } } -- cgit v1.3