@leejungkiin/awkit 1.7.0 → 1.7.4

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.
Files changed (241) hide show
  1. package/bin/awk.js +576 -84
  2. package/core/CLAUDE.md +1 -1
  3. package/core/GEMINI.md +148 -167
  4. package/core/GEMINI.md.bak +149 -116
  5. package/core/skill-runtime-manifest.json +3 -0
  6. package/docs/Claude Fable 5.md +3826 -0
  7. package/docs/android_kotlin_system_instruction.md +210 -0
  8. package/docs/brainstorm_ponytail_integration.md +146 -0
  9. package/docs/brainstorm_smart_setup.md +113 -0
  10. package/docs/deep-research-report (1).md +293 -0
  11. package/docs/history/GEMINI.v1.md +135 -0
  12. package/docs/history/brainstorm_antigravity_unified_architecture.v1.md +105 -0
  13. package/docs/history/implementation_plan.v1.md +58 -0
  14. package/package.json +4 -1
  15. package/scripts/artifact-storage.js +130 -0
  16. package/scripts/automation-gate.js +40 -7
  17. package/scripts/claude-plan.js +76 -0
  18. package/scripts/dependency-manager.js +210 -0
  19. package/scripts/exec-rtk.js +11 -5
  20. package/scripts/i18n-helper.js +381 -0
  21. package/scripts/multi-model-pipeline.js +144 -0
  22. package/skill-packs/mobile-ios/pack.json +4 -2
  23. package/skill-packs/reverse-engineering/pack.json +1 -0
  24. package/skills/CATALOG.md +20 -0
  25. package/skills/GEMINI.md +9 -1
  26. package/skills/TRIGGER_INDEX.md +10 -0
  27. package/skills/ai-music/SKILL.md +275 -0
  28. package/skills/android-re-analyzer/SKILL.md +238 -0
  29. package/skills/android-re-analyzer/references/api-extraction-patterns.md +119 -0
  30. package/skills/android-re-analyzer/references/call-flow-analysis.md +176 -0
  31. package/skills/android-re-analyzer/references/fernflower-usage.md +115 -0
  32. package/skills/android-re-analyzer/references/jadx-usage.md +116 -0
  33. package/skills/android-re-analyzer/references/setup-guide.md +221 -0
  34. package/skills/android-re-analyzer/scripts/check-deps.sh +129 -0
  35. package/skills/android-re-analyzer/scripts/decompile.sh +375 -0
  36. package/skills/android-re-analyzer/scripts/find-api-calls.sh +118 -0
  37. package/skills/android-re-analyzer/scripts/install-dep.sh +448 -0
  38. package/skills/animal-island-ui-style/SKILL.md +1450 -0
  39. package/skills/app-store-review-agent/SKILL.md +164 -0
  40. package/skills/app-store-review-agent/references/guidelines/README.md +154 -0
  41. package/skills/app-store-review-agent/references/guidelines/by-app-type/ai_apps.md +37 -0
  42. package/skills/app-store-review-agent/references/guidelines/by-app-type/all_apps.md +50 -0
  43. package/skills/app-store-review-agent/references/guidelines/by-app-type/crypto_finance.md +31 -0
  44. package/skills/app-store-review-agent/references/guidelines/by-app-type/games.md +31 -0
  45. package/skills/app-store-review-agent/references/guidelines/by-app-type/health_fitness.md +31 -0
  46. package/skills/app-store-review-agent/references/guidelines/by-app-type/kids.md +27 -0
  47. package/skills/app-store-review-agent/references/guidelines/by-app-type/macos.md +38 -0
  48. package/skills/app-store-review-agent/references/guidelines/by-app-type/social_ugc.md +32 -0
  49. package/skills/app-store-review-agent/references/guidelines/by-app-type/subscription_iap.md +34 -0
  50. package/skills/app-store-review-agent/references/guidelines/by-app-type/vpn.md +18 -0
  51. package/skills/app-store-review-agent/references/rules/design/minimum_functionality.md +96 -0
  52. package/skills/app-store-review-agent/references/rules/design/sign_in_with_apple.md +54 -0
  53. package/skills/app-store-review-agent/references/rules/entitlements/unused_entitlements.md +83 -0
  54. package/skills/app-store-review-agent/references/rules/metadata/accurate_metadata.md +54 -0
  55. package/skills/app-store-review-agent/references/rules/metadata/apple_trademark.md +99 -0
  56. package/skills/app-store-review-agent/references/rules/metadata/china_storefront.md +72 -0
  57. package/skills/app-store-review-agent/references/rules/metadata/competitor_terms.md +56 -0
  58. package/skills/app-store-review-agent/references/rules/metadata/subscription_metadata.md +81 -0
  59. package/skills/app-store-review-agent/references/rules/privacy/privacy_manifest.md +84 -0
  60. package/skills/app-store-review-agent/references/rules/privacy/unnecessary_data.md +60 -0
  61. package/skills/app-store-review-agent/references/rules/subscription/misleading_pricing.md +63 -0
  62. package/skills/app-store-review-agent/references/rules/subscription/missing_tos_pp.md +54 -0
  63. package/skills/awf-ponytail/SKILL.md +91 -0
  64. package/skills/awf-ponytail-review/SKILL.md +67 -0
  65. package/skills/awf-session-restore/SKILL.md +3 -3
  66. package/skills/brainstorm-agent/SKILL.md +11 -2
  67. package/skills/brainstorm-agent/templates/brief-template.md +8 -0
  68. package/skills/claude-planner/SKILL.md +47 -0
  69. package/skills/code-review/SKILL.md +87 -0
  70. package/skills/expo-game-development/SKILL.md +163 -0
  71. package/skills/flutter/LICENSE.txt +202 -0
  72. package/skills/flutter/SKILL.md +127 -0
  73. package/skills/flutter-project-creater/LICENSE.txt +202 -0
  74. package/skills/flutter-project-creater/SKILL.md +106 -0
  75. package/skills/game-developer/SKILL.md +163 -0
  76. package/skills/game-developer/references/ecs-patterns.md +501 -0
  77. package/skills/game-developer/references/multiplayer-networking.md +475 -0
  78. package/skills/game-developer/references/performance-optimization.md +422 -0
  79. package/skills/game-developer/references/unity-patterns.md +271 -0
  80. package/skills/game-developer/references/unreal-cpp.md +352 -0
  81. package/skills/generate-gui-assets/SKILL.md +305 -0
  82. package/skills/generate-gui-assets/agents/openai.yaml +4 -0
  83. package/skills/generate-gui-assets/references/catalog-schema.md +58 -0
  84. package/skills/generate-gui-assets/references/extraction-techniques.md +21 -0
  85. package/skills/generate-gui-assets/references/prompt-patterns.md +58 -0
  86. package/skills/generate-gui-assets/scripts/__pycache__/clean_chroma_edges.cpython-311.pyc +0 -0
  87. package/skills/generate-gui-assets/scripts/build_gui_contact_sheet.py +51 -0
  88. package/skills/generate-gui-assets/scripts/clean_chroma_edges.py +262 -0
  89. package/skills/generate-gui-assets/scripts/copy_approved_icons.py +64 -0
  90. package/skills/generate-gui-assets/scripts/prepare_gui_asset_run.py +91 -0
  91. package/skills/generate-gui-assets/scripts/suggest_grid_options.py +63 -0
  92. package/skills/generate-gui-assets/scripts/validate_gui_catalog.py +50 -0
  93. package/skills/godot-game-development/SKILL.md +142 -0
  94. package/skills/hatch-pet/LICENSE.txt +201 -0
  95. package/skills/hatch-pet/SKILL.md +420 -0
  96. package/skills/hatch-pet/agents/openai.yaml +4 -0
  97. package/skills/hatch-pet/references/animation-rows.md +29 -0
  98. package/skills/hatch-pet/references/codex-pet-contract.md +35 -0
  99. package/skills/hatch-pet/references/qa-rubric.md +60 -0
  100. package/skills/hatch-pet/scripts/__pycache__/clean_chroma_edges.cpython-311.pyc +0 -0
  101. package/skills/hatch-pet/scripts/clean_chroma_edges.py +262 -0
  102. package/skills/hatch-pet/scripts/compose_atlas.py +150 -0
  103. package/skills/hatch-pet/scripts/derive_running_left_from_running_right.py +143 -0
  104. package/skills/hatch-pet/scripts/extract_strip_frames.py +323 -0
  105. package/skills/hatch-pet/scripts/finalize_pet_run.py +382 -0
  106. package/skills/hatch-pet/scripts/generate_pet_images.py +287 -0
  107. package/skills/hatch-pet/scripts/inspect_frames.py +246 -0
  108. package/skills/hatch-pet/scripts/make_contact_sheet.py +96 -0
  109. package/skills/hatch-pet/scripts/package_custom_pet.py +108 -0
  110. package/skills/hatch-pet/scripts/pet_job_status.py +117 -0
  111. package/skills/hatch-pet/scripts/prepare_pet_run.py +673 -0
  112. package/skills/hatch-pet/scripts/queue_pet_repairs.py +172 -0
  113. package/skills/hatch-pet/scripts/record_imagegen_result.py +250 -0
  114. package/skills/hatch-pet/scripts/render_animation_videos.py +134 -0
  115. package/skills/hatch-pet/scripts/render_animation_videos.sh +5 -0
  116. package/skills/hatch-pet/scripts/validate_atlas.py +139 -0
  117. package/skills/i18n-orchestrator/SKILL.md +37 -0
  118. package/skills/ios-simulator-skill/SKILL.md +390 -0
  119. package/skills/ios-simulator-skill/scripts/accessibility_audit.py +300 -0
  120. package/skills/ios-simulator-skill/scripts/app_launcher.py +326 -0
  121. package/skills/ios-simulator-skill/scripts/app_state_capture.py +400 -0
  122. package/skills/ios-simulator-skill/scripts/appearance.py +385 -0
  123. package/skills/ios-simulator-skill/scripts/build_and_test.py +348 -0
  124. package/skills/ios-simulator-skill/scripts/clipboard.py +103 -0
  125. package/skills/ios-simulator-skill/scripts/common/__init__.py +61 -0
  126. package/skills/ios-simulator-skill/scripts/common/cache_utils.py +289 -0
  127. package/skills/ios-simulator-skill/scripts/common/device_utils.py +462 -0
  128. package/skills/ios-simulator-skill/scripts/common/env_config.py +35 -0
  129. package/skills/ios-simulator-skill/scripts/common/hang_pipeline.py +862 -0
  130. package/skills/ios-simulator-skill/scripts/common/hang_sessions.py +490 -0
  131. package/skills/ios-simulator-skill/scripts/common/idb_utils.py +180 -0
  132. package/skills/ios-simulator-skill/scripts/common/screenshot_utils.py +338 -0
  133. package/skills/ios-simulator-skill/scripts/container.py +668 -0
  134. package/skills/ios-simulator-skill/scripts/gesture.py +394 -0
  135. package/skills/ios-simulator-skill/scripts/hang_watcher.py +1533 -0
  136. package/skills/ios-simulator-skill/scripts/keyboard.py +391 -0
  137. package/skills/ios-simulator-skill/scripts/localization_audit.py +483 -0
  138. package/skills/ios-simulator-skill/scripts/location.py +467 -0
  139. package/skills/ios-simulator-skill/scripts/log_monitor.py +493 -0
  140. package/skills/ios-simulator-skill/scripts/model_inspector.py +645 -0
  141. package/skills/ios-simulator-skill/scripts/navigator.py +461 -0
  142. package/skills/ios-simulator-skill/scripts/privacy_manager.py +310 -0
  143. package/skills/ios-simulator-skill/scripts/push_notification.py +240 -0
  144. package/skills/ios-simulator-skill/scripts/screen_mapper.py +296 -0
  145. package/skills/ios-simulator-skill/scripts/sim_health_check.sh +245 -0
  146. package/skills/ios-simulator-skill/scripts/sim_list.py +299 -0
  147. package/skills/ios-simulator-skill/scripts/simctl_boot.py +312 -0
  148. package/skills/ios-simulator-skill/scripts/simctl_create.py +316 -0
  149. package/skills/ios-simulator-skill/scripts/simctl_delete.py +357 -0
  150. package/skills/ios-simulator-skill/scripts/simctl_erase.py +351 -0
  151. package/skills/ios-simulator-skill/scripts/simctl_shutdown.py +290 -0
  152. package/skills/ios-simulator-skill/scripts/simulator_selector.py +375 -0
  153. package/skills/ios-simulator-skill/scripts/status_bar.py +250 -0
  154. package/skills/ios-simulator-skill/scripts/test_recorder.py +323 -0
  155. package/skills/ios-simulator-skill/scripts/visual_diff.py +235 -0
  156. package/skills/ios-simulator-skill/scripts/xcode/__init__.py +13 -0
  157. package/skills/ios-simulator-skill/scripts/xcode/builder.py +397 -0
  158. package/skills/ios-simulator-skill/scripts/xcode/cache.py +204 -0
  159. package/skills/ios-simulator-skill/scripts/xcode/config.py +178 -0
  160. package/skills/ios-simulator-skill/scripts/xcode/reporter.py +343 -0
  161. package/skills/ios-simulator-skill/scripts/xcode/xcresult.py +451 -0
  162. package/skills/ios-visual-qa-strategist/SKILL.md +111 -0
  163. package/skills/ios-visual-qa-strategist/agents/openai.yaml +4 -0
  164. package/skills/ios-visual-qa-strategist/references/ios-tool-selection.md +61 -0
  165. package/skills/ios-visual-qa-strategist/references/minimal-capture-policy.md +56 -0
  166. package/skills/ios-visual-qa-strategist/references/visual-reasoning-heuristics.md +53 -0
  167. package/skills/orchestrator/SKILL.md +0 -20
  168. package/skills/persistent-storage/SKILL.md +55 -0
  169. package/skills/short-maker/SKILL.md +23 -0
  170. package/skills/short-maker/scripts/effects.js +56 -0
  171. package/skills/short-maker/scripts/shortmaker-bridge.js +332 -0
  172. package/skills/short-maker/scripts/videomix.js +601 -0
  173. package/skills/short-maker/templates/hyperframes/cinematic-character.template.html +172 -0
  174. package/skills/short-maker/templates/hyperframes/index.template.html +194 -0
  175. package/skills/smali-to-kotlin/SKILL.md +128 -0
  176. package/skills/smali-to-kotlin/examples/getting-started/tech-stack.md +58 -0
  177. package/skills/smali-to-kotlin/examples/pipeline/data-ui-parity.md +118 -0
  178. package/skills/smali-to-kotlin/examples/pipeline/scanner-and-bootstrap.md +106 -0
  179. package/skills/smali-to-kotlin/library-patterns.md +189 -0
  180. package/skills/smali-to-kotlin/phase-0-discovery.md +128 -0
  181. package/skills/smali-to-kotlin/phase-1-architecture.md +166 -0
  182. package/skills/smali-to-kotlin/phase-2-blueprint-ui.md +347 -0
  183. package/skills/smali-to-kotlin/phase-2-blueprint.md +228 -0
  184. package/skills/smali-to-kotlin/phase-3-build.md +248 -0
  185. package/skills/smali-to-kotlin/phase-3-logic-build.md +268 -0
  186. package/skills/smali-to-kotlin/smali-reading-guide.md +310 -0
  187. package/skills/smali-to-kotlin/templates/app-map.md +101 -0
  188. package/skills/smali-to-kotlin/templates/architecture.md +142 -0
  189. package/skills/smali-to-kotlin/templates/blueprint.md +145 -0
  190. package/skills/spec-gate/SKILL.md +6 -2
  191. package/skills/symphony-enforcer/SKILL.md +8 -0
  192. package/skills/symphony-enforcer/examples/mindful-stop.md +2 -0
  193. package/skills/symphony-enforcer/examples/three-phase.md +16 -0
  194. package/skills/symphony-enforcer/examples/trigger-points.md +7 -1
  195. package/skills/unity-game-development/SKILL.md +231 -0
  196. package/skills/verification-gate/SKILL.md +4 -2
  197. package/skills/video-edit/SKILL.md +36 -0
  198. package/skills/video-edit/scripts/video_edit.py +324 -0
  199. package/templates/setup-mapping.json +48 -0
  200. package/templates/specs/design-template.md +161 -71
  201. package/templates/specs/requirements-template.md +65 -133
  202. package/templates/specs/task-spec-template.xml +3 -0
  203. package/workflows/_uncategorized/critic.md +40 -0
  204. package/workflows/_uncategorized/git-rebase-flow.md +81 -0
  205. package/workflows/_uncategorized/image-gen.md +118 -0
  206. package/workflows/_uncategorized/multi-model-pipeline.md +60 -0
  207. package/workflows/_uncategorized/pixel-gen.md +86 -0
  208. package/workflows/_uncategorized/pixel-setup.md +90 -0
  209. package/workflows/_uncategorized/ponytail-review.md +59 -0
  210. package/workflows/_uncategorized/reverse-android-build.md +222 -0
  211. package/workflows/_uncategorized/reverse-android-design.md +139 -0
  212. package/workflows/_uncategorized/reverse-android-discover.md +150 -0
  213. package/workflows/_uncategorized/reverse-android-scan.md +158 -0
  214. package/workflows/_uncategorized/reverse-android.md +143 -0
  215. package/workflows/_uncategorized/reverse-ios-build.md +240 -0
  216. package/workflows/_uncategorized/reverse-ios-design.md +112 -0
  217. package/workflows/_uncategorized/reverse-ios-discover.md +120 -0
  218. package/workflows/_uncategorized/reverse-ios-scan.md +155 -0
  219. package/workflows/_uncategorized/reverse-ios.md +152 -0
  220. package/workflows/_uncategorized/safety-router.md +34 -0
  221. package/workflows/_uncategorized/teach.md +89 -0
  222. package/workflows/_uncategorized/verify-ui.md +53 -0
  223. package/workflows/_uncategorized/visualize-screenshots.md +34 -0
  224. package/workflows/ads/ads-analyst.md +201 -0
  225. package/workflows/ads/ads-audit.md +106 -0
  226. package/workflows/ads/ads-optimize.md +97 -0
  227. package/workflows/ads/ads-targeting.md +241 -0
  228. package/workflows/ads/adsExpert.md +160 -0
  229. package/workflows/ads/smali-ads-config.md +400 -0
  230. package/workflows/ads/smali-ads-flow.md +331 -0
  231. package/workflows/ads/smali-ads-interstitial.md +377 -0
  232. package/workflows/ads/smali-ads-native.md +382 -0
  233. package/workflows/context/teach.md +89 -0
  234. package/workflows/gitnexus.md +8 -8
  235. package/workflows/lifecycle/brainstorm.md +43 -0
  236. package/workflows/lifecycle/code.md +5 -0
  237. package/workflows/lifecycle/init.md +23 -5
  238. package/workflows/lifecycle/multi-model-pipeline.md +60 -0
  239. package/workflows/quality/ponytail-review.md +59 -0
  240. package/workflows/roles/critic.md +40 -0
  241. package/workflows/roles/safety-router.md +34 -0
