diff --git a/app.config.js b/app.config.js index a350cb2..ddb73a0 100644 --- a/app.config.js +++ b/app.config.js @@ -4,7 +4,7 @@ export default { expo: { name: "mobile-darmasaba", slug: "mobile-darmasaba", - version: "1.0.1", + version: "1.0.2", jsEngine: "jsc", orientation: "portrait", icon: "./assets/images/icon.png", @@ -21,12 +21,19 @@ export default { }, android: { package: "mobiledarmasaba.app", - versionCode: 2, + versionCode: 6, adaptiveIcon: { foregroundImage: "./assets/images/splash-icon.png", backgroundColor: "#ffffff" }, - googleServicesFile: "./google-services.json" + googleServicesFile: "./google-services.json", + permissions: [ + "READ_EXTERNAL_STORAGE", + "WRITE_EXTERNAL_STORAGE", + "READ_MEDIA_IMAGES", // Android 13+ + "READ_MEDIA_VIDEO", // Android 13+ + "READ_MEDIA_AUDIO" // Android 13+ + ] }, web: { bundler: "metro", diff --git a/bump-version.js b/bump-version.js new file mode 100644 index 0000000..d6ec7c3 --- /dev/null +++ b/bump-version.js @@ -0,0 +1,38 @@ +const fs = require("fs"); +const path = require("path"); + +const configPath = path.join(__dirname, "app.config.js"); +let configFile = fs.readFileSync(configPath, "utf8"); + +// --- Update versionCode --- +const codeRegex = /versionCode:\s*(\d+)/; +const codeMatch = configFile.match(codeRegex); + +if (!codeMatch) { + console.error("❌ Tidak menemukan versionCode di app.config.js"); + process.exit(1); +} + +const currentCode = parseInt(codeMatch[1], 10); +const newCode = currentCode + 1; +configFile = configFile.replace(codeRegex, `versionCode: ${newCode}`); + +// --- Update versionName --- +const nameRegex = /version:\s*"(.*?)"/; +const nameMatch = configFile.match(nameRegex); + +if (!nameMatch) { + console.error("❌ Tidak menemukan version di app.config.js"); + process.exit(1); +} + +let [major, minor, patch] = nameMatch[1].split(".").map(Number); +patch += 1; // bump patch version +const newName = `${major}.${minor}.${patch}`; +configFile = configFile.replace(nameRegex, `version: "${newName}"`); + +// --- Simpan file --- +fs.writeFileSync(configPath, configFile, "utf8"); + +console.log(`✅ versionCode: ${currentCode} → ${newCode}`); +console.log(`✅ versionName: ${nameMatch[1]} → ${newName}`); diff --git a/eas.json b/eas.json index 1545412..481c66b 100644 --- a/eas.json +++ b/eas.json @@ -1,7 +1,7 @@ { "cli": { "version": ">= 16.10.0", - "appVersionSource": "remote" + "appVersionSource": "local" }, "build": { "development": { @@ -53,4 +53,4 @@ } } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 31b5d7b..c81e9d6 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,9 @@ "ios": "expo run:ios", "web": "expo start --web", "test": "jest --watchAll", - "lint": "expo lint" + "lint": "expo lint", + "bump": "node bump-version.js", + "build:android": "npm run bump && eas build -p android --profile production" }, "jest": { "preset": "jest-expo"