Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions FirebaseDynamicLinks/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# v8.7.0
- [added] Refactoring and adding helper class. (#8432)

# v8.6.0
- [changed] Replaced conditionally-compiled APIs with `API_UNAVAILABLE` annotations on unsupported platforms (#8467).

Expand Down
18 changes: 9 additions & 9 deletions FirebaseDynamicLinks/Sources/FIRDynamicLinkNetworking.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#import "FirebaseDynamicLinks/Sources/GINInvocation/GINArgument.h"
#import "FirebaseDynamicLinks/Sources/GINInvocation/GINInvocation.h"
#import "FirebaseDynamicLinks/Sources/Utilities/FDLDeviceHeuristicsHelper.h"
#import "FirebaseDynamicLinks/Sources/Utilities/FDLUtilities.h"

NS_ASSUME_NONNULL_BEGIN
Expand Down Expand Up @@ -207,15 +208,14 @@ - (void)retrievePendingDynamicLinkWithIOSVersion:(NSString *)IOSVersion

NSMutableDictionary *requestBody = [@{
@"bundleId" : [NSBundle mainBundle].bundleIdentifier,
@"device" : @{
@"screenResolutionHeight" : @(resolutionHeight),
@"screenResolutionWidth" : @(resolutionWidth),
@"languageCode" : locale,
@"languageCodeRaw" : localeRaw,
@"languageCodeFromWebview" : localeFromWebView,
@"timezone" : timezone,
@"deviceModelName" : modelName,
},
@"device" :
[FDLDeviceHeuristicsHelper FDLDeviceInfoDictionaryFromResolutionHeight:resolutionHeight
resolutionWidth:resolutionWidth
locale:locale
localeRaw:localeRaw
localeFromWebview:localeFromWebView
timeZone:timezone
modelName:modelName],
@"iosVersion" : IOSVersion,
@"sdkVersion" : FDLSDKVersion,
@"visualStyle" : @(uniqueMatchVisualStyle),
Expand Down
33 changes: 33 additions & 0 deletions FirebaseDynamicLinks/Sources/Utilities/FDLDeviceHeuristicsHelper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#import <Foundation/Foundation.h>

@interface FDLDeviceHeuristicsHelper : NSObject

/**
* Creates DeviceInfo dictionary based on the provided information.
*/
+ (NSDictionary<NSString *, NSObject *> *)
FDLDeviceInfoDictionaryFromResolutionHeight:(NSInteger)resolutionHeight
resolutionWidth:(NSInteger)resolutionWidth
locale:(NSString *)locale
localeRaw:(NSString *)localeRaw
localeFromWebview:(NSString *)localeFromWebView
timeZone:(NSString *)timezone
modelName:(NSString *)modelName;

@end
43 changes: 43 additions & 0 deletions FirebaseDynamicLinks/Sources/Utilities/FDLDeviceHeuristicsHelper.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#import "FirebaseDynamicLinks/Sources/Utilities/FDLDeviceHeuristicsHelper.h"
#import <Foundation/Foundation.h>

@implementation FDLDeviceHeuristicsHelper

/**
* Creates DeviceInfo dictionary based on the provided information.
*/
+ (NSDictionary<NSString *, NSObject *> *)
FDLDeviceInfoDictionaryFromResolutionHeight:(NSInteger)resolutionHeight
resolutionWidth:(NSInteger)resolutionWidth
locale:(NSString *)locale
localeRaw:(NSString *)localeRaw
localeFromWebview:(NSString *)localeFromWebView
timeZone:(NSString *)timezone
modelName:(NSString *)modelName {
return @{
@"screenResolutionHeight" : @(resolutionHeight),
@"screenResolutionWidth" : @(resolutionWidth),
@"languageCode" : locale,
@"languageCodeRaw" : localeRaw,
@"languageCodeFromWebview" : localeFromWebView,
@"timezone" : timezone,
@"deviceModelName" : modelName,
};
}
@end