Skip to content

Commit 42a8cac

Browse files
authored
Added debug print and weak self in operation closures. (#69)
* Added debug print and `weak self` in operation closures.
1 parent 318ca85 commit 42a8cac

File tree

65 files changed

+753
-678
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+753
-678
lines changed

Changelog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [2.0.4] - 2021-09-23
8+
### Changed
9+
- Added debug print.
10+
11+
### Fixed
12+
- `weak self` in operation closures.
13+
714
## [2.0.3] - 2021-02-16
815
### Fixed
916
- API error response parsing

MailchimpSDK.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
Pod::Spec.new do |s|
1010
s.name = 'MailchimpSDK'
11-
s.version = '2.0.3'
11+
s.version = '2.0.4'
1212
s.summary = 'Mailchimp SDK for iOS'
1313

1414
s.description = <<-DESC

PanionApp/PanionApp.xcodeproj/project.pbxproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
isa = PBXProject;
169169
attributes = {
170170
LastSwiftUpdateCheck = 1100;
171-
LastUpgradeCheck = 1100;
171+
LastUpgradeCheck = 1250;
172172
ORGANIZATIONNAME = "The Rocket Science Group LLC";
173173
TargetAttributes = {
174174
F235666422B41EE60064C041 = {
@@ -312,6 +312,7 @@
312312
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
313313
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
314314
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
315+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
315316
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
316317
CLANG_WARN_STRICT_PROTOTYPES = YES;
317318
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -372,6 +373,7 @@
372373
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
373374
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
374375
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
376+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
375377
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
376378
CLANG_WARN_STRICT_PROTOTYPES = YES;
377379
CLANG_WARN_SUSPICIOUS_MOVE = YES;

PanionApp/PanionApp.xcodeproj/xcshareddata/xcschemes/PanionApp.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1110"
3+
LastUpgradeVersion = "1250"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

PanionApp/PanionApp.xcodeproj/xcshareddata/xcschemes/PanionAppTests.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1110"
3+
LastUpgradeVersion = "1250"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Sources/MailchimpSDK/MailchimpSDK.xcodeproj/project.pbxproj

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
8D3BCA6C2566E66200F9C268 /* EventTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D3BCA662566E66200F9C268 /* EventTests.swift */; };
1212
8D3BCA6D2566E66200F9C268 /* MergeFieldTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D3BCA682566E66200F9C268 /* MergeFieldTests.swift */; };
1313
8D3BCA6E2566E66200F9C268 /* ContactTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D3BCA692566E66200F9C268 /* ContactTests.swift */; };
14+
8DF0738326F8EB6900F0544C /* Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DF0738226F8EB6900F0544C /* Debug.swift */; };
1415
B95896A122774C0C00F7509B /* MailchimpSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B958969722774C0C00F7509B /* MailchimpSDK.framework */; };
1516
B95896A822774C0C00F7509B /* MailchimpSDK.h in Headers */ = {isa = PBXBuildFile; fileRef = B958969A22774C0C00F7509B /* MailchimpSDK.h */; settings = {ATTRIBUTES = (Public, ); }; };
1617
B95896B82277689F00F7509B /* URLRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = B95896B72277689F00F7509B /* URLRequest.swift */; };
@@ -47,6 +48,7 @@
4748
8D3BCA682566E66200F9C268 /* MergeFieldTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MergeFieldTests.swift; sourceTree = "<group>"; };
4849
8D3BCA692566E66200F9C268 /* ContactTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactTests.swift; sourceTree = "<group>"; };
4950
8D3BCA6A2566E66200F9C268 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
51+
8DF0738226F8EB6900F0544C /* Debug.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Debug.swift; sourceTree = "<group>"; };
5052
B958969722774C0C00F7509B /* MailchimpSDK.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MailchimpSDK.framework; sourceTree = BUILT_PRODUCTS_DIR; };
5153
B958969A22774C0C00F7509B /* MailchimpSDK.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MailchimpSDK.h; sourceTree = "<group>"; };
5254
B958969B22774C0C00F7509B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -183,6 +185,7 @@
183185
children = (
184186
B95896B72277689F00F7509B /* URLRequest.swift */,
185187
B95896C5227B73CC00F7509B /* Result.swift */,
188+
8DF0738226F8EB6900F0544C /* Debug.swift */,
186189
);
187190
path = Extensions;
188191
sourceTree = "<group>";
@@ -273,7 +276,7 @@
273276
isa = PBXProject;
274277
attributes = {
275278
LastSwiftUpdateCheck = 1100;
276-
LastUpgradeCheck = 1110;
279+
LastUpgradeCheck = 1250;
277280
ORGANIZATIONNAME = "The Rocket Science Group LLC";
278281
TargetAttributes = {
279282
B958969622774C0C00F7509B = {
@@ -342,6 +345,7 @@
342345
B95896BD227768AB00F7509B /* APIRequest.swift in Sources */,
343346
B95896B82277689F00F7509B /* URLRequest.swift in Sources */,
344347
F239C3FD229F2DDF00FB85C3 /* CountryCode.swift in Sources */,
348+
8DF0738326F8EB6900F0544C /* Debug.swift in Sources */,
345349
);
346350
runOnlyForDeploymentPostprocessing = 0;
347351
};
@@ -394,6 +398,7 @@
394398
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
395399
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
396400
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
401+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
397402
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
398403
CLANG_WARN_STRICT_PROTOTYPES = YES;
399404
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -460,6 +465,7 @@
460465
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
461466
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
462467
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
468+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
463469
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
464470
CLANG_WARN_STRICT_PROTOTYPES = YES;
465471
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -512,7 +518,7 @@
512518
"@executable_path/Frameworks",
513519
"@loader_path/Frameworks",
514520
);
515-
MARKETING_VERSION = 2.0.3;
521+
MARKETING_VERSION = 2.0.4;
516522
PRODUCT_BUNDLE_IDENTIFIER = com.theRocketScienceGroup.MailchimpSDK;
517523
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
518524
SKIP_INSTALL = YES;
@@ -541,7 +547,7 @@
541547
"@executable_path/Frameworks",
542548
"@loader_path/Frameworks",
543549
);
544-
MARKETING_VERSION = 2.0.3;
550+
MARKETING_VERSION = 2.0.4;
545551
PRODUCT_BUNDLE_IDENTIFIER = com.theRocketScienceGroup.MailchimpSDK;
546552
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
547553
SKIP_INSTALL = YES;
@@ -561,7 +567,7 @@
561567
"@executable_path/Frameworks",
562568
"@loader_path/Frameworks",
563569
);
564-
MARKETING_VERSION = 2.0.3;
570+
MARKETING_VERSION = 2.0.4;
565571
PRODUCT_BUNDLE_IDENTIFIER = "com.theRocketScienceGroup.Mailchimp-SDKTests";
566572
PRODUCT_NAME = "$(TARGET_NAME)";
567573
SWIFT_VERSION = 5.0;
@@ -580,7 +586,7 @@
580586
"@executable_path/Frameworks",
581587
"@loader_path/Frameworks",
582588
);
583-
MARKETING_VERSION = 2.0.3;
589+
MARKETING_VERSION = 2.0.4;
584590
PRODUCT_BUNDLE_IDENTIFIER = "com.theRocketScienceGroup.Mailchimp-SDKTests";
585591
PRODUCT_NAME = "$(TARGET_NAME)";
586592
SWIFT_VERSION = 5.0;

