Skip to content

Commit

Permalink
refactor(mobile): upgrade capacitor to v4
Browse files Browse the repository at this point in the history
  • Loading branch information
andelf authored and tiensonqin committed Sep 15, 2022
1 parent 23ecc64 commit 6dc5517
Show file tree
Hide file tree
Showing 14 changed files with 159 additions and 134 deletions.
2 changes: 2 additions & 0 deletions android/app/build.gradle
Expand Up @@ -30,6 +30,8 @@ repositories {
}

dependencies {
implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation project(':capacitor-android')
Expand Down
4 changes: 2 additions & 2 deletions android/app/capacitor.build.gradle
Expand Up @@ -2,8 +2,8 @@

android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}

Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Expand Up @@ -12,6 +12,7 @@
android:theme="@style/AppTheme">

<activity
android:exported="true"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
android:name="com.logseq.app.MainActivity"
android:label="@string/title_activity_main"
Expand Down
4 changes: 4 additions & 0 deletions android/app/src/main/assets/capacitor.config.json
Expand Up @@ -17,5 +17,9 @@
},
"ios": {
"scheme": "Logseq"
},
"server": {
"url": "http://192.168.199.241:3001",
"cleartext": true
}
}
2 changes: 1 addition & 1 deletion android/app/src/main/java/com/logseq/app/MainActivity.java
Expand Up @@ -12,10 +12,10 @@
public class MainActivity extends BridgeActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
registerPlugin(FolderPicker.class);
registerPlugin(FsWatcher.class);
registerPlugin(FileSync.class);
super.onCreate(savedInstanceState);

new Timer().schedule(new TimerTask() {
@Override
Expand Down
4 changes: 2 additions & 2 deletions android/app/src/main/res/values/styles.xml
Expand Up @@ -9,14 +9,14 @@
<item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.NoActionBar">
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:background">@null</item>
<item name="android:windowIsTranslucent">true</item>
</style>

<style name="AppTheme.NoActionBarLaunch" parent="AppTheme.NoActionBar">
<style name="AppTheme.NoActionBarLaunch" parent="Theme.SplashScreen">
<item name="android:background">@drawable/splash</item>
</style>
</resources>
7 changes: 5 additions & 2 deletions android/build.gradle
Expand Up @@ -5,10 +5,11 @@ buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.1'
classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.android.tools.build:gradle:7.2.1'
classpath 'com.google.gms:google-services:4.3.13'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -21,9 +22,11 @@ allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
26 changes: 14 additions & 12 deletions android/variables.gradle
@@ -1,14 +1,16 @@
ext {
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
androidxActivityVersion = '1.2.0'
androidxAppCompatVersion = '1.2.0'
androidxCoordinatorLayoutVersion = '1.1.0'
androidxCoreVersion = '1.3.2'
androidxFragmentVersion = '1.3.0'
junitVersion = '4.13.1'
androidxJunitVersion = '1.1.2'
androidxEspressoCoreVersion = '3.3.0'
cordovaAndroidVersion = '7.0.0'
minSdkVersion = 22
compileSdkVersion = 32
targetSdkVersion = 32
androidxActivityVersion = '1.4.0'
androidxAppCompatVersion = '1.4.2'
androidxCoordinatorLayoutVersion = '1.2.0'
androidxCoreVersion = '1.8.0'
androidxFragmentVersion = '1.4.1'
junitVersion = '4.13.2'
androidxJunitVersion = '1.1.3'
androidxEspressoCoreVersion = '3.4.0'
cordovaAndroidVersion = '10.1.1'
coreSplashScreenVersion = '1.0.0-rc01'
androidxWebkitVersion = '1.4.0'
}
11 changes: 1 addition & 10 deletions ios/App/App/AppDelegate.swift
Expand Up @@ -47,14 +47,5 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
return ApplicationDelegateProxy.shared.application(application, continue: userActivity, restorationHandler: restorationHandler)
}

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event)

