Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

add ios widget

ammarahm-ed1fd90eb9225d
diff --git a/apps/mobile/App.js b/apps/mobile/App.js
index 39a51cfd8..42566d0eb 100644
--- a/apps/mobile/App.js
+++ b/apps/mobile/App.js
@@ -1,30 +1,28 @@
-import React, {useEffect, useState} from 'react';
-import {View} from 'react-native';
+import React, { useEffect, useState } from 'react';
+import { View } from 'react-native';
import Orientation from 'react-native-orientation';
-import Animated, {Easing} from 'react-native-reanimated';
+import Animated, { Easing } from 'react-native-reanimated';
import AnimatedProgress from 'react-native-reanimated-progress-bar';
-import {SafeAreaProvider} from 'react-native-safe-area-context';
+import { SafeAreaProvider } from 'react-native-safe-area-context';
import SplashScreen from 'react-native-splash-screen';
-import {AppRootEvents} from './AppRootEvents';
-import {RootView} from './initializer.root';
-import {useTracked} from './src/provider';
-import {Actions} from './src/provider/Actions';
-import {DDS} from './src/services/DeviceDetection';
+import { AppRootEvents } from './AppRootEvents';
+import { RootView } from './initializer.root';
+import { useTracked } from './src/provider';
+import { Actions } from './src/provider/Actions';
+import { DDS } from './src/services/DeviceDetection';
import {
eSendEvent,
eSubscribeEvent,
- eUnSubscribeEvent,
+ eUnSubscribeEvent
} from './src/services/EventManager';
-import Navigation from './src/services/Navigation';
import SettingsService from './src/services/SettingsService';
import {
- changeAppScale,
changeContainerScale,
- ContainerScale,
+ ContainerScale
} from './src/utils/Animations';
-import {db} from './src/utils/DB';
-import {eDispatchAction, eOpenSideMenu} from './src/utils/Events';
-import {sleep} from './src/utils/TimeUtils';
+import { db } from './src/utils/DB';
+import { eDispatchAction, eOpenSideMenu } from './src/utils/Events';
+import { sleep } from './src/utils/TimeUtils';
import EditorRoot from './src/views/Editor/EditorRoot';
diff --git a/apps/mobile/AppRootEvents.js b/apps/mobile/AppRootEvents.js
index 7cec1bc13..a4cc16618 100644
--- a/apps/mobile/AppRootEvents.js
+++ b/apps/mobile/AppRootEvents.js
@@ -204,6 +204,8 @@ export const AppRootEvents = React.memo(
try {
if (url.startsWith('https://app.notesnook.com/account/verified')) {
await onEmailVerified();
+ } else if (url.startsWith("ShareMedia://MainApp")) {
+ await checkIntentState()
} else {
return;
}
diff --git a/apps/mobile/NotesnookShare.js b/apps/mobile/NotesnookShare.js
index b57ee564c..0da0d73e8 100644
--- a/apps/mobile/NotesnookShare.js
+++ b/apps/mobile/NotesnookShare.js
@@ -10,7 +10,7 @@ import {
View,
} from 'react-native';
import {ScrollView, TextInput} from 'react-native-gesture-handler';
-
+import SplashScreen from 'react-native-splash-screen';
import {COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT} from './src/utils/Colors';
import {db} from './src/utils/DB';
import {SIZE} from './src/utils/SizeUtils';
@@ -42,17 +42,19 @@ export default class NotesnookShare extends Component {
async componentDidMount() {
try {
- ShareExtension = require("rn-extensions-share").default
- validator = require("validator").default
- linkPreview = require("link-preview-js")
+ SplashScreen.hide();
+ ShareExtension = require('rn-extensions-share').default;
+ validator = require('validator').default;
+ linkPreview = require('link-preview-js');
const data = await ShareExtension.data();
+
let text;
if (!data) {
this.setState({
- loadingIntent:false,
- text:"",
- title:""
- })
+ loadingIntent: false,
+ text: '',
+ title: '',
+ });
return;
}
let item = data[0];
@@ -60,7 +62,8 @@ export default class NotesnookShare extends Component {
text = item.value;
}
if (validator.isURL(text)) {
- linkPreview.getLinkPreview(text)
+ linkPreview
+ .getLinkPreview(text)
.then((r) => {
if (r?.siteName) {
this.setState({
@@ -98,11 +101,11 @@ export default class NotesnookShare extends Component {
this.initialText = text;
} catch (e) {
- this.setState({
- loadingIntent:false,
- text:"",
- title:""
- })
+ this.setState({
+ loadingIntent: false,
+ text: '',
+ title: '',
+ });
console.log('errrr', e);
}
}
@@ -443,7 +446,7 @@ export default class NotesnookShare extends Component {
paddingTop: 0,
marginBottom: 10,
paddingHorizontal: 12,
- minHeight:100
+ minHeight: 100,
}}
textAlignVertical="top"
placeholderTextColor={this.state.colors.icon}
diff --git a/apps/mobile/QuickNoteIOS.js b/apps/mobile/QuickNoteIOS.js
new file mode 100644
index 000000000..9b8a6dc97
--- /dev/null
+++ b/apps/mobile/QuickNoteIOS.js
@@ -0,0 +1,224 @@
+import React, {Component, createRef} from 'react';
+import {SafeAreaView} from 'react-native';
+import {
+ ActivityIndicator,
+ Appearance,
+ KeyboardAvoidingView,
+ Modal,
+ Platform,
+ Text,
+ TouchableOpacity,
+ View,
+} from 'react-native';
+import {ScrollView, TextInput} from 'react-native-gesture-handler';
+import SplashScreen from 'react-native-splash-screen';
+import {COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT} from './src/utils/Colors';
+import {db} from './src/utils/DB';
+import {SIZE} from './src/utils/SizeUtils';
+import Storage from './src/utils/storage';
+import {sleep} from './src/utils/TimeUtils';
+import ShareExtension from 'rn-extensions-share';
+
+let validator;
+let linkPreview;
+export default class QuickNoteIOS extends Component {
+ constructor(props, context) {
+ super(props, context);
+ this.state = {
+ isOpen: true,
+ text: '',
+ title: '',
+ loading: false,
+ loadingIntent: false,
+ colors:
+ Appearance.getColorScheme() === 'dark'
+ ? COLOR_SCHEME_DARK
+ : COLOR_SCHEME_LIGHT,
+ height: 0,
+ };
+ this.initialText = '';
+ this.textInputRef = createRef();
+ this.titleInputRef = createRef();
+ }
+
+ componentDidMount() {
+ SplashScreen.hide();
+ sleep(300).then(r => {
+ this.textInputRef.current?.focus()
+ })
+ }
+
+ close = () => {
+ ShareExtension.openURL('ShareMedia://MainApp');
+ };
+
+ onPress = async () => {
+ this.titleInputRef.current?.blur();
+ this.textInputRef.current?.blur();
+ this.setState({
+ loading: true,
+ });
+
+ let tag = `<p>${this.state.text}</p>`;
+
+ let add = async () => {
+ await db.notes.add({
+ title: this.state.title,
+ content: {
+ type: 'tiny',
+ data: tag,
+ },
+ id: null,
+ });
+ };
+ if (db && db.notes) {
+ await add();
+ } else {
+ await db.init();
+ await add();
+ }
+ await Storage.write('notesAddedFromIntent', 'added');
+ await sleep(500);
+ this.close();
+ };
+
+ saveBtn = () => (
+ <View
+ style={{
+ paddingHorizontal: 12,
+ }}>
+ <TouchableOpacity
+ onPress={this.onPress}
+ activeOpacity={0.8}
+ style={{
+ backgroundColor: this.state.colors.accent,
+ width: '100%',
+ height: 50,
+ borderRadius: 5,
+ justifyContent: 'center',
+ alignItems: 'center',
+ flexDirection: 'row',
+ }}>
+ {this.state.loading && (
+ <ActivityIndicator color={this.state.colors.light} />
+ )}
+
+ <Text
+ style={{
+ fontSize: 18,
+ fontWeight: 'bold',
+ color: this.state.colors.light,
+ marginLeft: this.state.loading ? 10 : 0,
+ }}>
+ Save Note
+ </Text>
+ </TouchableOpacity>
+ </View>
+ );
+
+ render() {
+ return (
+ <SafeAreaView
+ style={{
+ width: '100%',
+ height: '100%',
+ justifyContent: 'flex-start',
+ backgroundColor: this.state.colors.bg,
+ }}>
+
+
+ <KeyboardAvoidingView
+ enabled={Platform.OS === 'ios'}
+ style={{
+ paddingVertical: 25,
+ backgroundColor: this.state.colors.bg,
+ borderTopRightRadius: 10,
+ borderTopLeftRadius: 10,
+ }}
+ behavior="padding">
+ <View
+ style={{
+ maxHeight: '100%',
+ }}>
+ <View
+ style={{
+ flexDirection: 'row',
+ alignItems: 'center',
+ borderBottomWidth: 1,
+ borderBottomColor: this.state.colors.nav,
+ paddingHorizontal: 12,
+ justifyContent: 'space-between',
+ }}>
+ <TextInput
+ ref={this.titleInputRef}
+ style={{
+ fontSize: 25,
+ fontWeight: 'bold',
+ color: this.state.colors.pri,
+ flexGrow: 1,
+ maxWidth: '85%',
+ }}
+ placeholderTextColor={this.state.colors.icon}
+ value={this.state.title}
+ onChangeText={(v) => this.setState({title: v})}
+ onSubmitEditing={() => {
+ this.textInputRef.current?.focus();
+ }}
+ blurOnSubmit={false}
+ placeholder="Note title"
+ />
+
+ <TouchableOpacity
+ onPress={this.close}
+ activeOpacity={0.8}
+ style={{
+ width: 60,
+ height: 40,
+ borderRadius: 5,
+ justifyContent: 'center',
+ alignItems: 'center',
+ flexDirection: 'row',
+ }}>
+ <Text
+ style={{
+ fontSize: 16,
+ fontWeight: 'bold',
+ color: this.state.colors.accent,
+ marginLeft: this.state.loading ? 10 : 0,
+ }}>
+ Cancel
+ </Text>
+ </TouchableOpacity>
+ </View>
+
+ <TextInput
+ ref={this.textInputRef}
+ style={{
+ fontSize: 15,
+ color: this.state.colors.pri,
+ marginBottom: 10,
+ width: '100%',
+ maxHeight: '70%',
+ paddingVertical: 10,
+ paddingHorizontal: 12,
+ minHeight: 150,
+ }}
+ placeholderTextColor={this.state.colors.icon}
+ onChangeText={(v) => this.setState({text: v})}
+ multiline={true}
+ value={this.state.text}
+ blurOnSubmit={false}
+ placeholder="Type your note here"
+ />
+ {this.saveBtn()}
+ <View
+ style={{
+ height: 25,
+ }}
+ />
+ </View>
+ </KeyboardAvoidingView>
+ </SafeAreaView>
+ );
+ }
+}
diff --git a/apps/mobile/index.js b/apps/mobile/index.js
index 965afc613..0e3f02383 100644
--- a/apps/mobile/index.js
+++ b/apps/mobile/index.js
@@ -6,6 +6,7 @@ import {name as appName} from './app.json';
let Provider;
let App;
let NotesnookShare;
+let QuickNoteIOS;
const AppProvider = () => {
Provider = require('./src/provider').Provider
@@ -18,7 +19,14 @@ const AppProvider = () => {
};
AppRegistry.registerComponent(appName, () => AppProvider);
+
AppRegistry.registerComponent('NotesnookShare', () => {
NotesnookShare = require("./NotesnookShare").default
return NotesnookShare;
})
+
+AppRegistry.registerComponent('QuickNoteIOS', () => {
+ QuickNoteIOS = require("./QuickNoteIOS").default
+ return QuickNoteIOS;
+})
+
diff --git a/apps/mobile/ios/NotesWidget/Assets.xcassets/AccentColor.colorset/Contents.json b/apps/mobile/ios/NotesWidget/Assets.xcassets/AccentColor.colorset/Contents.json
new file mode 100644
index 000000000..eb8789700
--- /dev/null
+++ b/apps/mobile/ios/NotesWidget/Assets.xcassets/AccentColor.colorset/Contents.json
@@ -0,0 +1,11 @@
+{
+ "colors" : [
+ {
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/apps/mobile/ios/NotesWidget/Assets.xcassets/AppIcon.appiconset/Contents.json b/apps/mobile/ios/NotesWidget/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 000000000..9221b9bb1
--- /dev/null
+++ b/apps/mobile/ios/NotesWidget/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,98 @@
+{
+ "images" : [
+ {
+ "idiom" : "iphone",
+ "scale" : "2x",
+ "size" : "20x20"
+ },
+ {
+ "idiom" : "iphone",
+ "scale" : "3x",
+ "size" : "20x20"
+ },
+ {
+ "idiom" : "iphone",
+ "scale" : "2x",
+ "size" : "29x29"
+ },
+ {
+ "idiom" : "iphone",
+ "scale" : "3x",
+ "size" : "29x29"
+ },
+ {
+ "idiom" : "iphone",
+ "scale" : "2x",
+ "size" : "40x40"
+ },
+ {
+ "idiom" : "iphone",
+ "scale" : "3x",
+ "size" : "40x40"
+ },
+ {
+ "idiom" : "iphone",
+ "scale" : "2x",
+ "size" : "60x60"
+ },
+ {
+ "idiom" : "iphone",
+ "scale" : "3x",
+ "size" : "60x60"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "1x",
+ "size" : "20x20"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "2x",
+ "size" : "20x20"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "1x",
+ "size" : "29x29"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "2x",
+ "size" : "29x29"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "1x",
+ "size" : "40x40"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "2x",
+ "size" : "40x40"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "1x",
+ "size" : "76x76"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "2x",
+ "size" : "76x76"
+ },
+ {
+ "idiom" : "ipad",
+ "scale" : "2x",
+ "size" : "83.5x83.5"
+ },
+ {
+ "idiom" : "ios-marketing",
+ "scale" : "1x",
+ "size" : "1024x1024"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/apps/mobile/ios/NotesWidget/Assets.xcassets/Contents.json b/apps/mobile/ios/NotesWidget/Assets.xcassets/Contents.json
new file mode 100644
index 000000000..73c00596a
--- /dev/null
+++ b/apps/mobile/ios/NotesWidget/Assets.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/apps/mobile/ios/NotesWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json b/apps/mobile/ios/NotesWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json
new file mode 100644
index 000000000..eb8789700
--- /dev/null
+++ b/apps/mobile/ios/NotesWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json
@@ -0,0 +1,11 @@
+{
+ "colors" : [
+ {
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
diff --git a/apps/mobile/ios/NotesWidget/Info.plist b/apps/mobile/ios/NotesWidget/Info.plist
new file mode 100644
index 000000000..d75544cfb
--- /dev/null
+++ b/apps/mobile/ios/NotesWidget/Info.plist
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>$(DEVELOPMENT_LANGUAGE)</string>
+ <key>CFBundleDisplayName</key>
+ <string>NotesWidget</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>NSExtension</key>
+ <dict>
+ <key>NSExtensionPointIdentifier</key>
+ <string>com.apple.widgetkit-extension</string>
+ </dict>
+</dict>
+</plist>
diff --git a/apps/mobile/ios/NotesWidget/NotesWidget.swift b/apps/mobile/ios/NotesWidget/NotesWidget.swift
new file mode 100644
index 000000000..efb784624
--- /dev/null
+++ b/apps/mobile/ios/NotesWidget/NotesWidget.swift
@@ -0,0 +1,75 @@
+//
+// NotesWidget.swift
+// NotesWidget
+//
+// Created by Ammar Ahmed on 25/02/2021.
+//
+
+import WidgetKit
+import SwiftUI
+
+struct Provider: TimelineProvider {
+ func placeholder(in context: Context) -> SimpleEntry {
+ SimpleEntry(date: Date())
+ }
+
+ func getSnapshot(in context: Context, completion: @escaping (SimpleEntry) -> ()) {
+ let entry = SimpleEntry(date: Date())
+ completion(entry)
+ }
+
+ func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
+ var entries: [SimpleEntry] = []
+
+ // Generate a timeline consisting of five entries an hour apart, starting from the current date.
+ let currentDate = Date()
+ for hourOffset in 0 ..< 5 {
+ let entryDate = Calendar.current.date(byAdding: .day, value: hourOffset, to: currentDate)!
+ let entry = SimpleEntry(date: entryDate)
+ entries.append(entry)
+ }
+
+ let timeline = Timeline(entries: entries, policy: .atEnd)
+ completion(timeline)
+ }
+}
+
+struct SimpleEntry: TimelineEntry {
+ let date: Date
+}
+
+struct NotesWidgetEntryView : View {
+ var entry: Provider.Entry
+
+ var body: some View {
+ ZStack {
+
+ VStack {
+ Image(systemName: "plus").font(.system(size: 30))
+ Text("Add a Note").font(.system(size: 20))
+ }.padding()
+
+ }.widgetURL(URL(string: "ShareMedia://QuickNoteWidget"))
+ }
+
+}
+
+@main
+struct NotesWidget: Widget {
+ let kind: String = "NotesWidget"
+
+ var body: some WidgetConfiguration {
+ StaticConfiguration(kind: kind, provider: Provider()) { entry in
+ NotesWidgetEntryView(entry: entry)
+ }
+ .configurationDisplayName("Quick Note")
+ .description("A widget to add notes quickly.")
+ }
+}
+
+struct NotesWidget_Previews: PreviewProvider {
+ static var previews: some View {
+ NotesWidgetEntryView(entry: SimpleEntry(date: Date()))
+ .previewContext(WidgetPreviewContext(family: .systemSmall))
+ }
+}
diff --git a/apps/mobile/ios/Notesnook.xcodeproj/project.pbxproj b/apps/mobile/ios/Notesnook.xcodeproj/project.pbxproj
index 7fc1b3bc9..7d9fbd817 100644
--- a/apps/mobile/ios/Notesnook.xcodeproj/project.pbxproj
+++ b/apps/mobile/ios/Notesnook.xcodeproj/project.pbxproj
@@ -20,6 +20,11 @@
6515C42F2580AA3000E83E39 /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6515C42E2580AA2F00E83E39 /* StoreKit.framework */; };
655FD77A253AD31C001D807D /* Web.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 655FD779253AD31C001D807D /* Web.bundle */; };
659BE46725E11A5100E05671 /* notesnook-text.png in Resources */ = {isa = PBXBuildFile; fileRef = 659BE46625E11A5100E05671 /* notesnook-text.png */; };
+ 65AA857925E6DDEC00772A01 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65AA857825E6DDEC00772A01 /* WidgetKit.framework */; };
+ 65AA857B25E6DDEC00772A01 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65AA857A25E6DDEC00772A01 /* SwiftUI.framework */; };
+ 65AA857E25E6DDEC00772A01 /* NotesWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65AA857D25E6DDEC00772A01 /* NotesWidget.swift */; };
+ 65AA858025E6DDEE00772A01 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 65AA857F25E6DDEE00772A01 /* Assets.xcassets */; };
+ 65AA858425E6DDEE00772A01 /* NotesWidgetExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 65AA857725E6DDEC00772A01 /* NotesWidgetExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
65B5014425A672B200E2D264 /* ShareViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 65B5014325A672B200E2D264 /* ShareViewController.m */; };
65B5014725A672B200E2D264 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 65B5014525A672B200E2D264 /* MainInterface.storyboard */; };
65B5014B25A672B200E2D264 /* Make Note.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 65B5014025A672B200E2D264 /* Make Note.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
@@ -46,6 +51,13 @@
remoteGlobalIDString = 2D02E47A1E0B4A5D006451C7;
remoteInfo = "Notesnook-tvOS";
};
+ 65AA858225E6DDEE00772A01 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 65AA857625E6DDEC00772A01;
+ remoteInfo = NotesWidgetExtension;
+ };
65B5014925A672B200E2D264 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
@@ -62,6 +74,7 @@
dstPath = "";
dstSubfolderSpec = 13;
files = (
+ 65AA858425E6DDEE00772A01 /* NotesWidgetExtension.appex in Embed App Extensions */,
65B5014B25A672B200E2D264 /* Make Note.appex in Embed App Extensions */,
);
name = "Embed App Extensions";
@@ -96,6 +109,12 @@
655FD779253AD31C001D807D /* Web.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = Web.bundle; path = ../html/Web.bundle; sourceTree = "<group>"; };
659BE46625E11A5100E05671 /* notesnook-text.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "notesnook-text.png"; path = "Notesnook/Images.xcassets/notesnook-text.png"; sourceTree = "<group>"; };
65A7F34F255689AD00699170 /* Notesnook.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = Notesnook.entitlements; path = Notesnook/Notesnook.entitlements; sourceTree = "<group>"; };
+ 65AA857725E6DDEC00772A01 /* NotesWidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = NotesWidgetExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
+ 65AA857825E6DDEC00772A01 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };
+ 65AA857A25E6DDEC00772A01 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; };
+ 65AA857D25E6DDEC00772A01 /* NotesWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotesWidget.swift; sourceTree = "<group>"; };
+ 65AA857F25E6DDEE00772A01 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+ 65AA858125E6DDEE00772A01 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
65B5014025A672B200E2D264 /* Make Note.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Make Note.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
65B5014325A672B200E2D264 /* ShareViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ShareViewController.m; sourceTree = "<group>"; };
65B5014625A672B200E2D264 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = "<group>"; };
@@ -155,6 +174,15 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 65AA857425E6DDEC00772A01 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 65AA857B25E6DDEC00772A01 /* SwiftUI.framework in Frameworks */,
+ 65AA857925E6DDEC00772A01 /* WidgetKit.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
65B5013D25A672B200E2D264 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -215,10 +243,22 @@
A03E3F5851D27269540E147C /* libPods-Notesnook-tvOSTests.a */,
41D57E9831C724F59F18FBAE /* libPods-Notesnook-Add to Notes.a */,
5269A46969D8091533003C72 /* libPods-Notesnook-Make Note.a */,
+ 65AA857825E6DDEC00772A01 /* WidgetKit.framework */,
+ 65AA857A25E6DDEC00772A01 /* SwiftUI.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
+ 65AA857C25E6DDEC00772A01 /* NotesWidget */ = {
+ isa = PBXGroup;
+ children = (
+ 65AA857D25E6DDEC00772A01 /* NotesWidget.swift */,
+ 65AA857F25E6DDEE00772A01 /* Assets.xcassets */,
+ 65AA858125E6DDEE00772A01 /* Info.plist */,
+ );
+ path = NotesWidget;
+ sourceTree = "<group>";
+ };
65B5014125A672B200E2D264 /* Make Note */ = {
isa = PBXGroup;
children = (
@@ -246,6 +286,7 @@
832341AE1AAA6A7D00B99B32 /* Libraries */,
00E356EF1AD99517003FC87E /* NotesnookTests */,
65B5014125A672B200E2D264 /* Make Note */,
+ 65AA857C25E6DDEC00772A01 /* NotesWidget */,
83CBBA001A601CBA00E9B192 /* Products */,
2D16E6871FA4F8E400B85C8A /* Frameworks */,
DA84645424CFBF19A44D64B3 /* Pods */,
@@ -263,6 +304,7 @@
2D02E47B1E0B4A5D006451C7 /* Notesnook-tvOS.app */,
2D02E4901E0B4A5D006451C7 /* Notesnook-tvOSTests.xctest */,
65B5014025A672B200E2D264 /* Make Note.appex */,
+ 65AA857725E6DDEC00772A01 /* NotesWidgetExtension.appex */,
);
name = Products;
sourceTree = "<group>";
@@ -329,6 +371,7 @@
);
dependencies = (
65B5014A25A672B200E2D264 /* PBXTargetDependency */,
+ 65AA858325E6DDEE00772A01 /* PBXTargetDependency */,
);
name = Notesnook;
productName = Notesnook;
@@ -375,6 +418,23 @@
productReference = 2D02E4901E0B4A5D006451C7 /* Notesnook-tvOSTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
+ 65AA857625E6DDEC00772A01 /* NotesWidgetExtension */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 65AA858725E6DDEF00772A01 /* Build configuration list for PBXNativeTarget "NotesWidgetExtension" */;
+ buildPhases = (
+ 65AA857325E6DDEC00772A01 /* Sources */,
+ 65AA857425E6DDEC00772A01 /* Frameworks */,
+ 65AA857525E6DDEC00772A01 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = NotesWidgetExtension;
+ productName = NotesWidgetExtension;
+ productReference = 65AA857725E6DDEC00772A01 /* NotesWidgetExtension.appex */;
+ productType = "com.apple.product-type.app-extension";
+ };
65B5013F25A672B200E2D264 /* Make Note */ = {
isa = PBXNativeTarget;
buildConfigurationList = 65B5014C25A672B200E2D264 /* Build configuration list for PBXNativeTarget "Make Note" */;
@@ -401,7 +461,7 @@
83CBB9F71A601CBA00E9B192 /* Project object */ = {
isa = PBXProject;
attributes = {
- LastSwiftUpdateCheck = 1110;
+ LastSwiftUpdateCheck = 1240;
LastUpgradeCheck = 1130;
TargetAttributes = {
00E356ED1AD99517003FC87E = {
@@ -420,6 +480,9 @@
ProvisioningStyle = Automatic;
TestTargetID = 2D02E47A1E0B4A5D006451C7;
};
+ 65AA857625E6DDEC00772A01 = {
+ CreatedOnToolsVersion = 12.4;
+ };
65B5013F25A672B200E2D264 = {
CreatedOnToolsVersion = 12.2;
LastSwiftMigration = 1220;
@@ -444,6 +507,7 @@
2D02E47A1E0B4A5D006451C7 /* Notesnook-tvOS */,
2D02E48F1E0B4A5D006451C7 /* Notesnook-tvOSTests */,
65B5013F25A672B200E2D264 /* Make Note */,
+ 65AA857625E6DDEC00772A01 /* NotesWidgetExtension */,
);
};
/* End PBXProject section */
@@ -482,6 +546,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 65AA857525E6DDEC00772A01 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 65AA858025E6DDEE00772A01 /* Assets.xcassets in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
65B5013E25A672B200E2D264 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@@ -907,6 +979,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 65AA857325E6DDEC00772A01 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 65AA857E25E6DDEC00772A01 /* NotesWidget.swift in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
65B5013C25A672B200E2D264 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -929,6 +1009,11 @@
target = 2D02E47A1E0B4A5D006451C7 /* Notesnook-tvOS */;
targetProxy = 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */;
};
+ 65AA858325E6DDEE00772A01 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 65AA857625E6DDEC00772A01 /* NotesWidgetExtension */;
+ targetProxy = 65AA858225E6DDEE00772A01 /* PBXContainerItemProxy */;
+ };
65B5014A25A672B200E2D264 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 65B5013F25A672B200E2D264 /* Make Note */;
@@ -1322,6 +1407,79 @@
};
name = Release;
};
+ 65AA858525E6DDEF00772A01 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
+ ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+ CLANG_ENABLE_OBJC_WEAK = YES;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
+ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+ CODE_SIGN_IDENTITY = "Apple Development";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
+ CODE_SIGN_STYLE = Automatic;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ DEVELOPMENT_TEAM = 53CWBG3QUC;
+ GCC_C_LANGUAGE_STANDARD = gnu11;
+ INFOPLIST_FILE = NotesWidget/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 14.4;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ "@executable_path/../../Frameworks",
+ );
+ MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
+ MTL_FAST_MATH = YES;
+ PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.NotesWidget;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 65AA858625E6DDEF00772A01 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
+ ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
+ CLANG_ENABLE_OBJC_WEAK = YES;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
+ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+ CODE_SIGN_IDENTITY = "Apple Development";
+ CODE_SIGN_STYLE = Automatic;
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ DEVELOPMENT_TEAM = 53CWBG3QUC;
+ GCC_C_LANGUAGE_STANDARD = gnu11;
+ INFOPLIST_FILE = NotesWidget/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 14.4;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ "@executable_path/../../Frameworks",
+ );
+ MTL_FAST_MATH = YES;
+ PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.NotesWidget;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
+ SWIFT_COMPILATION_MODE = wholemodule;
+ SWIFT_OPTIMIZATION_LEVEL = "-O";
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Release;
+ };
65B5014D25A672B200E2D264 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 279A4325E1D27BD3E720F35B /* Pods-Notesnook-Make Note.debug.xcconfig */;
@@ -1580,7 +1738,7 @@
);
LIBRARY_SEARCH_PATHS = (
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
- "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
+ "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.2/$(PLATFORM_NAME)\"",
"\"$(inherited)\"",
);
MTL_ENABLE_DEBUG_INFO = YES;
@@ -1636,7 +1794,7 @@
);
LIBRARY_SEARCH_PATHS = (
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
- "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"",
+ "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.2/$(PLATFORM_NAME)\"",
"\"$(inherited)\"",
);
MTL_ENABLE_DEBUG_INFO = NO;
@@ -1684,6 +1842,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
+ 65AA858725E6DDEF00772A01 /* Build configuration list for PBXNativeTarget "NotesWidgetExtension" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 65AA858525E6DDEF00772A01 /* Debug */,
+ 65AA858625E6DDEF00772A01 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
65B5014C25A672B200E2D264 /* Build configuration list for PBXNativeTarget "Make Note" */ = {
isa = XCConfigurationList;
buildConfigurations = (
diff --git a/apps/mobile/ios/Notesnook/AppDelegate.m b/apps/mobile/ios/Notesnook/AppDelegate.m
index 3a34a12bb..bec6864ed 100644
--- a/apps/mobile/ios/Notesnook/AppDelegate.m
+++ b/apps/mobile/ios/Notesnook/AppDelegate.m
@@ -8,23 +8,57 @@
#import <MMKV.h>
@implementation AppDelegate
+UINavigationController *navController;
+UIViewController *rootViewController;
+UIViewController *shareViewController;
+RCTBridge *bridge;
+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
-
-
- RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
- RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
- moduleName:@"Notesnook"
- initialProperties:nil];
-
- rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
-
+
+ shareViewController = [UIViewController new];
+
+ NSURL *url = (NSURL *) [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];
+
+ if (url != nil) {
+ navController = [[UINavigationController alloc] initWithRootViewController:shareViewController];
+ } else {
+ rootViewController = [UIViewController new];
+ navController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
+ }
+
+
+ navController.navigationBarHidden = YES;
+
+ bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
+
+
+ if (url != nil) {
+ RCTRootView *shareView = [[RCTRootView alloc] initWithBridge:bridge
+ moduleName:@"QuickNoteIOS"
+ initialProperties:nil];
+ shareView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
+ shareViewController.view = shareView;
+ } else {
+ RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
+ moduleName:@"Notesnook" initialProperties:nil];
+
+ rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
+ rootViewController.view = rootView;
+ }
+
+
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
- UIViewController *rootViewController = [UIViewController new];
- rootViewController.view = rootView;
- self.window.rootViewController = rootViewController;
+
+
+ self.window.rootViewController = navController;
[self.window makeKeyAndVisible];
- [RNSplashScreen show];
+ if (url != nil) {
+ [RNSplashScreen hide];
+ } else {
+ [RNSplashScreen show];
+ }
+
return YES;
}
@@ -50,6 +84,37 @@
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
+
+ if ([url.absoluteString isEqual:@"ShareMedia://QuickNoteWidget"]) {
+ if (rootViewController != nil) {
+
+ RCTRootView *shareView = [[RCTRootView alloc] initWithBridge:bridge
+ moduleName:@"QuickNoteIOS"
+ initialProperties:nil];
+ shareView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
+ shareViewController.view = shareView;
+ [navController pushViewController:shareViewController animated:false];
+ }
+
+ }
+
+ if ([url.absoluteString isEqual:@"ShareMedia://MainApp"]) {
+ if (rootViewController == nil) {
+ UIApplication *app = [UIApplication sharedApplication];
+ [app performSelector:@selector(suspend)];
+ [NSThread sleepForTimeInterval:1.0];
+ exit(0);
+ } else {
+ UIApplication *app = [UIApplication sharedApplication];
+ [app performSelector:@selector(suspend)];
+ [NSThread sleepForTimeInterval:0.5];
+ [navController popToRootViewControllerAnimated:false];
+
+ }
+
+
+ }
+
return [RCTLinkingManager application:application openURL:url options:options];
}
diff --git a/apps/mobile/ios/Notesnook/Info.plist b/apps/mobile/ios/Notesnook/Info.plist
index 51e6a06f5..f332a7f20 100644
--- a/apps/mobile/ios/Notesnook/Info.plist
+++ b/apps/mobile/ios/Notesnook/Info.plist
@@ -78,6 +78,8 @@
<array>
<string>MaterialCommunityIcons.ttf</string>
</array>
+ <key>UIApplicationIsOpaque</key>
+ <false/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>