currentactivity 1.0.1 → 1.0.2

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/README.md CHANGED
@@ -116,6 +116,9 @@ That's it.
116
116
 
117
117
  ## Changelog
118
118
 
119
+ * 1.0.2
120
+ * Compatible with some Samsung phones
121
+
119
122
  * 1.0.1
120
123
  * Added more options for more flexible output
121
124
 
package/build/index.js CHANGED
@@ -136,9 +136,10 @@ function printAll() {
136
136
  if (stackId != undefined) {
137
137
  const stackLines = windowLines.filter((v) => {
138
138
  const s = v.trim();
139
- return s.startsWith("*") && s.indexOf(stackId) > 0;
139
+ return ((s.startsWith("*") || s.startsWith("Activity #")) &&
140
+ s.indexOf(stackId) > 0);
140
141
  });
141
- const stacks = stackLines.map((v) => v.trim().split(" ")[3]);
142
+ const stacks = stackLines.map((v) => v.trim().split(" ").last(1));
142
143
  if (stacks[0] != currentActivity) {
143
144
  stacks.shift();
144
145
  }
@@ -417,9 +418,10 @@ function printCurrentActivityStack() {
417
418
  if (stackId != undefined) {
418
419
  const stackLines = windowLines.filter((v) => {
419
420
  const s = v.trim();
420
- return s.startsWith("*") && s.indexOf(stackId) > 0;
421
+ return ((s.startsWith("*") || s.startsWith("Activity #")) &&
422
+ s.indexOf(stackId) > 0);
421
423
  });
422
- const stacks = stackLines.map((v) => v.trim().split(" ")[3]);
424
+ const stacks = stackLines.map((v) => v.trim().split(" ").last(1));
423
425
  if (stacks[0] != currentActivity) {
424
426
  stacks.shift();
425
427
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "currentactivity",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "A command line tool to display the current activity for android.",
5
5
  "main": "./build/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -155,9 +155,12 @@ async function printAll() {
155
155
  if (stackId != undefined) {
156
156
  const stackLines = windowLines.filter((v) => {
157
157
  const s = v.trim();
158
- return s.startsWith("*") && s.indexOf(stackId) > 0;
158
+ return (
159
+ (s.startsWith("*") || s.startsWith("Activity #")) &&
160
+ s.indexOf(stackId) > 0
161
+ );
159
162
  });
160
- const stacks = stackLines.map((v) => v.trim().split(" ")[3]);
163
+ const stacks = stackLines.map((v) => v.trim().split(" ").last(1));
161
164
  if (stacks[0] != currentActivity) {
162
165
  stacks.shift();
163
166
  }
@@ -495,9 +498,12 @@ async function printCurrentActivityStack() {
495
498
  if (stackId != undefined) {
496
499
  const stackLines = windowLines.filter((v) => {
497
500
  const s = v.trim();
498
- return s.startsWith("*") && s.indexOf(stackId) > 0;
501
+ return (
502
+ (s.startsWith("*") || s.startsWith("Activity #")) &&
503
+ s.indexOf(stackId) > 0
504
+ );
499
505
  });
500
- const stacks = stackLines.map((v) => v.trim().split(" ")[3]);
506
+ const stacks = stackLines.map((v) => v.trim().split(" ").last(1));
501
507
  if (stacks[0] != currentActivity) {
502
508
  stacks.shift();
503
509
  }