Sources/MailchimpSDK/MailchimpSDK.xcodeproj/xcshareddata/xcschemes/MailchimpSDK.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1110"
3+
LastUpgradeVersion = "1250"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Sources/MailchimpSDK/MailchimpSDK.xcodeproj/xcshareddata/xcschemes/MailchimpSDKTests.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1220"
3+
LastUpgradeVersion = "1250"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
//
3+
// Debug.swift
4+
// MailchimpSDK
5+
//
6+
// Created by Jennifer Starratt on 9/20/21.
7+
// Copyright 2021 The Rocket Science Group LLC
8+
//
9+
// Licensed under the Mailchimp Mobile SDK License Agreement (the "License");
10+
// you may not use this file except in compliance with the License. Unless
11+
// required by applicable law or agreed to in writing, software distributed
12+
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
13+
// OR CONDITIONS OF ANY KIND, either or express or implied.
14+
//
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
19+
/// A debug version of print. `print()` will only be called if debug mode is enabled.
20+
///
21+
/// - Parameters:
22+
/// - items: Zero or more items to print.
23+
/// - separator: A string to print between each item. The default is a single space (" ").
24+
/// - terminator: The string to print after all items have been printed. The default is a newline ("\n").
25+
func debugPrint(_ items: Any..., separator: String = " ", terminator: String = "\n") {
26+
if Mailchimp.debugMode {
27+
print(items, separator: separator, terminator: terminator)
28+
}
29+
}

Sources/MailchimpSDK/MailchimpSDK/SDK/Mailchimp.swift

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ public class Mailchimp: NSObject {
5353
Mailchimp.autoTagContacts = autoTagContacts
5454
Mailchimp.debugMode = debugMode
5555

56-
if debugMode {
57-
print("Mailchimp SDK Initialized. Version: \(version)")
58-
}
56+
debugPrint("Mailchimp SDK Initialized. Version: \(version)")
5957
}
6058

6159
/// Creates a new Contact and permanently sets the status. If the Contact already exists, contact
@@ -76,10 +74,8 @@ public class Mailchimp: NSObject {
7674
let combinedTags = autoTags() + (contactInfo.tags ?? [])
7775
contactInfo.tags = combinedTags
7876

79-
if debugMode {
80-
for tag in autoTags() {
81-
print("Adding auto-tag \"\(tag.name)\" to create contact request.")
82-
}
77+
for tag in autoTags() {
78+
debugPrint("Adding auto-tag \"\(tag.name)\" to create contact request.")
8379
}
8480
}
8581

0 commit comments

Comments
 (0)