Skip to content

Commit

Permalink
(feat): SCSNotificationAgent & SCSLoggingAgent
Browse files Browse the repository at this point in the history
  • Loading branch information
N3v1 committed May 11, 2024
1 parent b2c1774 commit b7d72f5
Show file tree
Hide file tree
Showing 19 changed files with 241 additions and 560 deletions.
60 changes: 8 additions & 52 deletions ScribbleLab.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
381C1DF22B5EF4B200F73B5E /* SLPrivacySettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 381C1DF12B5EF4B200F73B5E /* SLPrivacySettingsView.swift */; };
381C1DF52B5EFD1900F73B5E /* SearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 381C1DF42B5EFD1900F73B5E /* SearchView.swift */; };
381C1DF82B5EFF7B00F73B5E /* TrashView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 381C1DF72B5EFF7B00F73B5E /* TrashView.swift */; };
381E0B362ADC136400A2A836 /* PomodoroModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 381E0B352ADC136400A2A836 /* PomodoroModel.swift */; };
381E0B382ADC14E300A2A836 /* SLStudyPomodoroTimerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 381E0B372ADC14E300A2A836 /* SLStudyPomodoroTimerView.swift */; };
381F1F132AD72DD6001B3B10 /* TestView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 381F1F122AD72DD6001B3B10 /* TestView.swift */; };
3828B2432B1FA5BE00D66BD8 /* NotificationCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3828B2422B1FA5BE00D66BD8 /* NotificationCell.swift */; };
3828B2452B1FA7A400D66BD8 /* NotificationCellModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3828B2442B1FA7A400D66BD8 /* NotificationCellModel.swift */; };
Expand Down Expand Up @@ -91,6 +89,8 @@
387CC3292BEE49A100B5B907 /* SCSNetworkMonitorAgentProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387CC3282BEE49A100B5B907 /* SCSNetworkMonitorAgentProtocol.swift */; };
387CC32B2BEE49A100B5B907 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387CC32A2BEE49A100B5B907 /* main.swift */; };
387CC3302BEE49A100B5B907 /* SCSNetworkMonitorAgent.xpc in Embed XPC Services */ = {isa = PBXBuildFile; fileRef = 387CC3242BEE49A000B5B907 /* SCSNetworkMonitorAgent.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
387CC3392BEFC43800B5B907 /* SCSLoggingAgent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387CC3382BEFC43800B5B907 /* SCSLoggingAgent.swift */; };
387CC33B2BEFC96400B5B907 /* SCSNotificationAgent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387CC33A2BEFC96400B5B907 /* SCSNotificationAgent.swift */; };
387F7F882B12087E001CC150 /* Draw+PencilKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387F7F872B12087E001CC150 /* Draw+PencilKit.swift */; };
387F7F8A2B120948001CC150 /* DrawingTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387F7F892B120948001CC150 /* DrawingTest.swift */; };
387F7F8D2B122634001CC150 /* ColorPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387F7F8C2B122634001CC150 /* ColorPickerView.swift */; };
Expand Down Expand Up @@ -125,7 +125,6 @@
38AB46312B16524000DC9D1C /* Release.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 385F788C2AD5C4690096E504 /* Release.xcconfig */; };
38AB46322B16524000DC9D1C /* Alpha.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 38355EFD2AD3DF9B00392674 /* Alpha.xcconfig */; };
38AB46332B16524000DC9D1C /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 38355F032AD3DFED00392674 /* Debug.xcconfig */; };
38AD22322B10F6A100663C37 /* Network.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38AD22312B10F6A100663C37 /* Network.swift */; };
38ADE8112B1D1253002229A2 /* SLTip.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38ADE8102B1D1253002229A2 /* SLTip.swift */; };
38ADE8172B1D1F44002229A2 /* NotificationSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38ADE8162B1D1F44002229A2 /* NotificationSettings.swift */; };
38AE9C9C2AD0750F00B761E8 /* ScribbleLabApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38AE9C9B2AD0750F00B761E8 /* ScribbleLabApp.swift */; };
Expand Down Expand Up @@ -247,8 +246,6 @@
381C1DF12B5EF4B200F73B5E /* SLPrivacySettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SLPrivacySettingsView.swift; sourceTree = "<group>"; };
381C1DF42B5EFD1900F73B5E /* SearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchView.swift; sourceTree = "<group>"; };
381C1DF72B5EFF7B00F73B5E /* TrashView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrashView.swift; sourceTree = "<group>"; };
381E0B352ADC136400A2A836 /* PomodoroModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PomodoroModel.swift; sourceTree = "<group>"; };
381E0B372ADC14E300A2A836 /* SLStudyPomodoroTimerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SLStudyPomodoroTimerView.swift; sourceTree = "<group>"; };
381F1F122AD72DD6001B3B10 /* TestView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestView.swift; sourceTree = "<group>"; };
3828B2422B1FA5BE00D66BD8 /* NotificationCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationCell.swift; sourceTree = "<group>"; };
3828B2442B1FA7A400D66BD8 /* NotificationCellModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationCellModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -315,6 +312,8 @@
387CC32A2BEE49A100B5B907 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
387CC32C2BEE49A100B5B907 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
387CC32D2BEE49A100B5B907 /* SCSNetworkMonitorAgent.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SCSNetworkMonitorAgent.entitlements; sourceTree = "<group>"; };
387CC3382BEFC43800B5B907 /* SCSLoggingAgent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SCSLoggingAgent.swift; sourceTree = "<group>"; };
387CC33A2BEFC96400B5B907 /* SCSNotificationAgent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SCSNotificationAgent.swift; sourceTree = "<group>"; };
387F7F872B12087E001CC150 /* Draw+PencilKit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Draw+PencilKit.swift"; sourceTree = "<group>"; };
387F7F892B120948001CC150 /* DrawingTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DrawingTest.swift; sourceTree = "<group>"; };
387F7F8C2B122634001CC150 /* ColorPickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorPickerView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -343,7 +342,6 @@
38A5E9BA2B03D4E80037C668 /* SLOTP+2FAView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SLOTP+2FAView.swift"; sourceTree = "<group>"; };
38A5E9BC2B03D7730037C668 /* OTPTextFieldView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OTPTextFieldView.swift; sourceTree = "<group>"; };
38A5E9C42B03F09C0037C668 /* SLOTP+2FA_ConfigView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SLOTP+2FA_ConfigView.swift"; sourceTree = "<group>"; };
38AD22312B10F6A100663C37 /* Network.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Network.swift; sourceTree = "<group>"; };
38ADE8102B1D1253002229A2 /* SLTip.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SLTip.swift; sourceTree = "<group>"; };
38ADE8162B1D1F44002229A2 /* NotificationSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationSettings.swift; sourceTree = "<group>"; };
38AE9C982AD0750F00B761E8 /* ScribbleLab.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ScribbleLab.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -469,22 +467,6 @@
path = Waiting;
sourceTree = "<group>";
};
380ADEA02B0E9030001832C6 /* Plug-Ins */ = {
isa = PBXGroup;
children = (
380ADEA12B0E9051001832C6 /* VocabularyLearning */,
38D5C67E2AD1C0FA00D943A5 /* Timer */,
);
path = "Plug-Ins";
sourceTree = "<group>";
};
380ADEA12B0E9051001832C6 /* VocabularyLearning */ = {
isa = PBXGroup;
children = (
);
path = VocabularyLearning;
sourceTree = "<group>";
};
380BC6442B260BA000DCF442 /* Shop */ = {
isa = PBXGroup;
children = (
Expand All @@ -505,7 +487,8 @@
isa = PBXGroup;
children = (
38140A682AE3F81900753FB6 /* UserService.swift */,
38AD22312B10F6A100663C37 /* Network.swift */,
387CC3382BEFC43800B5B907 /* SCSLoggingAgent.swift */,
387CC33A2BEFC96400B5B907 /* SCSNotificationAgent.swift */,
);
path = Service;
sourceTree = "<group>";
Expand Down Expand Up @@ -557,22 +540,6 @@
path = Trash;
sourceTree = "<group>";
};
381E0B332ADC134C00A2A836 /* Model */ = {
isa = PBXGroup;
children = (
381E0B352ADC136400A2A836 /* PomodoroModel.swift */,
);
path = Model;
sourceTree = "<group>";
};
381E0B342ADC135200A2A836 /* View */ = {
isa = PBXGroup;
children = (
381E0B372ADC14E300A2A836 /* SLStudyPomodoroTimerView.swift */,
);
path = View;
sourceTree = "<group>";
};
381F1F112AD72DC2001B3B10 /* Editor */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -752,7 +719,6 @@
3858A7722AD14AC800FC6319 /* Features */,
3858A7712AD14AC200FC6319 /* Home */,
38A5E34F2BECFE72009A8885 /* Onboarding */,
380ADEA02B0E9030001832C6 /* Plug-Ins */,
3858A7752AD14B5C00FC6319 /* Settings */,
3886B2DF2AD1ABA3002EF30E /* SideBar */,
380BC6442B260BA000DCF442 /* Shop */,
Expand Down Expand Up @@ -1378,15 +1344,6 @@
path = Profile;
sourceTree = "<group>";
};
38D5C67E2AD1C0FA00D943A5 /* Timer */ = {
isa = PBXGroup;
children = (
381E0B342ADC135200A2A836 /* View */,
381E0B332ADC134C00A2A836 /* Model */,
);
path = Timer;
sourceTree = "<group>";
};
38D5C6812AD2887000D943A5 /* Units */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1857,6 +1814,7 @@
files = (
38D0CF592B67C1090051B356 /* CreateNotebookView.swift in Sources */,
3852D7212B054DBF007FAFF1 /* Particle.swift in Sources */,
387CC3392BEFC43800B5B907 /* SCSLoggingAgent.swift in Sources */,
38B36C5E2B5D73D80009BA56 /* FavouriteView.swift in Sources */,
385DC5D72B53FB0C00D1FE6E /* NotificationSettingsModel.swift in Sources */,
38BAF7C52B5AF6EF00BEE6A5 /* IntegrationsView.swift in Sources */,
Expand All @@ -1866,7 +1824,6 @@
3889688B2AF143C700F67F08 /* SettingsViewModel.swift in Sources */,
3858A77E2AD15E8900FC6319 /* NotificationSheetView.swift in Sources */,
383588442AFEDB4000EEA1C3 /* PerformanceView.swift in Sources */,
38AD22322B10F6A100663C37 /* Network.swift in Sources */,
387B79362ADEDD9B0067E08B /* SLOtherSettings.swift in Sources */,
38F59B8B2AEC4E0D00475B0B /* ResetPasswordView.swift in Sources */,
38B36C652B5D95FD0009BA56 /* ScribbleCloudOverviewView.swift in Sources */,
Expand All @@ -1875,7 +1832,6 @@
38EFBE232AD6E4EF00CF0ECD /* RestartAppView.swift in Sources */,
389FD4332B1BD22800C7DCC1 /* ResetPasswordModel.swift in Sources */,
3886B2DE2AD19F34002EF30E /* SLSettingsView.swift in Sources */,
381E0B362ADC136400A2A836 /* PomodoroModel.swift in Sources */,
385F78BE2AD5ED720096E504 /* SLHelpView.swift in Sources */,
386845172B654AA800C375E1 /* LearningCenterView.swift in Sources */,
381C1DF22B5EF4B200F73B5E /* SLPrivacySettingsView.swift in Sources */,
Expand Down Expand Up @@ -1950,7 +1906,6 @@
38140A692AE3F81900753FB6 /* UserService.swift in Sources */,
3868A3DE2AD2DBA300D4CAEC /* ImageView.swift in Sources */,
380D93972AE42C6600277D2D /* CompleteRegistartionView.swift in Sources */,
381E0B382ADC14E300A2A836 /* SLStudyPomodoroTimerView.swift in Sources */,
3852D71F2B054D18007FAFF1 /* ParticleEffect.swift in Sources */,
387F7F962B12387E001CC150 /* DrawingViewController.swift in Sources */,
38A5E9BB2B03D4E80037C668 /* SLOTP+2FAView.swift in Sources */,
Expand All @@ -1961,6 +1916,7 @@
381C1DE32B5E8BCA00F73B5E /* DocumentSortOptionFavourite.swift in Sources */,
38B36C5B2B5D47510009BA56 /* StoreView.swift in Sources */,
384079D02B600E7A0059523C /* CrashReportSheet.swift in Sources */,
387CC33B2BEFC96400B5B907 /* SCSNotificationAgent.swift in Sources */,
385B8D2D2B9B7D5700DD4768 /* SettingsView.swift in Sources */,
38A5E3512BECFE9B009A8885 /* OnboardingView.swift in Sources */,
38CB09092B5411FA00E0C224 /* OnboardingFeature.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@
ReferencedContainer = "container:ScribbleLab.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<EnvironmentVariables>
<EnvironmentVariable
key = "IDEPreferLogStreaming"
value = "YES"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
17 changes: 4 additions & 13 deletions ScribbleLab.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "d94c3b66b899b731312191ce330cac7e4bd0aa4441298625f5bc557437b14b6b",
"originHash" : "f0341c625e15b430eb28cf479a232309a2b4e0629e76f1610fb2986dac210644",
"pins" : [
{
"identity" : "abseil-cpp-binary",
Expand Down Expand Up @@ -78,8 +78,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleUtilities.git",
"state" : {
"revision" : "8e5d57ed87057cd7b0e4e8f474d9e78f73eb85f7",
"version" : "7.13.2"
"revision" : "57a1d307f42df690fdef2637f3e5b776da02aad6",
"version" : "7.13.3"
}
},
{
Expand Down Expand Up @@ -163,15 +163,6 @@
"version" : "2.30910.0"
}
},
{
"identity" : "permissionskit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/sparrowcode/PermissionsKit",
"state" : {
"revision" : "8d6b3d6db7d0654a4e4fe31bbf6556dec6fc3d13",
"version" : "10.0.1"
}
},
{
"identity" : "phonenumberkit",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -205,7 +196,7 @@
"location" : "https://github.com/ScribbleLabApp/ScribbleCoreServices.git",
"state" : {
"branch" : "main",
"revision" : "143ab26b74c2e100275e8cfe0c33250e0f43cf70"
"revision" : "18be462234eef52de58674de6b63db1cd5943e7e"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
<key>EndingColumnNumber</key>
<string>0</string>
<key>EndingLineNumber</key>
<string>55</string>
<string>52</string>
<key>StartingColumnNumber</key>
<string>0</string>
<key>StartingLineNumber</key>
<string>54</string>
<string>51</string>
<key>Timestamp</key>
<string>736952176.826629</string>
<string>737133869.1351219</string>
</dict>
<key>rebasable-url</key>
<dict>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
filePath = "ScribbleLab/Core/Onboarding/OnboardingData.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "10"
endingLineNumber = "10"
landmarkName = "unknown"
landmarkType = "0">
startingLineNumber = "24"
endingLineNumber = "24"
landmarkName = "load(_:)"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
Expand Down
11 changes: 5 additions & 6 deletions ScribbleLab/App/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,14 @@
import UIKit
import SwiftUI
import UserNotifications
import os.log
import ScribbleCoreServices

import FirebaseCore
import GoogleSignIn
import FirebasePerformance
import FirebaseCrashlytics
import ScribbleCoreServices

class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDelegate, ObservableObject {
// var notificationSettings = NotificationSettingsModel()

@Published var notificationAllowed: Bool = false

func application(_ application: UIApplication,
Expand All @@ -54,10 +51,10 @@ class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDele
UNUserNotificationCenter.current().delegate = self

let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]

UNUserNotificationCenter.current().requestAuthorization(
options: authOptions,
completionHandler: { /*granted, _ in*/ [weak self] granted, _ in
// self.notificationSettings.notificationAllowed = granted
DispatchQueue.main.async {
self?.notificationAllowed = granted
}
Expand All @@ -77,10 +74,12 @@ class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDele
}

