Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add production logs for IAM (RMCCX-6877) #336

Open
wants to merge 9 commits into
base: feature
Choose a base branch
from
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Unreleased
- Features:
- Implement clickable image through CustomJson [RMCCX-7233]
- Implement dark background through CustomJson [RMCCX-7328]
- Fixes:
- Fix clickable image behaviour for invalid url [RMCCX-7351]

Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let package = Package(
name: "RInAppMessaging",
defaultLocalization: "en",
platforms: [
.iOS(.v12)
.iOS(.v14)
],
products: [
.library(
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

In-App Messaging (IAM) module allows app developers to easily configure and display notifications within their app.

This module supports iOS 12.0 and above. It has been tested with iOS 12.5 and above.
This module supports iOS 14.0 and above. It has been tested with iOS 14 and above.

### This page covers:
* [Requirements](#requirements)
Expand Down
2 changes: 1 addition & 1 deletion RInAppMessaging.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Pod::Spec.new do |s|
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.authors = 'Rakuten Ecosystem Mobile'
s.source = { :git => "https://github.com/rakutentech/ios-inappmessaging.git", :tag => s.version.to_s }
s.ios.deployment_target = '12.0'
s.ios.deployment_target = '14.0'
s.swift_versions = ['5.7.1']
s.resources = ['Sources/RInAppMessaging/Resources/PrivacyInfo.xcprivacy']
s.dependency 'RSDKUtils', '~> 4.0'
Expand Down
10 changes: 7 additions & 3 deletions RInAppMessaging.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
D92D1F262224A269008EA748 /* TestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = D92D1F242224A265008EA748 /* TestHelpers.swift */; };
E686BF522A2692CD00D4E3E9 /* TooltipViewSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = E686BF512A2692CD00D4E3E9 /* TooltipViewSpec.swift */; };
E686BF562A2692DD00D4E3E9 /* tooltip-data.json in Resources */ = {isa = PBXBuildFile; fileRef = E686BF532A2692DD00D4E3E9 /* tooltip-data.json */; };
E6D762532CA2A87F00FE62D2 /* CampaignDataModelSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6D762522CA2A87A00FE62D2 /* CampaignDataModelSpec.swift */; };
FC1872382A49B7C0005EB10B /* UserInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC1872372A49B7C0005EB10B /* UserInfoView.swift */; };
FC18723A2A49B7D3005EB10B /* UserInfoHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC1872392A49B7D3005EB10B /* UserInfoHelper.swift */; };
FC18723C2A4E97A6005EB10B /* ConstantSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC18723B2A4E97A6005EB10B /* ConstantSpec.swift */; };
Expand Down Expand Up @@ -252,6 +253,7 @@
D9F418282110FD9F00E2158F /* ConfigurationSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigurationSpec.swift; sourceTree = "<group>"; };
E686BF512A2692CD00D4E3E9 /* TooltipViewSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TooltipViewSpec.swift; sourceTree = "<group>"; };
E686BF532A2692DD00D4E3E9 /* tooltip-data.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "tooltip-data.json"; sourceTree = "<group>"; };
E6D762522CA2A87A00FE62D2 /* CampaignDataModelSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignDataModelSpec.swift; sourceTree = "<group>"; };
FC1872372A49B7C0005EB10B /* UserInfoView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserInfoView.swift; sourceTree = "<group>"; };
FC1872392A49B7D3005EB10B /* UserInfoHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserInfoHelper.swift; sourceTree = "<group>"; };
FC18723B2A4E97A6005EB10B /* ConstantSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConstantSpec.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -460,6 +462,7 @@
45B572F625AE2163005A80F7 /* Helpers */,
45357AE32457EB49007D8FDC /* Payloads */,
4557A8B0257E544C00C9D241 /* AccountRepositorySpec.swift */,
E6D762522CA2A87A00FE62D2 /* CampaignDataModelSpec.swift */,
C9827557262C423C00476505 /* BackoffSpec.swift */,
45B3CC8327871C01005BA3F7 /* BundleSpec.swift */,
45563B0624064D78004EAFD3 /* CampaignRepositorySpec.swift */,
Expand Down Expand Up @@ -859,6 +862,7 @@
files = (
D24CF280294BE3FA007C6C85 /* UITabBarExtensionSpec.swift in Sources */,
45ADA542247D206B00A9E2A3 /* RouterSpec.swift in Sources */,
E6D762532CA2A87F00FE62D2 /* CampaignDataModelSpec.swift in Sources */,
456FE1E72428513200304872 /* ErrorReportableSpec.swift in Sources */,
4538BCF6262AE8FA009952BE /* UserDataCacheSpec.swift in Sources */,
45BDFD052421EE7B004DEA0C /* SharedMocks.swift in Sources */,
Expand Down Expand Up @@ -1058,7 +1062,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -1245,7 +1249,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -1294,7 +1298,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand Down
4 changes: 2 additions & 2 deletions Sample/AppStarterViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class AppStarterViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()
guard #available(iOS 13, *) else {
guard #available(iOS 14, *) else {
swiftUIButton.isEnabled = false
return
}
Expand All @@ -21,7 +21,7 @@ class AppStarterViewController: UIViewController {
view.window?.rootViewController = uiKitTabBarController
}

