diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..2631b88 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Viktor Shchelochkov + +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. diff --git a/README.md b/README.md index f04e1aa..c356717 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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). \ No newline at end of file diff --git a/widget/widget.swift b/widget/widget.swift index 3081dfc..9c92128 100644 --- a/widget/widget.swift +++ b/widget/widget.swift @@ -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