expo-live-activity 0.2.0-alpha → 0.2.0-alpha1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-live-activity",
3
- "version": "0.2.0-alpha",
3
+ "version": "0.2.0-alpha1",
4
4
  "description": "A module for adding Live Activity to a React Native app for iOS.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -21,7 +21,9 @@
21
21
  "ios",
22
22
  "apple"
23
23
  ],
24
- "repository": "https://github.com/software-mansion-labs/expo-live-activity",
24
+ "author": "Kamil Owczarz <kamil.owczarz@swmansion.com> (https://github.com/kowczarz)",
25
+ "contributors": ["Anna Olak <anna.olak@swmansion.com> (https://github.com/anna1901)"],
26
+ "repository": "https://github.com/software-mansion-labs/expo-live-activity.git",
25
27
  "bugs": {
26
28
  "url": "https://github.com/software-mansion-labs/expo-live-activity/issues"
27
29
  },
@@ -7,9 +7,7 @@ const withXcode_1 = require("./withXcode");
7
7
  const withWidgetExtensionEntitlements_1 = require("./withWidgetExtensionEntitlements");
8
8
  const withWidgetsAndLiveActivities = (config) => {
9
9
  const deploymentTarget = "16.2";
10
- const moduleFileName = "ExpoNativeConfigurationModule.swift";
11
- const attributesFileName = "LiveActivityAttributes.swift";
12
- const targetName = `${config_plugins_1.IOSConfig.XcodeUtils.sanitizedName(config.name)}LiveActivity`; // Widgets => LiveActivity
10
+ const targetName = `${config_plugins_1.IOSConfig.XcodeUtils.sanitizedName(config.name)}LiveActivity`;
13
11
  const bundleIdentifier = `${config.ios?.bundleIdentifier}.${targetName}`;
14
12
  config.ios = {
15
13
  ...config.ios,
@@ -26,9 +24,6 @@ const withWidgetsAndLiveActivities = (config) => {
26
24
  targetName,
27
25
  bundleIdentifier,
28
26
  deploymentTarget,
29
- // widgetsFolder,
30
- moduleFileName,
31
- attributesFileName,
32
27
  },
33
28
  ],
34
29
  [withWidgetExtensionEntitlements_1.withWidgetExtensionEntitlements, { targetName }],
@@ -6,5 +6,5 @@ export type WidgetFiles = {
6
6
  intentFiles: string[];
7
7
  otherFiles: string[];
8
8
  };
9
- export declare function getWidgetFiles(targetPath: string, moduleFileName: string, attributesFileName: string): WidgetFiles;
9
+ export declare function getWidgetFiles(targetPath: string): WidgetFiles;
10
10
  export declare function copyFileSync(source: string, target: string): void;
@@ -37,9 +37,7 @@ exports.getWidgetFiles = getWidgetFiles;
37
37
  exports.copyFileSync = copyFileSync;
38
38
  const fs = __importStar(require("fs"));
39
39
  const path = __importStar(require("path"));
40
- function getWidgetFiles(
41
- // widgetsPath: string, // to zmieniamy, bo u nas to będzie "config.modRequest.projectRoot/[tu może coś jeszcze być]/node_modules/nasz-moduł/iosViews"
42
- targetPath, moduleFileName, attributesFileName) {
40
+ function getWidgetFiles(targetPath) {
43
41
  let packagePath;
44
42
  try {
45
43
  packagePath = path.dirname(require.resolve("expo-live-activity/package.json"));
@@ -47,8 +45,7 @@ targetPath, moduleFileName, attributesFileName) {
47
45
  catch {
48
46
  console.log("Building for example app");
49
47
  }
50
- const widgetsPath = path.join(packagePath ? packagePath : "..", "/ios-files");
51
- console.log(`Widgets path: ${widgetsPath}`);
48
+ const liveActivityFilesPath = path.join(packagePath ? packagePath : "..", "/ios-files");
52
49
  const imageAssetsPath = "./assets/live_activity";
53
50
  const widgetFiles = {
54
51
  swiftFiles: [],
@@ -58,20 +55,15 @@ targetPath, moduleFileName, attributesFileName) {
58
55
  intentFiles: [],
59
56
  otherFiles: [],
60
57
  };
61
- console.log(`Getting widget files`);
62
58
  if (!fs.existsSync(targetPath)) {
63
- console.log(`Making directory at: ${targetPath}`);
64
59
  fs.mkdirSync(targetPath, { recursive: true });
65
60
  }
66
- if (fs.lstatSync(widgetsPath).isDirectory()) {
67
- const files = fs.readdirSync(widgetsPath);
68
- console.log(`Files: ${files}`);
61
+ if (fs.lstatSync(liveActivityFilesPath).isDirectory()) {
62
+ const files = fs.readdirSync(liveActivityFilesPath);
69
63
  files.forEach((file) => {
70
64
  const fileExtension = file.split(".").pop();
71
65
  if (fileExtension === "swift") {
72
- if (file !== moduleFileName) {
73
- widgetFiles.swiftFiles.push(file);
74
- }
66
+ widgetFiles.swiftFiles.push(file);
75
67
  }
76
68
  else if (fileExtension === "entitlements") {
77
69
  widgetFiles.entitlementFiles.push(file);
@@ -98,25 +90,20 @@ targetPath, moduleFileName, attributesFileName) {
98
90
  ...widgetFiles.intentFiles,
99
91
  ...widgetFiles.otherFiles,
100
92
  ].forEach((file) => {
101
- const source = path.join(widgetsPath, file);
93
+ const source = path.join(liveActivityFilesPath, file);
102
94
  copyFileSync(source, targetPath);
103
95
  });
104
96
  // Copy assets directory
105
- const imagesXcassetsSource = path.join(widgetsPath, "Assets.xcassets");
97
+ const imagesXcassetsSource = path.join(liveActivityFilesPath, "Assets.xcassets");
106
98
  copyFolderRecursiveSync(imagesXcassetsSource, targetPath);
107
99
  // Move images to assets directory
108
- console.log(`Images Path: ${imageAssetsPath}`);
109
100
  if (fs.lstatSync(imageAssetsPath).isDirectory()) {
110
101
  const imagesXcassetsTarget = path.join(targetPath, "Assets.xcassets");
111
- console.log(`Assets Target: ${imagesXcassetsTarget}`);
112
102
  const files = fs.readdirSync(imageAssetsPath);
113
- console.log(`Images: ${files}`);
114
103
  files.forEach((file) => {
115
104
  if (path.extname(file).match(/\.(png|jpg|jpeg)$/)) {
116
105
  const source = path.join(imageAssetsPath, file);
117
- console.log(`Source: ${source}`);
118
106
  const imageSetDir = path.join(imagesXcassetsTarget, `${path.basename(file, path.extname(file))}.imageset`);
119
- console.log(`imageSetDir: ${source}`);
120
107
  // Create the .imageset directory if it doesn't exist
121
108
  if (!fs.existsSync(imageSetDir)) {
122
109
  fs.mkdirSync(imageSetDir, { recursive: true });
@@ -137,9 +124,7 @@ targetPath, moduleFileName, attributesFileName) {
137
124
  version: 1
138
125
  }
139
126
  };
140
- fs.writeFileSync(path.join(imageSetDir, 'Contents.json'), JSON.stringify(contentsJson, null, 2) // beautify the JSON output
141
- );
142
- console.log(`Processed ${file} into ${imageSetDir}`);
127
+ fs.writeFileSync(path.join(imageSetDir, 'Contents.json'), JSON.stringify(contentsJson, null, 2));
143
128
  }
144
129
  });
145
130
  }
@@ -50,7 +50,6 @@ const withWidgetExtensionEntitlements = (config, { targetName }) => {
50
50
  // });
51
51
  fs.mkdirSync(path.dirname(filePath), { recursive: true });
52
52
  fs.writeFileSync(filePath, plist_1.default.build({}));
53
- console.log("Finishing running withWidgetExtensionEntitlements");
54
53
  return config;
55
54
  });
56
55
  };
@@ -3,6 +3,4 @@ export declare const withXcode: ConfigPlugin<{
3
3
  targetName: string;
4
4
  bundleIdentifier: string;
5
5
  deploymentTarget: string;
6
- moduleFileName: string;
7
- attributesFileName: string;
8
6
  }>;
@@ -44,22 +44,15 @@ const addTargetDependency_1 = require("./xcode/addTargetDependency");
44
44
  const addPbxGroup_1 = require("./xcode/addPbxGroup");
45
45
  const addBuildPhases_1 = require("./xcode/addBuildPhases");
46
46
  const getWidgetFiles_1 = require("./lib/getWidgetFiles");
47
- const withXcode = (config, { targetName, bundleIdentifier, deploymentTarget,
48
- // widgetsFolder,
49
- moduleFileName, attributesFileName, }) => {
47
+ const withXcode = (config, { targetName, bundleIdentifier, deploymentTarget, }) => {
50
48
  return (0, config_plugins_1.withXcodeProject)(config, (config) => {
51
- console.log("Running withXcode");
52
49
  const xcodeProject = config.modResults;
53
- // const widgetsPath = path.join(config.modRequest.projectRoot, widgetsFolder);
54
50
  const targetUuid = xcodeProject.generateUuid();
55
51
  const groupName = "Embed Foundation Extensions";
56
52
  const { platformProjectRoot } = config.modRequest;
57
53
  const marketingVersion = config.version;
58
54
  const targetPath = path.join(platformProjectRoot, targetName);
59
- const widgetFiles = (0, getWidgetFiles_1.getWidgetFiles)(
60
- // widgetsPath,
61
- targetPath, moduleFileName, attributesFileName);
62
- console.log("Finished running withFiles");
55
+ const widgetFiles = (0, getWidgetFiles_1.getWidgetFiles)(targetPath);
63
56
  const xCConfigurationList = (0, addXCConfigurationList_1.addXCConfigurationList)(xcodeProject, {
64
57
  targetName,
65
58
  currentProjectVersion: config.ios.buildNumber || "1",
@@ -67,19 +60,16 @@ moduleFileName, attributesFileName, }) => {
67
60
  deploymentTarget,
68
61
  marketingVersion,
69
62
  });
70
- console.log("Finished running addXCConfigurationList");
71
63
  const productFile = (0, addProductFile_1.addProductFile)(xcodeProject, {
72
64
  targetName,
73
65
  groupName,
74
66
  });
75
- console.log("Finished running addProductFile");
76
67
  const target = (0, addToPbxNativeTargetSection_1.addToPbxNativeTargetSection)(xcodeProject, {
77
68
  targetName,
78
69
  targetUuid,
79
70
  productFile,
80
71
  xCConfigurationList,
81
72
  });
82
- console.log("Finished running addToPbxNativeTargetSection");
83
73
  (0, addToPbxProjectSection_1.addToPbxProjectSection)(xcodeProject, target);
84
74
  (0, addTargetDependency_1.addTargetDependency)(xcodeProject, target);
85
75
  (0, addBuildPhases_1.addBuildPhases)(xcodeProject, {
@@ -92,7 +82,6 @@ moduleFileName, attributesFileName, }) => {
92
82
  targetName,
93
83
  widgetFiles,
94
84
  });
95
- console.log("Finished running withXcode");
96
85
  return config;
97
86
  });
98
87
  };
@@ -9,12 +9,9 @@ const withWidgetsAndLiveActivities: ConfigPlugin = (
9
9
  config
10
10
  ) => {
11
11
  const deploymentTarget = "16.2";
12
- const moduleFileName = "ExpoNativeConfigurationModule.swift"
13
- const attributesFileName = "LiveActivityAttributes.swift"
14
-
15
12
  const targetName = `${IOSConfig.XcodeUtils.sanitizedName(
16
13
  config.name
17
- )}LiveActivity`; // Widgets => LiveActivity
14
+ )}LiveActivity`;
18
15
  const bundleIdentifier = `${config.ios?.bundleIdentifier}.${targetName}`;
19
16
 
20
17
  config.ios = {
@@ -33,9 +30,6 @@ const withWidgetsAndLiveActivities: ConfigPlugin = (
33
30
  targetName,
34
31
  bundleIdentifier,
35
32
  deploymentTarget,
36
- // widgetsFolder,
37
- moduleFileName,
38
- attributesFileName,
39
33
  },
40
34
  ],
41
35
  [withWidgetExtensionEntitlements, { targetName }],
@@ -11,10 +11,7 @@ export type WidgetFiles = {
11
11
  };
12
12
 
13
13
  export function getWidgetFiles(
14
- // widgetsPath: string, // to zmieniamy, bo u nas to będzie "config.modRequest.projectRoot/[tu może coś jeszcze być]/node_modules/nasz-moduł/iosViews"
15
14
  targetPath: string,
16
- moduleFileName: string,
17
- attributesFileName: string
18
15
  ) {
19
16
  let packagePath
20
17
  try {
@@ -22,9 +19,9 @@ export function getWidgetFiles(
22
19
  } catch {
23
20
  console.log("Building for example app")
24
21
  }
25
- const widgetsPath = path.join(packagePath ? packagePath : "..", "/ios-files");
26
- console.log(`Widgets path: ${widgetsPath}`);
22
+ const liveActivityFilesPath = path.join(packagePath ? packagePath : "..", "/ios-files");
27
23
  const imageAssetsPath = "./assets/live_activity";
24
+
28
25
  const widgetFiles: WidgetFiles = {
29
26
  swiftFiles: [],
30
27
  entitlementFiles: [],
@@ -33,23 +30,19 @@ export function getWidgetFiles(
33
30
  intentFiles: [],
34
31
  otherFiles: [],
35
32
  };
36
- console.log(`Getting widget files`)
33
+
37
34
  if (!fs.existsSync(targetPath)) {
38
- console.log(`Making directory at: ${targetPath}`)
39
35
  fs.mkdirSync(targetPath, { recursive: true });
40
36
  }
41
37
 
42
- if (fs.lstatSync(widgetsPath).isDirectory()) {
43
- const files = fs.readdirSync(widgetsPath);
44
- console.log(`Files: ${files}`)
38
+ if (fs.lstatSync(liveActivityFilesPath).isDirectory()) {
39
+ const files = fs.readdirSync(liveActivityFilesPath);
45
40
 
46
41
  files.forEach((file) => {
47
42
  const fileExtension = file.split(".").pop();
48
43
 
49
44
  if (fileExtension === "swift") {
50
- if (file !== moduleFileName) {
51
- widgetFiles.swiftFiles.push(file);
52
- }
45
+ widgetFiles.swiftFiles.push(file);
53
46
  } else if (fileExtension === "entitlements") {
54
47
  widgetFiles.entitlementFiles.push(file);
55
48
  } else if (fileExtension === "plist") {
@@ -73,29 +66,25 @@ export function getWidgetFiles(
73
66
  ...widgetFiles.intentFiles,
74
67
  ...widgetFiles.otherFiles,
75
68
  ].forEach((file) => {
76
- const source = path.join(widgetsPath, file);
69
+ const source = path.join(liveActivityFilesPath, file);
77
70
  copyFileSync(source, targetPath);
78
71
  });
79
72
 
80
73
  // Copy assets directory
81
- const imagesXcassetsSource = path.join(widgetsPath, "Assets.xcassets");
74
+ const imagesXcassetsSource = path.join(liveActivityFilesPath, "Assets.xcassets");
82
75
  copyFolderRecursiveSync(imagesXcassetsSource, targetPath);
83
76
 
84
77
  // Move images to assets directory
85
- console.log(`Images Path: ${imageAssetsPath}`)
86
78
  if (fs.lstatSync(imageAssetsPath).isDirectory()) {
87
79
  const imagesXcassetsTarget = path.join(targetPath, "Assets.xcassets");
88
- console.log(`Assets Target: ${imagesXcassetsTarget}`)
89
80
 
90
81
  const files = fs.readdirSync(imageAssetsPath);
91
- console.log(`Images: ${files}`)
82
+
92
83
  files.forEach((file) => {
93
84
  if (path.extname(file).match(/\.(png|jpg|jpeg)$/)) {
94
85
  const source = path.join(imageAssetsPath, file);
95
- console.log(`Source: ${source}`)
96
86
  const imageSetDir = path.join(imagesXcassetsTarget, `${path.basename(file, path.extname(file))}.imageset`);
97
87
 
98
- console.log(`imageSetDir: ${source}`)
99
88
  // Create the .imageset directory if it doesn't exist
100
89
  if (!fs.existsSync(imageSetDir)) {
101
90
  fs.mkdirSync(imageSetDir, { recursive: true });
@@ -121,10 +110,8 @@ export function getWidgetFiles(
121
110
 
122
111
  fs.writeFileSync(
123
112
  path.join(imageSetDir, 'Contents.json'),
124
- JSON.stringify(contentsJson, null, 2) // beautify the JSON output
113
+ JSON.stringify(contentsJson, null, 2)
125
114
  );
126
-
127
- console.log(`Processed ${file} into ${imageSetDir}`);
128
115
  }
129
116
  })
130
117
  }
@@ -20,7 +20,6 @@ export const withWidgetExtensionEntitlements: ConfigPlugin<{
20
20
 
21
21
  fs.mkdirSync(path.dirname(filePath), { recursive: true });
22
22
  fs.writeFileSync(filePath, plist.build({}));
23
- console.log("Finishing running withWidgetExtensionEntitlements")
24
23
  return config;
25
24
  });
26
25
  };
@@ -14,25 +14,16 @@ export const withXcode: ConfigPlugin<{
14
14
  targetName: string;
15
15
  bundleIdentifier: string;
16
16
  deploymentTarget: string;
17
- // widgetsFolder: string;
18
- moduleFileName: string;
19
- attributesFileName: string;
20
17
  }> = (
21
18
  config,
22
19
  {
23
20
  targetName,
24
21
  bundleIdentifier,
25
22
  deploymentTarget,
26
- // widgetsFolder,
27
- moduleFileName,
28
- attributesFileName,
29
23
  }
30
24
  ) => {
31
25
  return withXcodeProject(config, (config) => {
32
- console.log("Running withXcode")
33
26
  const xcodeProject = config.modResults;
34
- // const widgetsPath = path.join(config.modRequest.projectRoot, widgetsFolder);
35
-
36
27
  const targetUuid = xcodeProject.generateUuid();
37
28
  const groupName = "Embed Foundation Extensions";
38
29
  const { platformProjectRoot } = config.modRequest;
@@ -41,13 +32,9 @@ export const withXcode: ConfigPlugin<{
41
32
  const targetPath = path.join(platformProjectRoot, targetName);
42
33
 
43
34
  const widgetFiles = getWidgetFiles(
44
- // widgetsPath,
45
35
  targetPath,
46
- moduleFileName,
47
- attributesFileName
48
36
  );
49
37
 
50
- console.log("Finished running withFiles")
51
38
  const xCConfigurationList = addXCConfigurationList(xcodeProject, {
52
39
  targetName,
53
40
  currentProjectVersion: config.ios!.buildNumber || "1",
@@ -55,13 +42,11 @@ export const withXcode: ConfigPlugin<{
55
42
  deploymentTarget,
56
43
  marketingVersion,
57
44
  });
58
- console.log("Finished running addXCConfigurationList")
59
45
 
60
46
  const productFile = addProductFile(xcodeProject, {
61
47
  targetName,
62
48
  groupName,
63
49
  });
64
- console.log("Finished running addProductFile")
65
50
 
66
51
  const target = addToPbxNativeTargetSection(xcodeProject, {
67
52
  targetName,
@@ -69,7 +54,6 @@ export const withXcode: ConfigPlugin<{
69
54
  productFile,
70
55
  xCConfigurationList,
71
56
  });
72
- console.log("Finished running addToPbxNativeTargetSection")
73
57
 
74
58
  addToPbxProjectSection(xcodeProject, target);
75
59
 
@@ -87,7 +71,6 @@ export const withXcode: ConfigPlugin<{
87
71
  widgetFiles,
88
72
  });
89
73
 
90
- console.log("Finished running withXcode")
91
74
  return config;
92
75
  });
93
76
  };