@sency/react-native-smkit-ui 0.1.0
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/LICENSE +127 -0
- package/README.md +31 -0
- package/android/build.gradle +104 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/smkituilibrary/SmkitUiLibraryModule.kt +119 -0
- package/android/src/main/java/com/smkituilibrary/SmkitUiLibraryPackage.kt +16 -0
- package/android/src/main/java/com/smkituilibrary/mapper/SMMapper.kt +43 -0
- package/android/src/main/java/com/smkituilibrary/model/SMKitExercise.kt +17 -0
- package/android/src/main/java/com/smkituilibrary/model/SMKitWorkout.kt +13 -0
- package/android/src/main/java/com/smkituilibrary/model/SMKitWorkoutConfig.kt +12 -0
- package/ios/SMKitUIManager.mm +9 -0
- package/ios/SMKitUIManager.swift +136 -0
- package/ios/SMKitUIViewContoller.swift +20 -0
- package/ios/SmkitUiLibrary-Bridging-Header.h +5 -0
- package/lib/commonjs/SMKitUIView.js +5 -0
- package/lib/commonjs/SMKitUIView.js.map +1 -0
- package/lib/commonjs/SMWorkout.js +74 -0
- package/lib/commonjs/SMWorkout.js.map +1 -0
- package/lib/commonjs/index.js +38 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/SMKitUIView.js +3 -0
- package/lib/module/SMKitUIView.js.map +1 -0
- package/lib/module/SMWorkout.js +65 -0
- package/lib/module/SMWorkout.js.map +1 -0
- package/lib/module/index.js +28 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/example/src/App.d.ts +3 -0
- package/lib/typescript/example/src/App.d.ts.map +1 -0
- package/lib/typescript/package/src/SMKitUIView.d.ts +2 -0
- package/lib/typescript/package/src/SMKitUIView.d.ts.map +1 -0
- package/lib/typescript/package/src/SMWorkout.d.ts +57 -0
- package/lib/typescript/package/src/SMWorkout.d.ts.map +1 -0
- package/lib/typescript/package/src/index.d.ts +19 -0
- package/lib/typescript/package/src/index.d.ts.map +1 -0
- package/lib/typescript/src/SMKitUIView.d.ts +2 -0
- package/lib/typescript/src/SMKitUIView.d.ts.map +1 -0
- package/lib/typescript/src/SMWorkout.d.ts +57 -0
- package/lib/typescript/src/SMWorkout.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +19 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +155 -0
- package/react-native-smkit-ui.podspec +42 -0
- package/src/SMKitUIView.tsx +3 -0
- package/src/SMWorkout.tsx +94 -0
- package/src/index.tsx +40 -0
package/package.json
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sency/react-native-smkit-ui",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "react-native-smkit-ui",
|
|
5
|
+
"main": "lib/commonjs/index.js",
|
|
6
|
+
"module": "lib/module/index.js",
|
|
7
|
+
"types": "lib/typescript/src/index.d.ts",
|
|
8
|
+
"react-native": "src/index.tsx",
|
|
9
|
+
"source": "src/index.tsx",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"lib",
|
|
13
|
+
"!**/__tests__",
|
|
14
|
+
"!**/__fixtures__",
|
|
15
|
+
"!**/__mocks__",
|
|
16
|
+
"android",
|
|
17
|
+
"ios",
|
|
18
|
+
"cpp",
|
|
19
|
+
"*.podspec",
|
|
20
|
+
"!ios/build",
|
|
21
|
+
"!android/build",
|
|
22
|
+
"!android/gradle",
|
|
23
|
+
"!android/gradlew",
|
|
24
|
+
"!android/gradlew.bat",
|
|
25
|
+
"!android/local.properties",
|
|
26
|
+
"!**/.*"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"example": "yarn workspace react-native-smkit-ui-example",
|
|
30
|
+
"test": "jest",
|
|
31
|
+
"typecheck": "tsc --noEmit",
|
|
32
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
33
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
34
|
+
"prepare": "bob build",
|
|
35
|
+
"release": "release-it"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"react-native",
|
|
39
|
+
"ios",
|
|
40
|
+
"android"
|
|
41
|
+
],
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://sency-motion-sdk.document360.io.git"
|
|
45
|
+
},
|
|
46
|
+
"author": "Sency <Ofer.g@sency.ai> (https://github.com/sency-ai/smkit-ui-react-native-demo)",
|
|
47
|
+
"license": "Other",
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "contact@sency.ai"
|
|
50
|
+
},
|
|
51
|
+
"homepage": "https://github.com/sency-ai/smkit-ui-react-native-demo#readme",
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"registry": "https://registry.npmjs.org/"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
57
|
+
"@evilmartians/lefthook": "^1.5.0",
|
|
58
|
+
"@react-native/eslint-config": "^0.73.1",
|
|
59
|
+
"@release-it/conventional-changelog": "^5.0.0",
|
|
60
|
+
"@types/jest": "^29.5.5",
|
|
61
|
+
"@types/react": "^18.2.44",
|
|
62
|
+
"commitlint": "^17.0.2",
|
|
63
|
+
"del-cli": "^5.1.0",
|
|
64
|
+
"eslint": "^8.51.0",
|
|
65
|
+
"eslint-config-prettier": "^9.0.0",
|
|
66
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
67
|
+
"jest": "^29.7.0",
|
|
68
|
+
"prettier": "^3.0.3",
|
|
69
|
+
"react": "18.2.0",
|
|
70
|
+
"react-native": "0.73.6",
|
|
71
|
+
"react-native-builder-bob": "^0.23.2",
|
|
72
|
+
"release-it": "^15.0.0",
|
|
73
|
+
"turbo": "^1.10.7",
|
|
74
|
+
"typescript": "^5.2.2"
|
|
75
|
+
},
|
|
76
|
+
"resolutions": {
|
|
77
|
+
"@types/react": "^18.2.44"
|
|
78
|
+
},
|
|
79
|
+
"peerDependencies": {
|
|
80
|
+
"react": "*",
|
|
81
|
+
"react-native": "*"
|
|
82
|
+
},
|
|
83
|
+
"workspaces": [
|
|
84
|
+
"example"
|
|
85
|
+
],
|
|
86
|
+
"packageManager": "yarn@3.6.1",
|
|
87
|
+
"jest": {
|
|
88
|
+
"preset": "react-native",
|
|
89
|
+
"modulePathIgnorePatterns": [
|
|
90
|
+
"<rootDir>/example/node_modules",
|
|
91
|
+
"<rootDir>/lib/"
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
"commitlint": {
|
|
95
|
+
"extends": [
|
|
96
|
+
"@commitlint/config-conventional"
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
"release-it": {
|
|
100
|
+
"git": {
|
|
101
|
+
"commitMessage": "chore: release ${version}",
|
|
102
|
+
"tagName": "v${version}"
|
|
103
|
+
},
|
|
104
|
+
"npm": {
|
|
105
|
+
"publish": true
|
|
106
|
+
},
|
|
107
|
+
"github": {
|
|
108
|
+
"release": true
|
|
109
|
+
},
|
|
110
|
+
"plugins": {
|
|
111
|
+
"@release-it/conventional-changelog": {
|
|
112
|
+
"preset": "angular"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"eslintConfig": {
|
|
117
|
+
"root": true,
|
|
118
|
+
"extends": [
|
|
119
|
+
"@react-native",
|
|
120
|
+
"prettier"
|
|
121
|
+
],
|
|
122
|
+
"rules": {
|
|
123
|
+
"prettier/prettier": [
|
|
124
|
+
"error",
|
|
125
|
+
{
|
|
126
|
+
"quoteProps": "consistent",
|
|
127
|
+
"singleQuote": true,
|
|
128
|
+
"tabWidth": 2,
|
|
129
|
+
"trailingComma": "es5",
|
|
130
|
+
"useTabs": false
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
"eslintIgnore": [
|
|
136
|
+
"node_modules/",
|
|
137
|
+
"lib/"
|
|
138
|
+
],
|
|
139
|
+
"prettier": {
|
|
140
|
+
"quoteProps": "consistent",
|
|
141
|
+
"singleQuote": true,
|
|
142
|
+
"tabWidth": 2,
|
|
143
|
+
"trailingComma": "es5",
|
|
144
|
+
"useTabs": false
|
|
145
|
+
},
|
|
146
|
+
"react-native-builder-bob": {
|
|
147
|
+
"source": "src",
|
|
148
|
+
"output": "lib",
|
|
149
|
+
"targets": [
|
|
150
|
+
"commonjs",
|
|
151
|
+
"module",
|
|
152
|
+
"typescript"
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
|
+
|
|
6
|
+
Pod::Spec.new do |s|
|
|
7
|
+
s.name = "react-native-smkit-ui"
|
|
8
|
+
s.version = package["version"]
|
|
9
|
+
s.summary = package["description"]
|
|
10
|
+
s.homepage = package["homepage"]
|
|
11
|
+
s.license = package["license"]
|
|
12
|
+
s.authors = package["author"]
|
|
13
|
+
|
|
14
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
15
|
+
s.source = { :git => "https://sency-motion-sdk.document360.io.git", :tag => "#{s.version}" }
|
|
16
|
+
|
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
|
+
s.dependency "SMKitUI" ,'0.1.4'
|
|
19
|
+
|
|
20
|
+
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
21
|
+
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
22
|
+
if respond_to?(:install_modules_dependencies, true)
|
|
23
|
+
install_modules_dependencies(s)
|
|
24
|
+
else
|
|
25
|
+
s.dependency "React-Core"
|
|
26
|
+
|
|
27
|
+
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
28
|
+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
29
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
30
|
+
s.pod_target_xcconfig = {
|
|
31
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
32
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
33
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
34
|
+
}
|
|
35
|
+
s.dependency "React-Codegen"
|
|
36
|
+
s.dependency "RCT-Folly"
|
|
37
|
+
s.dependency "RCTRequired"
|
|
38
|
+
s.dependency "RCTTypeSafety"
|
|
39
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export enum AssessmentTypes{
|
|
2
|
+
Fitness = "fitness"
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export enum UIElement{
|
|
6
|
+
RepsCounter = "repsCounter",
|
|
7
|
+
Timer = "timer",
|
|
8
|
+
GaugeOfMotion = "gaugeOfMotion"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export enum BodyZone{
|
|
12
|
+
UpperBody = "UpperBody",
|
|
13
|
+
LowerBody = "LowerBody",
|
|
14
|
+
FullBody = "FullBody"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export enum WorkoutDifficulty{
|
|
18
|
+
LowDifficulty = "LowDifficulty",
|
|
19
|
+
MidDifficulty = "MidDifficulty",
|
|
20
|
+
HighDifficulty = "HighDifficulty"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export enum WorkoutDuration{
|
|
24
|
+
Short = "Short",
|
|
25
|
+
Long = "Long"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export class SMWorkout{
|
|
29
|
+
id: string | null;
|
|
30
|
+
name: string | null;
|
|
31
|
+
workoutIntro: string | null;
|
|
32
|
+
soundtrack: string | null;
|
|
33
|
+
exercises: SMExercise[];
|
|
34
|
+
getInFrame: string | null;
|
|
35
|
+
bodycalFinished: string | null;
|
|
36
|
+
workoutClosure: string | null;
|
|
37
|
+
|
|
38
|
+
constructor(id: string | null, name: string | null, workoutIntro: string | null, soundtrack: string | null, exercises: SMExercise[], getInFrame: string | null, bodycalFinished: string | null, workoutClosure: string | null) {
|
|
39
|
+
this.id = id || null;
|
|
40
|
+
this.name = name || null;
|
|
41
|
+
this.workoutIntro = workoutIntro || null;
|
|
42
|
+
this.soundtrack = soundtrack || null;
|
|
43
|
+
this.exercises = exercises;
|
|
44
|
+
this.getInFrame = getInFrame || null;
|
|
45
|
+
this.bodycalFinished = bodycalFinished || null;
|
|
46
|
+
this.workoutClosure = workoutClosure || null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export class SMExercise{
|
|
51
|
+
name:string | null;
|
|
52
|
+
totalSeconds: number | null;
|
|
53
|
+
introSeconds: number | null;
|
|
54
|
+
videoInstruction: string | null;
|
|
55
|
+
exerciseIntro: string | null;
|
|
56
|
+
uiElements: UIElement[] | null;
|
|
57
|
+
detector: string;
|
|
58
|
+
repBased: boolean | null;
|
|
59
|
+
exerciseClosure: string | null;
|
|
60
|
+
targetReps: number | null;
|
|
61
|
+
targetTime: number | null;
|
|
62
|
+
scoreFactor: number | null;
|
|
63
|
+
|
|
64
|
+
constructor(name: string | null, totalSeconds: number | null, introSeconds: number | null, videoInstruction: string | null, exerciseIntro: string | null, uiElements: UIElement[] | null, detector: string, repBased: boolean | null, exerciseClosure: string | null, targetReps: number | null, targetTime: number | null, scoreFactor: number | null) {
|
|
65
|
+
this.name = name || null
|
|
66
|
+
this.totalSeconds = totalSeconds || null
|
|
67
|
+
this.introSeconds = introSeconds || null
|
|
68
|
+
this.videoInstruction = videoInstruction || null
|
|
69
|
+
this.exerciseIntro = exerciseIntro || null
|
|
70
|
+
this.uiElements = uiElements || null
|
|
71
|
+
this.detector = detector
|
|
72
|
+
this.repBased = repBased || null
|
|
73
|
+
this.targetReps = targetReps || null
|
|
74
|
+
this.targetTime = targetTime || null
|
|
75
|
+
this.scoreFactor = scoreFactor || null
|
|
76
|
+
this.exerciseClosure = exerciseClosure || null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export class WorkoutConfig{
|
|
81
|
+
week: number;
|
|
82
|
+
bodyZone: BodyZone;
|
|
83
|
+
difficultyLevel: WorkoutDifficulty;
|
|
84
|
+
workoutDuration: WorkoutDuration;
|
|
85
|
+
programID: string;
|
|
86
|
+
|
|
87
|
+
constructor(week: number, bodyZone: BodyZone, difficultyLevel: WorkoutDifficulty, workoutDuration: WorkoutDuration, programID: string){
|
|
88
|
+
this.week = week;
|
|
89
|
+
this.bodyZone = bodyZone;
|
|
90
|
+
this.difficultyLevel = difficultyLevel;
|
|
91
|
+
this.workoutDuration = workoutDuration;
|
|
92
|
+
this.programID = programID;
|
|
93
|
+
}
|
|
94
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
import * as SMWorkoutLibrary from '../src/SMWorkout';
|
|
3
|
+
|
|
4
|
+
const LINKING_ERROR =
|
|
5
|
+
`The package 'react-native-smkit-ui' doesn't seem to be linked. Make sure: \n\n` +
|
|
6
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
7
|
+
'- You rebuilt the app after installing the package\n' +
|
|
8
|
+
'- You are not using Expo Go\n';
|
|
9
|
+
|
|
10
|
+
const SMKitUIManager = NativeModules.SMKitUIManager
|
|
11
|
+
? NativeModules.SMKitUIManager
|
|
12
|
+
: new Proxy(
|
|
13
|
+
{},
|
|
14
|
+
{
|
|
15
|
+
get() {
|
|
16
|
+
throw new Error(LINKING_ERROR);
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export function configure(key: string): Promise<string> {
|
|
22
|
+
return SMKitUIManager.configure(key);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function startAssessment(type:SMWorkoutLibrary.AssessmentTypes): Promise<{summary: string, didFinish:boolean}>{
|
|
26
|
+
return SMKitUIManager.startAssessment(type);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function startCustomWorkout(workout:SMWorkoutLibrary.SMWorkout): Promise<{summary: string, didFinish:boolean}>{
|
|
30
|
+
return SMKitUIManager.startCustomWorkout(workout);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function startWorkoutProgram(workoutConfig:SMWorkoutLibrary.WorkoutConfig): Promise<{summary: string, didFinish:boolean}>{
|
|
34
|
+
return SMKitUIManager.startWorkoutProgram(workoutConfig);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export enum AssessmentTypes{
|
|
38
|
+
Fitness = "fitness",
|
|
39
|
+
Custom = "custom"
|
|
40
|
+
}
|