Commit Graph

32 Commits

Author SHA1 Message Date
Sasha Weiss
13e4f39d2f
Add support for Unicode 17 emoji 2026-04-08 16:38:36 -05:00
Sasha Weiss
45f63da0ec
Introduce swiftformat 2025-12-19 14:36:47 -08:00
Pete Walters
31ca3f3511
Update to Unicode 16.0 Emoji 2025-10-15 15:01:18 -07:00
Harry
bb083ca39c
Fold SignalCoreKit into SignalServiceKit
Co-authored-by: Adam Sharp <sharplet@signal.org>
2024-06-26 08:44:41 -07:00
Pete Walters
c6b963c489
Change how EmojiWithSkinTones are initilaized to work with Xcode 15 2023-09-06 16:06:49 -05:00
Nora Trapp
5790964027 Update to latest Emoji version 2023-07-18 12:48:26 -07:00
Igor Solomennikov
20c55e7dec
Add necessary imports to Swift files.
Necessary for converting ChatListVC to Swift.
2023-06-05 16:04:48 -07:00
Evan Hahn
370ff654e7
Change license to AGPL
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
2022-10-13 08:25:37 -05:00
Evan Hahn
57c47ced2c Fix operator_whitespace SwiftLint violations
This fixes violations of [SwiftLint's `operator_whitespace` rule][0].
This is a whitespace-only change.

[0]: https://realm.github.io/SwiftLint/operator_whitespace.html
2022-07-07 17:38:38 -07:00
Evan Hahn
c41867ab7a Fix doc comment in Emoji
The `Emoji` enum had an [orphaned doc comment][0], which SwiftLint reported.

This updates that file's generator to fix the error. (SwiftLint is disabled for most of the file, though—a bit unfortunate, but probably correct for generated files.)

[0]: https://realm.github.io/SwiftLint/orphaned_doc_comment.html
2022-06-03 18:30:36 +00:00
Evan Hahn
df8592fa23 Fix SwiftLint switch_case_alignment violations
_I recommend reviewing this with whitespace changes disabled._

Bad:

```swift
switch foo {
    case .one: return 1
    case .two: return 2
}
```

Good:

```swift
switch foo {
case .one: return 1
case .two: return 2
}
```

See [the rule's documentation][0] for more.

[0]: https://realm.github.io/SwiftLint/switch_case_alignment.html
2022-05-03 12:15:05 -05:00
Evan Hahn
72a05b2be1 Revert "Speed up compilation by tweaking emoji code"
This reverts commit 3c26cb56f7, because it
caused compilation to slow down (the opposite of the original goal!).
2022-04-25 12:41:59 -07:00
Evan Hahn
3c26cb56f7 Speed up compilation by tweaking emoji code
I profiled our Swift code with the following flags:

    -Xfrontend -warn-long-function-bodies=100 -Xfrontend -warn-long-expression-type-checking=100

Lots of stuff took longer than 100ms, but only one function took longer
than 10 seconds: `EmojiWithSkinTones#init(rawValue: String)` took 12
seconds. Presumably, this was because it had a call to `self.init` once
per emoji. Now we do it once, which cuts the compile time from ~12.3
seconds to ~1.9.

There was another long-running one, `emojiPerSkinTonePermutation`, which
also took a fairly long time, and this cut it down a bit.

There's more we can do to speed up our builds (see links below) and this
shouldn't change incremental ones much (unless you're changing these
files) but it was low-hanging fruit.

Resources to speed up builds, some of which are old:

- ["Build performance analysis for speeding up Xcode builds"][0]
- ["Improving the Speed of Incremental Builds"][1]
- ["How to make Swift compile faster"][2]
- ["Speed up Swift compile time"][3]
- ["Optimizing Swift build times"][4]
- ["Improving Swift compile times"][5]
- ["Regarding Swift build time optimizations"][6]

[0]: https://www.avanderlee.com/optimization/analysing-build-performance-xcode/
[1]: https://developer.apple.com/documentation/xcode/improving-the-speed-of-incremental-builds
[2]: https://www.hackingwithswift.com/articles/11/how-to-make-swift-compile-faster
[3]: https://medium.com/hackernoon/speed-up-swift-compile-time-6f62d86f85e6
[4]: https://github.com/fastred/Optimizing-Swift-Build-Times
[5]: https://www.swiftbysundell.com/articles/improving-swift-compile-times/
[6]: https://medium.com/@RobertGummesson/regarding-swift-build-time-optimizations-fc92cdd91e31
2022-04-23 11:27:39 -05:00
Michelle Linington
0f3a2b4c2e Perform emoji mapping in EmojiGenerator 2022-04-01 14:55:30 -07:00
Dimitris Apostolou
62724cf0be Fix typos 2022-03-18 11:31:06 -07:00
Michelle Linington
a348495786 Swap hands 2022-03-03 17:11:23 -08:00
Michelle Linington
614807de65 Update to Emoji 14 2022-03-03 17:11:23 -08:00
Michelle Linington
b4acfbcfe7 Enhancements to emoji codegen script
- Any errors that are hit are propogated out to stdout
- Notifies via stdout if a new emoji needs a component definition
- Uses Character instead of UnicodeScalar when appropriate
- Explicitly declares the RemoteModel that's in use
- Enhancements to file writing to simplify indentation
2021-11-02 14:47:26 -07:00
Michelle Linington
582426a203 Update emoji script to account for new component emojis 2021-11-02 14:47:26 -07:00
Michelle Linington
98f9fcc9ad Fix emoji generator script to not re-add warnings 2021-10-21 21:30:56 -07:00
Michelle Linington
d2de17afb9 Fix lint script 2021-10-12 11:46:44 -07:00
Michelle Linington
ce8f0a8b0b Update emoji 2021-10-12 11:46:44 -07:00
Eugene Bistolas
1d451481a4 Review feedback, swift-lint 2021-06-02 14:17:21 -10:00
Eugene Bistolas
4c347e0488 Fix build performance for 12.5/Swift 5.4 2021-06-02 14:17:21 -10:00
Matthew Chen
111338b59d Rewrite conversation view. 2020-12-10 12:44:13 -03:00
Nora Trapp
21fcb5e763 Fix script to handle emoji with overlapping names 2020-11-05 13:18:39 -08:00
Nora Trapp
896b9f9902 Some small tweaks to emoji generation (determinate skin tone order, better 'couple' naming) 2020-08-24 15:12:24 -07:00
Nora Trapp
cfc6900440 Persist and render preferred skin tone permutations in reaction picker 2020-08-24 15:12:24 -07:00
Nora Trapp
f7dfcc3348 Generate skin tone information for Emoji 2020-08-24 15:12:24 -07:00
Nora Trapp
0805ff8ca9 Refactor to use shortName as some emoji don't have a name defined 2020-06-01 12:52:58 -07:00
Nora Trapp
1f3a3764bc Merge smileys & people categories, ignore skin tones 2020-06-01 12:52:58 -07:00
Nora Trapp
150639080d Generate Emoji enum representing all available emoji 2020-06-01 12:52:58 -07:00