MetaMask / MetaMask/metamask-mobile
Apply a fixed font size to the MM
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 1.7k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 669
Description
### What is this about?
As a user, when I adjust my font in my settings I don't want it to impact my MM app because it breaks certain features.
### Scenario
_No response_
### Design
_No response_
### Technical Details
- Android: Custom Theme for Fixed Fonts
You can define a global app theme with fixed text sizes. In your res/values/styles.xml:
xml
```
<!-- Fixed font sizes -->
<item name="android:fontSize">14sp</item>
And in AndroidManifest.xml, reference the theme:
xml
```
- iOS: implement Global Accessibility Control via Notification in the AppDelegate, the correct place to add this is typically in the `didFinishLaunchingWithOptions` method. This ensures that the notifications for dynamic text scaling are removed immediately when the app initializes.
Here’s how you would add it:
Adding Global Accessibility Control via Notification in AppDelegate. You can implement this in your AppDelegate.m file as follows:
```
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Remove Dynamic Type change notifications globally
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIContentSizeCategoryDidChangeNotification object:nil];
NSLog(@"Dynamic Type notifications have been disabled globally.");
return YES;
}
// MARK: UISceneSession Lifecycle (if your app supports scenes)
- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UIScene.ConnectionOptions *)options {
return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
}
- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet *)sceneSessions {
}
@end
```
What This Does
The NotificationCenter.default.removeObserver(...) line removes the observer for system-wide dynamic text scaling events (UIContentSizeCategoryDidChange).
This ensures that your app no longer reacts to changes in system font scaling preferences made in the Accessibility Settings.
The print statement serves as a log for debugging purposes to confirm the notification has been removed.
### Threat Modeling Framework
_No response_
### Acceptance Criteria
_No response_
### Stakeholder review needed before the work gets merged
- [x] Engineering (needed in most cases)
- [x] Design
- [x] Product
- [ ] QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
- [ ] Security
- [ ] Legal
- [ ] Marketing
- [ ] Management (please specify)
- [ ] Other (please specify)
### References
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.