let statusBarRect = UIApplication.shared.statusBarFrame
guard let touchPoint = event?.allTouches?.first?.location(in: self.window) else { return }

if statusBarRect.contains(touchPoint) {
NotificationCenter.default.post(name: .capacitorStatusBarTapped, object: nil)
}
}
}

5 changes: 0 additions & 5 deletions ios/App/App/Info.plist
Expand Up @@ -50,11 +50,6 @@
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>NSCameraUsageDescription</key>
<string>We will access your camera when you take a photo, and embed it in your note.</string>
<key>NSDocumentsFolderUsageDescription</key>
Expand Down
9 changes: 8 additions & 1 deletion ios/App/Podfile
@@ -1,4 +1,6 @@
platform :ios, '12.0'
require_relative '../../node_modules/@capacitor/ios/scripts/pods_helpers'

platform :ios, '13.0'
use_frameworks!

# workaround to avoid Xcode caching of Pods that requires
Expand Down Expand Up @@ -29,3 +31,8 @@ target 'Logseq' do
pod 'AWSS3'
pod 'AgeEncryption', :podspec => './LogseqSpecs/AgeEncryption.podspec'
end


post_install do |installer|
assertDeploymentTarget(installer)
end
30 changes: 15 additions & 15 deletions package.json
Expand Up @@ -5,7 +5,7 @@
"main": "static/electron.js",
"devDependencies": {
"@axe-core/playwright": "^4.4.4",
"@capacitor/cli": "3.2.2",
"@capacitor/cli": "^4.0.0",
"@playwright/test": "^1.24.2",
"@tailwindcss/ui": "0.7.2",
"@types/gulp": "^4.0.7",
Expand All @@ -14,6 +14,7 @@
"del": "^6.0.0",
"gulp": "^4.0.2",
"gulp-clean-css": "^4.3.0",
"ip": "1.1.8",
"npm-run-all": "^4.1.5",
"playwright": "^1.24.2",
"postcss": "8.4.16",
Expand All @@ -26,8 +27,7 @@
"stylelint": "^13.8.0",
"stylelint-config-standard": "^20.0.0",
"tailwindcss": "2.2.16",
"typescript": "^4.4.3",
"ip": "1.1.8"
"typescript": "^4.4.3"
},
"scripts": {
"watch": "run-p gulp:watch cljs:watch",
Expand Down Expand Up @@ -69,18 +69,18 @@
"android:dev": "cross-env PLATFORM=android gulp cap"
},
"dependencies": {
"@capacitor/android": "3.2.2",
"@capacitor/app": "1.0.6",
"@capacitor/camera": "1.2.1",
"@capacitor/clipboard": "^1.0.8",
"@capacitor/core": "3.2.2",
"@capacitor/filesystem": "1.0.6",
"@capacitor/haptics": "^1.1.4",
"@capacitor/ios": "3.2.2",
"@capacitor/keyboard": "^1.2.0",
"@capacitor/share": "^1.1.2",
"@capacitor/splash-screen": "1.1.3",
"@capacitor/status-bar": "1.0.6",
"@capacitor/android": "^4.0.0",
"@capacitor/app": "^4.0.0",
"@capacitor/camera": "^4.0.0",
"@capacitor/clipboard": "^4.0.0",
"@capacitor/core": "^4.0.0",
"@capacitor/filesystem": "^4.0.0",
"@capacitor/haptics": "^4.0.0",
"@capacitor/ios": "^4.0.0",
"@capacitor/keyboard": "^4.0.0",
"@capacitor/share": "^4.0.0",
"@capacitor/splash-screen": "^4.0.0",
"@capacitor/status-bar": "^4.0.0",
"@excalidraw/excalidraw": "0.10.0",
"@kanru/rage-wasm": "0.2.1",
"@logseq/react-tweet-embed": "1.3.1-1",
Expand Down

0 comments on commit 6dc5517

Please sign in to comment.