Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_sdk_framework
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Manos Chorianopoulos
2022-09-22 16:10:07 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
417ed0a0daa6cedd702229479db4887fda606ee0
417ed0a0
1 parent
024e7178
Added sendDeviceInfoIfNecessary function
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
180 additions
and
4 deletions
SwiftWarplyFramework/Pods/Pods.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
SwiftWarplyFramework/SwiftWarplyFramework.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.h
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.m
SwiftWarplyFramework/SwiftWarplyFramework/Warply/managers/WLPushManager.h
SwiftWarplyFramework/SwiftWarplyFramework/Warply/managers/WLPushManager.m
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/Pods/Pods.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
View file @
417ed0a
...
...
@@ -7,7 +7,7 @@
<key>
Pods-SwiftWarplyFramework.xcscheme_^#shared#^_
</key>
<dict>
<key>
orderHint
</key>
<integer>
1
</integer>
<integer>
0
</integer>
</dict>
</dict>
</dict>
...
...
SwiftWarplyFramework/SwiftWarplyFramework.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
View file @
417ed0a
...
...
@@ -7,7 +7,7 @@
<key>
SwiftWarplyFramework.xcscheme_^#shared#^_
</key>
<dict>
<key>
orderHint
</key>
<integer>
0
</integer>
<integer>
1
</integer>
</dict>
</dict>
</dict>
...
...
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
417ed0a
No preview for this file type
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.h
View file @
417ed0a
...
...
@@ -101,6 +101,7 @@
-
(
void
)
getMultilingualMerchantsAsync
:(
NSArray
*
)
categories
andDefaultShown
:(
NSNumber
*
)
defaultShown
andCenter
:(
NSNumber
*
)
center
andTags
:(
NSArray
*
)
tags
andUuid
:(
NSString
*
)
uuid
andDistance
:(
NSNumber
*
)
distance
parent_uuids
:(
NSArray
*
)
parent_uuids
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
// - (void)didReceiveNotification:(NSDictionary *)userInfo whileAppWasInState:(WLApplicationState)state;
-
(
void
)
didReceiveNotification
:(
NSDictionary
*
)
payload
;
-
(
void
)
sendDeviceInfoIfNecessary
:(
NSString
*
)
newDeviceToken
;
@end
#endif
/* MyApi_h */
...
...
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.m
View file @
417ed0a
...
...
@@ -1610,4 +1610,9 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify";
[[
Warply
sharedService
].
pushManager
didReceiveRemoteNotification
:
payload
whileAppWasInState
:
WLApplicationStateClosed
];
}
-
(
void
)
sendDeviceInfoIfNecessary
:
(
NSString
*
)
newDeviceToken
{
[[
Warply
sharedService
].
pushManager
sendDeviceInfoIfNecessary
:
newDeviceToken
];
}
@end
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Warply/managers/WLPushManager.h
View file @
417ed0a
...
...
@@ -201,10 +201,13 @@ typedef enum WLApplicationState : unsigned int{
@discussion This function is internal and only used by Warply service.
*/
-
(
void
)
sendDeviceInfoIfNecessary
;
-
(
void
)
sendDeviceInfoIfNecessary
:(
NSString
*
)
newDeviceToken
;
-
(
void
)
sendDeviceInfo
;
-
(
void
)
sendDeviceInfo
:(
NSString
*
)
newDeviceToken
;
-
(
NSDictionary
*
)
deviceInfo
;
-
(
NSDictionary
*
)
deviceInfo
:(
NSString
*
)
newDeviceToken
;
-
(
NSDictionary
*
)
applicationData
;
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Warply/managers/WLPushManager.m
View file @
417ed0a
...
...
@@ -371,9 +371,9 @@ static const char* jailbreak_apps[] =
NSLog
(
@"application_data_has_changed: %@"
,
application_data_has_changed
);
NSLog
(
@"_isMissingDeviceInfo: %@"
,
_isMissingDeviceInfo
);
//
if (device_info_has_changed || application_data_has_changed || _isMissingDeviceInfo) {
if
(
device_info_has_changed
||
application_data_has_changed
||
_isMissingDeviceInfo
)
{
[
self
sendDeviceInfo
];
//
}
}
}
///////////////////////////////////////////////////////////////////////////////
...
...
@@ -395,6 +395,55 @@ static const char* jailbreak_apps[] =
}
///////////////////////////////////////////////////////////////////////////////
// TODO: Check
-
(
void
)
sendDeviceInfoIfNecessary
:
(
NSString
*
)
newDeviceToken
{
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
if
([
defaults
boolForKey
:
@"NBAPPUuidChanged"
]
==
YES
)
{
[
defaults
removeObjectForKey
:
@"device_info"
];
[
defaults
removeObjectForKey
:
WL_APPLICATION_DATA
];
[
defaults
synchronize
];
}
NSDictionary
*
oldDeviceInfo
=
[
defaults
objectForKey
:
@"device_info"
];
BOOL
device_info_has_changed
=
!
[[
self
deviceInfo
:
newDeviceToken
]
isEqualToDictionary
:
oldDeviceInfo
];
NSDictionary
*
oldApplicationData
=
[
defaults
objectForKey
:
WL_APPLICATION_DATA
];
BOOL
application_data_has_changed
=
!
[[
self
applicationData
]
isEqualToDictionary
:
oldApplicationData
];
// TODO: DELETE
NSLog
(
@"oldDeviceInfo: %@"
,
oldDeviceInfo
);
NSLog
(
@"device_info_has_changed: %@"
,
device_info_has_changed
);
NSLog
(
@"oldApplicationData: %@"
,
oldApplicationData
);
NSLog
(
@"application_data_has_changed: %@"
,
application_data_has_changed
);
NSLog
(
@"_isMissingDeviceInfo: %@"
,
_isMissingDeviceInfo
);
// if (device_info_has_changed || application_data_has_changed || _isMissingDeviceInfo) {
[
self
sendDeviceInfo
:
newDeviceToken
];
// }
}
///////////////////////////////////////////////////////////////////////////////
-
(
void
)
sendDeviceInfo
:
(
NSString
*
)
newDeviceToken
{
WLEventSimple
*
deviceInfoEvent
=
[[
WLEventSimple
alloc
]
initWithType
:
@"device_info"
andContext
:[
NSDictionary
dictionaryWithObject
:[
self
deviceInfo
:
newDeviceToken
]
forKey
:
@"device_info"
]];
[[
Warply
sharedService
]
addEvent
:(
WLEvent
*
)
deviceInfoEvent
priority
:
NO
];
WLEventSimple
*
applicationDataEvent
=
[[
WLEventSimple
alloc
]
initWithType
:
WL_APPLICATION_DATA
andContext
:[
NSDictionary
dictionaryWithObject
:[
self
applicationData
]
forKey
:
WL_APPLICATION_DATA
]];
[[
Warply
sharedService
]
addEvent
:(
WLEvent
*
)
applicationDataEvent
priority
:
NO
];
_hasSentDeviceInfo
=
YES
;
_isMissingDeviceInfo
=
NO
;
[[
Warply
sharedService
]
sendAllEventsWithCompletionBlock
:
^
{
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
[
defaults
setObject
:[
self
applicationData
]
forKey
:
WL_APPLICATION_DATA
];
[
defaults
setObject
:[
self
deviceInfo
:
newDeviceToken
]
forKey
:
@"device_info"
];
[
defaults
synchronize
];
}
failureBlock
:
nil
];
}
///////////////////////////////////////////////////////////////////////////////
-
(
void
)
showItem
:
(
WLInboxItem
*
)
item
{
WLInboxItemViewController
*
itemViewController
=
[[
WLInboxItemViewController
alloc
]
initWithItem
:
item
];
...
...
@@ -527,6 +576,117 @@ static const char* jailbreak_apps[] =
}
///////////////////////////////////////////////////////////////////////////////
// TODO: Check
-
(
NSDictionary
*
)
deviceInfo
:
(
NSString
*
)
newDeviceToken
{
CTTelephonyNetworkInfo
*
telephony
=
[[
CTTelephonyNetworkInfo
alloc
]
init
];
CTCarrier
*
carrier
=
telephony
.
subscriberCellularProvider
;
NSArray
*
prefLangs
=
[
NSLocale
preferredLanguages
];
NSUInteger
count
=
[
prefLangs
count
];
NSString
*
langs
=
[
NSString
stringWithFormat
:
@"%@, %@, %@, %@, %@"
,
(
count
>
0
)?[
prefLangs
objectAtIndex
:
0
]:
@"-"
,
(
count
>
1
)?[
prefLangs
objectAtIndex
:
1
]:
@"-"
,
(
count
>
2
)?[
prefLangs
objectAtIndex
:
2
]:
@"-"
,
(
count
>
3
)?[
prefLangs
objectAtIndex
:
3
]:
@"-"
,
(
count
>
4
)?[
prefLangs
objectAtIndex
:
4
]:
@"-"
];
NSMutableDictionary
*
deviceInfo
=
[
NSMutableDictionary
dictionaryWithObjectsAndKeys
:
#if (DEBUG == 1)
@"true"
,
@"development"
,
#else
@"false"
,
@"development"
,
#endif
nil
];
if
([[[
UIDevice
currentDevice
]
systemName
]
length
]
!=
0
)
{
[
deviceInfo
setValue
:[[
UIDevice
currentDevice
]
systemName
]
forKey
:
@"ios_system_name"
];
}
if
([[[
UIDevice
currentDevice
]
systemVersion
]
length
]
!=
0
)
{
[
deviceInfo
setValue
:[[
UIDevice
currentDevice
]
systemVersion
]
forKey
:
@"ios_system_version"
];
}
if
([[[
UIDevice
currentDevice
]
platformString
]
length
]
!=
0
)
{
[
deviceInfo
setValue
:[[
UIDevice
currentDevice
]
platformString
]
forKey
:
@"ios_model"
];
}
if
([[
UIDevice
currentDevice
]
platform
].
length
!=
0
)
{
[
deviceInfo
setValue
:[[
UIDevice
currentDevice
]
platform
]
forKey
:
@"ios_device_model"
];
}
if
([[
UIDevice
currentDevice
]
deviceFamilyString
].
length
!=
0
)
{
[
deviceInfo
setValue
:[[
UIDevice
currentDevice
]
deviceFamilyString
]
forKey
:
@"device_family"
];
}
if
(
carrier
.
carrierName
.
length
!=
0
)
{
[
deviceInfo
setValue
:
carrier
.
carrierName
forKey
:
@"carrier_name"
];
}
if
(
carrier
.
isoCountryCode
.
length
!=
0
)
{
[
deviceInfo
setValue
:
carrier
.
isoCountryCode
forKey
:
@"ios_iso_country_code"
];
}
if
([[[
UIDevice
currentDevice
]
localizedModel
]
length
]
!=
0
)
{
[
deviceInfo
setValue
:[[
UIDevice
currentDevice
]
localizedModel
]
forKey
:
@"ios_localized_model"
];
}
if
([[[
NSLocale
currentLocale
]
localeIdentifier
]
length
]
!=
0
)
{
[
deviceInfo
setValue
:[[
NSLocale
currentLocale
]
localeIdentifier
]
forKey
:
@"ios_locale"
];
}
if
(
langs
.
length
!=
0
)
{
[
deviceInfo
setValue
:
langs
forKey
:
@"ios_languages"
];
}
[
deviceInfo
setValue
:
@"apple"
forKey
:
@"vendor"
];
[
deviceInfo
setValue
:
@"ios"
forKey
:
@"platform"
];
[
deviceInfo
setValue
:[[
UIDevice
currentDevice
]
systemVersion
]
forKey
:
@"os_version"
];
[
deviceInfo
setValue
:[[[
UIDevice
currentDevice
]
identifierForVendor
]
UUIDString
]
forKey
:
@"unique_device_id"
];
[
deviceInfo
setValue
:[[
ASIdentifierManager
sharedManager
].
advertisingIdentifier
UUIDString
]
forKey
:
@"advertising_id"
];
[
deviceInfo
setValue
:[
NSString
stringWithFormat
:
@"%.0fx%.0f"
,([
UIScreen
mainScreen
].
bounds
.
size
.
width
*
[[
UIScreen
mainScreen
]
scale
]),([
UIScreen
mainScreen
].
bounds
.
size
.
height
*
[[
UIScreen
mainScreen
]
scale
])]
forKey
:
@"screen_resolution"
];
#if (WARPLY_UDID_ENABLED == 1)
if
([[
UIDevice
currentDevice
]
respondsToSelector
:
@selector
(
uniqueIdentifier
)])
{
[
device_info
setValue
:[
UIDevice
currentDevice
].
uniqueIdentifier
forKey
:
@"ios_unique_identifier"
];
}
#endif
[
deviceInfo
setValue
:[
self
isJailBroken
]?[
NSNumber
numberWithBool
:
YES
]
:
[
NSNumber
numberWithBool
:
NO
]
forKey
:
@"ios_is_jailbroken_phone"
];
if
(
newDeviceToken
.
length
!=
0
)
{
[
deviceInfo
setValue
:
newDeviceToken
forKey
:
@"device_token"
];
}
[
deviceInfo
setValue
:[
NSNumber
numberWithBool
:
!
self
.
apsRegistrationError
]
forKey
:
@"ios_aps_entitlement_valid"
];
NSUInteger
rntypes
;
if
(
SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO
(
@"10.0"
))
{
[
deviceInfo
setValue
:[
NSNumber
numberWithInt
:
_notificationOptions
]
forKey
:
@"notification_types"
];
}
else
{
[
deviceInfo
setValue
:[
NSNumber
numberWithInt
:
_notificationTypes
]
forKey
:
@"notification_types"
];
}
if
(
SYSTEM_VERSION_LESS_THAN
(
@"8.0"
))
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
rntypes
=
[[
UIApplication
sharedApplication
]
enabledRemoteNotificationTypes
];
#pragma clang diagnostic pop
}
else
{
rntypes
=
[[[
UIApplication
sharedApplication
]
currentUserNotificationSettings
]
types
];
}
[
deviceInfo
setValue
:[
NSNumber
numberWithInteger
:
rntypes
]
forKey
:
@"user_enabled_notification_types"
];
// NSMutableDictionary *apple_uuids = [NSMutableDictionary dictionaryWithCapacity:2];
[
deviceInfo
setValue
:[
NSNumber
numberWithBool
:[
ASIdentifierManager
sharedManager
].
advertisingTrackingEnabled
]
forKey
:
@"advertising_tracking_enabled"
];
[
deviceInfo
setValue
:[[
ASIdentifierManager
sharedManager
].
advertisingIdentifier
UUIDString
]
forKey
:
@"advertising_identifier"
];
[
deviceInfo
setValue
:[[[
UIDevice
currentDevice
]
identifierForVendor
]
UUIDString
]
forKey
:
@"identifier_for_vendor"
];
// [deviceInfo setValue:apple_uuids forKey: @"ios_uuids"];
NSLog
(
@"%@"
,
deviceInfo
);
return
deviceInfo
;
}
///////////////////////////////////////////////////////////////////////////////
-
(
NSDictionary
*
)
applicationData
{
//Application Data Hack
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
417ed0a
...
...
@@ -5579,4 +5579,11 @@ public class swiftApi {
}
public
func
sendDeviceInfoIfNecessary
(
_
newDeviceToken
:
String
)
->
Void
{
let
instanceOfMyApi
=
MyApi
()
instanceOfMyApi
.
sendDeviceInfoIfNecessary
(
newDeviceToken
)
}
}
...
...
Please
register
or
login
to post a comment