Improve iPad layout. Add separate debug configuration.

This commit is contained in:
Doug
2021-12-09 16:20:22 +00:00
parent 28464b8a99
commit b44642a31d
6 changed files with 82 additions and 47 deletions

View File

@@ -165,11 +165,18 @@ final class BuildSettings: NSObject {
static let roomsAllowToJoinPublicRooms: Bool = true
// MARK: - Analytics
#warning("Testing environment.")
/// Host to use for PostHog analytics. Set to nil to disable analytics.
#if DEBUG
/// Host to use for PostHog analytics during development. Set to nil to disable analytics in debug builds.
static let analyticsHost: String? = "https://posthog-poc.lab.element.dev"
/// Public key for submitting analytics. Set to nil to disable analytics.
/// Public key for submitting analytics during development. Set to nil to disable analytics in debug builds.
static let analyticsKey: String? = "rs-pJjsYJTuAkXJfhaMmPUNBhWliDyTKLOOxike6ck8"
#else
/// Host to use for PostHog analytics. Set to nil to disable analytics.
static let analyticsHost: String? = "https://posthog.hss.element.io"
/// Public key for submitting analytics. Set to nil to disable analytics.
static let analyticsKey: String? = "phc_Jzsm6DTm6V2705zeU5dcNvQDlonOR68XvX2sh1sEOHO"
#endif
/// The URL to open with more information about analytics terms.
static let analyticsTermsURL = URL(string: "https://element.io/cookie-policy")!

View File

@@ -949,10 +949,12 @@ Tap the + to start adding people.";
// Analytics
"analytics_prompt_title" = "Help improve %@";
"analytics_prompt_description_new_user" = "Help us identify issues and improve Element by sharing anonymous usage data. To understand how people use multiple devices, well generate a random identifier, shared by your devices.";
"analytics_prompt_description_upgrade" = "You previously consented to share anonymous usage data with us. Now, to help understand how people use multiple devices, well generate a random identifier, shared by your devices.";
"analytics_prompt_message_new_user" = "Help us identify issues and improve Element by sharing anonymous usage data. To understand how people use multiple devices, well generate a random identifier, shared by your devices.";
"analytics_prompt_message_upgrade" = "You previously consented to share anonymous usage data with us. Now, to help understand how people use multiple devices, well generate a random identifier, shared by your devices.";
/* Note: The placeholder is for the contents of analytics_prompt_terms_link_new_user */
"analytics_prompt_terms_new_user" = "You can read all our terms %@.";
"analytics_prompt_terms_link_new_user" = "here";
/* Note: The placeholder is for the contents of analytics_prompt_terms_link_upgrade */
"analytics_prompt_terms_upgrade" = "Read all our terms %@. Is that OK?";
"analytics_prompt_terms_link_upgrade" = "here";
/* Note: The word "don't" is formatted in bold */
@@ -960,6 +962,7 @@ Tap the + to start adding people.";
/* Note: The word "don't" is formatted in bold */
"analytics_prompt_point_2" = "We <b>don't</b> share information with third parties";
"analytics_prompt_point_3" = "You can turn this off anytime in settings";
"analytics_prompt_not_now" = "Not now";
"analytics_prompt_yes" = "Yes, that's fine";
"analytics_prompt_stop" = "Stop sharing";

View File

@@ -16,8 +16,8 @@ public class VectorL10n: NSObject {
return VectorL10n.tr("Vector", "accept")
}
/// button
public static var accessibilityButtonLabel: String {
return VectorL10n.tr("Vector", "accessibility_button_label")
public static var accessibilityButtonLabel: String {
return VectorL10n.tr("Vector", "accessibility_button_label")
}
/// checkbox
public static var accessibilityCheckboxLabel: String {
@@ -36,12 +36,16 @@ public class VectorL10n: NSObject {
return VectorL10n.tr("Vector", "active_call_details", p1)
}
/// Help us identify issues and improve Element by sharing anonymous usage data. To understand how people use multiple devices, well generate a random identifier, shared by your devices.
public static var analyticsPromptDescriptionNewUser: String {
return VectorL10n.tr("Vector", "analytics_prompt_description_new_user")
public static var analyticsPromptMessageNewUser: String {
return VectorL10n.tr("Vector", "analytics_prompt_message_new_user")
}
/// You previously consented to share anonymous usage data with us. Now, to help understand how people use multiple devices, well generate a random identifier, shared by your devices.
public static var analyticsPromptDescriptionUpgrade: String {
return VectorL10n.tr("Vector", "analytics_prompt_description_upgrade")
public static var analyticsPromptMessageUpgrade: String {
return VectorL10n.tr("Vector", "analytics_prompt_message_upgrade")
}
/// Not now
public static var analyticsPromptNotNow: String {
return VectorL10n.tr("Vector", "analytics_prompt_not_now")
}
/// We <b>don't</b> record or profile any account data
public static var analyticsPromptPoint1: String {

View File

@@ -650,7 +650,11 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni
// Check if there is crash log to send
if (RiotSettings.shared.enableAnalytics)
{
#if DEBUG
// Don't show alerts for crashes during development.
#else
[self checkExceptionToReport];
#endif
}
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.

View File

@@ -63,12 +63,12 @@ enum AnalyticsPromptType {
extension AnalyticsPromptType {
/// The main description string that should be displayed.
var description: String {
var message: String {
switch self {
case .newUser:
return VectorL10n.analyticsPromptDescriptionNewUser
return VectorL10n.analyticsPromptMessageNewUser
case .upgrade:
return VectorL10n.analyticsPromptDescriptionUpgrade
return VectorL10n.analyticsPromptMessageUpgrade
}
}
@@ -94,7 +94,7 @@ extension AnalyticsPromptType {
var disableButtonTitle: String {
switch self {
case .newUser:
return VectorL10n.cancel
return VectorL10n.analyticsPromptNotNow
case .upgrade:
return VectorL10n.analyticsPromptStop
}
@@ -121,3 +121,8 @@ extension AnalyticsPromptType: Identifiable {
}
}
}
// For the RiotSwiftUI target presentation.
extension AnalyticsPromptType: CustomStringConvertible {
var description: String { id }
}

View File

@@ -27,6 +27,11 @@ struct AnalyticsPrompt: View {
// MARK: Private
@Environment(\.theme) private var theme
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
private var horizontalPadding: CGFloat {
horizontalSizeClass == .regular ? 50 : 16
}
// MARK: Public
@@ -35,9 +40,9 @@ struct AnalyticsPrompt: View {
// MARK: Views
/// The text that explains what analytics will do.
private var descriptionText: some View {
private var messageText: some View {
VStack {
Text("\(viewModel.viewState.promptType.description)\n")
Text("\(viewModel.viewState.promptType.message)\n")
AnalyticsPromptTermsText(attributedString: viewModel.viewState.promptType.termsStrings)
.accessibilityLabel(Text(viewModel.viewState.promptType.termsStrings.string))
@@ -63,6 +68,31 @@ struct AnalyticsPrompt: View {
.frame(maxWidth: .infinity)
}
private var mainContent: some View {
VStack {
Image(uiImage: Asset.Images.analyticsLogo.image)
.padding(.bottom, 25)
Text(VectorL10n.analyticsPromptTitle(viewModel.viewState.strings.appDisplayName))
.font(theme.fonts.title2B)
.foregroundColor(theme.colors.primaryContent)
.padding(.bottom, 2)
messageText
.font(theme.fonts.body)
.foregroundColor(theme.colors.secondaryContent)
.multilineTextAlignment(.center)
Divider()
.background(theme.colors.quinaryContent)
.padding(.vertical, 28)
checkmarkList
.foregroundColor(theme.colors.secondaryContent)
.padding(.bottom, 16)
}
}
/// The stack of enable/disable buttons.
private var buttons: some View {
VStack {
@@ -77,45 +107,27 @@ struct AnalyticsPrompt: View {
Text(viewModel.viewState.promptType.disableButtonTitle)
.font(theme.fonts.bodySB)
.foregroundColor(theme.colors.accent)
.padding(12)
}
.buttonStyle(PrimaryActionButtonStyle(customColor: .clear))
.accessibilityIdentifier("disableButton")
}
}
var body: some View {
VStack {
ScrollView(showsIndicators: false) {
VStack {
Image(uiImage: Asset.Images.analyticsLogo.image)
.padding(.bottom, 25)
Text(VectorL10n.analyticsPromptTitle(viewModel.viewState.strings.appDisplayName))
.font(theme.fonts.title2B)
.foregroundColor(theme.colors.primaryContent)
.padding(.bottom, 2)
descriptionText
.font(theme.fonts.body)
.foregroundColor(theme.colors.secondaryContent)
.multilineTextAlignment(.center)
Divider()
.background(theme.colors.quinaryContent)
.padding(.vertical, 28)
checkmarkList
.foregroundColor(theme.colors.secondaryContent)
.padding(.bottom, 16)
GeometryReader { geometry in
VStack {
ScrollView(showsIndicators: false) {
mainContent
.padding(.top, 50)
.padding(.horizontal, horizontalPadding)
}
.padding(.top, 50)
.padding(.horizontal, 16)
buttons
.padding(.horizontal, horizontalPadding)
.padding(.bottom, geometry.safeAreaInsets.bottom > 0 ? 0 : 16)
}
buttons
.padding(.horizontal, 16)
.background(theme.colors.background.ignoresSafeArea())
}
.background(theme.colors.background.ignoresSafeArea())
}
}