Skip to content

Commit de92923

Browse files
committed
Remove QR code stuff for now
1 parent 20804ea commit de92923

File tree

4 files changed

+14
-167
lines changed

4 files changed

+14
-167
lines changed

ntfy.xcodeproj/project.pbxproj

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
94E9196C28353E0100F30170 /* Log.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9474F216283531A200CDE4DD /* Log.swift */; };
5353
E27008102AF0F64B006E33BA /* SubscriptionsObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = E270080F2AF0F64B006E33BA /* SubscriptionsObservable.swift */; };
5454
E27008122AF1030A006E33BA /* NotificationsObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = E27008112AF1030A006E33BA /* NotificationsObservable.swift */; };
55-
E278CB332AECECCA004B9143 /* QRScannerUIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E278CB322AECECCA004B9143 /* QRScannerUIView.swift */; };
5655
/* End PBXBuildFile section */
5756

5857
/* Begin PBXContainerItemProxy section */
@@ -116,7 +115,6 @@
116115
94CD1969283E666900973B93 /* EmojiManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EmojiManager.swift; sourceTree = "<group>"; };
117116
E270080F2AF0F64B006E33BA /* SubscriptionsObservable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionsObservable.swift; sourceTree = "<group>"; };
118117
E27008112AF1030A006E33BA /* NotificationsObservable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationsObservable.swift; sourceTree = "<group>"; };
119-
E278CB322AECECCA004B9143 /* QRScannerUIView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRScannerUIView.swift; sourceTree = "<group>"; };
120118
/* End PBXFileReference section */
121119

122120
/* Begin PBXFrameworksBuildPhase section */
@@ -206,7 +204,6 @@
206204
94B736D4284AF9B2003D69FB /* SettingsView.swift */,
207205
94B736D6284AF9BE003D69FB /* MainView.swift */,
208206
9474F20728331F3900CDE4DD /* NotificationListView.swift */,
209-
E278CB322AECECCA004B9143 /* QRScannerUIView.swift */,
210207
);
211208
path = Views;
212209
sourceTree = "<group>";
@@ -218,10 +215,10 @@
218215
9474F1FE28316ACE00CDE4DD /* Subscription.swift */,
219216
9474F1F82830835400CDE4DD /* Store.swift */,
220217
9474F20B283321C300CDE4DD /* Notification.swift */,
218+
E27008112AF1030A006E33BA /* NotificationsObservable.swift */,
221219
94A3F7C7283734D900C48E79 /* SubscriptionManager.swift */,
222-
9407EDD9284ADE1F00C1C334 /* User.swift */,
223220
E270080F2AF0F64B006E33BA /* SubscriptionsObservable.swift */,
224-
E27008112AF1030A006E33BA /* NotificationsObservable.swift */,
221+
9407EDD9284ADE1F00C1C334 /* User.swift */,
225222
);
226223
path = Persistence;
227224
sourceTree = "<group>";
@@ -386,7 +383,6 @@
386383
E27008122AF1030A006E33BA /* NotificationsObservable.swift in Sources */,
387384
9486714A2841D0CE0093C7A4 /* ActionExecutor.swift in Sources */,
388385
9474F1FD2831311A00CDE4DD /* SubscriptionAddView.swift in Sources */,
389-
E278CB332AECECCA004B9143 /* QRScannerUIView.swift in Sources */,
390386
9474F1FF28316ACE00CDE4DD /* Subscription.swift in Sources */,
391387
94CD196A283E666900973B93 /* EmojiManager.swift in Sources */,
392388
9474F1C1282F2AA700CDE4DD /* AppMain.swift in Sources */,
@@ -561,7 +557,6 @@
561557
GENERATE_INFOPLIST_FILE = YES;
562558
INFOPLIST_FILE = ntfy/Info.plist;
563559
INFOPLIST_KEY_CFBundleDisplayName = ntfy;
564-
INFOPLIST_KEY_NSCameraUsageDescription = "We need access to the camera to scan QR codes.";
565560
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
566561
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
567562
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
@@ -596,7 +591,6 @@
596591
GENERATE_INFOPLIST_FILE = YES;
597592
INFOPLIST_FILE = ntfy/Info.plist;
598593
INFOPLIST_KEY_CFBundleDisplayName = ntfy;
599-
INFOPLIST_KEY_NSCameraUsageDescription = "We need access to the camera to scan QR codes.";
600594
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
601595
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
602596
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";

