Customizing the Terms and Conditions Dialog Box

  • The GMSNavigationTermsDialogUIParams object allows customization of the Terms and Conditions dialog's appearance, including background color, fonts, and text colors.

  • Developers can modify elements like title font, main text font, button font, and respective colors using this object.

  • The provided code examples demonstrate how to implement these customizations in both Swift and Objective-C.

You can use the GMSNavigationTermsDialogUIParams object to customize the look and feel of the Terms and Conditions dialog box by changing the background color, the fonts, and the text colors.

Example

The following code example demonstrates how to customize the look and feel of the Terms and Conditions dialog box.

Swift

let termsUIParams = GMSNavigationTermsDialogUIParams(
                backgroundColor: .brown,
                titleFont: UIFont(name:"ChalkboardSE-Bold", size:18),
                titleColor: .orange,
                mainTextFont: UIFont(name:"MarkerFelt-Wide", size:18),
                mainTextColor: .yellow,
                buttonsFont: UIFont(name:"Arial-BoldItalicMT", size:14),
                cancelButtonTextColor: .green,
                acceptButtonTextColor: .blue)

let termsAndConditionsOptions = GMSNavigationTermsAndConditionsOptions(companyName: "Ride Sharing Co.")
termsAndConditionsOptions.title = "Some Title"
termsAndConditionsOptions.uiParams = termsUIParams

GMSNavigationServices.showTermsAndConditionsDialogIfNeeded(
                with: termsAndConditionsOptions) { termsAccepted in
      if termsAccepted {
        // ...
      } else {
        // ...
      }
    }

Objective-C

GMSNavigationTermsDialogUIParams *termsUIParams =
      [[GMSNavigationTermsDialogUIParams alloc] initWithBackgroundColor:[UIColor brownColor]
                      titleFont:[UIFont fontWithName:@"ChalkboardSE-Bold" size:18]
                     titleColor:[UIColor orangeColor]
                   mainTextFont:[UIFont fontWithName:@"MarkerFelt-Wide" size:18]
                  mainTextColor:[UIColor yellowColor]
                    buttonsFont:[UIFont fontWithName:@"Arial-BoldItalicMT" size:14]
          cancelButtonTextColor:[UIColor greenColor]
          acceptButtonTextColor:[UIColor blueColor]];

GMSNavigationTermsAndConditionsOptions *termsAndConditionsOptions = [[GMSNavigationTermsAndConditionsOptions alloc] initWithCompanyName:@"Ride Sharing Co."];
termsAndConditionsOptions.title = @"Some Title";
termsAndConditionsOptions.uiParams = termsUIParams;

[GMSNavigationServices
    showTermsAndConditionsDialogIfNeededWithOptions:termsAndConditionsOptions
                                         callback:^(BOOL termsAccepted) {
                                                         if (termsAccepted) {
                                                           // …
                                                         } else {
                                                           // …
                                                         }
                                                       }];