Skip to content

Commit

Permalink
🚧
Browse files Browse the repository at this point in the history
  • Loading branch information
cruzdanilo committed Dec 5, 2024
1 parent d7b9a9e commit bb3c12b
Show file tree
Hide file tree
Showing 36 changed files with 489 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .changeset/late-forks-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
2 changes: 2 additions & 0 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default {
},
ios: {
icon: "src/assets/icon-ios.png",
appleTeamId: "665NDX7LBZ",
bundleIdentifier: "app.exactly",
associatedDomains: [`webcredentials:${process.env.EXPO_PUBLIC_DOMAIN ?? "web.exactly.app"}`],
supportsTablet: false,
Expand Down Expand Up @@ -117,6 +118,7 @@ export default {
largeIcons: ["src/assets/notifications_default_large.png"],
} satisfies OneSignalPlugin.OneSignalPluginProps,
],
"@bacons/apple-targets",
],
experiments: { typedRoutes: true },
extra: { eas: { projectId: "06bc0158-d23b-430b-a7e8-802df03c450b" } },
Expand Down
6 changes: 6 additions & 0 deletions modules/widgets/expo-module.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"platforms": ["apple"],
"apple": {
"modules": ["ExpoWidgetModule"]
}
}
18 changes: 18 additions & 0 deletions modules/widgets/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
declare global {
namespace Native {
interface ExpoWidget {
set(key: string, value: string, suite?: string): void;
}
}

interface NativeModules {
ExpoWidget?: Native.ExpoWidget;
}
}

// TODO: Can we drop this?
const m = (expo?.modules?.ExpoWidget ?? {
set() {},
}) as Native.ExpoWidget;

export default m;
23 changes: 23 additions & 0 deletions modules/widgets/ios/ExpoWidget.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Pod::Spec.new do |s|
s.name = 'ExpoWidget'
s.version = '1.0.0'
s.summary = 'A sample project summary'
s.description = 'A sample project description'
s.author = ''
s.homepage = 'https://docs.expo.dev/modules/'
s.platforms = {
:ios => '15.1',
:tvos => '15.1'
}
s.source = { git: '' }
s.static_framework = true

s.dependency 'ExpoModulesCore'

# Swift/Objective-C compatibility
s.pod_target_xcconfig = {
'DEFINES_MODULE' => 'YES',
}

s.source_files = "**/*.{h,m,mm,swift,hpp,cpp}"
end
15 changes: 15 additions & 0 deletions modules/widgets/ios/ExpoWidgetModule.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import ExpoModulesCore
import WidgetKit

public class ExpoWidgetModule: Module {
public func definition() -> ModuleDefinition {
Name("ExpoWidget")

Function("set") { (key: String, value: String, group: String?) in
let userDefaults = UserDefaults(suiteName: group)
userDefaults?.set(value, forKey: key)

WidgetCenter.shared.reloadAllTimelines()
}
}
}
20 changes: 20 additions & 0 deletions targets/widgets/Assets.xcassets/$accent.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors": [
{
"color": {
"color-space": "display-p3",
"components": {
"red": 0.27450980392156865,
"green": 0.5098039215686274,
"blue": 0.7058823529411765,
"alpha": 1
}
},
"idiom": "universal"
}
],
"info": {
"version": 1,
"author": "expo"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors": [
{
"color": {
"color-space": "display-p3",
"components": {
"red": 0.11764705882352941,
"green": 0.5647058823529412,
"blue": 1,
"alpha": 1
}
},
"idiom": "universal"
}
],
"info": {
"version": 1,
"author": "expo"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
122 changes: 122 additions & 0 deletions targets/widgets/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"images": [
{
"idiom": "iphone",
"size": "20x20",
"scale": "2x",
"filename": "[email protected]"
},
{
"idiom": "iphone",
"size": "20x20",
"scale": "3x",
"filename": "[email protected]"
},
{
"idiom": "iphone",
"size": "29x29",
"scale": "1x",
"filename": "[email protected]"
},
{
"idiom": "iphone",
"size": "29x29",
"scale": "2x",
"filename": "[email protected]"
},
{
"idiom": "iphone",
"size": "29x29",
"scale": "3x",
"filename": "[email protected]"
},
{
"idiom": "iphone",
"size": "40x40",
"scale": "2x",
"filename": "[email protected]"
},
{
"idiom": "iphone",
"size": "40x40",
"scale": "3x",
"filename": "[email protected]"
},
{
"idiom": "iphone",
"size": "60x60",
"scale": "2x",
"filename": "[email protected]"
},
{
"idiom": "iphone",
"size": "60x60",
"scale": "3x",
"filename": "[email protected]"
},
{
"idiom": "ipad",
"size": "20x20",
"scale": "1x",
"filename": "[email protected]"
},
{
"idiom": "ipad",
"size": "20x20",
"scale": "2x",
"filename": "[email protected]"
},
{
"idiom": "ipad",
"size": "29x29",
"scale": "1x",
"filename": "[email protected]"
},
{
"idiom": "ipad",
"size": "29x29",
"scale": "2x",
"filename": "[email protected]"
},
{
"idiom": "ipad",
"size": "40x40",
"scale": "1x",
"filename": "[email protected]"
},
{
"idiom": "ipad",
"size": "40x40",
"scale": "2x",
"filename": "[email protected]"
},
{
"idiom": "ipad",
"size": "76x76",
"scale": "1x",
"filename": "[email protected]"
},
{
"idiom": "ipad",
"size": "76x76",
"scale": "2x",
"filename": "[email protected]"
},
{
"idiom": "ipad",
"size": "83.5x83.5",
"scale": "2x",
"filename": "[email protected]"
},
{
"idiom": "ios-marketing",
"size": "1024x1024",
"scale": "1x",
"filename": "[email protected]"
}
],
"info": {
"version": 1,
"author": "expo"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions targets/widgets/Assets.xcassets/Color1.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x73",
"green" : "0x1D",
"red" : "0xB9"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
20 changes: 20 additions & 0 deletions targets/widgets/Assets.xcassets/Color2.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xC6",
"green" : "0x53",
"red" : "0xF9"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions targets/widgets/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
11 changes: 11 additions & 0 deletions targets/widgets/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.widgetkit-extension</string>
</dict>
</dict>
</plist>
48 changes: 48 additions & 0 deletions targets/widgets/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>0A2A.1</string>
<string>3B52.1</string>
<string>C617.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>E174.1</string>
<string>85F4.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
</array>
</dict>
</array>
<key>NSPrivacyCollectedDataTypes</key>
<array/>
<key>NSPrivacyTracking</key>
<false/>
</dict>
</plist>
12 changes: 12 additions & 0 deletions targets/widgets/expo-target.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/** @type {import('@bacons/apple-targets').Config} */
module.exports = {
type: "widget",
icon: "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e1/FullMoon2010.jpg/1200px-FullMoon2010.jpg",
colors: {
$accent: "steelblue",
$widgetBackground: "dodgerblue",
},
entitlements: {
"com.apple.security.application-groups": ["group.bacon.data"],
},
};
10 changes: 10 additions & 0 deletions targets/widgets/generated.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>group.bacon.data</string>
</array>
</dict>
</plist>
10 changes: 10 additions & 0 deletions targets/widgets/index.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import WidgetKit
import SwiftUI

@main
struct exportWidgets: WidgetBundle {
var body: some Widget {
// Export widgets here
widgets()
}
}
Loading

0 comments on commit bb3c12b

Please sign in to comment.