react-native-ios-widget 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugin/build/index.d.ts +2 -2
- package/plugin/build/index.js +5 -5
- package/plugin/build/lib/getWidgetExtensionEntitlements.d.ts +4 -4
- package/plugin/build/lib/getWidgetExtensionEntitlements.js +5 -5
- package/plugin/build/lib/getWidgetFiles.d.ts +1 -2
- package/plugin/build/lib/getWidgetFiles.js +9 -10
- package/plugin/build/types.d.ts +1 -1
- package/plugin/build/withConfig.d.ts +2 -2
- package/plugin/build/withPodfile.d.ts +2 -2
- package/plugin/build/withPodfile.js +14 -14
- package/plugin/build/withWidgetExtensionEntitlements.d.ts +2 -2
- package/plugin/build/withXcode.d.ts +2 -2
- package/plugin/src/index.ts +7 -7
- package/plugin/src/lib/getWidgetExtensionEntitlements.ts +6 -6
- package/plugin/src/lib/getWidgetFiles.ts +8 -8
- package/plugin/src/types.ts +1 -1
- package/plugin/src/withConfig.ts +2 -2
- package/plugin/src/withPodfile.ts +16 -16
- package/plugin/src/withWidgetExtensionEntitlements.ts +2 -2
- package/plugin/src/withXcode.ts +2 -2
- package/_widgets/EmojiRanger/AdventureActivityConfiguration.swift +0 -71
- package/_widgets/EmojiRanger/AllCharactersView.swift +0 -43
- package/_widgets/EmojiRanger/Assets.xcassets/AccentColor.colorset/Contents.json +0 -11
- package/_widgets/EmojiRanger/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -13
- package/_widgets/EmojiRanger/Assets.xcassets/Contents.json +0 -6
- package/_widgets/EmojiRanger/Assets.xcassets/WidgetBackground.colorset/Contents.json +0 -11
- package/_widgets/EmojiRanger/Attributes.swift +0 -21
- package/_widgets/EmojiRanger/EmojiRanger.swift +0 -248
- package/_widgets/EmojiRanger/EmojiRangersWidget.intentdefinition +0 -118
- package/_widgets/EmojiRanger/EmojiRangersWidget.swift +0 -189
- package/_widgets/EmojiRanger/EmojiRangersWidgetBundle.swift +0 -21
- package/_widgets/EmojiRanger/ImageURLProtocol.swift +0 -66
- package/_widgets/EmojiRanger/Info.plist +0 -11
- package/_widgets/EmojiRanger/LeaderboardWidget.swift +0 -93
- package/_widgets/EmojiRanger/Module.swift +0 -94
- package/_widgets/PizzaDelivery/Assets.xcassets/AccentColor.colorset/Contents.json +0 -11
- package/_widgets/PizzaDelivery/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -13
- package/_widgets/PizzaDelivery/Assets.xcassets/Contents.json +0 -6
- package/_widgets/PizzaDelivery/Assets.xcassets/WidgetBackground.colorset/Contents.json +0 -11
- package/_widgets/PizzaDelivery/Attributes.swift +0 -15
- package/_widgets/PizzaDelivery/Info.plist +0 -11
- package/_widgets/PizzaDelivery/LiveActivity.swift +0 -108
- package/_widgets/PizzaDelivery/Module.swift +0 -94
- package/_widgets/PizzaDelivery/WidgetBundle.swift +0 -13
- package/_widgets/PizzaDelivery/Widgets.swift +0 -59
package/package.json
CHANGED
package/plugin/build/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ConfigPlugin } from "expo/config-plugins";
|
|
2
|
-
import {
|
|
3
|
-
declare const withWidget: ConfigPlugin<
|
|
2
|
+
import { WidgetConfig } from "./types";
|
|
3
|
+
declare const withWidget: ConfigPlugin<WidgetConfig>;
|
|
4
4
|
export default withWidget;
|
package/plugin/build/index.js
CHANGED
|
@@ -6,7 +6,7 @@ const withWidgetExtensionEntitlements_1 = require("./withWidgetExtensionEntitlem
|
|
|
6
6
|
const withPodfile_1 = require("./withPodfile");
|
|
7
7
|
const withConfig_1 = require("./withConfig");
|
|
8
8
|
const withWidget = (config, { enabled = true, deploymentTarget = "14.0", widgetsFolder = "widgets", groupIdentifier, pods = [], targetName = "WidgetsExtension", bundleIdentifier = `${config.ios?.bundleIdentifier}.Widgets`, }) => {
|
|
9
|
-
const
|
|
9
|
+
const widget = {
|
|
10
10
|
enabled,
|
|
11
11
|
deploymentTarget,
|
|
12
12
|
widgetsFolder,
|
|
@@ -16,10 +16,10 @@ const withWidget = (config, { enabled = true, deploymentTarget = "14.0", widgets
|
|
|
16
16
|
bundleIdentifier,
|
|
17
17
|
};
|
|
18
18
|
return (0, config_plugins_1.withPlugins)(config, [
|
|
19
|
-
[withXcode_1.withXcode,
|
|
20
|
-
[withWidgetExtensionEntitlements_1.withWidgetExtensionEntitlements,
|
|
21
|
-
[withPodfile_1.withPodfile,
|
|
22
|
-
[withConfig_1.withConfig,
|
|
19
|
+
[withXcode_1.withXcode, widget],
|
|
20
|
+
[withWidgetExtensionEntitlements_1.withWidgetExtensionEntitlements, widget],
|
|
21
|
+
[withPodfile_1.withPodfile, widget],
|
|
22
|
+
[withConfig_1.withConfig, widget],
|
|
23
23
|
]);
|
|
24
24
|
};
|
|
25
25
|
exports.default = withWidget;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExportedConfig, InfoPlist } from "expo/config-plugins";
|
|
2
|
-
export declare
|
|
3
|
-
groupIdentifier?: string;
|
|
4
|
-
})
|
|
5
|
-
export declare
|
|
2
|
+
export declare const getWidgetExtensionEntitlements: (iosConfig: ExportedConfig["ios"], { groupIdentifier, }: {
|
|
3
|
+
groupIdentifier?: string | undefined;
|
|
4
|
+
}) => InfoPlist;
|
|
5
|
+
export declare const addApplicationGroupsEntitlement: (entitlements: InfoPlist, groupIdentifier?: string) => InfoPlist;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addApplicationGroupsEntitlement = exports.getWidgetExtensionEntitlements = void 0;
|
|
4
|
-
|
|
4
|
+
const getWidgetExtensionEntitlements = (iosConfig, { groupIdentifier, }) => {
|
|
5
5
|
const entitlements = {};
|
|
6
|
-
addApplicationGroupsEntitlement(entitlements, groupIdentifier);
|
|
6
|
+
(0, exports.addApplicationGroupsEntitlement)(entitlements, groupIdentifier);
|
|
7
7
|
return entitlements;
|
|
8
|
-
}
|
|
8
|
+
};
|
|
9
9
|
exports.getWidgetExtensionEntitlements = getWidgetExtensionEntitlements;
|
|
10
|
-
|
|
10
|
+
const addApplicationGroupsEntitlement = (entitlements, groupIdentifier) => {
|
|
11
11
|
if (groupIdentifier) {
|
|
12
12
|
const existingApplicationGroups = entitlements["com.apple.security.application-groups"] ?? [];
|
|
13
13
|
entitlements["com.apple.security.application-groups"] = [
|
|
@@ -16,5 +16,5 @@ function addApplicationGroupsEntitlement(entitlements, groupIdentifier) {
|
|
|
16
16
|
];
|
|
17
17
|
}
|
|
18
18
|
return entitlements;
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
20
|
exports.addApplicationGroupsEntitlement = addApplicationGroupsEntitlement;
|
|
@@ -5,5 +5,4 @@ export type WidgetFiles = {
|
|
|
5
5
|
fontFiles: string[];
|
|
6
6
|
assetDirectories: string[];
|
|
7
7
|
};
|
|
8
|
-
export declare
|
|
9
|
-
export declare function copyFileSync(source: string, target: string): void;
|
|
8
|
+
export declare const getWidgetFiles: (widgetsPath: string, targetPath: string) => WidgetFiles;
|
|
@@ -23,10 +23,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.getWidgetFiles = void 0;
|
|
27
27
|
const fs = __importStar(require("fs"));
|
|
28
28
|
const path = __importStar(require("path"));
|
|
29
|
-
|
|
29
|
+
const getWidgetFiles = (widgetsPath, targetPath) => {
|
|
30
30
|
const widgetFiles = {
|
|
31
31
|
swiftFiles: [],
|
|
32
32
|
entitlementFiles: [],
|
|
@@ -76,20 +76,19 @@ function getWidgetFiles(widgetsPath, targetPath) {
|
|
|
76
76
|
// Copy directories
|
|
77
77
|
widgetFiles.assetDirectories.forEach((directory) => {
|
|
78
78
|
const imagesXcassetsSource = path.join(widgetsPath, directory);
|
|
79
|
-
|
|
79
|
+
copyDirectorySync(imagesXcassetsSource, targetPath);
|
|
80
80
|
});
|
|
81
81
|
return widgetFiles;
|
|
82
|
-
}
|
|
82
|
+
};
|
|
83
83
|
exports.getWidgetFiles = getWidgetFiles;
|
|
84
|
-
|
|
84
|
+
const copyFileSync = (source, target) => {
|
|
85
85
|
let targetFile = target;
|
|
86
86
|
if (fs.existsSync(target) && fs.lstatSync(target).isDirectory()) {
|
|
87
87
|
targetFile = path.join(target, path.basename(source));
|
|
88
88
|
}
|
|
89
89
|
fs.writeFileSync(targetFile, fs.readFileSync(source));
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function copyFolderRecursiveSync(source, target) {
|
|
90
|
+
};
|
|
91
|
+
const copyDirectorySync = (source, target) => {
|
|
93
92
|
const targetPath = path.join(target, path.basename(source));
|
|
94
93
|
if (!fs.existsSync(targetPath)) {
|
|
95
94
|
fs.mkdirSync(targetPath, { recursive: true });
|
|
@@ -99,11 +98,11 @@ function copyFolderRecursiveSync(source, target) {
|
|
|
99
98
|
files.forEach((file) => {
|
|
100
99
|
const currentPath = path.join(source, file);
|
|
101
100
|
if (fs.lstatSync(currentPath).isDirectory()) {
|
|
102
|
-
|
|
101
|
+
copyDirectorySync(currentPath, targetPath);
|
|
103
102
|
}
|
|
104
103
|
else {
|
|
105
104
|
copyFileSync(currentPath, targetPath);
|
|
106
105
|
}
|
|
107
106
|
});
|
|
108
107
|
}
|
|
109
|
-
}
|
|
108
|
+
};
|
package/plugin/build/types.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ConfigPlugin } from "expo/config-plugins";
|
|
2
|
-
import {
|
|
3
|
-
export declare const withConfig: ConfigPlugin<Required<
|
|
2
|
+
import { WidgetConfig } from "./types";
|
|
3
|
+
export declare const withConfig: ConfigPlugin<Required<WidgetConfig>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ConfigPlugin } from "expo/config-plugins";
|
|
2
|
-
import {
|
|
3
|
-
export declare const withPodfile: ConfigPlugin<Required<
|
|
2
|
+
import { WidgetConfig } from "./types";
|
|
3
|
+
export declare const withPodfile: ConfigPlugin<Required<WidgetConfig>>;
|
|
@@ -38,26 +38,26 @@ const withPodfile = (config, { enabled, targetName, pods }) => {
|
|
|
38
38
|
const podFilePath = path.join(config.modRequest.platformProjectRoot, "Podfile");
|
|
39
39
|
let podFileContent = fs.readFileSync(podFilePath).toString();
|
|
40
40
|
podFileContent = (0, generateCode_1.mergeContents)({
|
|
41
|
-
tag: "react-native-widget
|
|
41
|
+
tag: "react-native-ios-widget",
|
|
42
42
|
src: podFileContent,
|
|
43
|
-
newSrc:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
newSrc: `\t\tinstaller.pods_project.targets.each do |target|
|
|
44
|
+
\t\t\ttarget.build_configurations.each do |config|
|
|
45
|
+
\t\t\t\tconfig.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
|
|
46
|
+
\t\t\tend
|
|
47
|
+
\t\tend`,
|
|
48
48
|
anchor: /installer.target_installation_results.pod_target_installation_results/,
|
|
49
|
-
offset:
|
|
50
|
-
comment: "#",
|
|
49
|
+
offset: 8,
|
|
50
|
+
comment: "\t\t#",
|
|
51
51
|
}).contents;
|
|
52
52
|
podFileContent = podFileContent
|
|
53
|
-
.concat(`\n\n# >>> Inserted by react-native-widget
|
|
53
|
+
.concat(`\n\n# >>> Inserted by react-native-ios-widget\n`)
|
|
54
54
|
.concat(`target '${targetName}' do
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
\tuse_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
|
|
56
|
+
\tuse_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
.concat(`\n# >>> Inserted by react-native-widget
|
|
58
|
+
${pods.map((pod) => `\tpod '${pod}'`).join("\n")}
|
|
59
|
+
end`)
|
|
60
|
+
.concat(`\n# >>> Inserted by react-native-ios-widget`);
|
|
61
61
|
fs.writeFileSync(podFilePath, podFileContent);
|
|
62
62
|
return config;
|
|
63
63
|
},
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ConfigPlugin } from "expo/config-plugins";
|
|
2
|
-
import {
|
|
3
|
-
export declare const withWidgetExtensionEntitlements: ConfigPlugin<Required<
|
|
2
|
+
import { WidgetConfig } from "./types";
|
|
3
|
+
export declare const withWidgetExtensionEntitlements: ConfigPlugin<Required<WidgetConfig>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ConfigPlugin } from "expo/config-plugins";
|
|
2
|
-
import {
|
|
3
|
-
export declare const withXcode: ConfigPlugin<Required<
|
|
2
|
+
import { WidgetConfig } from "./types";
|
|
3
|
+
export declare const withXcode: ConfigPlugin<Required<WidgetConfig>>;
|
package/plugin/src/index.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { withXcode } from "./withXcode";
|
|
|
3
3
|
import { withWidgetExtensionEntitlements } from "./withWidgetExtensionEntitlements";
|
|
4
4
|
import { withPodfile } from "./withPodfile";
|
|
5
5
|
import { withConfig } from "./withConfig";
|
|
6
|
-
import {
|
|
6
|
+
import { WidgetConfig } from "./types";
|
|
7
7
|
|
|
8
|
-
const withWidget: ConfigPlugin<
|
|
8
|
+
const withWidget: ConfigPlugin<WidgetConfig> = (
|
|
9
9
|
config,
|
|
10
10
|
{
|
|
11
11
|
enabled = true,
|
|
@@ -17,7 +17,7 @@ const withWidget: ConfigPlugin<WidgetPluginProps> = (
|
|
|
17
17
|
bundleIdentifier = `${config.ios?.bundleIdentifier}.Widgets`,
|
|
18
18
|
}
|
|
19
19
|
) => {
|
|
20
|
-
const
|
|
20
|
+
const widget: WidgetConfig = {
|
|
21
21
|
enabled,
|
|
22
22
|
deploymentTarget,
|
|
23
23
|
widgetsFolder,
|
|
@@ -28,10 +28,10 @@ const withWidget: ConfigPlugin<WidgetPluginProps> = (
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
return withPlugins(config, [
|
|
31
|
-
[withXcode,
|
|
32
|
-
[withWidgetExtensionEntitlements,
|
|
33
|
-
[withPodfile,
|
|
34
|
-
[withConfig,
|
|
31
|
+
[withXcode, widget],
|
|
32
|
+
[withWidgetExtensionEntitlements, widget],
|
|
33
|
+
[withPodfile, widget],
|
|
34
|
+
[withConfig, widget],
|
|
35
35
|
]);
|
|
36
36
|
};
|
|
37
37
|
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { ExportedConfig, InfoPlist } from "expo/config-plugins";
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export const getWidgetExtensionEntitlements = (
|
|
4
4
|
iosConfig: ExportedConfig["ios"],
|
|
5
5
|
{
|
|
6
6
|
groupIdentifier,
|
|
7
7
|
}: {
|
|
8
8
|
groupIdentifier?: string;
|
|
9
9
|
}
|
|
10
|
-
) {
|
|
10
|
+
) => {
|
|
11
11
|
const entitlements: InfoPlist = {};
|
|
12
12
|
|
|
13
13
|
addApplicationGroupsEntitlement(entitlements, groupIdentifier);
|
|
14
14
|
|
|
15
15
|
return entitlements;
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
17
|
|
|
18
|
-
export
|
|
18
|
+
export const addApplicationGroupsEntitlement = (
|
|
19
19
|
entitlements: InfoPlist,
|
|
20
20
|
groupIdentifier?: string
|
|
21
|
-
) {
|
|
21
|
+
) => {
|
|
22
22
|
if (groupIdentifier) {
|
|
23
23
|
const existingApplicationGroups =
|
|
24
24
|
(entitlements["com.apple.security.application-groups"] as string[]) ?? [];
|
|
@@ -30,4 +30,4 @@ export function addApplicationGroupsEntitlement(
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
return entitlements;
|
|
33
|
-
}
|
|
33
|
+
};
|
|
@@ -9,7 +9,7 @@ export type WidgetFiles = {
|
|
|
9
9
|
assetDirectories: string[];
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
export
|
|
12
|
+
export const getWidgetFiles = (widgetsPath: string, targetPath: string) => {
|
|
13
13
|
const widgetFiles: WidgetFiles = {
|
|
14
14
|
swiftFiles: [],
|
|
15
15
|
entitlementFiles: [],
|
|
@@ -65,13 +65,13 @@ export function getWidgetFiles(widgetsPath: string, targetPath: string) {
|
|
|
65
65
|
// Copy directories
|
|
66
66
|
widgetFiles.assetDirectories.forEach((directory) => {
|
|
67
67
|
const imagesXcassetsSource = path.join(widgetsPath, directory);
|
|
68
|
-
|
|
68
|
+
copyDirectorySync(imagesXcassetsSource, targetPath);
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
return widgetFiles;
|
|
72
|
-
}
|
|
72
|
+
};
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
const copyFileSync = (source: string, target: string) => {
|
|
75
75
|
let targetFile = target;
|
|
76
76
|
|
|
77
77
|
if (fs.existsSync(target) && fs.lstatSync(target).isDirectory()) {
|
|
@@ -79,9 +79,9 @@ export function copyFileSync(source: string, target: string) {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
fs.writeFileSync(targetFile, fs.readFileSync(source));
|
|
82
|
-
}
|
|
82
|
+
};
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
const copyDirectorySync = (source: string, target: string) => {
|
|
85
85
|
const targetPath = path.join(target, path.basename(source));
|
|
86
86
|
if (!fs.existsSync(targetPath)) {
|
|
87
87
|
fs.mkdirSync(targetPath, { recursive: true });
|
|
@@ -92,10 +92,10 @@ function copyFolderRecursiveSync(source: string, target: string) {
|
|
|
92
92
|
files.forEach((file) => {
|
|
93
93
|
const currentPath = path.join(source, file);
|
|
94
94
|
if (fs.lstatSync(currentPath).isDirectory()) {
|
|
95
|
-
|
|
95
|
+
copyDirectorySync(currentPath, targetPath);
|
|
96
96
|
} else {
|
|
97
97
|
copyFileSync(currentPath, targetPath);
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
-
}
|
|
101
|
+
};
|
package/plugin/src/types.ts
CHANGED
package/plugin/src/withConfig.ts
CHANGED
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
addApplicationGroupsEntitlement,
|
|
4
4
|
getWidgetExtensionEntitlements,
|
|
5
5
|
} from "./lib/getWidgetExtensionEntitlements";
|
|
6
|
-
import {
|
|
6
|
+
import { WidgetConfig } from "./types";
|
|
7
7
|
|
|
8
|
-
export const withConfig: ConfigPlugin<Required<
|
|
8
|
+
export const withConfig: ConfigPlugin<Required<WidgetConfig>> = (
|
|
9
9
|
config,
|
|
10
10
|
{ enabled, groupIdentifier, targetName, bundleIdentifier }
|
|
11
11
|
) => {
|
|
@@ -2,9 +2,9 @@ import { mergeContents } from "@expo/config-plugins/build/utils/generateCode";
|
|
|
2
2
|
import { ConfigPlugin, withDangerousMod } from "expo/config-plugins";
|
|
3
3
|
import * as fs from "fs";
|
|
4
4
|
import * as path from "path";
|
|
5
|
-
import {
|
|
5
|
+
import { WidgetConfig } from "./types";
|
|
6
6
|
|
|
7
|
-
export const withPodfile: ConfigPlugin<Required<
|
|
7
|
+
export const withPodfile: ConfigPlugin<Required<WidgetConfig>> = (
|
|
8
8
|
config,
|
|
9
9
|
{ enabled, targetName, pods }
|
|
10
10
|
) => {
|
|
@@ -22,30 +22,30 @@ export const withPodfile: ConfigPlugin<Required<WidgetPluginProps>> = (
|
|
|
22
22
|
let podFileContent = fs.readFileSync(podFilePath).toString();
|
|
23
23
|
|
|
24
24
|
podFileContent = mergeContents({
|
|
25
|
-
tag: "react-native-widget
|
|
25
|
+
tag: "react-native-ios-widget",
|
|
26
26
|
src: podFileContent,
|
|
27
|
-
newSrc:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
newSrc: `\t\tinstaller.pods_project.targets.each do |target|
|
|
28
|
+
\t\t\ttarget.build_configurations.each do |config|
|
|
29
|
+
\t\t\t\tconfig.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
|
|
30
|
+
\t\t\tend
|
|
31
|
+
\t\tend`,
|
|
32
32
|
anchor:
|
|
33
33
|
/installer.target_installation_results.pod_target_installation_results/,
|
|
34
|
-
offset:
|
|
35
|
-
comment: "#",
|
|
34
|
+
offset: 8,
|
|
35
|
+
comment: "\t\t#",
|
|
36
36
|
}).contents;
|
|
37
37
|
|
|
38
38
|
podFileContent = podFileContent
|
|
39
|
-
.concat(`\n\n# >>> Inserted by react-native-widget
|
|
39
|
+
.concat(`\n\n# >>> Inserted by react-native-ios-widget\n`)
|
|
40
40
|
.concat(
|
|
41
41
|
`target '${targetName}' do
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
\tuse_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks']
|
|
43
|
+
\tuse_frameworks! :linkage => ENV['USE_FRAMEWORKS'].to_sym if ENV['USE_FRAMEWORKS']
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
${pods.map((pod) => `\tpod '${pod}'`).join("\n")}
|
|
46
|
+
end`
|
|
47
47
|
)
|
|
48
|
-
.concat(`\n# >>> Inserted by react-native-widget
|
|
48
|
+
.concat(`\n# >>> Inserted by react-native-ios-widget`);
|
|
49
49
|
|
|
50
50
|
fs.writeFileSync(podFilePath, podFileContent);
|
|
51
51
|
|
|
@@ -4,10 +4,10 @@ import * as fs from "fs";
|
|
|
4
4
|
import * as path from "path";
|
|
5
5
|
|
|
6
6
|
import { getWidgetExtensionEntitlements } from "./lib/getWidgetExtensionEntitlements";
|
|
7
|
-
import {
|
|
7
|
+
import { WidgetConfig } from "./types";
|
|
8
8
|
|
|
9
9
|
export const withWidgetExtensionEntitlements: ConfigPlugin<
|
|
10
|
-
Required<
|
|
10
|
+
Required<WidgetConfig>
|
|
11
11
|
> = (config, { enabled, targetName, groupIdentifier }) => {
|
|
12
12
|
if (!enabled) {
|
|
13
13
|
return config;
|
package/plugin/src/withXcode.ts
CHANGED
|
@@ -9,9 +9,9 @@ import { addTargetDependency } from "./xcode/addTargetDependency";
|
|
|
9
9
|
import { addPbxGroup } from "./xcode/addPbxGroup";
|
|
10
10
|
import { addBuildPhases } from "./xcode/addBuildPhases";
|
|
11
11
|
import { getWidgetFiles } from "./lib/getWidgetFiles";
|
|
12
|
-
import {
|
|
12
|
+
import { WidgetConfig } from "./types";
|
|
13
13
|
|
|
14
|
-
export const withXcode: ConfigPlugin<Required<
|
|
14
|
+
export const withXcode: ConfigPlugin<Required<WidgetConfig>> = (
|
|
15
15
|
config,
|
|
16
16
|
{ enabled, targetName, bundleIdentifier, deploymentTarget, widgetsFolder }
|
|
17
17
|
) => {
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
See the LICENSE.txt file for this sample’s licensing information.
|
|
3
|
-
|
|
4
|
-
Abstract:
|
|
5
|
-
The adventure activity configuration.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import WidgetKit
|
|
9
|
-
import SwiftUI
|
|
10
|
-
|
|
11
|
-
struct AdventureActivityConfiguration: Widget {
|
|
12
|
-
var body: some WidgetConfiguration {
|
|
13
|
-
ActivityConfiguration(for: AdventureAttributes.self) { context in
|
|
14
|
-
AdventureLiveActivityView(
|
|
15
|
-
hero: context.attributes.hero,
|
|
16
|
-
isStale: context.isStale,
|
|
17
|
-
contentState: context.state
|
|
18
|
-
)
|
|
19
|
-
.activityBackgroundTint(Color.liveActivityBackground.opacity(0.25))
|
|
20
|
-
} dynamicIsland: { context in
|
|
21
|
-
DynamicIsland {
|
|
22
|
-
expandedContent(
|
|
23
|
-
hero: context.attributes.hero,
|
|
24
|
-
contentState: context.state,
|
|
25
|
-
isStale: context.isStale
|
|
26
|
-
)
|
|
27
|
-
} compactLeading: {
|
|
28
|
-
Avatar(hero: context.attributes.hero, includeBackground: true)
|
|
29
|
-
} compactTrailing: {
|
|
30
|
-
ProgressView(value: context.state.currentHealthLevel, total: 1) {
|
|
31
|
-
Text("\(Int(context.state.currentHealthLevel * 100))")
|
|
32
|
-
}
|
|
33
|
-
.progressViewStyle(.circular)
|
|
34
|
-
.tint(context.state.currentHealthLevel <= 0.2 ? Color.red : Color.green)
|
|
35
|
-
} minimal: {
|
|
36
|
-
ProgressView(value: context.state.currentHealthLevel, total: 1) {
|
|
37
|
-
Avatar(hero: context.attributes.hero, includeBackground: false)
|
|
38
|
-
}
|
|
39
|
-
.progressViewStyle(.circular)
|
|
40
|
-
.tint(context.state.currentHealthLevel <= 0.2 ? Color.red : Color.green)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
@DynamicIslandExpandedContentBuilder
|
|
47
|
-
private func expandedContent(hero: EmojiRanger,
|
|
48
|
-
contentState: AdventureAttributes.ContentState,
|
|
49
|
-
isStale: Bool) -> DynamicIslandExpandedContent<some View> {
|
|
50
|
-
DynamicIslandExpandedRegion(.leading) {
|
|
51
|
-
LiveActivityAvatarView(hero: hero)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
DynamicIslandExpandedRegion(.trailing) {
|
|
55
|
-
StatsView(
|
|
56
|
-
hero: hero,
|
|
57
|
-
isStale: isStale
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
DynamicIslandExpandedRegion(.bottom) {
|
|
62
|
-
|
|
63
|
-
HealthBar(currentHealthLevel: contentState.currentHealthLevel)
|
|
64
|
-
|
|
65
|
-
EventDescriptionView(
|
|
66
|
-
hero: hero,
|
|
67
|
-
contentState: contentState
|
|
68
|
-
)
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
See the LICENSE.txt file for this sample’s licensing information.
|
|
3
|
-
|
|
4
|
-
Abstract:
|
|
5
|
-
A view that shows a list of heroes sorted by their health level.
|
|
6
|
-
*/
|
|
7
|
-
import SwiftUI
|
|
8
|
-
|
|
9
|
-
struct AllCharactersView: View {
|
|
10
|
-
|
|
11
|
-
let heros: [EmojiRanger]
|
|
12
|
-
|
|
13
|
-
init(heros: [EmojiRanger]? = EmojiRanger.availableHeros) {
|
|
14
|
-
self.heros = heros ?? EmojiRanger.availableHeros
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
var body: some View {
|
|
18
|
-
VStack(spacing: 48) {
|
|
19
|
-
ForEach(heros.sorted { $0.healthLevel > $1.healthLevel }, id: \.self) { hero in
|
|
20
|
-
Link(destination: hero.url) {
|
|
21
|
-
HStack {
|
|
22
|
-
Avatar(hero: hero)
|
|
23
|
-
VStack(alignment: .leading) {
|
|
24
|
-
Text(hero.name)
|
|
25
|
-
.font(.headline)
|
|
26
|
-
.foregroundColor(.white)
|
|
27
|
-
Text("Level \(hero.level)")
|
|
28
|
-
.foregroundColor(.white)
|
|
29
|
-
HealthLevelShape(level: hero.healthLevel)
|
|
30
|
-
.frame(height: 10)
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
struct AllCharactersView_Previews: PreviewProvider {
|
|
40
|
-
static var previews: some View {
|
|
41
|
-
AllCharactersView()
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
See the LICENSE.txt file for this sample’s licensing information.
|
|
3
|
-
|
|
4
|
-
Abstract:
|
|
5
|
-
The adventure attributes.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
#if canImport(ActivityKit)
|
|
9
|
-
|
|
10
|
-
import ActivityKit
|
|
11
|
-
|
|
12
|
-
struct AdventureAttributes: ActivityAttributes {
|
|
13
|
-
struct ContentState: Codable & Hashable {
|
|
14
|
-
let currentHealthLevel: Double
|
|
15
|
-
let eventDescription: String
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
let hero: EmojiRanger
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
#endif
|