ntfy/Info.plist

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<dict>
55
<key>AppBaseURL</key>
66
<string>$(APP_BASE_URL)</string>
7+
<key>FirebaseAppDelegateProxyEnabled</key>
8+
<false/>
79
<key>NSAppTransportSecurity</key>
810
<dict>
911
<key>NSAllowsArbitraryLoads</key>
@@ -18,9 +20,5 @@
1820
<array>
1921
<string>remote-notification</string>
2022
</array>
21-
<key>FirebaseAppDelegateProxyEnabled</key>
22-
<false/>
23-
<key>NSCameraUsageDescription</key>
24-
<string>We need access to the camera for QR code scanning.</string>
2523
</dict>
2624
</plist>

ntfy/Views/QRScannerUIView.swift

Lines changed: 0 additions & 84 deletions
This file was deleted.

ntfy/Views/SubscriptionAddView.swift

Lines changed: 10 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import SwiftUI
2-
import AVFoundation
32

43
struct SubscriptionAddView: View {
54
private let tag = "SubscriptionAddView"
@@ -18,37 +17,26 @@ struct SubscriptionAddView: View {
1817
@State private var loading = false
1918
@State private var addError: String?
2019
@State private var loginError: String?
21-
@State private var hasCameraPermission: Bool = false
2220

2321
private var subscriptionManager: SubscriptionManager {
2422
return SubscriptionManager(store: store)
2523
}
2624

2725
var body: some View {
2826
NavigationView {
29-
VStack {
30-
addView
31-
// TODO: hide this if permission not granted
32-
QRScannerUIView { code in
33-
onQRCodeScanned(text: code)
34-
}
35-
.frame(height: 250) // You can adjust the height as needed.
36-
.padding()
37-
.onAppear(perform: checkCameraPermission)
38-
}
39-
4027
// This is a little weird, but it works. The nagivation link for the login view
41-
// is rendered in the background (it's hidden), abd we toggle it manually.
28+
// is rendered in the backgroun (it's hidden), abd we toggle it manually.
4229
// If anyone has a better way to do a two-page layout let me know.
4330

44-
.background(Group {
45-
NavigationLink(
46-
destination: loginView,
47-
isActive: $showLogin
48-
) {
49-
EmptyView()
50-
}
51-
})
31+
addView
32+
.background(Group {
33+
NavigationLink(
34+
destination: loginView,
35+
isActive: $showLogin
36+
) {
37+
EmptyView()
38+
}
39+
})
5240
}
5341
}
5442

@@ -141,55 +129,6 @@ struct SubscriptionAddView: View {
141129
return topic.trimmingCharacters(in: .whitespaces)
142130
}
143131

144-
private func checkCameraPermission() {
145-
switch AVCaptureDevice.authorizationStatus(for: .video) {
146-
case .authorized:
147-
self.hasCameraPermission = true
148-
149-
case .notDetermined:
150-
AVCaptureDevice.requestAccess(for: .video) { granted in
151-
DispatchQueue.main.async {
152-
self.hasCameraPermission = granted
153-
if !granted {
154-
self.hasCameraPermission = false
155-
}
156-
}
157-
}
158-
159-
case .denied, .restricted:
160-
self.hasCameraPermission = false
161-
162-
@unknown default:
163-
break
164-
}
165-
}
166-
167-
func onQRCodeScanned(text: String){
168-
// Check if the text is a valid URL with HTTP or HTTPS scheme
169-
guard let url = URL(string: text), let scheme = url.scheme, ["http", "https"].contains(scheme) else {
170-
return
171-
}
172-
173-
// Extract the base URL without the path
174-
var components = URLComponents(url: url, resolvingAgainstBaseURL: false)
175-
components?.path = ""
176-
guard let foundBaseUrl = components?.url else {
177-
return
178-
}
179-
180-
// Extract the route from the original URL
181-
baseUrl = foundBaseUrl.absoluteString
182-
useAnother = baseUrl != store.getDefaultBaseUrl()
183-
184-
topic = url.path
185-
if (topic.hasPrefix("/")) {
186-
topic.removeFirst()
187-
}
188-
189-
print("------> \(baseUrl) : \(topic) : \(useAnother)")
190-
subscribeOrShowLoginAction()
191-
}
192-
193132
private func isAddViewValid() -> Bool {
194133
if sanitizedTopic.isEmpty {
195134
return false

0 commit comments

Comments
 (0)