diff --git a/Vector/Utils/Tools.h b/Vector/Utils/Tools.h index 9705c5eeb..89e7fc48f 100644 --- a/Vector/Utils/Tools.h +++ b/Vector/Utils/Tools.h @@ -28,9 +28,13 @@ */ + (NSString*)presenceText:(MXUser*)user; - #pragma mark - Universal link +/** + The url of the Vector web application. + */ ++ (NSString*)webAppUrl; + /** Detect if a URL is a universal link for the application. diff --git a/Vector/Utils/Tools.m b/Vector/Utils/Tools.m index 3b9ba03a4..9a2ce9adb 100644 --- a/Vector/Utils/Tools.m +++ b/Vector/Utils/Tools.m @@ -61,6 +61,13 @@ #pragma mark - Universal link ++ (NSString *)webAppUrl +{ + // FIXME: When available, use the prod Vector web app URL + return [[NSUserDefaults standardUserDefaults] objectForKey:@"webAppUrlBeta"]; + //return [[NSUserDefaults standardUserDefaults] objectForKey:@"webAppUrlDev"]; +} + + (BOOL)isUniversalLink:(NSURL*)url { BOOL isUniversalLink = NO; diff --git a/Vector/Vector-Defaults.plist b/Vector/Vector-Defaults.plist index 52ae90cbb..447e87d76 100644 --- a/Vector/Vector-Defaults.plist +++ b/Vector/Vector-Defaults.plist @@ -16,6 +16,8 @@ matrix.org webAppUrlDev https://vector.im/develop + webAppUrlBeta + https://vector.im/beta apnsDeviceToken showAllEventsInRoomHistory diff --git a/Vector/ViewController/RoomViewController.m b/Vector/ViewController/RoomViewController.m index 75e43f472..c97de8cf7 100644 --- a/Vector/ViewController/RoomViewController.m +++ b/Vector/ViewController/RoomViewController.m @@ -1329,11 +1329,8 @@ [strongSelf cancelEventSelection]; // Create a permalink that is common to all Vector.im clients - // FIXME: When available, use the prod Vector web app URL - NSString *webAppUrl = [[NSUserDefaults standardUserDefaults] objectForKey:@"webAppUrlDev"]; - NSString *permalink = [NSString stringWithFormat:@"%@/#/room/%@/%@", - webAppUrl, + [Tools webAppUrl], selectedEvent.roomId, selectedEvent.eventId]; diff --git a/Vector/Views/Authentication/AuthInputsView.m b/Vector/Views/Authentication/AuthInputsView.m index 8d02a1611..021121563 100644 --- a/Vector/Views/Authentication/AuthInputsView.m +++ b/Vector/Views/Authentication/AuthInputsView.m @@ -17,6 +17,7 @@ #import "AuthInputsView.h" #import "VectorDesignValues.h" +#import "Tools.h" @interface AuthInputsView () { @@ -311,11 +312,8 @@ submittedEmail = [[MXK3PID alloc] initWithMedium:kMX3PIDMediumEmail andAddress:self.emailTextField.text]; // Create the next link that is common to all Vector.im clients - // FIXME: When available, use the prod Vector web app URL - NSString *webAppUrl = [[NSUserDefaults standardUserDefaults] objectForKey:@"webAppUrlDev"]; - NSString *nextLink = [NSString stringWithFormat:@"%@/#/register?client_secret=%@&hs_url=%@&is_url=%@&session_id=%@", - webAppUrl, + [Tools webAppUrl], [submittedEmail.clientSecret stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]], [restClient.homeserver stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]], [restClient.identityServer stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLHostAllowedCharacterSet]],