Skip to content

Commit

Permalink
Fixed fonts in widget
Browse files Browse the repository at this point in the history
  • Loading branch information
VityaSchel committed Sep 29, 2023
1 parent b654a17 commit 8ffed2a
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 4 deletions.
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Viktor Shchelochkov <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# samsung-pinger
# Samsung Pinger

Samsung Pinger is a MacOS widget that lets you quickly ring your Samsung device.

![Widget Gallery Screenshot](./docs/preview-widget-gallery.png)

## How it works
Simply open notification center, click on the widget and your Samsung phone will ring even if it's in silent mode for one minute!

You open notification center, click on widget and 1 second later your phone rings!
[Download](https://github.com/vityaschel/samsung-pinger/releases)

## Setup

you absolutely can do this! I believe in you! it takes less than 1 minute :)
you absolutely can do this! I believe in you! it takes less than a minute :)

![Screnshot](./docs/preview-screenshot.png)

Expand All @@ -28,3 +28,7 @@ you absolutely can do this! I believe in you! it takes less than 1 minute :)
## Under the hood

Read [my notes](https://gist.github.com/VityaSchel/fe8945c0189bbaabed420003bdf3216d) on reverse-engineering smartthingsfind website.

## Hire me!

I'm available for hire if you can provide me with a work visa in Canada. Check out my resume: [cv.hloth.dev](https://cv.hloth.dev).
15 changes: 15 additions & 0 deletions widget/widget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,24 @@ struct widgetEntryView : View {
}
}

func registerCustomFont(fileName: String, withExtension fileExtension: String) {
guard let fontURL = Bundle.main.url(forResource: fileName, withExtension: fileExtension) else {
print("Failed to find font URL for \(fileName).\(fileExtension)")
return
}

CTFontManagerRegisterFontsForURL(fontURL as CFURL, .process, nil)
}


@main
struct widget: Widget {
let kind: String = "widget"

init() {
registerCustomFont(fileName: "samsungsharpsans-bold", withExtension: "ttf")
registerCustomFont(fileName: "samsungsharpsans-medium", withExtension: "otf")
}

var body: some WidgetConfiguration {
IntentConfiguration(kind: kind, intent: ConfigurationIntent.self, provider: Provider()) { entry in
Expand Down

0 comments on commit 8ffed2a

Please sign in to comment.