Skip to content

Commit ced921e

Browse files
committed
internal dump method helper
* internal for now, put in information you want to log for each product that conforms to OSLoggable
1 parent 47972a4 commit ced921e

File tree

15 files changed

+99
-2
lines changed

15 files changed

+99
-2
lines changed

iOS_SDK/OneSignalDevApp/OneSignalDevApp/SwiftTest.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@ class SwiftTest: NSObject, OSLogListener {
3838
let token = OneSignal.User.pushSubscription.token
3939
OneSignal.Debug.addLogListener(self)
4040
OneSignal.Debug.removeLogListener(self)
41+
OneSignal.Debug._dump()
4142
}
4243
}

iOS_SDK/OneSignalDevApp/OneSignalDevApp/ViewController.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ - (IBAction)sendTagButton:(id)sender {
137137
- (IBAction)getTagsButton:(id)sender {
138138
NSDictionary<NSString *, NSString*> *tags = [OneSignal.User getTags];
139139
NSLog(@"Tags: %@", tags);
140+
[OneSignal.Debug _dump];
140141
}
141142

142143
- (IBAction)sendTagsButton:(id)sender {

iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
3C0151922C2E298F0079E076 /* OneSignalInAppMessages.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DEBAAE282A4211D900BF2C1C /* OneSignalInAppMessages.framework */; };
5757
3C01519C2C2E29F90079E076 /* IAMRequestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C01519B2C2E29F90079E076 /* IAMRequestTests.m */; };
5858
3C0EF49E28A1DBCB00E5434B /* OSUserInternalImpl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C0EF49D28A1DBCB00E5434B /* OSUserInternalImpl.swift */; };
59+
3C10E0632BF5651500A7B37F /* OSLoggable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C10E0622BF5651500A7B37F /* OSLoggable.swift */; };
5960
3C115165289A259500565C41 /* OneSignalOSCore.docc in Sources */ = {isa = PBXBuildFile; fileRef = 3C115164289A259500565C41 /* OneSignalOSCore.docc */; };
6061
3C115171289A259500565C41 /* OneSignalOSCore.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C115163289A259500565C41 /* OneSignalOSCore.h */; settings = {ATTRIBUTES = (Public, ); }; };
6162
3C115185289ADE4F00565C41 /* OSModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C115184289ADE4F00565C41 /* OSModel.swift */; };
@@ -1241,6 +1242,7 @@
12411242
3C01518E2C2E298E0079E076 /* OneSignalInAppMessagesTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OneSignalInAppMessagesTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
12421243
3C01519B2C2E29F90079E076 /* IAMRequestTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IAMRequestTests.m; sourceTree = "<group>"; };
12431244
3C0EF49D28A1DBCB00E5434B /* OSUserInternalImpl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSUserInternalImpl.swift; sourceTree = "<group>"; };
1245+
3C10E0622BF5651500A7B37F /* OSLoggable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OSLoggable.swift; sourceTree = "<group>"; };
12441246
3C115161289A259500565C41 /* OneSignalOSCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = OneSignalOSCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
12451247
3C115163289A259500565C41 /* OneSignalOSCore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OneSignalOSCore.h; sourceTree = "<group>"; };
12461248
3C115164289A259500565C41 /* OneSignalOSCore.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = OneSignalOSCore.docc; sourceTree = "<group>"; };
@@ -2125,6 +2127,7 @@
21252127
4710EA522B8FCFB200435356 /* OSDispatchQueue.swift */,
21262128
DEFB3E642BB7346D00E65DAD /* OSLiveActivities.swift */,
21272129
DEFB3E662BB735B500E65DAD /* OSStubLiveActivities.swift */,
2130+
3C10E0622BF5651500A7B37F /* OSLoggable.swift */,
21282131
);
21292132
path = Source;
21302133
sourceTree = "<group>";
@@ -4189,6 +4192,7 @@
41894192
5BC1DE602C90B83900CA8807 /* OSConsistencyKeyEnum.swift in Sources */,
41904193
3C4F9E4428A4466C009F453A /* OSOperationRepo.swift in Sources */,
41914194
3C11518B289ADEEB00565C41 /* OSEventProducer.swift in Sources */,
4195+
3C10E0632BF5651500A7B37F /* OSLoggable.swift in Sources */,
41924196
3C115165289A259500565C41 /* OneSignalOSCore.docc in Sources */,
41934197
5BC1DE5E2C90B80E00CA8807 /* OSCondition.swift in Sources */,
41944198
5BC1DE5C2C90B7E600CA8807 /* OSConsistencyManager.swift in Sources */,