@@ -0,0 +1,331 @@
1
+ ---
2
+ description: 📺 Tích hợp Ads Flow vào APK mod (Smali) - Splash → Ads → Onboarding → Home
3
+ ---
4
+
5
+ # Smali Ads Flow Integration
6
+
7
+ > **🎯 Mục tiêu**: Tạo luồng quảng cáo trong APK mod bằng cách hook vào Splash Activity có sẵn.
8
+
9
+ ---
10
+
11
+ ## 📋 Flow Logic Overview
12
+
13
+ ### First Launch (Lần đầu)
14
+ ```
15
+ Splash → Inter Ad (100%) → Onboarding + Native Ads → Inter Ad (100%) → Home
16
+ ```
17
+
18
+ ### Return Visit (Lần 2+)
19
+ ```
20
+ Splash → Inter Ad (random mỗi 3-5 lần) → Home
21
+ ```
22
+
23
+ ---
24
+
25
+ ## 🎬 Phase 1: Phân Tích Entry Points
26
+
27
+ **Prerequisites**: Đã decompile APK (xem `apk-modifier` skill)
28
+
29
+ ### 1.1. Xác định Splash Activity
30
+
31
+ ```bash
32
+ # Tìm LAUNCHER Activity trong AndroidManifest.xml
33
+ grep -r "android.intent.category.LAUNCHER" AndroidManifest.xml
34
+
35
+ # Kiểm tra có Splash Activity riêng không
36
+ find smali* -name "*Splash*.smali"
37
+ ```
38
+
39
+ **Kết quả mong đợi:**
40
+ - **Scenario A**: App có `SplashActivity` riêng
41
+ - **Scenario B**: `MainActivity` là LAUNCHER (không có Splash)
42
+
43
+ ### 1.2. Phân tích Navigation Flow
44
+
45
+ **Sử dụng jadx để hiểu logic:**
46
+ ```bash
47
+ jadx-gui target.apk
48
+ ```
49
+
50
+ **Cần xác định:**
51
+ - Method chứa navigation logic (ví dụ: `navigateToMain()`, `goHome()`)
52
+ - Delay mechanism (Handler.postDelayed, Timer, etc.)
53
+ - Target activity (MainActivity class name)
54
+
55
+ **Document findings:**
56
+ ```
57
+ Current Flow: [Splash/MainActivity] → [Activity?] → [FinalActivity]
58
+ Navigation Method: navigateToMain() / goHome() / etc.
59
+ Target Activity: com.example.app.MainActivity
60
+ ```
61
+
62
+ ---
63
+
64
+ ## 📦 Phase 2: Thiết Kế Components
65
+
66
+ ### 2.1. Cấu trúc SDK cần tạo
67
+
68
+ ```
69
+ {SDK_DIR}/
70
+ ├── config/
71
+ │ └── AppPreferences.smali # Quản lý state & random logic
72
+ └── activities/
73
+ └── OnboardingActivity.smali # Onboarding với Native Ads
74
+ ```
75
+
76
+ **Note**:
77
+ - `{SDK_DIR}` = thư mục SDK bạn chọn (ví dụ: `smali_classes2/com/myads/`)
78
+ - Package name tùy chỉnh theo dự án
79
+
80
+ ### 2.2. Config Strategy
81
+
82
+ **Option 1**: JSON config file trong assets
83
+ ```json
84
+ {
85
+ "ad_ids": {...},
86
+ "frequency": {"min": 3, "max": 5},
87
+ "main_activity": "com.target.app.MainActivity"
88
+ }
89
+ ```
90
+
91
+ **Option 2**: Hardcode trong Smali constants
92
+ ```smali
93
+ .field private static final INTER_FREQUENCY_MIN:I = 0x3
94
+ .field private static final INTER_FREQUENCY_MAX:I = 0x5
95
+ ```
96
+
97
+ ---
98
+
99
+ ## 🔧 Phase 3: Implementation Strategy
100
+
101
+ ### 3.1. Component: AppPreferences
102
+
103
+ **Chức năng cần implement:**
104
+
105
+ | Method | Mục đích | Return |
106
+ |--------|----------|--------|
107
+ | `isFirstLaunch()` | Kiểm tra lần đầu mở app | boolean |
108
+ | `setFirstLaunchDone()` | Đánh dấu đã onboarding | void |
109
+ | `incrementOpenCount()` | Tăng counter mỗi lần mở | int |
110
+ | `shouldShowInterAd()` | Random 3-5 lần | boolean |
111
+
112
+ **Storage**: SharedPreferences
113
+
114
+ **Implementation**: Xem chi tiết Smali syntax trong `apk-modifier` skill
115
+
116
+ ---
117
+
118
+ ### 3.2. Injection Strategy
119
+
120
+ #### Scenario A: App có SplashActivity
121
+
122
+ **Hook Point 1: onCreate()**
123
+ ```
124
+ Location: SplashActivity.smali
125
+ Action: Inject tracking
126
+ → Call incrementOpenCount()
127
+ ```
128
+
129
+ **Hook Point 2: Navigation Method**
130
+ ```
131
+ Location: navigateToMain() / goHome() / etc.
132
+ Action: Inject flow logic
133
+ → if isFirstLaunch() → go to Onboarding
134
+ → else if shouldShowInterAd() → show Inter
135
+ → else → go to MainActivity
136
+ ```
137
+
138
+ ---
139
+
140
+ #### Scenario B: MainActivity là LAUNCHER
141
+
142
+ **Hook Point: onCreate()**
143
+ ```
144
+ Location: MainActivity.smali
145
+ Action 1: Tạo method mới checkAdsFlow()
146
+ Action 2: Inject call vào đầu onCreate()
147
+ → Call checkAdsFlow()
148
+ → Logic tương tự Scenario A
149
+ ```
150
+
151
+ ---
152
+
153
+ ### 3.3. Component: OnboardingActivity
154
+
155
+ **Chức năng:**
156
+ - ViewPager/HorizontalScrollView với N slides
157
+ - Native Ad container (giữa hoặc cuối slides)
158
+ - Next/Skip buttons
159
+ - Khi complete → call `setFirstLaunchDone()`
160
+
161
+ **Navigation:**
162
+ ```
163
+ OnboardingActivity → [Show Inter Ad?] → MainActivity
164
+ ```
165
+
166
+ ---
167
+
168
+ ## 🔌 Phase 4: Integration
169
+
170
+ ### 4.1. AndroidManifest Changes
171
+
172
+ **Thêm permissions:**
173
+ ```xml
174
+ <uses-permission android:name="android.permission.INTERNET" />
175
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
176
+ ```
177
+
178
+ **Thêm AdMob App ID:**
179
+ ```xml
180
+ <meta-data
181
+ android:name="com.google.android.gms.ads.APPLICATION_ID"
182
+ android:value="ca-app-pub-{YOUR_PUBLISHER_ID}~{APP_ID}"/>
183
+ ```
184
+
185
+ **Đăng ký OnboardingActivity:**
186
+ ```xml
187
+ <activity
188
+ android:name="{YOUR_PACKAGE}.activities.OnboardingActivity"
189
+ android:exported="false"
190
+ android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
191
+ ```
192
+
193
+ **⚠️ Quan trọng**: KHÔNG thay đổi LAUNCHER activity
194
+
195
+ ---
196
+
197
+ ### 4.2. Copy Dependencies
198
+
199
+ ```bash
200
+ # Tùy project structure, có thể là smali, smali_classes2, etc.
201
+
202
+ # Copy AdMob libraries (nếu chưa có)
203
+ # Thường nằm trong com/google/android/gms/ads/
204
+
205
+ # Verify method count
206
+ find smali* -name "*.smali" | wc -l # Phải < 60,000
207
+ ```
208
+
209
+ ---
210
+
211
+ ### 4.3. Reference Validation
212
+
213
+ **Kiểm tra injection đúng:**
214
+ ```bash
215
+ # Tìm tất cả reference đến AppPreferences
216
+ grep -r "AppPreferences" smali*/
217
+
218
+ # Tìm reference đến OnboardingActivity
219
+ grep -r "OnboardingActivity" smali*/
220
+ ```
221
+
222
+ **Expected**: Thấy reference trong Splash/MainActivity
223
+
224
+ ---
225
+
226
+ ## 📺 Phase 5: Ads Implementation
227
+
228
+ > **Tách workflow riêng**: `/smali-ads-interstitial`, `/smali-ads-native`
229
+
230
+ **Tổng quan:**
231
+ 1. **Interstitial Ads**
232
+ - Load khi Splash onCreate()
233
+ - Show sau Splash, sau Onboarding
234
+ - Show random theo `shouldShowInterAd()`
235
+
236
+ 2. **Native Ads**
237
+ - Load trong OnboardingActivity
238
+ - Display trong ad container
239
+ - Cleanup khi destroy
240
+
241
+ **Chi tiết**: Xem workflows riêng
242
+
243
+ ---
244
+
245
+ ## ✅ Phase 6: Build & Test
246
+
247
+ ```
248
+
249
+ ### 6.2. Test Scenarios
250
+
251
+ | Scenario | Expected Behavior | Verification |
252
+ |----------|-------------------|--------------|
253
+ | **First Launch** | Splash → [Inter?] → Onboarding → [Inter?] → Home | Clear app data, launch |
254
+ | **2nd Launch** | Splash → Home (no ads) | Launch again |
255
+ | **3rd-5th Random** | Splash → [Inter random] → Home | Launch 10+ times, observe pattern |
256
+ | **Onboarding Skip** | Skip button works, navigate correctly | Test skip button |
257
+
258
+ ### 6.3. Debug Commands
259
+
260
+ ```bash
261
+ # Monitor flow events
262
+ adb logcat | grep -E "Preference|Onboarding|Navigation"
263
+
264
+ # Check SharedPreferences state
265
+ adb shell run-as {package} cat /data/data/{package}/shared_prefs/*.xml
266
+
267
+ # Extract & verify counter
268
+ # Should see: open_count, next_ad_count, first_launch values
269
+ ```
270
+
271
+ ---
272
+
273
+ ## 📋 Implementation Checklist
274
+
275
+ ### Pre-Implementation
276
+ - [ ] APK đã decompile xong
277
+ - [ ] Xác định Splash/MainActivity và navigation method
278
+ - [ ] Document flow hiện tại
279
+ - [ ] Backup APK gốc
280
+
281
+ ### Core Components
282
+ - [ ] Tạo AppPreferences với 4 methods
283
+ - [ ] Implement random logic (3-5 range)
284
+ - [ ] Tạo OnboardingActivity skeleton
285
+ - [ ] Test SharedPreferences đọc/ghi đúng
286
+
287
+ ### Injection
288
+ - [ ] Hook vào onCreate() - tracking
289
+ - [ ] Hook vào navigation method - flow logic
290
+ - [ ] Test first launch flow
291
+ - [ ] Test return visit flow
292
+
293
+ ### Integration
294
+ - [ ] Update AndroidManifest
295
+ - [ ] Copy dependencies (check method count)
296
+ - [ ] Validate all references
297
+ - [ ] Build thành công (no errors)
298
+
299
+ ### Testing
300
+ - [ ] First launch: đúng flow
301
+ - [ ] Return visit: random đúng (test 10+ lần)
302
+ - [ ] Onboarding: skip/next works
303
+ - [ ] No crashes, no ANR
304
+
305
+ ---
306
+
307
+ ## 🔗 Related Resources
308
+
309
+ ### Workflows
310
+ - `/smali-ads-interstitial` - Interstitial Ads implementation
311
+ - `/smali-ads-native` - Native Ads implementation
312
+ - `/smali-ads-config` - Remote Config cho Ad settings
313
+
314
+ ### Skills & Docs
315
+ - **Skill**: `apk-modifier` - Smali techniques & examples
316
+ - **Cheatsheet**: `SMALI_CHEATSHEET.md` - Syntax reference
317
+ - **Tool**: jadx-gui - Decompile để đọc logic
318
+
319
+ ---
320
+
321
+ ## 💡 Tips & Best Practices
322
+
323
+ 1. **Package Naming**: Chọn tên package phù hợp với app để tránh confusion
324
+ 2. **Method Count**: Monitor liên tục, phân bổ sang smali_classes* nếu cần
325
+ 3. **Testing**: Test với nhiều scenarios, đặc biệt random logic
326
+ 4. **Logging**: Thêm Log.d() trong Smali để debug flow
327
+ 5. **Backup**: Luôn giữ backup trước mỗi thay đổi lớn
328
+
329
+ ---
330
+
331
+ **⚠️ Note**: Workflow này chỉ tập trung vào **FLOW LOGIC**. Chi tiết Ads implementation xem workflows riêng.
@@ -0,0 +1,377 @@
1
+ ---
2
+ description: 📱 Tích hợp Interstitial Ads vào APK mod - Tận dụng library có sẵn
3
+ ---
4
+
5
+ # Smali Interstitial Ads Integration
6
+
7
+ > **🎯 Mục tiêu**: Tích hợp Interstitial Ads bằng cách tận dụng ads library có sẵn trong APK.
8
+
9
+ ---
10
+
11
+ ## 🔍 Phase 1: Discovery - Tìm Ads Library có sẵn
12
+
13
+ ### 1.1. Scan toàn bộ cấu trúc
14
+
15
+ **Pattern 1: Tìm theo tên thư mục**
16
+ ```bash
17
+ # Tìm các thư mục có chứa "ad"
18
+ find smali* -type d -iname "*ad*"
19
+
20
+ # Patterns thường gặp:
21
+ # - */ads/, */adslib/, */admanager/
22
+ # - */admob/, */admod/, */adsdk/
23
+ # - */advertisement/, */adnetwork/
24
+ ```
25
+
26
+ **Pattern 2: Tìm theo package Google**
27
+ ```bash
28
+ # AdMob SDK chính thống
29
+ find smali* -path "*/com/google/android/gms/ads/*" -type d
30
+
31
+ # Firebase Ads
32
+ find smali* -path "*/com/google/firebase/ads/*" -type d
33
+ ```
34
+
35
+ **Pattern 3: Tìm theo custom wrapper**
36
+ ```bash
37
+ # Tìm trong package chính của app
38
+ find smali*/{main_package}/* -type d -iname "*ad*"
39
+ ```
40
+
41
+ ### 1.2. Identify Interstitial Components
42
+
43
+ **Search Strategy:**
44
+ ```bash
45
+ # Tìm file có chứa "Inter" và liên quan đến ad
46
+ find smali* -name "*Inter*.smali" | xargs grep -l "Lcom/google/android/gms/ads"
47
+
48
+ # Tìm theo keyword khác
49
+ find smali* -name "*.smali" | xargs grep -l "interstitial\|InterstitialAd"
50
+
51
+ # Tìm theo usage pattern
52
+ find smali* -name "*.smali" | xargs grep -l "loadInterstitialAd\|showInterstitialAd"
53
+ ```
54
+
55
+ **Common class names (chỉ tham khảo):**
56
+ - `*InterstitialAd*.smali`
57
+ - `*InterAd*.smali`
58
+ - `*FullscreenAd*.smali`
59
+ - `*AdManager*.smali` (có thể chứa inter logic)
60
+
61
+ ### 1.3. Reverse Engineer Implementation
62
+
63
+ **Step 1: Jadx analysis**
64
+ ```bash
65
+ jadx-gui target.apk
66
+ ```
67
+
68
+ **Tìm kiếm:**
69
+ 1. Search "InterstitialAd" trong jadx
70
+ 2. Xem existing usage trong app
71
+ 3. Document class hierarchy
72
+ 4. Note down package structure
73
+
74
+ **Step 2: Document API**
75
+ ```
76
+ [Findings Template]
77
+
78
+ Ads Library Location: smali_classes*/{discovered_path}/
79
+ Interstitial Class: {ClassName}.smali
80
+ Package: {full.package.name}
81
+
82
+ Methods Found:
83
+ - Constructor: <init>(...)
84
+ - Load: {methodName}(...)
85
+ - Show: {methodName}(...)
86
+ - Check Ready: {methodName}()
87
+
88
+ Callbacks:
89
+ - Interface: {CallbackInterfaceName}
90
+ - Methods: onAdLoaded(), onAdClosed(), etc.
91
+
92
+ Current Usage:
93
+ - Used in: {ActivityName}.smali
94
+ - Called from: {methodName}()
95
+ ```
96
+
97
+ ---
98
+
99
+ ## 📦 Phase 2: API Analysis
100
+
101
+ ### 2.1. Understand Method Signatures
102
+
103
+ **Sử dụng jadx để xem Java code:**
104
+ ```java
105
+ // Example pattern (structure varies)
106
+ public class InterstitialAdHelper {
107
+ public void init(Context context, String adId);
108
+ public void loadAd();
109
+ public void show(Activity activity);
110
+ public boolean isReady();
111
+ public void setListener(AdListener listener);
112
+ }
113
+ ```
114
+
115
+ **Convert to Smali signatures:**
116
+ ```smali
117
+ .method public init(Landroid/content/Context;Ljava/lang/String;)V
118
+ .method public loadAd()V
119
+ .method public show(Landroid/app/Activity;)V
120
+ .method public isReady()Z
121
+ .method public setListener(L{package}/AdListener;)V
122
+ ```
123
+
124
+ ### 2.2. Identify Dependencies
125
+
126
+ **Check AdMob presence:**
127
+ ```bash
128
+ # Core AdMob classes
129
+ ls smali*/com/google/android/gms/ads/ 2>/dev/null
130
+
131
+ # If missing, need to copy from:
132
+ # - Another APK with AdMob
133
+ # - Extract from Google Play Services AAR
134
+ ```
135
+
136
+ **Check custom wrappers:**
137
+ ```bash
138
+ # Tìm dependency classes
139
+ grep -r "import.*AdRequest\|import.*InterstitialAd" smali*/ | head -20
140
+ ```
141
+
142
+ ---
143
+
144
+ ## 🔧 Phase 3: Wrapper Creation
145
+
146
+ ### 3.1. Tạo Wrapper Class (Option)
147
+
148
+ **Mục đích**: Standardize API để dễ sử dụng
149
+
150
+ ```
151
+ {SDK_DIR}/ads/InterstitialWrapper.smali
152
+ ```
153
+
154
+ **Chức năng:**
155
+ - Wrap existing library
156
+ - Handle lifecycle
157
+ - Provide clean API
158
+ - Manage ad caching
159
+
160
+ **Methods cần có:**
161
+ ```
162
+ init(Context, String adId) → Initialize
163
+ load() → Load ad
164
+ show(Activity) → Show ad
165
+ isReady() → Check ready state
166
+ destroy() → Cleanup
167
+ ```
168
+
169
+ ### 3.2. State Management
170
+
171
+ **Track states:**
172
+ - `NOT_LOADED` - Chưa load
173
+ - `LOADING` - Đang load
174
+ - `LOADED` - Đã load, ready
175
+ - `SHOWING` - Đang hiển thị
176
+ - `CLOSED` - Đã đóng
177
+
178
+ **Implementation**: Dùng enum hoặc int constants
179
+
180
+ ---
181
+
182
+ ## 🎯 Phase 4: Integration Points
183
+
184
+ ### 4.1. Load Ad - Khi nào?
185
+
186
+ **Strategy 1: Pre-load sớm**
187
+ ```
188
+ Application.onCreate() → Load ad
189
+ Splash.onCreate() → Load ad
190
+ ```
191
+ **Pros**: Ad sẵn sàng khi cần
192
+ **Cons**: Tốn resources nếu user không trigger
193
+
194
+ **Strategy 2: On-demand**
195
+ ```
196
+ Before navigation → Load ad → Show ad
197
+ ```
198
+ **Pros**: Tiết kiệm resources
199
+ **Cons**: Có delay khi show
200
+
201
+ ### 4.2. Show Ad - Ở đâu?
202
+
203
+ **Theo `/smali-ads-flow`:**
204
+ - Sau Splash (first launch)
205
+ - Sau Onboarding (first launch)
206
+ - Random 3-5 lần (return visit)
207
+
208
+ **Implementation:**
209
+ ```
210
+ Location: SplashActivity.navigateToMain()
211
+ Action: Insert show ad logic
212
+ → if shouldShowAd():
213
+ → interstitialWrapper.show(this)
214
+ → onAdClosed: navigate to next screen
215
+ → else:
216
+ → navigate directly
217
+ ```
218
+
219
+ ### 4.3. Handle Callbacks
220
+
221
+ **OnAdClosed callback:**
222
+ - Navigate to next screen
223
+ - Resume app flow
224
+ - Load next ad (pre-cache)
225
+
226
+ **OnAdFailedToLoad:**
227
+ - Fallback: skip ad, continue flow
228
+ - Log error for debugging
229
+ - Retry với exponential backoff?
230
+
231
+ ---
232
+
233
+ ## 🔌 Phase 5: Hook Implementation
234
+
235
+ ### 5.1. Hook Point Template
236
+
237
+ **Generic pattern:**
238
+ ```smali
239
+ # Original code
240
+ .method private navigateToNextScreen()V
241
+ # ... navigation logic ...
242
+ .end method
243
+ ```
244
+
245
+ **After injection:**
246
+ ```smali
247
+ .method private navigateToNextScreen()V
248
+ # Check if should show ad
249
+ invoke-static {p0}, {AdHelper};->shouldShowInterAd()Z
250
+ move-result v0
251
+
252
+ if-eqz v0, :skip_ad
253
+
254
+ # Show inter ad
255
+ invoke-static {p0}, {InterWrapper};->show(Activity)V
256
+ # Ad callback will handle navigation
257
+ return-void
258
+
259
+ :skip_ad
260
+ # Original navigation logic
261
+ # ...
262
+ .end method
263
+ ```
264
+
265
+ ### 5.2. Callback Handler
266
+
267
+ **Create callback class:**
268
+ ```
269
+ {SDK_DIR}/ads/InterstitialCallback.smali
270
+ ```
271
+
272
+ **Implement:**
273
+ ```
274
+ onAdClosed() {
275
+ // Resume navigation
276
+ navigateToNextScreen()
277
+ }
278
+
279
+ onAdFailedToShow() {
280
+ // Fallback
281
+ navigateToNextScreen()
282
+ }
283
+ ```
284
+
285
+ ---
286
+
287
+ ## ✅ Phase 6: Testing & Validation
288
+
289
+ ### 6.1. Functional Tests
290
+
291
+ | Test Case | Expected | Command |
292
+ |-----------|----------|---------|
293
+ | **Load Success** | Ad loads, isReady=true | Monitor logcat |
294
+ | **Show Success** | Ad displays fullscreen | Visual check |
295
+ | **Callback Fired** | onAdClosed called | Check logs |
296
+ | **Navigation** | Nav to next screen after ad | Flow test |
297
+ | **No Network** | Fallback, skip ad | Airplane mode test |
298
+
299
+ ### 6.2. Integration Tests
300
+
301
+ **With `/smali-ads-flow`:**
302
+ - First launch: Show after Splash ✓
303
+ - First launch: Show after Onboarding ✓
304
+ - Return visit: Random 3-5 times ✓
305
+
306
+ ### 6.3. Debug Commands
307
+
308
+ ```bash
309
+ # Monitor ad events
310
+ adb logcat | grep -E "InterstitialAd|AdMob|onAd"
311
+
312
+ # Test ad with test ID
313
+ # Replace ad unit ID with test ID:
314
+ # ca-app-pub-3940256099942544/1033173712 (Android Test Inter)
315
+
316
+ # Force show ad (for testing)
317
+ # Modify shouldShowInterAd() to always return true
318
+ ```
319
+
320
+ ---
321
+
322
+ ## 📋 Implementation Checklist
323
+
324
+ ### Discovery
325
+ - [ ] Tìm được ads library trong APK
326
+ - [ ] Xác định Interstitial class
327
+ - [ ] Document API methods
328
+ - [ ] Check dependencies đầy đủ
329
+
330
+ ### Wrapper (Optional)
331
+ - [ ] Tạo wrapper class
332
+ - [ ] Implement init/load/show
333
+ - [ ] Handle state management
334
+ - [ ] Test wrapper riêng lẻ
335
+
336
+ ### Integration
337
+ - [ ] Xác định hook points (từ `/smali-ads-flow`)
338
+ - [ ] Inject load ad logic
339
+ - [ ] Inject show ad logic
340
+ - [ ] Implement callbacks
341
+
342
+ ### Testing
343
+ - [ ] Load ad thành công
344
+ - [ ] Show ad thành công
345
+ - [ ] Callback navigation đúng
346
+ - [ ] Fallback khi no network
347
+ - [ ] Integration với flow logic
348
+
349
+ ---
350
+
351
+ ## 🔗 Related Resources
352
+
353
+ ### Workflows
354
+ - `/smali-ads-flow` - Main flow logic
355
+ - `/smali-ads-native` - Native ads
356
+ - `/smali-ads-config` - Remote config
357
+
358
+ ### Skills
359
+ - `apk-modifier` - Smali techniques
360
+
361
+ ### References
362
+ - [AdMob Interstitial Docs](https://developers.google.com/admob/android/interstitial)
363
+ - [AdMob Test Ads](https://developers.google.com/admob/android/test-ads)
364
+
365
+ ---
366
+
367
+ ## 💡 Tips & Best Practices
368
+
369
+ 1. **Reuse existing library**: Tận dụng library có sẵn thay vì viết từ đầu
370
+ 2. **Test ID first**: Dùng test ad ID khi debug để tránh invalid traffic
371
+ 3. **Fallback gracefully**: Luôn có fallback khi ad fail
372
+ 4. **Pre-load smart**: Load ad sớm nhưng đừng lãng phí resources
373
+ 5. **Respect ad policies**: Không force click, không spam ads
374
+
375
+ ---
376
+
377
+ **⚠️ Quan trọng**: Tuân thủ AdMob policies để tránh bị ban account!