@available(iOS 13.0, *)
@available(iOS 14.0, *)
@IBAction func swiftUiDidTap(_ sender: Any) {
let swiftUITabBarController = UIHostingController(rootView: TabBarView())
view.window?.rootViewController = swiftUITabBarController
Expand Down
2 changes: 1 addition & 1 deletion Sample/Shared/Helpers/View+Extension.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftUI

#if canImport(UIKit)
@available(iOS 13.0, *)
@available(iOS 14.0, *)
extension View {
func hideKeyboard() {
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
Expand Down
4 changes: 2 additions & 2 deletions Sample/SwiftUI/CustomEventView.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftUI
import RInAppMessaging

@available(iOS 13.0, *)
@available(iOS 14.0, *)
struct CustomEventView: View {

@State private var isAlertPresented = false
Expand Down Expand Up @@ -108,7 +108,7 @@ struct CustomEventView: View {
}
}

@available(iOS 13.0, *)
@available(iOS 14.0, *)
struct CustomEventView_Previews: PreviewProvider {
static var previews: some View {
CustomEventView()
Expand Down
4 changes: 2 additions & 2 deletions Sample/SwiftUI/MainView.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftUI
@testable import RInAppMessaging

@available(iOS 13.0, *)
@available(iOS 14.0, *)
struct MainView: View {

@State private var isErrorAlertPresented = false
Expand Down Expand Up @@ -77,7 +77,7 @@ struct MainView: View {
}
}

@available(iOS 13.0, *)
@available(iOS 14.0, *)
struct MainView_Previews: PreviewProvider {
static var previews: some View {
MainView()
Expand Down
4 changes: 2 additions & 2 deletions Sample/SwiftUI/SecondView.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftUI
import RInAppMessaging

@available(iOS 13.0, *)
@available(iOS 14.0, *)
struct SecondView: View {

@Environment(\.presentationMode) var presentationMode
Expand Down Expand Up @@ -42,7 +42,7 @@ struct SecondView: View {
}
}

@available(iOS 13.0, *)
@available(iOS 14.0, *)
struct SecondView_Previews: PreviewProvider {
static var previews: some View {
SecondView()
Expand Down
6 changes: 3 additions & 3 deletions Sample/SwiftUI/TabBarView.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import SwiftUI

@available(iOS 13.0, *)
@available(iOS 14.0, *)
struct TabBarView: View {
var body: some View {
VStack {
Expand Down Expand Up @@ -30,14 +30,14 @@ struct TabBarView: View {
}
}

@available(iOS 13.0, *)
@available(iOS 14.0, *)
struct TabView_Previews: PreviewProvider {
static var previews: some View {
TabBarView()
}
}

@available(iOS 13.0, *)
@available(iOS 14.0, *)
extension View {
func canHaveTooltipIfAvailable(identifier: String) -> some View {
if #available(iOS 15.0, *) {
Expand Down
4 changes: 2 additions & 2 deletions Sample/SwiftUI/UserInfoView.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftUI
import RInAppMessaging

@available(iOS 13.0, *)
@available(iOS 14.0, *)
struct UserInfoView: View {

@State private var userIDText: String = ""
Expand Down Expand Up @@ -87,7 +87,7 @@ struct UserInfoView: View {
}
}

@available(iOS 13.0, *)
@available(iOS 14.0, *)
struct UserInfoView_Previews: PreviewProvider {
static var previews: some View {
UserInfoView()
Expand Down
14 changes: 7 additions & 7 deletions SampleSPM/SampleSPM.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -1106,7 +1106,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand All @@ -1124,7 +1124,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 575EYS6ZJA;
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1323,7 +1323,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -1373,7 +1373,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
Expand All @@ -1392,7 +1392,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 575EYS6ZJA;
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -1416,7 +1416,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 575EYS6ZJA;
INFOPLIST_FILE = "$(SRCROOT)/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
3 changes: 2 additions & 1 deletion Sources/RInAppMessaging/CampaignDispatcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,15 @@ internal class CampaignDispatcher: CampaignDispatcherType, TaskSchedulable {

let campaignID = queuedCampaignIDs.removeFirst()
guard let campaign = campaignRepository.list.first(where: { $0.id == campaignID }) else {
Logger.debug("Warning: Queued campaign \(campaignID) does not exist in the repository anymore")
IAMLogger.debug("Warning: Queued campaign \(campaignID) does not exist in the repository anymore")
return
}
let permissionResponse = permissionService.checkPermission(forCampaign: campaign.data)
if permissionResponse.performPing {
delegate?.performPing()
}

IAMLogger.debugLog("campaign impressionsLeft: \(campaign.impressionsLeft)")
guard campaign.impressionsLeft > 0 && (permissionResponse.display || campaign.data.isTest) else {
dispatchNext()
return
Expand Down
2 changes: 2 additions & 0 deletions Sources/RInAppMessaging/CampaignsListManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ internal class CampaignsListManager: CampaignsListManagerType, TaskSchedulable {
}

func refreshList() {
IAMLogger.debugLog("refreshList()")
pingQueue.sync {
pingMixerServer()
}
Expand All @@ -53,6 +54,7 @@ internal class CampaignsListManager: CampaignsListManagerType, TaskSchedulable {
handleError(error)
return
}
IAMLogger.debugLog("pingMixerServer: response decoded")
handleSuccess(decodedResponse)
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/RInAppMessaging/CampaignsValidator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ internal struct CampaignsValidator: CampaignsValidatorType {
}

guard let campaignTriggers = campaign.data.triggers else {
Logger.debug("campaign (\(campaign.id)) has no triggers.")
IAMLogger.debug("campaign (\(campaign.id)) has no triggers.")
return
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/RInAppMessaging/Extensions/UIApplication+IAM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ extension UIApplication {

func getKeyWindow() -> UIWindow? {
var keySceneWindow: UIWindow?
if #available(iOS 13.0, *) {
if #available(iOS 14.0, *) {
keySceneWindow = connectedScenes
.filter({ $0.activationState == .foregroundActive })
.compactMap({ $0 as? UIWindowScene })
Expand All @@ -16,7 +16,7 @@ extension UIApplication {
}

func getCurrentStatusBarStyle() -> UIStatusBarStyle? {
if #available(iOS 13.0, *),
if #available(iOS 14.0, *),
let keyScene = connectedScenes
.filter({ $0.activationState != .unattached })
.compactMap({ $0 as? UIWindowScene })
Expand Down
2 changes: 1 addition & 1 deletion Sources/RInAppMessaging/Extensions/UITabBar+IAM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public extension UITabBar {
.sorted { $0.frame.minX < $1.frame.minX } // Ensuring the right order

guard tabBarButtons.count == items?.count else {
Logger.debug("Unexpected tab bar items setup: \(tabBarButtons) \(items ?? [])")
IAMLogger.debug("Unexpected tab bar items setup: \(tabBarButtons) \(items ?? [])")
return
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/RInAppMessaging/Extensions/View+IAM.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation
import SwiftUI

@available(iOS 13.0, *)
@available(iOS 14.0, *)
internal extension View {
/// Hide or show the view based on a boolean value.
///
Expand Down
5 changes: 5 additions & 0 deletions Sources/RInAppMessaging/InAppMessagingInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ final class InAppMessagingInteractor {
module.onVerifyContext = onVerifyContext
module.setAccessibilityCompatibleDisplay(accessibilityCompatibleDisplay)
if let userPerference {
IAMLogger.debugLog("configure: registerPreference - userPerference")
module.registerPreference(userPerference)
}
iamModule = module
Expand All @@ -101,17 +102,21 @@ final class InAppMessagingInteractor {
}

func logEvent(_ event: Event) {
IAMLogger.debugLog("logEvent called")
IAMLogger.debugLog("logEvent: \(event.type.name)")
let didLogEvent = iamModule?.logEvent(event) == true
if !didLogEvent {
eventBuffer.append(event)
}
}

func closeMessage(clearQueuedCampaigns: Bool) {
IAMLogger.debugLog("closeMessage: \(clearQueuedCampaigns)")
iamModule?.closeMessage(clearQueuedCampaigns: clearQueuedCampaigns)
}

func closeTooltip(with uiElementIdentifier: String) {
IAMLogger.debugLog("closeTooltip: \(uiElementIdentifier)")
iamModule?.closeTooltip(with: uiElementIdentifier)
}

Expand Down
Loading
Loading