iOS_SDK/OneSignalSDK/OneSignalCore/Source/OneSignalLog.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
7070
*/
7171
+ (void)removeLogListener:(NSObject<OSLogListener>*_Nonnull)listener NS_REFINED_FOR_SWIFT;
7272

73+
+ (void)_dump;
7374
@end
7475

75-
@interface OneSignalLog : NSObject<OSDebug>
76+
@interface OneSignalLog : NSObject <OSDebug>
7677
+ (Class<OSDebug>)Debug;
7778
+ (void)onesignalLog:(ONE_S_LOG_LEVEL)logLevel message:(NSString* _Nonnull)message;
7879
+ (ONE_S_LOG_LEVEL)getLogLevel;

iOS_SDK/OneSignalSDK/OneSignalCore/Source/OneSignalLog.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ - (instancetype)initWithLevel:(ONE_S_LOG_LEVEL)level entry:(NSString*)entry {
3838
}
3939
@end
4040

41+
/**
42+
Implements the Log Level methods of protocol `OSDebug`.
43+
The `_dump` method will be implemented in OneSignal module.
44+
*/
4145
@implementation OneSignalLog
4246

4347
static ONE_S_LOG_LEVEL _nsLogLevel = ONE_S_LL_WARN;
@@ -72,6 +76,8 @@ + (void)removeLogListener:(NSObject<OSLogListener>*_Nonnull)listener {
7276
[self.logListeners removeObject:listener];
7377
}
7478

79+
+ (void)_dump {}
80+
7581
+ (void)onesignalLog:(ONE_S_LOG_LEVEL)logLevel message:(NSString* _Nonnull)message {
7682
onesignal_Log(logLevel, message);
7783
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
Modified MIT License
3+
4+
Copyright 2024 OneSignal
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
1. The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
2. All copies of substantial portions of the Software may only be used in connection
17+
with services provided by OneSignal.
18+
19+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
THE SOFTWARE.
26+
*/
27+
28+
public protocol OSLoggable {
29+
func logSelf()
30+
}

iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSOperationExecutor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import OneSignalCore
3030
/**
3131
Concrete executors drop OSDeltas and Requests when initializing from the cache, when they cannot be connected to their respective models anymore. These cannot be sent, so they are dropped..
3232
*/
33-
public protocol OSOperationExecutor {
33+
public protocol OSOperationExecutor: OSLoggable {
3434
var supportedDeltas: [String] { get }
3535
var deltaQueue: [OSDelta] { get }
3636

iOS_SDK/OneSignalSDK/OneSignalOSCore/Source/OSOperationRepo.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,9 @@ public class OSOperationRepo: NSObject {
178178
}
179179
}
180180
}
181+
182+
extension OSOperationRepo: OSLoggable {
183+
public func logSelf() {
184+
// TODO: You fill in
185+
}
186+
}

iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSIdentityOperationExecutor.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,3 +289,9 @@ class OSIdentityOperationExecutor: OSOperationExecutor {
289289
}
290290
}
291291
}
292+
293+
extension OSIdentityOperationExecutor: OSLoggable {
294+
func logSelf() {
295+
// TODO: You fill in
296+
}
297+
}

iOS_SDK/OneSignalSDK/OneSignalUser/Source/Executors/OSPropertyOperationExecutor.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,9 @@ class OSPropertyOperationExecutor: OSOperationExecutor {
301301
}
302302
}
303303
}
304+
305+
extension OSPropertyOperationExecutor: OSLoggable {
306+
func logSelf() {
307+
// TODO: You fill in
308+
}
309+
}

0 commit comments

Comments
 (0)