- Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathDynamicLinkComponents.cs
123 lines (115 loc) · 5.4 KB
/
DynamicLinkComponents.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
* Copyright 2017 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.
*/
usingSystem;
namespaceFirebase.DynamicLinks{
/// @brief The information needed to generate a Dynamic Link.
publicclassDynamicLinkComponents{
// Keep a reference to FirebaseApp as it initializes this SDK.
privateFirebase.FirebaseAppapp;
/// Creates a new Dynamic Link Components object with the given link
/// and dynamic link domain.
///
/// @param link The base link that your app will open.
/// @param uriPrefix The URI prefix (of the form "https://xyz.app.goo.gl") to
/// use for this Dynamic Link. You can find this value in the Dynamic Links
/// section of the Firebase console. If you have set up custom domains on your
/// project, set this to your project's custom domain as listed in the
/// Firebase console. Note: If you do not specify "https://" as the URI
/// scheme, it will be added.
publicDynamicLinkComponents(System.Urilink,stringuriPrefix){
app=Firebase.FirebaseApp.DefaultInstance;
Link=link;
if(!uriPrefix.StartsWith("https://")){
uriPrefix="https://"+uriPrefix;
}
DomainUriPrefix=uriPrefix;
}
/// The long Dynamic Link, generated from the other parameters.
publicSystem.UriLongDynamicLink{
get{
returnShortDynamicLink.ConvertFromInternal(
FirebaseDynamicLinks.GetLongLinkInternal(ConvertToInternal())).Url;
}
}
/// The link your app will open. You can specify any URL your app can
/// handle, such as a link to your app's content, or a URL that initiates
/// some app-specific logic such as crediting the user with a coupon, or
/// displaying a specific welcome screen. This link must be a well-formatted
/// URL, be properly URL-encoded, and use the HTTP or HTTPS scheme.
publicSystem.UriLink{get;set;}
/// The domain (of the form "https://xyz.app.goo.gl") to use for this Dynamic
/// Link. You can find this value in the Dynamic Links section of the Firebase
/// console.
///
/// If you have set up custom domains on your project, set this to your
/// project's custom domain as listed in the Firebase console.
///
/// Only https:// links are supported.
publicstringDomainUriPrefix{get;set;}
/// The Google Analytics parameters.
publicGoogleAnalyticsParametersGoogleAnalyticsParameters{get;set;}
/// The iOS parameters.
publicIOSParametersIOSParameters{get;set;}
/// The iTunes Connect App Analytics parameters.
publicITunesConnectAnalyticsParametersITunesConnectAnalyticsParameters{get;set;}
/// The Android parameters.
publicAndroidParametersAndroidParameters{get;set;}
/// The social meta-tag parameters.
publicSocialMetaTagParametersSocialMetaTagParameters{get;set;}
// Convert this object to DynamicLinkComponentsInternal.
internalDynamicLinkComponentsInternalConvertToInternal(){
returnnewDynamicLinkComponentsInternal{
link=Firebase.FirebaseApp.UriToUrlString(Link),
domain_uri_prefix=DomainUriPrefix,
google_analytics_parameters=GoogleAnalyticsParameters==null?
null:newGoogleAnalyticsParametersInternal{
source=GoogleAnalyticsParameters.Source,
medium=GoogleAnalyticsParameters.Medium,
campaign=GoogleAnalyticsParameters.Campaign,
term=GoogleAnalyticsParameters.Term,
content=GoogleAnalyticsParameters.Content
},
ios_parameters=IOSParameters==null?null:newIOSParametersInternal{
bundle_id=IOSParameters.BundleId,
fallback_url=Firebase.FirebaseApp.UriToUrlString(IOSParameters.FallbackUrl),
custom_scheme=IOSParameters.CustomScheme,
ipad_fallback_url=Firebase.FirebaseApp.UriToUrlString(IOSParameters.IPadFallbackUrl),
ipad_bundle_id=IOSParameters.IPadBundleId,
app_store_id=IOSParameters.AppStoreId,
minimum_version=IOSParameters.MinimumVersion
},
itunes_connect_analytics_parameters=ITunesConnectAnalyticsParameters==null?
null:newITunesConnectAnalyticsParametersInternal{
provider_token=ITunesConnectAnalyticsParameters.ProviderToken,
affiliate_token=ITunesConnectAnalyticsParameters.AffiliateToken,
campaign_token=ITunesConnectAnalyticsParameters.CampaignToken
},
android_parameters=AndroidParameters==null?
null:newAndroidParametersInternal{
package_name=AndroidParameters.PackageName,
fallback_url=Firebase.FirebaseApp.UriToUrlString(AndroidParameters.FallbackUrl),
minimum_version=AndroidParameters.MinimumVersion
},
social_meta_tag_parameters=SocialMetaTagParameters==null?
null:newSocialMetaTagParametersInternal{
title=SocialMetaTagParameters.Title,
description=SocialMetaTagParameters.Description,
image_url=Firebase.FirebaseApp.UriToUrlString(SocialMetaTagParameters.ImageUrl),
}
};
}
}
}