Change license to AGPL
This commit:
- Updates the `LICENSE` file
- Start every file with something like:
// Copyright YEAR_FIRST_PUBLISHED Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
---
First, I removed existing license headers with this Ruby 3.1.2 script:
require 'set'
EXTENSIONS_TO_CHECK = Set['.h', '.hpp', '.cpp', '.m', '.mm', '.pch', '.swift']
same = 0
different = 0
all_files = `git ls-files`.lines.map { |line| line.strip }
all_files.each do |relative_path|
if relative_path == 'Pods'
next
end
unless EXTENSIONS_TO_CHECK.include? File.extname(relative_path)
next
end
path = File.expand_path(relative_path)
contents = File.read(path)
new_contents = contents.sub(/\/\/\n\/\/ Copyright .*\n\/\/\n\n/, '')
if contents == new_contents
same += 1
else
different += 1
end
File.write(path, new_contents)
end
puts "updated #{different} file(s), left #{same} untouched"
I'm sure this script could be improved, but it worked well enough.
Then, I created `Scripts/lint/lint-license-headers` and ran it to auto-
fix a lot of files. This changed the mode of some files, but I think
that's actually desirable. For example,
`SignalServiceKit/src/Util/AppContext.m` previously had a mode of
`0755/-rwxr-xr-x`, and it's now `0644/-rw-r--r--`.
Then I fixed some stragglers and updated the precommit script.
See [a similar change in the Desktop app][0].
[0]: 8bfaf598af
66 lines
2.8 KiB
Objective-C
66 lines
2.8 KiB
Objective-C
//
|
|
// Copyright 2014 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
//
|
|
|
|
#import "UIUtil.h"
|
|
#import "Theme.h"
|
|
#import <SignalServiceKit/AppContext.h>
|
|
#import <SignalUI/SignalUI-Swift.h>
|
|
|
|
#define CONTACT_PICTURE_VIEW_BORDER_WIDTH 0.5f
|
|
|
|
@implementation UIUtil
|
|
|
|
+ (void)applyRoundedBorderToImageView:(UIImageView *)imageView
|
|
{
|
|
imageView.layer.borderWidth = CONTACT_PICTURE_VIEW_BORDER_WIDTH;
|
|
imageView.layer.borderColor = [UIColor clearColor].CGColor;
|
|
imageView.layer.cornerRadius = CGRectGetWidth(imageView.frame) / 2;
|
|
imageView.layer.masksToBounds = YES;
|
|
}
|
|
|
|
+ (void)removeRoundedBorderToImageView:(UIImageView *__strong *)imageView
|
|
{
|
|
[[*imageView layer] setBorderWidth:0];
|
|
[[*imageView layer] setCornerRadius:0];
|
|
}
|
|
|
|
+ (void)setupSignalAppearence
|
|
{
|
|
UINavigationBar.appearance.barTintColor = Theme.navbarBackgroundColor;
|
|
UINavigationBar.appearance.tintColor = Theme.primaryIconColor;
|
|
UIToolbar.appearance.barTintColor = Theme.navbarBackgroundColor;
|
|
UIToolbar.appearance.tintColor = Theme.primaryIconColor;
|
|
|
|
// We do _not_ specify BarButton.appearance.tintColor because it is sufficient to specify
|
|
// UINavigationBar.appearance.tintColor. Furthermore, specifying the BarButtonItem's
|
|
// apearence makes it more difficult to override the navbar theme, e.g. how we _always_
|
|
// use dark theme in the media send flow and gallery views. If we were specifying
|
|
// barButton.appearance.tintColor we would then have to manually override each BarButtonItem's
|
|
// tint, rather than just the navbars.
|
|
//
|
|
// UIBarButtonItem.appearance.tintColor = Theme.primaryIconColor;
|
|
|
|
// Using the keyboardAppearance causes crashes due to a bug in UIKit.
|
|
// UITextField.appearance.keyboardAppearance = (Theme.isDarkThemeEnabled
|
|
// ? UIKeyboardAppearanceDark
|
|
// : UIKeyboardAppearanceDefault);
|
|
// UITextView.appearance.keyboardAppearance = (Theme.isDarkThemeEnabled
|
|
// ? UIKeyboardAppearanceDark
|
|
// : UIKeyboardAppearanceDefault);
|
|
|
|
[[UITableViewCell appearance] setTintColor:Theme.primaryIconColor];
|
|
[[UIToolbar appearance] setTintColor:UIColor.ows_accentBlueColor];
|
|
|
|
// If we set NSShadowAttributeName, the NSForegroundColorAttributeName value is ignored.
|
|
UINavigationBar.appearance.titleTextAttributes = @{ NSForegroundColorAttributeName : Theme.navbarTitleColor };
|
|
|
|
[UITextView appearanceWhenContainedInInstancesOfClasses:@[ [OWSNavigationController class] ]].tintColor
|
|
= Theme.cursorColor;
|
|
[UITextField appearanceWhenContainedInInstancesOfClasses:@[ [OWSNavigationController class] ]].tintColor
|
|
= Theme.cursorColor;
|
|
}
|
|
|
|
@end
|