1 |
efrain |
1 |
// Copyright 2021 Google LLC
|
|
|
2 |
//
|
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
|
5 |
// You may obtain a copy of the License at
|
|
|
6 |
//
|
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
8 |
//
|
|
|
9 |
// Unless required by applicable law or agreed to in writing, software
|
|
|
10 |
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
12 |
// See the License for the specific language governing permissions and
|
|
|
13 |
// limitations under the License.
|
|
|
14 |
|
|
|
15 |
#import "FirebasePerformance/Sources/Common/FPRConsoleURLGenerator.h"
|
|
|
16 |
|
|
|
17 |
NSString *const URL_BASE_PATH = @"https://console.firebase.google.com";
|
|
|
18 |
NSString *const UTM_MEDIUM = @"ios-ide";
|
|
|
19 |
NSString *const UTM_SOURCE = @"perf-ios-sdk";
|
|
|
20 |
|
|
|
21 |
@implementation FPRConsoleURLGenerator
|
|
|
22 |
|
|
|
23 |
/** This is a class method to generate the console URL for the project's dashboard page.*/
|
|
|
24 |
+ (NSString *)generateDashboardURLWithProjectID:(NSString *)projectID
|
|
|
25 |
bundleID:(NSString *)bundleID {
|
|
|
26 |
NSString *rootUrl = [FPRConsoleURLGenerator getRootURLWithProjectID:projectID bundleID:bundleID];
|
|
|
27 |
return [NSString
|
|
|
28 |
stringWithFormat:@"%@/trends?utm_source=%@&utm_medium=%@", rootUrl, UTM_SOURCE, UTM_MEDIUM];
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
/** This is a class method to generate the console URL for the custom trace.*/
|
|
|
32 |
+ (NSString *)generateCustomTraceURLWithProjectID:(NSString *)projectID
|
|
|
33 |
bundleID:(NSString *)bundleID
|
|
|
34 |
traceName:(NSString *)traceName {
|
|
|
35 |
NSString *rootUrl = [FPRConsoleURLGenerator getRootURLWithProjectID:projectID bundleID:bundleID];
|
|
|
36 |
return [NSString stringWithFormat:@"%@/metrics/trace/"
|
|
|
37 |
@"DURATION_TRACE/%@?utm_source=%@&utm_medium=%@",
|
|
|
38 |
rootUrl, traceName, UTM_SOURCE, UTM_MEDIUM];
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
/** This is a class method to generate the console URL for the screen trace.*/
|
|
|
42 |
+ (NSString *)generateScreenTraceURLWithProjectID:(NSString *)projectID
|
|
|
43 |
bundleID:(NSString *)bundleID
|
|
|
44 |
traceName:(NSString *)traceName {
|
|
|
45 |
NSString *rootUrl = [FPRConsoleURLGenerator getRootURLWithProjectID:projectID bundleID:bundleID];
|
|
|
46 |
return [NSString stringWithFormat:@"%@/metrics/trace/"
|
|
|
47 |
@"SCREEN_TRACE/%@?utm_source=%@&utm_medium=%@",
|
|
|
48 |
rootUrl, traceName, UTM_SOURCE, UTM_MEDIUM];
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
/** This is a class method to get the root URL for the console .*/
|
|
|
52 |
+ (NSString *)getRootURLWithProjectID:(NSString *)projectID bundleID:(NSString *)bundleID {
|
|
|
53 |
return [NSString
|
|
|
54 |
stringWithFormat:@"%@/project/%@/performance/app/ios:%@", URL_BASE_PATH, projectID, bundleID];
|
|
|
55 |
}
|
|
|
56 |
@end
|