// [START setting_up_scnLogger]
/*
let scnLog = SCNLog(subsystem: "com.nhstudiios.ScribbleLab")
*/

func applicationDidReceiveMemoryWarning(_ application: UIApplication) {
scnLog.memoryWarning("AppDelegate Received memory warning!")
SCNLoggingAgent.shared.logger.memoryWarning("AppDelegate Received memory warning!")
}
// [END setting_up_scnLogger]

Expand Down
20 changes: 5 additions & 15 deletions ScribbleLab/App/ScribbleLabApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,22 @@
// //
// ===---------------------------------------------------------------------------------------=== //

import SwiftUI
import TipKit

import SwiftUI
import ScribbleCoreServices

import FirebaseCore
import GoogleSignIn

#if os(iOS)
import FirebasePerformance
import FirebaseCrashlytics
#endif

@main
struct ScribbleLabApp: App {
// register app delegate for Firebase setup
@UIApplicationDelegateAdaptor(AppDelegate.self) var delegate

public let scnLog = SCNLog(subsystem: "com.nhstudiiios.ScribleLab")
init() {
_ = SCNLoggingAgent.shared
SCNLoggingAgent.shared.logger.log("SCNLoggingAgent: SCNLogStream successfully initialized")
}

var body: some Scene {
WindowGroup {
Expand All @@ -57,13 +54,6 @@ struct ScribbleLabApp: App {
.datastoreLocation(.applicationDefault)
])
}
#if os(macOS)
.frame(width: 500, height: 400)
#endif
// SignUpView()
// .environmentObject(RegistrationViewModel())
// .environmentObject(SignInWithGoogleModel())
// .preferredColorScheme(isDarkMode ? .dark : .light)
}
}
}

0 comments on commit b7d72f5

Please sign in to comment.